From 88aef830dfb583294ce29088d0ba92d9cf522d05 Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Fri, 11 Sep 2026 09:42:30 +0800 Subject: [PATCH] refactor(core): CORE-16 type display modes and own fullscreen lifetimes --- docs/compiled/artplayer.js | 2 +- docs/compiled/artplayer.legacy.js | 2 +- docs/compiled/artplayer.mjs | 1660 +- package.json | 2 +- packages/artplayer/ARCHITECTURE.md | 175 + packages/artplayer/dist/artplayer.js | 2 +- packages/artplayer/dist/artplayer.legacy.js | 2 +- packages/artplayer/dist/artplayer.mjs | 1660 +- .../src/display/fullscreen-abandoned.ts | 48 + .../src/display/fullscreen-adapter.ts | 38 + .../src/display/fullscreen-request.ts | 88 + packages/artplayer/src/display/mini-drag.ts | 51 + packages/artplayer/src/display/mini-layout.ts | 24 + packages/artplayer/src/display/mini-view.ts | 79 + packages/artplayer/src/display/mini.ts | 142 + .../src/display/native-fullscreen.ts | 106 + packages/artplayer/src/display/native-pip.ts | 98 + .../src/display/orientation-native.ts | 87 + .../src/display/orientation-types.ts | 16 + .../artplayer/src/display/orientation-web.ts | 72 + packages/artplayer/src/display/placement.ts | 19 + .../artplayer/src/display/sizing-types.ts | 29 + packages/artplayer/src/display/sizing.ts | 24 + packages/artplayer/src/display/types.ts | 71 + .../src/display/video-fullscreen-state.ts | 40 + .../artplayer/src/display/video-fullscreen.ts | 87 + .../artplayer/src/display/web-fullscreen.ts | 99 + packages/artplayer/src/display/webkit-pip.ts | 107 + .../artplayer/src/player/aspectRatioMix.js | 47 - .../artplayer/src/player/aspectRatioMix.ts | 44 + .../artplayer/src/player/autoHeightMix.js | 17 - .../artplayer/src/player/autoHeightMix.ts | 19 + packages/artplayer/src/player/autoSizeMix.js | 28 - packages/artplayer/src/player/autoSizeMix.ts | 30 + packages/artplayer/src/player/flipMix.js | 28 - packages/artplayer/src/player/flipMix.ts | 23 + .../artplayer/src/player/fullscreenMix.js | 88 - .../artplayer/src/player/fullscreenMix.ts | 35 + .../artplayer/src/player/fullscreenWebMix.js | 41 - .../artplayer/src/player/fullscreenWebMix.ts | 13 + packages/artplayer/src/player/miniMix.js | 134 - packages/artplayer/src/player/miniMix.ts | 7 + packages/artplayer/src/player/pipMix.js | 87 - packages/artplayer/src/player/pipMix.ts | 25 + .../artplayer/src/plugins/autoOrientation.js | 101 - .../artplayer/src/plugins/autoOrientation.ts | 30 + packages/artplayer/src/plugins/builtins.ts | 8 +- packages/artplayer/src/style/mini.less | 2 + .../baselines/display-mini-validation.json | 1712 ++ .../baselines/display-native-validation.json | 728 + .../display-orientation-validation.json | 2101 +++ .../baselines/display-pip-validation.json | 1344 ++ .../baselines/display-sizing-validation.json | 1915 +++ refactor/baselines/display-validation.json | 13360 ++++++++++++++++ .../baselines/display-video-validation.json | 1469 ++ .../baselines/display-web-validation.json | 4245 +++++ .../changes/2026-09-11-CORE-16-display.md | 144 + refactor/plan.md | 5 +- refactor/progress.md | 8 + refactor/risk-table.md | 14 + refactor/risks.json | 303 + refactor/tasks.json | 7 +- test/browser/display-mini.spec.js | 285 + test/browser/display-native.spec.js | 251 + test/browser/display-orientation.spec.js | 161 + test/browser/display-pip-webkit.spec.js | 77 + test/browser/display-pip.spec.js | 161 + test/browser/display-sizing.spec.js | 161 + test/browser/display-video-fullscreen.spec.js | 99 + test/browser/display-web.spec.js | 233 + test/display-mini.test.js | 30 + test/display-native.test.js | 324 + test/display-orientation.test.js | 141 + test/display-pip.test.js | 215 + test/display-sizing.test.js | 43 + test/display-video-fullscreen.test.js | 151 + test/types/display-mini.ts | 13 + test/types/display-orientation.ts | 14 + test/types/display-pip.ts | 13 + test/types/display-sizing.ts | 21 + test/types/display-web.ts | 15 + 81 files changed, 33897 insertions(+), 1503 deletions(-) create mode 100644 packages/artplayer/src/display/fullscreen-abandoned.ts create mode 100644 packages/artplayer/src/display/fullscreen-adapter.ts create mode 100644 packages/artplayer/src/display/fullscreen-request.ts create mode 100644 packages/artplayer/src/display/mini-drag.ts create mode 100644 packages/artplayer/src/display/mini-layout.ts create mode 100644 packages/artplayer/src/display/mini-view.ts create mode 100644 packages/artplayer/src/display/mini.ts create mode 100644 packages/artplayer/src/display/native-fullscreen.ts create mode 100644 packages/artplayer/src/display/native-pip.ts create mode 100644 packages/artplayer/src/display/orientation-native.ts create mode 100644 packages/artplayer/src/display/orientation-types.ts create mode 100644 packages/artplayer/src/display/orientation-web.ts create mode 100644 packages/artplayer/src/display/placement.ts create mode 100644 packages/artplayer/src/display/sizing-types.ts create mode 100644 packages/artplayer/src/display/sizing.ts create mode 100644 packages/artplayer/src/display/types.ts create mode 100644 packages/artplayer/src/display/video-fullscreen-state.ts create mode 100644 packages/artplayer/src/display/video-fullscreen.ts create mode 100644 packages/artplayer/src/display/web-fullscreen.ts create mode 100644 packages/artplayer/src/display/webkit-pip.ts delete mode 100644 packages/artplayer/src/player/aspectRatioMix.js create mode 100644 packages/artplayer/src/player/aspectRatioMix.ts delete mode 100644 packages/artplayer/src/player/autoHeightMix.js create mode 100644 packages/artplayer/src/player/autoHeightMix.ts delete mode 100644 packages/artplayer/src/player/autoSizeMix.js create mode 100644 packages/artplayer/src/player/autoSizeMix.ts delete mode 100644 packages/artplayer/src/player/flipMix.js create mode 100644 packages/artplayer/src/player/flipMix.ts delete mode 100644 packages/artplayer/src/player/fullscreenMix.js create mode 100644 packages/artplayer/src/player/fullscreenMix.ts delete mode 100644 packages/artplayer/src/player/fullscreenWebMix.js create mode 100644 packages/artplayer/src/player/fullscreenWebMix.ts delete mode 100644 packages/artplayer/src/player/miniMix.js create mode 100644 packages/artplayer/src/player/miniMix.ts delete mode 100644 packages/artplayer/src/player/pipMix.js create mode 100644 packages/artplayer/src/player/pipMix.ts delete mode 100644 packages/artplayer/src/plugins/autoOrientation.js create mode 100644 packages/artplayer/src/plugins/autoOrientation.ts create mode 100644 refactor/baselines/display-mini-validation.json create mode 100644 refactor/baselines/display-native-validation.json create mode 100644 refactor/baselines/display-orientation-validation.json create mode 100644 refactor/baselines/display-pip-validation.json create mode 100644 refactor/baselines/display-sizing-validation.json create mode 100644 refactor/baselines/display-validation.json create mode 100644 refactor/baselines/display-video-validation.json create mode 100644 refactor/baselines/display-web-validation.json create mode 100644 refactor/changes/2026-09-11-CORE-16-display.md create mode 100644 test/browser/display-mini.spec.js create mode 100644 test/browser/display-native.spec.js create mode 100644 test/browser/display-orientation.spec.js create mode 100644 test/browser/display-pip-webkit.spec.js create mode 100644 test/browser/display-pip.spec.js create mode 100644 test/browser/display-sizing.spec.js create mode 100644 test/browser/display-video-fullscreen.spec.js create mode 100644 test/browser/display-web.spec.js create mode 100644 test/display-mini.test.js create mode 100644 test/display-native.test.js create mode 100644 test/display-orientation.test.js create mode 100644 test/display-pip.test.js create mode 100644 test/display-sizing.test.js create mode 100644 test/display-video-fullscreen.test.js create mode 100644 test/types/display-mini.ts create mode 100644 test/types/display-orientation.ts create mode 100644 test/types/display-pip.ts create mode 100644 test/types/display-sizing.ts create mode 100644 test/types/display-web.ts diff --git a/docs/compiled/artplayer.js b/docs/compiled/artplayer.js index 7de5ddfd6..cded353cc 100644 --- a/docs/compiled/artplayer.js +++ b/docs/compiled/artplayer.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!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 o=(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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,o,n=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};o&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,n||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),n&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=v(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 S(t,e=document){return e.querySelector(t)}function z(t,e=document){return Array.from(e.querySelectorAll(t))}function L(t,e){return t.classList.add(e)}function M(t,e){return t.classList.remove(e)}function P(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function R(t,e,r){return t.style[e]=r,t}function O(t,e){for(const r in e)R(t,r,e[r]);return t}function I(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function _(t,e){I(t).forEach(t=>M(t,e)),L(t,e)}function V(t,e,r="top"){E||(t.setAttribute("aria-label",e),L(t,"hint--rounded"),L(t,`hint--${r}`))}function N(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function D(t,e){return q(t).includes(e)}function W(t,e){return e.parentNode.replaceChild(t,e),t}function Y(t){return document.createElement(t)}function F(t="",e=""){const r=Y("i");return L(r,"art-icon"),L(r,`art-icon-${t}`),A(r,e),r}function B(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function H(t){return t.getBoundingClientRect()}function j(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function q(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}function U(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class X extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function G(t,e){if(!t)throw new X(e);return t}function K(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function Z(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function J(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function Q(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function tt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function et(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const rt={"&":"&","<":"<",">":">","'":"'",'"':"""},ot={"&":"&","<":"<",">":">","'":"'",""":'"'},nt=/(&|<|>|'|")/g;function at(t){return t.replace(/[&<>'"]/g,t=>rt[t]||t)}const it=Object.defineProperty,{hasOwnProperty:st}=Object.prototype;function lt(t,e){return st.call(t,e)}function ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?dt(n,a):a,it(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function pt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 ut(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ht(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 ft(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const mt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:X,addClass:L,append:A,assToVtt:ht,capitalize:tt,clamp:Q,createElement:Y,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:it,download:J,errorHandle:G,escape:at,get:ct,getComposedPath:q,getExt:Z,getIcon:F,getRect:H,getSafeAreaInsets:U,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:lt,hasClass:P,includeFromEvent:D,inverseClass:_,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:N,isMobile:E,isSafari:x,loadImg:j,mergeDeep:dt,query:S,queryAll:z,remove:function(t){return t.parentNode.removeChild(t)},removeClass:M,replaceElement:W,secondToTime:et,setStyle:R,setStyleText:C,setStyles:O,siblings:I,silencePromise:K,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:pt,supportsFlex:B,throttle:ft,tooltip:V,unescape:function(t){return t.replace(nt,t=>ot[t]||t)},userAgent:w,vttToBlob:ut},Symbol.toStringTag,{value:"Module"}));function gt(t,e){return A(t,e)}function vt(t,e){return e.querySelector(t)}const yt="array",bt="boolean",wt="string",xt="number",kt="object",$t="function";function Et(t,e,r){return G(e===wt||e===xt||t instanceof Element,`${r.join(".")} require '${wt}' or 'Element' type`)}const Tt={html:Et,disable:`?${bt}`,name:`?${wt}`,index:`?${xt}`,style:`?${kt}`,click:`?${$t}`,mounted:`?${$t}`,tooltip:`?${wt}|${xt}`,width:`?${xt}`,selector:`?${yt}`,onSelect:`?${$t}`,switch:`?${bt}`,onSwitch:`?${$t}`,range:`?${yt}`,onRange:`?${$t}`,onChange:`?${$t}`},Ct={id:wt,container:Et,url:wt,poster:wt,type:wt,theme:wt,lang:wt,volume:xt,isLive:bt,muted:bt,autoplay:bt,autoSize:bt,autoMini:bt,loop:bt,flip:bt,playbackRate:bt,aspectRatio:bt,screenshot:bt,setting:bt,hotkey:bt,pip:bt,mutex:bt,backdrop:bt,fullscreen:bt,fullscreenWeb:bt,subtitleOffset:bt,miniProgressBar:bt,useSSR:bt,playsInline:bt,lock:bt,gesture:bt,fastForward:bt,autoPlayback:bt,autoOrientation:bt,airplay:bt,proxy:`?${$t}`,plugins:[$t],layers:[Tt],contextmenu:[Tt],settings:[Tt],controls:[{...Tt,position:(t,e,r)=>{const o=["top","left","right"];return G("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}}],quality:[{default:`?${bt}`,html:wt,url:wt}],highlight:[{time:xt,text:wt}],thumbnails:{url:wt,number:xt,column:xt,width:xt,height:xt,scale:xt},subtitle:{url:wt,name:wt,type:wt,style:kt,escape:bt,encoding:wt,onVttLoad:$t},moreVideoAttr:kt,i18n:kt,icons:kt,cssVar:kt,customType:kt},St=new WeakSet;class zt{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 P(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?L(e,r):M(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",n(e,Tt),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,o=this.cache;G(!o.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){L(t,`art-${r}`),L(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&O(t,a.style),a.tooltip&&V(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,r,a),c=!0,o.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw o.get(r)?.$ref===a&&o.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){G(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!St.has(e)){St.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{St.delete(e)}}}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 Lt extends zt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="1"]',t);o&&_(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).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:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="default"]',t);o&&_(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).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:o}}=e,n=o.map(t=>`${r.get(tt(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="normal"]',t);o&&_(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=H(e),{height:c,width:d}=H(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),O(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{D(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Mt(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function Pt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function At(t,e){const{$progress:r}=t.template,{left:o}=H(r),n=Q((E?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:et(a),width:n,percentage:Q(n/r.clientWidth,0,1)}}function Rt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=At(t,e);t.emit("setBar","played",o,e),t.seek=r}}function Ot(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=vt(".art-progress-hover",e),c=vt(".art-progress-loaded",e),d=vt(".art-progress-played",e),p=vt(".art-progress-highlight",e),u=vt(".art-progress-indicator",e),h=vt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||At(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?R(h,"left",0):n>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",n-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*o+"%"),"hover"===r&&(R(l,"width",100*o+"%"),D(i,p)?function(r){const{width:o}=At(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=n??"";const a=h.clientWidth;o<=a/2?R(h,"left",0):o>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",o-a/2+"px")}(i):f(i),0===o?M(n,"art-progress-hover"):L(n,"art-progress-hover")),"played"===r&&(R(d,"width",100*o+"%"),R(u,"left",100*o+"%")),m){L(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:et(o*t.duration)}),s(),s=Mt(a,()=>{M(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function It(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{Ot(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==o&&Rt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=At(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=At(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function _t(t){const{option:e}=t.art;e.isLive||t.add(It({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.play),s=gt(t,n.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}V(i,a.get("Play")),V(s,a.get("Pause")),o(i,"click",()=>{K(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n}=e,a=gt(t,n.volume),i=gt(t,n.volumeClose),s=gt(t,'
'),l=gt(s,'
'),c=gt(l,'
'),d=gt(l,'
'),p=gt(d,'
'),u=gt(p,'
'),h=gt(d,'
');function f(t){const{top:e,height:r}=H(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function o(){const r=`${et(e.currentTime)} / ${et(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;gt(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;gt(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{V(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;gt(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{V(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;gt(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.fullscreenWebOn),s=gt(t,n.fullscreenWebOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(V(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(V(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.fullscreenOn),s=gt(t,n.fullscreenOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(V(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(V(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rNt.get(t).option.selector}),it(t,"$control_item",{get:()=>Nt.get(t).item}),it(t,"$control_value",{get:()=>Nt.get(t).value})),Nt.set(t,e)}function Wt(t,e){t.innerHTML=e}function Yt(t,e,r,o,n){const{proxy:a}=t.events,i=v(o),s=r.selector;L(o,"art-control-selector");const l=document.createElement("div");L(l,"art-selector-value"),A(l,r.html),o.textContent="",A(o,l);const c=gt(o,'
');for(let u=0;u{if(i.closed)return;const n=q(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Vt.set(t,e),()=>{Vt.get(t)===e&&Vt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,o);c()&&Wt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});n.push(p)}class Ft extends zt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;g(t,o);const{on:n}=b(t,o);n("mousemove",()=>{E||(this.show=!0)}),n("click",()=>{E?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=D(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(M(r,"art-hide-cursor"),L(r,"art-hover"),this.timer=Date.now()):(L(r,"art-hide-cursor"),M(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=v(e),{on:a}=b(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){_t(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:G(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Wt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Bt(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function Ht(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const jt=new WeakMap;class qt{constructor(t){this.destroyEvents=new Set;const e=u(t);jt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){D(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&n&&K(t.toggle()):K(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&K(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=>{L(r,"art-hover"),t.emit("hover",!0,e)},e=>{M(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=u(t);let a=()=>{};const i=()=>{a(),a=Mt(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&Rt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=Bt(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=Q((o-i)/t.width,-1,1),d=Q((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=Q(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",Q(h/t.duration,0,1),e),t.notice.show=`${et(h)} / ${et(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=ft(()=>{t.emit("view",N(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{const o=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(o,r,e=>{t.emit(`window:${r}`,e)});n.push(s)})}a(),e.bindGlobalEvents=a}(t,this),Ht(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(jt.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 Ut{constructor(t){this.art=t,this.keys={},E||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",()=>{K(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Zt{constructor(t){const e={...Kt,...t.option.icons};for(const r in e)it(this,r,{get:()=>F(r,e[r])})}}class Jt extends zt{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=z("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(n,"display","none"),R(a,"display",null)}),o.proxy(e.$state,"click",()=>K(t.play()))}}class re{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,L(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.textContent="",M(r,"art-notice-show")},e.NOTICE_TIME)):M(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function oe(t,e,r,o=!1){const n=e=>{h(t)||r(e)};t[o?"once":"on"](e,n),u(t).add(()=>{t.off(e,n)})}function ne(t,e,r){for(const[o,n]of e){if(h(t)||r&&!r())return;t[o].show=n}}const ae=new WeakMap,ie=new WeakMap,se=new WeakMap;function le(t){return se.get(t)||u(t)}function ce(t){const e=ae.get(t),r=se.get(t);return()=>ae.get(t)===e&&(!e||e.active())&&se.get(t)===r&&(!r||!r.closed)}function de(t){const e=se.get(t),r=u(t).child(),o=r.child();se.set(t,r),r.add(()=>{se.get(t)===r&&se.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!o.closed&&ae.get(t)===n};return ae.set(t,n),o.add(()=>{ae.get(t)===n&&ae.delete(t),n.onAssigned=void 0,n.onError=void 0}),e?.dispose(),n}function pe(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function ue(t,e,r){ie.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ie.get(t)===e&&(ie.delete(t),pe(e))}}function he(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function fe(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=le(t),l=0;return{reset(){l=0,i?.dispose(),M(a,"art-error")},loadStart(){M(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=le(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===le(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function me(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=fe(t);!function(t,e){oe(t,"video:canplay",()=>{e.reset(),ne(t,[["loading",!1]])}),oe(t,"video:canplay",()=>{ne(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;oe(t,"video:ended",()=>{if(e.loop){const e=ce(t);if(t.seek=0,h(t)||!e())return;K(t.play()),e()&&ne(t,[["controls",!1],["mask",!1]],e)}else ne(t,[["controls",!0],["mask",!0]])})}(t),oe(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;oe(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&ne(t,[["loading",!1],["controls",!0],["mask",!0]])}),oe(t,"video:loadstart",()=>{e.loadStart(),ne(t,[["loading",!0],["mask",!1],["controls",!0]])}),oe(t,"video:pause",()=>{ne(t,[["controls",!0],["mask",!0]])}),oe(t,"video:play",()=>{ne(t,[["mask",!1]]),h(t)||R(r,"display","none")}),oe(t,"video:playing",()=>ne(t,[["mask",!1]])),oe(t,"video:progress",()=>{t.playing&&ne(t,[["loading",!1]])}),oe(t,"video:seeked",()=>ne(t,[["loading",!1],["mask",!0]])),oe(t,"video:seeking",()=>ne(t,[["loading",!0],["mask",!1]])),oe(t,"video:timeupdate",()=>ne(t,[["mask",!1]])),oe(t,"video:waiting",()=>ne(t,[["loading",!0],["mask",!1]]))}(t,e)}const ge=[["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"]],ve=(()=>{if("undefined"===typeof document)return!1;const t=ge[0],e={};for(const r of ge){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),ye={change:ve.fullscreenchange,error:ve.fullscreenerror},be={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{be.off("change",n),r()};be.on("change",n);const a=t[ve.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!be.isFullscreen)return void t();const r=()=>{be.off("change",r),t()};be.on("change",r);const o=document[ve.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>be.isFullscreen?be.exit():be.request(t,e),onchange(t){be.on("change",t)},onerror(t){be.on("error",t)},on(t,e){const r=ye[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=ye[t];r&&document.removeEventListener(r,e,!1)},raw:ve};function we(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;t.once("video:loadedmetadata",()=>{var a;be.isEnabled?(a=t,be.on("change",()=>{a.emit("fullscreen",be.isFullscreen),be.isFullscreen?(a.state="fullscreen",L(n,"art-fullscreen")):M(n,"art-fullscreen"),a.emit("resize")}),be.on("error",t=>{a.emit("fullscreenError",t)}),it(a,"fullscreen",{get:()=>be.isFullscreen,async set(t){t?await be.request(n):await be.exit()}})):o.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),it(t,"fullscreen",{get:()=>document.fullscreenElement===o,set(e){e?(t.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})})(t):it(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),it(t,"fullscreen",ct(t,"fullscreen"))})}function xe(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(M(n,"art-mini"),R(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(R(e,"display","none"),R(r,"display","flex")):(R(e,"display","flex"),R(r,"display","none"))}function p(){const{$mini:e}=t.template,r=H(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),R(e,"top",`${n}px`),R(e,"left",`${a}px`)}it(t,"mini",{get:()=>P(n,"art-mini"),set(u){if(u){t.state="mini",L(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return A(n,a),R(n,"display","flex");{const n=Y("div");L(n,"art-mini-popup"),A(document.body,n),t.template.$mini=n,A(n,a);const p=A(n,'
');A(p,e.close),r(p,"click",c);const u=A(n,'
'),h=A(u,e.play),f=A(u,e.pause);return r(h,"click",()=>K(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){L(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;R(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,M(n,"art-mini-dragging");const t=H(n);o.set("left",t.left),o.set("top",t.top),R(n,"left",`${t.left}px`),R(n,"top",`${t.top}px`),R(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(R(u,"top",`${h}px`),R(u,"left",`${f}px`),N(u)||p()):p(),t.emit("mini",!0)}else c()}})}function ke(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,it(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),it(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):it(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function $e(t){it(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Vt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${n.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(o.show=r)}return e.html}})}})}function Ee(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Te(t,e,r){return new Promise((o,n)=>{if(h(t)||e===t.url)return void o();const a=de(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Ee(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(ue(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Ee(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Ce(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",async(n,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===n||"played"===n&&l&&E){if(i||a||(a=!0,i=await j(d,p),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",n-u/2+"px")}(n)}}),it(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function Se(t){const{option:e,template:{$video:r}}=t;it(t,"url",{get:()=>r.src,async set(o){if(h(t))return;const n=function(t){const e=ie.get(t);return ie.delete(t),e||de(t)}(t);n.acceptingEvents=!1;try{if(!o)return void(await Pt(n.scope)&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||Z(o),s=e.customType[i];if(i&&s){if(!(await Pt(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;Ee(l,t,"video:canplay",()=>{c=!d}),Ee(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>he(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||Ee(n.scope,t,"video:canplay",e)}}catch(a){he(n,a)}finally{pe(n)}}})}Object.defineProperties(be,{isFullscreen:{get:()=>Boolean(document[ve.fullscreenElement])},element:{enumerable:!0,get:()=>document[ve.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ve.fullscreenEnabled])}});class ze{constructor(t){Se(t),function(t){const{template:{$video:e}}=t;it(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;it(t,"play",{async value(){const i=ce(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;it(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${et(t.currentTime)} / ${et(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;it(t,"forward",{set(e){r.seek=t.currentTime+e}}),it(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;it(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=Q(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),it(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;it(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=Q(o,0,t.duration))}})}(t),function(t){it(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Te(t,e,0);it(t,"switchQuality",{value:e=>Te(t,e,t.currentTime)}),it(t,"switchUrl",{value:e}),it(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;it(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;it(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)R(o,"width",null),R(o,"height",null),R(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(R(o,"width",s*r+"px"),R(o,"height","100%"),R(o,"margin","0 auto")):(R(o,"width","100%"),R(o,"height",e/s+"px"),R(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=Y("canvas");it(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),it(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),it(t,"screenshot",{value:async e=>{const o=await t.getDataURL();return J(o,`${e||`artplayer_${et(r.currentTime)}`}.png`),t.emit("screenshot",o),o}})}(t),we(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";it(t,"fullscreenWeb",{get:()=>P(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&A(document.body,o),t.state="fullscreenWeb",R(o,"width","100%"),R(o,"height","100%"),L(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&A(r,o),n&&(o.style.cssText=n,n=""),M(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),ke(t),function(t){const{$video:e}=t.template,r=t;it(t,"loaded",{get:()=>r.loadedTime/e.duration}),it(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){it(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;it(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:o}=t.template;it(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=H(e),l=n/a;if(i/s>l)R(r,"width",s*l/i*100+"%"),R(r,"height","100%");else{const t=i/l/s*100;R(r,"width","100%"),R(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;it(t,"rect",{get:()=>H(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}it(t,"x",{get:()=>e.left+window.pageXOffset}),it(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;it(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(tt(n))}`,t.emit("flip",n)}})}(t),xe(t),function(t){const{template:{$poster:e}}=t;it(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;it(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);R(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;it(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){it(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){it(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];it(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;oo.$track?.offset||0,set(n){const{cues:a}=t.subtitle;if(!o.$track||0===a.length)return;const i=Q(n,-10,10);o.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,it(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),$e(t),Ce(t),me(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=Q(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=Q(a,0,1)),e.poster&&R(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Le(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!P(o,a)&&function(){const e=U(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;R(o,"width",`${n}px`),R(o,"height",`${i}px`),R(o,"transform-origin","0 0"),R(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),L(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else P(o,a)&&(R(o,"width",""),R(o,"height",""),R(o,"transform-origin",""),R(o,"transform",""),M(o,a),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,L(o,i)}catch(n){s=!1,e.show=n}}else if(P(o,i)&&M(o,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return P(o,a)}}}function Me(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=S(".art-auto-playback-last",s),c=S(".art-auto-playback-jump",s),d=S(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${et(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,K(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Pe(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,M(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,L(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return P(o,"art-fast-forward")}}}function Ae(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return P(o,"art-lock")}function a(){L(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){M(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=A(e,r.lock),n=A(e,r.unlock);R(o,"display","none"),t.on("lock",t=>{t?(R(o,"display","inline-flex"),R(n,"display","none")):(R(o,"display","none"),R(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function Re(t){return t.on("control",e=>{e?M(t.template.$player,"art-mini-progress-bar"):L(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Oe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(Re),!h(t.art)&&e.lock&&E&&t.add(Ae),h(t.art)||!e.autoPlayback||e.isLive||t.add(Me),!h(t.art)&&e.autoOrientation&&E&&t.add(Le),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(Pe)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){G(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let n=o;const a=lt(t,n);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return h(t.art)||(G(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),h(t.art)||it(t,n,{value:r})),t}(this,t,e)}}const Ie=new WeakMap;function _e(t){return!t.closed&&!Ie.get(t)}function Ve(t){Ie.set(t,(Ie.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Ie.get(t)||1)-1;r?Ie.set(t,r):Ie.delete(t)}}const Ne=new WeakMap,De=new WeakMap,We=["$parent","$parents","$option","$events","$formatted"];function Ye(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=Ne.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(Ne.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function Fe(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function Be(t){const e=Ne.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function He(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Ze(t,n)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(n.push(...a.splice(0)),Ke.set(r,n),Xe.set(e,r),Ge.set(e,o)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function rr(t,e,r,o,n,a){const i=a||Qe(e);if(!_e(i)||h(t))return;const s=t.proxy(r,o,e=>{if(_e(i)&&!h(t))try{return n(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!_e(i)||h(t)?t.events.remove(s):(Be(e).events.push(s),a&&a!==Xe.get(e)&&a.add(()=>{const r=Be(e).events,o=r.indexOf(s);o>=0&&(r.splice(o,1),t.events.remove(s))}))}function or(t,e,r,o){const n=Qe(e);if(!_e(n)||h(t))return;const a=(...e)=>{if(_e(n)&&!h(t))return o(...e)};t.on(r,a),n.add(()=>{t.off(r,a)})}function nr(t){const{art:e,active:r}=t,{controls:o,constructor:{SETTING_WIDTH:n,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!o.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=o.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:o,rows:n,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,o),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,n*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||n,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const ar=new WeakMap;function ir(t){ar.delete(t)}const sr=new WeakMap;function lr(t,e){e?sr.set(t,e):sr.delete(t)}function cr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],o=sr.get(t),n=o?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,o]of e)Object.defineProperty(t,r,o);n?.(),lr(t,o);for(const{node:t,parent:e,next:o}of r)e?e.insertBefore(t,o?.parentNode===e?o:null):t.parentNode?.removeChild(t)}}const dr=new WeakMap;async function pr(t,e,r,o,n,a,i,s){try{const l=Qe(e),c=Qe(a),d=(dr.get(a)||0)+1;dr.set(a,d);const p=()=>_e(l)&&_e(c)&&!h(t.art)&&dr.get(a)===d;if(s?.(),!p())return;const u=await n.call(t.art,e,r,o);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function ur(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}const hr=new WeakMap;function fr(t){const e=[];for(const o of t)try{o()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function mr(t){hr.get(t)?.()}function gr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);ir(r),mr(r);const o=cr(r),n=r.$item,a=n?.parentNode,i=n?.nextSibling,s=n?ur(n):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,o=new Set,n=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&o.add(r),e.selector.forEach(n)}};n(e);const a=[],i=[];try{for(const e of r){const r=er(t.art,e);r&&a.push(r)}for(const t of o)i.push(Ve(qe(t)))}catch(l){try{fr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,fr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,fr([...a.reverse().map(t=>t.dispose),...Array.from(o).reverse().map(t=>()=>Ue(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{fr([d.resume,()=>{e&&e!==n&&e.remove()},o,()=>s?.(),()=>{a&&n&&a.insertBefore(n,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&_(t.cache.get(l),"art-current");for(const[e,r,o]of c)t.$parent.style.setProperty(e,r,o)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&hr.get(r)===m;for(const u of d.items)hr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);d.dispose()});try{if(function(t,e,r){for(const o of Reflect.ownKeys(e)){if(!r())return;const n=Object.getOwnPropertyDescriptor(e,o);if(!n?.enumerable||!r())continue;const a=Reflect.get(e,o);if(!r())return;if(!Reflect.set(t,o,a))throw new TypeError(`Cannot assign setting item property [${String(o)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const vr=new WeakMap;function yr(t,e,r){it(t,`$${e}`,{configurable:!0,get:()=>r}),it(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function br(t,e,r=!1){const o=function(t){const e=hr.get(t);return()=>!e||hr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const n=t.cache.get(e.$option),a=e.$item;let i="selector";lt(e,"switch")&&(i="switch"),lt(e,"range")&&(i="range"),lt(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!o())return;const c=function(t,e,r=u(t)){const o=Xe.get(e);(!o||_e(o)||o.closed)&&tr(t,e);const n=r.child();return Xe.set(e,n),Ge.set(e,r),Ke.set(n,Be(e).events),n.add(()=>{Ze(t,Ke.get(n))}),n}(t.art,e,qe(n)),d=()=>_e(c)&&!h(t.art)&&o();if(!d())return;const p=document.createElement("div");try{if(lr(e),L(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const o=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(L(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(o,f),!d())return;yr(e,"icon",f);const m=document.createElement("div");L(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(o,m),yr(e,"html",m);const v=document.createElement("div");L(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),yr(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");L(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),o=A(t,s.switchOff),n=e.switch;if(!d())return;R(n?o:r,"display","none"),A(u,t),it(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;lr(e,()=>{const t=a;return()=>{a=t}}),it(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(o,"display","none"),R(r,"display",null)):(R(o,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");L(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[n,a]of["value","min","max","step"].entries()){const t=e.range[n];if(!d())return;Reflect.set(r,a,String(t))}L(r,"art-setting-range"),A(u,t),it(e,"$range",{configurable:!0,get:()=>r});let o=[...e.range];if(!d())return;lr(e,()=>{const t=o,e=[...t],n={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),o=t,Object.assign(r,n)}}),it(e,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");L(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,o){const{art:n}=t,a=Qe(e),i=(t,r,o)=>rr(n,e,t,r,o,a);switch(o){case"switch":e.onSwitch&&i(r,"click",o=>pr(t,e,r,o,e.onSwitch,e,"switch"));break;case"range":{const o=e.$range;if(o)for(const[n,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(o,n,n=>pr(t,e,r,n,e[a],e,"tooltip",()=>{e.range[0]=o.valueAsNumber}));break}case"selector":i(r,"click",o=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return pr(t,e,r,o,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&L(r,"art-current");break;case"button":e.onClick&&i(r,"click",o=>pr(t,e,r,o,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;it(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(n,p),e.mounted&&d()&&Mt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function wr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!_e(qe(r)))return;const o=(vr.get(t)||0)+1;vr.set(t,o);const n=()=>vr.get(t)===o&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&_(t.cache.get(a),"art-current");for(const[e,r,o]of i)t.$parent.style.setProperty(e,r,o)};if(t.active=e,r)try{_(r,"art-current"),t.resize()}catch(l){throw n()&&t.cache.get(e)===r&&!qe(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const o=function(t,e,r){const o=u(t.art).child();return je.set(r,o),o.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),o}(t,e,r),a=()=>!o.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;L(r,"art-setting-panel"),A(t.$parent,r),_(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=De.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),o=(t,o)=>{if(r.closed||h(e))return;const n=(...t)=>{if(!r.closed&&!h(e))return o(...t)};e.on(t,n),r.add(()=>{e.off(t,n)})};o("blur",()=>{t.show&&(t.show=!1,t.render())}),o("focus",r=>{const o=D(r,e.controls.setting),n=D(r,t.$parent);!t.show||o||n||(t.show=!1,t.render())}),o("resize",()=>t.resize());const n=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&n()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(n);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(n);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,FLIP:n}}=t;function a(t){return e.get(tt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:o}=t;return{width:o.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)=>{or(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){He(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&_(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,o=[]){this.option=function(t,e,r,o,n=[]){const a=De.get(t)||{active:!0},i=[],s=new Set,l=new Set(n),c=(t,e,r)=>{for(let o=0;oBe(t).parent},$parents:{get:()=>Be(t).parents},$option:{get:()=>Be(t).option},$events:{get:()=>Be(t).events},$formatted:{get:()=>!0}}),Ne.set(t,{parent:r,parents:o,option:n,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||n.push(p.name);return t.id=d,e}(this,t,e,r,o)}find(t=""){return function(t,e=""){let r=null;return He(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){nr(this)}inactivate(t){!function(t,e){const r=[],o=new Set,n=e=>{if(!o.has(e)){o.add(e);for(const t of e.selector||[])n(t);if(e.selector){const o=t.cache.get(e.selector);t.cache.delete(e.selector);try{o&&Ue(o)}catch(a){r.push(a)}}try{tr(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(n(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);G(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{ir(t),mr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const o=e.$item,n=[];for(const i of[()=>this.inactivate(e),()=>o?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?n.push(...a.errors):n.push(a)}if(n.length)throw new s(n)}update(t){return gr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const o=e.length,n=r?void 0:function(t){const e={};ar.set(t,e);const r=()=>ar.get(t)===e;return{current:r,finish(){r()&&ar.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||n&&!n.current())throw i;if(e[o]===t&&e.splice(o,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{n?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:o},constructor:{SETTING_ITEM_HEIGHT:n}}=t.art,a=document.createElement("div");R(a,"height",`${n}px`),L(a,"art-setting-item"),L(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");L(s,"art-setting-item-left-icon"),A(s,o),A(i,s),A(i,e.$parent.html),rr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),qe(r)),A(r,a)}(this,t)}createItem(t,e=!1){br(this,t,e)}render(t=this.option){wr(this,t)}}class $r{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const Er='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Tr{constructor(t){this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope)?.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}async run(t){if(this.active)try{return await Promise.race([t(),this.cancelled])}finally{this.cancel()}}}const Cr=new WeakMap;function Sr(t){return Cr.get(t)}function zr(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const Lr=zt;class Mr extends Lr{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=u(e).child(),o={scope:r,revision:0,render:0,trackRevision:0};return Cr.set(t,o),r.add(()=>{zr(o)}),o}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const o=()=>{if(e.scope.closed||!this.url)return;const o=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof o&&o!==r&&(r=o,this.createTrack(o?"subtitles":"metadata",this.url))};t.on("video:timeupdate",o),e.scope.add(()=>{t.off("video:timeupdate",o)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return Array.from(this.textTrack?.activeCues||[])}get cues(){return Array.from(this.textTrack?.cues||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?O(r,t):R(r,t,e)}update(){!function(t){const e=Sr(t);if(e.scope.closed)return;const r=e.revision,o=++e.render,n=()=>!e.scope.closed&&e.revision===r&&e.render===o,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!n())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?at(t):t}\n
`).join("")).join("");n()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=Sr(this),s=i.revision+1,l=await this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),l}createTrack(t,e){!function(t,e,r){const o=Sr(t);if(o.scope.closed)return;const n=++o.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=o.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||o.trackRevision!==n)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||o.trackRevision!==n)return p.dispose(),void d.remove();const h=o.track;o.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{h?.dispose()}finally{o.ownedURL&&o.ownedURL!==r&&zr(o)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),o.scope.closed||o.trackRevision!==n)throw h;throw i.$track=s,l&&l.insertBefore(s,c?.parentNode===l?c:null),h}}(this,t,e)}async init(t){const e=Sr(this),r=function(t){const e=t.request,r=new Tr(t.scope);return t.request=r,t.revision+=1,e?.cancel(),r}(e),{notice:o,template:{$subtitle:a}}=this.art;return r.run(async()=>{if(!this.textTrack)return null;if(n(t,Ct.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const o=await fetch(t.url,{signal:r.signal});if(!r.active)return;if(!o.ok)throw new Error(`Failed to load subtitle: ${o.status} ${o.statusText}`);const n=await o.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||Z(e.url)){case"srt":return{vtt:e.onVttLoad(pt(r))};case"ass":return{vtt:e.onVttLoad(ht(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(n,t);if(!r.active)return;const l=void 0===s?t.url:i=ut(s.vtt);if(!r.active)return;a.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(s){if(!r.active)return;throw a.innerHTML="",o.show=s,s}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}})}}const Pr=`\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
${a}
\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 `;class Ar{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=S(e.container),G(this.$container,`No container element found by ${e.container}`)),G(B(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();G("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),G(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,ur(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Pr}query(t){return S(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Ar.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){G(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),W(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&L(this.$player,"art-backdrop"),E&&L(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":L(this.$player,"art-destroy")}}const Rr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Or{on(t,e,r){const o=this.e||(this.e={});let n=Rr(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Rr(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Rr(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),Vr.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Vr.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&_r.push(this)}catch(o){try{f(this,_r,!0,Vr.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return _r}static get version(){return a}static get config(){return i}static get utils(){return mt}static get scheme(){return Ct}static get Emitter(){return Or}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return Ar.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:x?"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){f(this,_r,t,Vr.REMOVE_SRC_WHEN_DESTROY)}}return Vr.STYLE=Er,Vr.DEBUG=!1,Vr.CONTEXTMENU=!0,Vr.NOTICE_TIME=2e3,Vr.SETTING_WIDTH=250,Vr.SETTING_ITEM_WIDTH=200,Vr.SETTING_ITEM_HEIGHT=35,Vr.RESIZE_TIME=200,Vr.SCROLL_TIME=200,Vr.SCROLL_GAP=50,Vr.AUTO_PLAYBACK_MAX=10,Vr.AUTO_PLAYBACK_MIN=5,Vr.AUTO_PLAYBACK_TIMEOUT=3e3,Vr.RECONNECT_TIME_MAX=5,Vr.RECONNECT_SLEEP_TIME=1e3,Vr.CONTROL_HIDE_TIME=3e3,Vr.DBCLICK_TIME=300,Vr.DBCLICK_FULLSCREEN=!0,Vr.MOBILE_DBCLICK_PLAY=!0,Vr.MOBILE_CLICK_PLAY=!1,Vr.AUTO_ORIENTATION_TIME=200,Vr.INFO_LOOP_TIME=1e3,Vr.FAST_FORWARD_VALUE=3,Vr.FAST_FORWARD_TIME=1e3,Vr.TOUCH_MOVE_RATIO=.5,Vr.VOLUME_STEP=.1,Vr.SEEK_STEP=5,Vr.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Vr.ASPECT_RATIO=["default","4:3","16:9"],Vr.FLIP=["normal","horizontal","vertical"],Vr.FULLSCREEN_WEB_IN_BODY=!0,Vr.LOG_VERSION=!0,Vr.USE_RAF=!1,Vr.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=Vr,C("artplayer-style",Er),setTimeout(()=>{Vr.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Vr.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Vr}); +!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 n=(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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,n,o=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};n&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,o||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),o&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=v(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 L(t,e=document){return e.querySelector(t)}function S(t,e=document){return Array.from(e.querySelectorAll(t))}function P(t,e){return t.classList.add(e)}function M(t,e){return t.classList.remove(e)}function z(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function R(t,e,r){return t.style[e]=r,t}function O(t,e){for(const r in e)R(t,r,e[r]);return t}function I(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function _(t,e){I(t).forEach(t=>M(t,e)),P(t,e)}function N(t,e,r="top"){E||(t.setAttribute("aria-label",e),P(t,"hint--rounded"),P(t,`hint--${r}`))}function D(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function W(t,e){return q(t).includes(e)}function F(t,e){return e.parentNode.replaceChild(t,e),t}function V(t){return document.createElement(t)}function Y(t="",e=""){const r=V("i");return P(r,"art-icon"),P(r,`art-icon-${t}`),A(r,e),r}function B(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function H(t){return t.getBoundingClientRect()}function j(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function q(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}function U(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class X extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function G(t,e){if(!t)throw new X(e);return t}function K(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function Z(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function J(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function Q(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function tt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function et(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const rt={"&":"&","<":"<",">":">","'":"'",'"':"""},nt={"&":"&","<":"<",">":">","'":"'",""":'"'},ot=/(&|<|>|'|")/g;function at(t){return t.replace(/[&<>'"]/g,t=>rt[t]||t)}const it=Object.defineProperty,{hasOwnProperty:st}=Object.prototype;function lt(t,e){return st.call(t,e)}function ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?dt(o,a):a,it(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function pt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 ut(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ht(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 ft(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const mt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:X,addClass:P,append:A,assToVtt:ht,capitalize:tt,clamp:Q,createElement:V,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:it,download:J,errorHandle:G,escape:at,get:ct,getComposedPath:q,getExt:Z,getIcon:Y,getRect:H,getSafeAreaInsets:U,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:lt,hasClass:z,includeFromEvent:W,inverseClass:_,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:D,isMobile:E,isSafari:x,loadImg:j,mergeDeep:dt,query:L,queryAll:S,remove:function(t){return t.parentNode.removeChild(t)},removeClass:M,replaceElement:F,secondToTime:et,setStyle:R,setStyleText:C,setStyles:O,siblings:I,silencePromise:K,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:pt,supportsFlex:B,throttle:ft,tooltip:N,unescape:function(t){return t.replace(ot,t=>nt[t]||t)},userAgent:w,vttToBlob:ut},Symbol.toStringTag,{value:"Module"}));function gt(t,e){return A(t,e)}function vt(t,e){return e.querySelector(t)}const yt="array",bt="boolean",wt="string",xt="number",kt="object",$t="function";function Et(t,e,r){return G(e===wt||e===xt||t instanceof Element,`${r.join(".")} require '${wt}' or 'Element' type`)}const Tt={html:Et,disable:`?${bt}`,name:`?${wt}`,index:`?${xt}`,style:`?${kt}`,click:`?${$t}`,mounted:`?${$t}`,tooltip:`?${wt}|${xt}`,width:`?${xt}`,selector:`?${yt}`,onSelect:`?${$t}`,switch:`?${bt}`,onSwitch:`?${$t}`,range:`?${yt}`,onRange:`?${$t}`,onChange:`?${$t}`},Ct={id:wt,container:Et,url:wt,poster:wt,type:wt,theme:wt,lang:wt,volume:xt,isLive:bt,muted:bt,autoplay:bt,autoSize:bt,autoMini:bt,loop:bt,flip:bt,playbackRate:bt,aspectRatio:bt,screenshot:bt,setting:bt,hotkey:bt,pip:bt,mutex:bt,backdrop:bt,fullscreen:bt,fullscreenWeb:bt,subtitleOffset:bt,miniProgressBar:bt,useSSR:bt,playsInline:bt,lock:bt,gesture:bt,fastForward:bt,autoPlayback:bt,autoOrientation:bt,airplay:bt,proxy:`?${$t}`,plugins:[$t],layers:[Tt],contextmenu:[Tt],settings:[Tt],controls:[{...Tt,position:(t,e,r)=>{const n=["top","left","right"];return G("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}}],quality:[{default:`?${bt}`,html:wt,url:wt}],highlight:[{time:xt,text:wt}],thumbnails:{url:wt,number:xt,column:xt,width:xt,height:xt,scale:xt},subtitle:{url:wt,name:wt,type:wt,style:kt,escape:bt,encoding:wt,onVttLoad:$t},moreVideoAttr:kt,i18n:kt,icons:kt,cssVar:kt,customType:kt},Lt=new WeakSet;class St{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 z(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?P(e,r):M(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",o(e,Tt),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,n=this.cache;G(!n.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){P(t,`art-${r}`),P(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&O(t,a.style),a.tooltip&&N(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,r,a),c=!0,n.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw n.get(r)?.$ref===a&&n.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){G(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Lt.has(e)){Lt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Lt.delete(e)}}}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 St{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="1"]',t);n&&_(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).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:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="default"]',t);n&&_(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).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:n}}=e,o=n.map(t=>`${r.get(tt(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="normal"]',t);n&&_(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=H(e),{height:c,width:d}=H(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),O(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{W(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Mt(t,e,r,n,o={}){const{capture:a=!1,once:i=!1,signal:s}=o;if(t.closed||s?.aborted)return()=>{};let l=()=>{};function c(e){i&&l(),t.closed||("function"===typeof n?n.call(this,e):n.handleEvent(e))}return e.addEventListener(r,c,o),l=t.add(()=>{try{e.removeEventListener(r,c,a)}finally{s?.removeEventListener("abort",l)}}),s?.addEventListener("abort",l,{once:!0}),l}function zt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function At(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function Rt(t,e){const{$progress:r}=t.template,{left:n}=H(r),o=Q((E?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:et(a),width:o,percentage:Q(o/r.clientWidth,0,1)}}function Ot(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Rt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function It(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=vt(".art-progress-hover",e),c=vt(".art-progress-loaded",e),d=vt(".art-progress-played",e),p=vt(".art-progress-highlight",e),u=vt(".art-progress-indicator",e),h=vt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||Rt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?R(h,"left",0):o>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",o-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*n+"%"),"hover"===r&&(R(l,"width",100*n+"%"),W(i,p)?function(r){const{width:n}=Rt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=o??"";const a=h.clientWidth;n<=a/2?R(h,"left",0):n>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",n-a/2+"px")}(i):f(i),0===n?M(o,"art-progress-hover"):P(o,"art-progress-hover")),"played"===r&&(R(d,"width",100*n+"%"),R(u,"left",100*n+"%")),m){P(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:et(n*t.duration)}),s(),s=zt(a,()=>{M(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function _t(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{It(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==n&&Ot(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Rt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Rt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Nt(t){const{option:e}=t.art;e.isLive||t.add(_t({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.play),s=gt(t,o.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}N(i,a.get("Play")),N(s,a.get("Pause")),n(i,"click",()=>{K(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o}=e,a=gt(t,o.volume),i=gt(t,o.volumeClose),s=gt(t,'
'),l=gt(s,'
'),c=gt(l,'
'),d=gt(l,'
'),p=gt(d,'
'),u=gt(p,'
'),h=gt(d,'
');function f(t){const{top:e,height:r}=H(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function n(){const r=`${et(e.currentTime)} / ${et(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:n}=e;gt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e;gt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{N(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e;gt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{N(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:n}=e;gt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.fullscreenWebOn),s=gt(t,o.fullscreenWebOff);R(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(N(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.fullscreenOn),s=gt(t,o.fullscreenOff);R(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(N(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rWt.get(t).option.selector}),it(t,"$control_item",{get:()=>Wt.get(t).item}),it(t,"$control_value",{get:()=>Wt.get(t).value})),Wt.set(t,e)}function Vt(t,e){t.innerHTML=e}function Yt(t,e,r,n,o){const{proxy:a}=t.events,i=v(n),s=r.selector;P(n,"art-control-selector");const l=document.createElement("div");P(l,"art-selector-value"),A(l,r.html),n.textContent="",A(n,l);const c=gt(n,'
');for(let u=0;u{if(i.closed)return;const o=q(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Dt.set(t,e),()=>{Dt.get(t)===e&&Dt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,n);c()&&Vt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});o.push(p)}class Bt extends St{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;g(t,n);const{on:o}=b(t,n);o("mousemove",()=>{E||(this.show=!0)}),o("click",()=>{E?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=W(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(M(r,"art-hide-cursor"),P(r,"art-hover"),this.timer=Date.now()):(P(r,"art-hide-cursor"),M(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=v(e),{on:a}=b(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Nt(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:G(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Vt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Ht(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function jt(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const qt=new WeakMap;class Ut{constructor(t){this.destroyEvents=new Set;const e=u(t);qt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){W(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&o&&K(t.toggle()):K(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&K(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=>{P(r,"art-hover"),t.emit("hover",!0,e)},e=>{M(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=u(t);let a=()=>{};const i=()=>{a(),a=zt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Ot(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=Ht(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=Q((n-i)/t.width,-1,1),d=Q((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=Q(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",Q(h/t.duration,0,1),e),t.notice.show=`${et(h)} / ${et(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=ft(()=>{t.emit("view",D(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{const n=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(n,r,e=>{t.emit(`window:${r}`,e)});o.push(s)})}a(),e.bindGlobalEvents=a}(t,this),jt(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(qt.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 Xt{constructor(t){this.art=t,this.keys={},E||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",()=>{K(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Jt{constructor(t){const e={...Zt,...t.option.icons};for(const r in e)it(this,r,{get:()=>Y(r,e[r])})}}class Qt extends St{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=S("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(o,"display","none"),R(a,"display",null)}),n.proxy(e.$state,"click",()=>K(t.play()))}}class ne{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,P(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",M(r,"art-notice-show")},e.NOTICE_TIME)):M(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function oe({width:t,height:e}){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0}function ae(t,e){if(!oe(t)||!Number.isFinite(e)||e<=0)return;const r=t.width/t.height>e?{width:e*t.height,height:t.height,axis:"width"}:{width:t.width,height:t.width/e,axis:"height"};return oe(r)?r:void 0}function ie(t){const{$container:e,$video:r}=t.template;it(t,"autoHeight",{value(){if(h(t))return;const n=function(t,e){if(!Number.isFinite(t)||t<=0||!oe(e))return;const r=e.height*(t/e.width);return Number.isFinite(r)&&r>0?r:void 0}(e.clientWidth,{width:r.videoWidth,height:r.videoHeight});void 0===n||h(t)||(e.style.height=`${n}px`,t.emit("autoHeight",n))}})}function se(t,e,r,n=!1){const o=e=>{h(t)||r(e)};t[n?"once":"on"](e,o),u(t).add(()=>{t.off(e,o)})}function le(t,e,r){for(const[n,o]of e){if(h(t)||r&&!r())return;t[n].show=o}}const ce=new WeakMap,de=new WeakMap,pe=new WeakMap;function ue(t){return pe.get(t)||u(t)}function he(t){const e=ce.get(t),r=pe.get(t);return()=>ce.get(t)===e&&(!e||e.active())&&pe.get(t)===r&&(!r||!r.closed)}function fe(t){const e=pe.get(t),r=u(t).child(),n=r.child();pe.set(t,r),r.add(()=>{pe.get(t)===r&&pe.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!n.closed&&ce.get(t)===o};return ce.set(t,o),n.add(()=>{ce.get(t)===o&&ce.delete(t),o.onAssigned=void 0,o.onError=void 0}),e?.dispose(),o}function me(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function ge(t,e,r){de.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{de.get(t)===e&&(de.delete(t),me(e))}}function ve(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function ye(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=ue(t),l=0;return{reset(){l=0,i?.dispose(),M(a,"art-error")},loadStart(){M(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=ue(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===ue(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function be(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=ye(t);!function(t,e){se(t,"video:canplay",()=>{e.reset(),le(t,[["loading",!1]])}),se(t,"video:canplay",()=>{le(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;se(t,"video:ended",()=>{if(e.loop){const e=he(t);if(t.seek=0,h(t)||!e())return;K(t.play()),e()&&le(t,[["controls",!1],["mask",!1]],e)}else le(t,[["controls",!0],["mask",!0]])})}(t),se(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;se(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&le(t,[["loading",!1],["controls",!0],["mask",!0]])}),se(t,"video:loadstart",()=>{e.loadStart(),le(t,[["loading",!0],["mask",!1],["controls",!0]])}),se(t,"video:pause",()=>{le(t,[["controls",!0],["mask",!0]])}),se(t,"video:play",()=>{le(t,[["mask",!1]]),h(t)||R(r,"display","none")}),se(t,"video:playing",()=>le(t,[["mask",!1]])),se(t,"video:progress",()=>{t.playing&&le(t,[["loading",!1]])}),se(t,"video:seeked",()=>le(t,[["loading",!1],["mask",!0]])),se(t,"video:seeking",()=>le(t,[["loading",!0],["mask",!1]])),se(t,"video:timeupdate",()=>le(t,[["mask",!1]])),se(t,"video:waiting",()=>le(t,[["loading",!0],["mask",!1]]))}(t,e)}const we=[["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"]],xe=(()=>{if("undefined"===typeof document)return!1;const t=we[0],e={};for(const r of we){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),ke={change:xe.fullscreenchange,error:xe.fullscreenerror},$e={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{$e.off("change",o),r()};$e.on("change",o);const a=t[xe.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!$e.isFullscreen)return void t();const r=()=>{$e.off("change",r),t()};$e.on("change",r);const n=document[xe.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>$e.isFullscreen?$e.exit():$e.request(t,e),onchange(t){$e.on("change",t)},onerror(t){$e.on("error",t)},on(t,e){const r=ke[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=ke[t];r&&document.removeEventListener(r,e,!1)},raw:xe};function Ee(t,e,...r){const n=Reflect.get(t,e);if("function"!==typeof n)throw new TypeError(`Fullscreen method ${e} is not available`);return n.apply(t,r)}Object.defineProperties($e,{isFullscreen:{get:()=>Boolean(document[xe.fullscreenElement])},element:{enumerable:!0,get:()=>document[xe.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[xe.fullscreenEnabled])}});const Te=new WeakMap;function Ce(t){try{Promise.resolve(t()).catch(()=>{})}catch{}}function Le(t){const{document:e,elementProperty:r,changeEvent:n,target:o,exit:a}=t,i=function(t,e,r){let n=Te.get(t);if(!n){n=new WeakMap,Te.set(t,n);const o=n;t.addEventListener(r,()=>{const r=Reflect.get(t,e),n=r&&o.get(r);n&&(o.delete(r),Ce(n))})}return n}(e,r,n);i.set(o,a),t.element===o&&(i.delete(o),Ce(a))}function Se(t,e,r,n,o=()=>t.element!==t.target){const a=e.child();let i,s,l=!1,c=!1,d=!1,p=!1,u=!1;const h=new Promise((t,e)=>{i=t,s=e});function f(t=!1,e){if(!l){l=!0;try{a.dispose()}catch(r){t||(t=!0,e=r)}t?s(e):i()}}a.add(()=>{l||(l=!0,c=!0,i(),d&&!p&&r&&Le(t))});const m=()=>{d&&!p&&(r?t.element===t.target:o())&&f()};if(Mt(a,t.document,t.changeEvent,m),Mt(a,t.document,t.errorEvent,e=>{e.target!==t.target&&e.target!==t.document||(u=!0,d&&!p&&f(!0,new Error("Fullscreen request failed")))}),!a.closed)try{r&&function(t){Te.get(t.document)?.delete(t.target)}(t);const e=r?t.request():t.exit();p=Boolean(e&&"function"===typeof e.then),d=!0,c&&!p&&r&&Le(t),p?Promise.resolve(e).then(()=>{c?n():f()},t=>f(!0,t)).catch(()=>{}):u?f(!0,new Error("Fullscreen request failed")):m()}catch(g){f(!0,g)}return{promise:h,cancel:()=>a.dispose()}}function Pe(t,e){const r=u(t).child(),{$player:n,$video:o}=t.template,a=()=>e.element===n||e.element===o;let i,s=a(),l=0,c=s,d=!1,p=!1,f=!1;function m(){if(a())try{Promise.resolve(e.exit()).catch(()=>{})}catch{}}return r.add(()=>{l+=1,c=!1,n.classList.remove("art-fullscreen"),m()}),Mt(r,e.document,e.changeEvent,()=>{const r=a();if(r&&function(t){return Te.get(t.document)?.has(t.target)??!1}(e))return;if(r&&p)return void m();if(r===s||h(t))return;s=r;const o=l,i=()=>h(t)||a()!==r||o!==l&&c!==r;t.emit("fullscreen",r),i()||(r&&(t.state="fullscreen"),i()||(n.classList.toggle("art-fullscreen",r),t.emit("resize")))}),Mt(r,e.document,e.errorEvent,r=>{(r.target===n||r.target===o||r.target===e.document&&(f||void 0!==i||a()))&&!h(t)&&t.emit("fullscreenError",r)}),{get:()=>!h(t)&&a(),set(n){if(h(t))return Promise.resolve();const o=++l;if(c=Boolean(n),c?p=!1:d&&(p=!0),i?.cancel(),i=void 0,d=!1,!c&&!a())return Promise.resolve();f=!0,d=c;const s=Se(e,r,c,()=>{!h(t)&&c||m()},()=>!a());f=!1,l===o?i=s:s.cancel();const u=s.promise.catch(e=>{throw h(t)||l!==o||(t.notice.show=e),e}).finally(()=>{l===o&&(i=void 0,d=!1)});return u.catch(()=>{}),u}}}const Me=new WeakSet;function ze(t,e=!1){return"string"===typeof t.webkitPresentationMode?"fullscreen"===t.webkitPresentationMode:"boolean"===typeof t.webkitDisplayingFullscreen?t.webkitDisplayingFullscreen:t.ownerDocument.fullscreenElement===t||e}function Ae(t){Me.delete(t),t.removeEventListener("webkitbeginfullscreen",Re),t.removeEventListener("webkitpresentationmodechanged",Re)}function Re(t){if(Me.has(this)&&ze(this,"webkitbeginfullscreen"===t.type)){Ae(this);try{this.webkitExitFullscreen?.()}catch{}}}function Oe(t){Me.add(t),t.addEventListener("webkitbeginfullscreen",Re),t.addEventListener("webkitpresentationmodechanged",Re)}function Ie(t){const{$video:e}=t.template,r=u(t).child();let n=!1,o=ze(e),a=o,i=!1,s=0;const l=()=>ze(e,n);function c(r){if(h(t)||(c=e,Me.has(c)))return;var c;"boolean"===typeof r&&(n=r);const d=l();if(d&&(i=!1),d===o)return;o=d;const p=s,u=()=>h(t)||l()!==d||p!==s&&a!==d;t.emit("fullscreen",d),u()||(d&&(t.state="fullscreen"),u()||t.emit("resize"))}r.add(()=>{s++,a=!1,i&&Oe(e),l()&&e.webkitExitFullscreen?.()}),Mt(r,e,"webkitbeginfullscreen",()=>c(!0)),Mt(r,e,"webkitendfullscreen",()=>c(!1)),Mt(r,e,"webkitpresentationmodechanged",()=>c());const d=()=>c();return t.on("document:webkitfullscreenchange",d),r.add(()=>{t.off("document:webkitfullscreenchange",d)}),{get:()=>!h(t)&&l(),set(r){if(h(t))return;const n=++s;if(a=Boolean(r),r){if(Ae(e),t.state="fullscreen",h(t)||n!==s)return;i=!0;try{e.webkitEnterFullscreen()}catch(o){throw n===s&&(i=!1),o}}else i&&(i=!1,Oe(e)),l()&&e.webkitExitFullscreen()}}}function _e(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=()=>{if(h(t))return;const a=function(t){const e=$e.raw,r=t.ownerDocument;if(e&&Reflect.get(r,e.fullscreenEnabled))return{document:r,target:t,get element(){return Reflect.get(r,e.fullscreenElement)},elementProperty:e.fullscreenElement,changeEvent:e.fullscreenchange,errorEvent:e.fullscreenerror,request:()=>Ee(t,e.requestFullscreen,void 0),exit:()=>Ee(r,e.exitFullscreen)}}(o);a?it(t,"fullscreen",Pe(t,a)):n.webkitSupportsFullscreen&&"function"===typeof n.webkitEnterFullscreen&&"function"===typeof n.webkitExitFullscreen?it(t,"fullscreen",Ie(t)):it(t,"fullscreen",{get:()=>!1,set(){h(t)||(r.show=e.get("Fullscreen Not Supported"))}}),it(t,"fullscreen",ct(t,"fullscreen"))};t.once("video:loadedmetadata",a),u(t).add(()=>{t.off("video:loadedmetadata",a)})}function Ne(t){return{node:t,parent:t.parentNode,next:t.nextSibling}}function De({node:t,parent:e,next:r}){if(!e)return void t.parentNode?.removeChild(t);const n=r?.parentNode===e?r:null;t.parentNode===e&&t.nextSibling===n||e.insertBefore(t,n)}function We(t){const e=function(t){const{$player:e}=t.template;let r,n=0;function o(t,r){return null===t.style?e.removeAttribute("style"):e.setAttribute("style",t.style),!!r()&&(e.classList.remove("art-fullscreen-web"),!!r()&&(De(t.placement),r()))}return u(t).add(()=>{n+=1;const t=r;if(r=void 0,t)try{o(t,()=>!0)}catch(a){try{e.parentNode!==t.placement.parent&&e.parentNode?.removeChild(e)}catch(i){throw new s([a,i])}throw a}}),a=>{if(h(t))return;const i=++n,s=()=>i===n&&!h(t);if(a){r||(r={placement:Ne(e),style:e.getAttribute("style")});const n=r;try{if(t.constructor.FULLSCREEN_WEB_IN_BODY&&e.parentNode!==document.body&&document.body.appendChild(e),!s())return;if(t.state="fullscreenWeb",!s())return;e.style.width="100%",e.style.height="100%",e.classList.add("art-fullscreen-web")}catch(l){throw s()&&o(n,s)&&(r=void 0),l}if(!s())return;t.emit("fullscreenWeb",!0)}else{if(r){if(!o(r,s))return;r=void 0}else e.classList.remove("art-fullscreen-web");if(!s())return;t.emit("fullscreenWeb",!1)}s()&&t.emit("resize")}}(t);it(t,"fullscreenWeb",{get:()=>t.template.$player.classList.contains("art-fullscreen-web"),set:e})}function Fe(t,e,r){const n=Math.max(0,r.viewportWidth-r.width),o=Math.max(0,r.viewportHeight-r.height);return{left:Math.max(0,Math.min(t,n)),top:Math.max(0,Math.min(e,o))}}function Ve(t){const{width:e,height:r}=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{width:e,height:r,viewportWidth:n.innerWidth,viewportHeight:n.innerHeight}}function Ye(t,e,r,n){const o=e.child();if(o.closed)return;const a=t.template.$mini;if(a){const t=a.style.display;return o.add(()=>{a.style.display=t}),{element:a,cancelDrag:()=>{},fresh:!1}}const i=t.template.$player.ownerDocument,s=i.createElement("div");s.className="art-mini-popup",o.add(()=>{s.remove()});try{const e=i.createElement("div");if(e.className="art-mini-close",e.append(t.icons.close),o.closed)return;const a=i.createElement("div");a.className="art-mini-state";const l=t.icons.play,c=t.icons.pause;if(o.closed)return;a.append(l,c),s.append(e,a),Mt(o,e,"click",n),Mt(o,l,"click",()=>{K(t.play())}),Mt(o,c,"click",()=>{t.pause()});const d=()=>{o.closed||(l.style.display=t.playing?"none":"flex",c.style.display=t.playing?"flex":"none")};d();for(const r of["video:playing","video:pause","video:timeupdate"])t.on(r,d),o.add(()=>{t.off(r,d)});const p=function(t,e,r,n){let o=!1,a=0,i=0;const s=()=>{o=!1,e.classList.remove("art-mini-dragging"),e.style.transform=""};Mt(r,e,"mousedown",t=>{const e=t;0===e.button&&n()&&(o=!0,a=e.clientX,i=e.clientY)});const l=t=>{!r.closed&&o&&n()&&(e.classList.add("art-mini-dragging"),e.style.transform=`translate(${t.clientX-a}px, ${t.clientY-i}px)`)},c=()=>{if(r.closed||!o||!n())return;const a=e.getBoundingClientRect(),i=Fe(a.left,a.top,Ve(e));s(),e.style.left=`${i.left}px`,e.style.top=`${i.top}px`,t.storage.set("left",i.left),r.closed||t.storage.set("top",i.top)};return t.on("document:mousemove",l),r.add(()=>{t.off("document:mousemove",l)}),t.on("document:mouseup",c),r.add(()=>{t.off("document:mouseup",c)}),r.add(s),s}(t,s,o,r);if(o.closed)return;if(t.template.$mini=s,i.body.append(s),!o.closed)return{element:s,cancelDrag:p,fresh:!0}}catch(l){throw o.dispose(),t.template.$mini===s&&delete t.template.$mini,l}}function Be(t){const{$player:e,$video:r}=t.template,n=u(t).child();let o,a,i=0,s=!1,l=!1;const c=()=>!h(t)&&e.classList.contains("art-mini");function d(){if(a){const e=a,r=i;a=void 0;try{De(e)}catch(t){throw r!==i||a||(a=e),t}}}function p(){if(h(t))return;const r=++i;l=!1,d(),h(t)||r!==i||(o?.cancelDrag(),e.classList.remove("art-mini"),t.template.$mini&&(t.template.$mini.style.display="none",t.emit("mini",!1)))}function f(){if(h(t))return;const u=++i;if(s)l=!0;else if(t.state="mini",!h(t)&&u===i){a??(a=Ne(r)),e.classList.add("art-mini");try{if(!o){s=!0;try{o=Ye(t,n,c,p)}finally{s=!1}}if(l)return l=!1,void f();if(!o||h(t))return;if(u!==i)return void(c()||(o.element.style.display="none"));if(o.fresh?o.element.prepend(r):o.element.append(r),h(t)||u!==i)return;o.element.style.display=o.fresh?"":"flex",o.fresh=!1;const e=t.storage.get("top"),a=function(t,e,r){return"number"===typeof t&&Number.isFinite(t)&&"number"===typeof e&&Number.isFinite(e)&&t>=0&&e>=0&&t+r.width<=r.viewportWidth&&e+r.height<=r.viewportHeight?{left:t,top:e,reset:!1}:{...Fe(r.viewportWidth-r.width-50,r.viewportHeight-r.height-50,r),reset:!0}}(t.storage.get("left"),e,Ve(o.element));if(h(t)||u!==i)return;if(o.element.style.left=`${a.left}px`,o.element.style.top=`${a.top}px`,a.reset){if(t.storage.set("top",a.top),h(t)||u!==i)return;t.storage.set("left",a.left)}h(t)||u!==i||t.emit("mini",!0)}catch(m){const r=l;throw l=!1,h(t)||u!==i&&!r||(d(),e.classList.remove("art-mini"),o&&(o.element.style.display="none")),m}}}return n.add(()=>{i++;try{d()}finally{o?.cancelDrag(),e.classList.remove("art-mini")}}),{get:c,set(t){t?f():p()}}}const He=new WeakSet,je=t=>"picture-in-picture"===t.webkitPresentationMode;function qe(t){He.delete(t),t.removeEventListener("webkitpresentationmodechanged",Ue),t.removeEventListener("enterpictureinpicture",Ue)}function Ue(){if(He.has(this)&&je(this)){qe(this);try{this.webkitSetPresentationMode?.("inline")}catch{}}}function Xe(t){He.add(t),t.addEventListener("webkitpresentationmodechanged",Ue),t.addEventListener("enterpictureinpicture",Ue)}function Ge(t){const{i18n:e,notice:r,template:{$video:n}}=t,o=n.ownerDocument;o.pictureInPictureEnabled&&"function"===typeof n.requestPictureInPicture&&"function"===typeof o.exitPictureInPicture?it(t,"pip",function(t){const{$video:e}=t.template,r=e.ownerDocument,n=u(t).child(),o=()=>r.pictureInPictureElement===e;let a=o(),i=a,s=!1,l=!1,c=0;function d(){if(o())try{r.exitPictureInPicture().catch(()=>{})}catch{}}function p(e,r,n){e.then(()=>{!r||!h(t)&&i||d()},e=>{h(t)||c!==n||(t.notice.show=e)}).finally(()=>{c===n&&(s=!1)}).catch(()=>{})}return e.disablePictureInPicture=!1,n.add(()=>{c++,i=!1,d()}),Mt(n,e,"enterpictureinpicture",()=>{if(l)return void d();if(!o()||a)return;const e=c;t.state="pip",!h(t)&&e===c&&o()&&(a=!0,t.emit("pip",!0))}),Mt(n,e,"leavepictureinpicture",()=>{a&&!o()&&(a=!1,t.emit("pip",!1))}),{get:()=>!h(t)&&o()?e:null,set(n){if(h(t))return;const a=++c;if(i=Boolean(n),i?l=!1:s&&(l=!0),s=!1,i){if(t.state="pip",h(t)||c!==a)return;s=!0;try{p(e.requestPictureInPicture(),!0,a)}catch(d){throw c===a&&(s=!1),d}}else o()&&p(r.exitPictureInPicture(),!1,a)}}}(t)):"function"===typeof n.webkitSupportsPresentationMode&&"function"===typeof n.webkitSetPresentationMode?it(t,"pip",function(t){const{$video:e}=t.template,r=u(t).child();let n=!1,o=!1,a=0,i=0;function s(r=!1){if(h(t)||He.has(e))return;const s=je(e);if(s&&(o=!1),s===n&&!r)return;const l=a;s&&(t.state="pip"),h(t)||a!==l||je(e)!==s||(n=s,i++,t.emit("pip",s))}e.webkitSetPresentationMode("inline"),r.add(()=>{a++,o&&Xe(e),je(e)&&e.webkitSetPresentationMode("inline")});for(const l of["webkitpresentationmodechanged","enterpictureinpicture","leavepictureinpicture"])Mt(r,e,l,()=>s());return{get:()=>!h(t)&&je(e),set(r){if(h(t))return;const n=++a,l=i;if(r){if(!1===e.webkitSupportsPresentationMode?.("picture-in-picture"))return void(t.notice.show=t.i18n.get("PIP Not Supported"));if(qe(e),t.state="pip",h(t)||a!==n)return;o=!0;try{e.webkitSetPresentationMode("picture-in-picture")}catch(c){throw n===a&&(o=!1),c}}else o&&(o=!1,Xe(e)),je(e)&&e.webkitSetPresentationMode("inline");h(t)||n!==a||l!==i||je(e)!==Boolean(r)||s(!0)}}}(t)):it(t,"pip",{get:()=>!1,set(){h(t)||(r.show=e.get("PIP Not Supported"))}})}function Ke(t){it(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Dt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${o.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(n.show=r)}return e.html}})}})}function Ze(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Je(t,e,r){return new Promise((n,o)=>{if(h(t)||e===t.url)return void n();const a=fe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Ze(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(ge(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Ze(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Qe(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",async(o,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===o||"played"===o&&l&&E){if(i||a||(a=!0,i=await j(d,p),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",o-u/2+"px")}(o)}}),it(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function tr(t){const{option:e,template:{$video:r}}=t;it(t,"url",{get:()=>r.src,async set(n){if(h(t))return;const o=function(t){const e=de.get(t);return de.delete(t),e||fe(t)}(t);o.acceptingEvents=!1;try{if(!n)return void(await At(o.scope)&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||Z(n),s=e.customType[i];if(i&&s){if(!(await At(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;Ze(l,t,"video:canplay",()=>{c=!d}),Ze(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>ve(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||Ze(o.scope,t,"video:canplay",e)}}catch(a){ve(o,a)}finally{me(o)}}})}class er{constructor(t){tr(t),function(t){const{template:{$video:e}}=t;it(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;it(t,"play",{async value(){const i=he(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;it(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${et(t.currentTime)} / ${et(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;it(t,"forward",{set(e){r.seek=t.currentTime+e}}),it(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;it(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=Q(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),it(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;it(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=Q(n,0,t.duration))}})}(t),function(t){it(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Je(t,e,0);it(t,"switchQuality",{value:e=>Je(t,e,t.currentTime)}),it(t,"switchUrl",{value:e}),it(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;it(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;it(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(!h(t)){if(a||(a="default"),"default"===a)n.style.width="",n.style.height="",n.style.margin="",delete o.dataset.aspectRatio;else{const e=a.split(":").map(Number),r=ae({width:o.clientWidth,height:o.clientHeight},e[0]/e[1]);if(h(t))return;"width"===r?.axis?(n.style.width=`${r.width}px`,n.style.height="100%",n.style.margin="0 auto"):r&&(n.style.width="100%",n.style.height=`${r.height}px`,n.style.margin="auto 0"),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,h(t)||t.emit("aspectRatio",a)}}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=V("canvas");it(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),it(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),it(t,"screenshot",{value:async e=>{const n=await t.getDataURL();return J(n,`${e||`artplayer_${et(r.currentTime)}`}.png`),t.emit("screenshot",n),n}})}(t),_e(t),We(t),Ge(t),function(t){const{$video:e}=t.template,r=t;it(t,"loaded",{get:()=>r.loadedTime/e.duration}),it(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){it(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;it(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:n}=t.template;it(t,"autoSize",{value(){if(h(t))return;const o={width:n.videoWidth,height:n.videoHeight};if(!oe(o))return;const a=H(e),i=ae(a,o.width/o.height);i&&!h(t)&&("width"===i.axis?(r.style.width=i.width/a.width*100+"%",r.style.height="100%"):(r.style.width="100%",r.style.height=i.height/a.height*100+"%"),t.emit("autoSize",{width:t.width,height:t.height}))}})}(t),function(t){const e=t;it(t,"rect",{get:()=>H(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}it(t,"x",{get:()=>e.left+window.pageXOffset}),it(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;it(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){h(t)||(o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(tt(o))}`,h(t)||t.emit("flip",o))}})}(t),function(t){it(t,"mini",Be(t))}(t),function(t){const{template:{$poster:e}}=t;it(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),ie(t),function(t){const{$player:e}=t.template;it(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){it(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){it(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];it(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;nn.$track?.offset||0,set(o){const{cues:a}=t.subtitle;if(!n.$track||0===a.length)return;const i=Q(o,-10,10);n.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,it(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ke(t),Qe(t),be(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=Q(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=Q(a,0,1)),e.poster&&R(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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)}}const rr=new WeakMap,nr="art-auto-orientation-fullscreen";function or(t){if(rr.get(t.orientation)===t)try{t.orientation.unlock()}catch{}}const ar="art-auto-orientation",ir=["width","height","transform-origin","transform"];function sr(t){const{$player:e,$video:r}=t.template,n=()=>{const t={width:r.videoWidth,height:r.videoHeight},n=e.ownerDocument.documentElement,o={width:n.clientWidth,height:n.clientHeight};return oe(t)&&oe(o)&&(t.width>t.height&&o.widtho.height)},o=function(t,e){const{$player:r}=t.template,n=u(t);let o,a=()=>{};function i(){a(),a=()=>{};const e=o;if(o=void 0,e&&t.fullscreenWeb)for(const{name:t,value:o,priority:a}of e)r.style.setProperty(t,o,a);const n=r.classList.contains(ar);r.classList.remove(ar),n&&(t.isRotate=!1,h(t)||t.emit("resize"))}function s(n){if(!t.fullscreenWeb||!e())return;const a=U();if(h(t)||!t.fullscreenWeb)return;const i=r.ownerDocument.documentElement;o??(o=ir.map(t=>({name:t,value:r.style.getPropertyValue(t),priority:r.style.getPropertyPriority(t)}))),r.style.width=i.clientHeight-a.top-a.bottom+"px",r.style.height=i.clientWidth-a.left-a.right+"px",r.style.transformOrigin="0 0",r.style.transform=`rotate(90deg) translate(${a.top}px, -${i.clientWidth-a.right}px)`,r.classList.add(ar),t.isRotate=!0,n&&t.emit("resize")}return n.add(i),r=>{h(t)||(r?o?s(!1):e()&&(a(),a=zt(n,()=>{o||s(!0)},Number(t.constructor.AUTO_ORIENTATION_TIME??0))):i())}}(t,n),a=function(t,e){const{$player:r}=t.template;let n;function o(){const t=n;n=void 0,r.classList.remove(nr),t&&(t.cancelled=!0,or(t),t.settled&&rr.get(t.orientation)===t&&rr.delete(t.orientation))}return u(t).add(o),a=>{if(h(t))return;if(!a)return void o();if(n&&!n.cancelled&&rr.get(n.orientation)===n)return;const i=r.ownerDocument.defaultView?.screen?.orientation;if("function"!==typeof i?.lock||"function"!==typeof i.unlock||!e())return;const s={orientation:i,cancelled:!1,settled:!1};n=s,rr.set(i,s);const l=()=>!h(t)&&!s.cancelled&&n===s&&rr.get(i)===s,c=e=>{s.settled=!0;const o=l();rr.get(i)===s&&rr.delete(i),n===s&&(n=void 0),o&&(r.classList.remove(nr),t.notice.show=e)};try{const t=i.lock(i.type.startsWith("portrait")?"landscape":"portrait");Promise.resolve(t).then(()=>{s.settled=!0,l()?r.classList.add(nr):(or(s),rr.get(i)===s&&rr.delete(i))}).catch(c)}catch(d){c(d)}}}(t,n);return t.on("fullscreenWeb",o),t.on("fullscreen",a),u(t).add(()=>{t.off("fullscreenWeb",o),t.off("fullscreen",a)}),{name:"autoOrientation",get state(){return e.classList.contains("art-auto-orientation")}}}function lr(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=L(".art-auto-playback-last",s),c=L(".art-auto-playback-jump",s),d=L(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${et(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,K(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function cr(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,M(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,P(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return z(n,"art-fast-forward")}}}function dr(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return z(n,"art-lock")}function a(){P(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){M(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=A(e,r.lock),o=A(e,r.unlock);R(n,"display","none"),t.on("lock",t=>{t?(R(n,"display","inline-flex"),R(o,"display","none")):(R(n,"display","none"),R(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function pr(t){return t.on("control",e=>{e?M(t.template.$player,"art-mini-progress-bar"):P(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class ur{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(pr),!h(t.art)&&e.lock&&E&&t.add(dr),h(t.art)||!e.autoPlayback||e.isLive||t.add(lr),!h(t.art)&&e.autoOrientation&&E&&t.add(sr),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(cr)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){G(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let o=n;const a=lt(t,o);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return h(t.art)||(G(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),h(t.art)||it(t,o,{value:r})),t}(this,t,e)}}const hr=new WeakMap;function fr(t){return!t.closed&&!hr.get(t)}function mr(t){hr.set(t,(hr.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(hr.get(t)||1)-1;r?hr.set(t,r):hr.delete(t)}}const gr=new WeakMap,vr=new WeakMap,yr=["$parent","$parents","$option","$events","$formatted"];function br(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=gr.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(gr.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function wr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function xr(t){const e=gr.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function kr(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Pr(t,o)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(o.push(...a.splice(0)),Sr.set(r,o),Cr.set(e,r),Lr.set(e,n)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function Or(t,e,r,n,o,a){const i=a||zr(e);if(!fr(i)||h(t))return;const s=t.proxy(r,n,e=>{if(fr(i)&&!h(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!fr(i)||h(t)?t.events.remove(s):(xr(e).events.push(s),a&&a!==Cr.get(e)&&a.add(()=>{const r=xr(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function Ir(t,e,r,n){const o=zr(e);if(!fr(o)||h(t))return;const a=(...e)=>{if(fr(o)&&!h(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function _r(t){const{art:e,active:r}=t,{controls:n,constructor:{SETTING_WIDTH:o,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!n.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=n.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||o,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const Nr=new WeakMap;function Dr(t){Nr.delete(t)}const Wr=new WeakMap;function Fr(t,e){e?Wr.set(t,e):Wr.delete(t)}function Vr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],n=Wr.get(t),o=n?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,n]of e)Object.defineProperty(t,r,n);o?.(),Fr(t,n);for(const{node:t,parent:e,next:n}of r)e?e.insertBefore(t,n?.parentNode===e?n:null):t.parentNode?.removeChild(t)}}const Yr=new WeakMap;async function Br(t,e,r,n,o,a,i,s){try{const l=zr(e),c=zr(a),d=(Yr.get(a)||0)+1;Yr.set(a,d);const p=()=>fr(l)&&fr(c)&&!h(t.art)&&Yr.get(a)===d;if(s?.(),!p())return;const u=await o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function Hr(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const jr=new WeakMap;function qr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function Ur(t){jr.get(t)?.()}function Xr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);Dr(r),Ur(r);const n=Vr(r),o=r.$item,a=o?.parentNode,i=o?.nextSibling,s=o?Hr(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=Rr(t.art,e);r&&a.push(r)}for(const t of n)i.push(mr(Er(t)))}catch(l){try{qr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,qr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,qr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>Tr(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{qr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>s?.(),()=>{a&&o&&a.insertBefore(o,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&_(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&jr.get(r)===m;for(const u of d.items)jr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!o?.enumerable||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const Gr=new WeakMap;function Kr(t,e,r){it(t,`$${e}`,{configurable:!0,get:()=>r}),it(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function Zr(t,e,r=!1){const n=function(t){const e=jr.get(t);return()=>!e||jr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const o=t.cache.get(e.$option),a=e.$item;let i="selector";lt(e,"switch")&&(i="switch"),lt(e,"range")&&(i="range"),lt(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!n())return;const c=function(t,e,r=u(t)){const n=Cr.get(e);(!n||fr(n)||n.closed)&&Ar(t,e);const o=r.child();return Cr.set(e,o),Lr.set(e,r),Sr.set(o,xr(e).events),o.add(()=>{Pr(t,Sr.get(o))}),o}(t.art,e,Er(o)),d=()=>fr(c)&&!h(t.art)&&n();if(!d())return;const p=document.createElement("div");try{if(Fr(e),P(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const n=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(P(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(n,f),!d())return;Kr(e,"icon",f);const m=document.createElement("div");P(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(n,m),Kr(e,"html",m);const v=document.createElement("div");P(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),Kr(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");P(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),n=A(t,s.switchOff),o=e.switch;if(!d())return;R(o?n:r,"display","none"),A(u,t),it(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;Fr(e,()=>{const t=a;return()=>{a=t}}),it(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(n,"display","none"),R(r,"display",null)):(R(n,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");P(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!d())return;Reflect.set(r,a,String(t))}P(r,"art-setting-range"),A(u,t),it(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!d())return;Fr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),it(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");P(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,n){const{art:o}=t,a=zr(e),i=(t,r,n)=>Or(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>Br(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>Br(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return Br(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&P(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>Br(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;it(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(o,p),e.mounted&&d()&&zt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function Jr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!fr(Er(r)))return;const n=(Gr.get(t)||0)+1;Gr.set(t,n);const o=()=>Gr.get(t)===n&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&_(t.cache.get(a),"art-current");for(const[e,r,n]of i)t.$parent.style.setProperty(e,r,n)};if(t.active=e,r)try{_(r,"art-current"),t.resize()}catch(l){throw o()&&t.cache.get(e)===r&&!Er(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const n=function(t,e,r){const n=u(t.art).child();return $r.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,r),a=()=>!n.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;P(r,"art-setting-panel"),A(t.$parent,r),_(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=vr.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),n=(t,n)=>{if(r.closed||h(e))return;const o=(...t)=>{if(!r.closed&&!h(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=W(r,e.controls.setting),o=W(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(tt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{Ir(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){kr(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&_(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=vr.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{for(let n=0;nxr(t).parent},$parents:{get:()=>xr(t).parents},$option:{get:()=>xr(t).option},$events:{get:()=>xr(t).events},$formatted:{get:()=>!0}}),gr.set(t,{parent:r,parents:n,option:o,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return kr(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){_r(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&Tr(n)}catch(a){r.push(a)}}try{Ar(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);G(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{Dr(t),Ur(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>n?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?o.push(...a.errors):o.push(a)}if(o.length)throw new s(o)}update(t){return Xr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const n=e.length,o=r?void 0:function(t){const e={};Nr.set(t,e);const r=()=>Nr.get(t)===e;return{current:r,finish(){r()&&Nr.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||o&&!o.current())throw i;if(e[n]===t&&e.splice(n,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{o?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");R(a,"height",`${o}px`),P(a,"art-setting-item"),P(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");P(s,"art-setting-item-left-icon"),A(s,n),A(i,s),A(i,e.$parent.html),Or(t.art,e.$parent,a,"click",()=>t.render(e.$parents),Er(r)),A(r,a)}(this,t)}createItem(t,e=!1){Zr(this,t,e)}render(t=this.option){Jr(this,t)}}class en{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const rn='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;max-width:100vw;max-height:100vh;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class nn{constructor(t){this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope)?.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}async run(t){if(this.active)try{return await Promise.race([t(),this.cancelled])}finally{this.cancel()}}}const on=new WeakMap;function an(t){return on.get(t)}function sn(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const ln=St;class cn extends ln{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=u(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return on.set(t,n),r.add(()=>{sn(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return Array.from(this.textTrack?.activeCues||[])}get cues(){return Array.from(this.textTrack?.cues||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?O(r,t):R(r,t,e)}update(){!function(t){const e=an(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?at(t):t}\n
`).join("")).join("");o()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}async switch(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a={...o.subtitle,...e,url:t},i=an(this),s=i.revision+1,l=await this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),l}createTrack(t,e){!function(t,e,r){const n=an(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=n.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||n.trackRevision!==o)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||n.trackRevision!==o)return p.dispose(),void d.remove();const h=n.track;n.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{h?.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&sn(n)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw i.$track=s,l&&l.insertBefore(s,c?.parentNode===l?c:null),h}}(this,t,e)}async init(t){const e=an(this),r=function(t){const e=t.request,r=new nn(t.scope);return t.request=r,t.revision+=1,e?.cancel(),r}(e),{notice:n,template:{$subtitle:a}}=this.art;return r.run(async()=>{if(!this.textTrack)return null;if(o(t,Ct.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const n=await fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const o=await n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||Z(e.url)){case"srt":return{vtt:e.onVttLoad(pt(r))};case"ass":return{vtt:e.onVttLoad(ht(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(o,t);if(!r.active)return;const l=void 0===s?t.url:i=ut(s.vtt);if(!r.active)return;a.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(s){if(!r.active)return;throw a.innerHTML="",n.show=s,s}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}})}}const dn=`\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
${a}
\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 `;class pn{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=L(e.container),G(this.$container,`No container element found by ${e.container}`)),G(B(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();G("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),G(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=d.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=p(t);o.rollback=r,d.set(e,t),o.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,Hr(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return dn}query(t){return L(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=pn.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){G(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),F(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&P(this.$player,"art-backdrop"),E&&P(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":P(this.$player,"art-destroy")}}const un=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class hn{on(t,e,r){const n=this.e||(this.e={});let o=un(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(un(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=un(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),gn.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${gn.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&mn.push(this)}catch(n){try{f(this,mn,!0,gn.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw n}}static get instances(){return mn}static get version(){return a}static get config(){return i}static get utils(){return mt}static get scheme(){return Ct}static get Emitter(){return hn}static get validator(){return o}static get kindOf(){return o.kindOf}static get html(){return pn.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:x?"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){f(this,mn,t,gn.REMOVE_SRC_WHEN_DESTROY)}}return gn.STYLE=rn,gn.DEBUG=!1,gn.CONTEXTMENU=!0,gn.NOTICE_TIME=2e3,gn.SETTING_WIDTH=250,gn.SETTING_ITEM_WIDTH=200,gn.SETTING_ITEM_HEIGHT=35,gn.RESIZE_TIME=200,gn.SCROLL_TIME=200,gn.SCROLL_GAP=50,gn.AUTO_PLAYBACK_MAX=10,gn.AUTO_PLAYBACK_MIN=5,gn.AUTO_PLAYBACK_TIMEOUT=3e3,gn.RECONNECT_TIME_MAX=5,gn.RECONNECT_SLEEP_TIME=1e3,gn.CONTROL_HIDE_TIME=3e3,gn.DBCLICK_TIME=300,gn.DBCLICK_FULLSCREEN=!0,gn.MOBILE_DBCLICK_PLAY=!0,gn.MOBILE_CLICK_PLAY=!1,gn.AUTO_ORIENTATION_TIME=200,gn.INFO_LOOP_TIME=1e3,gn.FAST_FORWARD_VALUE=3,gn.FAST_FORWARD_TIME=1e3,gn.TOUCH_MOVE_RATIO=.5,gn.VOLUME_STEP=.1,gn.SEEK_STEP=5,gn.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],gn.ASPECT_RATIO=["default","4:3","16:9"],gn.FLIP=["normal","horizontal","vertical"],gn.FULLSCREEN_WEB_IN_BODY=!0,gn.LOG_VERSION=!0,gn.USE_RAF=!1,gn.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=gn,C("artplayer-style",rn),setTimeout(()=>{gn.LOG_VERSION&&console.log(`%c ArtPlayer %c ${gn.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),gn}); diff --git a/docs/compiled/artplayer.legacy.js b/docs/compiled/artplayer.legacy.js index 9e8ef7ba7..619727b35 100644 --- a/docs/compiled/artplayer.legacy.js +++ b/docs/compiled/artplayer.legacy.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!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";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var a=t=>{try{s(r.next(t))}catch(e){o(e)}},i=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,o||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function S(t,e){const r=$(t).child();return C.set(e,r),r}function z(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function L(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=z(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=z(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const P=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(P),O=/iPad|iPhone|iPod/i.test(P)&&!window.MSStream,R=O||P.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(P)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 N(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function W(t,e){return t.classList.add(e)}function Y(t,e){return t.classList.remove(e)}function F(t,e){return t.classList.contains(e)}function j(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function B(t,e,r){return t.style[e]=r,t}function H(t,e){for(const r in e)B(t,r,e[r]);return t}function q(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function U(t,e){q(t).forEach(t=>Y(t,e)),W(t,e)}function X(t,e,r="top"){I||(t.setAttribute("aria-label",e),W(t,"hint--rounded"),W(t,`hint--${r}`))}function G(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function K(t,e){return nt(t).includes(e)}function Z(t,e){return e.parentNode.replaceChild(t,e),t}function J(t){return document.createElement(t)}function Q(t="",e=""){const r=J("i");return W(r,"art-icon"),W(r,`art-icon-${t}`),j(r,e),r}function tt(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function et(t){return t.getBoundingClientRect()}function rt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function nt(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}function ot(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class at extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function it(t,e){if(!t)throw new at(e);return t}function st(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function lt(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function ct(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function dt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function pt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ut(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ht={"&":"&","<":"<",">":">","'":"'",'"':"""},ft={"&":"&","<":"<",">":">","'":"'",""":'"'},mt=/(&|<|>|'|")/g;function gt(t){return t.replace(/[&<>'"]/g,t=>ht[t]||t)}const vt=Object.defineProperty,{hasOwnProperty:yt}=Object.prototype;function bt(t,e){return yt.call(t,e)}function wt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?xt(o,a):a,vt(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function kt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 $t(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Et(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Tt(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const Ct=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:at,addClass:W,append:j,assToVtt:Et,capitalize:pt,clamp:dt,createElement:J,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:vt,download:ct,errorHandle:it,escape:gt,get:wt,getComposedPath:nt,getExt:lt,getIcon:Q,getRect:et,getSafeAreaInsets:ot,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:bt,hasClass:F,includeFromEvent:K,inverseClass:U,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:G,isMobile:I,isSafari:A,loadImg:rt,mergeDeep:xt,query:N,queryAll:D,remove:function(t){return t.parentNode.removeChild(t)},removeClass:Y,replaceElement:Z,secondToTime:ut,setStyle:B,setStyleText:V,setStyles:H,siblings:q,silencePromise:st,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:kt,supportsFlex:tt,throttle:Tt,tooltip:X,unescape:function(t){return t.replace(mt,t=>ft[t]||t)},userAgent:P,vttToBlob:$t},Symbol.toStringTag,{value:"Module"}));function St(t,e){return j(t,e)}function zt(t,e){return e.querySelector(t)}const Lt="array",Mt="boolean",Pt="string",At="number",Ot="object",Rt="function";function It(t,e,r){return it(e===Pt||e===At||t instanceof Element,`${r.join(".")} require '${Pt}' or 'Element' type`)}const _t={html:It,disable:`?${Mt}`,name:`?${Pt}`,index:`?${At}`,style:`?${Ot}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${Pt}|${At}`,width:`?${At}`,selector:`?${Lt}`,onSelect:`?${Rt}`,switch:`?${Mt}`,onSwitch:`?${Rt}`,range:`?${Lt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Vt={id:Pt,container:It,url:Pt,poster:Pt,type:Pt,theme:Pt,lang:Pt,volume:At,isLive:Mt,muted:Mt,autoplay:Mt,autoSize:Mt,autoMini:Mt,loop:Mt,flip:Mt,playbackRate:Mt,aspectRatio:Mt,screenshot:Mt,setting:Mt,hotkey:Mt,pip:Mt,mutex:Mt,backdrop:Mt,fullscreen:Mt,fullscreenWeb:Mt,subtitleOffset:Mt,miniProgressBar:Mt,useSSR:Mt,playsInline:Mt,lock:Mt,gesture:Mt,fastForward:Mt,autoPlayback:Mt,autoOrientation:Mt,airplay:Mt,proxy:`?${Rt}`,plugins:[Rt],layers:[_t],contextmenu:[_t],settings:[_t],controls:[c(l({},_t),{position:(t,e,r)=>{const n=["top","left","right"];return it("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Mt}`,html:Pt,url:Pt}],highlight:[{time:At,text:Pt}],thumbnails:{url:Pt,number:At,column:At,width:At,height:At,scale:At},subtitle:{url:Pt,name:Pt,type:Pt,style:Ot,escape:Mt,encoding:Pt,onVttLoad:Rt},moreVideoAttr:Ot,i18n:Ot,icons:Ot,cssVar:Ot,customType:Ot},Nt=new WeakSet;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 F(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?W(e,r):Y(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,_t),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;it(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=S(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){W(t,`art-${r}`),W(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):j(e,t),a.html&&j(t,a.html),a.style&&H(t,a.style),a.tooltip&&X(t,a.tooltip)}(a,this.$parent,this.name,n,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,a),c=!0,o.set(n,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{L(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=o.get(n))?void 0:e.$ref)===a&&o.delete(n),c&&this[n]===a&&(l?Object.defineProperty(this,n,l):delete this[n]),a.remove(),d}}remove(t){it(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Nt.has(e)){Nt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{L(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Nt.delete(e)}}}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 Wt extends Dt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,S(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="1"]',t);n&&U(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&U(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="default"]',t);n&&U(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(pt(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="normal"]',t);n&&U(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=et(e),{height:c,width:d}=et(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),H(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{K(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Yt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function Ft(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function jt(t,e){const{$progress:r}=t.template,{left:n}=et(r),o=dt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:ut(a),width:o,percentage:dt(o/r.clientWidth,0,1)}}function Bt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=jt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function Ht(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=z(e),{on:i}=M(t,e);let s=()=>{};const l=zt(".art-progress-hover",e),c=zt(".art-progress-loaded",e),d=zt(".art-progress-played",e),p=zt(".art-progress-highlight",e),u=zt(".art-progress-indicator",e),h=zt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||jt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?B(h,"left",0):o>e.clientWidth-i/2?B(h,"left",e.clientWidth-i+"px"):B(h,"left",o-i/2+"px")}r.indicator?j(u,r.indicator):B(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&I;if("loaded"===r&&B(c,"width",100*n+"%"),"hover"===r&&(B(l,"width",100*n+"%"),K(i,p)?function(r){const{width:n}=jt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const a=h.clientWidth;n<=a/2?B(h,"left",0):n>e.clientWidth-a/2?B(h,"left",e.clientWidth-a+"px"):B(h,"left",n-a/2+"px")}(i):f(i),0===n?Y(o,"art-progress-hover"):W(o,"art-progress-hover")),"played"===r&&(B(d,"width",100*n+"%"),B(u,"left",100*n+"%")),m){W(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:ut(n*t.duration)}),s(),s=Yt(a,()=>{Y(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function qt(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{Ht(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=M(t,e);if(!I){let e=!1;a(r,"click",e=>{e.target!==n&&Bt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=jt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=jt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Ut(t){const{option:e}=t.art;e.isLive||t.add(qt({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.play),s=St(t,o.pause);function l(){B(i,"display","flex"),B(s,"display","none")}function c(){B(i,"display","none"),B(s,"display","flex")}X(i,a.get("Play")),X(s,a.get("Pause")),n(i,"click",()=>{st(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o}=e,a=St(t,o.volume),i=St(t,o.volumeClose),s=St(t,'
'),l=St(s,'
'),c=St(l,'
'),d=St(l,'
'),p=St(d,'
'),u=St(p,'
'),h=St(d,'
');function f(t){const{top:e,height:r}=et(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)B(a,"display","none"),B(i,"display","flex"),B(h,"top","100%"),B(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;B(a,"display","flex"),B(i,"display","none"),B(h,"top",100-t+"%"),B(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),I)B(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function n(){const r=`${ut(e.currentTime)} / ${ut(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;St(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e;St(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{X(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e;St(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{X(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;St(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.fullscreenWebOn),s=St(t,o.fullscreenWebOff);B(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(X(t,a.get("Exit Web Fullscreen")),B(i,"display","none"),B(s,"display","inline-flex")):(X(t,a.get("Web Fullscreen")),B(i,"display","inline-flex"),B(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.fullscreenOn),s=St(t,o.fullscreenOff);B(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(X(t,a.get("Exit Fullscreen")),B(i,"display","none"),B(s,"display","inline-flex")):(X(t,a.get("Fullscreen")),B(i,"display","inline-flex"),B(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rGt.get(t).option.selector}),vt(t,"$control_item",{get:()=>Gt.get(t).item}),vt(t,"$control_value",{get:()=>Gt.get(t).value})),Gt.set(t,e)}function Zt(t,e){t.innerHTML=e}function Jt(t,e,r,n,o){const{proxy:a}=t.events,i=z(n),s=r.selector;W(n,"art-control-selector");const l=document.createElement("div");W(l,"art-selector-value"),j(l,r.html),n.textContent="",j(n,l);const c=St(n,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const o=nt(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Xt.set(t,e),()=>{Xt.get(t)===e&&Xt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,n);c()&&Zt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));o.push(u)}class Qt extends Dt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;S(t,n);const{on:o}=M(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=K(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(Y(r,"art-hide-cursor"),W(r,"art-hover"),this.timer=Date.now()):(W(r,"art-hide-cursor"),Y(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=z(e),{on:a}=M(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Ut(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:it(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Zt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function te(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function ee(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const re=new WeakMap;class ne{constructor(t){this.destroyEvents=new Set;const e=$(t);re.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){K(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&&st(t.toggle()):st(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),I?!t.isLock&&s&&st(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=>{W(r,"art-hover"),t.emit("hover",!0,e)},e=>{Y(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let a=()=>{};const i=()=>{a(),a=Yt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Bt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=te(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=dt((n-i)/t.width,-1,1),d=dt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=dt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",dt(h/t.duration,0,1),e),t.notice.show=`${ut(h)} / ${ut(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Tt(()=>{t.emit("view",G(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=a.window||(null==(n=i.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}a(),e.bindGlobalEvents=a}(t,this),ee(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(re.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 oe{constructor(t){this.art=t,this.keys={},I||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",()=>{st(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class le{constructor(t){const e=l(l({},se),t.option.icons);for(const r in e)vt(this,r,{get:()=>Q(r,e[r])})}}class ce extends Dt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{B(o,"display","none"),B(a,"display",null)}),n.proxy(e.$state,"click",()=>st(t.play()))}}class he{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,W(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",Y(r,"art-notice-show")},e.NOTICE_TIME)):Y(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function fe(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function me(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const ge=new WeakMap,ve=new WeakMap,ye=new WeakMap;function be(t){return ye.get(t)||$(t)}function we(t){const e=ge.get(t),r=ye.get(t);return()=>ge.get(t)===e&&(!e||e.active())&&ye.get(t)===r&&(!r||!r.closed)}function xe(t){const e=ye.get(t),r=$(t).child(),n=r.child();ye.set(t,r),r.add(()=>{ye.get(t)===r&&ye.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&ge.get(t)===o};return ge.set(t,o),n.add(()=>{ge.get(t)===o&&ge.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function ke(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function $e(t,e,r){ve.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ve.get(t)===e&&(ve.delete(t),ke(e))}}function Ee(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Te(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=be(t),l=0;return{reset(){l=0,null==i||i.dispose(),Y(a,"art-error")},loadStart(){Y(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=be(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===be(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Ce(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Te(t);!function(t,e){fe(t,"video:canplay",()=>{e.reset(),me(t,[["loading",!1]])}),fe(t,"video:canplay",()=>{me(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;fe(t,"video:ended",()=>{if(e.loop){const e=we(t);if(t.seek=0,E(t)||!e())return;st(t.play()),e()&&me(t,[["controls",!1],["mask",!1]],e)}else me(t,[["controls",!0],["mask",!0]])})}(t),fe(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;fe(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&me(t,[["loading",!1],["controls",!0],["mask",!0]])}),fe(t,"video:loadstart",()=>{e.loadStart(),me(t,[["loading",!0],["mask",!1],["controls",!0]])}),fe(t,"video:pause",()=>{me(t,[["controls",!0],["mask",!0]])}),fe(t,"video:play",()=>{me(t,[["mask",!1]]),E(t)||B(r,"display","none")}),fe(t,"video:playing",()=>me(t,[["mask",!1]])),fe(t,"video:progress",()=>{t.playing&&me(t,[["loading",!1]])}),fe(t,"video:seeked",()=>me(t,[["loading",!1],["mask",!0]])),fe(t,"video:seeking",()=>me(t,[["loading",!0],["mask",!1]])),fe(t,"video:timeupdate",()=>me(t,[["mask",!1]])),fe(t,"video:waiting",()=>me(t,[["loading",!0],["mask",!1]]))}(t,e)}const Se=[["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"]],ze=(()=>{if("undefined"===typeof document)return!1;const t=Se[0],e={};for(const r of Se){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Le={change:ze.fullscreenchange,error:ze.fullscreenerror},Me={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Me.off("change",o),r()};Me.on("change",o);const a=t[ze.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Me.isFullscreen)return void t();const r=()=>{Me.off("change",r),t()};Me.on("change",r);const n=document[ze.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Me.isFullscreen?Me.exit():Me.request(t,e),onchange(t){Me.on("change",t)},onerror(t){Me.on("error",t)},on(t,e){const r=Le[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Le[t];r&&document.removeEventListener(r,e,!1)},raw:ze};function Pe(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=t=>{Me.on("change",()=>{t.emit("fullscreen",Me.isFullscreen),Me.isFullscreen?(t.state="fullscreen",W(o,"art-fullscreen")):Y(o,"art-fullscreen"),t.emit("resize")}),Me.on("error",e=>{t.emit("fullscreenError",e)}),vt(t,"fullscreen",{get:()=>Me.isFullscreen,set(t){return d(this,null,function*(){t?yield Me.request(o):yield Me.exit()})}})};t.once("video:loadedmetadata",()=>{var o;Me.isEnabled?a(t):n.webkitSupportsFullscreen?((o=t).on("document:webkitfullscreenchange",()=>{o.emit("fullscreen",o.fullscreen),o.emit("resize")}),vt(o,"fullscreen",{get:()=>document.fullscreenElement===n,set(t){t?(o.state="fullscreen",n.webkitEnterFullscreen()):n.webkitExitFullscreen()}})):vt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),vt(t,"fullscreen",wt(t,"fullscreen"))})}function Ae(t){const{icons:e,proxy:r,storage:n,template:{$player:o,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(Y(o,"art-mini"),B(e,"display","none"),o.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(B(e,"display","none"),B(r,"display","flex")):(B(e,"display","flex"),B(r,"display","none"))}function p(){const{$mini:e}=t.template,r=et(e),o=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;n.set("top",o),n.set("left",a),B(e,"top",`${o}px`),B(e,"left",`${a}px`)}vt(t,"mini",{get:()=>F(o,"art-mini"),set(u){if(u){t.state="mini",W(o,"art-mini");const u=function(){const{$mini:o}=t.template;if(o)return j(o,a),B(o,"display","flex");{const o=J("div");W(o,"art-mini-popup"),j(document.body,o),t.template.$mini=o,j(o,a);const p=j(o,'
');j(p,e.close),r(p,"click",c);const u=j(o,'
'),h=j(u,e.play),f=j(u,e.pause);return r(h,"click",()=>st(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){W(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;B(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,Y(o,"art-mini-dragging");const t=et(o);n.set("left",t.left),n.set("top",t.top),B(o,"left",`${t.left}px`),B(o,"top",`${t.top}px`),B(o,"transform",null)}}),o}}(),h=n.get("top"),f=n.get("left");"number"===typeof h&&"number"===typeof f?(B(u,"top",`${h}px`),B(u,"left",`${f}px`),G(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Oe(t){const{i18n:e,notice:r,template:{$video:n}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:n}=t;e.disablePictureInPicture=!1,vt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw n.show=t,t})):document.exitPictureInPicture().catch(t=>{throw n.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):n.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),vt(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):vt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Re(t){vt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Xt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=a)}return e.html})}})}})}function Ie(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function _e(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const a=xe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)Ie(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if($e(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=Ie(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ve(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===o||"played"===o&&l&&I){if(i||a||(a=!0,i=yield rt(p,u),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?B(s,"left",r.clientWidth-h+"px"):B(s,"left",o-h/2+"px")}(o)}})),vt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function Ne(t){const{option:e,template:{$video:r}}=t;vt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=ve.get(t);return ve.delete(t),e||xe(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield Ft(o.scope))&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||lt(n),s=e.customType[i];if(i&&s){if(!(yield Ft(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;Ie(l,t,"video:canplay",()=>{c=!d}),Ie(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Ee(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||Ie(o.scope,t,"video:canplay",e)}}catch(a){Ee(o,a)}finally{ke(o)}})}})}Object.defineProperties(Me,{isFullscreen:{get:()=>Boolean(document[ze.fullscreenElement])},element:{enumerable:!0,get:()=>document[ze.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ze.fullscreenEnabled])}});class De{constructor(t){Ne(t),function(t){const{template:{$video:e}}=t;vt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;vt(t,"play",{value(){return d(this,null,function*(){const i=we(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;vt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ut(t.currentTime)} / ${ut(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;vt(t,"forward",{set(e){r.seek=t.currentTime+e}}),vt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;vt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=dt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),vt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;vt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=dt(n,0,t.duration))}})}(t),function(t){vt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>_e(t,e,0);vt(t,"switchQuality",{value:e=>_e(t,e,t.currentTime)}),vt(t,"switchUrl",{value:e}),vt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;vt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;vt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)B(n,"width",null),B(n,"height",null),B(n,"margin",null),delete o.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(B(n,"width",s*r+"px"),B(n,"height","100%"),B(n,"margin","0 auto")):(B(n,"width","100%"),B(n,"height",e/s+"px"),B(n,"margin","auto 0")),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=J("canvas");vt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),vt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),vt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return ct(n,`${e||`artplayer_${ut(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Pe(t),function(t){const{constructor:e,template:{$container:r,$player:n}}=t;let o="";vt(t,"fullscreenWeb",{get:()=>F(n,"art-fullscreen-web"),set(a){a?(o=n.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&j(document.body,n),t.state="fullscreenWeb",B(n,"width","100%"),B(n,"height","100%"),W(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&j(r,n),o&&(n.style.cssText=o,o=""),Y(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Oe(t),function(t){const{$video:e}=t.template,r=t;vt(t,"loaded",{get:()=>r.loadedTime/e.duration}),vt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){vt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;vt(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:n}=t.template;vt(t,"autoSize",{value(){const{videoWidth:o,videoHeight:a}=n,{width:i,height:s}=et(e),l=o/a;if(i/s>l)B(r,"width",s*l/i*100+"%"),B(r,"height","100%");else{const t=i/l/s*100;B(r,"width","100%"),B(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;vt(t,"rect",{get:()=>et(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}vt(t,"x",{get:()=>e.left+window.pageXOffset}),vt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;vt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(pt(o))}`,t.emit("flip",o)}})}(t),Ae(t),function(t){const{template:{$poster:e}}=t;vt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){B(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;vt(t,"autoHeight",{value(){const{clientWidth:n}=e,{videoHeight:o,videoWidth:a}=r,i=o*(n/a);B(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;vt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){vt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){vt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];vt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,vt(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Re(t),Ve(t),Ce(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=dt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=dt(a,0,1)),e.poster&&B(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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 We(t){const{notice:e,constructor:r,template:{$player:n,$video:o}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,n=document.documentElement.clientHeight;return t>e&&rn}return t.on("fullscreenWeb",e=>{var o;if(e){if(l()){const e=Number(null!=(o=r.AUTO_ORIENTATION_TIME)?o:0);setTimeout(()=>{t.fullscreenWeb&&!F(n,a)&&function(){const e=ot(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;B(n,"width",`${o}px`),B(n,"height",`${i}px`),B(n,"transform-origin","0 0"),B(n,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),W(n,a),t.isRotate=!0,t.emit("resize")}()},e)}}else F(n,a)&&(B(n,"width",""),B(n,"height",""),B(n,"transform-origin",""),B(n,"transform",""),Y(n,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const o=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(o&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,W(n,i)}catch(a){s=!1,e.show=a}}else if(F(n,i)&&Y(n,i),o&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return F(n,a)}}}function Ye(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=N(".art-auto-playback-last",s),c=N(".art-auto-playback-jump",s),d=N(".art-auto-playback-close",s);j(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),B(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(B(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ut(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{B(s,"display","none")}),a(c,"click",()=>{t.seek=r,st(t.play()),B(i,"display","none"),B(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{B(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function Fe(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,Y(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,W(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return F(n,"art-fast-forward")}}}function je(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return F(n,"art-lock")}function a(){W(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){Y(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=j(e,r.lock),o=j(e,r.unlock);B(n,"display","none"),t.on("lock",t=>{t?(B(n,"display","inline-flex"),B(o,"display","none")):(B(n,"display","none"),B(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function Be(t){return t.on("control",e=>{e?Y(t.template.$player,"art-mini-progress-bar"):W(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class He{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(Be),!E(t.art)&&e.lock&&I&&t.add(je),E(t.art)||!e.autoPlayback||e.isLive||t.add(Ye),!E(t.art)&&e.autoOrientation&&I&&t.add(We),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(Fe)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){it(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const a=bt(t,o);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(it(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||vt(t,o,{value:r})),t}(this,t,e)}}const qe=new WeakMap;function Ue(t){return!t.closed&&!qe.get(t)}function Xe(t){qe.set(t,(qe.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(qe.get(t)||1)-1;r?qe.set(t,r):qe.delete(t)}}const Ge=new WeakMap,Ke=new WeakMap,Ze=["$parent","$parents","$option","$events","$formatted"];function Je(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Ge.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Ge.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function Qe(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function tr(t){const e=Ge.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function er(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>lr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...a.splice(0)),sr.set(r,o),ar.set(e,r),ir.set(e,n)),i(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{i()}}}}}function hr(t,e,r,n,o,a){const i=a||dr(e);if(!Ue(i)||E(t))return;const s=t.proxy(r,n,e=>{if(Ue(i)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Ue(i)||E(t)?t.events.remove(s):(tr(e).events.push(s),a&&a!==ar.get(e)&&a.add(()=>{const r=tr(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function fr(t,e,r,n){const o=dr(e);if(!Ue(o)||E(t))return;const a=(...e)=>{if(Ue(o)&&!E(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function mr(t){var e,r;const{art:n,active:o}=t,{controls:a,constructor:{SETTING_WIDTH:i,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!a.setting||!t.show||!o)return;const p=l.getBoundingClientRect(),u=a.setting.getBoundingClientRect(),h=p.width/l.offsetWidth||1,f=(u.left-p.left+u.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||i,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const gr=new WeakMap;function vr(t){gr.delete(t)}const yr=new WeakMap;function br(t,e){e?yr.set(t,e):yr.delete(t)}function wr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=yr.get(t),a=null==o?void 0:o();for(const i of["html","icon","tooltip"]){const t=null==(e=r.get(i))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,i;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==a||a(),br(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(i=t.parentNode)||i.removeChild(t)}}const xr=new WeakMap;function kr(t,e,r,n,o,a,i,s){return d(this,null,function*(){try{const l=dr(e),c=dr(a),d=(xr.get(a)||0)+1;xr.set(a,d);const p=()=>Ue(l)&&Ue(c)&&!E(t.art)&&xr.get(a)===d;if(null==s||s(),!p())return;const u=yield o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function $r(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const Er=new WeakMap;function Tr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function Cr(t){var e;null==(e=Er.get(t))||e()}function Sr(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);vr(r),Cr(r);const n=wr(r),o=r.$item,a=null==o?void 0:o.parentNode,i=null==o?void 0:o.nextSibling,s=o?$r(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=ur(t.art,e);r&&a.push(r)}for(const t of n)i.push(Xe(nr(t)))}catch(l){try{Tr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,Tr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,Tr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>or(t)),...i]))}}}(t,r);let p=!0,u=!1;const h=()=>{if(!p)return;p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{Tr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{a&&o&&a.insertBefore(o,(null==i?void 0:i.parentNode)===a?i:null)},()=>t.format(),()=>{if(u){t.active=l,l&&t.cache.has(l)&&U(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>p&&!E(t.art)&&Er.get(r)===h;for(const v of d.items)Er.set(v,h);const m=$(t.art).add(()=>{p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(u=!0,t.render(),!f())return r;p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const zr=new WeakMap;function Lr(t,e,r){vt(t,`$${e}`,{configurable:!0,get:()=>r}),vt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",j(r,t)}})}function Mr(t,e,r=!1){var n,o;const a=function(t){const e=Er.get(t);return()=>!e||Er.get(t)===e}(e);if(!t.cache.has(e.$option))return;const i=t.cache.get(e.$option),s=e.$item;let l="selector";bt(e,"switch")&&(l="switch"),bt(e,"range")&&(l="range"),bt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!a())return;const p=function(t,e,r=$(t)){const n=ar.get(e);(!n||Ue(n)||n.closed)&&pr(t,e);const o=r.child();return ar.set(e,o),ir.set(e,r),sr.set(o,tr(e).events),o.add(()=>{lr(t,sr.get(o))}),o}(t.art,e,nr(i)),u=()=>Ue(p)&&!E(t.art)&&a();if(!u())return;const h=document.createElement("div");try{if(br(e),W(h,"art-setting-item"),B(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!u())return;const a=j(h,'
'),f=j(h,'
'),m=document.createElement("div");switch(W(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!u())return;j(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!u())return;j(m,t)}else j(m,c.check)}if(j(a,m),!u())return;Lr(e,"icon",m);const g=document.createElement("div");W(g,"art-setting-item-left-text");const v=e.html||"";if(!u())return;j(g,v),j(a,g),Lr(e,"html",g);const y=document.createElement("div");W(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!u())return;switch(j(y,b),j(f,y),Lr(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");W(t,"art-setting-item-right-icon");const r=j(t,c.switchOn),n=j(t,c.switchOff),o=e.switch;if(!u())return;B(o?n:r,"display","none"),j(f,t),vt(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!u())return;br(e,()=>{const t=a;return()=>{a=t}}),vt(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(B(n,"display","none"),B(r,"display",null)):(B(n,"display",null),B(r,"display","none"))}});break}case"range":{const t=document.createElement("div");W(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",j(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!u())return;Reflect.set(r,a,String(t))}W(r,"art-setting-range"),j(f,t),vt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!u())return;br(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),vt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");W(t,"art-setting-item-right-icon"),j(t,c.arrowRight),j(f,t)}}if(!u())return;if(function(t,e,r,n){const{art:o}=t,a=dr(e),i=(t,r,n)=>hr(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>kr(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>kr(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{var o,a;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(a=e.$parent)?void 0:a.onSelect)return kr(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&W(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>kr(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!u())return;vt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):j(i,h),e.mounted&&u()&&Yt(p,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{p.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function Pr(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Ue(nr(n)))return;const o=(zr.get(t)||0)+1;zr.set(t,o);const a=()=>zr.get(t)===o&&!E(t.art),i=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=i,i&&t.cache.has(i)&&U(t.cache.get(i),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{U(n,"art-current"),t.resize()}catch(c){throw a()&&t.cache.get(e)===n&&!nr(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return rr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),i=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!i())return;W(n,"art-setting-panel"),j(t.$parent,n),U(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ke.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=K(r,e.controls.setting),o=K(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(pt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{fr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){er(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&U(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=Ke.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;otr(t).parent},$parents:{get:()=>tr(t).parents},$option:{get:()=>tr(t).option},$events:{get:()=>tr(t).events},$formatted:{get:()=>!0}}),Ge.set(t,{parent:r,parents:n,option:o,events:(null==i?void 0:i.events)||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return er(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){mr(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&or(n)}catch(a){r.push(a)}}try{pr(t.art,e)}catch(a){a instanceof y?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);it(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{vr(t),Cr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{i()}catch(a){a instanceof y?o.push(...a.errors):o.push(a)}if(o.length)throw new y(o)}update(t){return Sr(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,a=n?void 0:function(t){const e={};gr.set(t,e);const r=()=>gr.get(t)===e;return{current:r,finish(){r()&&gr.delete(t)}}}(t);let i=!1;try{e.push(t),this.format(),i=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||a&&!a.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&i){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==a||a.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");B(a,"height",`${o}px`),W(a,"art-setting-item"),W(a,"art-setting-item-back");const i=j(a,'
'),s=document.createElement("div");W(s,"art-setting-item-left-icon"),j(s,n),j(i,s),j(i,e.$parent.html),hr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),nr(r)),j(r,a)}(this,t)}createItem(t,e=!1){Mr(this,t,e)}render(t=this.option){Pr(this,t)}}class Rr{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const Ir='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class _r{constructor(t){var e;this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=null==(e=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope))?void 0:e.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}run(t){return d(this,null,function*(){if(this.active)try{return yield Promise.race([t(),this.cancelled])}finally{this.cancel()}})}}const Vr=new WeakMap;function Nr(t){return Vr.get(t)}function Dr(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const Wr=Dt;class Yr extends Wr{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=$(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return Vr.set(t,n),r.add(()=>{Dr(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[0]}get activeCues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.activeCues)||[])}get cues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.cues)||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?H(r,t):B(r,t,e)}update(){!function(t){const e=Nr(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?gt(t):t}\n
`).join("")).join("");o()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a=c(l(l({},o.subtitle),e),{url:t}),i=Nr(this),s=i.revision+1,d=yield this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),d})}createTrack(t,e){!function(t,e,r){const n=Nr(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=n.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||n.trackRevision!==o)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||n.trackRevision!==o)return p.dispose(),void d.remove();const h=n.track;n.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{null==h||h.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&Dr(n)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw i.$track=s,l&&l.insertBefore(s,(null==c?void 0:c.parentNode)===l?c:null),h}}(this,t,e)}init(t){return d(this,null,function*(){const e=Nr(this),r=function(t){const e=t.request,r=new _r(t.scope);return t.request=r,t.revision+=1,null==e||e.cancel(),r}(e),{notice:n,template:{$subtitle:o}}=this.art;return r.run(()=>d(this,null,function*(){if(!this.textTrack)return null;if(m(t,Vt.subtitle),!t.url)return;let a;this.option=t,this.style(t.style);try{if(!r.active)return;const n=yield fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const i=yield n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||lt(e.url)){case"srt":return{vtt:e.onVttLoad(kt(r))};case"ass":return{vtt:e.onVttLoad(Et(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(i,t);if(!r.active)return;const l=void 0===s?t.url:a=$t(s.vtt);if(!r.active)return;o.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return a&&(e.ownedURL=a,a=void 0),l}catch(i){if(!r.active)return;throw o.innerHTML="",n.show=i,i}finally{a&&(e.scope.closed||this.url!==a?URL.revokeObjectURL(a):e.ownedURL=a)}}))})}}const Fr=`\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
${g}
\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 `;class jr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=N(e.container),it(this.$container,`No container element found by ${e.container}`)),it(tt(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();it("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),it(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,$r(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Fr}query(t){return N(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=jr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){it(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),Z(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&W(this.$player,"art-backdrop"),I&&W(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":W(this.$player,"art-destroy")}}const Br=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Hr{on(t,e,r){const n=this.e||(this.e={});let o=Br(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(Br(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=Br(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),Xr.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Xr.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&Ur.push(this)}catch(n){try{T(this,Ur,!0,Xr.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return Ur}static get version(){return g}static get config(){return v}static get utils(){return Ct}static get scheme(){return Vt}static get Emitter(){return Hr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return jr.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,Ur,t,Xr.REMOVE_SRC_WHEN_DESTROY)}}return Xr.STYLE=Ir,Xr.DEBUG=!1,Xr.CONTEXTMENU=!0,Xr.NOTICE_TIME=2e3,Xr.SETTING_WIDTH=250,Xr.SETTING_ITEM_WIDTH=200,Xr.SETTING_ITEM_HEIGHT=35,Xr.RESIZE_TIME=200,Xr.SCROLL_TIME=200,Xr.SCROLL_GAP=50,Xr.AUTO_PLAYBACK_MAX=10,Xr.AUTO_PLAYBACK_MIN=5,Xr.AUTO_PLAYBACK_TIMEOUT=3e3,Xr.RECONNECT_TIME_MAX=5,Xr.RECONNECT_SLEEP_TIME=1e3,Xr.CONTROL_HIDE_TIME=3e3,Xr.DBCLICK_TIME=300,Xr.DBCLICK_FULLSCREEN=!0,Xr.MOBILE_DBCLICK_PLAY=!0,Xr.MOBILE_CLICK_PLAY=!1,Xr.AUTO_ORIENTATION_TIME=200,Xr.INFO_LOOP_TIME=1e3,Xr.FAST_FORWARD_VALUE=3,Xr.FAST_FORWARD_TIME=1e3,Xr.TOUCH_MOVE_RATIO=.5,Xr.VOLUME_STEP=.1,Xr.SEEK_STEP=5,Xr.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Xr.ASPECT_RATIO=["default","4:3","16:9"],Xr.FLIP=["normal","horizontal","vertical"],Xr.FULLSCREEN_WEB_IN_BODY=!0,Xr.LOG_VERSION=!0,Xr.USE_RAF=!1,Xr.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Xr,V("artplayer-style",Ir),setTimeout(()=>{Xr.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Xr.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Xr}); +!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";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))i.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))a.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var i=t=>{try{s(r.next(t))}catch(e){o(e)}},a=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(i,a);s((r=r.apply(t,e)).next())});function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p,h={exports:{}};var f=(p||(p=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var i,a,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(i=t.template)?void 0:i.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const u=e.indexOf(t);-1!==u&&e.splice(u,1),t.isDestroy=!0,o||(null==(a=l.releaseContainer)||a.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const p of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",p);if(c.length)throw c[0]}const C=new WeakMap;function L(t,e){const r=$(t).child();return C.set(e,r),r}function S(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function P(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=S(e);if(o.closed)return;const i=(...t)=>{if(!o.closed)return n(...t)};t.on(r,i),o.add(()=>{t.off(r,i)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const i=S(e);if(i.closed)return()=>{};const a=t.events.proxy(r,n,t=>{if(!i.closed)return o(t)});return i.add(()=>{t.events.remove(a)})}(t,e,r,n,o)}}const z=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(z),O=/iPad|iPhone|iPod/i.test(z)&&!window.MSStream,R=O||z.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(z)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function N(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 D(t,e=document){return e.querySelector(t)}function W(t,e=document){return Array.from(e.querySelectorAll(t))}function F(t,e){return t.classList.add(e)}function V(t,e){return t.classList.remove(e)}function Y(t,e){return t.classList.contains(e)}function B(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function H(t,e,r){return t.style[e]=r,t}function j(t,e){for(const r in e)H(t,r,e[r]);return t}function q(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function U(t,e){q(t).forEach(t=>V(t,e)),F(t,e)}function X(t,e,r="top"){I||(t.setAttribute("aria-label",e),F(t,"hint--rounded"),F(t,`hint--${r}`))}function G(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function K(t,e){return nt(t).includes(e)}function Z(t,e){return e.parentNode.replaceChild(t,e),t}function J(t){return document.createElement(t)}function Q(t="",e=""){const r=J("i");return F(r,"art-icon"),F(r,`art-icon-${t}`),B(r,e),r}function tt(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function et(t){return t.getBoundingClientRect()}function rt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width*e,i.height=o.height*e,a.drawImage(o,0,0,i.width,i.height),i.toBlob(e=>{const o=URL.createObjectURL(e),i=new Image;i.onload=function(){r(i)},i.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},i.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function nt(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}function ot(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function at(t,e){if(!t)throw new it(e);return t}function st(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function lt(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function ct(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function dt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function pt(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ht={"&":"&","<":"<",">":">","'":"'",'"':"""},ft={"&":"&","<":"<",">":">","'":"'",""":'"'},mt=/(&|<|>|'|")/g;function gt(t){return t.replace(/[&<>'"]/g,t=>ht[t]||t)}const vt=Object.defineProperty,{hasOwnProperty:yt}=Object.prototype;function bt(t,e){return yt.call(t,e)}function wt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],i=r[n];let a;a=Array.isArray(o)&&Array.isArray(i)?o.concat(...i):e(o)&&e(i)?xt(o,i):i,vt(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function kt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 $t(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Et(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 n=t.match(e);if(!n)return null;const[,o="",i="",,,a=""]=n;return{start:r(o.trim()),end:r(i.trim()),text:a.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Tt(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const Ct=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:F,append:B,assToVtt:Et,capitalize:ut,clamp:dt,createElement:J,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:vt,download:ct,errorHandle:at,escape:gt,get:wt,getComposedPath:nt,getExt:lt,getIcon:Q,getRect:et,getSafeAreaInsets:ot,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:bt,hasClass:Y,includeFromEvent:K,inverseClass:U,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:G,isMobile:I,isSafari:A,loadImg:rt,mergeDeep:xt,query:D,queryAll:W,remove:function(t){return t.parentNode.removeChild(t)},removeClass:V,replaceElement:Z,secondToTime:pt,setStyle:H,setStyleText:N,setStyles:j,siblings:q,silencePromise:st,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:kt,supportsFlex:tt,throttle:Tt,tooltip:X,unescape:function(t){return t.replace(mt,t=>ft[t]||t)},userAgent:z,vttToBlob:$t},Symbol.toStringTag,{value:"Module"}));function Lt(t,e){return B(t,e)}function St(t,e){return e.querySelector(t)}const Pt="array",Mt="boolean",zt="string",At="number",Ot="object",Rt="function";function It(t,e,r){return at(e===zt||e===At||t instanceof Element,`${r.join(".")} require '${zt}' or 'Element' type`)}const _t={html:It,disable:`?${Mt}`,name:`?${zt}`,index:`?${At}`,style:`?${Ot}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${zt}|${At}`,width:`?${At}`,selector:`?${Pt}`,onSelect:`?${Rt}`,switch:`?${Mt}`,onSwitch:`?${Rt}`,range:`?${Pt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Nt={id:zt,container:It,url:zt,poster:zt,type:zt,theme:zt,lang:zt,volume:At,isLive:Mt,muted:Mt,autoplay:Mt,autoSize:Mt,autoMini:Mt,loop:Mt,flip:Mt,playbackRate:Mt,aspectRatio:Mt,screenshot:Mt,setting:Mt,hotkey:Mt,pip:Mt,mutex:Mt,backdrop:Mt,fullscreen:Mt,fullscreenWeb:Mt,subtitleOffset:Mt,miniProgressBar:Mt,useSSR:Mt,playsInline:Mt,lock:Mt,gesture:Mt,fastForward:Mt,autoPlayback:Mt,autoOrientation:Mt,airplay:Mt,proxy:`?${Rt}`,plugins:[Rt],layers:[_t],contextmenu:[_t],settings:[_t],controls:[c(l({},_t),{position:(t,e,r)=>{const n=["top","left","right"];return at("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Mt}`,html:zt,url:zt}],highlight:[{time:At,text:zt}],thumbnails:{url:zt,number:At,column:At,width:At,height:At,scale:At},subtitle:{url:zt,name:zt,type:zt,style:Ot,escape:Mt,encoding:zt,onVttLoad:Rt},moreVideoAttr:Ot,i18n:Ot,icons:Ot,cssVar:Ot,customType:Ot},Dt=new WeakSet;class Wt{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 Y(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):V(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,_t),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;at(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const i=document.createElement("div"),a=L(this.art,i),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;a.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(a.closed)return;if(function(t,e,r,n,o,i){F(t,`art-${r}`),F(t,`art-${r}-${n}`);const a=Array.from(e.children);t.dataset.index=String(i.index||o);const s=a.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):B(e,t),i.html&&B(t,i.html),i.style&&j(t,i.style),i.tooltip&&X(t,i.tooltip)}(i,this.$parent,this.name,n,this.id,r),a.closed)return;if(r.click){const t=this.art.events.proxy(i,"click",t=>{a.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,i,s),a.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,i),c=!0,o.set(n,{$ref:i,events:s,option:r}),r.mounted&&r.mounted.call(this.art,i),i}catch(d){try{P(i)}catch(u){console.warn("ArtPlayer component cleanup failed:",u)}throw(null==(e=o.get(n))?void 0:e.$ref)===i&&o.delete(n),c&&this[n]===i&&(l?Object.defineProperty(this,n,l):delete this[n]),i.remove(),d}}remove(t){at(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{P(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Ft extends Wt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,L(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="1"]',t);n&&U(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&U(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="default"]',t);n&&U(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="normal"]',t);n&&U(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let i=0;i{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:i,width:a,left:s,top:l}=et(e),{height:c,width:d}=et(r);let u=n-s,p=o-l;n+d>s+a&&(u=a-d),o+c>l+i&&(p=i-c),j(r,{top:`${p}px`,left:`${u}px`})}),o(e,"click",t=>{K(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Vt(t,e,r,n,o={}){const{capture:i=!1,once:a=!1,signal:s}=o;if(t.closed||(null==s?void 0:s.aborted))return()=>{};let l=()=>{};function c(e){a&&l(),t.closed||("function"===typeof n?n.call(this,e):n.handleEvent(e))}return e.addEventListener(r,c,o),l=t.add(()=>{try{e.removeEventListener(r,c,i)}finally{null==s||s.removeEventListener("abort",l)}}),null==s||s.addEventListener("abort",l,{once:!0}),l}function Yt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const i=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(i)}),o}function Bt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const i=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(i),n||r(!1)})})}function Ht(t,e){const{$progress:r}=t.template,{left:n}=et(r),o=dt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),i=o/r.clientWidth*t.duration;return{second:i,time:pt(i),width:o,percentage:dt(o/r.clientWidth,0,1)}}function jt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Ht(t,e);t.emit("setBar","played",n,e),t.seek=r}}function qt(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,i=S(e),{on:a}=M(t,e);let s=()=>{};const l=St(".art-progress-hover",e),c=St(".art-progress-loaded",e),d=St(".art-progress-played",e),u=St(".art-progress-highlight",e),p=St(".art-progress-indicator",e),h=St(".art-progress-tip",e);function f(r,n){const{width:o,time:i}=n||Ht(t,r);h.textContent=i||"00:00";const a=h.clientWidth;o<=a/2?H(h,"left",0):o>e.clientWidth-a/2?H(h,"left",e.clientWidth-a+"px"):H(h,"left",o-a/2+"px")}r.indicator?B(p,r.indicator):H(p,"backgroundColor","var(--art-theme)"),a("setBar",function(r,n,a){const m="played"===r&&a&&I;if("loaded"===r&&H(c,"width",100*n+"%"),"hover"===r&&(H(l,"width",100*n+"%"),K(a,u)?function(r){const{width:n}=Ht(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const i=h.clientWidth;n<=i/2?H(h,"left",0):n>e.clientWidth-i/2?H(h,"left",e.clientWidth-i+"px"):H(h,"left",n-i/2+"px")}(a):f(a),0===n?V(o,"art-progress-hover"):F(o,"art-progress-hover")),"played"===r&&(H(d,"width",100*n+"%"),H(p,"left",100*n+"%")),m){F(o,"art-progress-hover");f(a,{width:e.clientWidth*n,time:pt(n*t.duration)}),s(),s=Yt(i,()=>{V(o,"art-progress-hover")},500)}}),a("video:loadedmetadata",function(){u.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(a("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),a("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),a("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:i}=M(t,e);if(!I){let e=!1;i(r,"click",e=>{e.target!==n&&jt(t,e)}),i(r,"mousemove",e=>{const{percentage:r}=Ht(t,e);t.emit("setBar","hover",r,e)}),i(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),i(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Ht(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.play),s=Lt(t,o.pause);function l(){H(a,"display","flex"),H(s,"display","none")}function c(){H(a,"display","none"),H(s,"display","flex")}X(a,i.get("Play")),X(s,i.get("Pause")),n(a,"click",()=>{st(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o}=e,i=Lt(t,o.volume),a=Lt(t,o.volumeClose),s=Lt(t,'
'),l=Lt(s,'
'),c=Lt(l,'
'),d=Lt(l,'
'),u=Lt(d,'
'),p=Lt(u,'
'),h=Lt(d,'
');function f(t){const{top:e,height:r}=et(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)H(i,"display","none"),H(a,"display","flex"),H(h,"top","100%"),H(p,"top","100%"),c.textContent="0";else{const t=100*e.volume;H(i,"display","flex"),H(a,"display","none"),H(h,"top",100-t+"%"),H(p,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(i,"click",()=>{e.muted=!0}),n(a,"click",()=>{e.muted=!1}),I)H(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function n(){const r=`${pt(e.currentTime)} / ${pt(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;Lt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e;Lt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{X(t,i.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e;Lt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{X(t,i.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;Lt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.fullscreenWebOn),s=Lt(t,o.fullscreenWebOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(X(t,i.get("Exit Web Fullscreen")),H(a,"display","none"),H(s,"display","inline-flex")):(X(t,i.get("Web Fullscreen")),H(a,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.fullscreenOn),s=Lt(t,o.fullscreenOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(X(t,i.get("Exit Fullscreen")),H(a,"display","none"),H(s,"display","inline-flex")):(X(t,i.get("Fullscreen")),H(a,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),vt(t,"$control_item",{get:()=>Kt.get(t).item}),vt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,n,o){const{proxy:i}=t.events,a=S(n),s=r.selector;F(n,"art-control-selector");const l=document.createElement("div");F(l,"art-selector-value"),B(l,r.html),n.textContent="",B(n,l);const c=Lt(n,'
');for(let d=0;dd(null,null,function*(){if(a.closed)return;const o=nt(n),i=r.selector.find(t=>o.includes(t.$control_item));if(!i)return;const s=++u,c=()=>!a.closed&&s===u,d=a.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(n,c));try{if(e(i),a.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,i,i.$control_item,n);c()&&Jt(l,e)}}catch(p){console.warn("ArtPlayer selector failed:",p)}finally{d()}}));o.push(p)}class te extends Wt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;L(t,n);const{on:o}=M(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=K(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(V(r,"art-hide-cursor"),F(r,"art-hover"),this.timer=Date.now()):(F(r,"art-hide-cursor"),V(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=S(e),{on:i}=M(t,e),a=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(i("resize",a),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(a);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(a);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}a()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:at(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,n){const o=e-n,i=r-t;let a=0;if(Math.abs(i)<2&&Math.abs(o)<2)return a;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(i,o);return s>=-45&&s<45?a=4:s>=45&&s<135?a=1:s>=-135&&s<-45?a=2:(s>=135&&s<=180||s>=-180&&s<-135)&&(a=3),a}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const ne=new WeakMap;class oe{constructor(t){this.destroyEvents=new Set;const e=$(t);ne.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function i(e){K(e,n)?(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",i),t.on("document:contextmenu",i);let a=[];e.proxy(o,"click",e=>{const n=Date.now();a.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:i,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=a.filter(t=>n-t<=i);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&&st(t.toggle()):st(t.toggle()),a=c;break;case 2:t.emit("dblclick",e),I?!t.isLock&&s&&st(t.toggle()):l&&(t.fullscreen=!t.fullscreen),a=[];break;default:a=[]}})}(t,this),function(t,e){const{$player:r}=t.template;e.hover(r,e=>{F(r,"art-hover"),t.emit("hover",!0,e)},e=>{V(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let i=()=>{};const a=()=>{i(),i=Yt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>a()),t.on("window:resize",()=>a()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>a())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,i=!1,a=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&jt(t,e),i=!0;const{pageX:r,pageY:c}=e.touches[0];a=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&i&&t.duration){const{pageX:n,pageY:i}=e.touches[0],c=ee(a,s,n,i),d=[3,4].includes(c),u=[1,2].includes(c);if(d&&!t.isRotate||u&&t.isRotate){const c=dt((n-a)/t.width,-1,1),d=dt((i-s)/t.height,-1,1),u=t.isRotate?d:c,p=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=dt(l+t.duration*u*p,0,t.duration);t.seek=h,t.emit("setBar","played",dt(h/t.duration,0,1),e),t.notice.show=`${pt(h)} / ${pt(t.duration)}`}}},u=()=>{i&&(a=0,s=0,l=0,i=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",u)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Tt(()=>{t.emit("view",G(n,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"],n=["resize","scroll","orientationchange"],o=[];function i(i={}){for(let t=0;t{const n=i.document||a.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=i.window||(null==(n=a.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}i(),e.bindGlobalEvents=i}(t,this),re(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(ne.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 ie{constructor(t){this.art=t,this.keys={},I||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",()=>{st(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)vt(this,r,{get:()=>Q(r,e[r])})}}class de extends Wt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let i=()=>{};const a=W("[data-video]",r)||[];this.art.on("destroy",()=>i());const s=$(this.art);!function t(){for(let e=0;e{H(o,"display","none"),H(i,"display",null)}),n.proxy(e.$state,"click",()=>st(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,F(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",V(r,"art-notice-show")},e.NOTICE_TIME)):V(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function me({width:t,height:e}){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0}function ge(t,e){if(!me(t)||!Number.isFinite(e)||e<=0)return;const r=t.width/t.height>e?{width:e*t.height,height:t.height,axis:"width"}:{width:t.width,height:t.width/e,axis:"height"};return me(r)?r:void 0}function ve(t){const{$container:e,$video:r}=t.template;vt(t,"autoHeight",{value(){if(E(t))return;const n=function(t,e){if(!Number.isFinite(t)||t<=0||!me(e))return;const r=e.height*(t/e.width);return Number.isFinite(r)&&r>0?r:void 0}(e.clientWidth,{width:r.videoWidth,height:r.videoHeight});void 0===n||E(t)||(e.style.height=`${n}px`,t.emit("autoHeight",n))}})}function ye(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function be(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const we=new WeakMap,xe=new WeakMap,ke=new WeakMap;function $e(t){return ke.get(t)||$(t)}function Ee(t){const e=we.get(t),r=ke.get(t);return()=>we.get(t)===e&&(!e||e.active())&&ke.get(t)===r&&(!r||!r.closed)}function Te(t){const e=ke.get(t),r=$(t).child(),n=r.child();ke.set(t,r),r.add(()=>{ke.get(t)===r&&ke.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&we.get(t)===o};return we.set(t,o),n.add(()=>{we.get(t)===o&&we.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function Ce(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Le(t,e,r){xe.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{xe.get(t)===e&&(xe.delete(t),Ce(e))}}function Se(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Pe(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:i}}=t;let a,s=$e(t),l=0;return{reset(){l=0,null==a||a.dispose(),V(i,"art-error")},loadStart(){V(i,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=$e(t);if(d!==s&&(s=d,l=0),a&&!a.closed)return;const u=d.child();a=u,u.add(()=>{a===u&&(a=void 0)});const p=()=>!E(t)&&!u.closed&&d===$e(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Me(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Pe(t);!function(t,e){ye(t,"video:canplay",()=>{e.reset(),be(t,[["loading",!1]])}),ye(t,"video:canplay",()=>{be(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;ye(t,"video:ended",()=>{if(e.loop){const e=Ee(t);if(t.seek=0,E(t)||!e())return;st(t.play()),e()&&be(t,[["controls",!1],["mask",!1]],e)}else be(t,[["controls",!0],["mask",!0]])})}(t),ye(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;ye(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&be(t,[["loading",!1],["controls",!0],["mask",!0]])}),ye(t,"video:loadstart",()=>{e.loadStart(),be(t,[["loading",!0],["mask",!1],["controls",!0]])}),ye(t,"video:pause",()=>{be(t,[["controls",!0],["mask",!0]])}),ye(t,"video:play",()=>{be(t,[["mask",!1]]),E(t)||H(r,"display","none")}),ye(t,"video:playing",()=>be(t,[["mask",!1]])),ye(t,"video:progress",()=>{t.playing&&be(t,[["loading",!1]])}),ye(t,"video:seeked",()=>be(t,[["loading",!1],["mask",!0]])),ye(t,"video:seeking",()=>be(t,[["loading",!0],["mask",!1]])),ye(t,"video:timeupdate",()=>be(t,[["mask",!1]])),ye(t,"video:waiting",()=>be(t,[["loading",!0],["mask",!1]]))}(t,e)}const ze=[["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"]],Ae=(()=>{if("undefined"===typeof document)return!1;const t=ze[0],e={};for(const r of ze){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Oe={change:Ae.fullscreenchange,error:Ae.fullscreenerror},Re={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Re.off("change",o),r()};Re.on("change",o);const i=t[Ae.requestFullscreen](e);i instanceof Promise&&i.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Re.isFullscreen)return void t();const r=()=>{Re.off("change",r),t()};Re.on("change",r);const n=document[Ae.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Re.isFullscreen?Re.exit():Re.request(t,e),onchange(t){Re.on("change",t)},onerror(t){Re.on("error",t)},on(t,e){const r=Oe[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Oe[t];r&&document.removeEventListener(r,e,!1)},raw:Ae};function Ie(t,e,...r){const n=Reflect.get(t,e);if("function"!==typeof n)throw new TypeError(`Fullscreen method ${e} is not available`);return n.apply(t,r)}Object.defineProperties(Re,{isFullscreen:{get:()=>Boolean(document[Ae.fullscreenElement])},element:{enumerable:!0,get:()=>document[Ae.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Ae.fullscreenEnabled])}});const _e=new WeakMap;function Ne(t){try{Promise.resolve(t()).catch(()=>{})}catch(e){}}function De(t){const{document:e,elementProperty:r,changeEvent:n,target:o,exit:i}=t,a=function(t,e,r){let n=_e.get(t);if(!n){n=new WeakMap,_e.set(t,n);const o=n;t.addEventListener(r,()=>{const r=Reflect.get(t,e),n=r&&o.get(r);n&&(o.delete(r),Ne(n))})}return n}(e,r,n);a.set(o,i),t.element===o&&(a.delete(o),Ne(i))}function We(t,e,r,n,o=()=>t.element!==t.target){const i=e.child();let a,s,l=!1,c=!1,d=!1,u=!1,p=!1;const h=new Promise((t,e)=>{a=t,s=e});function f(t=!1,e){if(!l){l=!0;try{i.dispose()}catch(r){t||(t=!0,e=r)}t?s(e):a()}}i.add(()=>{l||(l=!0,c=!0,a(),d&&!u&&r&&De(t))});const m=()=>{d&&!u&&(r?t.element===t.target:o())&&f()};if(Vt(i,t.document,t.changeEvent,m),Vt(i,t.document,t.errorEvent,e=>{e.target!==t.target&&e.target!==t.document||(p=!0,d&&!u&&f(!0,new Error("Fullscreen request failed")))}),!i.closed)try{r&&function(t){var e;null==(e=_e.get(t.document))||e.delete(t.target)}(t);const e=r?t.request():t.exit();u=Boolean(e&&"function"===typeof e.then),d=!0,c&&!u&&r&&De(t),u?Promise.resolve(e).then(()=>{c?n():f()},t=>f(!0,t)).catch(()=>{}):p?f(!0,new Error("Fullscreen request failed")):m()}catch(g){f(!0,g)}return{promise:h,cancel:()=>i.dispose()}}function Fe(t,e){const r=$(t).child(),{$player:n,$video:o}=t.template,i=()=>e.element===n||e.element===o;let a,s=i(),l=0,c=s,d=!1,u=!1,p=!1;function h(){if(i())try{Promise.resolve(e.exit()).catch(()=>{})}catch(t){}}return r.add(()=>{l+=1,c=!1,n.classList.remove("art-fullscreen"),h()}),Vt(r,e.document,e.changeEvent,()=>{const r=i();if(r&&function(t){var e,r;return null!=(r=null==(e=_e.get(t.document))?void 0:e.has(t.target))&&r}(e))return;if(r&&u)return void h();if(r===s||E(t))return;s=r;const o=l,a=()=>E(t)||i()!==r||o!==l&&c!==r;t.emit("fullscreen",r),a()||(r&&(t.state="fullscreen"),a()||(n.classList.toggle("art-fullscreen",r),t.emit("resize")))}),Vt(r,e.document,e.errorEvent,r=>{(r.target===n||r.target===o||r.target===e.document&&(p||void 0!==a||i()))&&!E(t)&&t.emit("fullscreenError",r)}),{get:()=>!E(t)&&i(),set(n){if(E(t))return Promise.resolve();const o=++l;if(c=Boolean(n),c?u=!1:d&&(u=!0),null==a||a.cancel(),a=void 0,d=!1,!c&&!i())return Promise.resolve();p=!0,d=c;const s=We(e,r,c,()=>{!E(t)&&c||h()},()=>!i());p=!1,l===o?a=s:s.cancel();const f=s.promise.catch(e=>{throw E(t)||l!==o||(t.notice.show=e),e}).finally(()=>{l===o&&(a=void 0,d=!1)});return f.catch(()=>{}),f}}}const Ve=new WeakSet;function Ye(t,e=!1){return"string"===typeof t.webkitPresentationMode?"fullscreen"===t.webkitPresentationMode:"boolean"===typeof t.webkitDisplayingFullscreen?t.webkitDisplayingFullscreen:t.ownerDocument.fullscreenElement===t||e}function Be(t){Ve.delete(t),t.removeEventListener("webkitbeginfullscreen",He),t.removeEventListener("webkitpresentationmodechanged",He)}function He(t){var e;if(Ve.has(this)&&Ye(this,"webkitbeginfullscreen"===t.type)){Be(this);try{null==(e=this.webkitExitFullscreen)||e.call(this)}catch(r){}}}function je(t){Ve.add(t),t.addEventListener("webkitbeginfullscreen",He),t.addEventListener("webkitpresentationmodechanged",He)}function qe(t){const{$video:e}=t.template,r=$(t).child();let n=!1,o=Ye(e),i=o,a=!1,s=0;const l=()=>Ye(e,n);function c(r){if(E(t)||(c=e,Ve.has(c)))return;var c;"boolean"===typeof r&&(n=r);const d=l();if(d&&(a=!1),d===o)return;o=d;const u=s,p=()=>E(t)||l()!==d||u!==s&&i!==d;t.emit("fullscreen",d),p()||(d&&(t.state="fullscreen"),p()||t.emit("resize"))}r.add(()=>{var t;s++,i=!1,a&&je(e),l()&&(null==(t=e.webkitExitFullscreen)||t.call(e))}),Vt(r,e,"webkitbeginfullscreen",()=>c(!0)),Vt(r,e,"webkitendfullscreen",()=>c(!1)),Vt(r,e,"webkitpresentationmodechanged",()=>c());const d=()=>c();return t.on("document:webkitfullscreenchange",d),r.add(()=>{t.off("document:webkitfullscreenchange",d)}),{get:()=>!E(t)&&l(),set(r){if(E(t))return;const n=++s;if(i=Boolean(r),r){if(Be(e),t.state="fullscreen",E(t)||n!==s)return;a=!0;try{e.webkitEnterFullscreen()}catch(o){throw n===s&&(a=!1),o}}else a&&(a=!1,je(e)),l()&&e.webkitExitFullscreen()}}}function Ue(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,i=()=>{if(E(t))return;const i=function(t){const e=Re.raw,r=t.ownerDocument;if(e&&Reflect.get(r,e.fullscreenEnabled))return{document:r,target:t,get element(){return Reflect.get(r,e.fullscreenElement)},elementProperty:e.fullscreenElement,changeEvent:e.fullscreenchange,errorEvent:e.fullscreenerror,request:()=>Ie(t,e.requestFullscreen,void 0),exit:()=>Ie(r,e.exitFullscreen)}}(o);i?vt(t,"fullscreen",Fe(t,i)):n.webkitSupportsFullscreen&&"function"===typeof n.webkitEnterFullscreen&&"function"===typeof n.webkitExitFullscreen?vt(t,"fullscreen",qe(t)):vt(t,"fullscreen",{get:()=>!1,set(){E(t)||(r.show=e.get("Fullscreen Not Supported"))}}),vt(t,"fullscreen",wt(t,"fullscreen"))};t.once("video:loadedmetadata",i),$(t).add(()=>{t.off("video:loadedmetadata",i)})}function Xe(t){return{node:t,parent:t.parentNode,next:t.nextSibling}}function Ge({node:t,parent:e,next:r}){var n;if(!e)return void(null==(n=t.parentNode)||n.removeChild(t));const o=(null==r?void 0:r.parentNode)===e?r:null;t.parentNode===e&&t.nextSibling===o||e.insertBefore(t,o)}function Ke(t){const e=function(t){const{$player:e}=t.template;let r,n=0;function o(t,r){return null===t.style?e.removeAttribute("style"):e.setAttribute("style",t.style),!!r()&&(e.classList.remove("art-fullscreen-web"),!!r()&&(Ge(t.placement),r()))}return $(t).add(()=>{var t;n+=1;const i=r;if(r=void 0,i)try{o(i,()=>!0)}catch(a){try{e.parentNode!==i.placement.parent&&(null==(t=e.parentNode)||t.removeChild(e))}catch(s){throw new y([a,s])}throw a}}),i=>{if(E(t))return;const a=++n,s=()=>a===n&&!E(t);if(i){r||(r={placement:Xe(e),style:e.getAttribute("style")});const n=r;try{if(t.constructor.FULLSCREEN_WEB_IN_BODY&&e.parentNode!==document.body&&document.body.appendChild(e),!s())return;if(t.state="fullscreenWeb",!s())return;e.style.width="100%",e.style.height="100%",e.classList.add("art-fullscreen-web")}catch(l){throw s()&&o(n,s)&&(r=void 0),l}if(!s())return;t.emit("fullscreenWeb",!0)}else{if(r){if(!o(r,s))return;r=void 0}else e.classList.remove("art-fullscreen-web");if(!s())return;t.emit("fullscreenWeb",!1)}s()&&t.emit("resize")}}(t);vt(t,"fullscreenWeb",{get:()=>t.template.$player.classList.contains("art-fullscreen-web"),set:e})}function Ze(t,e,r){const n=Math.max(0,r.viewportWidth-r.width),o=Math.max(0,r.viewportHeight-r.height);return{left:Math.max(0,Math.min(t,n)),top:Math.max(0,Math.min(e,o))}}function Je(t){const{width:e,height:r}=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{width:e,height:r,viewportWidth:n.innerWidth,viewportHeight:n.innerHeight}}function Qe(t,e,r,n){const o=e.child();if(o.closed)return;const i=t.template.$mini;if(i){const t=i.style.display;return o.add(()=>{i.style.display=t}),{element:i,cancelDrag:()=>{},fresh:!1}}const a=t.template.$player.ownerDocument,s=a.createElement("div");s.className="art-mini-popup",o.add(()=>{s.remove()});try{const e=a.createElement("div");if(e.className="art-mini-close",e.append(t.icons.close),o.closed)return;const i=a.createElement("div");i.className="art-mini-state";const l=t.icons.play,c=t.icons.pause;if(o.closed)return;i.append(l,c),s.append(e,i),Vt(o,e,"click",n),Vt(o,l,"click",()=>{st(t.play())}),Vt(o,c,"click",()=>{t.pause()});const d=()=>{o.closed||(l.style.display=t.playing?"none":"flex",c.style.display=t.playing?"flex":"none")};d();for(const r of["video:playing","video:pause","video:timeupdate"])t.on(r,d),o.add(()=>{t.off(r,d)});const u=function(t,e,r,n){let o=!1,i=0,a=0;const s=()=>{o=!1,e.classList.remove("art-mini-dragging"),e.style.transform=""};Vt(r,e,"mousedown",t=>{const e=t;0===e.button&&n()&&(o=!0,i=e.clientX,a=e.clientY)});const l=t=>{!r.closed&&o&&n()&&(e.classList.add("art-mini-dragging"),e.style.transform=`translate(${t.clientX-i}px, ${t.clientY-a}px)`)},c=()=>{if(r.closed||!o||!n())return;const i=e.getBoundingClientRect(),a=Ze(i.left,i.top,Je(e));s(),e.style.left=`${a.left}px`,e.style.top=`${a.top}px`,t.storage.set("left",a.left),r.closed||t.storage.set("top",a.top)};return t.on("document:mousemove",l),r.add(()=>{t.off("document:mousemove",l)}),t.on("document:mouseup",c),r.add(()=>{t.off("document:mouseup",c)}),r.add(s),s}(t,s,o,r);if(o.closed)return;if(t.template.$mini=s,a.body.append(s),!o.closed)return{element:s,cancelDrag:u,fresh:!0}}catch(l){throw o.dispose(),t.template.$mini===s&&delete t.template.$mini,l}}function tr(t){const{$player:e,$video:r}=t.template,n=$(t).child();let o,i,a=0,s=!1,d=!1;const u=()=>!E(t)&&e.classList.contains("art-mini");function p(){if(i){const e=i,r=a;i=void 0;try{Ge(e)}catch(t){throw r!==a||i||(i=e),t}}}function h(){if(E(t))return;const r=++a;d=!1,p(),E(t)||r!==a||(null==o||o.cancelDrag(),e.classList.remove("art-mini"),t.template.$mini&&(t.template.$mini.style.display="none",t.emit("mini",!1)))}function f(){if(E(t))return;const m=++a;if(s)d=!0;else if(t.state="mini",!E(t)&&m===a){null!=i||(i=Xe(r)),e.classList.add("art-mini");try{if(!o){s=!0;try{o=Qe(t,n,u,h)}finally{s=!1}}if(d)return d=!1,void f();if(!o||E(t))return;if(m!==a)return void(u()||(o.element.style.display="none"));if(o.fresh?o.element.prepend(r):o.element.append(r),E(t)||m!==a)return;o.element.style.display=o.fresh?"":"flex",o.fresh=!1;const e=t.storage.get("top"),i=function(t,e,r){return"number"===typeof t&&Number.isFinite(t)&&"number"===typeof e&&Number.isFinite(e)&&t>=0&&e>=0&&t+r.width<=r.viewportWidth&&e+r.height<=r.viewportHeight?{left:t,top:e,reset:!1}:c(l({},Ze(r.viewportWidth-r.width-50,r.viewportHeight-r.height-50,r)),{reset:!0})}(t.storage.get("left"),e,Je(o.element));if(E(t)||m!==a)return;if(o.element.style.left=`${i.left}px`,o.element.style.top=`${i.top}px`,i.reset){if(t.storage.set("top",i.top),E(t)||m!==a)return;t.storage.set("left",i.left)}E(t)||m!==a||t.emit("mini",!0)}catch(g){const r=d;throw d=!1,E(t)||m!==a&&!r||(p(),e.classList.remove("art-mini"),o&&(o.element.style.display="none")),g}}}return n.add(()=>{a++;try{p()}finally{null==o||o.cancelDrag(),e.classList.remove("art-mini")}}),{get:u,set(t){t?f():h()}}}const er=new WeakSet,rr=t=>"picture-in-picture"===t.webkitPresentationMode;function nr(t){er.delete(t),t.removeEventListener("webkitpresentationmodechanged",or),t.removeEventListener("enterpictureinpicture",or)}function or(){var t;if(er.has(this)&&rr(this)){nr(this);try{null==(t=this.webkitSetPresentationMode)||t.call(this,"inline")}catch(e){}}}function ir(t){er.add(t),t.addEventListener("webkitpresentationmodechanged",or),t.addEventListener("enterpictureinpicture",or)}function ar(t){const{i18n:e,notice:r,template:{$video:n}}=t,o=n.ownerDocument;o.pictureInPictureEnabled&&"function"===typeof n.requestPictureInPicture&&"function"===typeof o.exitPictureInPicture?vt(t,"pip",function(t){const{$video:e}=t.template,r=e.ownerDocument,n=$(t).child(),o=()=>r.pictureInPictureElement===e;let i=o(),a=i,s=!1,l=!1,c=0;function d(){if(o())try{r.exitPictureInPicture().catch(()=>{})}catch(t){}}function u(e,r,n){e.then(()=>{!r||!E(t)&&a||d()},e=>{E(t)||c!==n||(t.notice.show=e)}).finally(()=>{c===n&&(s=!1)}).catch(()=>{})}return e.disablePictureInPicture=!1,n.add(()=>{c++,a=!1,d()}),Vt(n,e,"enterpictureinpicture",()=>{if(l)return void d();if(!o()||i)return;const e=c;t.state="pip",!E(t)&&e===c&&o()&&(i=!0,t.emit("pip",!0))}),Vt(n,e,"leavepictureinpicture",()=>{i&&!o()&&(i=!1,t.emit("pip",!1))}),{get:()=>!E(t)&&o()?e:null,set(n){if(E(t))return;const i=++c;if(a=Boolean(n),a?l=!1:s&&(l=!0),s=!1,a){if(t.state="pip",E(t)||c!==i)return;s=!0;try{u(e.requestPictureInPicture(),!0,i)}catch(d){throw c===i&&(s=!1),d}}else o()&&u(r.exitPictureInPicture(),!1,i)}}}(t)):"function"===typeof n.webkitSupportsPresentationMode&&"function"===typeof n.webkitSetPresentationMode?vt(t,"pip",function(t){const{$video:e}=t.template,r=$(t).child();let n=!1,o=!1,i=0,a=0;function s(r=!1){if(E(t)||er.has(e))return;const s=rr(e);if(s&&(o=!1),s===n&&!r)return;const l=i;s&&(t.state="pip"),E(t)||i!==l||rr(e)!==s||(n=s,a++,t.emit("pip",s))}e.webkitSetPresentationMode("inline"),r.add(()=>{i++,o&&ir(e),rr(e)&&e.webkitSetPresentationMode("inline")});for(const l of["webkitpresentationmodechanged","enterpictureinpicture","leavepictureinpicture"])Vt(r,e,l,()=>s());return{get:()=>!E(t)&&rr(e),set(r){var n;if(E(t))return;const l=++i,c=a;if(r){if(!1===(null==(n=e.webkitSupportsPresentationMode)?void 0:n.call(e,"picture-in-picture")))return void(t.notice.show=t.i18n.get("PIP Not Supported"));if(nr(e),t.state="pip",E(t)||i!==l)return;o=!0;try{e.webkitSetPresentationMode("picture-in-picture")}catch(d){throw l===i&&(o=!1),d}}else o&&(o=!1,ir(e)),rr(e)&&e.webkitSetPresentationMode("inline");E(t)||l!==i||c!==a||rr(e)!==Boolean(r)||s(!0)}}}(t)):vt(t,"pip",{get:()=>!1,set(){E(t)||(r.show=e.get("PIP Not Supported"))}})}function sr(t){vt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,i=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==i?void 0:i.html)||"",selector:e,onSelect(e,r,i){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(i);if(yield t.switchQuality(e.url),!E(t)&&r()){const i=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=i)}return e.html})}})}})}function lr(t,e,r,n,o=!0){let i,a=!1;const s=e=>{t.closed||a||(o&&(a=!0,i()),n(e))};return e[o?"once":"on"](r,s),i=t.add(()=>{e.off(r,s)}),s}function cr(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const i=Te(t),a=i.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,i.onError=void 0,i.onAssigned=void 0,a.dispose(),t?o(e):n(),t&&i.scope.dispose())};a.add(()=>{l()});const c=()=>!s&&i.active(),u=t=>l(!0,t);i.onError=u;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const p=a.child(),h={"video:error":u,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){u(e)}},"video:canplay":()=>{if(!c())return;p.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(u)}},f=a.child(),m=[],g=Object.keys(h);for(const e of g)lr(f,t,e,t=>{i.acceptingEvents&&m.push([e,t])},!1);if(Le(t,i,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=lr(p,t,e,h[e]);for(const[t,e]of m){if(!c()||p.closed)break;r[t](e)}m.length=0};i.assigned?v():i.onAssigned=v}catch(p){u(p)}})}function dr(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,i=!1,a=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:u,scale:p}=e.thumbnails;if(!d||!u)return;if("hover"===o||"played"===o&&l&&I){if(a||i||(i=!0,a=yield rt(u,p),i=!1),!a)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?H(s,"left",r.clientWidth-h+"px"):H(s,"left",o-h/2+"px")}(o)}})),vt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,i=!1,a=null)}})}function ur(t){const{option:e,template:{$video:r}}=t;vt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=xe.get(t);return xe.delete(t),e||Te(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield Bt(o.scope))&&o.active()&&(t.loading.show=!0));const i=t.url,a=e.type||lt(n),s=e.customType[a];if(a&&s){if(!(yield Bt(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;lr(l,t,"video:canplay",()=>{c=!d}),lr(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,a&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Se(o,t))}else{if(i&&URL.revokeObjectURL(i),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(i!==t.url&&(t.option.url=n,o.active()&&t.isReady&&i)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||lr(o.scope,t,"video:canplay",e)}}catch(i){Se(o,i)}finally{Ce(o)}})}})}class pr{constructor(t){ur(t),function(t){const{template:{$video:e}}=t;vt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:i}}=t;vt(t,"play",{value(){return d(this,null,function*(){const a=Ee(t),s=yield i.play();if(!a())return s;const l=e.get("Play");if(!a())return s;if(r.show=l,!a())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;vt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${pt(t.currentTime)} / ${pt(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;vt(t,"forward",{set(e){r.seek=t.currentTime+e}}),vt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;vt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=dt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),vt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;vt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=dt(n,0,t.duration))}})}(t),function(t){vt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>cr(t,e,0);vt(t,"switchQuality",{value:e=>cr(t,e,t.currentTime)}),vt(t,"switchUrl",{value:e}),vt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;vt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;vt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(i){if(!E(t)){if(i||(i="default"),"default"===i)n.style.width="",n.style.height="",n.style.margin="",delete o.dataset.aspectRatio;else{const e=i.split(":").map(Number),r=ge({width:o.clientWidth,height:o.clientHeight},e[0]/e[1]);if(E(t))return;"width"===(null==r?void 0:r.axis)?(n.style.width=`${r.width}px`,n.style.height="100%",n.style.margin="0 auto"):r&&(n.style.width="100%",n.style.height=`${r.height}px`,n.style.margin="auto 0"),o.dataset.aspectRatio=i}r.show=`${e.get("Aspect Ratio")}: ${"default"===i?e.get("Default"):i}`,E(t)||t.emit("aspectRatio",i)}}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=J("canvas");vt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(i){e.show=i,o(i)}})}),vt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(i){e.show=i,o(i)}})}),vt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return ct(n,`${e||`artplayer_${pt(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Ue(t),Ke(t),ar(t),function(t){const{$video:e}=t.template,r=t;vt(t,"loaded",{get:()=>r.loadedTime/e.duration}),vt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){vt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;vt(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:n}=t.template;vt(t,"autoSize",{value(){if(E(t))return;const o={width:n.videoWidth,height:n.videoHeight};if(!me(o))return;const i=et(e),a=ge(i,o.width/o.height);a&&!E(t)&&("width"===a.axis?(r.style.width=a.width/i.width*100+"%",r.style.height="100%"):(r.style.width="100%",r.style.height=a.height/i.height*100+"%"),t.emit("autoSize",{width:t.width,height:t.height}))}})}(t),function(t){const e=t;vt(t,"rect",{get:()=>et(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}vt(t,"x",{get:()=>e.left+window.pageXOffset}),vt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;vt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){E(t)||(o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(ut(o))}`,E(t)||t.emit("flip",o))}})}(t),function(t){vt(t,"mini",tr(t))}(t),function(t){const{template:{$poster:e}}=t;vt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){H(e,"backgroundImage",`url(${t})`)}})}(t),ve(t),function(t){const{$player:e}=t.template;vt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){vt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){vt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];vt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":i=!0;break;case"not-available":i=!1}}):i=!1,vt(t,"airplay",{value(){i?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),sr(t),dr(t),Me(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const a in e.moreVideoAttr)t.attr(a,e.moreVideoAttr[a]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=dt(e.volume,0,1));const i=r.get("volume");"number"===typeof i&&(n.volume=dt(i,0,1)),e.poster&&H(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["webkit-playsinline"]=!0),e.theme&&(e.cssVar["--art-theme"]=e.theme);for(const a in e.cssVar)t.cssVar(a,e.cssVar[a]);t.url=e.url}(t)}}const hr=new WeakMap,fr="art-auto-orientation-fullscreen";function mr(t){if(hr.get(t.orientation)===t)try{t.orientation.unlock()}catch(e){}}const gr="art-auto-orientation",vr=["width","height","transform-origin","transform"];function yr(t){const{$player:e,$video:r}=t.template,n=()=>{const t={width:r.videoWidth,height:r.videoHeight},n=e.ownerDocument.documentElement,o={width:n.clientWidth,height:n.clientHeight};return me(t)&&me(o)&&(t.width>t.height&&o.widtho.height)},o=function(t,e){const{$player:r}=t.template,n=$(t);let o,i=()=>{};function a(){i(),i=()=>{};const e=o;if(o=void 0,e&&t.fullscreenWeb)for(const{name:t,value:o,priority:i}of e)r.style.setProperty(t,o,i);const n=r.classList.contains(gr);r.classList.remove(gr),n&&(t.isRotate=!1,E(t)||t.emit("resize"))}function s(n){if(!t.fullscreenWeb||!e())return;const i=ot();if(E(t)||!t.fullscreenWeb)return;const a=r.ownerDocument.documentElement;null!=o||(o=vr.map(t=>({name:t,value:r.style.getPropertyValue(t),priority:r.style.getPropertyPriority(t)}))),r.style.width=a.clientHeight-i.top-i.bottom+"px",r.style.height=a.clientWidth-i.left-i.right+"px",r.style.transformOrigin="0 0",r.style.transform=`rotate(90deg) translate(${i.top}px, -${a.clientWidth-i.right}px)`,r.classList.add(gr),t.isRotate=!0,n&&t.emit("resize")}return n.add(a),r=>{var l;E(t)||(r?o?s(!1):e()&&(i(),i=Yt(n,()=>{o||s(!0)},Number(null!=(l=t.constructor.AUTO_ORIENTATION_TIME)?l:0))):a())}}(t,n),i=function(t,e){const{$player:r}=t.template;let n;function o(){const t=n;n=void 0,r.classList.remove(fr),t&&(t.cancelled=!0,mr(t),t.settled&&hr.get(t.orientation)===t&&hr.delete(t.orientation))}return $(t).add(o),i=>{var a,s;if(E(t))return;if(!i)return void o();if(n&&!n.cancelled&&hr.get(n.orientation)===n)return;const l=null==(s=null==(a=r.ownerDocument.defaultView)?void 0:a.screen)?void 0:s.orientation;if("function"!==typeof(null==l?void 0:l.lock)||"function"!==typeof l.unlock||!e())return;const c={orientation:l,cancelled:!1,settled:!1};n=c,hr.set(l,c);const d=()=>!E(t)&&!c.cancelled&&n===c&&hr.get(l)===c,u=e=>{c.settled=!0;const o=d();hr.get(l)===c&&hr.delete(l),n===c&&(n=void 0),o&&(r.classList.remove(fr),t.notice.show=e)};try{const t=l.lock(l.type.startsWith("portrait")?"landscape":"portrait");Promise.resolve(t).then(()=>{c.settled=!0,d()?r.classList.add(fr):(mr(c),hr.get(l)===c&&hr.delete(l))}).catch(u)}catch(p){u(p)}}}(t,n);return t.on("fullscreenWeb",o),t.on("fullscreen",i),$(t).add(()=>{t.off("fullscreenWeb",o),t.off("fullscreen",i)}),{name:"autoOrientation",get state(){return e.classList.contains("art-auto-orientation")}}}function br(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:i,template:{$poster:a}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=D(".art-auto-playback-last",s),c=D(".art-auto-playback-jump",s),d=D(".art-auto-playback-close",s);B(d,r.close);let u=null;function p(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(u),H(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(H(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${pt(r)}`,c.textContent=e.get("Jump Play"),i(d,"click",()=>{H(s,"display","none")}),i(c,"click",()=>{t.seek=r,st(t.play()),H(a,"display","none"),H(s,"display","none")}),t.once("video:timeupdate",()=>{u=setTimeout(()=>{H(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",p),t.on("restart",p),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function wr(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let i=null,a=!1,s=1;const l=()=>{clearTimeout(i),a&&(a=!1,t.playbackRate=s,V(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(i=setTimeout(()=>{a=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,F(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return Y(n,"art-fast-forward")}}}function xr(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return Y(n,"art-lock")}function i(){F(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function a(){V(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=B(e,r.lock),o=B(e,r.unlock);H(n,"display","none"),t.on("lock",t=>{t?(H(n,"display","inline-flex"),H(o,"display","none")):(H(n,"display","none"),H(o,"display","inline-flex"))})},click(){o()?a():i()}}),{name:"lock",get state(){return o()},set state(t){t?i():a()}}}function kr(t){return t.on("control",e=>{e?V(t.template.$player,"art-mini-progress-bar"):F(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class $r{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(kr),!E(t.art)&&e.lock&&I&&t.add(xr),E(t.art)||!e.autoPlayback||e.isLive||t.add(br),!E(t.art)&&e.autoOrientation&&I&&t.add(yr),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(wr)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){at(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const i=bt(t,o);if(E(t.art))return t;const a=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(at(!i,a),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||vt(t,o,{value:r})),t}(this,t,e)}}const Er=new WeakMap;function Tr(t){return!t.closed&&!Er.get(t)}function Cr(t){Er.set(t,(Er.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Er.get(t)||1)-1;r?Er.set(t,r):Er.delete(t)}}const Lr=new WeakMap,Sr=new WeakMap,Pr=["$parent","$parents","$option","$events","$formatted"];function Mr(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Lr.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Lr.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function zr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function Ar(t){const e=Lr.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function Or(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>Fr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...i.splice(0)),Wr.set(r,o),Nr.set(e,r),Dr.set(e,n)),a(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{a()}}}}}function jr(t,e,r,n,o,i){const a=i||Yr(e);if(!Tr(a)||E(t))return;const s=t.proxy(r,n,e=>{if(Tr(a)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Tr(a)||E(t)?t.events.remove(s):(Ar(e).events.push(s),i&&i!==Nr.get(e)&&i.add(()=>{const r=Ar(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function qr(t,e,r,n){const o=Yr(e);if(!Tr(o)||E(t))return;const i=(...e)=>{if(Tr(o)&&!E(t))return n(...e)};t.on(r,i),o.add(()=>{t.off(r,i)})}function Ur(t){var e,r;const{art:n,active:o}=t,{controls:i,constructor:{SETTING_WIDTH:a,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!i.setting||!t.show||!o)return;const u=l.getBoundingClientRect(),p=i.setting.getBoundingClientRect(),h=u.width/l.offsetWidth||1,f=(p.left-u.left+p.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:i,controlCenter:a,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*i),Math.max(0,r-s-c)),left:Math.max(c,Math.min(a-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||a,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const Xr=new WeakMap;function Gr(t){Xr.delete(t)}const Kr=new WeakMap;function Zr(t,e){e?Kr.set(t,e):Kr.delete(t)}function Jr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=Kr.get(t),i=null==o?void 0:o();for(const a of["html","icon","tooltip"]){const t=null==(e=r.get(a))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,a;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==i||i(),Zr(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(a=t.parentNode)||a.removeChild(t)}}const Qr=new WeakMap;function tn(t,e,r,n,o,i,a,s){return d(this,null,function*(){try{const l=Yr(e),c=Yr(i),d=(Qr.get(i)||0)+1;Qr.set(i,d);const u=()=>Tr(l)&&Tr(c)&&!E(t.art)&&Qr.get(i)===d;if(null==s||s(),!u())return;const p=yield o.call(t.art,e,r,n);u()&&Reflect.set(i,a,p)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function en(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const rn=new WeakMap;function nn(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function on(t){var e;null==(e=rn.get(t))||e()}function an(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);Gr(r),on(r);const n=Jr(r),o=r.$item,i=null==o?void 0:o.parentNode,a=null==o?void 0:o.nextSibling,s=o?en(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const i=[],a=[];try{for(const e of r){const r=Hr(t.art,e);r&&i.push(r)}for(const t of n)a.push(Cr(Ir(t)))}catch(l){try{nn([...i.reverse().map(t=>t.resume),...a])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,nn([...i.reverse().map(t=>t.resume),...a]))},dispose(){s&&(s=!1,nn([...i.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>_r(t)),...a]))}}}(t,r);let u=!0,p=!1;const h=()=>{if(!u)return;u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{nn([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{i&&o&&i.insertBefore(o,(null==a?void 0:a.parentNode)===i?a:null)},()=>t.format(),()=>{if(p){t.active=l,l&&t.cache.has(l)&&U(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>u&&!E(t.art)&&rn.get(r)===h;for(const v of d.items)rn.set(v,h);const m=$(t.art).add(()=>{u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const i=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,i))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(p=!0,t.render(),!f())return r;u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const sn=new WeakMap;function ln(t,e,r){vt(t,`$${e}`,{configurable:!0,get:()=>r}),vt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",B(r,t)}})}function cn(t,e,r=!1){var n,o;const i=function(t){const e=rn.get(t);return()=>!e||rn.get(t)===e}(e);if(!t.cache.has(e.$option))return;const a=t.cache.get(e.$option),s=e.$item;let l="selector";bt(e,"switch")&&(l="switch"),bt(e,"range")&&(l="range"),bt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!i())return;const u=function(t,e,r=$(t)){const n=Nr.get(e);(!n||Tr(n)||n.closed)&&Br(t,e);const o=r.child();return Nr.set(e,o),Dr.set(e,r),Wr.set(o,Ar(e).events),o.add(()=>{Fr(t,Wr.get(o))}),o}(t.art,e,Ir(a)),p=()=>Tr(u)&&!E(t.art)&&i();if(!p())return;const h=document.createElement("div");try{if(Zr(e),F(h,"art-setting-item"),H(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!p())return;const i=B(h,'
'),f=B(h,'
'),m=document.createElement("div");switch(F(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!p())return;B(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!p())return;B(m,t)}else B(m,c.check)}if(B(i,m),!p())return;ln(e,"icon",m);const g=document.createElement("div");F(g,"art-setting-item-left-text");const v=e.html||"";if(!p())return;B(g,v),B(i,g),ln(e,"html",g);const y=document.createElement("div");F(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!p())return;switch(B(y,b),B(f,y),ln(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");F(t,"art-setting-item-right-icon");const r=B(t,c.switchOn),n=B(t,c.switchOff),o=e.switch;if(!p())return;H(o?n:r,"display","none"),B(f,t),vt(e,"$switch",{configurable:!0,get:()=>t});let i=e.switch;if(!p())return;Zr(e,()=>{const t=i;return()=>{i=t}}),vt(e,"switch",{configurable:!0,get:()=>i,set(t){i=t,t?(H(n,"display","none"),H(r,"display",null)):(H(n,"display",null),H(r,"display","none"))}});break}case"range":{const t=document.createElement("div");F(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",B(t,r);for(const[o,i]of["value","min","max","step"].entries()){const t=e.range[o];if(!p())return;Reflect.set(r,i,String(t))}F(r,"art-setting-range"),B(f,t),vt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!p())return;Zr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),vt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");F(t,"art-setting-item-right-icon"),B(t,c.arrowRight),B(f,t)}}if(!p())return;if(function(t,e,r,n){const{art:o}=t,i=Yr(e),a=(t,r,n)=>jr(o,e,t,r,n,i);switch(n){case"switch":e.onSwitch&&a(r,"click",n=>tn(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,i]of[["change","onRange"],["input","onChange"]])e[i]&&a(n,o,o=>tn(t,e,r,o,e[i],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":a(r,"click",n=>{var o,i;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(i=e.$parent)?void 0:i.onSelect)return tn(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&F(r,"art-current");break;case"button":e.onClick&&a(r,"click",n=>tn(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!p())return;vt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):B(a,h),e.mounted&&p()&&Yt(u,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{u.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function dn(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Tr(Ir(n)))return;const o=(sn.get(t)||0)+1;sn.set(t,o);const i=()=>sn.get(t)===o&&!E(t.art),a=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=a,a&&t.cache.has(a)&&U(t.cache.get(a),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{U(n,"art-current"),t.resize()}catch(c){throw i()&&t.cache.get(e)===n&&!Ir(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return Rr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),a=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!a())return;F(n,"art-setting-panel"),B(t.$parent,n),U(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Sr.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=K(r,e.controls.setting),o=K(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},i=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(i)});const{$player:a,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(a),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(a,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function i(t){return 1===t?e.get("Normal"):t.toFixed(1)}function a(){const e=t.setting.find(`playback-rate-${t.playbackRate}`);t.setting.check(e)}return{width:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:i(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:i(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"video:ratechange",()=>a())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function i(t){return"default"===t?e.get("Default"):t}function a(){const e=t.setting.find(`aspect-ratio-${t.aspectRatio}`);t.setting.check(e)}return{width:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:i(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:i(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"aspectRatio",()=>a())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function i(t){return e.get(ut(t))}function a(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:i(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:i(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"flip",()=>a())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{qr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){Or(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&U(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const i=Sr.get(t)||{active:!0},a=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;oAr(t).parent},$parents:{get:()=>Ar(t).parents},$option:{get:()=>Ar(t).option},$events:{get:()=>Ar(t).events},$formatted:{get:()=>!0}}),Lr.set(t,{parent:r,parents:n,option:o,events:(null==a?void 0:a.events)||[],owner:i}),u.generated&&(t.name=e)}for(const u of a)u.generated||o.push(u.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return Or(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){Ur(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&_r(n)}catch(i){r.push(i)}}try{Br(t.art,e)}catch(i){i instanceof y?r.push(...i.errors):r.push(i)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);at(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{Gr(t),on(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const a of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{a()}catch(i){i instanceof y?o.push(...i.errors):o.push(i)}if(o.length)throw new y(o)}update(t){return an(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,i=n?void 0:function(t){const e={};Xr.set(t,e);const r=()=>Xr.get(t)===e;return{current:r,finish(){r()&&Xr.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||i&&!i.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&a){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==i||i.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,i=document.createElement("div");H(i,"height",`${o}px`),F(i,"art-setting-item"),F(i,"art-setting-item-back");const a=B(i,'
'),s=document.createElement("div");F(s,"art-setting-item-left-icon"),B(s,n),B(a,s),B(a,e.$parent.html),jr(t.art,e.$parent,i,"click",()=>t.render(e.$parents),Ir(r)),B(r,i)}(this,t)}createItem(t,e=!1){cn(this,t,e)}render(t=this.option){dn(this,t)}}class hn{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const fn='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;max-width:100vw;max-height:100vh;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class mn{constructor(t){var e;this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=null==(e=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope))?void 0:e.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}run(t){return d(this,null,function*(){if(this.active)try{return yield Promise.race([t(),this.cancelled])}finally{this.cancel()}})}}const gn=new WeakMap;function vn(t){return gn.get(t)}function yn(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const bn=Wt;class wn extends bn{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=$(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return gn.set(t,n),r.add(()=>{yn(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[0]}get activeCues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.activeCues)||[])}get cues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.cues)||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?j(r,t):H(r,t,e)}update(){!function(t){const e=vn(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:i}=t,{$subtitle:a}=i.template;if(a.innerHTML="",!t.activeCues.length)return;if(i.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${i.option.subtitle.escape?gt(t):t}\n
`).join("")).join("");o()&&(a.innerHTML=s,i.emit("subtitleAfterUpdate",t.activeCues))}(this)}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,i=c(l(l({},o.subtitle),e),{url:t}),a=vn(this),s=a.revision+1,d=yield this.init(i);return!a.scope.closed&&a.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),d})}createTrack(t,e){!function(t,e,r){const n=vn(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:i}=t,{template:a}=i,s=a.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),u=n.scope.child();u.add(()=>{d.onload=null,d.onerror=null});let p=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=i.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{u.closed||a.$track!==d||i.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{u.closed||a.$track!==d||(i.notice.show=new Error("Failed to load subtitle track"))},u.closed||n.trackRevision!==o)return void u.dispose();s.remove(),a.$video.appendChild(d),a.$track=d;const l=t.textTrack,c=l?i.proxy(l,"cuechange",()=>{u.closed||a.$track!==d||t.update()}):()=>{};if(u.add(()=>{i.events.remove(c)}),u.closed||n.trackRevision!==o)return u.dispose(),void d.remove();const h=n.track;n.track=u,t.destroyEvent=c,s.onload=null,s.onerror=null,p=!0;try{null==h||h.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&yn(n)}}catch(h){if(p)throw h;if(u.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw a.$track=s,l&&l.insertBefore(s,(null==c?void 0:c.parentNode)===l?c:null),h}}(this,t,e)}init(t){return d(this,null,function*(){const e=vn(this),r=function(t){const e=t.request,r=new mn(t.scope);return t.request=r,t.revision+=1,null==e||e.cancel(),r}(e),{notice:n,template:{$subtitle:o}}=this.art;return r.run(()=>d(this,null,function*(){if(!this.textTrack)return null;if(m(t,Nt.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const n=yield fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const a=yield n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||lt(e.url)){case"srt":return{vtt:e.onVttLoad(kt(r))};case"ass":return{vtt:e.onVttLoad(Et(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(a,t);if(!r.active)return;const l=void 0===s?t.url:i=$t(s.vtt);if(!r.active)return;o.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(a){if(!r.active)return;throw o.innerHTML="",n.show=a,a}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}}))})}}const xn=`\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
${g}
\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 `;class kn{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=D(e.container),at(this.$container,`No container element found by ${e.container}`)),at(tt(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();at("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),at(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,en(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return xn}query(t){return D(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=kn.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){at(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),Z(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&F(this.$player,"art-backdrop"),I&&F(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":F(this.$player,"art-destroy")}}const $n=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class En{on(t,e,r){const n=this.e||(this.e={});let o=$n(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let i=!1;function a(...e){i||(i=!0,n.off(t,a),o.apply(r,e))}return a._=e,this.on(t,a,r)}emit(t,...e){const r=this.e||(this.e={}),n=($n(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=$n(r,t)?r[t]:void 0,o=[];if(n&&e)for(let i=0,a=n.length;ie.call(this,this)),Ln.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Ln.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&Cn.push(this)}catch(n){try{T(this,Cn,!0,Ln.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return Cn}static get version(){return g}static get config(){return v}static get utils(){return Ct}static get scheme(){return Nt}static get Emitter(){return En}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return kn.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,Cn,t,Ln.REMOVE_SRC_WHEN_DESTROY)}}return Ln.STYLE=fn,Ln.DEBUG=!1,Ln.CONTEXTMENU=!0,Ln.NOTICE_TIME=2e3,Ln.SETTING_WIDTH=250,Ln.SETTING_ITEM_WIDTH=200,Ln.SETTING_ITEM_HEIGHT=35,Ln.RESIZE_TIME=200,Ln.SCROLL_TIME=200,Ln.SCROLL_GAP=50,Ln.AUTO_PLAYBACK_MAX=10,Ln.AUTO_PLAYBACK_MIN=5,Ln.AUTO_PLAYBACK_TIMEOUT=3e3,Ln.RECONNECT_TIME_MAX=5,Ln.RECONNECT_SLEEP_TIME=1e3,Ln.CONTROL_HIDE_TIME=3e3,Ln.DBCLICK_TIME=300,Ln.DBCLICK_FULLSCREEN=!0,Ln.MOBILE_DBCLICK_PLAY=!0,Ln.MOBILE_CLICK_PLAY=!1,Ln.AUTO_ORIENTATION_TIME=200,Ln.INFO_LOOP_TIME=1e3,Ln.FAST_FORWARD_VALUE=3,Ln.FAST_FORWARD_TIME=1e3,Ln.TOUCH_MOVE_RATIO=.5,Ln.VOLUME_STEP=.1,Ln.SEEK_STEP=5,Ln.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Ln.ASPECT_RATIO=["default","4:3","16:9"],Ln.FLIP=["normal","horizontal","vertical"],Ln.FULLSCREEN_WEB_IN_BODY=!0,Ln.LOG_VERSION=!0,Ln.USE_RAF=!1,Ln.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Ln,N("artplayer-style",fn),setTimeout(()=>{Ln.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Ln.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Ln}); diff --git a/docs/compiled/artplayer.mjs b/docs/compiled/artplayer.mjs index 38b54480e..cf92ebd7c 100644 --- a/docs/compiled/artplayer.mjs +++ b/docs/compiled/artplayer.mjs @@ -318,11 +318,11 @@ class ResourceScope { return this.disposed; } add(cleanup) { - let active = true; + let active2 = true; const release = () => { - if (!active) + if (!active2) return; - active = false; + active2 = false; this.cleanups.delete(release); cleanup(); }; @@ -508,14 +508,14 @@ function query(selector, parent = document) { function queryAll(selector, parent = document) { return Array.from(parent.querySelectorAll(selector)); } -function addClass(target, className) { - return target.classList.add(className); +function addClass(target, className2) { + return target.classList.add(className2); } -function removeClass(target, className) { - return target.classList.remove(className); +function removeClass(target, className2) { + return target.classList.remove(className2); } -function hasClass(target, className) { - return target.classList.contains(className); +function hasClass(target, className2) { + return target.classList.contains(className2); } function append(parent, child) { if (child instanceof Element) { @@ -545,9 +545,9 @@ function getStyle(element, key, numberType = true) { function siblings(target) { return Array.from(target.parentElement.children).filter((item) => item !== target); } -function inverseClass(target, className) { - siblings(target).forEach((item) => removeClass(item, className)); - addClass(target, className); +function inverseClass(target, className2) { + siblings(target).forEach((item) => removeClass(item, className2)); + addClass(target, className2); } function tooltip(target, msg, pos = "top") { if (isMobile) @@ -1057,11 +1057,11 @@ class Component { } set show(value) { const { $player } = this.art.template; - const className = `art-${this.name}-show`; + const className2 = `art-${this.name}-show`; if (value) - addClass($player, className); + addClass($player, className2); else - removeClass($player, className); + removeClass($player, className2); this.art.emit(this.name, value); } toggle() { @@ -1393,6 +1393,34 @@ class Contextmenu extends Component { }); } } +function listen(scope, target, name, callback, options = {}) { + const { capture = false, once = false, signal } = options; + if (scope.closed || signal?.aborted) + return () => { + }; + let release = () => { + }; + function listener(event) { + if (once) + release(); + if (scope.closed) + return; + if (typeof callback === "function") + callback.call(this, event); + else + callback.handleEvent(event); + } + target.addEventListener(name, listener, options); + release = scope.add(() => { + try { + target.removeEventListener(name, listener, capture); + } finally { + signal?.removeEventListener("abort", release); + } + }); + signal?.addEventListener("abort", release, { once: true }); + return release; +} function timeout(scope, callback, delay) { if (scope.closed) return () => { @@ -1930,8 +1958,8 @@ function installControls(controls) { ); } if (option.quality.length) { - wait(getScope(controls.art)).then((active) => { - if (!active || getScope(controls.art).closed) + wait(getScope(controls.art)).then((active2) => { + if (!active2 || getScope(controls.art).closed) return; controls.art.quality = option.quality; }).catch((error2) => { @@ -2024,10 +2052,10 @@ function observeControlLayout(art) { update(); } const selections = /* @__PURE__ */ new WeakMap(); -function trackSelection(event, active) { - selections.set(event, active); +function trackSelection(event, active2) { + selections.set(event, active2); return () => { - if (selections.get(event) === active) + if (selections.get(event) === active2) selections.delete(event); }; } @@ -2091,15 +2119,15 @@ function renderSelector(art, check2, option, $ref, events) { if (!item) return; const current2 = ++generation; - const active = () => !scope.closed && current2 === generation; - const release = scope.add(trackSelection(event2, active)); + const active2 = () => !scope.closed && current2 === generation; + const release = scope.add(trackSelection(event2, active2)); try { check2(item); if (scope.closed) return; if (option.onSelect) { const value = await option.onSelect.call(art, item, item.$control_item, event2); - if (active()) + if (active2()) setHTML($value, value); } } catch (error2) { @@ -2666,7 +2694,7 @@ const setting = ' 0 && Number.isFinite(height) && height > 0; +} +function containSize(container, ratio) { + if (!positiveSize(container) || !Number.isFinite(ratio) || ratio <= 0) + return; + const result = container.width / container.height > ratio ? { width: ratio * container.height, height: container.height, axis: "width" } : { width: container.width, height: container.width / ratio, axis: "height" }; + return positiveSize(result) ? result : void 0; +} +function proportionalHeight(width, media) { + if (!Number.isFinite(width) || width <= 0 || !positiveSize(media)) + return; + const height = media.height * (width / media.width); + return Number.isFinite(height) && height > 0 ? height : void 0; +} function aspectRatioMix(art) { - const { - i18n, - notice, - template: { $video, $player } - } = art; + const { i18n, notice, template: { $video, $player } } = art; def(art, "aspectRatio", { - get() { - return $player.dataset.aspectRatio || "default"; - }, + get: () => $player.dataset.aspectRatio || "default", set(ratio) { + if (isClosing(art)) + return; if (!ratio) ratio = "default"; if (ratio === "default") { - setStyle($video, "width", null); - setStyle($video, "height", null); - setStyle($video, "margin", null); + $video.style.width = ""; + $video.style.height = ""; + $video.style.margin = ""; delete $player.dataset.aspectRatio; } else { - const ratioArray = ratio.split(":").map(Number); - const { clientWidth, clientHeight } = $player; - const playerRatio = clientWidth / clientHeight; - const setupRatio = ratioArray[0] / ratioArray[1]; - if (playerRatio > setupRatio) { - setStyle($video, "width", `${setupRatio * clientHeight}px`); - setStyle($video, "height", "100%"); - setStyle($video, "margin", "0 auto"); - } else { - setStyle($video, "width", "100%"); - setStyle($video, "height", `${clientWidth / setupRatio}px`); - setStyle($video, "margin", "auto 0"); + const parts = ratio.split(":").map(Number); + const size = containSize({ width: $player.clientWidth, height: $player.clientHeight }, parts[0] / parts[1]); + if (isClosing(art)) + return; + if (size?.axis === "width") { + $video.style.width = `${size.width}px`; + $video.style.height = "100%"; + $video.style.margin = "0 auto"; + } else if (size) { + $video.style.width = "100%"; + $video.style.height = `${size.height}px`; + $video.style.margin = "auto 0"; } $player.dataset.aspectRatio = ratio; } notice.show = `${i18n.get("Aspect Ratio")}: ${ratio === "default" ? i18n.get("Default") : ratio}`; - art.emit("aspectRatio", ratio); + if (!isClosing(art)) + art.emit("aspectRatio", ratio); } }); } @@ -2977,15 +3017,15 @@ function attrMix(art) { }); } function autoHeightMix(art) { - const { - template: { $container, $video } - } = art; + const { $container, $video } = art.template; def(art, "autoHeight", { value() { - const { clientWidth } = $container; - const { videoHeight, videoWidth } = $video; - const height = videoHeight * (clientWidth / videoWidth); - setStyle($container, "height", `${height}px`); + if (isClosing(art)) + return; + const height = proportionalHeight($container.clientWidth, { width: $video.videoWidth, height: $video.videoHeight }); + if (height === void 0 || isClosing(art)) + return; + $container.style.height = `${height}px`; art.emit("autoHeight", height); } }); @@ -2994,23 +3034,23 @@ function autoSizeMix(art) { const { $container, $player, $video } = art.template; def(art, "autoSize", { value() { - const { videoWidth, videoHeight } = $video; - const { width, height } = getRect($container); - const videoRatio = videoWidth / videoHeight; - const containerRatio = width / height; - if (containerRatio > videoRatio) { - const percentage = height * videoRatio / width * 100; - setStyle($player, "width", `${percentage}%`); - setStyle($player, "height", "100%"); + if (isClosing(art)) + return; + const media = { width: $video.videoWidth, height: $video.videoHeight }; + if (!positiveSize(media)) + return; + const container = getRect($container); + const size = containSize(container, media.width / media.height); + if (!size || isClosing(art)) + return; + if (size.axis === "width") { + $player.style.width = `${size.width / container.width * 100}%`; + $player.style.height = "100%"; } else { - const percentage = width / videoRatio / height * 100; - setStyle($player, "width", "100%"); - setStyle($player, "height", `${percentage}%`); + $player.style.width = "100%"; + $player.style.height = `${size.height / container.height * 100}%`; } - art.emit("autoSize", { - width: art.width, - height: art.height - }); + art.emit("autoSize", { width: art.width, height: art.height }); } }); } @@ -3067,9 +3107,9 @@ function listenMedia(art, name, callback, once = false) { art.off(name, guarded); }); } -function showMediaUI(art, changes, active) { +function showMediaUI(art, changes, active2) { for (const [name, value] of changes) { - if (isClosing(art) || active && !active()) + if (isClosing(art) || active2 && !active2()) return; art[name].show = value; } @@ -3147,13 +3187,13 @@ function installEnded(art) { const { option } = art; listenMedia(art, "video:ended", () => { if (option.loop) { - const active = captureSource(art); + const active2 = captureSource(art); art.seek = 0; - if (isClosing(art) || !active()) + if (isClosing(art) || !active2()) return; silencePromise(art.play()); - if (active()) - showMediaUI(art, [["controls", false], ["mask", false]], active); + if (active2()) + showMediaUI(art, [["controls", false], ["mask", false]], active2); } else { showMediaUI(art, [["controls", true], ["mask", true]]); } @@ -3222,20 +3262,20 @@ function createReconnect(art) { if (pending2 === attempt) pending2 = void 0; }); - const active = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); + const active2 = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); const retry = attempts < constructor.RECONNECT_TIME_MAX; try { if (!retry) { - showMediaUI(art, [["mask", true], ["loading", false], ["controls", true]], active); - if (!active()) + showMediaUI(art, [["mask", true], ["loading", false], ["controls", true]], active2); + if (!active2()) return; addClass($player, "art-error"); } - if (!await wait(attempt, constructor.RECONNECT_SLEEP_TIME) || !active()) + if (!await wait(attempt, constructor.RECONNECT_SLEEP_TIME) || !active2()) return; if (retry) { const url = option.url; - if (!active()) + if (!active2()) return; attempts += 1; const attemptNumber = attempts; @@ -3253,7 +3293,7 @@ function createReconnect(art) { art.emit("error", error2, attemptNumber); } else { const message = i18n.get("Video Load Failed"); - if (active()) + if (active2()) notice.show = message; } } finally { @@ -3285,25 +3325,21 @@ function eventInit(art) { installPlaybackUI(art, reconnect); } function flipMix(art) { - const { - template: { $player }, - i18n, - notice - } = art; + const { template: { $player }, i18n, notice } = art; def(art, "flip", { - get() { - return $player.dataset.flip || "normal"; - }, + get: () => $player.dataset.flip || "normal", set(flip2) { + if (isClosing(art)) + return; if (!flip2) flip2 = "normal"; - if (flip2 === "normal") { + if (flip2 === "normal") delete $player.dataset.flip; - } else { + else $player.dataset.flip = flip2; - } notice.show = `${i18n.get("Video Flip")}: ${i18n.get(capitalize(flip2))}`; - art.emit("flip", flip2); + if (!isClosing(art)) + art.emit("flip", flip2); } }); } @@ -3439,110 +3475,477 @@ Object.defineProperties(screenfull, { get: () => Boolean(document[nativeAPI.fullscreenEnabled]) } }); -function fullscreenMix(art) { - const { - i18n, - notice, - template: { $video, $player } - } = art; - const nativeScreenfull = (art2) => { - screenfull.on("change", () => { - art2.emit("fullscreen", screenfull.isFullscreen); - if (screenfull.isFullscreen) { - art2.state = "fullscreen"; - addClass($player, "art-fullscreen"); +function call(target, name, ...args) { + const method = Reflect.get(target, name); + if (typeof method !== "function") + throw new TypeError(`Fullscreen method ${name} is not available`); + return method.apply(target, args); +} +function fullscreenAdapter(target) { + const raw = screenfull.raw; + const document2 = target.ownerDocument; + if (!raw || !Reflect.get(document2, raw.fullscreenEnabled)) + return void 0; + return { + document: document2, + target, + get element() { + return Reflect.get(document2, raw.fullscreenElement); + }, + elementProperty: raw.fullscreenElement, + changeEvent: raw.fullscreenchange, + errorEvent: raw.fullscreenerror, + request: () => call(target, raw.requestFullscreen, void 0), + exit: () => call(document2, raw.exitFullscreen) + }; +} +const abandoned$2 = /* @__PURE__ */ new WeakMap(); +function hasAbandonedFullscreen(adapter) { + return abandoned$2.get(adapter.document)?.has(adapter.target) ?? false; +} +function clearAbandonedFullscreen(adapter) { + abandoned$2.get(adapter.document)?.delete(adapter.target); +} +function exitNative(exit) { + try { + void Promise.resolve(exit()).catch(() => { + }); + } catch { + } +} +function entriesFor(document2, elementProperty, changeEvent) { + let entries = abandoned$2.get(document2); + if (!entries) { + entries = /* @__PURE__ */ new WeakMap(); + abandoned$2.set(document2, entries); + const pending2 = entries; + document2.addEventListener(changeEvent, () => { + const element = Reflect.get(document2, elementProperty); + const release = element && pending2.get(element); + if (!release) + return; + pending2.delete(element); + exitNative(release); + }); + } + return entries; +} +function abandonFullscreen(adapter) { + const { document: document2, elementProperty, changeEvent, target, exit } = adapter; + const entries = entriesFor(document2, elementProperty, changeEvent); + entries.set(target, exit); + if (adapter.element === target) { + entries.delete(target); + exitNative(exit); + } +} +function requestFullscreen(adapter, parent, entering, lateCompletion, hasExited = () => adapter.element !== adapter.target) { + const scope = parent.child(); + let done = false; + let cancelled = false; + let returned = false; + let promiseResult = false; + let eventFailed = false; + let resolve; + let reject; + const promise = new Promise((accept, fail) => { + resolve = accept; + reject = fail; + }); + scope.add(() => { + if (!done) { + done = true; + cancelled = true; + resolve(); + if (returned && !promiseResult && entering) + abandonFullscreen(adapter); + } + }); + function finish2(failed = false, error2) { + if (done) + return; + done = true; + try { + scope.dispose(); + } catch (cleanupError) { + if (!failed) { + failed = true; + error2 = cleanupError; + } + } + if (failed) + reject(error2); + else + resolve(); + } + const changed = () => { + if (returned && !promiseResult && (entering ? adapter.element === adapter.target : hasExited())) + finish2(); + }; + listen(scope, adapter.document, adapter.changeEvent, changed); + listen(scope, adapter.document, adapter.errorEvent, (event) => { + if (event.target === adapter.target || event.target === adapter.document) { + eventFailed = true; + if (returned && !promiseResult) + finish2(true, new Error("Fullscreen request failed")); + } + }); + if (!scope.closed) { + try { + if (entering) + clearAbandonedFullscreen(adapter); + const result = entering ? adapter.request() : adapter.exit(); + promiseResult = Boolean(result && typeof result.then === "function"); + returned = true; + if (cancelled && !promiseResult && entering) + abandonFullscreen(adapter); + if (promiseResult) { + void Promise.resolve(result).then(() => { + if (cancelled) + lateCompletion(); + else + finish2(); + }, (error2) => finish2(true, error2)).catch(() => { + }); + } else if (eventFailed) { + finish2(true, new Error("Fullscreen request failed")); } else { - removeClass($player, "art-fullscreen"); + changed(); } - art2.emit("resize"); - }); - screenfull.on("error", (event) => { - art2.emit("fullscreenError", event); - }); - def(art2, "fullscreen", { - get() { - return screenfull.isFullscreen; - }, - async set(value) { - if (value) { - await screenfull.request($player); - } else { - await screenfull.exit(); + } catch (error2) { + finish2(true, error2); + } + } + return { promise, cancel: () => scope.dispose() }; +} +function nativeFullscreen(art, adapter) { + const scope = getScope(art).child(); + const { $player, $video } = art.template; + const ownsFullscreen = () => adapter.element === $player || adapter.element === $video; + let last = ownsFullscreen(); + let revision = 0; + let desired = last; + let pending2; + let pendingEntry = false; + let cancelledEntry = false; + let requesting = false; + function exitOwned() { + if (!ownsFullscreen()) + return; + try { + void Promise.resolve(adapter.exit()).catch(() => { + }); + } catch { + } + } + scope.add(() => { + revision += 1; + desired = false; + $player.classList.remove("art-fullscreen"); + exitOwned(); + }); + listen(scope, adapter.document, adapter.changeEvent, () => { + const value = ownsFullscreen(); + if (value && hasAbandonedFullscreen(adapter)) + return; + if (value && cancelledEntry) { + exitOwned(); + return; + } + if (value === last || isClosing(art)) + return; + last = value; + const current2 = revision; + const stale = () => isClosing(art) || ownsFullscreen() !== value || current2 !== revision && desired !== value; + art.emit("fullscreen", value); + if (stale()) + return; + if (value) + art.state = "fullscreen"; + if (stale()) + return; + $player.classList.toggle("art-fullscreen", value); + art.emit("resize"); + }); + listen(scope, adapter.document, adapter.errorEvent, (event) => { + const ownEvent = event.target === $player || event.target === $video || event.target === adapter.document && (requesting || pending2 !== void 0 || ownsFullscreen()); + if (ownEvent && !isClosing(art)) + art.emit("fullscreenError", event); + }); + return { + get: () => !isClosing(art) && ownsFullscreen(), + set(value) { + if (isClosing(art)) + return Promise.resolve(); + const current2 = ++revision; + desired = Boolean(value); + if (desired) + cancelledEntry = false; + else if (pendingEntry) + cancelledEntry = true; + pending2?.cancel(); + pending2 = void 0; + pendingEntry = false; + if (!desired && !ownsFullscreen()) + return Promise.resolve(); + requesting = true; + pendingEntry = desired; + const operation = requestFullscreen(adapter, scope, desired, () => { + if (isClosing(art) || !desired) + exitOwned(); + }, () => !ownsFullscreen()); + requesting = false; + if (revision === current2) + pending2 = operation; + else + operation.cancel(); + const result = operation.promise.catch((error2) => { + if (!isClosing(art) && revision === current2) + art.notice.show = error2; + throw error2; + }).finally(() => { + if (revision === current2) { + pending2 = void 0; + pendingEntry = false; } - } - }); + }); + void result.catch(() => { + }); + return result; + } }; - const webkitScreenfull = (art2) => { - art2.on("document:webkitfullscreenchange", () => { - art2.emit("fullscreen", art2.fullscreen); - art2.emit("resize"); - }); - def(art2, "fullscreen", { - get() { - return document.fullscreenElement === $video; - }, - set(value) { - if (value) { - art2.state = "fullscreen"; +} +const abandoned$1 = /* @__PURE__ */ new WeakSet(); +function videoIsFullscreen(video, observed = false) { + if (typeof video.webkitPresentationMode === "string") + return video.webkitPresentationMode === "fullscreen"; + if (typeof video.webkitDisplayingFullscreen === "boolean") + return video.webkitDisplayingFullscreen; + return video.ownerDocument.fullscreenElement === video || observed; +} +function clearAbandonedVideo(video) { + abandoned$1.delete(video); + video.removeEventListener("webkitbeginfullscreen", releaseAbandonedVideo); + video.removeEventListener("webkitpresentationmodechanged", releaseAbandonedVideo); +} +function releaseAbandonedVideo(event) { + if (!abandoned$1.has(this) || !videoIsFullscreen(this, event.type === "webkitbeginfullscreen")) + return; + clearAbandonedVideo(this); + try { + this.webkitExitFullscreen?.(); + } catch { + } +} +function abandonVideo(video) { + abandoned$1.add(video); + video.addEventListener("webkitbeginfullscreen", releaseAbandonedVideo); + video.addEventListener("webkitpresentationmodechanged", releaseAbandonedVideo); +} +function isAbandonedVideo(video) { + return abandoned$1.has(video); +} +function videoFullscreen(art) { + const { $video } = art.template; + const scope = getScope(art).child(); + let observed = false; + let last = videoIsFullscreen($video); + let desired = last; + let pending2 = false; + let revision = 0; + const active2 = () => videoIsFullscreen($video, observed); + function changed(hint) { + if (isClosing(art) || isAbandonedVideo($video)) + return; + if (typeof hint === "boolean") + observed = hint; + const value = active2(); + if (value) + pending2 = false; + if (value === last) + return; + last = value; + const current2 = revision; + const stale = () => isClosing(art) || active2() !== value || current2 !== revision && desired !== value; + art.emit("fullscreen", value); + if (stale()) + return; + if (value) + art.state = "fullscreen"; + if (!stale()) + art.emit("resize"); + } + scope.add(() => { + revision++; + desired = false; + if (pending2) + abandonVideo($video); + if (active2()) + $video.webkitExitFullscreen?.(); + }); + listen(scope, $video, "webkitbeginfullscreen", () => changed(true)); + listen(scope, $video, "webkitendfullscreen", () => changed(false)); + listen(scope, $video, "webkitpresentationmodechanged", () => changed()); + const documentChanged = () => changed(); + art.on("document:webkitfullscreenchange", documentChanged); + scope.add(() => { + art.off("document:webkitfullscreenchange", documentChanged); + }); + return { + get: () => !isClosing(art) && active2(), + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + desired = Boolean(value); + if (value) { + clearAbandonedVideo($video); + art.state = "fullscreen"; + if (isClosing(art) || current2 !== revision) + return; + pending2 = true; + try { $video.webkitEnterFullscreen(); - } else { - $video.webkitExitFullscreen(); + } catch (error2) { + if (current2 === revision) + pending2 = false; + throw error2; } + } else { + if (pending2) { + pending2 = false; + abandonVideo($video); + } + if (active2()) + $video.webkitExitFullscreen(); } - }); + } }; - art.once("video:loadedmetadata", () => { - if (screenfull.isEnabled) { - nativeScreenfull(art); - } else if ($video.webkitSupportsFullscreen) { - webkitScreenfull(art); +} +function fullscreenMix(art) { + const { i18n, notice, template: { $video, $player } } = art; + const metadata = () => { + if (isClosing(art)) + return; + const adapter = fullscreenAdapter($player); + if (adapter) { + def(art, "fullscreen", nativeFullscreen(art, adapter)); + } else if ($video.webkitSupportsFullscreen && typeof $video.webkitEnterFullscreen === "function" && typeof $video.webkitExitFullscreen === "function") { + def(art, "fullscreen", videoFullscreen(art)); } else { def(art, "fullscreen", { - get() { - return false; - }, + get: () => false, set() { - notice.show = i18n.get("Fullscreen Not Supported"); + if (!isClosing(art)) + notice.show = i18n.get("Fullscreen Not Supported"); } }); } def(art, "fullscreen", get(art, "fullscreen")); + }; + art.once("video:loadedmetadata", metadata); + getScope(art).add(() => { + art.off("video:loadedmetadata", metadata); }); } +function capturePlacement(node) { + return { node, parent: node.parentNode, next: node.nextSibling }; +} +function restorePlacement({ node, parent, next }) { + if (!parent) { + node.parentNode?.removeChild(node); + return; + } + const anchor = next?.parentNode === parent ? next : null; + if (node.parentNode !== parent || node.nextSibling !== anchor) + parent.insertBefore(node, anchor); +} +function webFullscreen(art) { + const { $player } = art.template; + let saved; + let revision = 0; + function restore(snapshot, active2) { + if (snapshot.style === null) + $player.removeAttribute("style"); + else + $player.setAttribute("style", snapshot.style); + if (!active2()) + return false; + $player.classList.remove("art-fullscreen-web"); + if (!active2()) + return false; + restorePlacement(snapshot.placement); + return active2(); + } + getScope(art).add(() => { + revision += 1; + const snapshot = saved; + saved = void 0; + if (snapshot) { + try { + restore(snapshot, () => true); + } catch (error2) { + try { + if ($player.parentNode !== snapshot.placement.parent) + $player.parentNode?.removeChild($player); + } catch (detachError) { + throw new ResourceCleanupError([error2, detachError]); + } + throw error2; + } + } + }); + return (value) => { + if (isClosing(art)) + return; + const current2 = ++revision; + const active2 = () => current2 === revision && !isClosing(art); + if (value) { + if (!saved) + saved = { placement: capturePlacement($player), style: $player.getAttribute("style") }; + const snapshot = saved; + try { + if (art.constructor.FULLSCREEN_WEB_IN_BODY && $player.parentNode !== document.body) + document.body.appendChild($player); + if (!active2()) + return; + art.state = "fullscreenWeb"; + if (!active2()) + return; + $player.style.width = "100%"; + $player.style.height = "100%"; + $player.classList.add("art-fullscreen-web"); + } catch (error2) { + if (active2() && restore(snapshot, active2)) + saved = void 0; + throw error2; + } + if (!active2()) + return; + art.emit("fullscreenWeb", true); + } else { + if (saved) { + if (!restore(saved, active2)) + return; + saved = void 0; + } else { + $player.classList.remove("art-fullscreen-web"); + } + if (!active2()) + return; + art.emit("fullscreenWeb", false); + } + if (active2()) + art.emit("resize"); + }; +} function fullscreenWebMix(art) { - const { - constructor, - template: { $container, $player } - } = art; - let cssText = ""; + const setFullscreen = webFullscreen(art); def(art, "fullscreenWeb", { get() { - return hasClass($player, "art-fullscreen-web"); + return art.template.$player.classList.contains("art-fullscreen-web"); }, - set(value) { - if (value) { - cssText = $player.style.cssText; - if (constructor.FULLSCREEN_WEB_IN_BODY) { - append(document.body, $player); - } - art.state = "fullscreenWeb"; - setStyle($player, "width", "100%"); - setStyle($player, "height", "100%"); - addClass($player, "art-fullscreen-web"); - art.emit("fullscreenWeb", true); - } else { - if (constructor.FULLSCREEN_WEB_IN_BODY) { - append($container, $player); - } - if (cssText) { - $player.style.cssText = cssText; - cssText = ""; - } - removeClass($player, "art-fullscreen-web"); - art.emit("fullscreenWeb", false); - } - art.emit("resize"); - } + set: setFullscreen }); } function loadedMix(art) { @@ -3553,121 +3956,263 @@ function loadedMix(art) { get: () => $video.buffered.length ? $video.buffered.end($video.buffered.length - 1) : 0 }); } -function miniMix(art) { - const { - icons, - proxy, - storage, - template: { $player, $video } - } = art; - let isDragging = false; - let lastPageX = 0; - let lastPageY = 0; - function hideMini() { - const { $mini } = art.template; - if ($mini) { - removeClass($player, "art-mini"); - setStyle($mini, "display", "none"); - $player.prepend($video); +function clampMini(left, top, geometry) { + const maxLeft = Math.max(0, geometry.viewportWidth - geometry.width); + const maxTop = Math.max(0, geometry.viewportHeight - geometry.height); + return { left: Math.max(0, Math.min(left, maxLeft)), top: Math.max(0, Math.min(top, maxTop)) }; +} +function miniPosition(left, top, geometry) { + if (typeof left === "number" && Number.isFinite(left) && typeof top === "number" && Number.isFinite(top) && left >= 0 && top >= 0 && left + geometry.width <= geometry.viewportWidth && top + geometry.height <= geometry.viewportHeight) { + return { left, top, reset: false }; + } + return { ...clampMini(geometry.viewportWidth - geometry.width - 50, geometry.viewportHeight - geometry.height - 50, geometry), reset: true }; +} +function miniGeometry(element) { + const { width, height } = element.getBoundingClientRect(); + const view = element.ownerDocument.defaultView; + return { width, height, viewportWidth: view.innerWidth, viewportHeight: view.innerHeight }; +} +function miniDrag(art, element, scope, active2) { + let dragging = false; + let startX = 0; + let startY = 0; + const cancel = () => { + dragging = false; + element.classList.remove("art-mini-dragging"); + element.style.transform = ""; + }; + listen(scope, element, "mousedown", (event) => { + const mouse = event; + if (mouse.button !== 0 || !active2()) + return; + dragging = true; + startX = mouse.clientX; + startY = mouse.clientY; + }); + const move = (event) => { + if (!scope.closed && dragging && active2()) { + element.classList.add("art-mini-dragging"); + element.style.transform = `translate(${event.clientX - startX}px, ${event.clientY - startY}px)`; + } + }; + const end = () => { + if (scope.closed || !dragging || !active2()) + return; + const rect = element.getBoundingClientRect(); + const position = clampMini(rect.left, rect.top, miniGeometry(element)); + cancel(); + element.style.left = `${position.left}px`; + element.style.top = `${position.top}px`; + art.storage.set("left", position.left); + if (!scope.closed) + art.storage.set("top", position.top); + }; + art.on("document:mousemove", move); + scope.add(() => { + art.off("document:mousemove", move); + }); + art.on("document:mouseup", end); + scope.add(() => { + art.off("document:mouseup", end); + }); + scope.add(cancel); + return cancel; +} +function createMiniView(art, parent, active2, hide) { + const scope = parent.child(); + if (scope.closed) + return; + const existing = art.template.$mini; + if (existing) { + const display = existing.style.display; + scope.add(() => { + existing.style.display = display; + }); + return { element: existing, cancelDrag: () => { + }, fresh: false }; + } + const document2 = art.template.$player.ownerDocument; + const element = document2.createElement("div"); + element.className = "art-mini-popup"; + scope.add(() => { + element.remove(); + }); + try { + const close2 = document2.createElement("div"); + close2.className = "art-mini-close"; + close2.append(art.icons.close); + if (scope.closed) + return; + const state2 = document2.createElement("div"); + state2.className = "art-mini-state"; + const play2 = art.icons.play; + const pause2 = art.icons.pause; + if (scope.closed) + return; + state2.append(play2, pause2); + element.append(close2, state2); + listen(scope, close2, "click", hide); + listen(scope, play2, "click", () => { + silencePromise(art.play()); + }); + listen(scope, pause2, "click", () => { + art.pause(); + }); + const update = () => { + if (scope.closed) + return; + play2.style.display = art.playing ? "none" : "flex"; + pause2.style.display = art.playing ? "flex" : "none"; + }; + update(); + for (const name of ["video:playing", "video:pause", "video:timeupdate"]) { + art.on(name, update); + scope.add(() => { + art.off(name, update); + }); + } + const cancelDrag = miniDrag(art, element, scope, active2); + if (scope.closed) + return; + art.template.$mini = element; + document2.body.append(element); + if (!scope.closed) + return { element, cancelDrag, fresh: true }; + } catch (error2) { + scope.dispose(); + if (art.template.$mini === element) + delete art.template.$mini; + throw error2; + } +} +function mini(art) { + const { $player, $video } = art.template; + const scope = getScope(art).child(); + let view; + let placement; + let revision = 0; + let creating = false; + let queued = false; + const active2 = () => !isClosing(art) && $player.classList.contains("art-mini"); + function restore() { + if (placement) { + const saved = placement; + const current2 = revision; + placement = void 0; + try { + restorePlacement(saved); + } catch (error2) { + if (current2 === revision && !placement) + placement = saved; + throw error2; + } + } + } + function hide() { + if (isClosing(art)) + return; + const current2 = ++revision; + queued = false; + restore(); + if (isClosing(art) || current2 !== revision) + return; + view?.cancelDrag(); + $player.classList.remove("art-mini"); + if (art.template.$mini) { + art.template.$mini.style.display = "none"; art.emit("mini", false); } } - function initState($play, $pause) { - if (art.playing) { - setStyle($play, "display", `none`); - setStyle($pause, "display", `flex`); - } else { - setStyle($play, "display", `flex`); - setStyle($pause, "display", `none`); - } - } - function createMini() { - const { $mini } = art.template; - if ($mini) { - append($mini, $video); - return setStyle($mini, "display", "flex"); - } else { - const $mini2 = createElement("div"); - addClass($mini2, "art-mini-popup"); - append(document.body, $mini2); - art.template.$mini = $mini2; - append($mini2, $video); - const $close = append($mini2, `
`); - append($close, icons.close); - proxy($close, "click", hideMini); - const $state = append($mini2, `
`); - const $play = append($state, icons.play); - const $pause = append($state, icons.pause); - proxy($play, "click", () => silencePromise(art.play())); - proxy($pause, "click", () => art.pause()); - initState($play, $pause); - art.on("video:playing", () => initState($play, $pause)); - art.on("video:pause", () => initState($play, $pause)); - art.on("video:timeupdate", () => initState($play, $pause)); - proxy($mini2, "mousedown", (event) => { - isDragging = event.button === 0; - lastPageX = event.pageX; - lastPageY = event.pageY; - }); - art.on("document:mousemove", (event) => { - if (isDragging) { - addClass($mini2, "art-mini-dragging"); - const x = event.pageX - lastPageX; - const y = event.pageY - lastPageY; - setStyle($mini2, "transform", `translate(${x}px, ${y}px)`); - } - }); - art.on("document:mouseup", () => { - if (isDragging) { - isDragging = false; - removeClass($mini2, "art-mini-dragging"); - const rect = getRect($mini2); - storage.set("left", rect.left); - storage.set("top", rect.top); - setStyle($mini2, "left", `${rect.left}px`); - setStyle($mini2, "top", `${rect.top}px`); - setStyle($mini2, "transform", null); - } - }); - return $mini2; - } - } - function initMini() { - const { $mini } = art.template; - const rect = getRect($mini); - const top = window.innerHeight - rect.height - 50; - const left = window.innerWidth - rect.width - 50; - storage.set("top", top); - storage.set("left", left); - setStyle($mini, "top", `${top}px`); - setStyle($mini, "left", `${left}px`); - } - def(art, "mini", { - get() { - return hasClass($player, "art-mini"); - }, - set(value) { - if (value) { - art.state = "mini"; - addClass($player, "art-mini"); - const $mini = createMini(); - const top = storage.get("top"); - const left = storage.get("left"); - if (typeof top === "number" && typeof left === "number") { - setStyle($mini, "top", `${top}px`); - setStyle($mini, "left", `${left}px`); - if (!isInViewport($mini)) { - initMini(); - } - } else { - initMini(); - } - art.emit("mini", true); - } else { - hideMini(); - } + scope.add(() => { + revision++; + try { + restore(); + } finally { + view?.cancelDrag(); + $player.classList.remove("art-mini"); } }); + function show() { + if (isClosing(art)) + return; + const current2 = ++revision; + if (creating) { + queued = true; + return; + } + art.state = "mini"; + if (isClosing(art) || current2 !== revision) + return; + placement ?? (placement = capturePlacement($video)); + $player.classList.add("art-mini"); + try { + if (!view) { + creating = true; + try { + view = createMiniView(art, scope, active2, hide); + } finally { + creating = false; + } + } + if (queued) { + queued = false; + show(); + return; + } + if (!view || isClosing(art)) + return; + if (current2 !== revision) { + if (!active2()) + view.element.style.display = "none"; + return; + } + if (view.fresh) + view.element.prepend($video); + else + view.element.append($video); + if (isClosing(art) || current2 !== revision) + return; + view.element.style.display = view.fresh ? "" : "flex"; + view.fresh = false; + const top = art.storage.get("top"); + const left = art.storage.get("left"); + const position = miniPosition(left, top, miniGeometry(view.element)); + if (isClosing(art) || current2 !== revision) + return; + view.element.style.left = `${position.left}px`; + view.element.style.top = `${position.top}px`; + if (position.reset) { + art.storage.set("top", position.top); + if (isClosing(art) || current2 !== revision) + return; + art.storage.set("left", position.left); + } + if (!isClosing(art) && current2 === revision) + art.emit("mini", true); + } catch (error2) { + const pendingReentry = queued; + queued = false; + if (!isClosing(art) && (current2 === revision || pendingReentry)) { + restore(); + $player.classList.remove("art-mini"); + if (view) + view.element.style.display = "none"; + } + throw error2; + } + } + return { + get: active2, + set(value) { + if (value) + show(); + else + hide(); + } + }; +} +function miniMix(art) { + def(art, "mini", mini(art)); } function optionInit(art) { const { @@ -3722,74 +4267,199 @@ function pauseMix(art) { }); } function nativePip(art) { - const { - template: { $video }, - proxy, - notice - } = art; + const { $video } = art.template; + const document2 = $video.ownerDocument; + const scope = getScope(art).child(); + const owns2 = () => document2.pictureInPictureElement === $video; + let last = owns2(); + let desired = last; + let pending2 = false; + let cancelled = false; + let revision = 0; $video.disablePictureInPicture = false; - def(art, "pip", { - get() { - return document.pictureInPictureElement; - }, - set(value) { - if (value) { - art.state = "pip"; - $video.requestPictureInPicture().catch((err) => { - notice.show = err; - throw err; - }); - } else { - document.exitPictureInPicture().catch((err) => { - notice.show = err; - throw err; - }); - } + function exitOwned() { + if (!owns2()) + return; + try { + void document2.exitPictureInPicture().catch(() => { + }); + } catch { + } + } + function observe(result, entering, current2) { + void result.then(() => { + if (entering && (isClosing(art) || !desired)) + exitOwned(); + }, (error2) => { + if (!isClosing(art) && revision === current2) + art.notice.show = error2; + }).finally(() => { + if (revision === current2) + pending2 = false; + }).catch(() => { + }); + } + scope.add(() => { + revision++; + desired = false; + exitOwned(); + }); + listen(scope, $video, "enterpictureinpicture", () => { + if (cancelled) { + exitOwned(); + return; + } + if (!owns2() || last) + return; + const current2 = revision; + art.state = "pip"; + if (!isClosing(art) && current2 === revision && owns2()) { + last = true; + art.emit("pip", true); } }); - proxy($video, "enterpictureinpicture", () => { - art.emit("pip", true); - }); - proxy($video, "leavepictureinpicture", () => { + listen(scope, $video, "leavepictureinpicture", () => { + if (!last || owns2()) + return; + last = false; art.emit("pip", false); }); + return { + // Native callers historically receive the media element, not a boolean. + get: () => !isClosing(art) && owns2() ? $video : null, + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + desired = Boolean(value); + if (desired) + cancelled = false; + else if (pending2) + cancelled = true; + pending2 = false; + if (desired) { + art.state = "pip"; + if (isClosing(art) || revision !== current2) + return; + pending2 = true; + try { + observe($video.requestPictureInPicture(), true, current2); + } catch (error2) { + if (revision === current2) + pending2 = false; + throw error2; + } + } else if (owns2()) { + observe(document2.exitPictureInPicture(), false, current2); + } + } + }; +} +const abandoned = /* @__PURE__ */ new WeakSet(); +const active = (video) => video.webkitPresentationMode === "picture-in-picture"; +function clearAbandoned(video) { + abandoned.delete(video); + video.removeEventListener("webkitpresentationmodechanged", releaseAbandoned); + video.removeEventListener("enterpictureinpicture", releaseAbandoned); +} +function releaseAbandoned() { + if (!abandoned.has(this) || !active(this)) + return; + clearAbandoned(this); + try { + this.webkitSetPresentationMode?.("inline"); + } catch { + } +} +function abandon(video) { + abandoned.add(video); + video.addEventListener("webkitpresentationmodechanged", releaseAbandoned); + video.addEventListener("enterpictureinpicture", releaseAbandoned); } function webkitPip(art) { const { $video } = art.template; + const scope = getScope(art).child(); + let last = false; + let pending2 = false; + let revision = 0; + let emissions = 0; $video.webkitSetPresentationMode("inline"); - def(art, "pip", { - get() { - return $video.webkitPresentationMode === "picture-in-picture"; - }, - set(value) { - if (value) { - art.state = "pip"; - $video.webkitSetPresentationMode("picture-in-picture"); - art.emit("pip", true); - } else { - $video.webkitSetPresentationMode("inline"); - art.emit("pip", false); - } - } + function changed(force = false) { + if (isClosing(art) || abandoned.has($video)) + return; + const value = active($video); + if (value) + pending2 = false; + if (value === last && !force) + return; + const current2 = revision; + if (value) + art.state = "pip"; + if (isClosing(art) || revision !== current2 || active($video) !== value) + return; + last = value; + emissions++; + art.emit("pip", value); + } + scope.add(() => { + revision++; + if (pending2) + abandon($video); + if (active($video)) + $video.webkitSetPresentationMode("inline"); }); + for (const name of ["webkitpresentationmodechanged", "enterpictureinpicture", "leavepictureinpicture"]) + listen(scope, $video, name, () => changed()); + return { + get: () => !isClosing(art) && active($video), + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + const before = emissions; + if (value) { + if ($video.webkitSupportsPresentationMode?.("picture-in-picture") === false) { + art.notice.show = art.i18n.get("PIP Not Supported"); + return; + } + clearAbandoned($video); + art.state = "pip"; + if (isClosing(art) || revision !== current2) + return; + pending2 = true; + try { + $video.webkitSetPresentationMode("picture-in-picture"); + } catch (error2) { + if (current2 === revision) + pending2 = false; + throw error2; + } + } else { + if (pending2) { + pending2 = false; + abandon($video); + } + if (active($video)) + $video.webkitSetPresentationMode("inline"); + } + if (!isClosing(art) && current2 === revision && before === emissions && active($video) === Boolean(value)) + changed(true); + } + }; } function pipMix(art) { - const { - i18n, - notice, - template: { $video } - } = art; - if (document.pictureInPictureEnabled) { - nativePip(art); - } else if ($video.webkitSupportsPresentationMode) { - webkitPip(art); + const { i18n, notice, template: { $video } } = art; + const document2 = $video.ownerDocument; + if (document2.pictureInPictureEnabled && typeof $video.requestPictureInPicture === "function" && typeof document2.exitPictureInPicture === "function") { + def(art, "pip", nativePip(art)); + } else if (typeof $video.webkitSupportsPresentationMode === "function" && typeof $video.webkitSetPresentationMode === "function") { + def(art, "pip", webkitPip(art)); } else { def(art, "pip", { - get() { - return false; - }, + get: () => false, set() { - notice.show = i18n.get("PIP Not Supported"); + if (!isClosing(art)) + notice.show = i18n.get("PIP Not Supported"); } }); } @@ -3836,20 +4506,20 @@ function playMix(art) { } = art; def(art, "play", { async value() { - const active = captureSource(art); + const active2 = captureSource(art); const result = await $video.play(); - if (!active()) + if (!active2()) return result; const message = i18n.get("Play"); - if (!active()) + if (!active2()) return result; notice.show = message; - if (!active()) + if (!active2()) return result; art.emit("play"); if (option.mutex) { for (let index = 0; index < instances2.length; index++) { - if (!active()) + if (!active2()) break; const instance = instances2[index]; if (instance !== art) { @@ -3891,11 +4561,11 @@ function qualityMix(art) { html: qualityDefault?.html || "", selector: quality, async onSelect(item, _element, event) { - const active = captureSelection(event); + const active2 = captureSelection(event); await art.switchQuality(item.url); - if (!isClosing(art) && active()) { + if (!isClosing(art) && active2()) { const message = `${i18n.get("Switch Video")}: ${item.html}`; - if (!isClosing(art) && active()) + if (!isClosing(art) && active2()) notice.show = message; } return item.html; @@ -4079,19 +4749,19 @@ function switchSource(art, url, currentTime) { scope.add(() => { settle(); }); - const active = () => !settled && operation.active(); + const active2 = () => !settled && operation.active(); const fail = (error2) => settle(true, error2); operation.onError = fail; try { const { playing, aspectRatio: aspectRatio2, playbackRate: playbackRate2 } = art; art.pause(); - if (!active()) + if (!active2()) return; const readiness = scope.child(); const handlers = { "video:error": fail, "video:loadedmetadata": () => { - if (!active()) + if (!active2()) return; try { art.currentTime = currentTime; @@ -4100,15 +4770,15 @@ function switchSource(art, url, currentTime) { } }, "video:canplay": () => { - if (!active()) + if (!active2()) return; readiness.dispose(); const resume = async () => { art.playbackRate = playbackRate2; - if (!active()) + if (!active2()) return; art.aspectRatio = aspectRatio2; - if (!active()) + if (!active2()) return; if (playing) { try { @@ -4116,7 +4786,7 @@ function switchSource(art, url, currentTime) { } catch { } } - if (!active()) + if (!active2()) return; art.notice.show = ""; settle(); @@ -4134,10 +4804,10 @@ function switchSource(art, url, currentTime) { }, false); } assignUrl(art, operation, url); - if (!active()) + if (!active2()) return; art.notice.show = ""; - if (!active()) + if (!active2()) return; const activate = () => { capture.dispose(); @@ -4149,7 +4819,7 @@ function switchSource(art, url, currentTime) { for (const name of names) dispatch[name] = listenSource(readiness, art, name, handlers[name]); for (const [name, event] of queued) { - if (!active() || readiness.closed) + if (!active2() || readiness.closed) break; dispatch[name](event); } @@ -4401,91 +5071,160 @@ class Player { optionInit(art); } } -function autoOrientation(art) { - const { - notice, - constructor, - template: { $player, $video } - } = art; - const WEB_CLASS = "art-auto-orientation"; - const FS_CLASS = "art-auto-orientation-fullscreen"; - let fsLocked = false; - function applyWebRotate() { +const owners$2 = /* @__PURE__ */ new WeakMap(); +const className$1 = "art-auto-orientation-fullscreen"; +function unlock(request) { + if (owners$2.get(request.orientation) !== request) + return; + try { + request.orientation.unlock(); + } catch { + } +} +function nativeOrientation(art, needRotate) { + const { $player } = art.template; + let current2; + function cancel() { + const request = current2; + current2 = void 0; + $player.classList.remove(className$1); + if (request) { + request.cancelled = true; + unlock(request); + if (request.settled && owners$2.get(request.orientation) === request) + owners$2.delete(request.orientation); + } + } + getScope(art).add(cancel); + return (state2) => { + if (isClosing(art)) + return; + if (!state2) { + cancel(); + return; + } + if (current2 && !current2.cancelled && owners$2.get(current2.orientation) === current2) + return; + const orientation = $player.ownerDocument.defaultView?.screen?.orientation; + if (typeof orientation?.lock !== "function" || typeof orientation.unlock !== "function" || !needRotate()) + return; + const request = { orientation, cancelled: false, settled: false }; + current2 = request; + owners$2.set(orientation, request); + const active2 = () => !isClosing(art) && !request.cancelled && current2 === request && owners$2.get(orientation) === request; + const failed = (error2) => { + request.settled = true; + const show = active2(); + if (owners$2.get(orientation) === request) + owners$2.delete(orientation); + if (current2 === request) + current2 = void 0; + if (show) { + $player.classList.remove(className$1); + art.notice.show = error2; + } + }; + try { + const result = orientation.lock(orientation.type.startsWith("portrait") ? "landscape" : "portrait"); + Promise.resolve(result).then(() => { + request.settled = true; + if (active2()) { + $player.classList.add(className$1); + } else { + unlock(request); + if (owners$2.get(orientation) === request) + owners$2.delete(orientation); + } + }).catch(failed); + } catch (error2) { + failed(error2); + } + }; +} +const className = "art-auto-orientation"; +const properties = ["width", "height", "transform-origin", "transform"]; +function webOrientation(art, needRotate) { + const { $player } = art.template; + const scope = getScope(art); + let cancel = () => { + }; + let saved; + function clear() { + cancel(); + cancel = () => { + }; + const previous = saved; + saved = void 0; + if (previous && art.fullscreenWeb) { + for (const { name, value, priority } of previous) + $player.style.setProperty(name, value, priority); + } + const wasRotated = $player.classList.contains(className); + $player.classList.remove(className); + if (wasRotated) { + art.isRotate = false; + if (!isClosing(art)) + art.emit("resize"); + } + } + scope.add(clear); + function apply(emit) { + if (!art.fullscreenWeb || !needRotate()) + return; const insets = getSafeAreaInsets(); - const viewWidth = document.documentElement.clientWidth; - const viewHeight = document.documentElement.clientHeight; - const safeWidth = viewHeight - insets.top - insets.bottom; - const safeHeight = viewWidth - insets.left - insets.right; - setStyle($player, "width", `${safeWidth}px`); - setStyle($player, "height", `${safeHeight}px`); - setStyle($player, "transform-origin", "0 0"); - setStyle($player, "transform", `rotate(90deg) translate(${insets.top}px, -${viewWidth - insets.right}px)`); - addClass($player, WEB_CLASS); + if (isClosing(art) || !art.fullscreenWeb) + return; + const viewport = $player.ownerDocument.documentElement; + saved ?? (saved = properties.map((name) => ({ name, value: $player.style.getPropertyValue(name), priority: $player.style.getPropertyPriority(name) }))); + $player.style.width = `${viewport.clientHeight - insets.top - insets.bottom}px`; + $player.style.height = `${viewport.clientWidth - insets.left - insets.right}px`; + $player.style.transformOrigin = "0 0"; + $player.style.transform = `rotate(90deg) translate(${insets.top}px, -${viewport.clientWidth - insets.right}px)`; + $player.classList.add(className); art.isRotate = true; - art.emit("resize"); + if (emit) + art.emit("resize"); } - function clearWebRotate() { - setStyle($player, "width", ""); - setStyle($player, "height", ""); - setStyle($player, "transform-origin", ""); - setStyle($player, "transform", ""); - removeClass($player, WEB_CLASS); - art.isRotate = false; - art.emit("resize"); - } - function needRotate() { - const { videoWidth, videoHeight } = $video; - const vw = document.documentElement.clientWidth; - const vh = document.documentElement.clientHeight; - return videoWidth > videoHeight && vw < vh || videoWidth < videoHeight && vw > vh; - } - art.on("fullscreenWeb", (state2) => { - if (state2) { - if (needRotate()) { - const delay = Number(constructor.AUTO_ORIENTATION_TIME ?? 0); - setTimeout(() => { - if (art.fullscreenWeb && !hasClass($player, WEB_CLASS)) { - applyWebRotate(); - } - }, delay); - } - } else { - if (hasClass($player, WEB_CLASS)) - clearWebRotate(); + return (state2) => { + if (isClosing(art)) + return; + if (!state2) { + clear(); + return; } - }); - art.on("fullscreen", async (state2) => { - const canLock = !!screen?.orientation?.lock; - if (state2) { - if (canLock && needRotate()) { - try { - const last = screen.orientation.type; - const opposite = last.startsWith("portrait") ? "landscape" : "portrait"; - await screen.orientation.lock(opposite); - fsLocked = true; - addClass($player, FS_CLASS); - } catch (err) { - fsLocked = false; - notice.show = err; - } - } - } else { - if (hasClass($player, FS_CLASS)) { - removeClass($player, FS_CLASS); - } - if (canLock && fsLocked) { - try { - screen.orientation.unlock(); - } catch { - } - fsLocked = false; - } + if (saved) { + apply(false); + return; } + if (!needRotate()) + return; + cancel(); + cancel = timeout(scope, () => { + if (!saved) + apply(true); + }, Number(art.constructor.AUTO_ORIENTATION_TIME ?? 0)); + }; +} +function autoOrientation(art) { + const { $player, $video } = art.template; + const needRotate = () => { + const media = { width: $video.videoWidth, height: $video.videoHeight }; + const viewport = $player.ownerDocument.documentElement; + const view = { width: viewport.clientWidth, height: viewport.clientHeight }; + return positiveSize(media) && positiveSize(view) && (media.width > media.height && view.width < view.height || media.width < media.height && view.width > view.height); + }; + const web = webOrientation(art, needRotate); + const native = nativeOrientation(art, needRotate); + art.on("fullscreenWeb", web); + art.on("fullscreen", native); + getScope(art).add(() => { + art.off("fullscreenWeb", web); + art.off("fullscreen", native); }); return { name: "autoOrientation", get state() { - return hasClass($player, WEB_CLASS); + return $player.classList.contains("art-auto-orientation"); } }; } @@ -4676,8 +5415,9 @@ function installBuiltins(registry, option) { registry.add(lock); if (!isClosing(registry.art) && option.autoPlayback && !option.isLive) registry.add(autoPlayback); - if (!isClosing(registry.art) && option.autoOrientation && isMobile) + if (!isClosing(registry.art) && option.autoOrientation && isMobile) { registry.add(autoOrientation); + } if (!isClosing(registry.art) && option.fastForward && isMobile && !option.isLive) registry.add(fastForward); } @@ -5223,9 +5963,9 @@ function calculateSettingLayout(input) { return { width, height, left }; } function resizeSetting(setting2) { - const { art, active } = setting2; + const { art, active: active2 } = setting2; const { controls, constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, template: { $player, $setting, $bottom } } = art; - if (!controls.setting || !setting2.show || !active) + if (!controls.setting || !setting2.show || !active2) return; const player = $player.getBoundingClientRect(); const control = controls.setting.getBoundingClientRect(); @@ -5234,8 +5974,8 @@ function resizeSetting(setting2) { const layout = calculateSettingLayout({ containerWidth: $player.clientWidth, containerHeight: $player.clientHeight, - requestedWidth: active[0]?.$parent?.width || SETTING_WIDTH, - rows: active.length + (active === setting2.option ? 0 : 1), + requestedWidth: active2[0]?.$parent?.width || SETTING_WIDTH, + rows: active2.length + (active2 === setting2.option ? 0 : 1), rowHeight: SETTING_ITEM_HEIGHT, controlCenter, bottom: Number.parseFloat(getComputedStyle($setting).bottom) || 0, @@ -5358,12 +6098,12 @@ async function act(setting2, item, element, event, callback, target, property, b const targetScope = settingScope(target); const generation = (generations.get(target) || 0) + 1; generations.set(target, generation); - const active = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; + const active2 = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; before?.(); - if (!active()) + if (!active2()) return; const value = await callback.call(setting2.art, item, element, event); - if (active()) + if (active2()) Reflect.set(target, property, value); } catch (error2) { console.warn("ArtPlayer setting callback failed:", error2); @@ -5490,19 +6230,19 @@ function suspendTree(setting2, root) { } throw error2; } - let active = true; + let active2 = true; return { items, resume() { - if (!active) + if (!active2) return; - active = false; + active2 = false; finish([...suspended.reverse().map((item) => item.resume), ...unpause]); }, dispose() { - if (!active) + if (!active2) return; - active = false; + active2 = false; finish([...suspended.reverse().map((item) => item.dispose), ...Array.from(panels).reverse().map((panel) => () => releaseSettingPanel(panel)), ...unpause]); } }; @@ -5544,12 +6284,12 @@ function updateSetting(setting2, target) { const previous = setting2.active; const layout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); const tree = suspendTree(setting2, item); - let active = true; + let active2 = true; let rendered = false; const cancel = () => { - if (!active) + if (!active2) return; - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -5587,11 +6327,11 @@ function updateSetting(setting2, target) { console.warn("ArtPlayer setting restore failed:", error2); } }; - const current2 = () => active && !isClosing(setting2.art) && pending.get(item) === cancel; + const current2 = () => active2 && !isClosing(setting2.art) && pending.get(item) === cancel; for (const affected of tree.items) pending.set(affected, cancel); const release = getScope(setting2.art).add(() => { - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -5612,7 +6352,7 @@ function updateSetting(setting2, target) { setting2.render(); if (!current2()) return item; - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -6142,7 +6882,7 @@ class Storage { } } } -const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; +const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n max-width: 100vw;\n max-height: 100vh;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; function parseSubtitle(buffer, option) { const text = new TextDecoder(option.encoding).decode(buffer); switch (option.type || getExt(option.url)) { @@ -6215,19 +6955,19 @@ function renderSubtitle(subtitle) { return; const revision = state2.revision; const render = ++state2.render; - const active = () => !state2.scope.closed && state2.revision === revision && state2.render === render; + const active2 = () => !state2.scope.closed && state2.revision === revision && state2.render === render; const { art } = subtitle; const { $subtitle } = art.template; $subtitle.innerHTML = ""; if (!subtitle.activeCues.length) return; art.emit("subtitleBeforeUpdate", subtitle.activeCues); - if (!active()) + if (!active2()) return; const html2 = subtitle.activeCues.map((cue, index) => cue.text.split(/\r?\n/).filter((line) => line.trim()).map((line) => `
${art.option.subtitle.escape ? escape(line) : line}
`).join("")).join(""); - if (!active()) + if (!active2()) return; $subtitle.innerHTML = html2; art.emit("subtitleAfterUpdate", subtitle.activeCues); @@ -6537,8 +7277,8 @@ class Template { static get html() { return html; } - query(className) { - return query(className, this.$container); + query(className2) { + return query(className2, this.$container); } init() { const { option } = this.art; diff --git a/package.json b/package.json index d18bedfd3..49681e1fc 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "ci:build": "yarn build all && yarn build:i18n && yarn build:ts && yarn build:docs && yarn test:imports", "test:imports": "node --test test/esm.test.js test/i18n.test.js test/ssr.test.js", "typecheck": "node scripts/typecheck.mjs", - "test:unit": "node --test test/playback.test.js test/dash-control.test.js test/public-behavior.test.js test/helpers.test.js test/chapter.test.js test/utils.test.js test/resource-scope.test.js test/instance-lifecycle.test.js test/options.test.js test/media-hosts.test.js test/plugins.test.js test/source.test.js test/playback-properties.test.js test/media-events.test.js test/template-resources.test.js test/core-vendor.test.js test/component-resources.test.js test/setting-model.test.js test/setting-layout.test.js test/setting-resources.test.js test/subtitle.test.js", + "test:unit": "node --test test/playback.test.js test/dash-control.test.js test/public-behavior.test.js test/helpers.test.js test/chapter.test.js test/utils.test.js test/resource-scope.test.js test/instance-lifecycle.test.js test/options.test.js test/media-hosts.test.js test/plugins.test.js test/source.test.js test/playback-properties.test.js test/media-events.test.js test/template-resources.test.js test/core-vendor.test.js test/component-resources.test.js test/setting-model.test.js test/setting-layout.test.js test/setting-resources.test.js test/subtitle.test.js test/display-native.test.js test/display-video-fullscreen.test.js test/display-pip.test.js test/display-mini.test.js test/display-sizing.test.js test/display-orientation.test.js", "test": "yarn test:node && yarn test:baseline", "test:browser": "playwright test", "test:browser:install": "playwright install chromium firefox webkit", diff --git a/packages/artplayer/ARCHITECTURE.md b/packages/artplayer/ARCHITECTURE.md index a8cac14d0..245dadfee 100644 --- a/packages/artplayer/ARCHITECTURE.md +++ b/packages/artplayer/ARCHITECTURE.md @@ -4,6 +4,181 @@ ArtPlayer keeps its existing constructor, player mixins, plugins and DOM/CSS hoo The production entry is still `src/index.js`; this document marks actual migrated boundaries rather than describing the entire core as TypeScript. +## Display modes (CORE-16, in progress) + +player/autoSizeMix.ts, autoHeightMix.ts, aspectRatioMix.ts and flipMix.ts retain the +own-property facades, detached method binding, synchronous returns and normal events. +display/sizing.ts contains geometry only; sizing-types.ts describes the minimal hosts. +Zero/unready/non-finite media or container dimensions defer auto sizing without layout +writes or invalid height events; the next valid call measures and applies normally. +Aspect ratios retain split/Number coercion, datasets, notices and repeated events. +Malformed or unusable ratios do not partially overwrite existing video geometry. +Flip keeps custom strings and falsy normalization. Closing instances ignore these writes. +Run `node --test test/display-sizing.test.js` and +`yarn test:browser test/browser/display-sizing.spec.js` for geometry invariants, old/new +property contracts, hidden-container recovery, notices and destruction. Composition with +screen rotation is tested below; final installed-artifact acceptance remains a CORE-16 gate. + +plugins/autoOrientation.ts composes the mobile-only builtin, retaining its name/state +getter and mismatch rule. It rejects unready geometry and scopes the two ArtPlayer event +subscriptions. orientation-types.ts models the minimal host and optional platform lock. +The builtin registry currently bridges its generic JS host at this one assembly boundary; +the complete constructor host remains for CORE-21, without widening the implementation. + +display/orientation-web.ts owns delayed rotation and its four inline style properties. +Each new fullscreen session cancels the previous timer. Repeated entry reapplies dimensions +without replacing the first snapshot. On ordinary exit fullscreenWeb has already restored +the full entry style, so rotation only clears its flags; destroy restores rotation properties +before fullscreenWeb performs its own final restoration. Resize may update control CSS +variables independently. The scope cancels timers and removes subscriptions on destruction. + +display/orientation-native.ts owns lock requests, error notices and fullscreen rotation +classes. It calls lock synchronously, marks success only while current, and cancels on exit +or destroy. A weak per-platform-object token prevents cancelled or older instances from +unlocking a newer ArtPlayer request. Late cancelled success is released; obsolete failures +cannot overwrite current notices. Unlock is best effort, consistent with the prior API; +arbitrary application calls outside ArtPlayer cannot be tracked as owned locks. + +Run `node --test test/display-orientation.test.js` and +`yarn test:browser test/browser/display-orientation.spec.js` for cancellation, retry, shared +screen ownership, repeated entry, styles, timers, real rotated playback and ratio/flip +composition. The browser fixture uses a mobile UA with desktop engines and controlled +orientation.lock; it does not establish physical screen rotation or safe-area device support. +The [Screen Orientation specification](https://www.w3.org/TR/screen-orientation/) permits +platform preconditions for lock and defines superseding requests; capability and device +acceptance must stay distinct from controlled request-state tests. + +player/fullscreenWebMix.ts is the boolean property facade. display/web-fullscreen.ts +owns a single entry-session snapshot, reentry generations and destroy restoration; +display/placement.ts captures the original parent and next sibling. Repeated entry +preserves the first snapshot while keeping the existing true events. Exit restores +the captured position even if FULLSCREEN_WEB_IN_BODY changes while active. Destruction +restores the player before template.destroy, so removeHtml still owns the same tree. +Failed exit retains the snapshot for retry; reentrant event/DOM callbacks supersede +the earlier setter. Normal fullscreenWeb/resize ordering remains synchronous. + +Destroy is terminal: if restoring the original position throws before reattachment, +detach the displaced player so template cleanup cannot leave an orphan in body. The +original error still propagates; if detachment also fails, the lifecycle collector +retains both failures. A node already returned to its owner is left for normal +removeHtml handling. This exceptional fallback can leave retained HTML detached. + +Restore the exact style attribute before the exit event; downstream resize handlers +may update their own CSS variables. display-web.spec.js checks that distinction along +with original placement, repeated entry, failure, reentry and destruction. The native +fullscreen/PiP/mini/sizing/rotation paths have migrated source, while complete +acceptance remain CORE-16; this section does not certify physical mobile devices. + +player/fullscreenMix.ts still installs the fullscreen descriptor once after metadata. +display/fullscreen-adapter.ts reuses the unchanged screenfull vendor method mapping; +display/native-fullscreen.ts owns instance state, native events, cancellation and notices. +The getter and exit operation concern this player's container/video, not any document +fullscreen element. Normal fullscreen events precede class changes and resize. Reentrant +setters invalidate stale work while same-state reentry still updates the interface. + +display/fullscreen-request.ts invokes the native API on the caller stack, preserving +transient user activation. Native Promise results remain authoritative for their errors; +void prefixed APIs settle from change/error events. Void exit waits until neither the +instance player nor video owns fullscreen, even +when the request target was the player. Another element becoming fullscreen completes +the old exit without giving this instance ownership of that new element. Cancelled calls +settle promptly and lose their instance listeners. Descriptor callers can observe rejection identity; +ordinary assignments report a notice without creating an unhandled rejection. + +Unabortable void entry has no Promise to observe after destruction. Only cancellation +of that path creates display/fullscreen-abandoned.ts's document-lifetime change guard. +It keeps weak element keys and native exit operations, never player instances/scopes; +unrelated targets are ignored and a new entry clears the old cancellation. This shared +guard intentionally outlives instances, unlike their ordinary change/error listeners. +Post-destroy native exit is best effort: browser denial cannot be undone synchronously. + +Run `node --test test/display-native.test.js` for controlled async/reentry semantics. +For native gesture, recovery and subtitle checks: + +```sh +yarn test:browser test/browser/display-native.spec.js test/browser/display-web.spec.js test/browser/subtitle-lifecycle.spec.js +``` + +Void cancellation in desktop browsers uses controlled native methods; it does not certify +old browser versions or iOS video-only fullscreen. Remaining failure boundaries and +final installed distribution acceptance remain in CORE-16. + +display/video-fullscreen.ts owns the video-only WebKit fallback. It retains the +synchronous property setter and native thrown error, and listens to video begin/end, +presentation-mode changes and the existing document event bridge. The state helper in +display/video-fullscreen-state.ts distinguishes fullscreen from PiP when a presentation +mode exists, otherwise reads webkitDisplayingFullscreen or the video event fallback. +Repeated signals emit one transition; an exit failure retains actual state for retry. + +Destroy releases all instance listeners and exits active video presentation. A pending +unabortable entry leaves only a static listener on that video with a weak cancellation +mark; this callback references no ArtPlayer/scope and exits late entry. New entry removes +the cancellation. Synchronous exit failure during destroy propagates through the normal +lifecycle cleanup collector; late cancellation cleanup is best effort. No document-wide +listener is installed for this video-only path. + +Use `node --test test/display-video-fullscreen.test.js` and +`yarn test:browser test/browser/display-video-fullscreen.spec.js` for controlled fallback +checks, plus native/fullscreenWeb/subtitle tests for composition. The desktop fixture +forces the fallback and emulates native video events; it does not prove physical iOS +presentation or gesture behavior. Apple documents the distinct video events in +[Controlling Media with JavaScript](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html). + +player/pipMix.ts chooses callable native, WebKit or unsupported capabilities and installs +the original property descriptor. display/native-pip.ts keeps the element/null getter, +void setter, native entry/leave events and failure notices. It never exits another +video's PiP; revisions suppress obsolete notices, cancellation rejects late entry, and +destroy disposes listeners before exiting owned presentation. Request invocation remains +synchronous for transient activation. Async rejection is handled internally because the +historical void setter cannot expose a Promise; native synchronous errors still throw. +An old queued leave event is ignored while this video still owns the current PiP session; +actual ownership loss continues to emit the existing false notification. + +display/webkit-pip.ts keeps its boolean getter and initial inline setup. It observes both +presentation-mode and PiP events, deduplicates native signals, and retains repeated +synchronous setter notifications. Capability is checked at entry so later media readiness +can allow retry. Cancelled pending entry leaves only a static video-held callback and weak +mark, with no art/scope closure. Inline cleanup never exits a different fullscreen mode. +Destruction's synchronous WebKit failure follows the normal lifecycle error collector; +late cleanup is best effort. Platform UI remains the browser's responsibility. + +The internal PipProperty reflects the branch-dependent getter. Historical public boolean +declarations remain unchanged pending BASE-TYPE-10 / CORE-21; this is an explicit legacy +declaration discrepancy, not a reason to convert native JS consumers to boolean. +Run `node --test test/display-pip.test.js` and +`yarn test:browser test/browser/display-pip.spec.js test/browser/display-pip-webkit.spec.js`. +The actual native test records capabilities and, when supported, a native window, media +progress, exit and fullscreenWeb/native-fullscreen transitions. WebKit event injection +is separate from physical Safari/iOS validation. See the +[PiP specification](https://w3c.github.io/picture-in-picture/) and +[Apple's presentation-mode API](https://developer.apple.com/documentation/webkitjs/adding_picture_in_picture_to_your_safari_media_controls). + +player/miniMix.ts keeps the boolean mini descriptor. display/mini.ts owns entry/exit +generations and video placement; mini-view.ts owns popup creation, controls, playback +subscriptions and node removal. mini-drag.ts owns document mouse subscriptions and drag +state; mini-layout.ts calculates finite saved/default coordinates and viewport bounds. +The first popup keeps video-first DOM order and its default display; reuse moves the video +last and uses flex as before. Repeated true/false events and storage keys left/top remain. + +Capture the original video parent and next sibling once per mini session. Exit restores +that location, with the snapshot retained on failure for retry. Detach the snapshot before +restoring DOM so a reentrant entry can capture its own placement. Serialize entry during +view creation to avoid duplicate popups from custom icon getters. Failed creation disposes +its partial view; hide/destroy during construction never leaves visible stale UI. + +Created popups and playback/drag listeners belong to the instance scope; hide keeps a +reusable hidden popup but cancels drag, and destroy removes owned nodes and restores the +video. A caller-provided template.$mini stays caller-owned and regains its prior display +on destroy. Drag uses client coordinates for fixed positioning, clamps its final position, +and writes numeric left/top. Normal defaults retain a 50px inset; non-finite/offscreen +storage resets, and CSS max-width/max-height keep the popup inside a smaller viewport. + +Run `node --test test/display-mini.test.js` and +`yarn test:browser test/browser/display-mini.spec.js test/browser/display-pip.spec.js`. +Browser checks include video placement, playback buttons, actual drag, failure/reentry, +caller ownership, narrow screens and transitions from mini to web fullscreen/native PiP. +Final installed display-mode acceptance is still pending with CORE-16. + ## Subtitles (CORE-15) src/subtitle/index.ts keeps the Component prototype, bound update, public methods and diff --git a/packages/artplayer/dist/artplayer.js b/packages/artplayer/dist/artplayer.js index 7de5ddfd6..cded353cc 100644 --- a/packages/artplayer/dist/artplayer.js +++ b/packages/artplayer/dist/artplayer.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!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 o=(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 n=t(r);if("boolean"===n)return"boolean";if("string"===n)return"string";if("number"===n)return"number";if("symbol"===n)return"symbol";if("function"===n)return"GeneratorFunction"===o(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(o(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(n=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 n.slice(8,-1).toLowerCase().replace(/\s/g,"")};function o(t){return t.constructor?t.constructor.name:null}function n(t,e){var o=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,o,n=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};o&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,n||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),n&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,o)=>{!function(t,e,r,o){const n=v(e);if(n.closed)return;const a=(...t)=>{if(!n.closed)return o(...t)};t.on(r,a),n.add(()=>{t.off(r,a)})}(t,e,r,o)},proxy:(r,o,n)=>function(t,e,r,o,n){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,o,t=>{if(!a.closed)return n(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,o,n)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 S(t,e=document){return e.querySelector(t)}function z(t,e=document){return Array.from(e.querySelectorAll(t))}function L(t,e){return t.classList.add(e)}function M(t,e){return t.classList.remove(e)}function P(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function R(t,e,r){return t.style[e]=r,t}function O(t,e){for(const r in e)R(t,r,e[r]);return t}function I(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function _(t,e){I(t).forEach(t=>M(t,e)),L(t,e)}function V(t,e,r="top"){E||(t.setAttribute("aria-label",e),L(t,"hint--rounded"),L(t,`hint--${r}`))}function N(t,e=0){const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=o&&r.top+r.height+e>=0,i=r.left-e<=n+e&&r.left+r.width+e>=0;return a&&i}function D(t,e){return q(t).includes(e)}function W(t,e){return e.parentNode.replaceChild(t,e),t}function Y(t){return document.createElement(t)}function F(t="",e=""){const r=Y("i");return L(r,"art-icon"),L(r,`art-icon-${t}`),A(r,e),r}function B(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function H(t){return t.getBoundingClientRect()}function j(t,e){return new Promise((r,o)=>{const n=new Image;n.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=n.width*e,a.height=n.height*e,i.drawImage(n,0,0,a.width,a.height),a.toBlob(e=>{const n=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(n),o(new Error(`Image load failed: ${t}`))},a.src=n})}else r(n)},n.onerror=function(){o(new Error(`Image load failed: ${t}`))},n.src=t})}function q(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}function U(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class X extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function G(t,e){if(!t)throw new X(e);return t}function K(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function Z(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function J(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function Q(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function tt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function et(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),o=Math.floor(t-3600*e-60*r);return(e>0?[e,r,o]:[r,o]).map(t=>t<10?`0${t}`:String(t)).join(":")}const rt={"&":"&","<":"<",">":">","'":"'",'"':"""},ot={"&":"&","<":"<",">":">","'":"'",""":'"'},nt=/(&|<|>|'|")/g;function at(t){return t.replace(/[&<>'"]/g,t=>rt[t]||t)}const it=Object.defineProperty,{hasOwnProperty:st}=Object.prototype;function lt(t,e){return st.call(t,e)}function ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(o=>{const n=t[o],a=r[o];let i;i=Array.isArray(n)&&Array.isArray(a)?n.concat(...a):e(n)&&e(a)?dt(n,a):a,it(t,o,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function pt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let o=r.slice(0,3);return 1===r.length&&(o=`${r}00`),2===r.length&&(o=`${r}0`),`${e},${o}`})).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 ut(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ht(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 o=t.match(e);if(!o)return null;const[,n="",a="",,,i=""]=o;return{start:r(n.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 ft(t,e){let r=!1;return function(...o){r||(t.apply(this,o),r=!0,setTimeout(()=>{r=!1},e))}}const mt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:X,addClass:L,append:A,assToVtt:ht,capitalize:tt,clamp:Q,createElement:Y,debounce:function(t,e){let r;return function(...o){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,o)),e)}},def:it,download:J,errorHandle:G,escape:at,get:ct,getComposedPath:q,getExt:Z,getIcon:F,getRect:H,getSafeAreaInsets:U,getStyle:function(t,e,r=!0){const o=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(o):o},has:lt,hasClass:P,includeFromEvent:D,inverseClass:_,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:N,isMobile:E,isSafari:x,loadImg:j,mergeDeep:dt,query:S,queryAll:z,remove:function(t){return t.parentNode.removeChild(t)},removeClass:M,replaceElement:W,secondToTime:et,setStyle:R,setStyleText:C,setStyles:O,siblings:I,silencePromise:K,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:pt,supportsFlex:B,throttle:ft,tooltip:V,unescape:function(t){return t.replace(nt,t=>ot[t]||t)},userAgent:w,vttToBlob:ut},Symbol.toStringTag,{value:"Module"}));function gt(t,e){return A(t,e)}function vt(t,e){return e.querySelector(t)}const yt="array",bt="boolean",wt="string",xt="number",kt="object",$t="function";function Et(t,e,r){return G(e===wt||e===xt||t instanceof Element,`${r.join(".")} require '${wt}' or 'Element' type`)}const Tt={html:Et,disable:`?${bt}`,name:`?${wt}`,index:`?${xt}`,style:`?${kt}`,click:`?${$t}`,mounted:`?${$t}`,tooltip:`?${wt}|${xt}`,width:`?${xt}`,selector:`?${yt}`,onSelect:`?${$t}`,switch:`?${bt}`,onSwitch:`?${$t}`,range:`?${yt}`,onRange:`?${$t}`,onChange:`?${$t}`},Ct={id:wt,container:Et,url:wt,poster:wt,type:wt,theme:wt,lang:wt,volume:xt,isLive:bt,muted:bt,autoplay:bt,autoSize:bt,autoMini:bt,loop:bt,flip:bt,playbackRate:bt,aspectRatio:bt,screenshot:bt,setting:bt,hotkey:bt,pip:bt,mutex:bt,backdrop:bt,fullscreen:bt,fullscreenWeb:bt,subtitleOffset:bt,miniProgressBar:bt,useSSR:bt,playsInline:bt,lock:bt,gesture:bt,fastForward:bt,autoPlayback:bt,autoOrientation:bt,airplay:bt,proxy:`?${$t}`,plugins:[$t],layers:[Tt],contextmenu:[Tt],settings:[Tt],controls:[{...Tt,position:(t,e,r)=>{const o=["top","left","right"];return G("string"===typeof t&&o.includes(t),`${r.join(".")} only accept ${o.toString()} as parameters`)}}],quality:[{default:`?${bt}`,html:wt,url:wt}],highlight:[{time:xt,text:wt}],thumbnails:{url:wt,number:xt,column:xt,width:xt,height:xt,scale:xt},subtitle:{url:wt,name:wt,type:wt,style:kt,escape:bt,encoding:wt,onVttLoad:$t},moreVideoAttr:kt,i18n:kt,icons:kt,cssVar:kt,customType:kt},St=new WeakSet;class zt{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 P(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?L(e,r):M(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",n(e,Tt),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,o=this.cache;G(!o.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,o,n,a){L(t,`art-${r}`),L(t,`art-${r}-${o}`);const i=Array.from(e.children);t.dataset.index=String(a.index||n);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&O(t,a.style),a.tooltip&&V(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const o=t;"__proto__"===e?Object.defineProperty(o,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):o[e]=r}(this,r,a),c=!0,o.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw o.get(r)?.$ref===a&&o.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){G(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!St.has(e)){St.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{St.delete(e)}}}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 Lt extends zt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:o,proxy:n}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:o}}=e,n=o.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.playbackRate=Number(o),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="1"]',t);o&&_(o,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).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:o}}=e,n=o.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.aspectRatio=o,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="default"]',t);o&&_(o,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).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:o}}=e,n=o.map(t=>`${r.get(tt(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${n}`,click:(t,r)=>{const o=r.target instanceof HTMLElement?r.target.dataset.value:void 0;o&&(e.flip=o.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),o=S('[data-value="normal"]',t);o&&_(o,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const o=t.clientX,n=t.clientY,{height:a,width:i,left:s,top:l}=H(e),{height:c,width:d}=H(r);let p=o-s,u=n-l;o+d>s+i&&(p=i-d),n+c>l+a&&(u=a-c),O(r,{top:`${u}px`,left:`${p}px`})}),n(e,"click",t=>{D(t,r)||(this.show=!1)}),o("blur",()=>{this.show=!1})}}function Mt(t,e,r){if(t.closed)return()=>{};let o=!0,n=()=>{};const a=setTimeout(()=>{o&&(n(),t.closed||e())},r);return n=t.add(()=>{o=!1,clearTimeout(a)}),n}function Pt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let o=!1,n=()=>{};const a=setTimeout(()=>{o=!0,n(),r(!0)},e);n=t.add(()=>{clearTimeout(a),o||r(!1)})})}function At(t,e){const{$progress:r}=t.template,{left:o}=H(r),n=Q((E?e.touches[0].clientX:e.clientX)-o,0,r.clientWidth),a=n/r.clientWidth*t.duration;return{second:a,time:et(a),width:n,percentage:Q(n/r.clientWidth,0,1)}}function Rt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,o=r*t.duration;t.emit("setBar","played",r,e),t.seek=o}else{const{second:r,percentage:o}=At(t,e);t.emit("setBar","played",o,e),t.seek=r}}function Ot(t,e){const{icons:r,option:o}=t,{$player:n}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=vt(".art-progress-hover",e),c=vt(".art-progress-loaded",e),d=vt(".art-progress-played",e),p=vt(".art-progress-highlight",e),u=vt(".art-progress-indicator",e),h=vt(".art-progress-tip",e);function f(r,o){const{width:n,time:a}=o||At(t,r);h.textContent=a||"00:00";const i=h.clientWidth;n<=i/2?R(h,"left",0):n>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",n-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,o,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*o+"%"),"hover"===r&&(R(l,"width",100*o+"%"),D(i,p)?function(r){const{width:o}=At(t,r),n=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=n??"";const a=h.clientWidth;o<=a/2?R(h,"left",0):o>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",o-a/2+"px")}(i):f(i),0===o?M(n,"art-progress-hover"):L(n,"art-progress-hover")),"played"===r&&(R(d,"width",100*o+"%"),R(u,"left",100*o+"%")),m){L(n,"art-progress-hover");f(i,{width:e.clientWidth*o,time:et(o*t.duration)}),s(),s=Mt(a,()=>{M(n,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function It(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{Ot(e,t),function(t,e){const{$progress:r}=t.template,o=e.querySelector(".art-progress-indicator"),{on:n,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==o&&Rt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=At(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),n("document:mousemove",r=>{if(e){const{second:e,percentage:o}=At(t,r);t.emit("setBar","played",o,r),t.seek=e}}),n("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function _t(t){const{option:e}=t.art;e.isLive||t.add(It({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.play),s=gt(t,n.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}V(i,a.get("Play")),V(s,a.get("Pause")),o(i,"click",()=>{K(e.play())}),o(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n}=e,a=gt(t,n.volume),i=gt(t,n.volumeClose),s=gt(t,'
'),l=gt(s,'
'),c=gt(l,'
'),d=gt(l,'
'),p=gt(d,'
'),u=gt(p,'
'),h=gt(d,'
');function f(t){const{top:e,height:r}=H(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),o(a,"click",()=>{e.muted=!0}),o(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;o(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function o(){const r=`${et(e.currentTime)} / ${et(e.duration)}`;r!==t.textContent&&(t.textContent=r)}o();const n=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;gt(t,o.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;gt(t,n.setting),o(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{V(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e;gt(t,n.pip),o(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{V(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:o}=e;gt(t,o.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.fullscreenWebOn),s=gt(t,n.fullscreenWebOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(V(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(V(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:o}=b(e,t),{icons:n,i18n:a}=e,i=gt(t,n.fullscreenOn),s=gt(t,n.fullscreenOff);R(s,"display","none"),o(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(V(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(V(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rNt.get(t).option.selector}),it(t,"$control_item",{get:()=>Nt.get(t).item}),it(t,"$control_value",{get:()=>Nt.get(t).value})),Nt.set(t,e)}function Wt(t,e){t.innerHTML=e}function Yt(t,e,r,o,n){const{proxy:a}=t.events,i=v(o),s=r.selector;L(o,"art-control-selector");const l=document.createElement("div");L(l,"art-selector-value"),A(l,r.html),o.textContent="",A(o,l);const c=gt(o,'
');for(let u=0;u{if(i.closed)return;const n=q(o),a=r.selector.find(t=>n.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Vt.set(t,e),()=>{Vt.get(t)===e&&Vt.delete(t)}}(o,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,o);c()&&Wt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});n.push(p)}class Ft extends zt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:o}=this.art.template;g(t,o);const{on:n}=b(t,o);n("mousemove",()=>{E||(this.show=!0)}),n("click",()=>{E?this.toggle():this.show=!0}),n("document:mousemove",t=>{this.isHover=D(t,o)}),n("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),n("control",t=>{t?(M(r,"art-hide-cursor"),L(r,"art-hover"),this.timer=Date.now()):(L(r,"art-hide-cursor"),M(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:o}=t.template,n=v(e),{on:a}=b(t,e),i=()=>{if(n.closed)return;const t=r.offsetHeight;t>0&&o.style.getPropertyValue("--art-controls-height")!==`${t}px`&&o.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),n.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),n.add(()=>{t.disconnect()})}i()}(t)}init(){_t(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:o,$controlsRight:n}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=o;break;case"right":this.$parent=n;break;default:G(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Wt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Bt(t,e,r,o){const n=e-o,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(n)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,n);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}function Ht(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function o(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,o=()=>{};const n=requestAnimationFrame(n=>{r&&(o(),t.closed||e(n))});return o=t.add(()=>{r=!1,cancelAnimationFrame(n)}),o}(e,o))}(),t.on("destroy",()=>{r()})}}const jt=new WeakMap;class qt{constructor(t){this.destroyEvents=new Set;const e=u(t);jt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:o,$video:n}}=t;function a(e){D(e,o)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(n,"click",e=>{const o=Date.now();i.push(o);const{MOBILE_CLICK_PLAY:n,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>o-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&n&&K(t.toggle()):K(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&K(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=>{L(r,"art-hover"),t.emit("hover",!0,e)},e=>{M(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:o}=t;t.on("resize",()=>{const{aspectRatio:e,notice:o}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,o.show=""});const n=u(t);let a=()=>{};const i=()=>{a(),a=Mt(n,()=>t.emit("resize"),o.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:o}=t.template;let n=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){n===o&&Rt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:o,pageY:a}=e.touches[0],c=Bt(i,s,o,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=Q((o-i)/t.width,-1,1),d=Q((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=n===r?t.constructor.TOUCH_MOVE_RATIO:1,h=Q(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",Q(h/t.duration,0,1),e),t.notice.show=`${et(h)} / ${et(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,n=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{n=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(o,"touchstart",t=>{n=o,c(t)}),e.proxy(o,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:o}}=t,n=ft(()=>{t.emit("view",N(o,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>n()),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"],o=["resize","scroll","orientationchange"],n=[];function a(a={}){for(let t=0;t{const o=a.document||i.ownerDocument||document,s=e.proxy(o,r,e=>{t.emit(`document:${r}`,e)});n.push(s)}),o.forEach(r=>{const o=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(o,r,e=>{t.emit(`window:${r}`,e)});n.push(s)})}a(),e.bindGlobalEvents=a}(t,this),Ht(t)}proxy(t,e,r,o={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,o));if(jt.get(this).closed)return()=>{};t.addEventListener(e,r,o);const n=()=>t.removeEventListener(e,r,o);return this.destroyEvents.add(n),n}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 Ut{constructor(t){this.art=t,this.keys={},E||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",()=>{K(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Zt{constructor(t){const e={...Kt,...t.option.icons};for(const r in e)it(this,r,{get:()=>F(r,e[r])})}}class Jt extends zt{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:o,$video:n}}=this.art;t(o,"click",()=>{this.show=!1});let a=()=>{};const i=z("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(n,"display","none"),R(a,"display",null)}),o.proxy(e.$state,"click",()=>K(t.play()))}}class re{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:o}}=this.art;t?(o.textContent=t instanceof Error?t.message.trim():t,L(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{o.textContent="",M(r,"art-notice-show")},e.NOTICE_TIME)):M(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function oe(t,e,r,o=!1){const n=e=>{h(t)||r(e)};t[o?"once":"on"](e,n),u(t).add(()=>{t.off(e,n)})}function ne(t,e,r){for(const[o,n]of e){if(h(t)||r&&!r())return;t[o].show=n}}const ae=new WeakMap,ie=new WeakMap,se=new WeakMap;function le(t){return se.get(t)||u(t)}function ce(t){const e=ae.get(t),r=se.get(t);return()=>ae.get(t)===e&&(!e||e.active())&&se.get(t)===r&&(!r||!r.closed)}function de(t){const e=se.get(t),r=u(t).child(),o=r.child();se.set(t,r),r.add(()=>{se.get(t)===r&&se.delete(t)});const n={scope:o,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!o.closed&&ae.get(t)===n};return ae.set(t,n),o.add(()=>{ae.get(t)===n&&ae.delete(t),n.onAssigned=void 0,n.onError=void 0}),e?.dispose(),n}function pe(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function ue(t,e,r){ie.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ie.get(t)===e&&(ie.delete(t),pe(e))}}function he(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function fe(t){const{option:e,constructor:r,i18n:o,notice:n,template:{$player:a}}=t;let i,s=le(t),l=0;return{reset(){l=0,i?.dispose(),M(a,"art-error")},loadStart(){M(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=le(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===le(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function me(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let o=0;o{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=fe(t);!function(t,e){oe(t,"video:canplay",()=>{e.reset(),ne(t,[["loading",!1]])}),oe(t,"video:canplay",()=>{ne(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;oe(t,"video:ended",()=>{if(e.loop){const e=ce(t);if(t.seek=0,h(t)||!e())return;K(t.play()),e()&&ne(t,[["controls",!1],["mask",!1]],e)}else ne(t,[["controls",!0],["mask",!0]])})}(t),oe(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;oe(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&ne(t,[["loading",!1],["controls",!0],["mask",!0]])}),oe(t,"video:loadstart",()=>{e.loadStart(),ne(t,[["loading",!0],["mask",!1],["controls",!0]])}),oe(t,"video:pause",()=>{ne(t,[["controls",!0],["mask",!0]])}),oe(t,"video:play",()=>{ne(t,[["mask",!1]]),h(t)||R(r,"display","none")}),oe(t,"video:playing",()=>ne(t,[["mask",!1]])),oe(t,"video:progress",()=>{t.playing&&ne(t,[["loading",!1]])}),oe(t,"video:seeked",()=>ne(t,[["loading",!1],["mask",!0]])),oe(t,"video:seeking",()=>ne(t,[["loading",!0],["mask",!1]])),oe(t,"video:timeupdate",()=>ne(t,[["mask",!1]])),oe(t,"video:waiting",()=>ne(t,[["loading",!0],["mask",!1]]))}(t,e)}const ge=[["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"]],ve=(()=>{if("undefined"===typeof document)return!1;const t=ge[0],e={};for(const r of ge){if(r[1]in document){for(const[o,n]of r.entries())e[t[o]]=n;return e}}return!1})(),ye={change:ve.fullscreenchange,error:ve.fullscreenerror},be={request:(t=document.documentElement,e)=>new Promise((r,o)=>{const n=()=>{be.off("change",n),r()};be.on("change",n);const a=t[ve.requestFullscreen](e);a instanceof Promise&&a.then(n).catch(o)}),exit:()=>new Promise((t,e)=>{if(!be.isFullscreen)return void t();const r=()=>{be.off("change",r),t()};be.on("change",r);const o=document[ve.exitFullscreen]();o instanceof Promise&&o.then(r).catch(e)}),toggle:(t,e)=>be.isFullscreen?be.exit():be.request(t,e),onchange(t){be.on("change",t)},onerror(t){be.on("error",t)},on(t,e){const r=ye[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=ye[t];r&&document.removeEventListener(r,e,!1)},raw:ve};function we(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;t.once("video:loadedmetadata",()=>{var a;be.isEnabled?(a=t,be.on("change",()=>{a.emit("fullscreen",be.isFullscreen),be.isFullscreen?(a.state="fullscreen",L(n,"art-fullscreen")):M(n,"art-fullscreen"),a.emit("resize")}),be.on("error",t=>{a.emit("fullscreenError",t)}),it(a,"fullscreen",{get:()=>be.isFullscreen,async set(t){t?await be.request(n):await be.exit()}})):o.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),it(t,"fullscreen",{get:()=>document.fullscreenElement===o,set(e){e?(t.state="fullscreen",o.webkitEnterFullscreen()):o.webkitExitFullscreen()}})})(t):it(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),it(t,"fullscreen",ct(t,"fullscreen"))})}function xe(t){const{icons:e,proxy:r,storage:o,template:{$player:n,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(M(n,"art-mini"),R(e,"display","none"),n.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(R(e,"display","none"),R(r,"display","flex")):(R(e,"display","flex"),R(r,"display","none"))}function p(){const{$mini:e}=t.template,r=H(e),n=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;o.set("top",n),o.set("left",a),R(e,"top",`${n}px`),R(e,"left",`${a}px`)}it(t,"mini",{get:()=>P(n,"art-mini"),set(u){if(u){t.state="mini",L(n,"art-mini");const u=function(){const{$mini:n}=t.template;if(n)return A(n,a),R(n,"display","flex");{const n=Y("div");L(n,"art-mini-popup"),A(document.body,n),t.template.$mini=n,A(n,a);const p=A(n,'
');A(p,e.close),r(p,"click",c);const u=A(n,'
'),h=A(u,e.play),f=A(u,e.pause);return r(h,"click",()=>K(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(n,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){L(n,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;R(n,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,M(n,"art-mini-dragging");const t=H(n);o.set("left",t.left),o.set("top",t.top),R(n,"left",`${t.left}px`),R(n,"top",`${t.top}px`),R(n,"transform",null)}}),n}}(),h=o.get("top"),f=o.get("left");"number"===typeof h&&"number"===typeof f?(R(u,"top",`${h}px`),R(u,"left",`${f}px`),N(u)||p()):p(),t.emit("mini",!0)}else c()}})}function ke(t){const{i18n:e,notice:r,template:{$video:o}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:o}=t;e.disablePictureInPicture=!1,it(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw o.show=t,t})):document.exitPictureInPicture().catch(t=>{throw o.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):o.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),it(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):it(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function $e(t){it(t,"quality",{set(e){const{controls:r,notice:o,i18n:n}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Vt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${n.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(o.show=r)}return e.html}})}})}function Ee(t,e,r,o,n=!0){let a,i=!1;const s=e=>{t.closed||i||(n&&(i=!0,a()),o(e))};return e[n?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Te(t,e,r){return new Promise((o,n)=>{if(h(t)||e===t.url)return void o();const a=de(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?n(e):o(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:o,aspectRatio:n,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=n,c())){if(o)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Ee(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(ue(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Ee(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Ce(t){const{option:e,template:{$progress:r,$video:o}}=t;let n=null,a=!1,i=null;t.on("setBar",async(n,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===n||"played"===n&&l&&E){if(i||a||(a=!0,i=await j(d,p),a=!1),!i)return;const n=r.clientWidth*s;n>0&&nr.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",n-u/2+"px")}(n)}}),it(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(n),n=null,a=!1,i=null)}})}function Se(t){const{option:e,template:{$video:r}}=t;it(t,"url",{get:()=>r.src,async set(o){if(h(t))return;const n=function(t){const e=ie.get(t);return ie.delete(t),e||de(t)}(t);n.acceptingEvents=!1;try{if(!o)return void(await Pt(n.scope)&&n.active()&&(t.loading.show=!0));const a=t.url,i=e.type||Z(o),s=e.customType[i];if(i&&s){if(!(await Pt(n.scope))||!n.active())return;t.loading.show=!0}if(!n.active())return;const l=n.scope.child();let c=!1,d=!1;Ee(l,t,"video:canplay",()=>{c=!d}),Ee(l,t,"video:error",()=>{d=!0});try{if(n.acceptingEvents=!0,i&&s){const e=s.call(t,r,o,t);Promise.resolve(e).catch(t=>he(n,t))}else{if(a&&URL.revokeObjectURL(a),!n.active())return;r.src=o}}finally{l.dispose()}if(!n.active())return;if(a!==t.url&&(t.option.url=o,n.active()&&t.isReady&&a)){const e=()=>{n.active()&&t.emit("restart",o)};c?e():d||Ee(n.scope,t,"video:canplay",e)}}catch(a){he(n,a)}finally{pe(n)}}})}Object.defineProperties(be,{isFullscreen:{get:()=>Boolean(document[ve.fullscreenElement])},element:{enumerable:!0,get:()=>document[ve.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ve.fullscreenEnabled])}});class ze{constructor(t){Se(t),function(t){const{template:{$video:e}}=t;it(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:o,constructor:{instances:n},template:{$video:a}}=t;it(t,"play",{async value(){const i=ce(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),o.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;it(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${et(t.currentTime)} / ${et(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;it(t,"forward",{set(e){r.seek=t.currentTime+e}}),it(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:o,storage:n}=t;it(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=Q(t,0,1),o.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&n.set("volume",e.volume)}}),it(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;it(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const o=Number.parseFloat(r);Number.isNaN(o)||(e.currentTime=Q(o,0,t.duration))}})}(t),function(t){it(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Te(t,e,0);it(t,"switchQuality",{value:e=>Te(t,e,t.currentTime)}),it(t,"switchUrl",{value:e}),it(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:o}=t,n=t;it(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,o.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else n.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:o,$player:n}}=t;it(t,"aspectRatio",{get:()=>n.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)R(o,"width",null),R(o,"height",null),R(o,"margin",null),delete n.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=n,i=e/r,s=t[0]/t[1];i>s?(R(o,"width",s*r+"px"),R(o,"height","100%"),R(o,"margin","0 auto")):(R(o,"width","100%"),R(o,"height",e/s+"px"),R(o,"margin","auto 0")),n.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,o=Y("canvas");it(t,"getDataURL",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(a){e.show=a,n(a)}})}),it(t,"getBlobUrl",{value:()=>new Promise((t,n)=>{try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,n(a)}})}),it(t,"screenshot",{value:async e=>{const o=await t.getDataURL();return J(o,`${e||`artplayer_${et(r.currentTime)}`}.png`),t.emit("screenshot",o),o}})}(t),we(t),function(t){const{constructor:e,template:{$container:r,$player:o}}=t;let n="";it(t,"fullscreenWeb",{get:()=>P(o,"art-fullscreen-web"),set(a){a?(n=o.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&A(document.body,o),t.state="fullscreenWeb",R(o,"width","100%"),R(o,"height","100%"),L(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&A(r,o),n&&(o.style.cssText=n,n=""),M(o,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),ke(t),function(t){const{$video:e}=t.template,r=t;it(t,"loaded",{get:()=>r.loadedTime/e.duration}),it(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){it(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;it(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:o}=t.template;it(t,"autoSize",{value(){const{videoWidth:n,videoHeight:a}=o,{width:i,height:s}=H(e),l=n/a;if(i/s>l)R(r,"width",s*l/i*100+"%"),R(r,"height","100%");else{const t=i/l/s*100;R(r,"width","100%"),R(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;it(t,"rect",{get:()=>H(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let o=0;oe.rect[n]})}it(t,"x",{get:()=>e.left+window.pageXOffset}),it(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:o}=t;it(t,"flip",{get:()=>e.dataset.flip||"normal",set(n){n||(n="normal"),"normal"===n?delete e.dataset.flip:e.dataset.flip=n,o.show=`${r.get("Video Flip")}: ${r.get(tt(n))}`,t.emit("flip",n)}})}(t),xe(t),function(t){const{template:{$poster:e}}=t;it(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;it(t,"autoHeight",{value(){const{clientWidth:o}=e,{videoHeight:n,videoWidth:a}=r,i=n*(o/a);R(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;it(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){it(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){it(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];it(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let o=0;oo.$track?.offset||0,set(n){const{cues:a}=t.subtitle;if(!o.$track||0===a.length)return;const i=Q(n,-10,10);o.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,it(t,"airplay",{value(){a?(n.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),$e(t),Ce(t),me(t),function(t){const{option:e,storage:r,template:{$video:o,$poster:n}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(o.volume=Q(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(o.volume=Q(a,0,1)),e.poster&&R(n,"backgroundImage",`url(${e.poster})`),e.autoplay&&(o.autoplay=e.autoplay),e.playsInline&&(o.playsInline=!0,o["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 Le(t){const{notice:e,constructor:r,template:{$player:o,$video:n}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=n,r=document.documentElement.clientWidth,o=document.documentElement.clientHeight;return t>e&&ro}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!P(o,a)&&function(){const e=U(),r=document.documentElement.clientWidth,n=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;R(o,"width",`${n}px`),R(o,"height",`${i}px`),R(o,"transform-origin","0 0"),R(o,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),L(o,a),t.isRotate=!0,t.emit("resize")}()},e)}}else P(o,a)&&(R(o,"width",""),R(o,"height",""),R(o,"transform-origin",""),R(o,"transform",""),M(o,a),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,L(o,i)}catch(n){s=!1,e.show=n}}else if(P(o,i)&&M(o,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return P(o,a)}}}function Me(t){const{i18n:e,icons:r,storage:o,constructor:n,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=S(".art-auto-playback-last",s),c=S(".art-auto-playback-jump",s),d=S(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(o.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=n.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${et(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,K(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},n.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=o.get("times")||{},r=Object.keys(e);r.length>n.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,o.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return o.get("times")||{}},clear:()=>o.del("times"),delete(t){const e=o.get("times")||{};return delete e[t],o.set("times",e),e}}}function Pe(t){const{constructor:e,proxy:r,template:{$player:o,$video:n}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,M(o,"art-fast-forward"))};return r(n,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,L(o,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return P(o,"art-fast-forward")}}}function Ae(t){const{layers:e,icons:r,template:{$player:o}}=t;function n(){return P(o,"art-lock")}function a(){L(o,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){M(o,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const o=A(e,r.lock),n=A(e,r.unlock);R(o,"display","none"),t.on("lock",t=>{t?(R(o,"display","inline-flex"),R(n,"display","none")):(R(o,"display","none"),R(n,"display","inline-flex"))})},click(){n()?i():a()}}),{name:"lock",get state(){return n()},set state(t){t?a():i()}}}function Re(t){return t.on("control",e=>{e?M(t.template.$player,"art-mini-progress-bar"):L(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Oe{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(Re),!h(t.art)&&e.lock&&E&&t.add(Ae),h(t.art)||!e.autoPlayback||e.isLive||t.add(Me),!h(t.art)&&e.autoOrientation&&E&&t.add(Le),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(Pe)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){G(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const o=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let n=o;const a=lt(t,n);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${o}`;return h(t.art)||(G(!a,i),("object"===typeof o&&null!==o||"function"===typeof o)&&(n=Reflect.ownKeys({[n]:void 0})[0]),h(t.art)||it(t,n,{value:r})),t}(this,t,e)}}const Ie=new WeakMap;function _e(t){return!t.closed&&!Ie.get(t)}function Ve(t){Ie.set(t,(Ie.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Ie.get(t)||1)-1;r?Ie.set(t,r):Ie.delete(t)}}const Ne=new WeakMap,De=new WeakMap,We=["$parent","$parents","$option","$events","$formatted"];function Ye(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=Ne.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(Ne.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function Fe(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function Be(t){const e=Ne.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function He(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Ze(t,n)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(n.push(...a.splice(0)),Ke.set(r,n),Xe.set(e,r),Ge.set(e,o)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function rr(t,e,r,o,n,a){const i=a||Qe(e);if(!_e(i)||h(t))return;const s=t.proxy(r,o,e=>{if(_e(i)&&!h(t))try{return n(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!_e(i)||h(t)?t.events.remove(s):(Be(e).events.push(s),a&&a!==Xe.get(e)&&a.add(()=>{const r=Be(e).events,o=r.indexOf(s);o>=0&&(r.splice(o,1),t.events.remove(s))}))}function or(t,e,r,o){const n=Qe(e);if(!_e(n)||h(t))return;const a=(...e)=>{if(_e(n)&&!h(t))return o(...e)};t.on(r,a),n.add(()=>{t.off(r,a)})}function nr(t){const{art:e,active:r}=t,{controls:o,constructor:{SETTING_WIDTH:n,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!o.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=o.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:o,rows:n,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,o),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,n*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||n,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const ar=new WeakMap;function ir(t){ar.delete(t)}const sr=new WeakMap;function lr(t,e){e?sr.set(t,e):sr.delete(t)}function cr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],o=sr.get(t),n=o?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,o]of e)Object.defineProperty(t,r,o);n?.(),lr(t,o);for(const{node:t,parent:e,next:o}of r)e?e.insertBefore(t,o?.parentNode===e?o:null):t.parentNode?.removeChild(t)}}const dr=new WeakMap;async function pr(t,e,r,o,n,a,i,s){try{const l=Qe(e),c=Qe(a),d=(dr.get(a)||0)+1;dr.set(a,d);const p=()=>_e(l)&&_e(c)&&!h(t.art)&&dr.get(a)===d;if(s?.(),!p())return;const u=await n.call(t.art,e,r,o);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function ur(t){const e=[];return function t(r){const o=Array.from(r.childNodes);e.push({node:r,children:o,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),o.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:o,value:n}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(o){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of o)e.setAttribute(t,r)}else t.nodeValue=n}}}const hr=new WeakMap;function fr(t){const e=[];for(const o of t)try{o()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function mr(t){hr.get(t)?.()}function gr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);ir(r),mr(r);const o=cr(r),n=r.$item,a=n?.parentNode,i=n?.nextSibling,s=n?ur(n):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,o=new Set,n=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&o.add(r),e.selector.forEach(n)}};n(e);const a=[],i=[];try{for(const e of r){const r=er(t.art,e);r&&a.push(r)}for(const t of o)i.push(Ve(qe(t)))}catch(l){try{fr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,fr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,fr([...a.reverse().map(t=>t.dispose),...Array.from(o).reverse().map(t=>()=>Ue(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{fr([d.resume,()=>{e&&e!==n&&e.remove()},o,()=>s?.(),()=>{a&&n&&a.insertBefore(n,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&_(t.cache.get(l),"art-current");for(const[e,r,o]of c)t.$parent.style.setProperty(e,r,o)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&hr.get(r)===m;for(const u of d.items)hr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);d.dispose()});try{if(function(t,e,r){for(const o of Reflect.ownKeys(e)){if(!r())return;const n=Object.getOwnPropertyDescriptor(e,o);if(!n?.enumerable||!r())continue;const a=Reflect.get(e,o);if(!r())return;if(!Reflect.set(t,o,a))throw new TypeError(`Cannot assign setting item property [${String(o)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)hr.get(t)===m&&hr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const vr=new WeakMap;function yr(t,e,r){it(t,`$${e}`,{configurable:!0,get:()=>r}),it(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function br(t,e,r=!1){const o=function(t){const e=hr.get(t);return()=>!e||hr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const n=t.cache.get(e.$option),a=e.$item;let i="selector";lt(e,"switch")&&(i="switch"),lt(e,"range")&&(i="range"),lt(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!o())return;const c=function(t,e,r=u(t)){const o=Xe.get(e);(!o||_e(o)||o.closed)&&tr(t,e);const n=r.child();return Xe.set(e,n),Ge.set(e,r),Ke.set(n,Be(e).events),n.add(()=>{Ze(t,Ke.get(n))}),n}(t.art,e,qe(n)),d=()=>_e(c)&&!h(t.art)&&o();if(!d())return;const p=document.createElement("div");try{if(lr(e),L(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const o=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(L(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(o,f),!d())return;yr(e,"icon",f);const m=document.createElement("div");L(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(o,m),yr(e,"html",m);const v=document.createElement("div");L(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),yr(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");L(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),o=A(t,s.switchOff),n=e.switch;if(!d())return;R(n?o:r,"display","none"),A(u,t),it(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;lr(e,()=>{const t=a;return()=>{a=t}}),it(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(o,"display","none"),R(r,"display",null)):(R(o,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");L(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[n,a]of["value","min","max","step"].entries()){const t=e.range[n];if(!d())return;Reflect.set(r,a,String(t))}L(r,"art-setting-range"),A(u,t),it(e,"$range",{configurable:!0,get:()=>r});let o=[...e.range];if(!d())return;lr(e,()=>{const t=o,e=[...t],n={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),o=t,Object.assign(r,n)}}),it(e,"range",{configurable:!0,get:()=>o,set(t){o=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");L(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,o){const{art:n}=t,a=Qe(e),i=(t,r,o)=>rr(n,e,t,r,o,a);switch(o){case"switch":e.onSwitch&&i(r,"click",o=>pr(t,e,r,o,e.onSwitch,e,"switch"));break;case"range":{const o=e.$range;if(o)for(const[n,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(o,n,n=>pr(t,e,r,n,e[a],e,"tooltip",()=>{e.range[0]=o.valueAsNumber}));break}case"selector":i(r,"click",o=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return pr(t,e,r,o,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&L(r,"art-current");break;case"button":e.onClick&&i(r,"click",o=>pr(t,e,r,o,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;it(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(n,p),e.mounted&&d()&&Mt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function wr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!_e(qe(r)))return;const o=(vr.get(t)||0)+1;vr.set(t,o);const n=()=>vr.get(t)===o&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&_(t.cache.get(a),"art-current");for(const[e,r,o]of i)t.$parent.style.setProperty(e,r,o)};if(t.active=e,r)try{_(r,"art-current"),t.resize()}catch(l){throw n()&&t.cache.get(e)===r&&!qe(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const o=function(t,e,r){const o=u(t.art).child();return je.set(r,o),o.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),o}(t,e,r),a=()=>!o.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;L(r,"art-setting-panel"),A(t.$parent,r),_(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=De.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),o=(t,o)=>{if(r.closed||h(e))return;const n=(...t)=>{if(!r.closed&&!h(e))return o(...t)};e.on(t,n),r.add(()=>{e.off(t,n)})};o("blur",()=>{t.show&&(t.show=!1,t.render())}),o("focus",r=>{const o=D(r,e.controls.setting),n=D(r,t.$parent);!t.show||o||n||(t.show=!1,t.render())}),o("resize",()=>t.resize());const n=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&n()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(n);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(n);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,PLAYBACK_RATE:n}}=t;function a(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:o,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:n.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,ASPECT_RATIO:n}}=t;function a(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:o,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:n.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:o,FLIP:n}}=t;function a(t){return e.get(tt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:o,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:n.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),or(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:o}=t;return{width:o.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)=>{or(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){He(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&_(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,o=[]){this.option=function(t,e,r,o,n=[]){const a=De.get(t)||{active:!0},i=[],s=new Set,l=new Set(n),c=(t,e,r)=>{for(let o=0;oBe(t).parent},$parents:{get:()=>Be(t).parents},$option:{get:()=>Be(t).option},$events:{get:()=>Be(t).events},$formatted:{get:()=>!0}}),Ne.set(t,{parent:r,parents:o,option:n,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||n.push(p.name);return t.id=d,e}(this,t,e,r,o)}find(t=""){return function(t,e=""){let r=null;return He(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){nr(this)}inactivate(t){!function(t,e){const r=[],o=new Set,n=e=>{if(!o.has(e)){o.add(e);for(const t of e.selector||[])n(t);if(e.selector){const o=t.cache.get(e.selector);t.cache.delete(e.selector);try{o&&Ue(o)}catch(a){r.push(a)}}try{tr(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(n(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);G(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{ir(t),mr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const o=e.$item,n=[];for(const i of[()=>this.inactivate(e),()=>o?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?n.push(...a.errors):n.push(a)}if(n.length)throw new s(n)}update(t){return gr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const o=e.length,n=r?void 0:function(t){const e={};ar.set(t,e);const r=()=>ar.get(t)===e;return{current:r,finish(){r()&&ar.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||n&&!n.current())throw i;if(e[o]===t&&e.splice(o,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{n?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:o},constructor:{SETTING_ITEM_HEIGHT:n}}=t.art,a=document.createElement("div");R(a,"height",`${n}px`),L(a,"art-setting-item"),L(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");L(s,"art-setting-item-left-icon"),A(s,o),A(i,s),A(i,e.$parent.html),rr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),qe(r)),A(r,a)}(this,t)}createItem(t,e=!1){br(this,t,e)}render(t=this.option){wr(this,t)}}class $r{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const Er='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class Tr{constructor(t){this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope)?.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}async run(t){if(this.active)try{return await Promise.race([t(),this.cancelled])}finally{this.cancel()}}}const Cr=new WeakMap;function Sr(t){return Cr.get(t)}function zr(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const Lr=zt;class Mr extends Lr{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=u(e).child(),o={scope:r,revision:0,render:0,trackRevision:0};return Cr.set(t,o),r.add(()=>{zr(o)}),o}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const o=()=>{if(e.scope.closed||!this.url)return;const o=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof o&&o!==r&&(r=o,this.createTrack(o?"subtitles":"metadata",this.url))};t.on("video:timeupdate",o),e.scope.add(()=>{t.off("video:timeupdate",o)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return Array.from(this.textTrack?.activeCues||[])}get cues(){return Array.from(this.textTrack?.cues||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?O(r,t):R(r,t,e)}update(){!function(t){const e=Sr(t);if(e.scope.closed)return;const r=e.revision,o=++e.render,n=()=>!e.scope.closed&&e.revision===r&&e.render===o,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!n())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?at(t):t}\n
`).join("")).join("");n()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}async switch(t,e={}){const{i18n:r,notice:o,option:n}=this.art,a={...n.subtitle,...e,url:t},i=Sr(this),s=i.revision+1,l=await this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(o.show=`${r.get("Switch Subtitle")}: ${e.name}`),l}createTrack(t,e){!function(t,e,r){const o=Sr(t);if(o.scope.closed)return;const n=++o.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=o.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||o.trackRevision!==n)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||o.trackRevision!==n)return p.dispose(),void d.remove();const h=o.track;o.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{h?.dispose()}finally{o.ownedURL&&o.ownedURL!==r&&zr(o)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),o.scope.closed||o.trackRevision!==n)throw h;throw i.$track=s,l&&l.insertBefore(s,c?.parentNode===l?c:null),h}}(this,t,e)}async init(t){const e=Sr(this),r=function(t){const e=t.request,r=new Tr(t.scope);return t.request=r,t.revision+=1,e?.cancel(),r}(e),{notice:o,template:{$subtitle:a}}=this.art;return r.run(async()=>{if(!this.textTrack)return null;if(n(t,Ct.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const o=await fetch(t.url,{signal:r.signal});if(!r.active)return;if(!o.ok)throw new Error(`Failed to load subtitle: ${o.status} ${o.statusText}`);const n=await o.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||Z(e.url)){case"srt":return{vtt:e.onVttLoad(pt(r))};case"ass":return{vtt:e.onVttLoad(ht(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(n,t);if(!r.active)return;const l=void 0===s?t.url:i=ut(s.vtt);if(!r.active)return;a.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(s){if(!r.active)return;throw a.innerHTML="",o.show=s,s}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}})}}const Pr=`\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
${a}
\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 `;class Ar{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=S(e.container),G(this.$container,`No container element found by ${e.container}`)),G(B(),"The current browser does not support flex layout");const o=this.$container.tagName.toLowerCase();G("div"===o,`Unsupported container element type, only support 'div' but got '${o}'`),G(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const o=d.get(e);if(o&&o!==t)throw new Error("Cannot mount multiple instances on the same dom element");const n=p(t);n.rollback=r,d.set(e,t),n.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,ur(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Pr}query(t){return S(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=Ar.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){G(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),W(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&L(this.$player,"art-backdrop"),E&&L(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":L(this.$player,"art-destroy")}}const Rr=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Or{on(t,e,r){const o=this.e||(this.e={});let n=Rr(o,t)?o[t]:void 0;return n||(n=[],Object.defineProperty(o,t,{value:n,enumerable:!0,configurable:!0,writable:!0})),n.push({fn:e,ctx:r}),this}once(t,e,r){const o=this,n=e;let a=!1;function i(...e){a||(a=!0,o.off(t,i),n.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),o=(Rr(r,t)&&r[t]||[]).slice();for(const n of o)n.fn.apply(n.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),o=Rr(r,t)?r[t]:void 0,n=[];if(o&&e)for(let a=0,i=o.length;ae.call(this,this)),Vr.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Vr.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&_r.push(this)}catch(o){try{f(this,_r,!0,Vr.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw o}}static get instances(){return _r}static get version(){return a}static get config(){return i}static get utils(){return mt}static get scheme(){return Ct}static get Emitter(){return Or}static get validator(){return n}static get kindOf(){return n.kindOf}static get html(){return Ar.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:x?"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){f(this,_r,t,Vr.REMOVE_SRC_WHEN_DESTROY)}}return Vr.STYLE=Er,Vr.DEBUG=!1,Vr.CONTEXTMENU=!0,Vr.NOTICE_TIME=2e3,Vr.SETTING_WIDTH=250,Vr.SETTING_ITEM_WIDTH=200,Vr.SETTING_ITEM_HEIGHT=35,Vr.RESIZE_TIME=200,Vr.SCROLL_TIME=200,Vr.SCROLL_GAP=50,Vr.AUTO_PLAYBACK_MAX=10,Vr.AUTO_PLAYBACK_MIN=5,Vr.AUTO_PLAYBACK_TIMEOUT=3e3,Vr.RECONNECT_TIME_MAX=5,Vr.RECONNECT_SLEEP_TIME=1e3,Vr.CONTROL_HIDE_TIME=3e3,Vr.DBCLICK_TIME=300,Vr.DBCLICK_FULLSCREEN=!0,Vr.MOBILE_DBCLICK_PLAY=!0,Vr.MOBILE_CLICK_PLAY=!1,Vr.AUTO_ORIENTATION_TIME=200,Vr.INFO_LOOP_TIME=1e3,Vr.FAST_FORWARD_VALUE=3,Vr.FAST_FORWARD_TIME=1e3,Vr.TOUCH_MOVE_RATIO=.5,Vr.VOLUME_STEP=.1,Vr.SEEK_STEP=5,Vr.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Vr.ASPECT_RATIO=["default","4:3","16:9"],Vr.FLIP=["normal","horizontal","vertical"],Vr.FULLSCREEN_WEB_IN_BODY=!0,Vr.LOG_VERSION=!0,Vr.USE_RAF=!1,Vr.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=Vr,C("artplayer-style",Er),setTimeout(()=>{Vr.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Vr.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Vr}); +!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 n=(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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new l,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof s?t.push(...e.errors):t.push(e)}if(t.length)throw new s(t)}}const c=new WeakMap,d=new WeakMap;function p(t){const e=c.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function u(t){return p(t).scope}function h(t){const e=p(t);return e.destroying||e.scope.closed}function f(t,e,r,n,o=!1){const a=p(t);if(a.destroying||a.scope.closed)return;a.destroying=!0;const i=[],l=t=>{try{t()}catch(e){i.push(...e instanceof s?e.errors:[e])}};n&&t.template?.$video&&l(()=>t.reset()),l(()=>a.scope.dispose()),l(()=>t.template?.destroy(r));const c=e.indexOf(t);-1!==c&&e.splice(c,1),t.isDestroy=!0,o||(a.releaseContainer?.(),a.releaseContainer=void 0),l(()=>t.emit("destroy")),o&&a.rollback&&l(a.rollback),a.rollback=void 0,a.releaseContainer?.(),a.releaseContainer=void 0;for(const s of i.slice(1))console.warn("Additional ArtPlayer cleanup failure:",s);if(i.length)throw i[0]}const m=new WeakMap;function g(t,e){const r=u(t).child();return m.set(e,r),r}function v(t){const e=m.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function y(t){m.get(t)?.dispose()}function b(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=v(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=v(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const w=globalThis?.CUSTOM_USER_AGENT??("undefined"!==typeof navigator?navigator.userAgent:""),x=/^(?:(?!chrome|android).)*safari/i.test(w),k=/iPad|iPhone|iPod/i.test(w)&&!window.MSStream,$=k||w.includes("Macintosh")&&navigator.maxTouchPoints>=1,E=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(w)||$,T="undefined"!==typeof window&&"undefined"!==typeof document;function C(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 L(t,e=document){return e.querySelector(t)}function S(t,e=document){return Array.from(e.querySelectorAll(t))}function P(t,e){return t.classList.add(e)}function M(t,e){return t.classList.remove(e)}function z(t,e){return t.classList.contains(e)}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function R(t,e,r){return t.style[e]=r,t}function O(t,e){for(const r in e)R(t,r,e[r]);return t}function I(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function _(t,e){I(t).forEach(t=>M(t,e)),P(t,e)}function N(t,e,r="top"){E||(t.setAttribute("aria-label",e),P(t,"hint--rounded"),P(t,`hint--${r}`))}function D(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function W(t,e){return q(t).includes(e)}function F(t,e){return e.parentNode.replaceChild(t,e),t}function V(t){return document.createElement(t)}function Y(t="",e=""){const r=V("i");return P(r,"art-icon"),P(r,`art-icon-${t}`),A(r,e),r}function B(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function H(t){return t.getBoundingClientRect()}function j(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function q(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}function U(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class X extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function G(t,e){if(!t)throw new X(e);return t}function K(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function Z(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function J(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function Q(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function tt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function et(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const rt={"&":"&","<":"<",">":">","'":"'",'"':"""},nt={"&":"&","<":"<",">":">","'":"'",""":'"'},ot=/(&|<|>|'|")/g;function at(t){return t.replace(/[&<>'"]/g,t=>rt[t]||t)}const it=Object.defineProperty,{hasOwnProperty:st}=Object.prototype;function lt(t,e){return st.call(t,e)}function ct(t,e){return Object.getOwnPropertyDescriptor(t,e)}function dt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?dt(o,a):a,it(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function pt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 ut(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function ht(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 ft(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const mt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:X,addClass:P,append:A,assToVtt:ht,capitalize:tt,clamp:Q,createElement:V,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:it,download:J,errorHandle:G,escape:at,get:ct,getComposedPath:q,getExt:Z,getIcon:Y,getRect:H,getSafeAreaInsets:U,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:lt,hasClass:z,includeFromEvent:W,inverseClass:_,isBrowser:T,isIOS:k,isIOS13:$,isInViewport:D,isMobile:E,isSafari:x,loadImg:j,mergeDeep:dt,query:L,queryAll:S,remove:function(t){return t.parentNode.removeChild(t)},removeClass:M,replaceElement:F,secondToTime:et,setStyle:R,setStyleText:C,setStyles:O,siblings:I,silencePromise:K,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:pt,supportsFlex:B,throttle:ft,tooltip:N,unescape:function(t){return t.replace(ot,t=>nt[t]||t)},userAgent:w,vttToBlob:ut},Symbol.toStringTag,{value:"Module"}));function gt(t,e){return A(t,e)}function vt(t,e){return e.querySelector(t)}const yt="array",bt="boolean",wt="string",xt="number",kt="object",$t="function";function Et(t,e,r){return G(e===wt||e===xt||t instanceof Element,`${r.join(".")} require '${wt}' or 'Element' type`)}const Tt={html:Et,disable:`?${bt}`,name:`?${wt}`,index:`?${xt}`,style:`?${kt}`,click:`?${$t}`,mounted:`?${$t}`,tooltip:`?${wt}|${xt}`,width:`?${xt}`,selector:`?${yt}`,onSelect:`?${$t}`,switch:`?${bt}`,onSwitch:`?${$t}`,range:`?${yt}`,onRange:`?${$t}`,onChange:`?${$t}`},Ct={id:wt,container:Et,url:wt,poster:wt,type:wt,theme:wt,lang:wt,volume:xt,isLive:bt,muted:bt,autoplay:bt,autoSize:bt,autoMini:bt,loop:bt,flip:bt,playbackRate:bt,aspectRatio:bt,screenshot:bt,setting:bt,hotkey:bt,pip:bt,mutex:bt,backdrop:bt,fullscreen:bt,fullscreenWeb:bt,subtitleOffset:bt,miniProgressBar:bt,useSSR:bt,playsInline:bt,lock:bt,gesture:bt,fastForward:bt,autoPlayback:bt,autoOrientation:bt,airplay:bt,proxy:`?${$t}`,plugins:[$t],layers:[Tt],contextmenu:[Tt],settings:[Tt],controls:[{...Tt,position:(t,e,r)=>{const n=["top","left","right"];return G("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}}],quality:[{default:`?${bt}`,html:wt,url:wt}],highlight:[{time:xt,text:wt}],thumbnails:{url:wt,number:xt,column:xt,width:xt,height:xt,scale:xt},subtitle:{url:wt,name:wt,type:wt,style:kt,escape:bt,encoding:wt,onVttLoad:$t},moreVideoAttr:kt,i18n:kt,icons:kt,cssVar:kt,customType:kt},Lt=new WeakSet;class St{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 z(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?P(e,r):M(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t;if(h(this.art))return;if(e.html=e.html||"",o(e,Tt),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`,n=this.cache;G(!n.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=g(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,r);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){P(t,`art-${r}`),P(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):A(e,t),a.html&&A(t,a.html),a.style&&O(t,a.style),a.tooltip&&N(t,a.tooltip)}(a,this.$parent,this.name,r,this.id,e),i.closed)return;if(e.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),e.click.call(this.art,this,t))});s.push(t)}if(e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,r,a),c=!0,n.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}catch(d){try{y(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw n.get(r)?.$ref===a&&n.delete(r),c&&this[r]===a&&(l?Object.defineProperty(this,r,l):delete this[r]),a.remove(),d}}remove(t){G(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Lt.has(e)){Lt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{y(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Lt.delete(e)}}}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 St{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,g(t,this.$parent),E||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=b(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="1"]',t);n&&_(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).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:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="default"]',t);n&&_(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).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:n}}=e,o=n.map(t=>`${r.get(tt(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=b(e,t),n=L('[data-value="normal"]',t);n&&_(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).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){return{...t,html:`ArtPlayer ${a}`}}({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 a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=H(e),{height:c,width:d}=H(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),O(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{W(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Mt(t,e,r,n,o={}){const{capture:a=!1,once:i=!1,signal:s}=o;if(t.closed||s?.aborted)return()=>{};let l=()=>{};function c(e){i&&l(),t.closed||("function"===typeof n?n.call(this,e):n.handleEvent(e))}return e.addEventListener(r,c,o),l=t.add(()=>{try{e.removeEventListener(r,c,a)}finally{s?.removeEventListener("abort",l)}}),s?.addEventListener("abort",l,{once:!0}),l}function zt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function At(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function Rt(t,e){const{$progress:r}=t.template,{left:n}=H(r),o=Q((E?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:et(a),width:o,percentage:Q(o/r.clientWidth,0,1)}}function Ot(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Rt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function It(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=v(e),{on:i}=b(t,e);let s=()=>{};const l=vt(".art-progress-hover",e),c=vt(".art-progress-loaded",e),d=vt(".art-progress-played",e),p=vt(".art-progress-highlight",e),u=vt(".art-progress-indicator",e),h=vt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||Rt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?R(h,"left",0):o>e.clientWidth-i/2?R(h,"left",e.clientWidth-i+"px"):R(h,"left",o-i/2+"px")}r.indicator?A(u,r.indicator):R(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&E;if("loaded"===r&&R(c,"width",100*n+"%"),"hover"===r&&(R(l,"width",100*n+"%"),W(i,p)?function(r){const{width:n}=Rt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=o??"";const a=h.clientWidth;n<=a/2?R(h,"left",0):n>e.clientWidth-a/2?R(h,"left",e.clientWidth-a+"px"):R(h,"left",n-a/2+"px")}(i):f(i),0===n?M(o,"art-progress-hover"):P(o,"art-progress-hover")),"played"===r&&(R(d,"width",100*n+"%"),R(u,"left",100*n+"%")),m){P(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:et(n*t.duration)}),s(),s=zt(a,()=>{M(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function _t(t){return e=>({...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{It(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=b(t,e);if(!E){let e=!1;a(r,"click",e=>{e.target!==n&&Ot(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=Rt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Rt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Nt(t){const{option:e}=t.art;e.isLive||t.add(_t({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.play),s=gt(t,o.pause);function l(){R(i,"display","flex"),R(s,"display","none")}function c(){R(i,"display","none"),R(s,"display","flex")}N(i,a.get("Play")),N(s,a.get("Pause")),n(i,"click",()=>{K(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>({...t,mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o}=e,a=gt(t,o.volume),i=gt(t,o.volumeClose),s=gt(t,'
'),l=gt(s,'
'),c=gt(l,'
'),d=gt(l,'
'),p=gt(d,'
'),u=gt(p,'
'),h=gt(d,'
');function f(t){const{top:e,height:r}=H(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)R(a,"display","none"),R(i,"display","flex"),R(h,"top","100%"),R(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;R(a,"display","flex"),R(i,"display","none"),R(h,"top",100-t+"%"),R(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),E)R(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>({...t,style:E?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=b(e,t);function n(){const r=`${et(e.currentTime)} / ${et(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!u(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!E&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=b(e,t),{icons:n}=e;gt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e;gt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{N(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e;gt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{N(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=b(e,t),{icons:n}=e;gt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.fullscreenWebOn),s=gt(t,o.fullscreenWebOff);R(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(N(t,a.get("Exit Web Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Web Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=b(e,t),{icons:o,i18n:a}=e,i=gt(t,o.fullscreenOn),s=gt(t,o.fullscreenOff);R(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(N(t,a.get("Exit Fullscreen")),R(i,"display","none"),R(s,"display","inline-flex")):(N(t,a.get("Fullscreen")),R(i,"display","inline-flex"),R(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rWt.get(t).option.selector}),it(t,"$control_item",{get:()=>Wt.get(t).item}),it(t,"$control_value",{get:()=>Wt.get(t).value})),Wt.set(t,e)}function Vt(t,e){t.innerHTML=e}function Yt(t,e,r,n,o){const{proxy:a}=t.events,i=v(n),s=r.selector;P(n,"art-control-selector");const l=document.createElement("div");P(l,"art-selector-value"),A(l,r.html),n.textContent="",A(n,l);const c=gt(n,'
');for(let u=0;u{if(i.closed)return;const o=q(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++d,c=()=>!i.closed&&s===d,p=i.add(function(t,e){return Dt.set(t,e),()=>{Dt.get(t)===e&&Dt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=await r.onSelect.call(t,a,a.$control_item,n);c()&&Vt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{p()}});o.push(p)}class Bt extends St{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;g(t,n);const{on:o}=b(t,n);o("mousemove",()=>{E||(this.show=!0)}),o("click",()=>{E?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=W(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(M(r,"art-hide-cursor"),P(r,"art-hover"),this.timer=Date.now()):(P(r,"art-hide-cursor"),M(r,"art-hover"))}),this.init(),u(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=v(e),{on:a}=b(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Nt(this)}add(t){if(h(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:G(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Vt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function Ht(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function jt(t){if(t.constructor.USE_RAF){const e=u(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const qt=new WeakMap;class Ut{constructor(t){this.destroyEvents=new Set;const e=u(t);qt.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){W(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),E?!t.isLock&&o&&K(t.toggle()):K(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),E?!t.isLock&&s&&K(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=>{P(r,"art-hover"),t.emit("hover",!0,e)},e=>{M(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=u(t);let a=()=>{};const i=()=>{a(),a=zt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(E&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Ot(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=Ht(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=Q((n-i)/t.width,-1,1),d=Q((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=Q(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",Q(h/t.duration,0,1),e),t.notice.show=`${et(h)} / ${et(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=ft(()=>{t.emit("view",D(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{const n=a.window||i.ownerDocument?.defaultView||window,s=e.proxy(n,r,e=>{t.emit(`window:${r}`,e)});o.push(s)})}a(),e.bindGlobalEvents=a}(t,this),jt(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(qt.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 Xt{constructor(t){this.art=t,this.keys={},E||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",()=>{K(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class Jt{constructor(t){const e={...Zt,...t.option.icons};for(const r in e)it(this,r,{get:()=>Y(r,e[r])})}}class Qt extends St{constructor(t){super(t),this.name="info",E||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=S("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=u(this.art);!function t(){for(let e=0;e{R(o,"display","none"),R(a,"display",null)}),n.proxy(e.$state,"click",()=>K(t.play()))}}class ne{constructor(t){this.art=t,this.timer=null,u(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if(u(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,P(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",M(r,"art-notice-show")},e.NOTICE_TIME)):M(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function oe({width:t,height:e}){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0}function ae(t,e){if(!oe(t)||!Number.isFinite(e)||e<=0)return;const r=t.width/t.height>e?{width:e*t.height,height:t.height,axis:"width"}:{width:t.width,height:t.width/e,axis:"height"};return oe(r)?r:void 0}function ie(t){const{$container:e,$video:r}=t.template;it(t,"autoHeight",{value(){if(h(t))return;const n=function(t,e){if(!Number.isFinite(t)||t<=0||!oe(e))return;const r=e.height*(t/e.width);return Number.isFinite(r)&&r>0?r:void 0}(e.clientWidth,{width:r.videoWidth,height:r.videoHeight});void 0===n||h(t)||(e.style.height=`${n}px`,t.emit("autoHeight",n))}})}function se(t,e,r,n=!1){const o=e=>{h(t)||r(e)};t[n?"once":"on"](e,o),u(t).add(()=>{t.off(e,o)})}function le(t,e,r){for(const[n,o]of e){if(h(t)||r&&!r())return;t[n].show=o}}const ce=new WeakMap,de=new WeakMap,pe=new WeakMap;function ue(t){return pe.get(t)||u(t)}function he(t){const e=ce.get(t),r=pe.get(t);return()=>ce.get(t)===e&&(!e||e.active())&&pe.get(t)===r&&(!r||!r.closed)}function fe(t){const e=pe.get(t),r=u(t).child(),n=r.child();pe.set(t,r),r.add(()=>{pe.get(t)===r&&pe.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!h(t)&&!n.closed&&ce.get(t)===o};return ce.set(t,o),n.add(()=>{ce.get(t)===o&&ce.delete(t),o.onAssigned=void 0,o.onError=void 0}),e?.dispose(),o}function me(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&e?.()}function ge(t,e,r){de.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{de.get(t)===e&&(de.delete(t),me(e))}}function ve(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function ye(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=ue(t),l=0;return{reset(){l=0,i?.dispose(),M(a,"art-error")},loadStart(){M(a,"art-error")},schedule(c){(async c=>{if(h(t))return;const d=ue(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!h(t)&&!p.closed&&d===ue(t),f=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function be(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{h(t)||t.emit(`video:${e.type}`,e)})}(t);const e=ye(t);!function(t,e){se(t,"video:canplay",()=>{e.reset(),le(t,[["loading",!1]])}),se(t,"video:canplay",()=>{le(t,[["loading",!1],["controls",!0],["mask",!0]]),h(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;se(t,"video:ended",()=>{if(e.loop){const e=he(t);if(t.seek=0,h(t)||!e())return;K(t.play()),e()&&le(t,[["controls",!1],["mask",!1]],e)}else le(t,[["controls",!0],["mask",!0]])})}(t),se(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;se(t,"video:loadedmetadata",()=>{t.emit("resize"),E&&le(t,[["loading",!1],["controls",!0],["mask",!0]])}),se(t,"video:loadstart",()=>{e.loadStart(),le(t,[["loading",!0],["mask",!1],["controls",!0]])}),se(t,"video:pause",()=>{le(t,[["controls",!0],["mask",!0]])}),se(t,"video:play",()=>{le(t,[["mask",!1]]),h(t)||R(r,"display","none")}),se(t,"video:playing",()=>le(t,[["mask",!1]])),se(t,"video:progress",()=>{t.playing&&le(t,[["loading",!1]])}),se(t,"video:seeked",()=>le(t,[["loading",!1],["mask",!0]])),se(t,"video:seeking",()=>le(t,[["loading",!0],["mask",!1]])),se(t,"video:timeupdate",()=>le(t,[["mask",!1]])),se(t,"video:waiting",()=>le(t,[["loading",!0],["mask",!1]]))}(t,e)}const we=[["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"]],xe=(()=>{if("undefined"===typeof document)return!1;const t=we[0],e={};for(const r of we){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),ke={change:xe.fullscreenchange,error:xe.fullscreenerror},$e={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{$e.off("change",o),r()};$e.on("change",o);const a=t[xe.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!$e.isFullscreen)return void t();const r=()=>{$e.off("change",r),t()};$e.on("change",r);const n=document[xe.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>$e.isFullscreen?$e.exit():$e.request(t,e),onchange(t){$e.on("change",t)},onerror(t){$e.on("error",t)},on(t,e){const r=ke[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=ke[t];r&&document.removeEventListener(r,e,!1)},raw:xe};function Ee(t,e,...r){const n=Reflect.get(t,e);if("function"!==typeof n)throw new TypeError(`Fullscreen method ${e} is not available`);return n.apply(t,r)}Object.defineProperties($e,{isFullscreen:{get:()=>Boolean(document[xe.fullscreenElement])},element:{enumerable:!0,get:()=>document[xe.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[xe.fullscreenEnabled])}});const Te=new WeakMap;function Ce(t){try{Promise.resolve(t()).catch(()=>{})}catch{}}function Le(t){const{document:e,elementProperty:r,changeEvent:n,target:o,exit:a}=t,i=function(t,e,r){let n=Te.get(t);if(!n){n=new WeakMap,Te.set(t,n);const o=n;t.addEventListener(r,()=>{const r=Reflect.get(t,e),n=r&&o.get(r);n&&(o.delete(r),Ce(n))})}return n}(e,r,n);i.set(o,a),t.element===o&&(i.delete(o),Ce(a))}function Se(t,e,r,n,o=()=>t.element!==t.target){const a=e.child();let i,s,l=!1,c=!1,d=!1,p=!1,u=!1;const h=new Promise((t,e)=>{i=t,s=e});function f(t=!1,e){if(!l){l=!0;try{a.dispose()}catch(r){t||(t=!0,e=r)}t?s(e):i()}}a.add(()=>{l||(l=!0,c=!0,i(),d&&!p&&r&&Le(t))});const m=()=>{d&&!p&&(r?t.element===t.target:o())&&f()};if(Mt(a,t.document,t.changeEvent,m),Mt(a,t.document,t.errorEvent,e=>{e.target!==t.target&&e.target!==t.document||(u=!0,d&&!p&&f(!0,new Error("Fullscreen request failed")))}),!a.closed)try{r&&function(t){Te.get(t.document)?.delete(t.target)}(t);const e=r?t.request():t.exit();p=Boolean(e&&"function"===typeof e.then),d=!0,c&&!p&&r&&Le(t),p?Promise.resolve(e).then(()=>{c?n():f()},t=>f(!0,t)).catch(()=>{}):u?f(!0,new Error("Fullscreen request failed")):m()}catch(g){f(!0,g)}return{promise:h,cancel:()=>a.dispose()}}function Pe(t,e){const r=u(t).child(),{$player:n,$video:o}=t.template,a=()=>e.element===n||e.element===o;let i,s=a(),l=0,c=s,d=!1,p=!1,f=!1;function m(){if(a())try{Promise.resolve(e.exit()).catch(()=>{})}catch{}}return r.add(()=>{l+=1,c=!1,n.classList.remove("art-fullscreen"),m()}),Mt(r,e.document,e.changeEvent,()=>{const r=a();if(r&&function(t){return Te.get(t.document)?.has(t.target)??!1}(e))return;if(r&&p)return void m();if(r===s||h(t))return;s=r;const o=l,i=()=>h(t)||a()!==r||o!==l&&c!==r;t.emit("fullscreen",r),i()||(r&&(t.state="fullscreen"),i()||(n.classList.toggle("art-fullscreen",r),t.emit("resize")))}),Mt(r,e.document,e.errorEvent,r=>{(r.target===n||r.target===o||r.target===e.document&&(f||void 0!==i||a()))&&!h(t)&&t.emit("fullscreenError",r)}),{get:()=>!h(t)&&a(),set(n){if(h(t))return Promise.resolve();const o=++l;if(c=Boolean(n),c?p=!1:d&&(p=!0),i?.cancel(),i=void 0,d=!1,!c&&!a())return Promise.resolve();f=!0,d=c;const s=Se(e,r,c,()=>{!h(t)&&c||m()},()=>!a());f=!1,l===o?i=s:s.cancel();const u=s.promise.catch(e=>{throw h(t)||l!==o||(t.notice.show=e),e}).finally(()=>{l===o&&(i=void 0,d=!1)});return u.catch(()=>{}),u}}}const Me=new WeakSet;function ze(t,e=!1){return"string"===typeof t.webkitPresentationMode?"fullscreen"===t.webkitPresentationMode:"boolean"===typeof t.webkitDisplayingFullscreen?t.webkitDisplayingFullscreen:t.ownerDocument.fullscreenElement===t||e}function Ae(t){Me.delete(t),t.removeEventListener("webkitbeginfullscreen",Re),t.removeEventListener("webkitpresentationmodechanged",Re)}function Re(t){if(Me.has(this)&&ze(this,"webkitbeginfullscreen"===t.type)){Ae(this);try{this.webkitExitFullscreen?.()}catch{}}}function Oe(t){Me.add(t),t.addEventListener("webkitbeginfullscreen",Re),t.addEventListener("webkitpresentationmodechanged",Re)}function Ie(t){const{$video:e}=t.template,r=u(t).child();let n=!1,o=ze(e),a=o,i=!1,s=0;const l=()=>ze(e,n);function c(r){if(h(t)||(c=e,Me.has(c)))return;var c;"boolean"===typeof r&&(n=r);const d=l();if(d&&(i=!1),d===o)return;o=d;const p=s,u=()=>h(t)||l()!==d||p!==s&&a!==d;t.emit("fullscreen",d),u()||(d&&(t.state="fullscreen"),u()||t.emit("resize"))}r.add(()=>{s++,a=!1,i&&Oe(e),l()&&e.webkitExitFullscreen?.()}),Mt(r,e,"webkitbeginfullscreen",()=>c(!0)),Mt(r,e,"webkitendfullscreen",()=>c(!1)),Mt(r,e,"webkitpresentationmodechanged",()=>c());const d=()=>c();return t.on("document:webkitfullscreenchange",d),r.add(()=>{t.off("document:webkitfullscreenchange",d)}),{get:()=>!h(t)&&l(),set(r){if(h(t))return;const n=++s;if(a=Boolean(r),r){if(Ae(e),t.state="fullscreen",h(t)||n!==s)return;i=!0;try{e.webkitEnterFullscreen()}catch(o){throw n===s&&(i=!1),o}}else i&&(i=!1,Oe(e)),l()&&e.webkitExitFullscreen()}}}function _e(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=()=>{if(h(t))return;const a=function(t){const e=$e.raw,r=t.ownerDocument;if(e&&Reflect.get(r,e.fullscreenEnabled))return{document:r,target:t,get element(){return Reflect.get(r,e.fullscreenElement)},elementProperty:e.fullscreenElement,changeEvent:e.fullscreenchange,errorEvent:e.fullscreenerror,request:()=>Ee(t,e.requestFullscreen,void 0),exit:()=>Ee(r,e.exitFullscreen)}}(o);a?it(t,"fullscreen",Pe(t,a)):n.webkitSupportsFullscreen&&"function"===typeof n.webkitEnterFullscreen&&"function"===typeof n.webkitExitFullscreen?it(t,"fullscreen",Ie(t)):it(t,"fullscreen",{get:()=>!1,set(){h(t)||(r.show=e.get("Fullscreen Not Supported"))}}),it(t,"fullscreen",ct(t,"fullscreen"))};t.once("video:loadedmetadata",a),u(t).add(()=>{t.off("video:loadedmetadata",a)})}function Ne(t){return{node:t,parent:t.parentNode,next:t.nextSibling}}function De({node:t,parent:e,next:r}){if(!e)return void t.parentNode?.removeChild(t);const n=r?.parentNode===e?r:null;t.parentNode===e&&t.nextSibling===n||e.insertBefore(t,n)}function We(t){const e=function(t){const{$player:e}=t.template;let r,n=0;function o(t,r){return null===t.style?e.removeAttribute("style"):e.setAttribute("style",t.style),!!r()&&(e.classList.remove("art-fullscreen-web"),!!r()&&(De(t.placement),r()))}return u(t).add(()=>{n+=1;const t=r;if(r=void 0,t)try{o(t,()=>!0)}catch(a){try{e.parentNode!==t.placement.parent&&e.parentNode?.removeChild(e)}catch(i){throw new s([a,i])}throw a}}),a=>{if(h(t))return;const i=++n,s=()=>i===n&&!h(t);if(a){r||(r={placement:Ne(e),style:e.getAttribute("style")});const n=r;try{if(t.constructor.FULLSCREEN_WEB_IN_BODY&&e.parentNode!==document.body&&document.body.appendChild(e),!s())return;if(t.state="fullscreenWeb",!s())return;e.style.width="100%",e.style.height="100%",e.classList.add("art-fullscreen-web")}catch(l){throw s()&&o(n,s)&&(r=void 0),l}if(!s())return;t.emit("fullscreenWeb",!0)}else{if(r){if(!o(r,s))return;r=void 0}else e.classList.remove("art-fullscreen-web");if(!s())return;t.emit("fullscreenWeb",!1)}s()&&t.emit("resize")}}(t);it(t,"fullscreenWeb",{get:()=>t.template.$player.classList.contains("art-fullscreen-web"),set:e})}function Fe(t,e,r){const n=Math.max(0,r.viewportWidth-r.width),o=Math.max(0,r.viewportHeight-r.height);return{left:Math.max(0,Math.min(t,n)),top:Math.max(0,Math.min(e,o))}}function Ve(t){const{width:e,height:r}=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{width:e,height:r,viewportWidth:n.innerWidth,viewportHeight:n.innerHeight}}function Ye(t,e,r,n){const o=e.child();if(o.closed)return;const a=t.template.$mini;if(a){const t=a.style.display;return o.add(()=>{a.style.display=t}),{element:a,cancelDrag:()=>{},fresh:!1}}const i=t.template.$player.ownerDocument,s=i.createElement("div");s.className="art-mini-popup",o.add(()=>{s.remove()});try{const e=i.createElement("div");if(e.className="art-mini-close",e.append(t.icons.close),o.closed)return;const a=i.createElement("div");a.className="art-mini-state";const l=t.icons.play,c=t.icons.pause;if(o.closed)return;a.append(l,c),s.append(e,a),Mt(o,e,"click",n),Mt(o,l,"click",()=>{K(t.play())}),Mt(o,c,"click",()=>{t.pause()});const d=()=>{o.closed||(l.style.display=t.playing?"none":"flex",c.style.display=t.playing?"flex":"none")};d();for(const r of["video:playing","video:pause","video:timeupdate"])t.on(r,d),o.add(()=>{t.off(r,d)});const p=function(t,e,r,n){let o=!1,a=0,i=0;const s=()=>{o=!1,e.classList.remove("art-mini-dragging"),e.style.transform=""};Mt(r,e,"mousedown",t=>{const e=t;0===e.button&&n()&&(o=!0,a=e.clientX,i=e.clientY)});const l=t=>{!r.closed&&o&&n()&&(e.classList.add("art-mini-dragging"),e.style.transform=`translate(${t.clientX-a}px, ${t.clientY-i}px)`)},c=()=>{if(r.closed||!o||!n())return;const a=e.getBoundingClientRect(),i=Fe(a.left,a.top,Ve(e));s(),e.style.left=`${i.left}px`,e.style.top=`${i.top}px`,t.storage.set("left",i.left),r.closed||t.storage.set("top",i.top)};return t.on("document:mousemove",l),r.add(()=>{t.off("document:mousemove",l)}),t.on("document:mouseup",c),r.add(()=>{t.off("document:mouseup",c)}),r.add(s),s}(t,s,o,r);if(o.closed)return;if(t.template.$mini=s,i.body.append(s),!o.closed)return{element:s,cancelDrag:p,fresh:!0}}catch(l){throw o.dispose(),t.template.$mini===s&&delete t.template.$mini,l}}function Be(t){const{$player:e,$video:r}=t.template,n=u(t).child();let o,a,i=0,s=!1,l=!1;const c=()=>!h(t)&&e.classList.contains("art-mini");function d(){if(a){const e=a,r=i;a=void 0;try{De(e)}catch(t){throw r!==i||a||(a=e),t}}}function p(){if(h(t))return;const r=++i;l=!1,d(),h(t)||r!==i||(o?.cancelDrag(),e.classList.remove("art-mini"),t.template.$mini&&(t.template.$mini.style.display="none",t.emit("mini",!1)))}function f(){if(h(t))return;const u=++i;if(s)l=!0;else if(t.state="mini",!h(t)&&u===i){a??(a=Ne(r)),e.classList.add("art-mini");try{if(!o){s=!0;try{o=Ye(t,n,c,p)}finally{s=!1}}if(l)return l=!1,void f();if(!o||h(t))return;if(u!==i)return void(c()||(o.element.style.display="none"));if(o.fresh?o.element.prepend(r):o.element.append(r),h(t)||u!==i)return;o.element.style.display=o.fresh?"":"flex",o.fresh=!1;const e=t.storage.get("top"),a=function(t,e,r){return"number"===typeof t&&Number.isFinite(t)&&"number"===typeof e&&Number.isFinite(e)&&t>=0&&e>=0&&t+r.width<=r.viewportWidth&&e+r.height<=r.viewportHeight?{left:t,top:e,reset:!1}:{...Fe(r.viewportWidth-r.width-50,r.viewportHeight-r.height-50,r),reset:!0}}(t.storage.get("left"),e,Ve(o.element));if(h(t)||u!==i)return;if(o.element.style.left=`${a.left}px`,o.element.style.top=`${a.top}px`,a.reset){if(t.storage.set("top",a.top),h(t)||u!==i)return;t.storage.set("left",a.left)}h(t)||u!==i||t.emit("mini",!0)}catch(m){const r=l;throw l=!1,h(t)||u!==i&&!r||(d(),e.classList.remove("art-mini"),o&&(o.element.style.display="none")),m}}}return n.add(()=>{i++;try{d()}finally{o?.cancelDrag(),e.classList.remove("art-mini")}}),{get:c,set(t){t?f():p()}}}const He=new WeakSet,je=t=>"picture-in-picture"===t.webkitPresentationMode;function qe(t){He.delete(t),t.removeEventListener("webkitpresentationmodechanged",Ue),t.removeEventListener("enterpictureinpicture",Ue)}function Ue(){if(He.has(this)&&je(this)){qe(this);try{this.webkitSetPresentationMode?.("inline")}catch{}}}function Xe(t){He.add(t),t.addEventListener("webkitpresentationmodechanged",Ue),t.addEventListener("enterpictureinpicture",Ue)}function Ge(t){const{i18n:e,notice:r,template:{$video:n}}=t,o=n.ownerDocument;o.pictureInPictureEnabled&&"function"===typeof n.requestPictureInPicture&&"function"===typeof o.exitPictureInPicture?it(t,"pip",function(t){const{$video:e}=t.template,r=e.ownerDocument,n=u(t).child(),o=()=>r.pictureInPictureElement===e;let a=o(),i=a,s=!1,l=!1,c=0;function d(){if(o())try{r.exitPictureInPicture().catch(()=>{})}catch{}}function p(e,r,n){e.then(()=>{!r||!h(t)&&i||d()},e=>{h(t)||c!==n||(t.notice.show=e)}).finally(()=>{c===n&&(s=!1)}).catch(()=>{})}return e.disablePictureInPicture=!1,n.add(()=>{c++,i=!1,d()}),Mt(n,e,"enterpictureinpicture",()=>{if(l)return void d();if(!o()||a)return;const e=c;t.state="pip",!h(t)&&e===c&&o()&&(a=!0,t.emit("pip",!0))}),Mt(n,e,"leavepictureinpicture",()=>{a&&!o()&&(a=!1,t.emit("pip",!1))}),{get:()=>!h(t)&&o()?e:null,set(n){if(h(t))return;const a=++c;if(i=Boolean(n),i?l=!1:s&&(l=!0),s=!1,i){if(t.state="pip",h(t)||c!==a)return;s=!0;try{p(e.requestPictureInPicture(),!0,a)}catch(d){throw c===a&&(s=!1),d}}else o()&&p(r.exitPictureInPicture(),!1,a)}}}(t)):"function"===typeof n.webkitSupportsPresentationMode&&"function"===typeof n.webkitSetPresentationMode?it(t,"pip",function(t){const{$video:e}=t.template,r=u(t).child();let n=!1,o=!1,a=0,i=0;function s(r=!1){if(h(t)||He.has(e))return;const s=je(e);if(s&&(o=!1),s===n&&!r)return;const l=a;s&&(t.state="pip"),h(t)||a!==l||je(e)!==s||(n=s,i++,t.emit("pip",s))}e.webkitSetPresentationMode("inline"),r.add(()=>{a++,o&&Xe(e),je(e)&&e.webkitSetPresentationMode("inline")});for(const l of["webkitpresentationmodechanged","enterpictureinpicture","leavepictureinpicture"])Mt(r,e,l,()=>s());return{get:()=>!h(t)&&je(e),set(r){if(h(t))return;const n=++a,l=i;if(r){if(!1===e.webkitSupportsPresentationMode?.("picture-in-picture"))return void(t.notice.show=t.i18n.get("PIP Not Supported"));if(qe(e),t.state="pip",h(t)||a!==n)return;o=!0;try{e.webkitSetPresentationMode("picture-in-picture")}catch(c){throw n===a&&(o=!1),c}}else o&&(o=!1,Xe(e)),je(e)&&e.webkitSetPresentationMode("inline");h(t)||n!==a||l!==i||je(e)!==Boolean(r)||s(!0)}}}(t)):it(t,"pip",{get:()=>!1,set(){h(t)||(r.show=e.get("PIP Not Supported"))}})}function Ke(t){it(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:a?.html||"",selector:e,async onSelect(e,r,a){const i=function(t){return t&&Dt.get(t)||(()=>!0)}(a);if(await t.switchQuality(e.url),!h(t)&&i()){const r=`${o.get("Switch Video")}: ${e.html}`;!h(t)&&i()&&(n.show=r)}return e.html}})}})}function Ze(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function Je(t,e,r){return new Promise((n,o)=>{if(h(t)||e===t.url)return void n();const a=fe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),d=t=>l(!0,t);a.onError=d;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const p=i.child(),u={"video:error":d,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){d(e)}},"video:canplay":()=>{if(!c())return;p.dispose();(async()=>{if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{await t.play()}catch{}c()&&(t.notice.show="",l())}})().catch(d)}},h=i.child(),f=[],m=Object.keys(u);for(const e of m)Ze(h,t,e,t=>{a.acceptingEvents&&f.push([e,t])},!1);if(ge(t,a,e),!c())return;if(t.notice.show="",!c())return;const g=()=>{if(h.dispose(),!e)return void l();const r={};for(const e of m)r[e]=Ze(p,t,e,u[e]);for(const[t,e]of f){if(!c()||p.closed)break;r[t](e)}f.length=0};a.assigned?g():a.onAssigned=g}catch(p){d(p)}})}function Qe(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",async(o,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:p}=e.thumbnails;if(!c||!d)return;if("hover"===o||"played"===o&&l&&E){if(i||a||(a=!0,i=await j(d,p),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-u/2?R(a,"left",r.clientWidth-u+"px"):R(a,"left",o-u/2+"px")}(o)}}),it(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function tr(t){const{option:e,template:{$video:r}}=t;it(t,"url",{get:()=>r.src,async set(n){if(h(t))return;const o=function(t){const e=de.get(t);return de.delete(t),e||fe(t)}(t);o.acceptingEvents=!1;try{if(!n)return void(await At(o.scope)&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||Z(n),s=e.customType[i];if(i&&s){if(!(await At(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;Ze(l,t,"video:canplay",()=>{c=!d}),Ze(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>ve(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||Ze(o.scope,t,"video:canplay",e)}}catch(a){ve(o,a)}finally{me(o)}}})}class er{constructor(t){tr(t),function(t){const{template:{$video:e}}=t;it(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;it(t,"play",{async value(){const i=he(t),s=await a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;it(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${et(t.currentTime)} / ${et(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;it(t,"forward",{set(e){r.seek=t.currentTime+e}}),it(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;it(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=Q(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),it(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;it(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=Q(n,0,t.duration))}})}(t),function(t){it(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>Je(t,e,0);it(t,"switchQuality",{value:e=>Je(t,e,t.currentTime)}),it(t,"switchUrl",{value:e}),it(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;it(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;it(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(!h(t)){if(a||(a="default"),"default"===a)n.style.width="",n.style.height="",n.style.margin="",delete o.dataset.aspectRatio;else{const e=a.split(":").map(Number),r=ae({width:o.clientWidth,height:o.clientHeight},e[0]/e[1]);if(h(t))return;"width"===r?.axis?(n.style.width=`${r.width}px`,n.style.height="100%",n.style.margin="0 auto"):r&&(n.style.width="100%",n.style.height=`${r.height}px`,n.style.margin="auto 0"),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,h(t)||t.emit("aspectRatio",a)}}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=V("canvas");it(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),it(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),it(t,"screenshot",{value:async e=>{const n=await t.getDataURL();return J(n,`${e||`artplayer_${et(r.currentTime)}`}.png`),t.emit("screenshot",n),n}})}(t),_e(t),We(t),Ge(t),function(t){const{$video:e}=t.template,r=t;it(t,"loaded",{get:()=>r.loadedTime/e.duration}),it(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){it(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;it(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:n}=t.template;it(t,"autoSize",{value(){if(h(t))return;const o={width:n.videoWidth,height:n.videoHeight};if(!oe(o))return;const a=H(e),i=ae(a,o.width/o.height);i&&!h(t)&&("width"===i.axis?(r.style.width=i.width/a.width*100+"%",r.style.height="100%"):(r.style.width="100%",r.style.height=i.height/a.height*100+"%"),t.emit("autoSize",{width:t.width,height:t.height}))}})}(t),function(t){const e=t;it(t,"rect",{get:()=>H(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}it(t,"x",{get:()=>e.left+window.pageXOffset}),it(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;it(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){h(t)||(o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(tt(o))}`,h(t)||t.emit("flip",o))}})}(t),function(t){it(t,"mini",Be(t))}(t),function(t){const{template:{$poster:e}}=t;it(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){R(e,"backgroundImage",`url(${t})`)}})}(t),ie(t),function(t){const{$player:e}=t.template;it(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){it(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){it(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];it(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;nn.$track?.offset||0,set(o){const{cues:a}=t.subtitle;if(!n.$track||0===a.length)return;const i=Q(o,-10,10);n.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,it(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Ke(t),Qe(t),be(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=Q(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=Q(a,0,1)),e.poster&&R(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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)}}const rr=new WeakMap,nr="art-auto-orientation-fullscreen";function or(t){if(rr.get(t.orientation)===t)try{t.orientation.unlock()}catch{}}const ar="art-auto-orientation",ir=["width","height","transform-origin","transform"];function sr(t){const{$player:e,$video:r}=t.template,n=()=>{const t={width:r.videoWidth,height:r.videoHeight},n=e.ownerDocument.documentElement,o={width:n.clientWidth,height:n.clientHeight};return oe(t)&&oe(o)&&(t.width>t.height&&o.widtho.height)},o=function(t,e){const{$player:r}=t.template,n=u(t);let o,a=()=>{};function i(){a(),a=()=>{};const e=o;if(o=void 0,e&&t.fullscreenWeb)for(const{name:t,value:o,priority:a}of e)r.style.setProperty(t,o,a);const n=r.classList.contains(ar);r.classList.remove(ar),n&&(t.isRotate=!1,h(t)||t.emit("resize"))}function s(n){if(!t.fullscreenWeb||!e())return;const a=U();if(h(t)||!t.fullscreenWeb)return;const i=r.ownerDocument.documentElement;o??(o=ir.map(t=>({name:t,value:r.style.getPropertyValue(t),priority:r.style.getPropertyPriority(t)}))),r.style.width=i.clientHeight-a.top-a.bottom+"px",r.style.height=i.clientWidth-a.left-a.right+"px",r.style.transformOrigin="0 0",r.style.transform=`rotate(90deg) translate(${a.top}px, -${i.clientWidth-a.right}px)`,r.classList.add(ar),t.isRotate=!0,n&&t.emit("resize")}return n.add(i),r=>{h(t)||(r?o?s(!1):e()&&(a(),a=zt(n,()=>{o||s(!0)},Number(t.constructor.AUTO_ORIENTATION_TIME??0))):i())}}(t,n),a=function(t,e){const{$player:r}=t.template;let n;function o(){const t=n;n=void 0,r.classList.remove(nr),t&&(t.cancelled=!0,or(t),t.settled&&rr.get(t.orientation)===t&&rr.delete(t.orientation))}return u(t).add(o),a=>{if(h(t))return;if(!a)return void o();if(n&&!n.cancelled&&rr.get(n.orientation)===n)return;const i=r.ownerDocument.defaultView?.screen?.orientation;if("function"!==typeof i?.lock||"function"!==typeof i.unlock||!e())return;const s={orientation:i,cancelled:!1,settled:!1};n=s,rr.set(i,s);const l=()=>!h(t)&&!s.cancelled&&n===s&&rr.get(i)===s,c=e=>{s.settled=!0;const o=l();rr.get(i)===s&&rr.delete(i),n===s&&(n=void 0),o&&(r.classList.remove(nr),t.notice.show=e)};try{const t=i.lock(i.type.startsWith("portrait")?"landscape":"portrait");Promise.resolve(t).then(()=>{s.settled=!0,l()?r.classList.add(nr):(or(s),rr.get(i)===s&&rr.delete(i))}).catch(c)}catch(d){c(d)}}}(t,n);return t.on("fullscreenWeb",o),t.on("fullscreen",a),u(t).add(()=>{t.off("fullscreenWeb",o),t.off("fullscreen",a)}),{name:"autoOrientation",get state(){return e.classList.contains("art-auto-orientation")}}}function lr(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=L(".art-auto-playback-last",s),c=L(".art-auto-playback-jump",s),d=L(".art-auto-playback-close",s);A(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),R(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(R(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${et(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{R(s,"display","none")}),a(c,"click",()=>{t.seek=r,K(t.play()),R(i,"display","none"),R(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{R(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function cr(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,M(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,P(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return z(n,"art-fast-forward")}}}function dr(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return z(n,"art-lock")}function a(){P(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){M(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=A(e,r.lock),o=A(e,r.unlock);R(n,"display","none"),t.on("lock",t=>{t?(R(n,"display","inline-flex"),R(o,"display","none")):(R(n,"display","none"),R(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function pr(t){return t.on("control",e=>{e?M(t.template.$player,"art-mini-progress-bar"):P(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class ur{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){h(t.art)||!e.miniProgressBar||e.isLive||t.add(pr),!h(t.art)&&e.lock&&E&&t.add(dr),h(t.art)||!e.autoPlayback||e.isLive||t.add(lr),!h(t.art)&&e.autoOrientation&&E&&t.add(sr),!h(t.art)&&e.fastForward&&E&&!e.isLive&&t.add(cr)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){G(!h(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(h(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(h(t.art))return t;let o=n;const a=lt(t,o);if(h(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return h(t.art)||(G(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),h(t.art)||it(t,o,{value:r})),t}(this,t,e)}}const hr=new WeakMap;function fr(t){return!t.closed&&!hr.get(t)}function mr(t){hr.set(t,(hr.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(hr.get(t)||1)-1;r?hr.set(t,r):hr.delete(t)}}const gr=new WeakMap,vr=new WeakMap,yr=["$parent","$parents","$option","$events","$formatted"];function br(t){const e=new Set;let r=t;for(;r&&!e.has(r);){e.add(r);const t=gr.get(r);if(!t||!t.owner.active||t.owner.scope?.closed||!t.option.includes(r))return!1;if(!t.parent)return t.owner.root===t.option;if(gr.get(t.parent)?.owner!==t.owner)return!1;r=t.parent}return!1}function wr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function xr(t){const e=gr.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function kr(t,e){for(let r=0;r{d&&d!==r&&d.dispose()},()=>Pr(t,o)])try{e()}catch(p){p instanceof s?c.push(...p.errors):c.push(p)}if(r.closed||h(t)||(o.push(...a.splice(0)),Sr.set(r,o),Cr.set(e,r),Lr.set(e,n)),i(),c.length)throw new s(c)},dispose(){if(l){l=!1;try{r.dispose()}finally{i()}}}}}function Or(t,e,r,n,o,a){const i=a||zr(e);if(!fr(i)||h(t))return;const s=t.proxy(r,n,e=>{if(fr(i)&&!h(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!fr(i)||h(t)?t.events.remove(s):(xr(e).events.push(s),a&&a!==Cr.get(e)&&a.add(()=>{const r=xr(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function Ir(t,e,r,n){const o=zr(e);if(!fr(o)||h(t))return;const a=(...e)=>{if(fr(o)&&!h(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function _r(t){const{art:e,active:r}=t,{controls:n,constructor:{SETTING_WIDTH:o,SETTING_ITEM_HEIGHT:a},template:{$player:i,$setting:s,$bottom:l}}=e;if(!n.setting||!t.show||!r)return;const c=i.getBoundingClientRect(),d=n.setting.getBoundingClientRect(),p=c.width/i.offsetWidth||1,u=(d.left-c.left+d.width/2)/p-i.clientLeft,h=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:i.clientWidth,containerHeight:i.clientHeight,requestedWidth:r[0]?.$parent?.width||o,rows:r.length+(r===t.option?0:1),rowHeight:a,controlCenter:u,bottom:Number.parseFloat(getComputedStyle(s).bottom)||0,padding:Number.parseFloat(getComputedStyle(l).paddingLeft)||0});s.style.height=`${h.height}px`,s.style.width=`${h.width}px`,e.isRotate||E||(u+h.width/2>i.clientWidth?(s.style.left="",s.style.right=""):(s.style.left=`${h.left}px`,s.style.right="auto"))}const Nr=new WeakMap;function Dr(t){Nr.delete(t)}const Wr=new WeakMap;function Fr(t,e){e?Wr.set(t,e):Wr.delete(t)}function Vr(t){const e=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),r=[],n=Wr.get(t),o=n?.();for(const a of["html","icon","tooltip"]){const t=e.get(a)?.value;t instanceof Node&&r.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{for(const r of Reflect.ownKeys(t))!e.has(r)&&Object.getOwnPropertyDescriptor(t,r)?.configurable&&Reflect.deleteProperty(t,r);for(const[r,n]of e)Object.defineProperty(t,r,n);o?.(),Fr(t,n);for(const{node:t,parent:e,next:n}of r)e?e.insertBefore(t,n?.parentNode===e?n:null):t.parentNode?.removeChild(t)}}const Yr=new WeakMap;async function Br(t,e,r,n,o,a,i,s){try{const l=zr(e),c=zr(a),d=(Yr.get(a)||0)+1;Yr.set(a,d);const p=()=>fr(l)&&fr(c)&&!h(t.art)&&Yr.get(a)===d;if(s?.(),!p())return;const u=await o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}}function Hr(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const jr=new WeakMap;function qr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof s?e.push(...r.errors):e.push(r)}if(e.length)throw new s(e)}function Ur(t){jr.get(t)?.()}function Xr(t,e){const r=t.find(e.name);if(h(t.art))return r||e;if(!r)return t.add(e);Dr(r),Ur(r);const n=Vr(r),o=r.$item,a=o?.parentNode,i=o?.nextSibling,s=o?Hr(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=Rr(t.art,e);r&&a.push(r)}for(const t of n)i.push(mr(Er(t)))}catch(l){try{qr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,qr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,qr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>Tr(t)),...i]))}}}(t,r);let p=!0,f=!1;const m=()=>{if(!p)return;p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);if(h(t.art))return void d.dispose();const e=r.$item;try{qr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>s?.(),()=>{a&&o&&a.insertBefore(o,i?.parentNode===a?i:null)},()=>t.format(),()=>{if(f){t.active=l,l&&t.cache.has(l)&&_(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(u){console.warn("ArtPlayer setting restore failed:",u)}},g=()=>p&&!h(t.art)&&jr.get(r)===m;for(const u of d.items)jr.set(u,m);const v=u(t.art).add(()=>{p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!o?.enumerable||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,g),!g())return r;if(t.format(),!g())return r;if(t.createItem(r,!0),!g())return r;if(f=!0,t.render(),!g())return r;p=!1;for(const t of d.items)jr.get(t)===m&&jr.delete(t);return d.dispose(),r}catch(y){throw g()&&m(),y}finally{v()}}const Gr=new WeakMap;function Kr(t,e,r){it(t,`$${e}`,{configurable:!0,get:()=>r}),it(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",A(r,t)}})}function Zr(t,e,r=!1){const n=function(t){const e=jr.get(t);return()=>!e||jr.get(t)===e}(e);if(!t.cache.has(e.$option))return;const o=t.cache.get(e.$option),a=e.$item;let i="selector";lt(e,"switch")&&(i="switch"),lt(e,"range")&&(i="range"),lt(e,"onClick")&&(i="button");const{icons:s,constructor:l}=t.art;if(!n())return;const c=function(t,e,r=u(t)){const n=Cr.get(e);(!n||fr(n)||n.closed)&&Ar(t,e);const o=r.child();return Cr.set(e,o),Lr.set(e,r),Sr.set(o,xr(e).events),o.add(()=>{Pr(t,Sr.get(o))}),o}(t.art,e,Er(o)),d=()=>fr(c)&&!h(t.art)&&n();if(!d())return;const p=document.createElement("div");try{if(Fr(e),P(p,"art-setting-item"),R(p,"height",`${l.SETTING_ITEM_HEIGHT}px`),p.dataset.name=e.name||"",p.dataset.value=String(e.value||""),!d())return;const n=A(p,'
'),u=A(p,'
'),f=document.createElement("div");switch(P(f,"art-setting-item-left-icon"),i){case"button":case"switch":case"range":{const t=e.icon||s.config;if(!d())return;A(f,t);break}case"selector":if(e.selector?.length){const t=e.icon||s.config;if(!d())return;A(f,t)}else A(f,s.check)}if(A(n,f),!d())return;Kr(e,"icon",f);const m=document.createElement("div");P(m,"art-setting-item-left-text");const g=e.html||"";if(!d())return;A(m,g),A(n,m),Kr(e,"html",m);const v=document.createElement("div");P(v,"art-setting-item-right-tooltip");const y=e.tooltip||"";if(!d())return;switch(A(v,y),A(u,v),Kr(e,"tooltip",v),i){case"switch":{const t=document.createElement("div");P(t,"art-setting-item-right-icon");const r=A(t,s.switchOn),n=A(t,s.switchOff),o=e.switch;if(!d())return;R(o?n:r,"display","none"),A(u,t),it(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!d())return;Fr(e,()=>{const t=a;return()=>{a=t}}),it(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(R(n,"display","none"),R(r,"display",null)):(R(n,"display",null),R(r,"display","none"))}});break}case"range":{const t=document.createElement("div");P(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",A(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!d())return;Reflect.set(r,a,String(t))}P(r,"art-setting-range"),A(u,t),it(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!d())return;Fr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),it(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(e.selector?.length){const t=document.createElement("div");P(t,"art-setting-item-right-icon"),A(t,s.arrowRight),A(u,t)}}if(!d())return;if(function(t,e,r,n){const{art:o}=t,a=zr(e),i=(t,r,n)=>Or(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>Br(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>Br(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{if(e.selector?.length)t.render(e.selector);else{if(e.$parent?.onSelect)return Br(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&P(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>Br(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,p,i),!d())return;it(e,"$item",{configurable:!0,get:()=>p}),r&&a?.parentNode?a.replaceWith(p):A(o,p),e.mounted&&d()&&zt(c,()=>{if(!h(t.art))try{const r=e.mounted?.call(t.art,p,e);Promise.resolve(r).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(r){console.warn("ArtPlayer setting mounted failed:",r)}},0)}catch(f){try{c.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw p.remove(),f}}function Jr(t,e=t.option){if(h(t.art))return;const r=t.cache.get(e);if(r&&!fr(Er(r)))return;const n=(Gr.get(t)||0)+1;Gr.set(t,n);const o=()=>Gr.get(t)===n&&!h(t.art),a=t.active,i=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),s=()=>{t.active=a,a&&t.cache.has(a)&&_(t.cache.get(a),"art-current");for(const[e,r,n]of i)t.$parent.style.setProperty(e,r,n)};if(t.active=e,r)try{_(r,"art-current"),t.resize()}catch(l){throw o()&&t.cache.get(e)===r&&!Er(r).closed&&s(),l}else{const r=document.createElement("div");t.cache.set(e,r);const n=function(t,e,r){const n=u(t.art).child();return $r.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,r),a=()=>!n.closed&&!h(t.art)&&t.cache.get(e)===r,i=[];try{if(!a())return;P(r,"art-setting-panel"),A(t.$parent,r),_(r,"art-current"),e[0]?.$parent&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=vr.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=u(e).child(),n=(t,n)=>{if(r.closed||h(e))return;const o=(...t)=>{if(!r.closed&&!h(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=W(r,e.controls.setting),o=W(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||h(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(tt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),Ir(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{Ir(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){kr(e,t)}check(t){!function(t,e){e?.$parent&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&_(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=vr.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{for(let n=0;nxr(t).parent},$parents:{get:()=>xr(t).parents},$option:{get:()=>xr(t).option},$events:{get:()=>xr(t).events},$formatted:{get:()=>!0}}),gr.set(t,{parent:r,parents:n,option:o,events:i?.events||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return kr(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){_r(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&Tr(n)}catch(a){r.push(a)}}try{Ar(t.art,e)}catch(a){a instanceof s?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new s(r)}(this,t)}remove(t){const e=this.find(t);G(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{Dr(t),Ur(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>n?.remove(),()=>this.render()])try{i()}catch(a){a instanceof s?o.push(...a.errors):o.push(a)}if(o.length)throw new s(o)}update(t){return Xr(this,t)}add(t,e=this.option){if(h(this.art))return t;let r=!1;this.traverse(e=>{r||(r=e===t)});const n=e.length,o=r?void 0:function(t){const e={};Nr.set(t,e);const r=()=>Nr.get(t)===e;return{current:r,finish(){r()&&Nr.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(i){if(h(this.art)||o&&!o.current())throw i;if(e[n]===t&&e.splice(n,1),!r&&a){try{this.inactivate(t)}catch(s){console.warn("ArtPlayer setting cleanup failed:",s)}t.$item?.remove()}throw i}finally{o?.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");R(a,"height",`${o}px`),P(a,"art-setting-item"),P(a,"art-setting-item-back");const i=A(a,'
'),s=document.createElement("div");P(s,"art-setting-item-left-icon"),A(s,n),A(i,s),A(i,e.$parent.html),Or(t.art,e.$parent,a,"click",()=>t.render(e.$parents),Er(r)),A(r,a)}(this,t)}createItem(t,e=!1){Zr(this,t,e)}render(t=this.option){Jr(this,t)}}class en{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch{return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch{this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch{delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch{this.settings={}}}}const rn='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;max-width:100vw;max-height:100vh;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class nn{constructor(t){this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope)?.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}async run(t){if(this.active)try{return await Promise.race([t(),this.cancelled])}finally{this.cancel()}}}const on=new WeakMap;function an(t){return on.get(t)}function sn(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const ln=St;class cn extends ln{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=u(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return on.set(t,n),r.add(()=>{sn(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return Array.from(this.textTrack?.activeCues||[])}get cues(){return Array.from(this.textTrack?.cues||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?O(r,t):R(r,t,e)}update(){!function(t){const e=an(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?at(t):t}\n
`).join("")).join("");o()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}async switch(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a={...o.subtitle,...e,url:t},i=an(this),s=i.revision+1,l=await this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),l}createTrack(t,e){!function(t,e,r){const n=an(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=n.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||n.trackRevision!==o)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||n.trackRevision!==o)return p.dispose(),void d.remove();const h=n.track;n.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{h?.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&sn(n)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw i.$track=s,l&&l.insertBefore(s,c?.parentNode===l?c:null),h}}(this,t,e)}async init(t){const e=an(this),r=function(t){const e=t.request,r=new nn(t.scope);return t.request=r,t.revision+=1,e?.cancel(),r}(e),{notice:n,template:{$subtitle:a}}=this.art;return r.run(async()=>{if(!this.textTrack)return null;if(o(t,Ct.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const n=await fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const o=await n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||Z(e.url)){case"srt":return{vtt:e.onVttLoad(pt(r))};case"ass":return{vtt:e.onVttLoad(ht(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(o,t);if(!r.active)return;const l=void 0===s?t.url:i=ut(s.vtt);if(!r.active)return;a.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(s){if(!r.active)return;throw a.innerHTML="",n.show=s,s}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}})}}const dn=`\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
${a}
\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 `;class pn{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=L(e.container),G(this.$container,`No container element found by ${e.container}`)),G(B(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();G("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),G(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=d.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=p(t);o.rollback=r,d.set(e,t),o.releaseContainer=()=>{d.get(e)===t&&d.delete(e)}}(t,this.$container,Hr(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return dn}query(t){return L(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=pn.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){G(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),F(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&P(this.$player,"art-backdrop"),E&&P(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":P(this.$player,"art-destroy")}}const un=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class hn{on(t,e,r){const n=this.e||(this.e={});let o=un(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(un(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=un(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),gn.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${gn.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=p(t);return e.rollback=void 0,!e.scope.closed})(this)&&mn.push(this)}catch(n){try{f(this,mn,!0,gn.REMOVE_SRC_WHEN_DESTROY,!0)}catch(a){console.warn("Failed to clean up ArtPlayer initialization:",a)}throw n}}static get instances(){return mn}static get version(){return a}static get config(){return i}static get utils(){return mt}static get scheme(){return Ct}static get Emitter(){return hn}static get validator(){return o}static get kindOf(){return o.kindOf}static get html(){return pn.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:x?"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){f(this,mn,t,gn.REMOVE_SRC_WHEN_DESTROY)}}return gn.STYLE=rn,gn.DEBUG=!1,gn.CONTEXTMENU=!0,gn.NOTICE_TIME=2e3,gn.SETTING_WIDTH=250,gn.SETTING_ITEM_WIDTH=200,gn.SETTING_ITEM_HEIGHT=35,gn.RESIZE_TIME=200,gn.SCROLL_TIME=200,gn.SCROLL_GAP=50,gn.AUTO_PLAYBACK_MAX=10,gn.AUTO_PLAYBACK_MIN=5,gn.AUTO_PLAYBACK_TIMEOUT=3e3,gn.RECONNECT_TIME_MAX=5,gn.RECONNECT_SLEEP_TIME=1e3,gn.CONTROL_HIDE_TIME=3e3,gn.DBCLICK_TIME=300,gn.DBCLICK_FULLSCREEN=!0,gn.MOBILE_DBCLICK_PLAY=!0,gn.MOBILE_CLICK_PLAY=!1,gn.AUTO_ORIENTATION_TIME=200,gn.INFO_LOOP_TIME=1e3,gn.FAST_FORWARD_VALUE=3,gn.FAST_FORWARD_TIME=1e3,gn.TOUCH_MOVE_RATIO=.5,gn.VOLUME_STEP=.1,gn.SEEK_STEP=5,gn.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],gn.ASPECT_RATIO=["default","4:3","16:9"],gn.FLIP=["normal","horizontal","vertical"],gn.FULLSCREEN_WEB_IN_BODY=!0,gn.LOG_VERSION=!0,gn.USE_RAF=!1,gn.REMOVE_SRC_WHEN_DESTROY=!0,T&&(window.Artplayer=gn,C("artplayer-style",rn),setTimeout(()=>{gn.LOG_VERSION&&console.log(`%c ArtPlayer %c ${gn.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),gn}); diff --git a/packages/artplayer/dist/artplayer.legacy.js b/packages/artplayer/dist/artplayer.legacy.js index 9e8ef7ba7..619727b35 100644 --- a/packages/artplayer/dist/artplayer.legacy.js +++ b/packages/artplayer/dist/artplayer.legacy.js @@ -67,4 +67,4 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!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";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))i.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var a=t=>{try{s(r.next(t))}catch(e){o(e)}},i=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(a,i);s((r=r.apply(t,e)).next())});function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var u,h={exports:{}};var f=(u||(u=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var a,i,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(a=t.template)?void 0:a.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const p=e.indexOf(t);-1!==p&&e.splice(p,1),t.isDestroy=!0,o||(null==(i=l.releaseContainer)||i.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const u of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",u);if(c.length)throw c[0]}const C=new WeakMap;function S(t,e){const r=$(t).child();return C.set(e,r),r}function z(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function L(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=z(e);if(o.closed)return;const a=(...t)=>{if(!o.closed)return n(...t)};t.on(r,a),o.add(()=>{t.off(r,a)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const a=z(e);if(a.closed)return()=>{};const i=t.events.proxy(r,n,t=>{if(!a.closed)return o(t)});return a.add(()=>{t.events.remove(i)})}(t,e,r,n,o)}}const P=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(P),O=/iPad|iPhone|iPod/i.test(P)&&!window.MSStream,R=O||P.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(P)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function V(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 N(t,e=document){return e.querySelector(t)}function D(t,e=document){return Array.from(e.querySelectorAll(t))}function W(t,e){return t.classList.add(e)}function Y(t,e){return t.classList.remove(e)}function F(t,e){return t.classList.contains(e)}function j(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function B(t,e,r){return t.style[e]=r,t}function H(t,e){for(const r in e)B(t,r,e[r]);return t}function q(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function U(t,e){q(t).forEach(t=>Y(t,e)),W(t,e)}function X(t,e,r="top"){I||(t.setAttribute("aria-label",e),W(t,"hint--rounded"),W(t,`hint--${r}`))}function G(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,a=r.top-e<=n&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return a&&i}function K(t,e){return nt(t).includes(e)}function Z(t,e){return e.parentNode.replaceChild(t,e),t}function J(t){return document.createElement(t)}function Q(t="",e=""){const r=J("i");return W(r,"art-icon"),W(r,`art-icon-${t}`),j(r,e),r}function tt(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function et(t){return t.getBoundingClientRect()}function rt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=o.width*e,a.height=o.height*e,i.drawImage(o,0,0,a.width,a.height),a.toBlob(e=>{const o=URL.createObjectURL(e),a=new Image;a.onload=function(){r(a)},a.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},a.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function nt(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}function ot(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class at extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function it(t,e){if(!t)throw new at(e);return t}function st(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function lt(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function ct(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function dt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function pt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ut(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ht={"&":"&","<":"<",">":">","'":"'",'"':"""},ft={"&":"&","<":"<",">":">","'":"'",""":'"'},mt=/(&|<|>|'|")/g;function gt(t){return t.replace(/[&<>'"]/g,t=>ht[t]||t)}const vt=Object.defineProperty,{hasOwnProperty:yt}=Object.prototype;function bt(t,e){return yt.call(t,e)}function wt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],a=r[n];let i;i=Array.isArray(o)&&Array.isArray(a)?o.concat(...a):e(o)&&e(a)?xt(o,a):a,vt(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function kt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 $t(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Et(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 n=t.match(e);if(!n)return null;const[,o="",a="",,,i=""]=n;return{start:r(o.trim()),end:r(a.trim()),text:i.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Tt(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const Ct=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:at,addClass:W,append:j,assToVtt:Et,capitalize:pt,clamp:dt,createElement:J,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:vt,download:ct,errorHandle:it,escape:gt,get:wt,getComposedPath:nt,getExt:lt,getIcon:Q,getRect:et,getSafeAreaInsets:ot,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:bt,hasClass:F,includeFromEvent:K,inverseClass:U,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:G,isMobile:I,isSafari:A,loadImg:rt,mergeDeep:xt,query:N,queryAll:D,remove:function(t){return t.parentNode.removeChild(t)},removeClass:Y,replaceElement:Z,secondToTime:ut,setStyle:B,setStyleText:V,setStyles:H,siblings:q,silencePromise:st,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:kt,supportsFlex:tt,throttle:Tt,tooltip:X,unescape:function(t){return t.replace(mt,t=>ft[t]||t)},userAgent:P,vttToBlob:$t},Symbol.toStringTag,{value:"Module"}));function St(t,e){return j(t,e)}function zt(t,e){return e.querySelector(t)}const Lt="array",Mt="boolean",Pt="string",At="number",Ot="object",Rt="function";function It(t,e,r){return it(e===Pt||e===At||t instanceof Element,`${r.join(".")} require '${Pt}' or 'Element' type`)}const _t={html:It,disable:`?${Mt}`,name:`?${Pt}`,index:`?${At}`,style:`?${Ot}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${Pt}|${At}`,width:`?${At}`,selector:`?${Lt}`,onSelect:`?${Rt}`,switch:`?${Mt}`,onSwitch:`?${Rt}`,range:`?${Lt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Vt={id:Pt,container:It,url:Pt,poster:Pt,type:Pt,theme:Pt,lang:Pt,volume:At,isLive:Mt,muted:Mt,autoplay:Mt,autoSize:Mt,autoMini:Mt,loop:Mt,flip:Mt,playbackRate:Mt,aspectRatio:Mt,screenshot:Mt,setting:Mt,hotkey:Mt,pip:Mt,mutex:Mt,backdrop:Mt,fullscreen:Mt,fullscreenWeb:Mt,subtitleOffset:Mt,miniProgressBar:Mt,useSSR:Mt,playsInline:Mt,lock:Mt,gesture:Mt,fastForward:Mt,autoPlayback:Mt,autoOrientation:Mt,airplay:Mt,proxy:`?${Rt}`,plugins:[Rt],layers:[_t],contextmenu:[_t],settings:[_t],controls:[c(l({},_t),{position:(t,e,r)=>{const n=["top","left","right"];return it("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Mt}`,html:Pt,url:Pt}],highlight:[{time:At,text:Pt}],thumbnails:{url:Pt,number:At,column:At,width:At,height:At,scale:At},subtitle:{url:Pt,name:Pt,type:Pt,style:Ot,escape:Mt,encoding:Pt,onVttLoad:Rt},moreVideoAttr:Ot,i18n:Ot,icons:Ot,cssVar:Ot,customType:Ot},Nt=new WeakSet;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 F(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?W(e,r):Y(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,_t),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;it(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const a=document.createElement("div"),i=S(this.art,a),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;i.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(i.closed)return;if(function(t,e,r,n,o,a){W(t,`art-${r}`),W(t,`art-${r}-${n}`);const i=Array.from(e.children);t.dataset.index=String(a.index||o);const s=i.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):j(e,t),a.html&&j(t,a.html),a.style&&H(t,a.style),a.tooltip&&X(t,a.tooltip)}(a,this.$parent,this.name,n,this.id,r),i.closed)return;if(r.click){const t=this.art.events.proxy(a,"click",t=>{i.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,a,s),i.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,a),c=!0,o.set(n,{$ref:a,events:s,option:r}),r.mounted&&r.mounted.call(this.art,a),a}catch(d){try{L(a)}catch(p){console.warn("ArtPlayer component cleanup failed:",p)}throw(null==(e=o.get(n))?void 0:e.$ref)===a&&o.delete(n),c&&this[n]===a&&(l?Object.defineProperty(this,n,l):delete this[n]),a.remove(),d}}remove(t){it(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Nt.has(e)){Nt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{L(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Nt.delete(e)}}}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 Wt extends Dt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,S(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="1"]',t);n&&U(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&U(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="default"]',t);n&&U(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(pt(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=N('[data-value="normal"]',t);n&&U(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let a=0;a{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:a,width:i,left:s,top:l}=et(e),{height:c,width:d}=et(r);let p=n-s,u=o-l;n+d>s+i&&(p=i-d),o+c>l+a&&(u=a-c),H(r,{top:`${u}px`,left:`${p}px`})}),o(e,"click",t=>{K(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Yt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const a=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(a)}),o}function Ft(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const a=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(a),n||r(!1)})})}function jt(t,e){const{$progress:r}=t.template,{left:n}=et(r),o=dt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),a=o/r.clientWidth*t.duration;return{second:a,time:ut(a),width:o,percentage:dt(o/r.clientWidth,0,1)}}function Bt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=jt(t,e);t.emit("setBar","played",n,e),t.seek=r}}function Ht(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,a=z(e),{on:i}=M(t,e);let s=()=>{};const l=zt(".art-progress-hover",e),c=zt(".art-progress-loaded",e),d=zt(".art-progress-played",e),p=zt(".art-progress-highlight",e),u=zt(".art-progress-indicator",e),h=zt(".art-progress-tip",e);function f(r,n){const{width:o,time:a}=n||jt(t,r);h.textContent=a||"00:00";const i=h.clientWidth;o<=i/2?B(h,"left",0):o>e.clientWidth-i/2?B(h,"left",e.clientWidth-i+"px"):B(h,"left",o-i/2+"px")}r.indicator?j(u,r.indicator):B(u,"backgroundColor","var(--art-theme)"),i("setBar",function(r,n,i){const m="played"===r&&i&&I;if("loaded"===r&&B(c,"width",100*n+"%"),"hover"===r&&(B(l,"width",100*n+"%"),K(i,p)?function(r){const{width:n}=jt(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const a=h.clientWidth;n<=a/2?B(h,"left",0):n>e.clientWidth-a/2?B(h,"left",e.clientWidth-a+"px"):B(h,"left",n-a/2+"px")}(i):f(i),0===n?Y(o,"art-progress-hover"):W(o,"art-progress-hover")),"played"===r&&(B(d,"width",100*n+"%"),B(u,"left",100*n+"%")),m){W(o,"art-progress-hover");f(i,{width:e.clientWidth*n,time:ut(n*t.duration)}),s(),s=Yt(a,()=>{Y(o,"art-progress-hover")},500)}}),i("video:loadedmetadata",function(){p.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(i("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),i("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),i("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function qt(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{Ht(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:a}=M(t,e);if(!I){let e=!1;a(r,"click",e=>{e.target!==n&&Bt(t,e)}),a(r,"mousemove",e=>{const{percentage:r}=jt(t,e);t.emit("setBar","hover",r,e)}),a(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),a(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=jt(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Ut(t){const{option:e}=t.art;e.isLive||t.add(qt({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.play),s=St(t,o.pause);function l(){B(i,"display","flex"),B(s,"display","none")}function c(){B(i,"display","none"),B(s,"display","flex")}X(i,a.get("Play")),X(s,a.get("Pause")),n(i,"click",()=>{st(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o}=e,a=St(t,o.volume),i=St(t,o.volumeClose),s=St(t,'
'),l=St(s,'
'),c=St(l,'
'),d=St(l,'
'),p=St(d,'
'),u=St(p,'
'),h=St(d,'
');function f(t){const{top:e,height:r}=et(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)B(a,"display","none"),B(i,"display","flex"),B(h,"top","100%"),B(u,"top","100%"),c.textContent="0";else{const t=100*e.volume;B(a,"display","flex"),B(i,"display","none"),B(h,"top",100-t+"%"),B(u,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(a,"click",()=>{e.muted=!0}),n(i,"click",()=>{e.muted=!1}),I)B(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function n(){const r=`${ut(e.currentTime)} / ${ut(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;St(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e;St(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{X(t,a.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e;St(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{X(t,a.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;St(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.fullscreenWebOn),s=St(t,o.fullscreenWebOff);B(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(X(t,a.get("Exit Web Fullscreen")),B(i,"display","none"),B(s,"display","inline-flex")):(X(t,a.get("Web Fullscreen")),B(i,"display","inline-flex"),B(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:a}=e,i=St(t,o.fullscreenOn),s=St(t,o.fullscreenOff);B(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(X(t,a.get("Exit Fullscreen")),B(i,"display","none"),B(s,"display","inline-flex")):(X(t,a.get("Fullscreen")),B(i,"display","inline-flex"),B(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rGt.get(t).option.selector}),vt(t,"$control_item",{get:()=>Gt.get(t).item}),vt(t,"$control_value",{get:()=>Gt.get(t).value})),Gt.set(t,e)}function Zt(t,e){t.innerHTML=e}function Jt(t,e,r,n,o){const{proxy:a}=t.events,i=z(n),s=r.selector;W(n,"art-control-selector");const l=document.createElement("div");W(l,"art-selector-value"),j(l,r.html),n.textContent="",j(n,l);const c=St(n,'
');for(let d=0;dd(null,null,function*(){if(i.closed)return;const o=nt(n),a=r.selector.find(t=>o.includes(t.$control_item));if(!a)return;const s=++p,c=()=>!i.closed&&s===p,d=i.add(function(t,e){return Xt.set(t,e),()=>{Xt.get(t)===e&&Xt.delete(t)}}(n,c));try{if(e(a),i.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,a,a.$control_item,n);c()&&Zt(l,e)}}catch(u){console.warn("ArtPlayer selector failed:",u)}finally{d()}}));o.push(u)}class Qt extends Dt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;S(t,n);const{on:o}=M(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=K(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(Y(r,"art-hide-cursor"),W(r,"art-hover"),this.timer=Date.now()):(W(r,"art-hide-cursor"),Y(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=z(e),{on:a}=M(t,e),i=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(a("resize",i),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(i);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(i);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}i()}(t)}init(){Ut(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:it(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Zt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function te(t,e,r,n){const o=e-n,a=r-t;let i=0;if(Math.abs(a)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(a,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}function ee(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const re=new WeakMap;class ne{constructor(t){this.destroyEvents=new Set;const e=$(t);re.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function a(e){K(e,n)?(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",a),t.on("document:contextmenu",a);let i=[];e.proxy(o,"click",e=>{const n=Date.now();i.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:a,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>n-t<=a);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&&st(t.toggle()):st(t.toggle()),i=c;break;case 2:t.emit("dblclick",e),I?!t.isLock&&s&&st(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=>{W(r,"art-hover"),t.emit("hover",!0,e)},e=>{Y(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let a=()=>{};const i=()=>{a(),a=Yt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>i()),t.on("window:resize",()=>i()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>i())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,a=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&Bt(t,e),a=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&a&&t.duration){const{pageX:n,pageY:a}=e.touches[0],c=te(i,s,n,a),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=dt((n-i)/t.width,-1,1),d=dt((a-s)/t.height,-1,1),p=t.isRotate?d:c,u=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=dt(l+t.duration*p*u,0,t.duration);t.seek=h,t.emit("setBar","played",dt(h/t.duration,0,1),e),t.notice.show=`${ut(h)} / ${ut(t.duration)}`}}},p=()=>{a&&(i=0,s=0,l=0,a=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Tt(()=>{t.emit("view",G(n,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"],n=["resize","scroll","orientationchange"],o=[];function a(a={}){for(let t=0;t{const n=a.document||i.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=a.window||(null==(n=i.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}a(),e.bindGlobalEvents=a}(t,this),ee(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(re.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 oe{constructor(t){this.art=t,this.keys={},I||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",()=>{st(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class le{constructor(t){const e=l(l({},se),t.option.icons);for(const r in e)vt(this,r,{get:()=>Q(r,e[r])})}}class ce extends Dt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let a=()=>{};const i=D("[data-video]",r)||[];this.art.on("destroy",()=>a());const s=$(this.art);!function t(){for(let e=0;e{B(o,"display","none"),B(a,"display",null)}),n.proxy(e.$state,"click",()=>st(t.play()))}}class he{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,W(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",Y(r,"art-notice-show")},e.NOTICE_TIME)):Y(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function fe(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function me(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const ge=new WeakMap,ve=new WeakMap,ye=new WeakMap;function be(t){return ye.get(t)||$(t)}function we(t){const e=ge.get(t),r=ye.get(t);return()=>ge.get(t)===e&&(!e||e.active())&&ye.get(t)===r&&(!r||!r.closed)}function xe(t){const e=ye.get(t),r=$(t).child(),n=r.child();ye.set(t,r),r.add(()=>{ye.get(t)===r&&ye.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&ge.get(t)===o};return ge.set(t,o),n.add(()=>{ge.get(t)===o&&ge.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function ke(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function $e(t,e,r){ve.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{ve.get(t)===e&&(ve.delete(t),ke(e))}}function Ee(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Te(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:a}}=t;let i,s=be(t),l=0;return{reset(){l=0,null==i||i.dispose(),Y(a,"art-error")},loadStart(){Y(a,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=be(t);if(d!==s&&(s=d,l=0),i&&!i.closed)return;const p=d.child();i=p,p.add(()=>{i===p&&(i=void 0)});const u=()=>!E(t)&&!p.closed&&d===be(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Ce(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Te(t);!function(t,e){fe(t,"video:canplay",()=>{e.reset(),me(t,[["loading",!1]])}),fe(t,"video:canplay",()=>{me(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;fe(t,"video:ended",()=>{if(e.loop){const e=we(t);if(t.seek=0,E(t)||!e())return;st(t.play()),e()&&me(t,[["controls",!1],["mask",!1]],e)}else me(t,[["controls",!0],["mask",!0]])})}(t),fe(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;fe(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&me(t,[["loading",!1],["controls",!0],["mask",!0]])}),fe(t,"video:loadstart",()=>{e.loadStart(),me(t,[["loading",!0],["mask",!1],["controls",!0]])}),fe(t,"video:pause",()=>{me(t,[["controls",!0],["mask",!0]])}),fe(t,"video:play",()=>{me(t,[["mask",!1]]),E(t)||B(r,"display","none")}),fe(t,"video:playing",()=>me(t,[["mask",!1]])),fe(t,"video:progress",()=>{t.playing&&me(t,[["loading",!1]])}),fe(t,"video:seeked",()=>me(t,[["loading",!1],["mask",!0]])),fe(t,"video:seeking",()=>me(t,[["loading",!0],["mask",!1]])),fe(t,"video:timeupdate",()=>me(t,[["mask",!1]])),fe(t,"video:waiting",()=>me(t,[["loading",!0],["mask",!1]]))}(t,e)}const Se=[["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"]],ze=(()=>{if("undefined"===typeof document)return!1;const t=Se[0],e={};for(const r of Se){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Le={change:ze.fullscreenchange,error:ze.fullscreenerror},Me={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Me.off("change",o),r()};Me.on("change",o);const a=t[ze.requestFullscreen](e);a instanceof Promise&&a.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Me.isFullscreen)return void t();const r=()=>{Me.off("change",r),t()};Me.on("change",r);const n=document[ze.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Me.isFullscreen?Me.exit():Me.request(t,e),onchange(t){Me.on("change",t)},onerror(t){Me.on("error",t)},on(t,e){const r=Le[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Le[t];r&&document.removeEventListener(r,e,!1)},raw:ze};function Pe(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,a=t=>{Me.on("change",()=>{t.emit("fullscreen",Me.isFullscreen),Me.isFullscreen?(t.state="fullscreen",W(o,"art-fullscreen")):Y(o,"art-fullscreen"),t.emit("resize")}),Me.on("error",e=>{t.emit("fullscreenError",e)}),vt(t,"fullscreen",{get:()=>Me.isFullscreen,set(t){return d(this,null,function*(){t?yield Me.request(o):yield Me.exit()})}})};t.once("video:loadedmetadata",()=>{var o;Me.isEnabled?a(t):n.webkitSupportsFullscreen?((o=t).on("document:webkitfullscreenchange",()=>{o.emit("fullscreen",o.fullscreen),o.emit("resize")}),vt(o,"fullscreen",{get:()=>document.fullscreenElement===n,set(t){t?(o.state="fullscreen",n.webkitEnterFullscreen()):n.webkitExitFullscreen()}})):vt(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),vt(t,"fullscreen",wt(t,"fullscreen"))})}function Ae(t){const{icons:e,proxy:r,storage:n,template:{$player:o,$video:a}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(Y(o,"art-mini"),B(e,"display","none"),o.prepend(a),t.emit("mini",!1))}function d(e,r){t.playing?(B(e,"display","none"),B(r,"display","flex")):(B(e,"display","flex"),B(r,"display","none"))}function p(){const{$mini:e}=t.template,r=et(e),o=window.innerHeight-r.height-50,a=window.innerWidth-r.width-50;n.set("top",o),n.set("left",a),B(e,"top",`${o}px`),B(e,"left",`${a}px`)}vt(t,"mini",{get:()=>F(o,"art-mini"),set(u){if(u){t.state="mini",W(o,"art-mini");const u=function(){const{$mini:o}=t.template;if(o)return j(o,a),B(o,"display","flex");{const o=J("div");W(o,"art-mini-popup"),j(document.body,o),t.template.$mini=o,j(o,a);const p=j(o,'
');j(p,e.close),r(p,"click",c);const u=j(o,'
'),h=j(u,e.play),f=j(u,e.pause);return r(h,"click",()=>st(t.play())),r(f,"click",()=>t.pause()),d(h,f),t.on("video:playing",()=>d(h,f)),t.on("video:pause",()=>d(h,f)),t.on("video:timeupdate",()=>d(h,f)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){W(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;B(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,Y(o,"art-mini-dragging");const t=et(o);n.set("left",t.left),n.set("top",t.top),B(o,"left",`${t.left}px`),B(o,"top",`${t.top}px`),B(o,"transform",null)}}),o}}(),h=n.get("top"),f=n.get("left");"number"===typeof h&&"number"===typeof f?(B(u,"top",`${h}px`),B(u,"left",`${f}px`),G(u)||p()):p(),t.emit("mini",!0)}else c()}})}function Oe(t){const{i18n:e,notice:r,template:{$video:n}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:n}=t;e.disablePictureInPicture=!1,vt(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw n.show=t,t})):document.exitPictureInPicture().catch(t=>{throw n.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):n.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),vt(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):vt(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Re(t){vt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,a=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==a?void 0:a.html)||"",selector:e,onSelect(e,r,a){return d(this,null,function*(){const r=function(t){return t&&Xt.get(t)||(()=>!0)}(a);if(yield t.switchQuality(e.url),!E(t)&&r()){const a=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=a)}return e.html})}})}})}function Ie(t,e,r,n,o=!0){let a,i=!1;const s=e=>{t.closed||i||(o&&(i=!0,a()),n(e))};return e[o?"once":"on"](r,s),a=t.add(()=>{e.off(r,s)}),s}function _e(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const a=xe(t),i=a.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,a.onError=void 0,a.onAssigned=void 0,i.dispose(),t?o(e):n(),t&&a.scope.dispose())};i.add(()=>{l()});const c=()=>!s&&a.active(),p=t=>l(!0,t);a.onError=p;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const u=i.child(),h={"video:error":p,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){p(e)}},"video:canplay":()=>{if(!c())return;u.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(p)}},f=i.child(),m=[],g=Object.keys(h);for(const e of g)Ie(f,t,e,t=>{a.acceptingEvents&&m.push([e,t])},!1);if($e(t,a,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=Ie(u,t,e,h[e]);for(const[t,e]of m){if(!c()||u.closed)break;r[t](e)}m.length=0};a.assigned?v():a.onAssigned=v}catch(u){p(u)}})}function Ve(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,a=!1,i=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:p,scale:u}=e.thumbnails;if(!d||!p)return;if("hover"===o||"played"===o&&l&&I){if(i||a||(a=!0,i=yield rt(p,u),a=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?B(s,"left",r.clientWidth-h+"px"):B(s,"left",o-h/2+"px")}(o)}})),vt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,a=!1,i=null)}})}function Ne(t){const{option:e,template:{$video:r}}=t;vt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=ve.get(t);return ve.delete(t),e||xe(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield Ft(o.scope))&&o.active()&&(t.loading.show=!0));const a=t.url,i=e.type||lt(n),s=e.customType[i];if(i&&s){if(!(yield Ft(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;Ie(l,t,"video:canplay",()=>{c=!d}),Ie(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,i&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Ee(o,t))}else{if(a&&URL.revokeObjectURL(a),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(a!==t.url&&(t.option.url=n,o.active()&&t.isReady&&a)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||Ie(o.scope,t,"video:canplay",e)}}catch(a){Ee(o,a)}finally{ke(o)}})}})}Object.defineProperties(Me,{isFullscreen:{get:()=>Boolean(document[ze.fullscreenElement])},element:{enumerable:!0,get:()=>document[ze.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[ze.fullscreenEnabled])}});class De{constructor(t){Ne(t),function(t){const{template:{$video:e}}=t;vt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:a}}=t;vt(t,"play",{value(){return d(this,null,function*(){const i=we(t),s=yield a.play();if(!i())return s;const l=e.get("Play");if(!i())return s;if(r.show=l,!i())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;vt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${ut(t.currentTime)} / ${ut(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;vt(t,"forward",{set(e){r.seek=t.currentTime+e}}),vt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;vt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=dt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),vt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;vt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=dt(n,0,t.duration))}})}(t),function(t){vt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>_e(t,e,0);vt(t,"switchQuality",{value:e=>_e(t,e,t.currentTime)}),vt(t,"switchUrl",{value:e}),vt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;vt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;vt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(a){if(a||(a="default"),"default"===a)B(n,"width",null),B(n,"height",null),B(n,"margin",null),delete o.dataset.aspectRatio;else{const t=a.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(B(n,"width",s*r+"px"),B(n,"height","100%"),B(n,"margin","0 auto")):(B(n,"width","100%"),B(n,"height",e/s+"px"),B(n,"margin","auto 0")),o.dataset.aspectRatio=a}r.show=`${e.get("Aspect Ratio")}: ${"default"===a?e.get("Default"):a}`,t.emit("aspectRatio",a)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=J("canvas");vt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(a){e.show=a,o(a)}})}),vt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(a){e.show=a,o(a)}})}),vt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return ct(n,`${e||`artplayer_${ut(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Pe(t),function(t){const{constructor:e,template:{$container:r,$player:n}}=t;let o="";vt(t,"fullscreenWeb",{get:()=>F(n,"art-fullscreen-web"),set(a){a?(o=n.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&j(document.body,n),t.state="fullscreenWeb",B(n,"width","100%"),B(n,"height","100%"),W(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&j(r,n),o&&(n.style.cssText=o,o=""),Y(n,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),Oe(t),function(t){const{$video:e}=t.template,r=t;vt(t,"loaded",{get:()=>r.loadedTime/e.duration}),vt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){vt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;vt(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:n}=t.template;vt(t,"autoSize",{value(){const{videoWidth:o,videoHeight:a}=n,{width:i,height:s}=et(e),l=o/a;if(i/s>l)B(r,"width",s*l/i*100+"%"),B(r,"height","100%");else{const t=i/l/s*100;B(r,"width","100%"),B(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){const e=t;vt(t,"rect",{get:()=>et(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}vt(t,"x",{get:()=>e.left+window.pageXOffset}),vt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;vt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(pt(o))}`,t.emit("flip",o)}})}(t),Ae(t),function(t){const{template:{$poster:e}}=t;vt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){B(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;vt(t,"autoHeight",{value(){const{clientWidth:n}=e,{videoHeight:o,videoWidth:a}=r,i=o*(n/a);B(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;vt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){vt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){vt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];vt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":a=!0;break;case"not-available":a=!1}}):a=!1,vt(t,"airplay",{value(){a?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),Re(t),Ve(t),Ce(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=dt(e.volume,0,1));const a=r.get("volume");"number"===typeof a&&(n.volume=dt(a,0,1)),e.poster&&B(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["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 We(t){const{notice:e,constructor:r,template:{$player:n,$video:o}}=t,a="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,n=document.documentElement.clientHeight;return t>e&&rn}return t.on("fullscreenWeb",e=>{var o;if(e){if(l()){const e=Number(null!=(o=r.AUTO_ORIENTATION_TIME)?o:0);setTimeout(()=>{t.fullscreenWeb&&!F(n,a)&&function(){const e=ot(),r=document.documentElement.clientWidth,o=document.documentElement.clientHeight-e.top-e.bottom,i=r-e.left-e.right;B(n,"width",`${o}px`),B(n,"height",`${i}px`),B(n,"transform-origin","0 0"),B(n,"transform",`rotate(90deg) translate(${e.top}px, -${r-e.right}px)`),W(n,a),t.isRotate=!0,t.emit("resize")}()},e)}}else F(n,a)&&(B(n,"width",""),B(n,"height",""),B(n,"transform-origin",""),B(n,"transform",""),Y(n,a),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",t=>d(null,null,function*(){var r;const o=!!(null==(r=null==screen?void 0:screen.orientation)?void 0:r.lock);if(t){if(o&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";yield screen.orientation.lock(t),s=!0,W(n,i)}catch(a){s=!1,e.show=a}}else if(F(n,i)&&Y(n,i),o&&s){try{screen.orientation.unlock()}catch(c){}s=!1}})),{name:"autoOrientation",get state(){return F(n,a)}}}function Ye(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:a,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=N(".art-auto-playback-last",s),c=N(".art-auto-playback-jump",s),d=N(".art-auto-playback-close",s);j(d,r.close);let p=null;function u(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),B(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(B(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${ut(r)}`,c.textContent=e.get("Jump Play"),a(d,"click",()=>{B(s,"display","none")}),a(c,"click",()=>{t.seek=r,st(t.play()),B(i,"display","none"),B(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{B(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",u),t.on("restart",u),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function Fe(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let a=null,i=!1,s=1;const l=()=>{clearTimeout(a),i&&(i=!1,t.playbackRate=s,Y(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(a=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,W(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return F(n,"art-fast-forward")}}}function je(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return F(n,"art-lock")}function a(){W(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){Y(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=j(e,r.lock),o=j(e,r.unlock);B(n,"display","none"),t.on("lock",t=>{t?(B(n,"display","inline-flex"),B(o,"display","none")):(B(n,"display","none"),B(o,"display","inline-flex"))})},click(){o()?i():a()}}),{name:"lock",get state(){return o()},set state(t){t?a():i()}}}function Be(t){return t.on("control",e=>{e?Y(t.template.$player,"art-mini-progress-bar"):W(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class He{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(Be),!E(t.art)&&e.lock&&I&&t.add(je),E(t.art)||!e.autoPlayback||e.isLive||t.add(Ye),!E(t.art)&&e.autoOrientation&&I&&t.add(We),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(Fe)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){it(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const a=bt(t,o);if(E(t.art))return t;const i=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(it(!a,i),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||vt(t,o,{value:r})),t}(this,t,e)}}const qe=new WeakMap;function Ue(t){return!t.closed&&!qe.get(t)}function Xe(t){qe.set(t,(qe.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(qe.get(t)||1)-1;r?qe.set(t,r):qe.delete(t)}}const Ge=new WeakMap,Ke=new WeakMap,Ze=["$parent","$parents","$option","$events","$formatted"];function Je(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Ge.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Ge.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function Qe(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function tr(t){const e=Ge.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function er(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>lr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...a.splice(0)),sr.set(r,o),ar.set(e,r),ir.set(e,n)),i(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{i()}}}}}function hr(t,e,r,n,o,a){const i=a||dr(e);if(!Ue(i)||E(t))return;const s=t.proxy(r,n,e=>{if(Ue(i)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Ue(i)||E(t)?t.events.remove(s):(tr(e).events.push(s),a&&a!==ar.get(e)&&a.add(()=>{const r=tr(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function fr(t,e,r,n){const o=dr(e);if(!Ue(o)||E(t))return;const a=(...e)=>{if(Ue(o)&&!E(t))return n(...e)};t.on(r,a),o.add(()=>{t.off(r,a)})}function mr(t){var e,r;const{art:n,active:o}=t,{controls:a,constructor:{SETTING_WIDTH:i,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!a.setting||!t.show||!o)return;const p=l.getBoundingClientRect(),u=a.setting.getBoundingClientRect(),h=p.width/l.offsetWidth||1,f=(u.left-p.left+u.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:a,controlCenter:i,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*a),Math.max(0,r-s-c)),left:Math.max(c,Math.min(i-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||i,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const gr=new WeakMap;function vr(t){gr.delete(t)}const yr=new WeakMap;function br(t,e){e?yr.set(t,e):yr.delete(t)}function wr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=yr.get(t),a=null==o?void 0:o();for(const i of["html","icon","tooltip"]){const t=null==(e=r.get(i))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,i;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==a||a(),br(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(i=t.parentNode)||i.removeChild(t)}}const xr=new WeakMap;function kr(t,e,r,n,o,a,i,s){return d(this,null,function*(){try{const l=dr(e),c=dr(a),d=(xr.get(a)||0)+1;xr.set(a,d);const p=()=>Ue(l)&&Ue(c)&&!E(t.art)&&xr.get(a)===d;if(null==s||s(),!p())return;const u=yield o.call(t.art,e,r,n);p()&&Reflect.set(a,i,u)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function $r(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const Er=new WeakMap;function Tr(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function Cr(t){var e;null==(e=Er.get(t))||e()}function Sr(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);vr(r),Cr(r);const n=wr(r),o=r.$item,a=null==o?void 0:o.parentNode,i=null==o?void 0:o.nextSibling,s=o?$r(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const a=[],i=[];try{for(const e of r){const r=ur(t.art,e);r&&a.push(r)}for(const t of n)i.push(Xe(nr(t)))}catch(l){try{Tr([...a.reverse().map(t=>t.resume),...i])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,Tr([...a.reverse().map(t=>t.resume),...i]))},dispose(){s&&(s=!1,Tr([...a.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>or(t)),...i]))}}}(t,r);let p=!0,u=!1;const h=()=>{if(!p)return;p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{Tr([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{a&&o&&a.insertBefore(o,(null==i?void 0:i.parentNode)===a?i:null)},()=>t.format(),()=>{if(u){t.active=l,l&&t.cache.has(l)&&U(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>p&&!E(t.art)&&Er.get(r)===h;for(const v of d.items)Er.set(v,h);const m=$(t.art).add(()=>{p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const a=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,a))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(u=!0,t.render(),!f())return r;p=!1;for(const t of d.items)Er.get(t)===h&&Er.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const zr=new WeakMap;function Lr(t,e,r){vt(t,`$${e}`,{configurable:!0,get:()=>r}),vt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",j(r,t)}})}function Mr(t,e,r=!1){var n,o;const a=function(t){const e=Er.get(t);return()=>!e||Er.get(t)===e}(e);if(!t.cache.has(e.$option))return;const i=t.cache.get(e.$option),s=e.$item;let l="selector";bt(e,"switch")&&(l="switch"),bt(e,"range")&&(l="range"),bt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!a())return;const p=function(t,e,r=$(t)){const n=ar.get(e);(!n||Ue(n)||n.closed)&&pr(t,e);const o=r.child();return ar.set(e,o),ir.set(e,r),sr.set(o,tr(e).events),o.add(()=>{lr(t,sr.get(o))}),o}(t.art,e,nr(i)),u=()=>Ue(p)&&!E(t.art)&&a();if(!u())return;const h=document.createElement("div");try{if(br(e),W(h,"art-setting-item"),B(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!u())return;const a=j(h,'
'),f=j(h,'
'),m=document.createElement("div");switch(W(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!u())return;j(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!u())return;j(m,t)}else j(m,c.check)}if(j(a,m),!u())return;Lr(e,"icon",m);const g=document.createElement("div");W(g,"art-setting-item-left-text");const v=e.html||"";if(!u())return;j(g,v),j(a,g),Lr(e,"html",g);const y=document.createElement("div");W(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!u())return;switch(j(y,b),j(f,y),Lr(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");W(t,"art-setting-item-right-icon");const r=j(t,c.switchOn),n=j(t,c.switchOff),o=e.switch;if(!u())return;B(o?n:r,"display","none"),j(f,t),vt(e,"$switch",{configurable:!0,get:()=>t});let a=e.switch;if(!u())return;br(e,()=>{const t=a;return()=>{a=t}}),vt(e,"switch",{configurable:!0,get:()=>a,set(t){a=t,t?(B(n,"display","none"),B(r,"display",null)):(B(n,"display",null),B(r,"display","none"))}});break}case"range":{const t=document.createElement("div");W(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",j(t,r);for(const[o,a]of["value","min","max","step"].entries()){const t=e.range[o];if(!u())return;Reflect.set(r,a,String(t))}W(r,"art-setting-range"),j(f,t),vt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!u())return;br(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),vt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");W(t,"art-setting-item-right-icon"),j(t,c.arrowRight),j(f,t)}}if(!u())return;if(function(t,e,r,n){const{art:o}=t,a=dr(e),i=(t,r,n)=>hr(o,e,t,r,n,a);switch(n){case"switch":e.onSwitch&&i(r,"click",n=>kr(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,a]of[["change","onRange"],["input","onChange"]])e[a]&&i(n,o,o=>kr(t,e,r,o,e[a],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":i(r,"click",n=>{var o,a;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(a=e.$parent)?void 0:a.onSelect)return kr(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&W(r,"art-current");break;case"button":e.onClick&&i(r,"click",n=>kr(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!u())return;vt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):j(i,h),e.mounted&&u()&&Yt(p,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{p.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function Pr(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Ue(nr(n)))return;const o=(zr.get(t)||0)+1;zr.set(t,o);const a=()=>zr.get(t)===o&&!E(t.art),i=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=i,i&&t.cache.has(i)&&U(t.cache.get(i),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{U(n,"art-current"),t.resize()}catch(c){throw a()&&t.cache.get(e)===n&&!nr(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return rr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),i=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!i())return;W(n,"art-setting-panel"),j(t.$parent,n),U(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Ke.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=K(r,e.controls.setting),o=K(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},a=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(a)});const{$player:i,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(i),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(i,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function a(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:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:a(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:a(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function a(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:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:a(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:a(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function a(t){return e.get(pt(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:a(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:a(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{i(),fr(t,r,"flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{fr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){er(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&U(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const a=Ke.get(t)||{active:!0},i=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;otr(t).parent},$parents:{get:()=>tr(t).parents},$option:{get:()=>tr(t).option},$events:{get:()=>tr(t).events},$formatted:{get:()=>!0}}),Ge.set(t,{parent:r,parents:n,option:o,events:(null==i?void 0:i.events)||[],owner:a}),p.generated&&(t.name=e)}for(const p of i)p.generated||o.push(p.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return er(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){mr(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&or(n)}catch(a){r.push(a)}}try{pr(t.art,e)}catch(a){a instanceof y?r.push(...a.errors):r.push(a)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);it(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{vr(t),Cr(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const i of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{i()}catch(a){a instanceof y?o.push(...a.errors):o.push(a)}if(o.length)throw new y(o)}update(t){return Sr(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,a=n?void 0:function(t){const e={};gr.set(t,e);const r=()=>gr.get(t)===e;return{current:r,finish(){r()&&gr.delete(t)}}}(t);let i=!1;try{e.push(t),this.format(),i=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||a&&!a.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&i){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==a||a.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,a=document.createElement("div");B(a,"height",`${o}px`),W(a,"art-setting-item"),W(a,"art-setting-item-back");const i=j(a,'
'),s=document.createElement("div");W(s,"art-setting-item-left-icon"),j(s,n),j(i,s),j(i,e.$parent.html),hr(t.art,e.$parent,a,"click",()=>t.render(e.$parents),nr(r)),j(r,a)}(this,t)}createItem(t,e=!1){Mr(this,t,e)}render(t=this.option){Pr(this,t)}}class Rr{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const Ir='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class _r{constructor(t){var e;this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=null==(e=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope))?void 0:e.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}run(t){return d(this,null,function*(){if(this.active)try{return yield Promise.race([t(),this.cancelled])}finally{this.cancel()}})}}const Vr=new WeakMap;function Nr(t){return Vr.get(t)}function Dr(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const Wr=Dt;class Yr extends Wr{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=$(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return Vr.set(t,n),r.add(()=>{Dr(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[0]}get activeCues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.activeCues)||[])}get cues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.cues)||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?H(r,t):B(r,t,e)}update(){!function(t){const e=Nr(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:a}=t,{$subtitle:i}=a.template;if(i.innerHTML="",!t.activeCues.length)return;if(a.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${a.option.subtitle.escape?gt(t):t}\n
`).join("")).join("");o()&&(i.innerHTML=s,a.emit("subtitleAfterUpdate",t.activeCues))}(this)}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,a=c(l(l({},o.subtitle),e),{url:t}),i=Nr(this),s=i.revision+1,d=yield this.init(a);return!i.scope.closed&&i.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),d})}createTrack(t,e){!function(t,e,r){const n=Nr(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:a}=t,{template:i}=a,s=i.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),p=n.scope.child();p.add(()=>{d.onload=null,d.onerror=null});let u=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=a.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{p.closed||i.$track!==d||a.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{p.closed||i.$track!==d||(a.notice.show=new Error("Failed to load subtitle track"))},p.closed||n.trackRevision!==o)return void p.dispose();s.remove(),i.$video.appendChild(d),i.$track=d;const l=t.textTrack,c=l?a.proxy(l,"cuechange",()=>{p.closed||i.$track!==d||t.update()}):()=>{};if(p.add(()=>{a.events.remove(c)}),p.closed||n.trackRevision!==o)return p.dispose(),void d.remove();const h=n.track;n.track=p,t.destroyEvent=c,s.onload=null,s.onerror=null,u=!0;try{null==h||h.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&Dr(n)}}catch(h){if(u)throw h;if(p.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw i.$track=s,l&&l.insertBefore(s,(null==c?void 0:c.parentNode)===l?c:null),h}}(this,t,e)}init(t){return d(this,null,function*(){const e=Nr(this),r=function(t){const e=t.request,r=new _r(t.scope);return t.request=r,t.revision+=1,null==e||e.cancel(),r}(e),{notice:n,template:{$subtitle:o}}=this.art;return r.run(()=>d(this,null,function*(){if(!this.textTrack)return null;if(m(t,Vt.subtitle),!t.url)return;let a;this.option=t,this.style(t.style);try{if(!r.active)return;const n=yield fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const i=yield n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||lt(e.url)){case"srt":return{vtt:e.onVttLoad(kt(r))};case"ass":return{vtt:e.onVttLoad(Et(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(i,t);if(!r.active)return;const l=void 0===s?t.url:a=$t(s.vtt);if(!r.active)return;o.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return a&&(e.ownedURL=a,a=void 0),l}catch(i){if(!r.active)return;throw o.innerHTML="",n.show=i,i}finally{a&&(e.scope.closed||this.url!==a?URL.revokeObjectURL(a):e.ownedURL=a)}}))})}}const Fr=`\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
${g}
\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 `;class jr{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=N(e.container),it(this.$container,`No container element found by ${e.container}`)),it(tt(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();it("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),it(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,$r(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return Fr}query(t){return N(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=jr.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){it(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),Z(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&W(this.$player,"art-backdrop"),I&&W(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":W(this.$player,"art-destroy")}}const Br=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class Hr{on(t,e,r){const n=this.e||(this.e={});let o=Br(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let a=!1;function i(...e){a||(a=!0,n.off(t,i),o.apply(r,e))}return i._=e,this.on(t,i,r)}emit(t,...e){const r=this.e||(this.e={}),n=(Br(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=Br(r,t)?r[t]:void 0,o=[];if(n&&e)for(let a=0,i=n.length;ae.call(this,this)),Xr.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Xr.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&Ur.push(this)}catch(n){try{T(this,Ur,!0,Xr.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return Ur}static get version(){return g}static get config(){return v}static get utils(){return Ct}static get scheme(){return Vt}static get Emitter(){return Hr}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return jr.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,Ur,t,Xr.REMOVE_SRC_WHEN_DESTROY)}}return Xr.STYLE=Ir,Xr.DEBUG=!1,Xr.CONTEXTMENU=!0,Xr.NOTICE_TIME=2e3,Xr.SETTING_WIDTH=250,Xr.SETTING_ITEM_WIDTH=200,Xr.SETTING_ITEM_HEIGHT=35,Xr.RESIZE_TIME=200,Xr.SCROLL_TIME=200,Xr.SCROLL_GAP=50,Xr.AUTO_PLAYBACK_MAX=10,Xr.AUTO_PLAYBACK_MIN=5,Xr.AUTO_PLAYBACK_TIMEOUT=3e3,Xr.RECONNECT_TIME_MAX=5,Xr.RECONNECT_SLEEP_TIME=1e3,Xr.CONTROL_HIDE_TIME=3e3,Xr.DBCLICK_TIME=300,Xr.DBCLICK_FULLSCREEN=!0,Xr.MOBILE_DBCLICK_PLAY=!0,Xr.MOBILE_CLICK_PLAY=!1,Xr.AUTO_ORIENTATION_TIME=200,Xr.INFO_LOOP_TIME=1e3,Xr.FAST_FORWARD_VALUE=3,Xr.FAST_FORWARD_TIME=1e3,Xr.TOUCH_MOVE_RATIO=.5,Xr.VOLUME_STEP=.1,Xr.SEEK_STEP=5,Xr.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Xr.ASPECT_RATIO=["default","4:3","16:9"],Xr.FLIP=["normal","horizontal","vertical"],Xr.FULLSCREEN_WEB_IN_BODY=!0,Xr.LOG_VERSION=!0,Xr.USE_RAF=!1,Xr.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Xr,V("artplayer-style",Ir),setTimeout(()=>{Xr.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Xr.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Xr}); +!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";var t,e=Object.defineProperty,r=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,l=(t,e)=>{for(var r in e||(e={}))i.call(e,r)&&s(t,r,e[r]);if(o)for(var r of o(e))a.call(e,r)&&s(t,r,e[r]);return t},c=(t,e)=>r(t,n(e)),d=(t,e,r)=>new Promise((n,o)=>{var i=t=>{try{s(r.next(t))}catch(e){o(e)}},a=t=>{try{s(r.throw(t))}catch(e){o(e)}},s=t=>t.done?n(t.value):Promise.resolve(t.value).then(i,a);s((r=r.apply(t,e)).next())});function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p,h={exports:{}};var f=(p||(p=1,h.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"===n(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(n(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 n(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2{e&&(e=!1,this.cleanups.delete(r),t())};return this.closed?r():this.cleanups.add(r),r}child(){const t=new b,e=this.add(()=>{t.dispose()});return t.add(()=>{e()}),t}dispose(){if(this.closed)return;this.disposed=!0;const t=[];for(const r of Array.from(this.cleanups).reverse())try{r()}catch(e){e instanceof y?t.push(...e.errors):t.push(e)}if(t.length)throw new y(t)}}const w=new WeakMap,x=new WeakMap;function k(t){const e=w.get(t);if(!e)throw new Error("ArtPlayer lifecycle has not been initialized");return e}function $(t){return k(t).scope}function E(t){const e=k(t);return e.destroying||e.scope.closed}function T(t,e,r,n,o=!1){var i,a,s;const l=k(t);if(l.destroying||l.scope.closed)return;l.destroying=!0;const c=[],d=t=>{try{t()}catch(e){c.push(...e instanceof y?e.errors:[e])}};n&&(null==(i=t.template)?void 0:i.$video)&&d(()=>t.reset()),d(()=>l.scope.dispose()),d(()=>{var e;return null==(e=t.template)?void 0:e.destroy(r)});const u=e.indexOf(t);-1!==u&&e.splice(u,1),t.isDestroy=!0,o||(null==(a=l.releaseContainer)||a.call(l),l.releaseContainer=void 0),d(()=>t.emit("destroy")),o&&l.rollback&&d(l.rollback),l.rollback=void 0,null==(s=l.releaseContainer)||s.call(l),l.releaseContainer=void 0;for(const p of c.slice(1))console.warn("Additional ArtPlayer cleanup failure:",p);if(c.length)throw c[0]}const C=new WeakMap;function L(t,e){const r=$(t).child();return C.set(e,r),r}function S(t){const e=C.get(t);if(!e)throw new Error("ArtPlayer component has not been registered");return e}function P(t){var e;null==(e=C.get(t))||e.dispose()}function M(t,e){return{on:(r,n)=>{!function(t,e,r,n){const o=S(e);if(o.closed)return;const i=(...t)=>{if(!o.closed)return n(...t)};t.on(r,i),o.add(()=>{t.off(r,i)})}(t,e,r,n)},proxy:(r,n,o)=>function(t,e,r,n,o){const i=S(e);if(i.closed)return()=>{};const a=t.events.proxy(r,n,t=>{if(!i.closed)return o(t)});return i.add(()=>{t.events.remove(a)})}(t,e,r,n,o)}}const z=null!=(t=null==globalThis?void 0:globalThis.CUSTOM_USER_AGENT)?t:"undefined"!==typeof navigator?navigator.userAgent:"",A=/^(?:(?!chrome|android).)*safari/i.test(z),O=/iPad|iPhone|iPod/i.test(z)&&!window.MSStream,R=O||z.includes("Macintosh")&&navigator.maxTouchPoints>=1,I=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(z)||R,_="undefined"!==typeof window&&"undefined"!==typeof document;function N(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 D(t,e=document){return e.querySelector(t)}function W(t,e=document){return Array.from(e.querySelectorAll(t))}function F(t,e){return t.classList.add(e)}function V(t,e){return t.classList.remove(e)}function Y(t,e){return t.classList.contains(e)}function B(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function H(t,e,r){return t.style[e]=r,t}function j(t,e){for(const r in e)H(t,r,e[r]);return t}function q(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function U(t,e){q(t).forEach(t=>V(t,e)),F(t,e)}function X(t,e,r="top"){I||(t.setAttribute("aria-label",e),F(t,"hint--rounded"),F(t,`hint--${r}`))}function G(t,e=0){const r=t.getBoundingClientRect(),n=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=r.top-e<=n&&r.top+r.height+e>=0,a=r.left-e<=o+e&&r.left+r.width+e>=0;return i&&a}function K(t,e){return nt(t).includes(e)}function Z(t,e){return e.parentNode.replaceChild(t,e),t}function J(t){return document.createElement(t)}function Q(t="",e=""){const r=J("i");return F(r,"art-icon"),F(r,`art-icon-${t}`),B(r,e),r}function tt(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function et(t){return t.getBoundingClientRect()}function rt(t,e){return new Promise((r,n)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const i=document.createElement("canvas"),a=i.getContext("2d");i.width=o.width*e,i.height=o.height*e,a.drawImage(o,0,0,i.width,i.height),i.toBlob(e=>{const o=URL.createObjectURL(e),i=new Image;i.onload=function(){r(i)},i.onerror=function(){URL.revokeObjectURL(o),n(new Error(`Image load failed: ${t}`))},i.src=o})}else r(o)},o.onerror=function(){n(new Error(`Image load failed: ${t}`))},o.src=t})}function nt(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}function ot(){const t=document.createElement("div");t.style.cssText="position:fixed;top:env(safe-area-inset-top,0px);right:env(safe-area-inset-right,0px);bottom:env(safe-area-inset-bottom,0px);left:env(safe-area-inset-left,0px);pointer-events:none;visibility:hidden;",document.body.appendChild(t);const e=getComputedStyle(t),r={top:Number.parseFloat(e.top)||0,right:Number.parseFloat(e.right)||0,bottom:Number.parseFloat(e.bottom)||0,left:Number.parseFloat(e.left)||0};return t.remove(),r}class it extends Error{constructor(t,e){super(t),"captureStackTrace"in Error&&"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function at(t,e){if(!t)throw new it(e);return t}function st(t){const e=t;return e&&"function"===typeof e.catch?e.catch(()=>{}):t}function lt(t){const e=t.search(/[?#]/),r=(e<0?t:t.slice(0,e)).trim().toLowerCase();return r.slice(r.lastIndexOf(".")+1)}function ct(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r);try{r.click()}finally{r.remove()}}function dt(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function ut(t){return t.charAt(0).toUpperCase()+t.slice(1)}function pt(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),n=Math.floor(t-3600*e-60*r);return(e>0?[e,r,n]:[r,n]).map(t=>t<10?`0${t}`:String(t)).join(":")}const ht={"&":"&","<":"<",">":">","'":"'",'"':"""},ft={"&":"&","<":"<",">":">","'":"'",""":'"'},mt=/(&|<|>|'|")/g;function gt(t){return t.replace(/[&<>'"]/g,t=>ht[t]||t)}const vt=Object.defineProperty,{hasOwnProperty:yt}=Object.prototype;function bt(t,e){return yt.call(t,e)}function wt(t,e){return Object.getOwnPropertyDescriptor(t,e)}function xt(...t){const e=t=>!!t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(n=>{const o=t[n],i=r[n];let a;a=Array.isArray(o)&&Array.isArray(i)?o.concat(...i):e(o)&&e(i)?xt(o,i):i,vt(t,n,{value:a,enumerable:!0,configurable:!0,writable:!0})}),t),{})}function kt(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let n=r.slice(0,3);return 1===r.length&&(n=`${r}00`),2===r.length&&(n=`${r}0`),`${e},${n}`})).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 $t(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function Et(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 n=t.match(e);if(!n)return null;const[,o="",i="",,,a=""]=n;return{start:r(o.trim()),end:r(i.trim()),text:a.replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}}).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 Tt(t,e){let r=!1;return function(...n){r||(t.apply(this,n),r=!0,setTimeout(()=>{r=!1},e))}}const Ct=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:it,addClass:F,append:B,assToVtt:Et,capitalize:ut,clamp:dt,createElement:J,debounce:function(t,e){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>(r=void 0,t.apply(this,n)),e)}},def:vt,download:ct,errorHandle:at,escape:gt,get:wt,getComposedPath:nt,getExt:lt,getIcon:Q,getRect:et,getSafeAreaInsets:ot,getStyle:function(t,e,r=!0){const n=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(n):n},has:bt,hasClass:Y,includeFromEvent:K,inverseClass:U,isBrowser:_,isIOS:O,isIOS13:R,isInViewport:G,isMobile:I,isSafari:A,loadImg:rt,mergeDeep:xt,query:D,queryAll:W,remove:function(t){return t.parentNode.removeChild(t)},removeClass:V,replaceElement:Z,secondToTime:pt,setStyle:H,setStyleText:N,setStyles:j,siblings:q,silencePromise:st,sleep:function(t=0){return new Promise(e=>setTimeout(e,t))},srtToVtt:kt,supportsFlex:tt,throttle:Tt,tooltip:X,unescape:function(t){return t.replace(mt,t=>ft[t]||t)},userAgent:z,vttToBlob:$t},Symbol.toStringTag,{value:"Module"}));function Lt(t,e){return B(t,e)}function St(t,e){return e.querySelector(t)}const Pt="array",Mt="boolean",zt="string",At="number",Ot="object",Rt="function";function It(t,e,r){return at(e===zt||e===At||t instanceof Element,`${r.join(".")} require '${zt}' or 'Element' type`)}const _t={html:It,disable:`?${Mt}`,name:`?${zt}`,index:`?${At}`,style:`?${Ot}`,click:`?${Rt}`,mounted:`?${Rt}`,tooltip:`?${zt}|${At}`,width:`?${At}`,selector:`?${Pt}`,onSelect:`?${Rt}`,switch:`?${Mt}`,onSwitch:`?${Rt}`,range:`?${Pt}`,onRange:`?${Rt}`,onChange:`?${Rt}`},Nt={id:zt,container:It,url:zt,poster:zt,type:zt,theme:zt,lang:zt,volume:At,isLive:Mt,muted:Mt,autoplay:Mt,autoSize:Mt,autoMini:Mt,loop:Mt,flip:Mt,playbackRate:Mt,aspectRatio:Mt,screenshot:Mt,setting:Mt,hotkey:Mt,pip:Mt,mutex:Mt,backdrop:Mt,fullscreen:Mt,fullscreenWeb:Mt,subtitleOffset:Mt,miniProgressBar:Mt,useSSR:Mt,playsInline:Mt,lock:Mt,gesture:Mt,fastForward:Mt,autoPlayback:Mt,autoOrientation:Mt,airplay:Mt,proxy:`?${Rt}`,plugins:[Rt],layers:[_t],contextmenu:[_t],settings:[_t],controls:[c(l({},_t),{position:(t,e,r)=>{const n=["top","left","right"];return at("string"===typeof t&&n.includes(t),`${r.join(".")} only accept ${n.toString()} as parameters`)}})],quality:[{default:`?${Mt}`,html:zt,url:zt}],highlight:[{time:At,text:zt}],thumbnails:{url:zt,number:At,column:At,width:At,height:At,scale:At},subtitle:{url:zt,name:zt,type:zt,style:Ot,escape:Mt,encoding:zt,onVttLoad:Rt},moreVideoAttr:Ot,i18n:Ot,icons:Ot,cssVar:Ot,customType:Ot},Dt=new WeakSet;class Wt{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 Y(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):V(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){var e;if(E(this.art))return;const r="function"===typeof t?t(this.art):t;if(E(this.art))return;if(r.html=r.html||"",m(r,_t),!this.$parent||!this.name||r.disable)return;const n=r.name||`${this.name}${this.id}`,o=this.cache;at(!o.has(n),`Can't add an existing [${n}] to the [${this.name}]`),this.id+=1;const i=document.createElement("div"),a=L(this.art,i),s=[],l=Object.getOwnPropertyDescriptor(this,n);let c=!1;a.add(()=>{for(const t of s)this.art.events.remove(t)});try{if(a.closed)return;if(function(t,e,r,n,o,i){F(t,`art-${r}`),F(t,`art-${r}-${n}`);const a=Array.from(e.children);t.dataset.index=String(i.index||o);const s=a.find(e=>Number(e.dataset.index)>=Number(t.dataset.index));s?s.insertAdjacentElement("beforebegin",t):B(e,t),i.html&&B(t,i.html),i.style&&j(t,i.style),i.tooltip&&X(t,i.tooltip)}(i,this.$parent,this.name,n,this.id,r),a.closed)return;if(r.click){const t=this.art.events.proxy(i,"click",t=>{a.closed||(t.preventDefault(),r.click.call(this.art,this,t))});s.push(t)}if(r.selector&&["left","right"].includes(r.position)&&this.selector(r,i,s),a.closed)return;return function(t,e,r){const n=t;"__proto__"===e?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r}(this,n,i),c=!0,o.set(n,{$ref:i,events:s,option:r}),r.mounted&&r.mounted.call(this.art,i),i}catch(d){try{P(i)}catch(u){console.warn("ArtPlayer component cleanup failed:",u)}throw(null==(e=o.get(n))?void 0:e.$ref)===i&&o.delete(n),c&&this[n]===i&&(l?Object.defineProperty(this,n,l):delete this[n]),i.remove(),d}}remove(t){at(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);if(!Dt.has(e)){Dt.add(e);try{e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);try{P(e.$ref)}finally{this.cache.get(t)===e&&(this.cache.delete(t),delete this[t]),e.$ref.remove()}}finally{Dt.delete(e)}}}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 Ft extends Wt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,L(t,this.$parent),I||this.init()}init(){const{option:t,template:{$player:e,$contextmenu:r}}=this.art,{on:n,proxy:o}=M(this.art,r);t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:n}}=e,o=n.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return c(l({},t),{html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.playbackRate=Number(n),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="1"]',t);n&&U(n,"art-current"),r("video:ratechange",()=>{const r=Array.from(t.querySelectorAll("span")).find(t=>Number(t.dataset.value)===e.playbackRate);r&&U(r,"art-current")})}})}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:n}}=e,o=n.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return c(l({},t),{html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.aspectRatio=n,t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="default"]',t);n&&U(n,"art-current"),r("aspectRatio",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:n}}=e,o=n.map(t=>`${r.get(ut(t))}`).join("");return c(l({},t),{html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const n=r.target instanceof HTMLElement?r.target.dataset.value:void 0;n&&(e.flip=n.toLowerCase(),t.show=!1)},mounted:t=>{const{on:r}=M(e,t),n=D('[data-value="normal"]',t);n&&U(n,"art-current"),r("flip",e=>{const r=Array.from(t.querySelectorAll("span")).find(t=>t.dataset.value===e);r&&U(r,"art-current")})}})}}({name:"flip",index:30})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){return c(l({},t),{html:`ArtPlayer ${g}`})}({name:"version",index:50})),this.add(function(t){return e=>c(l({},t),{html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let i=0;i{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const n=t.clientX,o=t.clientY,{height:i,width:a,left:s,top:l}=et(e),{height:c,width:d}=et(r);let u=n-s,p=o-l;n+d>s+a&&(u=a-d),o+c>l+i&&(p=i-c),j(r,{top:`${p}px`,left:`${u}px`})}),o(e,"click",t=>{K(t,r)||(this.show=!1)}),n("blur",()=>{this.show=!1})}}function Vt(t,e,r,n,o={}){const{capture:i=!1,once:a=!1,signal:s}=o;if(t.closed||(null==s?void 0:s.aborted))return()=>{};let l=()=>{};function c(e){a&&l(),t.closed||("function"===typeof n?n.call(this,e):n.handleEvent(e))}return e.addEventListener(r,c,o),l=t.add(()=>{try{e.removeEventListener(r,c,i)}finally{null==s||s.removeEventListener("abort",l)}}),null==s||s.addEventListener("abort",l,{once:!0}),l}function Yt(t,e,r){if(t.closed)return()=>{};let n=!0,o=()=>{};const i=setTimeout(()=>{n&&(o(),t.closed||e())},r);return o=t.add(()=>{n=!1,clearTimeout(i)}),o}function Bt(t,e=0){return t.closed?Promise.resolve(!1):new Promise(r=>{let n=!1,o=()=>{};const i=setTimeout(()=>{n=!0,o(),r(!0)},e);o=t.add(()=>{clearTimeout(i),n||r(!1)})})}function Ht(t,e){const{$progress:r}=t.template,{left:n}=et(r),o=dt((I?e.touches[0].clientX:e.clientX)-n,0,r.clientWidth),i=o/r.clientWidth*t.duration;return{second:i,time:pt(i),width:o,percentage:dt(o/r.clientWidth,0,1)}}function jt(t,e){if(t.isRotate){const r=(e.touches[0].clientY-t.top)/t.height,n=r*t.duration;t.emit("setBar","played",r,e),t.seek=n}else{const{second:r,percentage:n}=Ht(t,e);t.emit("setBar","played",n,e),t.seek=r}}function qt(t,e){const{icons:r,option:n}=t,{$player:o}=t.template,i=S(e),{on:a}=M(t,e);let s=()=>{};const l=St(".art-progress-hover",e),c=St(".art-progress-loaded",e),d=St(".art-progress-played",e),u=St(".art-progress-highlight",e),p=St(".art-progress-indicator",e),h=St(".art-progress-tip",e);function f(r,n){const{width:o,time:i}=n||Ht(t,r);h.textContent=i||"00:00";const a=h.clientWidth;o<=a/2?H(h,"left",0):o>e.clientWidth-a/2?H(h,"left",e.clientWidth-a+"px"):H(h,"left",o-a/2+"px")}r.indicator?B(p,r.indicator):H(p,"backgroundColor","var(--art-theme)"),a("setBar",function(r,n,a){const m="played"===r&&a&&I;if("loaded"===r&&H(c,"width",100*n+"%"),"hover"===r&&(H(l,"width",100*n+"%"),K(a,u)?function(r){const{width:n}=Ht(t,r),o=r.target instanceof HTMLElement?r.target.dataset.text:void 0;h.textContent=null!=o?o:"";const i=h.clientWidth;n<=i/2?H(h,"left",0):n>e.clientWidth-i/2?H(h,"left",e.clientWidth-i+"px"):H(h,"left",n-i/2+"px")}(a):f(a),0===n?V(o,"art-progress-hover"):F(o,"art-progress-hover")),"played"===r&&(H(d,"width",100*n+"%"),H(p,"left",100*n+"%")),m){F(o,"art-progress-hover");f(a,{width:e.clientWidth*n,time:pt(n*t.duration)}),s(),s=Yt(i,()=>{V(o,"art-progress-hover")},500)}}),a("video:loadedmetadata",function(){u.textContent="";for(let e=0;e{t.emit("setBar","played",t.played),t.emit("setBar","loaded",t.loaded)}):(a("video:timeupdate",()=>{t.emit("setBar","played",t.played)}),a("video:progress",()=>{t.emit("setBar","loaded",t.loaded)}),a("video:ended",()=>{t.emit("setBar","played",1)})),t.emit("setBar","loaded",t.loaded||0)}function Ut(t){return e=>c(l({},t),{html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{qt(e,t),function(t,e){const{$progress:r}=t.template,n=e.querySelector(".art-progress-indicator"),{on:o,proxy:i}=M(t,e);if(!I){let e=!1;i(r,"click",e=>{e.target!==n&&jt(t,e)}),i(r,"mousemove",e=>{const{percentage:r}=Ht(t,e);t.emit("setBar","hover",r,e)}),i(r,"mouseleave",e=>{t.emit("setBar","hover",0,e)}),i(r,"mousedown",t=>{e=0===t.button}),o("document:mousemove",r=>{if(e){const{second:e,percentage:n}=Ht(t,r);t.emit("setBar","played",n,r),t.seek=e}}),o("document:mouseup",()=>{e&&(e=!1)})}}(e,t)}})}function Xt(t){const{option:e}=t.art;e.isLive||t.add(Ut({name:"progress",position:"top",index:10})),t.add({name:"thumbnails",position:"top",index:20}),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.play),s=Lt(t,o.pause);function l(){H(a,"display","flex"),H(s,"display","none")}function c(){H(a,"display","none"),H(s,"display","flex")}X(a,i.get("Play")),X(s,i.get("Pause")),n(a,"click",()=>{st(e.play())}),n(s,"click",()=>{e.pause()}),e.playing?c():l(),r("video:playing",()=>{c()}),r("video:pause",()=>{l()})}})}({name:"playAndPause",position:"left",index:10})),t.add(function(t){return e=>c(l({},t),{mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o}=e,i=Lt(t,o.volume),a=Lt(t,o.volumeClose),s=Lt(t,'
'),l=Lt(s,'
'),c=Lt(l,'
'),d=Lt(l,'
'),u=Lt(d,'
'),p=Lt(u,'
'),h=Lt(d,'
');function f(t){const{top:e,height:r}=et(d);return 1-(t.clientY-e)/r}function m(){if(e.muted||0===e.volume)H(i,"display","none"),H(a,"display","flex"),H(h,"top","100%"),H(p,"top","100%"),c.textContent="0";else{const t=100*e.volume;H(i,"display","flex"),H(a,"display","none"),H(h,"top",100-t+"%"),H(p,"top",100-t+"%"),c.textContent=String(Math.floor(t))}}if(m(),r("video:volumechange",m),n(i,"click",()=>{e.muted=!0}),n(a,"click",()=>{e.muted=!1}),I)H(s,"display","none");else{let t=!1;n(d,"mousedown",r=>{t=0===r.button,e.volume=f(r)}),r("document:mousemove",r=>{t&&(e.muted=!1,e.volume=f(r))}),r("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),e.isLive||t.add(function(t){return e=>c(l({},t),{style:I?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{const{on:r}=M(e,t);function n(){const r=`${pt(e.currentTime)} / ${pt(e.duration)}`;r!==t.textContent&&(t.textContent=r)}n();const o=["video:loadedmetadata","video:timeupdate","video:progress"];for(let e=0;e{r&&!$(t.art).closed&&(t.art.quality=e.quality)}).catch(t=>{console.warn("ArtPlayer quality initialization failed:",t)}),e.screenshot&&!I&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;Lt(t,n.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),e.setting&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e;Lt(t,o.setting),n(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),r("setting",e=>{X(t,i.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),e.pip&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e;Lt(t,o.pip),n(t,"click",()=>{e.pip=!e.pip}),r("pip",e=>{X(t,i.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),e.airplay&&"WebKitPlaybackTargetAvailabilityEvent"in window&&window.WebKitPlaybackTargetAvailabilityEvent&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r}=M(e,t),{icons:n}=e;Lt(t,n.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),e.fullscreenWeb&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.fullscreenWebOn),s=Lt(t,o.fullscreenWebOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),r("fullscreenWeb",e=>{e?(X(t,i.get("Exit Web Fullscreen")),H(a,"display","none"),H(s,"display","inline-flex")):(X(t,i.get("Web Fullscreen")),H(a,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),e.fullscreen&&t.add(function(t){return e=>c(l({},t),{tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{on:r,proxy:n}=M(e,t),{icons:o,i18n:i}=e,a=Lt(t,o.fullscreenOn),s=Lt(t,o.fullscreenOff);H(s,"display","none"),n(t,"click",()=>{e.fullscreen=!e.fullscreen}),r("fullscreen",e=>{e?(X(t,i.get("Exit Fullscreen")),H(a,"display","none"),H(s,"display","inline-flex")):(X(t,i.get("Fullscreen")),H(a,"display","inline-flex"),H(s,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let r=0;rKt.get(t).option.selector}),vt(t,"$control_item",{get:()=>Kt.get(t).item}),vt(t,"$control_value",{get:()=>Kt.get(t).value})),Kt.set(t,e)}function Jt(t,e){t.innerHTML=e}function Qt(t,e,r,n,o){const{proxy:i}=t.events,a=S(n),s=r.selector;F(n,"art-control-selector");const l=document.createElement("div");F(l,"art-selector-value"),B(l,r.html),n.textContent="",B(n,l);const c=Lt(n,'
');for(let d=0;dd(null,null,function*(){if(a.closed)return;const o=nt(n),i=r.selector.find(t=>o.includes(t.$control_item));if(!i)return;const s=++u,c=()=>!a.closed&&s===u,d=a.add(function(t,e){return Gt.set(t,e),()=>{Gt.get(t)===e&&Gt.delete(t)}}(n,c));try{if(e(i),a.closed)return;if(r.onSelect){const e=yield r.onSelect.call(t,i,i.$control_item,n);c()&&Jt(l,e)}}catch(p){console.warn("ArtPlayer selector failed:",p)}finally{d()}}));o.push(p)}class te extends Wt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:n}=this.art.template;L(t,n);const{on:o}=M(t,n);o("mousemove",()=>{I||(this.show=!0)}),o("click",()=>{I?this.toggle():this.show=!0}),o("document:mousemove",t=>{this.isHover=K(t,n)}),o("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),o("control",t=>{t?(V(r,"art-hide-cursor"),F(r,"art-hover"),this.timer=Date.now()):(F(r,"art-hide-cursor"),V(r,"art-hover"))}),this.init(),$(t).closed||function(t){const{$bottom:e,$controls:r,$player:n}=t.template,o=S(e),{on:i}=M(t,e),a=()=>{if(o.closed)return;const t=r.offsetHeight;t>0&&n.style.getPropertyValue("--art-controls-height")!==`${t}px`&&n.style.setProperty("--art-controls-height",`${t}px`)};if(i("resize",a),"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(a);t.observe(r),o.add(()=>{t.disconnect()})}else if("undefined"!==typeof MutationObserver){const t=new MutationObserver(a);t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),o.add(()=>{t.disconnect()})}a()}(t)}init(){Xt(this)}add(t){if(E(this.art))return;const e="function"===typeof t?t(this.art):t,{$progress:r,$controlsLeft:n,$controlsRight:o}=this.art.template;switch(e.position){case"top":this.$parent=r;break;case"left":this.$parent=n;break;case"right":this.$parent=o;break;default:at(!1,"Control option.position must one of 'top', 'left', 'right'")}super.add(e)}check(t){!function(t){if(t){Jt(t.$control_value,t.html);for(let e=0;ethis.check(t),t,e,r)}}function ee(t,e,r,n){const o=e-n,i=r-t;let a=0;if(Math.abs(i)<2&&Math.abs(o)<2)return a;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(i,o);return s>=-45&&s<45?a=4:s>=45&&s<135?a=1:s>=-135&&s<-45?a=2:(s>=135&&s<=180||s>=-180&&s<-135)&&(a=3),a}function re(t){if(t.constructor.USE_RAF){const e=$(t);let r=()=>{};!function n(){t.playing&&t.emit("raf"),t.isDestroy||(r=function(t,e){if(t.closed)return()=>{};let r=!0,n=()=>{};const o=requestAnimationFrame(o=>{r&&(n(),t.closed||e(o))});return n=t.add(()=>{r=!1,cancelAnimationFrame(o)}),n}(e,n))}(),t.on("destroy",()=>{r()})}}const ne=new WeakMap;class oe{constructor(t){this.destroyEvents=new Set;const e=$(t);ne.set(this,e),e.add(()=>this.destroy()),this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:n,$video:o}}=t;function i(e){K(e,n)?(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",i),t.on("document:contextmenu",i);let a=[];e.proxy(o,"click",e=>{const n=Date.now();a.push(n);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:i,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=a.filter(t=>n-t<=i);switch(c.length){case 1:t.emit("click",e),I?!t.isLock&&o&&st(t.toggle()):st(t.toggle()),a=c;break;case 2:t.emit("dblclick",e),I?!t.isLock&&s&&st(t.toggle()):l&&(t.fullscreen=!t.fullscreen),a=[];break;default:a=[]}})}(t,this),function(t,e){const{$player:r}=t.template;e.hover(r,e=>{F(r,"art-hover"),t.emit("hover",!0,e)},e=>{V(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:n}=t;t.on("resize",()=>{const{aspectRatio:e,notice:n}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,n.show=""});const o=$(t);let i=()=>{};const a=()=>{i(),i=Yt(o,()=>t.emit("resize"),n.RESIZE_TIME)};t.on("window:orientationchange",()=>a()),t.on("window:resize",()=>a()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>a())}(t,this),function(t,e){if(I&&!t.option.isLive){const{$video:r,$progress:n}=t.template;let o=null,i=!1,a=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===n&&jt(t,e),i=!0;const{pageX:r,pageY:c}=e.touches[0];a=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&i&&t.duration){const{pageX:n,pageY:i}=e.touches[0],c=ee(a,s,n,i),d=[3,4].includes(c),u=[1,2].includes(c);if(d&&!t.isRotate||u&&t.isRotate){const c=dt((n-a)/t.width,-1,1),d=dt((i-s)/t.height,-1,1),u=t.isRotate?d:c,p=o===r?t.constructor.TOUCH_MOVE_RATIO:1,h=dt(l+t.duration*u*p,0,t.duration);t.seek=h,t.emit("setBar","played",dt(h/t.duration,0,1),e),t.notice.show=`${pt(h)} / ${pt(t.duration)}`}}},u=()=>{i&&(a=0,s=0,l=0,i=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(n,"touchstart",t=>{o=n,c(t)}),e.proxy(n,"touchmove",d),t.on("document:touchend",u)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:n}}=t,o=Tt(()=>{t.emit("view",G(n,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"],n=["resize","scroll","orientationchange"],o=[];function i(i={}){for(let t=0;t{const n=i.document||a.ownerDocument||document,s=e.proxy(n,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),n.forEach(r=>{var n;const s=i.window||(null==(n=a.ownerDocument)?void 0:n.defaultView)||window,l=e.proxy(s,r,e=>{t.emit(`window:${r}`,e)});o.push(l)})}i(),e.bindGlobalEvents=i}(t,this),re(t)}proxy(t,e,r,n={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,n));if(ne.get(this).closed)return()=>{};t.addEventListener(e,r,n);const o=()=>t.removeEventListener(e,r,n);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 ie{constructor(t){this.art=t,this.keys={},I||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",()=>{st(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\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n',state:'\r\n\r\n\r\n',play:'\r\n \r\n',pause:'\r\n \r\n',check:'\r\n\r\n',volume:'\r\n \r\n \r\n',volumeClose:'\r\n \r\n \r\n',screenshot:'\r\n\t\r\n\r\n',setting:'\r\n \r\n \r\n',pip:'\r\n\r\n',arrowLeft:'\r\n \r\n',arrowRight:'\r\n \r\n',playbackRate:'',aspectRatio:'',config:'',lock:'\r\n\r\n\r\n\r\n\r\n',flip:'\r\n\r\n\r\n\r\n\r\n\r\n',unlock:'\r\n\r\n\r\n',fullscreenOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenOn:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOff:'\r\n\r\n\r\n\r\n\r\n',fullscreenWebOn:'\r\n\r\n\r\n\r\n\r\n',switchOn:'\r\n\r\n\r\n \r\n',switchOff:'\r\n\r\n\r\n \r\n\r\n',error:'\r\n\r\n\r\n\r\n\r\n',close:'\r\n\r\n\r\n\r\n\r\n',airplay:'\r\n \r\n \r\n \r\n \r\n\r\n'};class ce{constructor(t){const e=l(l({},le),t.option.icons);for(const r in e)vt(this,r,{get:()=>Q(r,e[r])})}}class de extends Wt{constructor(t){super(t),this.name="info",I||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:n,$video:o}}=this.art;t(n,"click",()=>{this.show=!1});let i=()=>{};const a=W("[data-video]",r)||[];this.art.on("destroy",()=>i());const s=$(this.art);!function t(){for(let e=0;e{H(o,"display","none"),H(i,"display",null)}),n.proxy(e.$state,"click",()=>st(t.play()))}}class fe{constructor(t){this.art=t,this.timer=null,$(t).add(()=>this.destroy()),t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){if($(this.art).closed)return;const{constructor:e,template:{$player:r,$noticeInner:n}}=this.art;t?(n.textContent=t instanceof Error?t.message.trim():t,F(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{n.textContent="",V(r,"art-notice-show")},e.NOTICE_TIME)):V(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}function me({width:t,height:e}){return Number.isFinite(t)&&t>0&&Number.isFinite(e)&&e>0}function ge(t,e){if(!me(t)||!Number.isFinite(e)||e<=0)return;const r=t.width/t.height>e?{width:e*t.height,height:t.height,axis:"width"}:{width:t.width,height:t.width/e,axis:"height"};return me(r)?r:void 0}function ve(t){const{$container:e,$video:r}=t.template;vt(t,"autoHeight",{value(){if(E(t))return;const n=function(t,e){if(!Number.isFinite(t)||t<=0||!me(e))return;const r=e.height*(t/e.width);return Number.isFinite(r)&&r>0?r:void 0}(e.clientWidth,{width:r.videoWidth,height:r.videoHeight});void 0===n||E(t)||(e.style.height=`${n}px`,t.emit("autoHeight",n))}})}function ye(t,e,r,n=!1){const o=e=>{E(t)||r(e)};t[n?"once":"on"](e,o),$(t).add(()=>{t.off(e,o)})}function be(t,e,r){for(const[n,o]of e){if(E(t)||r&&!r())return;t[n].show=o}}const we=new WeakMap,xe=new WeakMap,ke=new WeakMap;function $e(t){return ke.get(t)||$(t)}function Ee(t){const e=we.get(t),r=ke.get(t);return()=>we.get(t)===e&&(!e||e.active())&&ke.get(t)===r&&(!r||!r.closed)}function Te(t){const e=ke.get(t),r=$(t).child(),n=r.child();ke.set(t,r),r.add(()=>{ke.get(t)===r&&ke.delete(t)});const o={scope:n,assigned:!1,acceptingEvents:!1,active:()=>!E(t)&&!n.closed&&we.get(t)===o};return we.set(t,o),n.add(()=>{we.get(t)===o&&we.delete(t),o.onAssigned=void 0,o.onError=void 0}),null==e||e.dispose(),o}function Ce(t){t.assigned=!0;const e=t.onAssigned;t.onAssigned=void 0,t.active()&&(null==e||e())}function Le(t,e,r){xe.set(t,e),e.acceptingEvents=!0;try{t.url=r}finally{xe.get(t)===e&&(xe.delete(t),Ce(e))}}function Se(t,e){t.active()&&(t.onError?t.onError(e):console.warn("Failed to initialize ArtPlayer source:",e),t.scope.dispose())}function Pe(t){const{option:e,constructor:r,i18n:n,notice:o,template:{$player:i}}=t;let a,s=$e(t),l=0;return{reset(){l=0,null==a||a.dispose(),V(i,"art-error")},loadStart(){V(i,"art-error")},schedule(c){(c=>d(null,null,function*(){if(E(t))return;const d=$e(t);if(d!==s&&(s=d,l=0),a&&!a.closed)return;const u=d.child();a=u,u.add(()=>{a===u&&(a=void 0)});const p=()=>!E(t)&&!u.closed&&d===$e(t),h=l{console.warn("ArtPlayer reconnect failed:",t)})}}}function Me(t){!function(t){const{proxy:e,template:{$video:r}}=t;for(let n=0;n{E(t)||t.emit(`video:${e.type}`,e)})}(t);const e=Pe(t);!function(t,e){ye(t,"video:canplay",()=>{e.reset(),be(t,[["loading",!1]])}),ye(t,"video:canplay",()=>{be(t,[["loading",!1],["controls",!0],["mask",!0]]),E(t)||(t.isReady=!0,t.emit("ready"))},!0)}(t,e),function(t){const{option:e}=t;ye(t,"video:ended",()=>{if(e.loop){const e=Ee(t);if(t.seek=0,E(t)||!e())return;st(t.play()),e()&&be(t,[["controls",!1],["mask",!1]],e)}else be(t,[["controls",!0],["mask",!0]])})}(t),ye(t,"video:error",e.schedule),function(t,e){const{template:{$poster:r}}=t;ye(t,"video:loadedmetadata",()=>{t.emit("resize"),I&&be(t,[["loading",!1],["controls",!0],["mask",!0]])}),ye(t,"video:loadstart",()=>{e.loadStart(),be(t,[["loading",!0],["mask",!1],["controls",!0]])}),ye(t,"video:pause",()=>{be(t,[["controls",!0],["mask",!0]])}),ye(t,"video:play",()=>{be(t,[["mask",!1]]),E(t)||H(r,"display","none")}),ye(t,"video:playing",()=>be(t,[["mask",!1]])),ye(t,"video:progress",()=>{t.playing&&be(t,[["loading",!1]])}),ye(t,"video:seeked",()=>be(t,[["loading",!1],["mask",!0]])),ye(t,"video:seeking",()=>be(t,[["loading",!0],["mask",!1]])),ye(t,"video:timeupdate",()=>be(t,[["mask",!1]])),ye(t,"video:waiting",()=>be(t,[["loading",!0],["mask",!1]]))}(t,e)}const ze=[["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"]],Ae=(()=>{if("undefined"===typeof document)return!1;const t=ze[0],e={};for(const r of ze){if(r[1]in document){for(const[n,o]of r.entries())e[t[n]]=o;return e}}return!1})(),Oe={change:Ae.fullscreenchange,error:Ae.fullscreenerror},Re={request:(t=document.documentElement,e)=>new Promise((r,n)=>{const o=()=>{Re.off("change",o),r()};Re.on("change",o);const i=t[Ae.requestFullscreen](e);i instanceof Promise&&i.then(o).catch(n)}),exit:()=>new Promise((t,e)=>{if(!Re.isFullscreen)return void t();const r=()=>{Re.off("change",r),t()};Re.on("change",r);const n=document[Ae.exitFullscreen]();n instanceof Promise&&n.then(r).catch(e)}),toggle:(t,e)=>Re.isFullscreen?Re.exit():Re.request(t,e),onchange(t){Re.on("change",t)},onerror(t){Re.on("error",t)},on(t,e){const r=Oe[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=Oe[t];r&&document.removeEventListener(r,e,!1)},raw:Ae};function Ie(t,e,...r){const n=Reflect.get(t,e);if("function"!==typeof n)throw new TypeError(`Fullscreen method ${e} is not available`);return n.apply(t,r)}Object.defineProperties(Re,{isFullscreen:{get:()=>Boolean(document[Ae.fullscreenElement])},element:{enumerable:!0,get:()=>document[Ae.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Ae.fullscreenEnabled])}});const _e=new WeakMap;function Ne(t){try{Promise.resolve(t()).catch(()=>{})}catch(e){}}function De(t){const{document:e,elementProperty:r,changeEvent:n,target:o,exit:i}=t,a=function(t,e,r){let n=_e.get(t);if(!n){n=new WeakMap,_e.set(t,n);const o=n;t.addEventListener(r,()=>{const r=Reflect.get(t,e),n=r&&o.get(r);n&&(o.delete(r),Ne(n))})}return n}(e,r,n);a.set(o,i),t.element===o&&(a.delete(o),Ne(i))}function We(t,e,r,n,o=()=>t.element!==t.target){const i=e.child();let a,s,l=!1,c=!1,d=!1,u=!1,p=!1;const h=new Promise((t,e)=>{a=t,s=e});function f(t=!1,e){if(!l){l=!0;try{i.dispose()}catch(r){t||(t=!0,e=r)}t?s(e):a()}}i.add(()=>{l||(l=!0,c=!0,a(),d&&!u&&r&&De(t))});const m=()=>{d&&!u&&(r?t.element===t.target:o())&&f()};if(Vt(i,t.document,t.changeEvent,m),Vt(i,t.document,t.errorEvent,e=>{e.target!==t.target&&e.target!==t.document||(p=!0,d&&!u&&f(!0,new Error("Fullscreen request failed")))}),!i.closed)try{r&&function(t){var e;null==(e=_e.get(t.document))||e.delete(t.target)}(t);const e=r?t.request():t.exit();u=Boolean(e&&"function"===typeof e.then),d=!0,c&&!u&&r&&De(t),u?Promise.resolve(e).then(()=>{c?n():f()},t=>f(!0,t)).catch(()=>{}):p?f(!0,new Error("Fullscreen request failed")):m()}catch(g){f(!0,g)}return{promise:h,cancel:()=>i.dispose()}}function Fe(t,e){const r=$(t).child(),{$player:n,$video:o}=t.template,i=()=>e.element===n||e.element===o;let a,s=i(),l=0,c=s,d=!1,u=!1,p=!1;function h(){if(i())try{Promise.resolve(e.exit()).catch(()=>{})}catch(t){}}return r.add(()=>{l+=1,c=!1,n.classList.remove("art-fullscreen"),h()}),Vt(r,e.document,e.changeEvent,()=>{const r=i();if(r&&function(t){var e,r;return null!=(r=null==(e=_e.get(t.document))?void 0:e.has(t.target))&&r}(e))return;if(r&&u)return void h();if(r===s||E(t))return;s=r;const o=l,a=()=>E(t)||i()!==r||o!==l&&c!==r;t.emit("fullscreen",r),a()||(r&&(t.state="fullscreen"),a()||(n.classList.toggle("art-fullscreen",r),t.emit("resize")))}),Vt(r,e.document,e.errorEvent,r=>{(r.target===n||r.target===o||r.target===e.document&&(p||void 0!==a||i()))&&!E(t)&&t.emit("fullscreenError",r)}),{get:()=>!E(t)&&i(),set(n){if(E(t))return Promise.resolve();const o=++l;if(c=Boolean(n),c?u=!1:d&&(u=!0),null==a||a.cancel(),a=void 0,d=!1,!c&&!i())return Promise.resolve();p=!0,d=c;const s=We(e,r,c,()=>{!E(t)&&c||h()},()=>!i());p=!1,l===o?a=s:s.cancel();const f=s.promise.catch(e=>{throw E(t)||l!==o||(t.notice.show=e),e}).finally(()=>{l===o&&(a=void 0,d=!1)});return f.catch(()=>{}),f}}}const Ve=new WeakSet;function Ye(t,e=!1){return"string"===typeof t.webkitPresentationMode?"fullscreen"===t.webkitPresentationMode:"boolean"===typeof t.webkitDisplayingFullscreen?t.webkitDisplayingFullscreen:t.ownerDocument.fullscreenElement===t||e}function Be(t){Ve.delete(t),t.removeEventListener("webkitbeginfullscreen",He),t.removeEventListener("webkitpresentationmodechanged",He)}function He(t){var e;if(Ve.has(this)&&Ye(this,"webkitbeginfullscreen"===t.type)){Be(this);try{null==(e=this.webkitExitFullscreen)||e.call(this)}catch(r){}}}function je(t){Ve.add(t),t.addEventListener("webkitbeginfullscreen",He),t.addEventListener("webkitpresentationmodechanged",He)}function qe(t){const{$video:e}=t.template,r=$(t).child();let n=!1,o=Ye(e),i=o,a=!1,s=0;const l=()=>Ye(e,n);function c(r){if(E(t)||(c=e,Ve.has(c)))return;var c;"boolean"===typeof r&&(n=r);const d=l();if(d&&(a=!1),d===o)return;o=d;const u=s,p=()=>E(t)||l()!==d||u!==s&&i!==d;t.emit("fullscreen",d),p()||(d&&(t.state="fullscreen"),p()||t.emit("resize"))}r.add(()=>{var t;s++,i=!1,a&&je(e),l()&&(null==(t=e.webkitExitFullscreen)||t.call(e))}),Vt(r,e,"webkitbeginfullscreen",()=>c(!0)),Vt(r,e,"webkitendfullscreen",()=>c(!1)),Vt(r,e,"webkitpresentationmodechanged",()=>c());const d=()=>c();return t.on("document:webkitfullscreenchange",d),r.add(()=>{t.off("document:webkitfullscreenchange",d)}),{get:()=>!E(t)&&l(),set(r){if(E(t))return;const n=++s;if(i=Boolean(r),r){if(Be(e),t.state="fullscreen",E(t)||n!==s)return;a=!0;try{e.webkitEnterFullscreen()}catch(o){throw n===s&&(a=!1),o}}else a&&(a=!1,je(e)),l()&&e.webkitExitFullscreen()}}}function Ue(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t,i=()=>{if(E(t))return;const i=function(t){const e=Re.raw,r=t.ownerDocument;if(e&&Reflect.get(r,e.fullscreenEnabled))return{document:r,target:t,get element(){return Reflect.get(r,e.fullscreenElement)},elementProperty:e.fullscreenElement,changeEvent:e.fullscreenchange,errorEvent:e.fullscreenerror,request:()=>Ie(t,e.requestFullscreen,void 0),exit:()=>Ie(r,e.exitFullscreen)}}(o);i?vt(t,"fullscreen",Fe(t,i)):n.webkitSupportsFullscreen&&"function"===typeof n.webkitEnterFullscreen&&"function"===typeof n.webkitExitFullscreen?vt(t,"fullscreen",qe(t)):vt(t,"fullscreen",{get:()=>!1,set(){E(t)||(r.show=e.get("Fullscreen Not Supported"))}}),vt(t,"fullscreen",wt(t,"fullscreen"))};t.once("video:loadedmetadata",i),$(t).add(()=>{t.off("video:loadedmetadata",i)})}function Xe(t){return{node:t,parent:t.parentNode,next:t.nextSibling}}function Ge({node:t,parent:e,next:r}){var n;if(!e)return void(null==(n=t.parentNode)||n.removeChild(t));const o=(null==r?void 0:r.parentNode)===e?r:null;t.parentNode===e&&t.nextSibling===o||e.insertBefore(t,o)}function Ke(t){const e=function(t){const{$player:e}=t.template;let r,n=0;function o(t,r){return null===t.style?e.removeAttribute("style"):e.setAttribute("style",t.style),!!r()&&(e.classList.remove("art-fullscreen-web"),!!r()&&(Ge(t.placement),r()))}return $(t).add(()=>{var t;n+=1;const i=r;if(r=void 0,i)try{o(i,()=>!0)}catch(a){try{e.parentNode!==i.placement.parent&&(null==(t=e.parentNode)||t.removeChild(e))}catch(s){throw new y([a,s])}throw a}}),i=>{if(E(t))return;const a=++n,s=()=>a===n&&!E(t);if(i){r||(r={placement:Xe(e),style:e.getAttribute("style")});const n=r;try{if(t.constructor.FULLSCREEN_WEB_IN_BODY&&e.parentNode!==document.body&&document.body.appendChild(e),!s())return;if(t.state="fullscreenWeb",!s())return;e.style.width="100%",e.style.height="100%",e.classList.add("art-fullscreen-web")}catch(l){throw s()&&o(n,s)&&(r=void 0),l}if(!s())return;t.emit("fullscreenWeb",!0)}else{if(r){if(!o(r,s))return;r=void 0}else e.classList.remove("art-fullscreen-web");if(!s())return;t.emit("fullscreenWeb",!1)}s()&&t.emit("resize")}}(t);vt(t,"fullscreenWeb",{get:()=>t.template.$player.classList.contains("art-fullscreen-web"),set:e})}function Ze(t,e,r){const n=Math.max(0,r.viewportWidth-r.width),o=Math.max(0,r.viewportHeight-r.height);return{left:Math.max(0,Math.min(t,n)),top:Math.max(0,Math.min(e,o))}}function Je(t){const{width:e,height:r}=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;return{width:e,height:r,viewportWidth:n.innerWidth,viewportHeight:n.innerHeight}}function Qe(t,e,r,n){const o=e.child();if(o.closed)return;const i=t.template.$mini;if(i){const t=i.style.display;return o.add(()=>{i.style.display=t}),{element:i,cancelDrag:()=>{},fresh:!1}}const a=t.template.$player.ownerDocument,s=a.createElement("div");s.className="art-mini-popup",o.add(()=>{s.remove()});try{const e=a.createElement("div");if(e.className="art-mini-close",e.append(t.icons.close),o.closed)return;const i=a.createElement("div");i.className="art-mini-state";const l=t.icons.play,c=t.icons.pause;if(o.closed)return;i.append(l,c),s.append(e,i),Vt(o,e,"click",n),Vt(o,l,"click",()=>{st(t.play())}),Vt(o,c,"click",()=>{t.pause()});const d=()=>{o.closed||(l.style.display=t.playing?"none":"flex",c.style.display=t.playing?"flex":"none")};d();for(const r of["video:playing","video:pause","video:timeupdate"])t.on(r,d),o.add(()=>{t.off(r,d)});const u=function(t,e,r,n){let o=!1,i=0,a=0;const s=()=>{o=!1,e.classList.remove("art-mini-dragging"),e.style.transform=""};Vt(r,e,"mousedown",t=>{const e=t;0===e.button&&n()&&(o=!0,i=e.clientX,a=e.clientY)});const l=t=>{!r.closed&&o&&n()&&(e.classList.add("art-mini-dragging"),e.style.transform=`translate(${t.clientX-i}px, ${t.clientY-a}px)`)},c=()=>{if(r.closed||!o||!n())return;const i=e.getBoundingClientRect(),a=Ze(i.left,i.top,Je(e));s(),e.style.left=`${a.left}px`,e.style.top=`${a.top}px`,t.storage.set("left",a.left),r.closed||t.storage.set("top",a.top)};return t.on("document:mousemove",l),r.add(()=>{t.off("document:mousemove",l)}),t.on("document:mouseup",c),r.add(()=>{t.off("document:mouseup",c)}),r.add(s),s}(t,s,o,r);if(o.closed)return;if(t.template.$mini=s,a.body.append(s),!o.closed)return{element:s,cancelDrag:u,fresh:!0}}catch(l){throw o.dispose(),t.template.$mini===s&&delete t.template.$mini,l}}function tr(t){const{$player:e,$video:r}=t.template,n=$(t).child();let o,i,a=0,s=!1,d=!1;const u=()=>!E(t)&&e.classList.contains("art-mini");function p(){if(i){const e=i,r=a;i=void 0;try{Ge(e)}catch(t){throw r!==a||i||(i=e),t}}}function h(){if(E(t))return;const r=++a;d=!1,p(),E(t)||r!==a||(null==o||o.cancelDrag(),e.classList.remove("art-mini"),t.template.$mini&&(t.template.$mini.style.display="none",t.emit("mini",!1)))}function f(){if(E(t))return;const m=++a;if(s)d=!0;else if(t.state="mini",!E(t)&&m===a){null!=i||(i=Xe(r)),e.classList.add("art-mini");try{if(!o){s=!0;try{o=Qe(t,n,u,h)}finally{s=!1}}if(d)return d=!1,void f();if(!o||E(t))return;if(m!==a)return void(u()||(o.element.style.display="none"));if(o.fresh?o.element.prepend(r):o.element.append(r),E(t)||m!==a)return;o.element.style.display=o.fresh?"":"flex",o.fresh=!1;const e=t.storage.get("top"),i=function(t,e,r){return"number"===typeof t&&Number.isFinite(t)&&"number"===typeof e&&Number.isFinite(e)&&t>=0&&e>=0&&t+r.width<=r.viewportWidth&&e+r.height<=r.viewportHeight?{left:t,top:e,reset:!1}:c(l({},Ze(r.viewportWidth-r.width-50,r.viewportHeight-r.height-50,r)),{reset:!0})}(t.storage.get("left"),e,Je(o.element));if(E(t)||m!==a)return;if(o.element.style.left=`${i.left}px`,o.element.style.top=`${i.top}px`,i.reset){if(t.storage.set("top",i.top),E(t)||m!==a)return;t.storage.set("left",i.left)}E(t)||m!==a||t.emit("mini",!0)}catch(g){const r=d;throw d=!1,E(t)||m!==a&&!r||(p(),e.classList.remove("art-mini"),o&&(o.element.style.display="none")),g}}}return n.add(()=>{a++;try{p()}finally{null==o||o.cancelDrag(),e.classList.remove("art-mini")}}),{get:u,set(t){t?f():h()}}}const er=new WeakSet,rr=t=>"picture-in-picture"===t.webkitPresentationMode;function nr(t){er.delete(t),t.removeEventListener("webkitpresentationmodechanged",or),t.removeEventListener("enterpictureinpicture",or)}function or(){var t;if(er.has(this)&&rr(this)){nr(this);try{null==(t=this.webkitSetPresentationMode)||t.call(this,"inline")}catch(e){}}}function ir(t){er.add(t),t.addEventListener("webkitpresentationmodechanged",or),t.addEventListener("enterpictureinpicture",or)}function ar(t){const{i18n:e,notice:r,template:{$video:n}}=t,o=n.ownerDocument;o.pictureInPictureEnabled&&"function"===typeof n.requestPictureInPicture&&"function"===typeof o.exitPictureInPicture?vt(t,"pip",function(t){const{$video:e}=t.template,r=e.ownerDocument,n=$(t).child(),o=()=>r.pictureInPictureElement===e;let i=o(),a=i,s=!1,l=!1,c=0;function d(){if(o())try{r.exitPictureInPicture().catch(()=>{})}catch(t){}}function u(e,r,n){e.then(()=>{!r||!E(t)&&a||d()},e=>{E(t)||c!==n||(t.notice.show=e)}).finally(()=>{c===n&&(s=!1)}).catch(()=>{})}return e.disablePictureInPicture=!1,n.add(()=>{c++,a=!1,d()}),Vt(n,e,"enterpictureinpicture",()=>{if(l)return void d();if(!o()||i)return;const e=c;t.state="pip",!E(t)&&e===c&&o()&&(i=!0,t.emit("pip",!0))}),Vt(n,e,"leavepictureinpicture",()=>{i&&!o()&&(i=!1,t.emit("pip",!1))}),{get:()=>!E(t)&&o()?e:null,set(n){if(E(t))return;const i=++c;if(a=Boolean(n),a?l=!1:s&&(l=!0),s=!1,a){if(t.state="pip",E(t)||c!==i)return;s=!0;try{u(e.requestPictureInPicture(),!0,i)}catch(d){throw c===i&&(s=!1),d}}else o()&&u(r.exitPictureInPicture(),!1,i)}}}(t)):"function"===typeof n.webkitSupportsPresentationMode&&"function"===typeof n.webkitSetPresentationMode?vt(t,"pip",function(t){const{$video:e}=t.template,r=$(t).child();let n=!1,o=!1,i=0,a=0;function s(r=!1){if(E(t)||er.has(e))return;const s=rr(e);if(s&&(o=!1),s===n&&!r)return;const l=i;s&&(t.state="pip"),E(t)||i!==l||rr(e)!==s||(n=s,a++,t.emit("pip",s))}e.webkitSetPresentationMode("inline"),r.add(()=>{i++,o&&ir(e),rr(e)&&e.webkitSetPresentationMode("inline")});for(const l of["webkitpresentationmodechanged","enterpictureinpicture","leavepictureinpicture"])Vt(r,e,l,()=>s());return{get:()=>!E(t)&&rr(e),set(r){var n;if(E(t))return;const l=++i,c=a;if(r){if(!1===(null==(n=e.webkitSupportsPresentationMode)?void 0:n.call(e,"picture-in-picture")))return void(t.notice.show=t.i18n.get("PIP Not Supported"));if(nr(e),t.state="pip",E(t)||i!==l)return;o=!0;try{e.webkitSetPresentationMode("picture-in-picture")}catch(d){throw l===i&&(o=!1),d}}else o&&(o=!1,ir(e)),rr(e)&&e.webkitSetPresentationMode("inline");E(t)||l!==i||c!==a||rr(e)!==Boolean(r)||s(!0)}}}(t)):vt(t,"pip",{get:()=>!1,set(){E(t)||(r.show=e.get("PIP Not Supported"))}})}function sr(t){vt(t,"quality",{set(e){const{controls:r,notice:n,i18n:o}=t,i=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:(null==i?void 0:i.html)||"",selector:e,onSelect(e,r,i){return d(this,null,function*(){const r=function(t){return t&&Gt.get(t)||(()=>!0)}(i);if(yield t.switchQuality(e.url),!E(t)&&r()){const i=`${o.get("Switch Video")}: ${e.html}`;!E(t)&&r()&&(n.show=i)}return e.html})}})}})}function lr(t,e,r,n,o=!0){let i,a=!1;const s=e=>{t.closed||a||(o&&(a=!0,i()),n(e))};return e[o?"once":"on"](r,s),i=t.add(()=>{e.off(r,s)}),s}function cr(t,e,r){return new Promise((n,o)=>{if(E(t)||e===t.url)return void n();const i=Te(t),a=i.scope.child();let s=!1;const l=(t=!1,e)=>{s||(s=!0,i.onError=void 0,i.onAssigned=void 0,a.dispose(),t?o(e):n(),t&&i.scope.dispose())};a.add(()=>{l()});const c=()=>!s&&i.active(),u=t=>l(!0,t);i.onError=u;try{const{playing:n,aspectRatio:o,playbackRate:s}=t;if(t.pause(),!c())return;const p=a.child(),h={"video:error":u,"video:loadedmetadata":()=>{if(c())try{t.currentTime=r}catch(e){u(e)}},"video:canplay":()=>{if(!c())return;p.dispose();d(null,null,function*(){if(t.playbackRate=s,c()&&(t.aspectRatio=o,c())){if(n)try{yield t.play()}catch(e){}c()&&(t.notice.show="",l())}}).catch(u)}},f=a.child(),m=[],g=Object.keys(h);for(const e of g)lr(f,t,e,t=>{i.acceptingEvents&&m.push([e,t])},!1);if(Le(t,i,e),!c())return;if(t.notice.show="",!c())return;const v=()=>{if(f.dispose(),!e)return void l();const r={};for(const e of g)r[e]=lr(p,t,e,h[e]);for(const[t,e]of m){if(!c()||p.closed)break;r[t](e)}m.length=0};i.assigned?v():i.onAssigned=v}catch(p){u(p)}})}function dr(t){const{option:e,template:{$progress:r,$video:n}}=t;let o=null,i=!1,a=null;t.on("setBar",(o,s,l)=>d(null,null,function*(){var c;const d=null==(c=t.controls)?void 0:c.thumbnails,{url:u,scale:p}=e.thumbnails;if(!d||!u)return;if("hover"===o||"played"===o&&l&&I){if(a||i||(i=!0,a=yield rt(u,p),i=!1),!a)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?H(s,"left",r.clientWidth-h+"px"):H(s,"left",o-h/2+"px")}(o)}})),vt(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,i=!1,a=null)}})}function ur(t){const{option:e,template:{$video:r}}=t;vt(t,"url",{get:()=>r.src,set(n){return d(this,null,function*(){if(E(t))return;const o=function(t){const e=xe.get(t);return xe.delete(t),e||Te(t)}(t);o.acceptingEvents=!1;try{if(!n)return void((yield Bt(o.scope))&&o.active()&&(t.loading.show=!0));const i=t.url,a=e.type||lt(n),s=e.customType[a];if(a&&s){if(!(yield Bt(o.scope))||!o.active())return;t.loading.show=!0}if(!o.active())return;const l=o.scope.child();let c=!1,d=!1;lr(l,t,"video:canplay",()=>{c=!d}),lr(l,t,"video:error",()=>{d=!0});try{if(o.acceptingEvents=!0,a&&s){const e=s.call(t,r,n,t);Promise.resolve(e).catch(t=>Se(o,t))}else{if(i&&URL.revokeObjectURL(i),!o.active())return;r.src=n}}finally{l.dispose()}if(!o.active())return;if(i!==t.url&&(t.option.url=n,o.active()&&t.isReady&&i)){const e=()=>{o.active()&&t.emit("restart",n)};c?e():d||lr(o.scope,t,"video:canplay",e)}}catch(i){Se(o,i)}finally{Ce(o)}})}})}class pr{constructor(t){ur(t),function(t){const{template:{$video:e}}=t;vt(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:n,constructor:{instances:o},template:{$video:i}}=t;vt(t,"play",{value(){return d(this,null,function*(){const a=Ee(t),s=yield i.play();if(!a())return s;const l=e.get("Play");if(!a())return s;if(r.show=l,!a())return s;if(t.emit("play"),n.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;vt(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${pt(t.currentTime)} / ${pt(t.duration)}`),t.emit("seek",t.currentTime,r)}});const r=t;vt(t,"forward",{set(e){r.seek=t.currentTime+e}}),vt(t,"backward",{set(e){r.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:n,storage:o}=t;vt(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=dt(t,0,1),n.show=`${r.get("Volume")}: ${Number.parseInt(String(100*e.volume),10)}`,0!==e.volume&&o.set("volume",e.volume)}}),vt(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;vt(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{const n=Number.parseFloat(r);Number.isNaN(n)||(e.currentTime=dt(n,0,t.duration))}})}(t),function(t){vt(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){const e=e=>cr(t,e,0);vt(t,"switchQuality",{value:e=>cr(t,e,t.currentTime)}),vt(t,"switchUrl",{value:e}),vt(t,"switch",{set:e})}(t),function(t){const{template:{$video:e},i18n:r,notice:n}=t,o=t;vt(t,"playbackRate",{get:()=>e.playbackRate,set(t){if(t){if(t===e.playbackRate)return;e.playbackRate=t,n.show=`${r.get("Rate")}: ${1===t?r.get("Normal"):`${t}x`}`}else o.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:n,$player:o}}=t;vt(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(i){if(!E(t)){if(i||(i="default"),"default"===i)n.style.width="",n.style.height="",n.style.margin="",delete o.dataset.aspectRatio;else{const e=i.split(":").map(Number),r=ge({width:o.clientWidth,height:o.clientHeight},e[0]/e[1]);if(E(t))return;"width"===(null==r?void 0:r.axis)?(n.style.width=`${r.width}px`,n.style.height="100%",n.style.margin="0 auto"):r&&(n.style.width="100%",n.style.height=`${r.height}px`,n.style.margin="auto 0"),o.dataset.aspectRatio=i}r.show=`${e.get("Aspect Ratio")}: ${"default"===i?e.get("Default"):i}`,E(t)||t.emit("aspectRatio",i)}}})}(t),function(t){const{notice:e,template:{$video:r}}=t,n=J("canvas");vt(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),t(n.toDataURL("image/png"))}catch(i){e.show=i,o(i)}})}),vt(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{n.width=r.videoWidth,n.height=r.videoHeight,n.getContext("2d").drawImage(r,0,0),n.toBlob(e=>{t(URL.createObjectURL(e))})}catch(i){e.show=i,o(i)}})}),vt(t,"screenshot",{value:e=>d(null,null,function*(){const n=yield t.getDataURL();return ct(n,`${e||`artplayer_${pt(r.currentTime)}`}.png`),t.emit("screenshot",n),n})})}(t),Ue(t),Ke(t),ar(t),function(t){const{$video:e}=t.template,r=t;vt(t,"loaded",{get:()=>r.loadedTime/e.duration}),vt(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){vt(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;vt(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:n}=t.template;vt(t,"autoSize",{value(){if(E(t))return;const o={width:n.videoWidth,height:n.videoHeight};if(!me(o))return;const i=et(e),a=ge(i,o.width/o.height);a&&!E(t)&&("width"===a.axis?(r.style.width=a.width/i.width*100+"%",r.style.height="100%"):(r.style.width="100%",r.style.height=a.height/i.height*100+"%"),t.emit("autoSize",{width:t.width,height:t.height}))}})}(t),function(t){const e=t;vt(t,"rect",{get:()=>et(t.template.$player)});const r=["bottom","height","left","right","top","width"];for(let n=0;ne.rect[o]})}vt(t,"x",{get:()=>e.left+window.pageXOffset}),vt(t,"y",{get:()=>e.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:n}=t;vt(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){E(t)||(o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,n.show=`${r.get("Video Flip")}: ${r.get(ut(o))}`,E(t)||t.emit("flip",o))}})}(t),function(t){vt(t,"mini",tr(t))}(t),function(t){const{template:{$poster:e}}=t;vt(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch(t){return""}},set(t){H(e,"backgroundImage",`url(${t})`)}})}(t),ve(t),function(t){const{$player:e}=t.template;vt(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){vt(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){vt(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];vt(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let n=0;n{switch(t.availability){case"available":i=!0;break;case"not-available":i=!1}}):i=!1,vt(t,"airplay",{value(){i?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),sr(t),dr(t),Me(t),function(t){const{option:e,storage:r,template:{$video:n,$poster:o}}=t;for(const a in e.moreVideoAttr)t.attr(a,e.moreVideoAttr[a]);e.muted&&(t.muted=e.muted),e.volume&&(n.volume=dt(e.volume,0,1));const i=r.get("volume");"number"===typeof i&&(n.volume=dt(i,0,1)),e.poster&&H(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(n.autoplay=e.autoplay),e.playsInline&&(n.playsInline=!0,n["webkit-playsinline"]=!0),e.theme&&(e.cssVar["--art-theme"]=e.theme);for(const a in e.cssVar)t.cssVar(a,e.cssVar[a]);t.url=e.url}(t)}}const hr=new WeakMap,fr="art-auto-orientation-fullscreen";function mr(t){if(hr.get(t.orientation)===t)try{t.orientation.unlock()}catch(e){}}const gr="art-auto-orientation",vr=["width","height","transform-origin","transform"];function yr(t){const{$player:e,$video:r}=t.template,n=()=>{const t={width:r.videoWidth,height:r.videoHeight},n=e.ownerDocument.documentElement,o={width:n.clientWidth,height:n.clientHeight};return me(t)&&me(o)&&(t.width>t.height&&o.widtho.height)},o=function(t,e){const{$player:r}=t.template,n=$(t);let o,i=()=>{};function a(){i(),i=()=>{};const e=o;if(o=void 0,e&&t.fullscreenWeb)for(const{name:t,value:o,priority:i}of e)r.style.setProperty(t,o,i);const n=r.classList.contains(gr);r.classList.remove(gr),n&&(t.isRotate=!1,E(t)||t.emit("resize"))}function s(n){if(!t.fullscreenWeb||!e())return;const i=ot();if(E(t)||!t.fullscreenWeb)return;const a=r.ownerDocument.documentElement;null!=o||(o=vr.map(t=>({name:t,value:r.style.getPropertyValue(t),priority:r.style.getPropertyPriority(t)}))),r.style.width=a.clientHeight-i.top-i.bottom+"px",r.style.height=a.clientWidth-i.left-i.right+"px",r.style.transformOrigin="0 0",r.style.transform=`rotate(90deg) translate(${i.top}px, -${a.clientWidth-i.right}px)`,r.classList.add(gr),t.isRotate=!0,n&&t.emit("resize")}return n.add(a),r=>{var l;E(t)||(r?o?s(!1):e()&&(i(),i=Yt(n,()=>{o||s(!0)},Number(null!=(l=t.constructor.AUTO_ORIENTATION_TIME)?l:0))):a())}}(t,n),i=function(t,e){const{$player:r}=t.template;let n;function o(){const t=n;n=void 0,r.classList.remove(fr),t&&(t.cancelled=!0,mr(t),t.settled&&hr.get(t.orientation)===t&&hr.delete(t.orientation))}return $(t).add(o),i=>{var a,s;if(E(t))return;if(!i)return void o();if(n&&!n.cancelled&&hr.get(n.orientation)===n)return;const l=null==(s=null==(a=r.ownerDocument.defaultView)?void 0:a.screen)?void 0:s.orientation;if("function"!==typeof(null==l?void 0:l.lock)||"function"!==typeof l.unlock||!e())return;const c={orientation:l,cancelled:!1,settled:!1};n=c,hr.set(l,c);const d=()=>!E(t)&&!c.cancelled&&n===c&&hr.get(l)===c,u=e=>{c.settled=!0;const o=d();hr.get(l)===c&&hr.delete(l),n===c&&(n=void 0),o&&(r.classList.remove(fr),t.notice.show=e)};try{const t=l.lock(l.type.startsWith("portrait")?"landscape":"portrait");Promise.resolve(t).then(()=>{c.settled=!0,d()?r.classList.add(fr):(mr(c),hr.get(l)===c&&hr.delete(l))}).catch(u)}catch(p){u(p)}}}(t,n);return t.on("fullscreenWeb",o),t.on("fullscreen",i),$(t).add(()=>{t.off("fullscreenWeb",o),t.off("fullscreen",i)}),{name:"autoOrientation",get state(){return e.classList.contains("art-auto-orientation")}}}function br(t){const{i18n:e,icons:r,storage:n,constructor:o,proxy:i,template:{$poster:a}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=D(".art-auto-playback-last",s),c=D(".art-auto-playback-jump",s),d=D(".art-auto-playback-close",s);B(d,r.close);let u=null;function p(){const r=(n.get("times")||{})[t.option.id||t.option.url];clearTimeout(u),H(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(H(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${pt(r)}`,c.textContent=e.get("Jump Play"),i(d,"click",()=>{H(s,"display","none")}),i(c,"click",()=>{t.seek=r,st(t.play()),H(a,"display","none"),H(s,"display","none")}),t.once("video:timeupdate",()=>{u=setTimeout(()=>{H(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=n.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,n.set("times",e)}}),t.on("ready",p),t.on("restart",p),{name:"auto-playback",get times(){return n.get("times")||{}},clear:()=>n.del("times"),delete(t){const e=n.get("times")||{};return delete e[t],n.set("times",e),e}}}function wr(t){const{constructor:e,proxy:r,template:{$player:n,$video:o}}=t;let i=null,a=!1,s=1;const l=()=>{clearTimeout(i),a&&(a=!1,t.playbackRate=s,V(n,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(i=setTimeout(()=>{a=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,F(n,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return Y(n,"art-fast-forward")}}}function xr(t){const{layers:e,icons:r,template:{$player:n}}=t;function o(){return Y(n,"art-lock")}function i(){F(n,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function a(){V(n,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const n=B(e,r.lock),o=B(e,r.unlock);H(n,"display","none"),t.on("lock",t=>{t?(H(n,"display","inline-flex"),H(o,"display","none")):(H(n,"display","none"),H(o,"display","inline-flex"))})},click(){o()?a():i()}}),{name:"lock",get state(){return o()},set state(t){t?i():a()}}}function kr(t){return t.on("control",e=>{e?V(t.template.$player,"art-mini-progress-bar"):F(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class $r{constructor(t){this.art=t,this.id=0;const{option:e}=t;!function(t,e){E(t.art)||!e.miniProgressBar||e.isLive||t.add(kr),!E(t.art)&&e.lock&&I&&t.add(xr),E(t.art)||!e.autoPlayback||e.isLive||t.add(br),!E(t.art)&&e.autoOrientation&&I&&t.add(yr),!E(t.art)&&e.fastForward&&I&&!e.isLive&&t.add(wr)}(this,e);for(let r=0;rconsole.warn("Failed to initialize ArtPlayer plugin:",t))}}add(t){at(!E(this.art),"Cannot add a plugin after ArtPlayer is destroyed"),this.id+=1;const e=t.call(this.art,this.art);return e instanceof Promise?e.then(e=>this.next(t,e)):this.next(t,e)}next(t,e){return function(t,e,r){if(E(t.art))return t;const n=r&&r.name||e.name||`plugin${t.id}`;if(E(t.art))return t;let o=n;const i=bt(t,o);if(E(t.art))return t;const a=`Cannot add a plugin that already has the same name: ${n}`;return E(t.art)||(at(!i,a),("object"===typeof n&&null!==n||"function"===typeof n)&&(o=Reflect.ownKeys({[o]:void 0})[0]),E(t.art)||vt(t,o,{value:r})),t}(this,t,e)}}const Er=new WeakMap;function Tr(t){return!t.closed&&!Er.get(t)}function Cr(t){Er.set(t,(Er.get(t)||0)+1);let e=!0;return()=>{if(!e)return;e=!1;const r=(Er.get(t)||1)-1;r?Er.set(t,r):Er.delete(t)}}const Lr=new WeakMap,Sr=new WeakMap,Pr=["$parent","$parents","$option","$events","$formatted"];function Mr(t){var e,r;const n=new Set;let o=t;for(;o&&!n.has(o);){n.add(o);const t=Lr.get(o);if(!t||!t.owner.active||(null==(e=t.owner.scope)?void 0:e.closed)||!t.option.includes(o))return!1;if(!t.parent)return t.owner.root===t.option;if((null==(r=Lr.get(t.parent))?void 0:r.owner)!==t.owner)return!1;o=t.parent}return!1}function zr(t){let e=t;for(;e;){const r=Object.getOwnPropertyDescriptor(e,"name");if(r)return"set"in r?"function"===typeof r.set:Boolean(r.writable&&(e===t||Object.isExtensible(t)));e=Object.getPrototypeOf(e)}return Object.isExtensible(t)}function Ar(t){const e=Lr.get(t);if(!e)throw new Error("Setting item has not been formatted");return e}function Or(t,e){var r;for(let n=0;n{c&&c!==r&&c.dispose()},()=>Fr(t,o)])try{e()}catch(d){d instanceof y?l.push(...d.errors):l.push(d)}if(r.closed||E(t)||(o.push(...i.splice(0)),Wr.set(r,o),Nr.set(e,r),Dr.set(e,n)),a(),l.length)throw new y(l)},dispose(){if(s){s=!1;try{r.dispose()}finally{a()}}}}}function jr(t,e,r,n,o,i){const a=i||Yr(e);if(!Tr(a)||E(t))return;const s=t.proxy(r,n,e=>{if(Tr(a)&&!E(t))try{return o(e)}catch(r){console.warn("ArtPlayer setting callback failed:",r)}});!Tr(a)||E(t)?t.events.remove(s):(Ar(e).events.push(s),i&&i!==Nr.get(e)&&i.add(()=>{const r=Ar(e).events,n=r.indexOf(s);n>=0&&(r.splice(n,1),t.events.remove(s))}))}function qr(t,e,r,n){const o=Yr(e);if(!Tr(o)||E(t))return;const i=(...e)=>{if(Tr(o)&&!E(t))return n(...e)};t.on(r,i),o.add(()=>{t.off(r,i)})}function Ur(t){var e,r;const{art:n,active:o}=t,{controls:i,constructor:{SETTING_WIDTH:a,SETTING_ITEM_HEIGHT:s},template:{$player:l,$setting:c,$bottom:d}}=n;if(!i.setting||!t.show||!o)return;const u=l.getBoundingClientRect(),p=i.setting.getBoundingClientRect(),h=u.width/l.offsetWidth||1,f=(p.left-u.left+p.width/2)/h-l.clientLeft,m=function(t){const{containerWidth:e,containerHeight:r,requestedWidth:n,rows:o,rowHeight:i,controlCenter:a,bottom:s,padding:l}=t,c=Math.min(Math.max(0,l),Math.max(0,e/2)),d=Math.min(Math.max(0,n),Math.max(0,e-2*c));return{width:d,height:Math.min(Math.max(0,o*i),Math.max(0,r-s-c)),left:Math.max(c,Math.min(a-d/2,e-c-d))}}({containerWidth:l.clientWidth,containerHeight:l.clientHeight,requestedWidth:(null==(r=null==(e=o[0])?void 0:e.$parent)?void 0:r.width)||a,rows:o.length+(o===t.option?0:1),rowHeight:s,controlCenter:f,bottom:Number.parseFloat(getComputedStyle(c).bottom)||0,padding:Number.parseFloat(getComputedStyle(d).paddingLeft)||0});c.style.height=`${m.height}px`,c.style.width=`${m.width}px`,n.isRotate||I||(f+m.width/2>l.clientWidth?(c.style.left="",c.style.right=""):(c.style.left=`${m.left}px`,c.style.right="auto"))}const Xr=new WeakMap;function Gr(t){Xr.delete(t)}const Kr=new WeakMap;function Zr(t,e){e?Kr.set(t,e):Kr.delete(t)}function Jr(t){var e;const r=new Map(Reflect.ownKeys(t).map(e=>[e,Object.getOwnPropertyDescriptor(t,e)])),n=[],o=Kr.get(t),i=null==o?void 0:o();for(const a of["html","icon","tooltip"]){const t=null==(e=r.get(a))?void 0:e.value;t instanceof Node&&n.push({node:t,parent:t.parentNode,next:t.nextSibling})}return()=>{var e,a;for(const n of Reflect.ownKeys(t))!r.has(n)&&(null==(e=Object.getOwnPropertyDescriptor(t,n))?void 0:e.configurable)&&Reflect.deleteProperty(t,n);for(const[n,o]of r)Object.defineProperty(t,n,o);null==i||i(),Zr(t,o);for(const{node:t,parent:r,next:o}of n)r?r.insertBefore(t,(null==o?void 0:o.parentNode)===r?o:null):null==(a=t.parentNode)||a.removeChild(t)}}const Qr=new WeakMap;function tn(t,e,r,n,o,i,a,s){return d(this,null,function*(){try{const l=Yr(e),c=Yr(i),d=(Qr.get(i)||0)+1;Qr.set(i,d);const u=()=>Tr(l)&&Tr(c)&&!E(t.art)&&Qr.get(i)===d;if(null==s||s(),!u())return;const p=yield o.call(t.art,e,r,n);u()&&Reflect.set(i,a,p)}catch(l){console.warn("ArtPlayer setting callback failed:",l)}})}function en(t){const e=[];return function t(r){const n=Array.from(r.childNodes);e.push({node:r,children:n,attributes:1===r.nodeType?Array.from(r.attributes,t=>[t.name,t.value]):void 0,value:r.nodeValue}),n.forEach(t)}(t),()=>{for(const{node:t,children:r,attributes:n,value:o}of e){for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of r)t.appendChild(e);if(n){const e=t;for(const t of Array.from(e.attributes))e.removeAttribute(t.name);for(const[t,r]of n)e.setAttribute(t,r)}else t.nodeValue=o}}}const rn=new WeakMap;function nn(t){const e=[];for(const n of t)try{n()}catch(r){r instanceof y?e.push(...r.errors):e.push(r)}if(e.length)throw new y(e)}function on(t){var e;null==(e=rn.get(t))||e()}function an(t,e){const r=t.find(e.name);if(E(t.art))return r||e;if(!r)return t.add(e);Gr(r),on(r);const n=Jr(r),o=r.$item,i=null==o?void 0:o.parentNode,a=null==o?void 0:o.nextSibling,s=o?en(o):void 0,l=t.active,c=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),d=function(t,e){const r=new Set,n=new Set,o=e=>{if(!r.has(e)&&(r.add(e),e.selector)){const r=t.cache.get(e.selector);r&&n.add(r),e.selector.forEach(o)}};o(e);const i=[],a=[];try{for(const e of r){const r=Hr(t.art,e);r&&i.push(r)}for(const t of n)a.push(Cr(Ir(t)))}catch(l){try{nn([...i.reverse().map(t=>t.resume),...a])}catch(c){console.warn("ArtPlayer setting restore failed:",c)}throw l}let s=!0;return{items:r,resume(){s&&(s=!1,nn([...i.reverse().map(t=>t.resume),...a]))},dispose(){s&&(s=!1,nn([...i.reverse().map(t=>t.dispose),...Array.from(n).reverse().map(t=>()=>_r(t)),...a]))}}}(t,r);let u=!0,p=!1;const h=()=>{if(!u)return;u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);if(E(t.art))return void d.dispose();const e=r.$item;try{nn([d.resume,()=>{e&&e!==o&&e.remove()},n,()=>null==s?void 0:s(),()=>{i&&o&&i.insertBefore(o,(null==a?void 0:a.parentNode)===i?a:null)},()=>t.format(),()=>{if(p){t.active=l,l&&t.cache.has(l)&&U(t.cache.get(l),"art-current");for(const[e,r,n]of c)t.$parent.style.setProperty(e,r,n)}}])}catch(f){console.warn("ArtPlayer setting restore failed:",f)}},f=()=>u&&!E(t.art)&&rn.get(r)===h;for(const v of d.items)rn.set(v,h);const m=$(t.art).add(()=>{u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);d.dispose()});try{if(function(t,e,r){for(const n of Reflect.ownKeys(e)){if(!r())return;const o=Object.getOwnPropertyDescriptor(e,n);if(!(null==o?void 0:o.enumerable)||!r())continue;const i=Reflect.get(e,n);if(!r())return;if(!Reflect.set(t,n,i))throw new TypeError(`Cannot assign setting item property [${String(n)}]`)}}(r,e,f),!f())return r;if(t.format(),!f())return r;if(t.createItem(r,!0),!f())return r;if(p=!0,t.render(),!f())return r;u=!1;for(const t of d.items)rn.get(t)===h&&rn.delete(t);return d.dispose(),r}catch(g){throw f()&&h(),g}finally{m()}}const sn=new WeakMap;function ln(t,e,r){vt(t,`$${e}`,{configurable:!0,get:()=>r}),vt(t,e,{configurable:!0,get:()=>r.innerHTML,set(t){r.innerHTML="",B(r,t)}})}function cn(t,e,r=!1){var n,o;const i=function(t){const e=rn.get(t);return()=>!e||rn.get(t)===e}(e);if(!t.cache.has(e.$option))return;const a=t.cache.get(e.$option),s=e.$item;let l="selector";bt(e,"switch")&&(l="switch"),bt(e,"range")&&(l="range"),bt(e,"onClick")&&(l="button");const{icons:c,constructor:d}=t.art;if(!i())return;const u=function(t,e,r=$(t)){const n=Nr.get(e);(!n||Tr(n)||n.closed)&&Br(t,e);const o=r.child();return Nr.set(e,o),Dr.set(e,r),Wr.set(o,Ar(e).events),o.add(()=>{Fr(t,Wr.get(o))}),o}(t.art,e,Ir(a)),p=()=>Tr(u)&&!E(t.art)&&i();if(!p())return;const h=document.createElement("div");try{if(Zr(e),F(h,"art-setting-item"),H(h,"height",`${d.SETTING_ITEM_HEIGHT}px`),h.dataset.name=e.name||"",h.dataset.value=String(e.value||""),!p())return;const i=B(h,'
'),f=B(h,'
'),m=document.createElement("div");switch(F(m,"art-setting-item-left-icon"),l){case"button":case"switch":case"range":{const t=e.icon||c.config;if(!p())return;B(m,t);break}case"selector":if(null==(n=e.selector)?void 0:n.length){const t=e.icon||c.config;if(!p())return;B(m,t)}else B(m,c.check)}if(B(i,m),!p())return;ln(e,"icon",m);const g=document.createElement("div");F(g,"art-setting-item-left-text");const v=e.html||"";if(!p())return;B(g,v),B(i,g),ln(e,"html",g);const y=document.createElement("div");F(y,"art-setting-item-right-tooltip");const b=e.tooltip||"";if(!p())return;switch(B(y,b),B(f,y),ln(e,"tooltip",y),l){case"switch":{const t=document.createElement("div");F(t,"art-setting-item-right-icon");const r=B(t,c.switchOn),n=B(t,c.switchOff),o=e.switch;if(!p())return;H(o?n:r,"display","none"),B(f,t),vt(e,"$switch",{configurable:!0,get:()=>t});let i=e.switch;if(!p())return;Zr(e,()=>{const t=i;return()=>{i=t}}),vt(e,"switch",{configurable:!0,get:()=>i,set(t){i=t,t?(H(n,"display","none"),H(r,"display",null)):(H(n,"display",null),H(r,"display","none"))}});break}case"range":{const t=document.createElement("div");F(t,"art-setting-item-right-icon");const r=document.createElement("input");r.type="range",B(t,r);for(const[o,i]of["value","min","max","step"].entries()){const t=e.range[o];if(!p())return;Reflect.set(r,i,String(t))}F(r,"art-setting-range"),B(f,t),vt(e,"$range",{configurable:!0,get:()=>r});let n=[...e.range];if(!p())return;Zr(e,()=>{const t=n,e=[...t],o={min:r.min,max:r.max,step:r.step,value:r.value};return()=>{t.splice(0,t.length,...e),n=t,Object.assign(r,o)}}),vt(e,"range",{configurable:!0,get:()=>n,set(t){n=[...t],r.value=String(t[0]),r.min=String(t[1]),r.max=String(t[2]),r.step=String(t[3])}})}break;case"selector":if(null==(o=e.selector)?void 0:o.length){const t=document.createElement("div");F(t,"art-setting-item-right-icon"),B(t,c.arrowRight),B(f,t)}}if(!p())return;if(function(t,e,r,n){const{art:o}=t,i=Yr(e),a=(t,r,n)=>jr(o,e,t,r,n,i);switch(n){case"switch":e.onSwitch&&a(r,"click",n=>tn(t,e,r,n,e.onSwitch,e,"switch"));break;case"range":{const n=e.$range;if(n)for(const[o,i]of[["change","onRange"],["input","onChange"]])e[i]&&a(n,o,o=>tn(t,e,r,o,e[i],e,"tooltip",()=>{e.range[0]=n.valueAsNumber}));break}case"selector":a(r,"click",n=>{var o,i;if(null==(o=e.selector)?void 0:o.length)t.render(e.selector);else{if(null==(i=e.$parent)?void 0:i.onSelect)return tn(t,e,r,n,e.$parent.onSelect,e.$parent,"tooltip",()=>t.check(e));t.check(e)}}),e.default&&F(r,"art-current");break;case"button":e.onClick&&a(r,"click",n=>tn(t,e,r,n,e.onClick,e,"tooltip"))}}(t,e,h,l),!p())return;vt(e,"$item",{configurable:!0,get:()=>h}),r&&(null==s?void 0:s.parentNode)?s.replaceWith(h):B(a,h),e.mounted&&p()&&Yt(u,()=>{var r;if(!E(t.art))try{const n=null==(r=e.mounted)?void 0:r.call(t.art,h,e);Promise.resolve(n).catch(t=>console.warn("ArtPlayer setting mounted failed:",t))}catch(n){console.warn("ArtPlayer setting mounted failed:",n)}},0)}catch(f){try{u.dispose()}catch(m){console.warn("ArtPlayer setting cleanup failed:",m)}throw h.remove(),f}}function dn(t,e=t.option){var r;if(E(t.art))return;const n=t.cache.get(e);if(n&&!Tr(Ir(n)))return;const o=(sn.get(t)||0)+1;sn.set(t,o);const i=()=>sn.get(t)===o&&!E(t.art),a=t.active,s=["height","width","left","right"].map(e=>[e,t.$parent.style.getPropertyValue(e),t.$parent.style.getPropertyPriority(e)]),l=()=>{t.active=a,a&&t.cache.has(a)&&U(t.cache.get(a),"art-current");for(const[e,r,n]of s)t.$parent.style.setProperty(e,r,n)};if(t.active=e,n)try{U(n,"art-current"),t.resize()}catch(c){throw i()&&t.cache.get(e)===n&&!Ir(n).closed&&l(),c}else{const n=document.createElement("div");t.cache.set(e,n);const o=function(t,e,r){const n=$(t.art).child();return Rr.set(r,n),n.add(()=>{t.cache.get(e)===r&&t.cache.delete(e),r.remove()}),n}(t,e,n),a=()=>!o.closed&&!E(t.art)&&t.cache.get(e)===n,s=[];try{if(!a())return;F(n,"art-setting-panel"),B(t.$parent,n),U(n,"art-current"),(null==(r=e[0])?void 0:r.$parent)&&t.createHeader(e[0]);for(let r=0;r{!function(t){const e=Sr.get(t);e&&(e.active=!1,e.root=void 0,e.scope=void 0)}(this)}),e.setting&&(this.format(),this.render(),function(t){const{art:e}=t,r=$(e).child(),n=(t,n)=>{if(r.closed||E(e))return;const o=(...t)=>{if(!r.closed&&!E(e))return n(...t)};e.on(t,o),r.add(()=>{e.off(t,o)})};n("blur",()=>{t.show&&(t.show=!1,t.render())}),n("focus",r=>{const n=K(r,e.controls.setting),o=K(r,t.$parent);!t.show||n||o||(t.show=!1,t.render())}),n("resize",()=>t.resize());const o=()=>{r.closed||E(e)||t.resize()},i=e.proxy(t.$parent,"transitionend",e=>{e.target===t.$parent&&"bottom"===e.propertyName&&o()});r.add(()=>{e.events.remove(i)});const{$player:a,$controls:s}=e.template;if(!r.closed&&"undefined"!==typeof ResizeObserver){const t=new ResizeObserver(o);t.observe(a),t.observe(s),r.add(()=>{t.disconnect()})}if(!r.closed&&"undefined"!==typeof MutationObserver){const t=new MutationObserver(o);"undefined"===typeof ResizeObserver&&t.observe(s,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),t.observe(a,{attributes:!0,attributeFilter:["class","style"]}),r.add(()=>{t.disconnect()})}}(this))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,PLAYBACK_RATE:o}}=t;function i(t){return 1===t?e.get("Normal"):t.toFixed(1)}function a(){const e=t.setting.find(`playback-rate-${t.playbackRate}`);t.setting.check(e)}return{width:n,name:"playback-rate",html:e.get("Play Speed"),tooltip:i(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:i(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"video:ratechange",()=>a())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,ASPECT_RATIO:o}}=t;function i(t){return"default"===t?e.get("Default"):t}function a(){const e=t.setting.find(`aspect-ratio-${t.aspectRatio}`);t.setting.check(e)}return{width:n,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:i(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:i(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"aspectRatio",()=>a())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:n,FLIP:o}}=t;function i(t){return e.get(ut(t))}function a(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:n,name:"flip",html:e.get("Video Flip"),tooltip:i(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:i(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:(e,r)=>{a(),qr(t,r,"flip",()=>a())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:n}=t;return{width:n.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)=>{qr(t,r,"subtitleOffset",t=>{r.$range.value=String(t),r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){Or(e,t)}check(t){!function(t,e){(null==e?void 0:e.$parent)&&(e.$parent.tooltip=e.html,t.traverse(t=>{t.default=t===e,t.default&&t.$item&&U(t.$item,"art-current")},e.$option),t.render(e.$parents))}(this,t)}format(t=this.option,e,r,n=[]){this.option=function(t,e,r,n,o=[]){const i=Sr.get(t)||{active:!0},a=[],s=new Set,l=new Set(o),c=(t,e,r)=>{var n;for(let o=0;oAr(t).parent},$parents:{get:()=>Ar(t).parents},$option:{get:()=>Ar(t).option},$events:{get:()=>Ar(t).events},$formatted:{get:()=>!0}}),Lr.set(t,{parent:r,parents:n,option:o,events:(null==a?void 0:a.events)||[],owner:i}),u.generated&&(t.name=e)}for(const u of a)u.generated||o.push(u.name);return t.id=d,e}(this,t,e,r,n)}find(t=""){return function(t,e=""){let r=null;return Or(t,t=>{t.name===e&&(r=t)}),r}(this.option,t)}resize(){Ur(this)}inactivate(t){!function(t,e){const r=[],n=new Set,o=e=>{if(!n.has(e)){n.add(e);for(const t of e.selector||[])o(t);if(e.selector){const n=t.cache.get(e.selector);t.cache.delete(e.selector);try{n&&_r(n)}catch(i){r.push(i)}}try{Br(t.art,e)}catch(i){i instanceof y?r.push(...i.errors):r.push(i)}}};if(o(e),r.length)throw new y(r)}(this,t)}remove(t){const e=this.find(t);at(e,`Can't find [${t}] in the [setting]`),this.traverse(t=>{Gr(t),on(t)},[e]);const r=e.$option.indexOf(e);e.$option.splice(r,1);const n=e.$item,o=[];for(const a of[()=>this.inactivate(e),()=>null==n?void 0:n.remove(),()=>this.render()])try{a()}catch(i){i instanceof y?o.push(...i.errors):o.push(i)}if(o.length)throw new y(o)}update(t){return an(this,t)}add(t,e=this.option){var r;if(E(this.art))return t;let n=!1;this.traverse(e=>{n||(n=e===t)});const o=e.length,i=n?void 0:function(t){const e={};Xr.set(t,e);const r=()=>Xr.get(t)===e;return{current:r,finish(){r()&&Xr.delete(t)}}}(t);let a=!1;try{e.push(t),this.format(),a=!0,this.createItem(t),this.render()}catch(s){if(E(this.art)||i&&!i.current())throw s;if(e[o]===t&&e.splice(o,1),!n&&a){try{this.inactivate(t)}catch(l){console.warn("ArtPlayer setting cleanup failed:",l)}null==(r=t.$item)||r.remove()}throw s}finally{null==i||i.finish()}return t}createHeader(t){!function(t,e){if(!t.cache.has(e.$option))return;const r=t.cache.get(e.$option),{icons:{arrowLeft:n},constructor:{SETTING_ITEM_HEIGHT:o}}=t.art,i=document.createElement("div");H(i,"height",`${o}px`),F(i,"art-setting-item"),F(i,"art-setting-item-back");const a=B(i,'
'),s=document.createElement("div");F(s,"art-setting-item-left-icon"),B(s,n),B(a,s),B(a,e.$parent.html),jr(t.art,e.$parent,i,"click",()=>t.render(e.$parents),Ir(r)),B(r,i)}(this,t)}createItem(t,e=!1){cn(this,t,e)}render(t=this.option){dn(this,t)}}class hn{constructor(){this.name="artplayer_settings",this.settings={}}get(t){try{const e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:e}catch(e){return t?this.settings[t]:this.settings}}set(t,e){try{const r=Object.assign({},this.get(),{[t]:e});window.localStorage.setItem(this.name,JSON.stringify(r))}catch(r){this.settings[t]=e}}del(t){try{const e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}catch(e){delete this.settings[t]}}clear(){try{window.localStorage.removeItem(this.name)}catch(t){this.settings={}}}}const fn='.art-video-player{--art-theme: #f00;--art-font-color: #fff;--art-background-color: #000;--art-text-shadow-color: rgba(0, 0, 0, .5);--art-transition-duration: .2s;--art-padding: 10px;--art-border-radius: 3px;--art-progress-height: 6px;--art-progress-color: rgba(255, 255, 255, .25);--art-progress-top-gap: 10px;--art-hover-color: rgba(255, 255, 255, .25);--art-loaded-color: rgba(255, 255, 255, .25);--art-state-size: 80px;--art-state-opacity: .8;--art-bottom-height: 100px;--art-bottom-offset: 20px;--art-bottom-gap: 5px;--art-highlight-width: 8px;--art-highlight-color: rgba(255, 255, 255, .5);--art-control-height: 46px;--art-control-opacity: .75;--art-control-icon-size: 36px;--art-control-icon-scale: 1.1;--art-volume-height: 120px;--art-volume-handle-size: 14px;--art-lock-size: 36px;--art-indicator-scale: 0;--art-indicator-size: 16px;--art-fullscreen-web-index: 9999;--art-settings-icon-size: 24px;--art-settings-max-height: 300px;--art-selector-max-height: 300px;--art-contextmenus-min-width: 250px;--art-subtitle-font-size: 20px;--art-subtitle-gap: 5px;--art-subtitle-bottom: 15px;--art-subtitle-border: #000;--art-widget-background: rgba(0, 0, 0, .85);--art-tip-background: rgba(0, 0, 0, .7);--art-scrollbar-size: 4px;--art-scrollbar-background: rgba(255, 255, 255, .25);--art-scrollbar-background-hover: rgba(255, 255, 255, .5);--art-mini-progress-height: 2px}.art-bg-cover{background-position:center center;background-repeat:no-repeat;background-size:cover}.art-bottom-gradient{background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-backdrop-filter{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player{position:relative;margin:0 auto;width:100%;height:100%;outline:0;zoom:1;padding:0;text-align:left;direction:ltr;font-size:14px;line-height:1.3;user-select:none;box-sizing:border-box;color:var(--art-font-color);background-color:var(--art-background-color);text-shadow:0 0 2px var(--art-text-shadow-color);font-family:PingFang SC,Helvetica Neue,Microsoft YaHei,Roboto,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-touch-action:manipulation;touch-action:manipulation;-ms-high-contrast-adjust:none}.art-video-player *,.art-video-player *:before,.art-video-player *:after{box-sizing:border-box}.art-video-player ::-webkit-scrollbar{width:var(--art-scrollbar-size);height:var(--art-scrollbar-size)}.art-video-player ::-webkit-scrollbar-thumb{background-color:var(--art-scrollbar-background)}.art-video-player ::-webkit-scrollbar-thumb:hover{background-color:var(--art-scrollbar-background-hover)}.art-video-player img{max-width:100%;vertical-align:top}.art-video-player svg{fill:var(--art-font-color)}.art-video-player a{color:var(--art-font-color);text-decoration:none}.art-icon{line-height:1;display:flex;justify-content:center;align-items:center}.art-video-player.art-backdrop .art-contextmenus,.art-video-player.art-backdrop .art-info,.art-video-player.art-backdrop .art-settings,.art-video-player.art-backdrop .art-layer-auto-playback,.art-video-player.art-backdrop .art-selector-list,.art-video-player.art-backdrop .art-volume-inner{-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);background-color:#000000bf!important}.art-video{position:absolute;inset:0;z-index:10;width:100%;height:100%}.art-poster{position:absolute;inset:0;z-index:11;width:100%;height:100%;background-position:center center;background-repeat:no-repeat;background-size:cover;pointer-events:none}.art-video-player .art-subtitle{display:none;justify-content:center;align-items:center;flex-direction:column;position:absolute;z-index:20;width:100%;padding:0 5%;text-align:center;pointer-events:none;gap:var(--art-subtitle-gap);bottom:var(--art-subtitle-bottom);font-size:var(--art-subtitle-font-size);transition:bottom var(--art-transition-duration) ease;text-shadow:var(--art-subtitle-border) 1px 0 1px,var(--art-subtitle-border) 0 1px 1px,var(--art-subtitle-border) -1px 0 1px,var(--art-subtitle-border) 0 -1px 1px,var(--art-subtitle-border) 1px 1px 1px,var(--art-subtitle-border) -1px -1px 1px,var(--art-subtitle-border) 1px -1px 1px,var(--art-subtitle-border) -1px 1px 1px}.art-video-player.art-subtitle-show .art-subtitle{display:flex}.art-video-player.art-control-show .art-subtitle{bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom))}.art-danmuku{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none;overflow:hidden}.art-video-player .art-layers{position:absolute;inset:0;z-index:40;width:100%;height:100%;display:none;pointer-events:none}.art-video-player .art-layers .art-layer{pointer-events:auto}.art-video-player.art-layer-show .art-layers{display:flex}.art-video-player .art-mask{display:flex;justify-content:center;align-items:center;position:absolute;inset:0;z-index:50;width:100%;height:100%;pointer-events:none}.art-video-player .art-mask .art-state{display:flex;justify-content:center;align-items:center;opacity:0;transform:scale(2);width:var(--art-state-size);height:var(--art-state-size);transition:all var(--art-transition-duration) ease}.art-video-player.art-mask-show .art-state{pointer-events:auto;opacity:var(--art-state-opacity);transform:scale(1)}.art-video-player.art-loading-show .art-state{display:none}.art-video-player .art-loading{display:none;justify-content:center;align-items:center;position:absolute;inset:0;z-index:70;width:100%;height:100%;pointer-events:none}.art-video-player.art-loading-show .art-loading{display:flex}.art-video-player.art-loading-show .art-mask{display:none}.art-video-player .art-bottom{position:absolute;inset:0;z-index:60;width:100%;height:100%;display:flex;flex-direction:column;justify-content:flex-end;opacity:0;overflow:hidden;pointer-events:none;padding:0 var(--art-padding);transition:all var(--art-transition-duration) ease;background-size:100% var(--art-bottom-height);background-image:linear-gradient(to top,#000,rgba(0,0,0,.4),transparent);background-repeat:repeat-x;background-position:center bottom}.art-video-player .art-bottom .art-controls,.art-video-player .art-bottom .art-progress{transform:translateY(var(--art-bottom-offset));transition:transform var(--art-transition-duration) ease}.art-video-player.art-control-show .art-bottom,.art-video-player.art-hover .art-bottom{opacity:1}.art-video-player.art-control-show .art-bottom .art-controls,.art-video-player.art-hover .art-bottom .art-controls,.art-video-player.art-control-show .art-bottom .art-progress,.art-video-player.art-hover .art-bottom .art-progress{transform:translateY(0)}.art-bottom .art-progress{position:relative;z-index:0;cursor:pointer;pointer-events:auto;padding-top:var(--art-progress-top-gap);padding-bottom:var(--art-bottom-gap)}.art-bottom .art-progress .art-control-progress{position:relative;display:flex;justify-content:center;align-items:center;height:var(--art-progress-height)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:height var(--art-transition-duration) ease;background-color:var(--art-progress-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover{position:absolute;inset:0;z-index:0;width:100%;height:100%;width:0%;background-color:var(--art-hover-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded{position:absolute;inset:0;z-index:10;width:100%;height:100%;width:0%;background-color:var(--art-loaded-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played{position:absolute;inset:0;z-index:20;width:100%;height:100%;width:0%;background-color:var(--art-theme)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight{position:absolute;inset:0;z-index:30;width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span{position:absolute;inset:0 auto 0 0;z-index:0;width:100%;height:100%;pointer-events:auto;width:var(--art-highlight-width)!important;transform:translate(calc(var(--art-highlight-width) / -2));background-color:var(--art-highlight-color)}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{display:flex;justify-content:center;align-items:center;position:absolute;z-index:40;left:0;border-radius:50%;width:var(--art-indicator-size);height:var(--art-indicator-size);transform:scale(var(--art-indicator-scale));margin-left:calc(var(--art-indicator-size) / -2);transition:transform var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon{width:100%;height:100%;pointer-events:none}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover{transform:scale(1.2)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active{transform:scale(1)!important}.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;z-index:50;top:-25px;left:0;padding:3px 5px;line-height:1;font-size:12px;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease}.art-bottom .art-progress .art-control-thumbnails{transform-origin:bottom center;transform:scale(.5);opacity:0;position:absolute;bottom:calc(var(--art-bottom-gap) + 10px);left:0;border-radius:var(--art-border-radius);pointer-events:none;background-color:var(--art-widget-background);transition:transform var(--art-transition-duration) ease,opacity var(--art-transition-duration) ease;box-shadow:0 1px 3px #0003,0 1px 2px -1px #0003}.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner{height:100%}.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator{transform:scale(1)}.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,.art-progress-hover .art-bottom .art-progress .art-control-thumbnails{transform:scale(1);opacity:1}.art-video-player .art-controls{position:relative;z-index:10;pointer-events:auto;display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;flex-shrink:0;height:auto;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-left,.art-video-player .art-controls .art-controls-right{display:flex;flex-wrap:wrap;max-width:100%;min-height:var(--art-control-height)}.art-video-player .art-controls .art-controls-center{display:none;justify-content:center;align-items:center;flex:1;height:100%;padding:0 10px}.art-video-player .art-controls .art-controls-right{justify-content:flex-end;margin-left:auto}.art-video-player .art-controls .art-control{display:flex;justify-content:center;align-items:center;flex-shrink:0;max-width:100%;cursor:pointer;white-space:nowrap;opacity:var(--art-control-opacity);min-height:var(--art-control-height);min-width:var(--art-control-height);transition:opacity var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon{height:var(--art-control-icon-size);width:var(--art-control-icon-size);transform:scale(var(--art-control-icon-scale));transition:transform var(--art-transition-duration) ease}.art-video-player .art-controls .art-control .art-icon:active{transform:scale(calc(var(--art-control-icon-scale) * .8))}.art-video-player .art-controls .art-control:hover{opacity:1}.art-control-volume{position:relative}.art-control-volume .art-volume-panel{display:flex;justify-content:center;align-items:center;position:absolute;left:0;right:0;padding:0 5px;font-size:12px;text-align:center;cursor:default;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);width:var(--art-control-height);height:var(--art-volume-height);transition:all var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner{display:flex;flex-direction:column;align-items:center;gap:10px;height:100%;width:100%;padding:10px 0 12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider{flex:1;width:100%;display:flex;cursor:pointer;position:relative;justify-content:center}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle{position:relative;display:flex;justify-content:center;width:2px;border-radius:var(--art-border-radius);overflow:hidden;background-color:#ffffff40}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded{position:absolute;inset:0;z-index:0;width:100%;height:100%;background-color:var(--art-theme)}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator{position:absolute;width:var(--art-volume-handle-size);height:var(--art-volume-handle-size);margin-top:calc(var(--art-volume-handle-size) / -2);flex-shrink:0;transform:scale(1);border-radius:100%;background-color:var(--art-theme);transition:transform var(--art-transition-duration) ease}.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator{transform:scale(.9)}.art-control-volume:hover .art-volume-panel{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player .art-notice{display:none;position:absolute;inset:0 0 auto;z-index:80;width:100%;height:100%;height:auto;padding:var(--art-padding);pointer-events:none}.art-video-player .art-notice .art-notice-inner{display:inline-flex;padding:5px;line-height:1;border-radius:var(--art-border-radius);background-color:var(--art-tip-background)}.art-video-player.art-notice-show .art-notice{display:flex}.art-video-player .art-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;padding:5px 0;border-radius:var(--art-border-radius);font-size:12px;background-color:var(--art-widget-background);min-width:var(--art-contextmenus-min-width)}.art-video-player .art-contextmenus .art-contextmenu{cursor:pointer;display:flex;padding:10px 15px;border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player .art-contextmenus .art-contextmenu span{padding:0 8px}.art-video-player .art-contextmenus .art-contextmenu span:hover,.art-video-player .art-contextmenus .art-contextmenu span.art-current{color:var(--art-theme)}.art-video-player .art-contextmenus .art-contextmenu:hover{background-color:#ffffff1a}.art-video-player .art-contextmenus .art-contextmenu:last-child{border-bottom:none}.art-video-player.art-contextmenu-show .art-contextmenus{display:flex}.art-video-player .art-settings{display:none;flex-direction:column;position:absolute;z-index:90;left:auto;overflow-y:auto;overflow-x:hidden;border-radius:var(--art-border-radius);max-height:var(--art-settings-max-height);right:var(--art-padding);bottom:var(--art-controls-height, var(--art-control-height));transition:all var(--art-transition-duration) ease;background-color:var(--art-widget-background)}.art-video-player .art-settings .art-setting-panel{display:none;flex-direction:column}.art-video-player .art-settings .art-setting-panel.art-current{display:flex}.art-video-player .art-settings .art-setting-panel .art-setting-item{display:flex;justify-content:space-between;align-items:center;gap:5px;padding:0 5px;cursor:pointer;overflow:hidden;transition:background-color var(--art-transition-duration) ease}.art-video-player .art-settings .art-setting-panel .art-setting-item:hover{background-color:#ffffff1a}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current{color:var(--art-theme)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check{visibility:hidden;height:15px}.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check{visibility:visible}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left{display:flex;justify-content:center;align-items:center;flex-shrink:1;min-width:0;overflow:hidden;gap:5px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;height:var(--art-settings-icon-size);width:var(--art-settings-icon-size)}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:0;max-width:55%;gap:5px;font-size:12px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#ffffff80}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon{display:flex;justify-content:center;align-items:center;flex-shrink:0;min-width:32px;height:24px}.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range{height:3px;width:80px;outline:none;appearance:none;background-color:#fff3}.art-video-player .art-settings .art-setting-panel .art-setting-item-back{border-bottom:1px solid rgba(255,255,255,.1)}.art-video-player.art-setting-show .art-settings{display:flex}.art-video-player .art-info{display:none;position:absolute;left:var(--art-padding);top:var(--art-padding);z-index:100;padding:10px;font-size:12px;border-radius:var(--art-border-radius);background-color:var(--art-widget-background)}.art-video-player .art-info .art-info-panel{display:flex;flex-direction:column;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item{display:flex;align-items:center;gap:5px}.art-video-player .art-info .art-info-panel .art-info-item .art-info-title{width:100px;text-align:right}.art-video-player .art-info .art-info-panel .art-info-item .art-info-content{width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;user-select:all}.art-video-player .art-info .art-info-close{position:absolute;top:5px;right:5px;cursor:pointer}.art-video-player.art-info-show .art-info{display:flex}.art-hide-cursor *{cursor:none!important}.art-video-player[data-aspect-ratio]{overflow:hidden}.art-video-player[data-aspect-ratio] .art-video{object-fit:fill;box-sizing:content-box}.art-fullscreen{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3}.art-fullscreen-web{--art-progress-height: 8px;--art-indicator-size: 20px;--art-control-height: 60px;--art-control-icon-scale: 1.3;position:fixed;inset:0;z-index:var(--art-fullscreen-web-index);width:100%;height:100%}.art-mini-popup{position:fixed;z-index:9999;width:320px;height:180px;max-width:100vw;max-height:100vh;background:#000;border-radius:var(--art-border-radius);cursor:move;user-select:none;overflow:hidden;transition:opacity .2s ease;box-shadow:0 0 5px #00000080}.art-mini-popup svg{fill:#fff}.art-mini-popup .art-video{pointer-events:none}.art-mini-popup .art-mini-close{position:absolute;z-index:20;right:10px;top:10px;cursor:pointer;opacity:0;transition:opacity .2s ease}.art-mini-popup .art-mini-state{position:absolute;inset:0;z-index:30;width:100%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transition:opacity .2s ease;background-color:#00000040}.art-mini-popup .art-mini-state .art-icon{opacity:.75;cursor:pointer;transform:scale(3);pointer-events:auto;transition:transform .2s ease}.art-mini-popup .art-mini-state .art-icon:active{transform:scale(2.5)}.art-mini-popup.art-mini-dragging{opacity:.9}.art-mini-popup:hover .art-mini-close,.art-mini-popup:hover .art-mini-state{opacity:1}.art-video-player[data-flip=horizontal] .art-video{transform:scaleX(-1)}.art-video-player[data-flip=vertical] .art-video{transform:scaleY(-1)}.art-video-player .art-layer-lock{display:none;justify-content:center;align-items:center;position:absolute;top:50%;border-radius:50%;transform:translateY(-50%);height:var(--art-lock-size);width:var(--art-lock-size);left:var(--art-padding);background-color:var(--art-tip-background)}.art-video-player .art-layer-auto-playback{display:none;gap:10px;align-items:center;position:absolute;border-radius:var(--art-border-radius);padding:10px;line-height:1;left:var(--art-padding);bottom:calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);background-color:var(--art-widget-background)}.art-video-player .art-layer-auto-playback .art-auto-playback-close{display:flex;justify-content:center;align-items:center;cursor:pointer}.art-video-player .art-layer-auto-playback .art-auto-playback-close svg{width:15px;height:15px;fill:var(--art-theme)}.art-video-player .art-layer-auto-playback .art-auto-playback-jump{color:var(--art-theme);cursor:pointer}.art-video-player.art-lock .art-subtitle{bottom:var(--art-subtitle-bottom)!important}.art-video-player.art-mini-progress-bar .art-bottom,.art-video-player.art-lock .art-bottom{opacity:1;padding:0;background-image:none}.art-video-player.art-mini-progress-bar .art-bottom .art-controls,.art-video-player.art-lock .art-bottom .art-controls,.art-video-player.art-mini-progress-bar .art-bottom .art-progress,.art-video-player.art-lock .art-bottom .art-progress{transform:translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4))}.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,.art-video-player.art-lock .art-bottom .art-progress-indicator{display:none!important}.art-video-player.art-control-show .art-layer-lock{display:flex}.art-control-selector{position:relative;display:flex;justify-content:center}.art-control-selector .art-selector-list{display:flex;flex-direction:column;align-items:center;text-align:center;position:absolute;border-radius:var(--art-border-radius);overflow-y:auto;overflow-x:hidden;opacity:0;transform:translateY(10px);pointer-events:none;bottom:var(--art-control-height);max-height:var(--art-selector-max-height);background-color:var(--art-widget-background);transition:all var(--art-transition-duration) ease}.art-control-selector .art-selector-list .art-selector-item{display:flex;justify-content:center;align-items:center;width:100%;padding:10px 15px;flex-shrink:0;line-height:1}.art-control-selector .art-selector-list .art-selector-item:hover{background-color:#ffffff1a}.art-control-selector .art-selector-list .art-selector-item:hover,.art-control-selector .art-selector-list .art-selector-item.art-current{color:var(--art-theme)}.art-control-selector:hover .art-selector-list{opacity:1;transform:translateY(0);pointer-events:auto}.art-video-player [class*=hint--]{position:relative;display:inline-block;font-style:normal}.art-video-player [class*=hint--]:before,.art-video-player [class*=hint--]:after{position:absolute;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);transform:translateZ(0);visibility:hidden;opacity:0;z-index:1000000;pointer-events:none;-webkit-transition:.3s ease;-moz-transition:.3s ease;transition:.3s ease;-webkit-transition-delay:0ms;-moz-transition-delay:0ms;transition-delay:0ms}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{visibility:visible;opacity:1}.art-video-player [class*=hint--]:hover:before,.art-video-player [class*=hint--]:hover:after{-webkit-transition-delay:.1s;-moz-transition-delay:.1s;transition-delay:.1s}.art-video-player [class*=hint--]:before{content:"";position:absolute;background:transparent;border:6px solid transparent;z-index:1000001}.art-video-player [class*=hint--]:after{background:#000;color:#fff;padding:8px 10px;font-size:12px;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;line-height:12px;white-space:nowrap}.art-video-player [class*=hint--][aria-label]:after{content:attr(aria-label)}.art-video-player [class*=hint--][data-hint]:after{content:attr(data-hint)}.art-video-player [aria-label=""]:before,.art-video-player [aria-label=""]:after,.art-video-player [data-hint=""]:before,.art-video-player [data-hint=""]:after{display:none!important}.art-video-player .hint--top-left:before{border-top-color:#000}.art-video-player .hint--top-right:before{border-top-color:#000}.art-video-player .hint--top:before{border-top-color:#000}.art-video-player .hint--bottom-left:before{border-bottom-color:#000}.art-video-player .hint--bottom-right:before{border-bottom-color:#000}.art-video-player .hint--bottom:before{border-bottom-color:#000}.art-video-player .hint--left:before{border-left-color:#000}.art-video-player .hint--right:before{border-right-color:#000}.art-video-player .hint--top:before{margin-bottom:-11px}.art-video-player .hint--top:before,.art-video-player .hint--top:after{bottom:100%;left:50%}.art-video-player .hint--top:before{left:calc(50% - 6px)}.art-video-player .hint--top:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--top:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top:hover:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--bottom:before{margin-top:-11px}.art-video-player .hint--bottom:before,.art-video-player .hint--bottom:after{top:100%;left:50%}.art-video-player .hint--bottom:before{left:calc(50% - 6px)}.art-video-player .hint--bottom:after{-webkit-transform:translateX(-50%);-moz-transform:translateX(-50%);transform:translate(-50%)}.art-video-player .hint--bottom:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom:hover:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--right:before{margin-left:-11px;margin-bottom:-6px}.art-video-player .hint--right:after{margin-bottom:-14px}.art-video-player .hint--right:before,.art-video-player .hint--right:after{left:100%;bottom:50%}.art-video-player .hint--right:hover:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--right:hover:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--left:before{margin-right:-11px;margin-bottom:-6px}.art-video-player .hint--left:after{margin-bottom:-14px}.art-video-player .hint--left:before,.art-video-player .hint--left:after{right:100%;bottom:50%}.art-video-player .hint--left:hover:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--left:hover:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--top-left:before{margin-bottom:-11px}.art-video-player .hint--top-left:before,.art-video-player .hint--top-left:after{bottom:100%;left:50%}.art-video-player .hint--top-left:before{left:calc(50% - 6px)}.art-video-player .hint--top-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--top-left:after{margin-left:12px}.art-video-player .hint--top-left:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-left:hover:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--top-right:before{margin-bottom:-11px}.art-video-player .hint--top-right:before,.art-video-player .hint--top-right:after{bottom:100%;left:50%}.art-video-player .hint--top-right:before{left:calc(50% - 6px)}.art-video-player .hint--top-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--top-right:after{margin-left:-12px}.art-video-player .hint--top-right:hover:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--top-right:hover:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--bottom-left:before{margin-top:-11px}.art-video-player .hint--bottom-left:before,.art-video-player .hint--bottom-left:after{top:100%;left:50%}.art-video-player .hint--bottom-left:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-left:after{-webkit-transform:translateX(-100%);-moz-transform:translateX(-100%);transform:translate(-100%)}.art-video-player .hint--bottom-left:after{margin-left:12px}.art-video-player .hint--bottom-left:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-left:hover:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--bottom-right:before{margin-top:-11px}.art-video-player .hint--bottom-right:before,.art-video-player .hint--bottom-right:after{top:100%;left:50%}.art-video-player .hint--bottom-right:before{left:calc(50% - 6px)}.art-video-player .hint--bottom-right:after{-webkit-transform:translateX(0);-moz-transform:translateX(0);transform:translate(0)}.art-video-player .hint--bottom-right:after{margin-left:-12px}.art-video-player .hint--bottom-right:hover:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--bottom-right:hover:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--small:after,.art-video-player .hint--medium:after,.art-video-player .hint--large:after{white-space:normal;line-height:1.4em;word-wrap:break-word}.art-video-player .hint--small:after{width:80px}.art-video-player .hint--medium:after{width:150px}.art-video-player .hint--large:after{width:300px}.art-video-player [class*=hint--]:after{text-shadow:0 -1px 0px black;box-shadow:4px 4px 8px #0000004d}.art-video-player .hint--error:after{background-color:#b34e4d;text-shadow:0 -1px 0px #592726}.art-video-player .hint--error.hint--top-left:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top-right:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--top:before{border-top-color:#b34e4d}.art-video-player .hint--error.hint--bottom-left:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom-right:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--bottom:before{border-bottom-color:#b34e4d}.art-video-player .hint--error.hint--left:before{border-left-color:#b34e4d}.art-video-player .hint--error.hint--right:before{border-right-color:#b34e4d}.art-video-player .hint--warning:after{background-color:#c09854;text-shadow:0 -1px 0px #6c5328}.art-video-player .hint--warning.hint--top-left:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top-right:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--top:before{border-top-color:#c09854}.art-video-player .hint--warning.hint--bottom-left:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom-right:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--bottom:before{border-bottom-color:#c09854}.art-video-player .hint--warning.hint--left:before{border-left-color:#c09854}.art-video-player .hint--warning.hint--right:before{border-right-color:#c09854}.art-video-player .hint--info:after{background-color:#3986ac;text-shadow:0 -1px 0px #1a3c4d}.art-video-player .hint--info.hint--top-left:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top-right:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--top:before{border-top-color:#3986ac}.art-video-player .hint--info.hint--bottom-left:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom-right:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--bottom:before{border-bottom-color:#3986ac}.art-video-player .hint--info.hint--left:before{border-left-color:#3986ac}.art-video-player .hint--info.hint--right:before{border-right-color:#3986ac}.art-video-player .hint--success:after{background-color:#458746;text-shadow:0 -1px 0px #1a321a}.art-video-player .hint--success.hint--top-left:before{border-top-color:#458746}.art-video-player .hint--success.hint--top-right:before{border-top-color:#458746}.art-video-player .hint--success.hint--top:before{border-top-color:#458746}.art-video-player .hint--success.hint--bottom-left:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom-right:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--bottom:before{border-bottom-color:#458746}.art-video-player .hint--success.hint--left:before{border-left-color:#458746}.art-video-player .hint--success.hint--right:before{border-right-color:#458746}.art-video-player .hint--always:after,.art-video-player .hint--always:before{opacity:1;visibility:visible}.art-video-player .hint--always.hint--top:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top:after{-webkit-transform:translateX(-50%) translateY(-8px);-moz-transform:translateX(-50%) translateY(-8px);transform:translate(-50%) translateY(-8px)}.art-video-player .hint--always.hint--top-left:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-left:after{-webkit-transform:translateX(-100%) translateY(-8px);-moz-transform:translateX(-100%) translateY(-8px);transform:translate(-100%) translateY(-8px)}.art-video-player .hint--always.hint--top-right:before{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--top-right:after{-webkit-transform:translateY(-8px);-moz-transform:translateY(-8px);transform:translateY(-8px)}.art-video-player .hint--always.hint--bottom:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom:after{-webkit-transform:translateX(-50%) translateY(8px);-moz-transform:translateX(-50%) translateY(8px);transform:translate(-50%) translateY(8px)}.art-video-player .hint--always.hint--bottom-left:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-left:after{-webkit-transform:translateX(-100%) translateY(8px);-moz-transform:translateX(-100%) translateY(8px);transform:translate(-100%) translateY(8px)}.art-video-player .hint--always.hint--bottom-right:before{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--bottom-right:after{-webkit-transform:translateY(8px);-moz-transform:translateY(8px);transform:translateY(8px)}.art-video-player .hint--always.hint--left:before{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--left:after{-webkit-transform:translateX(-8px);-moz-transform:translateX(-8px);transform:translate(-8px)}.art-video-player .hint--always.hint--right:before{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--always.hint--right:after{-webkit-transform:translateX(8px);-moz-transform:translateX(8px);transform:translate(8px)}.art-video-player .hint--rounded:after{border-radius:4px}.art-video-player .hint--no-animate:before,.art-video-player .hint--no-animate:after{-webkit-transition-duration:0ms;-moz-transition-duration:0ms;transition-duration:0ms}.art-video-player .hint--bounce:before,.art-video-player .hint--bounce:after{-webkit-transition:opacity .3s ease,visibility .3s ease,-webkit-transform .3s cubic-bezier(.71,1.7,.77,1.24);-moz-transition:opacity .3s ease,visibility .3s ease,-moz-transform .3s cubic-bezier(.71,1.7,.77,1.24);transition:opacity .3s ease,visibility .3s ease,transform .3s cubic-bezier(.71,1.7,.77,1.24)}.art-video-player .hint--no-shadow:before,.art-video-player .hint--no-shadow:after{text-shadow:initial;box-shadow:initial}.art-video-player .hint--no-arrow:before{display:none}.art-video-player.art-mobile{--art-bottom-gap: 10px;--art-control-height: 38px;--art-control-icon-scale: 1;--art-state-size: 60px;--art-settings-max-height: 180px;--art-selector-max-height: 180px;--art-indicator-scale: 1;--art-control-opacity: 1}.art-video-player.art-mobile .art-controls-left{margin-left:calc(var(--art-padding) / -1)}.art-video-player.art-mobile .art-controls-right{margin-right:calc(var(--art-padding) / -1)}';class mn{constructor(t){var e;this.scope=t.child(),this.cancelled=new Promise(t=>{this.scope.add(()=>{t(void 0)})}),this.signal=null==(e=function(t){if("undefined"===typeof AbortController)return;const e=new AbortController;return t.add(()=>{e.abort()}),e}(this.scope))?void 0:e.signal}get active(){return!this.scope.closed}cancel(){this.scope.dispose()}run(t){return d(this,null,function*(){if(this.active)try{return yield Promise.race([t(),this.cancelled])}finally{this.cancel()}})}}const gn=new WeakMap;function vn(t){return gn.get(t)}function yn(t){const e=t.ownedURL;t.ownedURL=void 0,e&&URL.revokeObjectURL(e)}const bn=Wt;class wn extends bn{constructor(t){super(t),this.name="subtitle",this.option=null,this.destroyEvent=()=>null;const e=function(t,e){const r=$(e).child(),n={scope:r,revision:0,render:0,trackRevision:0};return gn.set(t,n),r.add(()=>{yn(n)}),n}(this,t);this.init(t.option.subtitle).catch(()=>{});let r=!1;const n=()=>{if(e.scope.closed||!this.url)return;const n=t.template.$video.webkitDisplayingFullscreen;"boolean"===typeof n&&n!==r&&(r=n,this.createTrack(n?"subtitles":"metadata",this.url))};t.on("video:timeupdate",n),e.scope.add(()=>{t.off("video:timeupdate",n)})}get url(){return this.art.template.$track.src}set url(t){this.switch(t).catch(()=>{})}get textTrack(){var t,e;return null==(e=null==(t=this.art.template.$video)?void 0:t.textTracks)?void 0:e[0]}get activeCues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.activeCues)||[])}get cues(){var t;return Array.from((null==(t=this.textTrack)?void 0:t.cues)||[])}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?j(r,t):H(r,t,e)}update(){!function(t){const e=vn(t);if(e.scope.closed)return;const r=e.revision,n=++e.render,o=()=>!e.scope.closed&&e.revision===r&&e.render===n,{art:i}=t,{$subtitle:a}=i.template;if(a.innerHTML="",!t.activeCues.length)return;if(i.emit("subtitleBeforeUpdate",t.activeCues),!o())return;const s=t.activeCues.map((t,e)=>t.text.split(/\r?\n/).filter(t=>t.trim()).map(t=>`
\n ${i.option.subtitle.escape?gt(t):t}\n
`).join("")).join("");o()&&(a.innerHTML=s,i.emit("subtitleAfterUpdate",t.activeCues))}(this)}switch(t){return d(this,arguments,function*(t,e={}){const{i18n:r,notice:n,option:o}=this.art,i=c(l(l({},o.subtitle),e),{url:t}),a=vn(this),s=a.revision+1,d=yield this.init(i);return!a.scope.closed&&a.revision===s&&e.name&&(n.show=`${r.get("Switch Subtitle")}: ${e.name}`),d})}createTrack(t,e){!function(t,e,r){const n=vn(t);if(n.scope.closed)return;const o=++n.trackRevision,{art:i}=t,{template:a}=i,s=a.$track,l=s.parentNode,c=s.nextSibling,d=document.createElement("track"),u=n.scope.child();u.add(()=>{d.onload=null,d.onerror=null});let p=!1;try{if(d.default=!0,d.kind=e,d.src=r,d.label=i.option.subtitle.name||"Artplayer",d.track.mode="hidden",d.onload=()=>{u.closed||a.$track!==d||i.emit("subtitleLoad",t.cues,t.option)},d.onerror=()=>{u.closed||a.$track!==d||(i.notice.show=new Error("Failed to load subtitle track"))},u.closed||n.trackRevision!==o)return void u.dispose();s.remove(),a.$video.appendChild(d),a.$track=d;const l=t.textTrack,c=l?i.proxy(l,"cuechange",()=>{u.closed||a.$track!==d||t.update()}):()=>{};if(u.add(()=>{i.events.remove(c)}),u.closed||n.trackRevision!==o)return u.dispose(),void d.remove();const h=n.track;n.track=u,t.destroyEvent=c,s.onload=null,s.onerror=null,p=!0;try{null==h||h.dispose()}finally{n.ownedURL&&n.ownedURL!==r&&yn(n)}}catch(h){if(p)throw h;if(u.dispose(),d.remove(),n.scope.closed||n.trackRevision!==o)throw h;throw a.$track=s,l&&l.insertBefore(s,(null==c?void 0:c.parentNode)===l?c:null),h}}(this,t,e)}init(t){return d(this,null,function*(){const e=vn(this),r=function(t){const e=t.request,r=new mn(t.scope);return t.request=r,t.revision+=1,null==e||e.cancel(),r}(e),{notice:n,template:{$subtitle:o}}=this.art;return r.run(()=>d(this,null,function*(){if(!this.textTrack)return null;if(m(t,Nt.subtitle),!t.url)return;let i;this.option=t,this.style(t.style);try{if(!r.active)return;const n=yield fetch(t.url,{signal:r.signal});if(!r.active)return;if(!n.ok)throw new Error(`Failed to load subtitle: ${n.status} ${n.statusText}`);const a=yield n.arrayBuffer();if(!r.active)return;const s=function(t,e){const r=new TextDecoder(e.encoding).decode(t);switch(e.type||lt(e.url)){case"srt":return{vtt:e.onVttLoad(kt(r))};case"ass":return{vtt:e.onVttLoad(Et(r))};case"vtt":return{vtt:e.onVttLoad(r)};default:return}}(a,t);if(!r.active)return;const l=void 0===s?t.url:i=$t(s.vtt);if(!r.active)return;o.innerHTML="";const c=e.trackRevision+1;if(this.url!==l&&this.createTrack("metadata",l),!r.active||e.trackRevision>c)return;return i&&(e.ownedURL=i,i=void 0),l}catch(a){if(!r.active)return;throw o.innerHTML="",n.show=a,a}finally{i&&(e.scope.closed||this.url!==i?URL.revokeObjectURL(i):e.ownedURL=i)}}))})}}const xn=`\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
${g}
\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 `;class kn{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=D(e.container),at(this.$container,`No container element found by ${e.container}`)),at(tt(),"The current browser does not support flex layout");const n=this.$container.tagName.toLowerCase();at("div"===n,`Unsupported container element type, only support 'div' but got '${n}'`),at(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),function(t,e,r){const n=x.get(e);if(n&&n!==t)throw new Error("Cannot mount multiple instances on the same dom element");const o=k(t);o.rollback=r,x.set(e,t),o.releaseContainer=()=>{x.get(e)===t&&x.delete(e)}}(t,this.$container,en(this.$container)),this.$container.dataset.artId=String(t.id),this.init()}static get html(){return xn}query(t){return D(t,this.$container)}init(){const{option:t}=this.art;var e;if(t.useSSR||(this.$container.innerHTML=kn.html),(e=this).$player=e.query(".art-video-player"),e.$video=e.query(".art-video"),e.$track=e.query("track"),e.$poster=e.query(".art-poster"),e.$subtitle=e.query(".art-subtitle"),e.$danmuku=e.query(".art-danmuku"),e.$bottom=e.query(".art-bottom"),e.$progress=e.query(".art-progress"),e.$controls=e.query(".art-controls"),e.$controlsLeft=e.query(".art-controls-left"),e.$controlsCenter=e.query(".art-controls-center"),e.$controlsRight=e.query(".art-controls-right"),e.$layer=e.query(".art-layers"),e.$loading=e.query(".art-loading"),e.$notice=e.query(".art-notice"),e.$noticeInner=e.query(".art-notice-inner"),e.$mask=e.query(".art-mask"),e.$state=e.query(".art-state"),e.$setting=e.query(".art-settings"),e.$info=e.query(".art-info"),e.$infoPanel=e.query(".art-info-panel"),e.$infoClose=e.query(".art-info-close"),e.$contextmenu=e.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);!function(t){at(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'")}(e),Z(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&F(this.$player,"art-backdrop"),I&&F(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":F(this.$player,"art-destroy")}}const $n=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class En{on(t,e,r){const n=this.e||(this.e={});let o=$n(n,t)?n[t]:void 0;return o||(o=[],Object.defineProperty(n,t,{value:o,enumerable:!0,configurable:!0,writable:!0})),o.push({fn:e,ctx:r}),this}once(t,e,r){const n=this,o=e;let i=!1;function a(...e){i||(i=!0,n.off(t,a),o.apply(r,e))}return a._=e,this.on(t,a,r)}emit(t,...e){const r=this.e||(this.e={}),n=($n(r,t)&&r[t]||[]).slice();for(const o of n)o.fn.apply(o.ctx,e);return this}off(t,e){const r=this.e||(this.e={}),n=$n(r,t)?r[t]:void 0,o=[];if(n&&e)for(let i=0,a=n.length;ie.call(this,this)),Ln.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Ln.version}`);for(let e=0;et(`Event@${e.type}`))}(function(t){const e=k(t);return e.rollback=void 0,!e.scope.closed})(this)&&Cn.push(this)}catch(n){try{T(this,Cn,!0,Ln.REMOVE_SRC_WHEN_DESTROY,!0)}catch(o){console.warn("Failed to clean up ArtPlayer initialization:",o)}throw n}}static get instances(){return Cn}static get version(){return g}static get config(){return v}static get utils(){return Ct}static get scheme(){return Nt}static get Emitter(){return En}static get validator(){return m}static get kindOf(){return m.kindOf}static get html(){return kn.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:A?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:null==navigator?void 0: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){T(this,Cn,t,Ln.REMOVE_SRC_WHEN_DESTROY)}}return Ln.STYLE=fn,Ln.DEBUG=!1,Ln.CONTEXTMENU=!0,Ln.NOTICE_TIME=2e3,Ln.SETTING_WIDTH=250,Ln.SETTING_ITEM_WIDTH=200,Ln.SETTING_ITEM_HEIGHT=35,Ln.RESIZE_TIME=200,Ln.SCROLL_TIME=200,Ln.SCROLL_GAP=50,Ln.AUTO_PLAYBACK_MAX=10,Ln.AUTO_PLAYBACK_MIN=5,Ln.AUTO_PLAYBACK_TIMEOUT=3e3,Ln.RECONNECT_TIME_MAX=5,Ln.RECONNECT_SLEEP_TIME=1e3,Ln.CONTROL_HIDE_TIME=3e3,Ln.DBCLICK_TIME=300,Ln.DBCLICK_FULLSCREEN=!0,Ln.MOBILE_DBCLICK_PLAY=!0,Ln.MOBILE_CLICK_PLAY=!1,Ln.AUTO_ORIENTATION_TIME=200,Ln.INFO_LOOP_TIME=1e3,Ln.FAST_FORWARD_VALUE=3,Ln.FAST_FORWARD_TIME=1e3,Ln.TOUCH_MOVE_RATIO=.5,Ln.VOLUME_STEP=.1,Ln.SEEK_STEP=5,Ln.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Ln.ASPECT_RATIO=["default","4:3","16:9"],Ln.FLIP=["normal","horizontal","vertical"],Ln.FULLSCREEN_WEB_IN_BODY=!0,Ln.LOG_VERSION=!0,Ln.USE_RAF=!1,Ln.REMOVE_SRC_WHEN_DESTROY=!0,_&&(window.Artplayer=Ln,N("artplayer-style",fn),setTimeout(()=>{Ln.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Ln.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Ln}); diff --git a/packages/artplayer/dist/artplayer.mjs b/packages/artplayer/dist/artplayer.mjs index 38b54480e..cf92ebd7c 100644 --- a/packages/artplayer/dist/artplayer.mjs +++ b/packages/artplayer/dist/artplayer.mjs @@ -318,11 +318,11 @@ class ResourceScope { return this.disposed; } add(cleanup) { - let active = true; + let active2 = true; const release = () => { - if (!active) + if (!active2) return; - active = false; + active2 = false; this.cleanups.delete(release); cleanup(); }; @@ -508,14 +508,14 @@ function query(selector, parent = document) { function queryAll(selector, parent = document) { return Array.from(parent.querySelectorAll(selector)); } -function addClass(target, className) { - return target.classList.add(className); +function addClass(target, className2) { + return target.classList.add(className2); } -function removeClass(target, className) { - return target.classList.remove(className); +function removeClass(target, className2) { + return target.classList.remove(className2); } -function hasClass(target, className) { - return target.classList.contains(className); +function hasClass(target, className2) { + return target.classList.contains(className2); } function append(parent, child) { if (child instanceof Element) { @@ -545,9 +545,9 @@ function getStyle(element, key, numberType = true) { function siblings(target) { return Array.from(target.parentElement.children).filter((item) => item !== target); } -function inverseClass(target, className) { - siblings(target).forEach((item) => removeClass(item, className)); - addClass(target, className); +function inverseClass(target, className2) { + siblings(target).forEach((item) => removeClass(item, className2)); + addClass(target, className2); } function tooltip(target, msg, pos = "top") { if (isMobile) @@ -1057,11 +1057,11 @@ class Component { } set show(value) { const { $player } = this.art.template; - const className = `art-${this.name}-show`; + const className2 = `art-${this.name}-show`; if (value) - addClass($player, className); + addClass($player, className2); else - removeClass($player, className); + removeClass($player, className2); this.art.emit(this.name, value); } toggle() { @@ -1393,6 +1393,34 @@ class Contextmenu extends Component { }); } } +function listen(scope, target, name, callback, options = {}) { + const { capture = false, once = false, signal } = options; + if (scope.closed || signal?.aborted) + return () => { + }; + let release = () => { + }; + function listener(event) { + if (once) + release(); + if (scope.closed) + return; + if (typeof callback === "function") + callback.call(this, event); + else + callback.handleEvent(event); + } + target.addEventListener(name, listener, options); + release = scope.add(() => { + try { + target.removeEventListener(name, listener, capture); + } finally { + signal?.removeEventListener("abort", release); + } + }); + signal?.addEventListener("abort", release, { once: true }); + return release; +} function timeout(scope, callback, delay) { if (scope.closed) return () => { @@ -1930,8 +1958,8 @@ function installControls(controls) { ); } if (option.quality.length) { - wait(getScope(controls.art)).then((active) => { - if (!active || getScope(controls.art).closed) + wait(getScope(controls.art)).then((active2) => { + if (!active2 || getScope(controls.art).closed) return; controls.art.quality = option.quality; }).catch((error2) => { @@ -2024,10 +2052,10 @@ function observeControlLayout(art) { update(); } const selections = /* @__PURE__ */ new WeakMap(); -function trackSelection(event, active) { - selections.set(event, active); +function trackSelection(event, active2) { + selections.set(event, active2); return () => { - if (selections.get(event) === active) + if (selections.get(event) === active2) selections.delete(event); }; } @@ -2091,15 +2119,15 @@ function renderSelector(art, check2, option, $ref, events) { if (!item) return; const current2 = ++generation; - const active = () => !scope.closed && current2 === generation; - const release = scope.add(trackSelection(event2, active)); + const active2 = () => !scope.closed && current2 === generation; + const release = scope.add(trackSelection(event2, active2)); try { check2(item); if (scope.closed) return; if (option.onSelect) { const value = await option.onSelect.call(art, item, item.$control_item, event2); - if (active()) + if (active2()) setHTML($value, value); } } catch (error2) { @@ -2666,7 +2694,7 @@ const setting = ' 0 && Number.isFinite(height) && height > 0; +} +function containSize(container, ratio) { + if (!positiveSize(container) || !Number.isFinite(ratio) || ratio <= 0) + return; + const result = container.width / container.height > ratio ? { width: ratio * container.height, height: container.height, axis: "width" } : { width: container.width, height: container.width / ratio, axis: "height" }; + return positiveSize(result) ? result : void 0; +} +function proportionalHeight(width, media) { + if (!Number.isFinite(width) || width <= 0 || !positiveSize(media)) + return; + const height = media.height * (width / media.width); + return Number.isFinite(height) && height > 0 ? height : void 0; +} function aspectRatioMix(art) { - const { - i18n, - notice, - template: { $video, $player } - } = art; + const { i18n, notice, template: { $video, $player } } = art; def(art, "aspectRatio", { - get() { - return $player.dataset.aspectRatio || "default"; - }, + get: () => $player.dataset.aspectRatio || "default", set(ratio) { + if (isClosing(art)) + return; if (!ratio) ratio = "default"; if (ratio === "default") { - setStyle($video, "width", null); - setStyle($video, "height", null); - setStyle($video, "margin", null); + $video.style.width = ""; + $video.style.height = ""; + $video.style.margin = ""; delete $player.dataset.aspectRatio; } else { - const ratioArray = ratio.split(":").map(Number); - const { clientWidth, clientHeight } = $player; - const playerRatio = clientWidth / clientHeight; - const setupRatio = ratioArray[0] / ratioArray[1]; - if (playerRatio > setupRatio) { - setStyle($video, "width", `${setupRatio * clientHeight}px`); - setStyle($video, "height", "100%"); - setStyle($video, "margin", "0 auto"); - } else { - setStyle($video, "width", "100%"); - setStyle($video, "height", `${clientWidth / setupRatio}px`); - setStyle($video, "margin", "auto 0"); + const parts = ratio.split(":").map(Number); + const size = containSize({ width: $player.clientWidth, height: $player.clientHeight }, parts[0] / parts[1]); + if (isClosing(art)) + return; + if (size?.axis === "width") { + $video.style.width = `${size.width}px`; + $video.style.height = "100%"; + $video.style.margin = "0 auto"; + } else if (size) { + $video.style.width = "100%"; + $video.style.height = `${size.height}px`; + $video.style.margin = "auto 0"; } $player.dataset.aspectRatio = ratio; } notice.show = `${i18n.get("Aspect Ratio")}: ${ratio === "default" ? i18n.get("Default") : ratio}`; - art.emit("aspectRatio", ratio); + if (!isClosing(art)) + art.emit("aspectRatio", ratio); } }); } @@ -2977,15 +3017,15 @@ function attrMix(art) { }); } function autoHeightMix(art) { - const { - template: { $container, $video } - } = art; + const { $container, $video } = art.template; def(art, "autoHeight", { value() { - const { clientWidth } = $container; - const { videoHeight, videoWidth } = $video; - const height = videoHeight * (clientWidth / videoWidth); - setStyle($container, "height", `${height}px`); + if (isClosing(art)) + return; + const height = proportionalHeight($container.clientWidth, { width: $video.videoWidth, height: $video.videoHeight }); + if (height === void 0 || isClosing(art)) + return; + $container.style.height = `${height}px`; art.emit("autoHeight", height); } }); @@ -2994,23 +3034,23 @@ function autoSizeMix(art) { const { $container, $player, $video } = art.template; def(art, "autoSize", { value() { - const { videoWidth, videoHeight } = $video; - const { width, height } = getRect($container); - const videoRatio = videoWidth / videoHeight; - const containerRatio = width / height; - if (containerRatio > videoRatio) { - const percentage = height * videoRatio / width * 100; - setStyle($player, "width", `${percentage}%`); - setStyle($player, "height", "100%"); + if (isClosing(art)) + return; + const media = { width: $video.videoWidth, height: $video.videoHeight }; + if (!positiveSize(media)) + return; + const container = getRect($container); + const size = containSize(container, media.width / media.height); + if (!size || isClosing(art)) + return; + if (size.axis === "width") { + $player.style.width = `${size.width / container.width * 100}%`; + $player.style.height = "100%"; } else { - const percentage = width / videoRatio / height * 100; - setStyle($player, "width", "100%"); - setStyle($player, "height", `${percentage}%`); + $player.style.width = "100%"; + $player.style.height = `${size.height / container.height * 100}%`; } - art.emit("autoSize", { - width: art.width, - height: art.height - }); + art.emit("autoSize", { width: art.width, height: art.height }); } }); } @@ -3067,9 +3107,9 @@ function listenMedia(art, name, callback, once = false) { art.off(name, guarded); }); } -function showMediaUI(art, changes, active) { +function showMediaUI(art, changes, active2) { for (const [name, value] of changes) { - if (isClosing(art) || active && !active()) + if (isClosing(art) || active2 && !active2()) return; art[name].show = value; } @@ -3147,13 +3187,13 @@ function installEnded(art) { const { option } = art; listenMedia(art, "video:ended", () => { if (option.loop) { - const active = captureSource(art); + const active2 = captureSource(art); art.seek = 0; - if (isClosing(art) || !active()) + if (isClosing(art) || !active2()) return; silencePromise(art.play()); - if (active()) - showMediaUI(art, [["controls", false], ["mask", false]], active); + if (active2()) + showMediaUI(art, [["controls", false], ["mask", false]], active2); } else { showMediaUI(art, [["controls", true], ["mask", true]]); } @@ -3222,20 +3262,20 @@ function createReconnect(art) { if (pending2 === attempt) pending2 = void 0; }); - const active = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); + const active2 = () => !isClosing(art) && !attempt.closed && current2 === getSourceScope(art); const retry = attempts < constructor.RECONNECT_TIME_MAX; try { if (!retry) { - showMediaUI(art, [["mask", true], ["loading", false], ["controls", true]], active); - if (!active()) + showMediaUI(art, [["mask", true], ["loading", false], ["controls", true]], active2); + if (!active2()) return; addClass($player, "art-error"); } - if (!await wait(attempt, constructor.RECONNECT_SLEEP_TIME) || !active()) + if (!await wait(attempt, constructor.RECONNECT_SLEEP_TIME) || !active2()) return; if (retry) { const url = option.url; - if (!active()) + if (!active2()) return; attempts += 1; const attemptNumber = attempts; @@ -3253,7 +3293,7 @@ function createReconnect(art) { art.emit("error", error2, attemptNumber); } else { const message = i18n.get("Video Load Failed"); - if (active()) + if (active2()) notice.show = message; } } finally { @@ -3285,25 +3325,21 @@ function eventInit(art) { installPlaybackUI(art, reconnect); } function flipMix(art) { - const { - template: { $player }, - i18n, - notice - } = art; + const { template: { $player }, i18n, notice } = art; def(art, "flip", { - get() { - return $player.dataset.flip || "normal"; - }, + get: () => $player.dataset.flip || "normal", set(flip2) { + if (isClosing(art)) + return; if (!flip2) flip2 = "normal"; - if (flip2 === "normal") { + if (flip2 === "normal") delete $player.dataset.flip; - } else { + else $player.dataset.flip = flip2; - } notice.show = `${i18n.get("Video Flip")}: ${i18n.get(capitalize(flip2))}`; - art.emit("flip", flip2); + if (!isClosing(art)) + art.emit("flip", flip2); } }); } @@ -3439,110 +3475,477 @@ Object.defineProperties(screenfull, { get: () => Boolean(document[nativeAPI.fullscreenEnabled]) } }); -function fullscreenMix(art) { - const { - i18n, - notice, - template: { $video, $player } - } = art; - const nativeScreenfull = (art2) => { - screenfull.on("change", () => { - art2.emit("fullscreen", screenfull.isFullscreen); - if (screenfull.isFullscreen) { - art2.state = "fullscreen"; - addClass($player, "art-fullscreen"); +function call(target, name, ...args) { + const method = Reflect.get(target, name); + if (typeof method !== "function") + throw new TypeError(`Fullscreen method ${name} is not available`); + return method.apply(target, args); +} +function fullscreenAdapter(target) { + const raw = screenfull.raw; + const document2 = target.ownerDocument; + if (!raw || !Reflect.get(document2, raw.fullscreenEnabled)) + return void 0; + return { + document: document2, + target, + get element() { + return Reflect.get(document2, raw.fullscreenElement); + }, + elementProperty: raw.fullscreenElement, + changeEvent: raw.fullscreenchange, + errorEvent: raw.fullscreenerror, + request: () => call(target, raw.requestFullscreen, void 0), + exit: () => call(document2, raw.exitFullscreen) + }; +} +const abandoned$2 = /* @__PURE__ */ new WeakMap(); +function hasAbandonedFullscreen(adapter) { + return abandoned$2.get(adapter.document)?.has(adapter.target) ?? false; +} +function clearAbandonedFullscreen(adapter) { + abandoned$2.get(adapter.document)?.delete(adapter.target); +} +function exitNative(exit) { + try { + void Promise.resolve(exit()).catch(() => { + }); + } catch { + } +} +function entriesFor(document2, elementProperty, changeEvent) { + let entries = abandoned$2.get(document2); + if (!entries) { + entries = /* @__PURE__ */ new WeakMap(); + abandoned$2.set(document2, entries); + const pending2 = entries; + document2.addEventListener(changeEvent, () => { + const element = Reflect.get(document2, elementProperty); + const release = element && pending2.get(element); + if (!release) + return; + pending2.delete(element); + exitNative(release); + }); + } + return entries; +} +function abandonFullscreen(adapter) { + const { document: document2, elementProperty, changeEvent, target, exit } = adapter; + const entries = entriesFor(document2, elementProperty, changeEvent); + entries.set(target, exit); + if (adapter.element === target) { + entries.delete(target); + exitNative(exit); + } +} +function requestFullscreen(adapter, parent, entering, lateCompletion, hasExited = () => adapter.element !== adapter.target) { + const scope = parent.child(); + let done = false; + let cancelled = false; + let returned = false; + let promiseResult = false; + let eventFailed = false; + let resolve; + let reject; + const promise = new Promise((accept, fail) => { + resolve = accept; + reject = fail; + }); + scope.add(() => { + if (!done) { + done = true; + cancelled = true; + resolve(); + if (returned && !promiseResult && entering) + abandonFullscreen(adapter); + } + }); + function finish2(failed = false, error2) { + if (done) + return; + done = true; + try { + scope.dispose(); + } catch (cleanupError) { + if (!failed) { + failed = true; + error2 = cleanupError; + } + } + if (failed) + reject(error2); + else + resolve(); + } + const changed = () => { + if (returned && !promiseResult && (entering ? adapter.element === adapter.target : hasExited())) + finish2(); + }; + listen(scope, adapter.document, adapter.changeEvent, changed); + listen(scope, adapter.document, adapter.errorEvent, (event) => { + if (event.target === adapter.target || event.target === adapter.document) { + eventFailed = true; + if (returned && !promiseResult) + finish2(true, new Error("Fullscreen request failed")); + } + }); + if (!scope.closed) { + try { + if (entering) + clearAbandonedFullscreen(adapter); + const result = entering ? adapter.request() : adapter.exit(); + promiseResult = Boolean(result && typeof result.then === "function"); + returned = true; + if (cancelled && !promiseResult && entering) + abandonFullscreen(adapter); + if (promiseResult) { + void Promise.resolve(result).then(() => { + if (cancelled) + lateCompletion(); + else + finish2(); + }, (error2) => finish2(true, error2)).catch(() => { + }); + } else if (eventFailed) { + finish2(true, new Error("Fullscreen request failed")); } else { - removeClass($player, "art-fullscreen"); + changed(); } - art2.emit("resize"); - }); - screenfull.on("error", (event) => { - art2.emit("fullscreenError", event); - }); - def(art2, "fullscreen", { - get() { - return screenfull.isFullscreen; - }, - async set(value) { - if (value) { - await screenfull.request($player); - } else { - await screenfull.exit(); + } catch (error2) { + finish2(true, error2); + } + } + return { promise, cancel: () => scope.dispose() }; +} +function nativeFullscreen(art, adapter) { + const scope = getScope(art).child(); + const { $player, $video } = art.template; + const ownsFullscreen = () => adapter.element === $player || adapter.element === $video; + let last = ownsFullscreen(); + let revision = 0; + let desired = last; + let pending2; + let pendingEntry = false; + let cancelledEntry = false; + let requesting = false; + function exitOwned() { + if (!ownsFullscreen()) + return; + try { + void Promise.resolve(adapter.exit()).catch(() => { + }); + } catch { + } + } + scope.add(() => { + revision += 1; + desired = false; + $player.classList.remove("art-fullscreen"); + exitOwned(); + }); + listen(scope, adapter.document, adapter.changeEvent, () => { + const value = ownsFullscreen(); + if (value && hasAbandonedFullscreen(adapter)) + return; + if (value && cancelledEntry) { + exitOwned(); + return; + } + if (value === last || isClosing(art)) + return; + last = value; + const current2 = revision; + const stale = () => isClosing(art) || ownsFullscreen() !== value || current2 !== revision && desired !== value; + art.emit("fullscreen", value); + if (stale()) + return; + if (value) + art.state = "fullscreen"; + if (stale()) + return; + $player.classList.toggle("art-fullscreen", value); + art.emit("resize"); + }); + listen(scope, adapter.document, adapter.errorEvent, (event) => { + const ownEvent = event.target === $player || event.target === $video || event.target === adapter.document && (requesting || pending2 !== void 0 || ownsFullscreen()); + if (ownEvent && !isClosing(art)) + art.emit("fullscreenError", event); + }); + return { + get: () => !isClosing(art) && ownsFullscreen(), + set(value) { + if (isClosing(art)) + return Promise.resolve(); + const current2 = ++revision; + desired = Boolean(value); + if (desired) + cancelledEntry = false; + else if (pendingEntry) + cancelledEntry = true; + pending2?.cancel(); + pending2 = void 0; + pendingEntry = false; + if (!desired && !ownsFullscreen()) + return Promise.resolve(); + requesting = true; + pendingEntry = desired; + const operation = requestFullscreen(adapter, scope, desired, () => { + if (isClosing(art) || !desired) + exitOwned(); + }, () => !ownsFullscreen()); + requesting = false; + if (revision === current2) + pending2 = operation; + else + operation.cancel(); + const result = operation.promise.catch((error2) => { + if (!isClosing(art) && revision === current2) + art.notice.show = error2; + throw error2; + }).finally(() => { + if (revision === current2) { + pending2 = void 0; + pendingEntry = false; } - } - }); + }); + void result.catch(() => { + }); + return result; + } }; - const webkitScreenfull = (art2) => { - art2.on("document:webkitfullscreenchange", () => { - art2.emit("fullscreen", art2.fullscreen); - art2.emit("resize"); - }); - def(art2, "fullscreen", { - get() { - return document.fullscreenElement === $video; - }, - set(value) { - if (value) { - art2.state = "fullscreen"; +} +const abandoned$1 = /* @__PURE__ */ new WeakSet(); +function videoIsFullscreen(video, observed = false) { + if (typeof video.webkitPresentationMode === "string") + return video.webkitPresentationMode === "fullscreen"; + if (typeof video.webkitDisplayingFullscreen === "boolean") + return video.webkitDisplayingFullscreen; + return video.ownerDocument.fullscreenElement === video || observed; +} +function clearAbandonedVideo(video) { + abandoned$1.delete(video); + video.removeEventListener("webkitbeginfullscreen", releaseAbandonedVideo); + video.removeEventListener("webkitpresentationmodechanged", releaseAbandonedVideo); +} +function releaseAbandonedVideo(event) { + if (!abandoned$1.has(this) || !videoIsFullscreen(this, event.type === "webkitbeginfullscreen")) + return; + clearAbandonedVideo(this); + try { + this.webkitExitFullscreen?.(); + } catch { + } +} +function abandonVideo(video) { + abandoned$1.add(video); + video.addEventListener("webkitbeginfullscreen", releaseAbandonedVideo); + video.addEventListener("webkitpresentationmodechanged", releaseAbandonedVideo); +} +function isAbandonedVideo(video) { + return abandoned$1.has(video); +} +function videoFullscreen(art) { + const { $video } = art.template; + const scope = getScope(art).child(); + let observed = false; + let last = videoIsFullscreen($video); + let desired = last; + let pending2 = false; + let revision = 0; + const active2 = () => videoIsFullscreen($video, observed); + function changed(hint) { + if (isClosing(art) || isAbandonedVideo($video)) + return; + if (typeof hint === "boolean") + observed = hint; + const value = active2(); + if (value) + pending2 = false; + if (value === last) + return; + last = value; + const current2 = revision; + const stale = () => isClosing(art) || active2() !== value || current2 !== revision && desired !== value; + art.emit("fullscreen", value); + if (stale()) + return; + if (value) + art.state = "fullscreen"; + if (!stale()) + art.emit("resize"); + } + scope.add(() => { + revision++; + desired = false; + if (pending2) + abandonVideo($video); + if (active2()) + $video.webkitExitFullscreen?.(); + }); + listen(scope, $video, "webkitbeginfullscreen", () => changed(true)); + listen(scope, $video, "webkitendfullscreen", () => changed(false)); + listen(scope, $video, "webkitpresentationmodechanged", () => changed()); + const documentChanged = () => changed(); + art.on("document:webkitfullscreenchange", documentChanged); + scope.add(() => { + art.off("document:webkitfullscreenchange", documentChanged); + }); + return { + get: () => !isClosing(art) && active2(), + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + desired = Boolean(value); + if (value) { + clearAbandonedVideo($video); + art.state = "fullscreen"; + if (isClosing(art) || current2 !== revision) + return; + pending2 = true; + try { $video.webkitEnterFullscreen(); - } else { - $video.webkitExitFullscreen(); + } catch (error2) { + if (current2 === revision) + pending2 = false; + throw error2; } + } else { + if (pending2) { + pending2 = false; + abandonVideo($video); + } + if (active2()) + $video.webkitExitFullscreen(); } - }); + } }; - art.once("video:loadedmetadata", () => { - if (screenfull.isEnabled) { - nativeScreenfull(art); - } else if ($video.webkitSupportsFullscreen) { - webkitScreenfull(art); +} +function fullscreenMix(art) { + const { i18n, notice, template: { $video, $player } } = art; + const metadata = () => { + if (isClosing(art)) + return; + const adapter = fullscreenAdapter($player); + if (adapter) { + def(art, "fullscreen", nativeFullscreen(art, adapter)); + } else if ($video.webkitSupportsFullscreen && typeof $video.webkitEnterFullscreen === "function" && typeof $video.webkitExitFullscreen === "function") { + def(art, "fullscreen", videoFullscreen(art)); } else { def(art, "fullscreen", { - get() { - return false; - }, + get: () => false, set() { - notice.show = i18n.get("Fullscreen Not Supported"); + if (!isClosing(art)) + notice.show = i18n.get("Fullscreen Not Supported"); } }); } def(art, "fullscreen", get(art, "fullscreen")); + }; + art.once("video:loadedmetadata", metadata); + getScope(art).add(() => { + art.off("video:loadedmetadata", metadata); }); } +function capturePlacement(node) { + return { node, parent: node.parentNode, next: node.nextSibling }; +} +function restorePlacement({ node, parent, next }) { + if (!parent) { + node.parentNode?.removeChild(node); + return; + } + const anchor = next?.parentNode === parent ? next : null; + if (node.parentNode !== parent || node.nextSibling !== anchor) + parent.insertBefore(node, anchor); +} +function webFullscreen(art) { + const { $player } = art.template; + let saved; + let revision = 0; + function restore(snapshot, active2) { + if (snapshot.style === null) + $player.removeAttribute("style"); + else + $player.setAttribute("style", snapshot.style); + if (!active2()) + return false; + $player.classList.remove("art-fullscreen-web"); + if (!active2()) + return false; + restorePlacement(snapshot.placement); + return active2(); + } + getScope(art).add(() => { + revision += 1; + const snapshot = saved; + saved = void 0; + if (snapshot) { + try { + restore(snapshot, () => true); + } catch (error2) { + try { + if ($player.parentNode !== snapshot.placement.parent) + $player.parentNode?.removeChild($player); + } catch (detachError) { + throw new ResourceCleanupError([error2, detachError]); + } + throw error2; + } + } + }); + return (value) => { + if (isClosing(art)) + return; + const current2 = ++revision; + const active2 = () => current2 === revision && !isClosing(art); + if (value) { + if (!saved) + saved = { placement: capturePlacement($player), style: $player.getAttribute("style") }; + const snapshot = saved; + try { + if (art.constructor.FULLSCREEN_WEB_IN_BODY && $player.parentNode !== document.body) + document.body.appendChild($player); + if (!active2()) + return; + art.state = "fullscreenWeb"; + if (!active2()) + return; + $player.style.width = "100%"; + $player.style.height = "100%"; + $player.classList.add("art-fullscreen-web"); + } catch (error2) { + if (active2() && restore(snapshot, active2)) + saved = void 0; + throw error2; + } + if (!active2()) + return; + art.emit("fullscreenWeb", true); + } else { + if (saved) { + if (!restore(saved, active2)) + return; + saved = void 0; + } else { + $player.classList.remove("art-fullscreen-web"); + } + if (!active2()) + return; + art.emit("fullscreenWeb", false); + } + if (active2()) + art.emit("resize"); + }; +} function fullscreenWebMix(art) { - const { - constructor, - template: { $container, $player } - } = art; - let cssText = ""; + const setFullscreen = webFullscreen(art); def(art, "fullscreenWeb", { get() { - return hasClass($player, "art-fullscreen-web"); + return art.template.$player.classList.contains("art-fullscreen-web"); }, - set(value) { - if (value) { - cssText = $player.style.cssText; - if (constructor.FULLSCREEN_WEB_IN_BODY) { - append(document.body, $player); - } - art.state = "fullscreenWeb"; - setStyle($player, "width", "100%"); - setStyle($player, "height", "100%"); - addClass($player, "art-fullscreen-web"); - art.emit("fullscreenWeb", true); - } else { - if (constructor.FULLSCREEN_WEB_IN_BODY) { - append($container, $player); - } - if (cssText) { - $player.style.cssText = cssText; - cssText = ""; - } - removeClass($player, "art-fullscreen-web"); - art.emit("fullscreenWeb", false); - } - art.emit("resize"); - } + set: setFullscreen }); } function loadedMix(art) { @@ -3553,121 +3956,263 @@ function loadedMix(art) { get: () => $video.buffered.length ? $video.buffered.end($video.buffered.length - 1) : 0 }); } -function miniMix(art) { - const { - icons, - proxy, - storage, - template: { $player, $video } - } = art; - let isDragging = false; - let lastPageX = 0; - let lastPageY = 0; - function hideMini() { - const { $mini } = art.template; - if ($mini) { - removeClass($player, "art-mini"); - setStyle($mini, "display", "none"); - $player.prepend($video); +function clampMini(left, top, geometry) { + const maxLeft = Math.max(0, geometry.viewportWidth - geometry.width); + const maxTop = Math.max(0, geometry.viewportHeight - geometry.height); + return { left: Math.max(0, Math.min(left, maxLeft)), top: Math.max(0, Math.min(top, maxTop)) }; +} +function miniPosition(left, top, geometry) { + if (typeof left === "number" && Number.isFinite(left) && typeof top === "number" && Number.isFinite(top) && left >= 0 && top >= 0 && left + geometry.width <= geometry.viewportWidth && top + geometry.height <= geometry.viewportHeight) { + return { left, top, reset: false }; + } + return { ...clampMini(geometry.viewportWidth - geometry.width - 50, geometry.viewportHeight - geometry.height - 50, geometry), reset: true }; +} +function miniGeometry(element) { + const { width, height } = element.getBoundingClientRect(); + const view = element.ownerDocument.defaultView; + return { width, height, viewportWidth: view.innerWidth, viewportHeight: view.innerHeight }; +} +function miniDrag(art, element, scope, active2) { + let dragging = false; + let startX = 0; + let startY = 0; + const cancel = () => { + dragging = false; + element.classList.remove("art-mini-dragging"); + element.style.transform = ""; + }; + listen(scope, element, "mousedown", (event) => { + const mouse = event; + if (mouse.button !== 0 || !active2()) + return; + dragging = true; + startX = mouse.clientX; + startY = mouse.clientY; + }); + const move = (event) => { + if (!scope.closed && dragging && active2()) { + element.classList.add("art-mini-dragging"); + element.style.transform = `translate(${event.clientX - startX}px, ${event.clientY - startY}px)`; + } + }; + const end = () => { + if (scope.closed || !dragging || !active2()) + return; + const rect = element.getBoundingClientRect(); + const position = clampMini(rect.left, rect.top, miniGeometry(element)); + cancel(); + element.style.left = `${position.left}px`; + element.style.top = `${position.top}px`; + art.storage.set("left", position.left); + if (!scope.closed) + art.storage.set("top", position.top); + }; + art.on("document:mousemove", move); + scope.add(() => { + art.off("document:mousemove", move); + }); + art.on("document:mouseup", end); + scope.add(() => { + art.off("document:mouseup", end); + }); + scope.add(cancel); + return cancel; +} +function createMiniView(art, parent, active2, hide) { + const scope = parent.child(); + if (scope.closed) + return; + const existing = art.template.$mini; + if (existing) { + const display = existing.style.display; + scope.add(() => { + existing.style.display = display; + }); + return { element: existing, cancelDrag: () => { + }, fresh: false }; + } + const document2 = art.template.$player.ownerDocument; + const element = document2.createElement("div"); + element.className = "art-mini-popup"; + scope.add(() => { + element.remove(); + }); + try { + const close2 = document2.createElement("div"); + close2.className = "art-mini-close"; + close2.append(art.icons.close); + if (scope.closed) + return; + const state2 = document2.createElement("div"); + state2.className = "art-mini-state"; + const play2 = art.icons.play; + const pause2 = art.icons.pause; + if (scope.closed) + return; + state2.append(play2, pause2); + element.append(close2, state2); + listen(scope, close2, "click", hide); + listen(scope, play2, "click", () => { + silencePromise(art.play()); + }); + listen(scope, pause2, "click", () => { + art.pause(); + }); + const update = () => { + if (scope.closed) + return; + play2.style.display = art.playing ? "none" : "flex"; + pause2.style.display = art.playing ? "flex" : "none"; + }; + update(); + for (const name of ["video:playing", "video:pause", "video:timeupdate"]) { + art.on(name, update); + scope.add(() => { + art.off(name, update); + }); + } + const cancelDrag = miniDrag(art, element, scope, active2); + if (scope.closed) + return; + art.template.$mini = element; + document2.body.append(element); + if (!scope.closed) + return { element, cancelDrag, fresh: true }; + } catch (error2) { + scope.dispose(); + if (art.template.$mini === element) + delete art.template.$mini; + throw error2; + } +} +function mini(art) { + const { $player, $video } = art.template; + const scope = getScope(art).child(); + let view; + let placement; + let revision = 0; + let creating = false; + let queued = false; + const active2 = () => !isClosing(art) && $player.classList.contains("art-mini"); + function restore() { + if (placement) { + const saved = placement; + const current2 = revision; + placement = void 0; + try { + restorePlacement(saved); + } catch (error2) { + if (current2 === revision && !placement) + placement = saved; + throw error2; + } + } + } + function hide() { + if (isClosing(art)) + return; + const current2 = ++revision; + queued = false; + restore(); + if (isClosing(art) || current2 !== revision) + return; + view?.cancelDrag(); + $player.classList.remove("art-mini"); + if (art.template.$mini) { + art.template.$mini.style.display = "none"; art.emit("mini", false); } } - function initState($play, $pause) { - if (art.playing) { - setStyle($play, "display", `none`); - setStyle($pause, "display", `flex`); - } else { - setStyle($play, "display", `flex`); - setStyle($pause, "display", `none`); - } - } - function createMini() { - const { $mini } = art.template; - if ($mini) { - append($mini, $video); - return setStyle($mini, "display", "flex"); - } else { - const $mini2 = createElement("div"); - addClass($mini2, "art-mini-popup"); - append(document.body, $mini2); - art.template.$mini = $mini2; - append($mini2, $video); - const $close = append($mini2, `
`); - append($close, icons.close); - proxy($close, "click", hideMini); - const $state = append($mini2, `
`); - const $play = append($state, icons.play); - const $pause = append($state, icons.pause); - proxy($play, "click", () => silencePromise(art.play())); - proxy($pause, "click", () => art.pause()); - initState($play, $pause); - art.on("video:playing", () => initState($play, $pause)); - art.on("video:pause", () => initState($play, $pause)); - art.on("video:timeupdate", () => initState($play, $pause)); - proxy($mini2, "mousedown", (event) => { - isDragging = event.button === 0; - lastPageX = event.pageX; - lastPageY = event.pageY; - }); - art.on("document:mousemove", (event) => { - if (isDragging) { - addClass($mini2, "art-mini-dragging"); - const x = event.pageX - lastPageX; - const y = event.pageY - lastPageY; - setStyle($mini2, "transform", `translate(${x}px, ${y}px)`); - } - }); - art.on("document:mouseup", () => { - if (isDragging) { - isDragging = false; - removeClass($mini2, "art-mini-dragging"); - const rect = getRect($mini2); - storage.set("left", rect.left); - storage.set("top", rect.top); - setStyle($mini2, "left", `${rect.left}px`); - setStyle($mini2, "top", `${rect.top}px`); - setStyle($mini2, "transform", null); - } - }); - return $mini2; - } - } - function initMini() { - const { $mini } = art.template; - const rect = getRect($mini); - const top = window.innerHeight - rect.height - 50; - const left = window.innerWidth - rect.width - 50; - storage.set("top", top); - storage.set("left", left); - setStyle($mini, "top", `${top}px`); - setStyle($mini, "left", `${left}px`); - } - def(art, "mini", { - get() { - return hasClass($player, "art-mini"); - }, - set(value) { - if (value) { - art.state = "mini"; - addClass($player, "art-mini"); - const $mini = createMini(); - const top = storage.get("top"); - const left = storage.get("left"); - if (typeof top === "number" && typeof left === "number") { - setStyle($mini, "top", `${top}px`); - setStyle($mini, "left", `${left}px`); - if (!isInViewport($mini)) { - initMini(); - } - } else { - initMini(); - } - art.emit("mini", true); - } else { - hideMini(); - } + scope.add(() => { + revision++; + try { + restore(); + } finally { + view?.cancelDrag(); + $player.classList.remove("art-mini"); } }); + function show() { + if (isClosing(art)) + return; + const current2 = ++revision; + if (creating) { + queued = true; + return; + } + art.state = "mini"; + if (isClosing(art) || current2 !== revision) + return; + placement ?? (placement = capturePlacement($video)); + $player.classList.add("art-mini"); + try { + if (!view) { + creating = true; + try { + view = createMiniView(art, scope, active2, hide); + } finally { + creating = false; + } + } + if (queued) { + queued = false; + show(); + return; + } + if (!view || isClosing(art)) + return; + if (current2 !== revision) { + if (!active2()) + view.element.style.display = "none"; + return; + } + if (view.fresh) + view.element.prepend($video); + else + view.element.append($video); + if (isClosing(art) || current2 !== revision) + return; + view.element.style.display = view.fresh ? "" : "flex"; + view.fresh = false; + const top = art.storage.get("top"); + const left = art.storage.get("left"); + const position = miniPosition(left, top, miniGeometry(view.element)); + if (isClosing(art) || current2 !== revision) + return; + view.element.style.left = `${position.left}px`; + view.element.style.top = `${position.top}px`; + if (position.reset) { + art.storage.set("top", position.top); + if (isClosing(art) || current2 !== revision) + return; + art.storage.set("left", position.left); + } + if (!isClosing(art) && current2 === revision) + art.emit("mini", true); + } catch (error2) { + const pendingReentry = queued; + queued = false; + if (!isClosing(art) && (current2 === revision || pendingReentry)) { + restore(); + $player.classList.remove("art-mini"); + if (view) + view.element.style.display = "none"; + } + throw error2; + } + } + return { + get: active2, + set(value) { + if (value) + show(); + else + hide(); + } + }; +} +function miniMix(art) { + def(art, "mini", mini(art)); } function optionInit(art) { const { @@ -3722,74 +4267,199 @@ function pauseMix(art) { }); } function nativePip(art) { - const { - template: { $video }, - proxy, - notice - } = art; + const { $video } = art.template; + const document2 = $video.ownerDocument; + const scope = getScope(art).child(); + const owns2 = () => document2.pictureInPictureElement === $video; + let last = owns2(); + let desired = last; + let pending2 = false; + let cancelled = false; + let revision = 0; $video.disablePictureInPicture = false; - def(art, "pip", { - get() { - return document.pictureInPictureElement; - }, - set(value) { - if (value) { - art.state = "pip"; - $video.requestPictureInPicture().catch((err) => { - notice.show = err; - throw err; - }); - } else { - document.exitPictureInPicture().catch((err) => { - notice.show = err; - throw err; - }); - } + function exitOwned() { + if (!owns2()) + return; + try { + void document2.exitPictureInPicture().catch(() => { + }); + } catch { + } + } + function observe(result, entering, current2) { + void result.then(() => { + if (entering && (isClosing(art) || !desired)) + exitOwned(); + }, (error2) => { + if (!isClosing(art) && revision === current2) + art.notice.show = error2; + }).finally(() => { + if (revision === current2) + pending2 = false; + }).catch(() => { + }); + } + scope.add(() => { + revision++; + desired = false; + exitOwned(); + }); + listen(scope, $video, "enterpictureinpicture", () => { + if (cancelled) { + exitOwned(); + return; + } + if (!owns2() || last) + return; + const current2 = revision; + art.state = "pip"; + if (!isClosing(art) && current2 === revision && owns2()) { + last = true; + art.emit("pip", true); } }); - proxy($video, "enterpictureinpicture", () => { - art.emit("pip", true); - }); - proxy($video, "leavepictureinpicture", () => { + listen(scope, $video, "leavepictureinpicture", () => { + if (!last || owns2()) + return; + last = false; art.emit("pip", false); }); + return { + // Native callers historically receive the media element, not a boolean. + get: () => !isClosing(art) && owns2() ? $video : null, + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + desired = Boolean(value); + if (desired) + cancelled = false; + else if (pending2) + cancelled = true; + pending2 = false; + if (desired) { + art.state = "pip"; + if (isClosing(art) || revision !== current2) + return; + pending2 = true; + try { + observe($video.requestPictureInPicture(), true, current2); + } catch (error2) { + if (revision === current2) + pending2 = false; + throw error2; + } + } else if (owns2()) { + observe(document2.exitPictureInPicture(), false, current2); + } + } + }; +} +const abandoned = /* @__PURE__ */ new WeakSet(); +const active = (video) => video.webkitPresentationMode === "picture-in-picture"; +function clearAbandoned(video) { + abandoned.delete(video); + video.removeEventListener("webkitpresentationmodechanged", releaseAbandoned); + video.removeEventListener("enterpictureinpicture", releaseAbandoned); +} +function releaseAbandoned() { + if (!abandoned.has(this) || !active(this)) + return; + clearAbandoned(this); + try { + this.webkitSetPresentationMode?.("inline"); + } catch { + } +} +function abandon(video) { + abandoned.add(video); + video.addEventListener("webkitpresentationmodechanged", releaseAbandoned); + video.addEventListener("enterpictureinpicture", releaseAbandoned); } function webkitPip(art) { const { $video } = art.template; + const scope = getScope(art).child(); + let last = false; + let pending2 = false; + let revision = 0; + let emissions = 0; $video.webkitSetPresentationMode("inline"); - def(art, "pip", { - get() { - return $video.webkitPresentationMode === "picture-in-picture"; - }, - set(value) { - if (value) { - art.state = "pip"; - $video.webkitSetPresentationMode("picture-in-picture"); - art.emit("pip", true); - } else { - $video.webkitSetPresentationMode("inline"); - art.emit("pip", false); - } - } + function changed(force = false) { + if (isClosing(art) || abandoned.has($video)) + return; + const value = active($video); + if (value) + pending2 = false; + if (value === last && !force) + return; + const current2 = revision; + if (value) + art.state = "pip"; + if (isClosing(art) || revision !== current2 || active($video) !== value) + return; + last = value; + emissions++; + art.emit("pip", value); + } + scope.add(() => { + revision++; + if (pending2) + abandon($video); + if (active($video)) + $video.webkitSetPresentationMode("inline"); }); + for (const name of ["webkitpresentationmodechanged", "enterpictureinpicture", "leavepictureinpicture"]) + listen(scope, $video, name, () => changed()); + return { + get: () => !isClosing(art) && active($video), + set(value) { + if (isClosing(art)) + return; + const current2 = ++revision; + const before = emissions; + if (value) { + if ($video.webkitSupportsPresentationMode?.("picture-in-picture") === false) { + art.notice.show = art.i18n.get("PIP Not Supported"); + return; + } + clearAbandoned($video); + art.state = "pip"; + if (isClosing(art) || revision !== current2) + return; + pending2 = true; + try { + $video.webkitSetPresentationMode("picture-in-picture"); + } catch (error2) { + if (current2 === revision) + pending2 = false; + throw error2; + } + } else { + if (pending2) { + pending2 = false; + abandon($video); + } + if (active($video)) + $video.webkitSetPresentationMode("inline"); + } + if (!isClosing(art) && current2 === revision && before === emissions && active($video) === Boolean(value)) + changed(true); + } + }; } function pipMix(art) { - const { - i18n, - notice, - template: { $video } - } = art; - if (document.pictureInPictureEnabled) { - nativePip(art); - } else if ($video.webkitSupportsPresentationMode) { - webkitPip(art); + const { i18n, notice, template: { $video } } = art; + const document2 = $video.ownerDocument; + if (document2.pictureInPictureEnabled && typeof $video.requestPictureInPicture === "function" && typeof document2.exitPictureInPicture === "function") { + def(art, "pip", nativePip(art)); + } else if (typeof $video.webkitSupportsPresentationMode === "function" && typeof $video.webkitSetPresentationMode === "function") { + def(art, "pip", webkitPip(art)); } else { def(art, "pip", { - get() { - return false; - }, + get: () => false, set() { - notice.show = i18n.get("PIP Not Supported"); + if (!isClosing(art)) + notice.show = i18n.get("PIP Not Supported"); } }); } @@ -3836,20 +4506,20 @@ function playMix(art) { } = art; def(art, "play", { async value() { - const active = captureSource(art); + const active2 = captureSource(art); const result = await $video.play(); - if (!active()) + if (!active2()) return result; const message = i18n.get("Play"); - if (!active()) + if (!active2()) return result; notice.show = message; - if (!active()) + if (!active2()) return result; art.emit("play"); if (option.mutex) { for (let index = 0; index < instances2.length; index++) { - if (!active()) + if (!active2()) break; const instance = instances2[index]; if (instance !== art) { @@ -3891,11 +4561,11 @@ function qualityMix(art) { html: qualityDefault?.html || "", selector: quality, async onSelect(item, _element, event) { - const active = captureSelection(event); + const active2 = captureSelection(event); await art.switchQuality(item.url); - if (!isClosing(art) && active()) { + if (!isClosing(art) && active2()) { const message = `${i18n.get("Switch Video")}: ${item.html}`; - if (!isClosing(art) && active()) + if (!isClosing(art) && active2()) notice.show = message; } return item.html; @@ -4079,19 +4749,19 @@ function switchSource(art, url, currentTime) { scope.add(() => { settle(); }); - const active = () => !settled && operation.active(); + const active2 = () => !settled && operation.active(); const fail = (error2) => settle(true, error2); operation.onError = fail; try { const { playing, aspectRatio: aspectRatio2, playbackRate: playbackRate2 } = art; art.pause(); - if (!active()) + if (!active2()) return; const readiness = scope.child(); const handlers = { "video:error": fail, "video:loadedmetadata": () => { - if (!active()) + if (!active2()) return; try { art.currentTime = currentTime; @@ -4100,15 +4770,15 @@ function switchSource(art, url, currentTime) { } }, "video:canplay": () => { - if (!active()) + if (!active2()) return; readiness.dispose(); const resume = async () => { art.playbackRate = playbackRate2; - if (!active()) + if (!active2()) return; art.aspectRatio = aspectRatio2; - if (!active()) + if (!active2()) return; if (playing) { try { @@ -4116,7 +4786,7 @@ function switchSource(art, url, currentTime) { } catch { } } - if (!active()) + if (!active2()) return; art.notice.show = ""; settle(); @@ -4134,10 +4804,10 @@ function switchSource(art, url, currentTime) { }, false); } assignUrl(art, operation, url); - if (!active()) + if (!active2()) return; art.notice.show = ""; - if (!active()) + if (!active2()) return; const activate = () => { capture.dispose(); @@ -4149,7 +4819,7 @@ function switchSource(art, url, currentTime) { for (const name of names) dispatch[name] = listenSource(readiness, art, name, handlers[name]); for (const [name, event] of queued) { - if (!active() || readiness.closed) + if (!active2() || readiness.closed) break; dispatch[name](event); } @@ -4401,91 +5071,160 @@ class Player { optionInit(art); } } -function autoOrientation(art) { - const { - notice, - constructor, - template: { $player, $video } - } = art; - const WEB_CLASS = "art-auto-orientation"; - const FS_CLASS = "art-auto-orientation-fullscreen"; - let fsLocked = false; - function applyWebRotate() { +const owners$2 = /* @__PURE__ */ new WeakMap(); +const className$1 = "art-auto-orientation-fullscreen"; +function unlock(request) { + if (owners$2.get(request.orientation) !== request) + return; + try { + request.orientation.unlock(); + } catch { + } +} +function nativeOrientation(art, needRotate) { + const { $player } = art.template; + let current2; + function cancel() { + const request = current2; + current2 = void 0; + $player.classList.remove(className$1); + if (request) { + request.cancelled = true; + unlock(request); + if (request.settled && owners$2.get(request.orientation) === request) + owners$2.delete(request.orientation); + } + } + getScope(art).add(cancel); + return (state2) => { + if (isClosing(art)) + return; + if (!state2) { + cancel(); + return; + } + if (current2 && !current2.cancelled && owners$2.get(current2.orientation) === current2) + return; + const orientation = $player.ownerDocument.defaultView?.screen?.orientation; + if (typeof orientation?.lock !== "function" || typeof orientation.unlock !== "function" || !needRotate()) + return; + const request = { orientation, cancelled: false, settled: false }; + current2 = request; + owners$2.set(orientation, request); + const active2 = () => !isClosing(art) && !request.cancelled && current2 === request && owners$2.get(orientation) === request; + const failed = (error2) => { + request.settled = true; + const show = active2(); + if (owners$2.get(orientation) === request) + owners$2.delete(orientation); + if (current2 === request) + current2 = void 0; + if (show) { + $player.classList.remove(className$1); + art.notice.show = error2; + } + }; + try { + const result = orientation.lock(orientation.type.startsWith("portrait") ? "landscape" : "portrait"); + Promise.resolve(result).then(() => { + request.settled = true; + if (active2()) { + $player.classList.add(className$1); + } else { + unlock(request); + if (owners$2.get(orientation) === request) + owners$2.delete(orientation); + } + }).catch(failed); + } catch (error2) { + failed(error2); + } + }; +} +const className = "art-auto-orientation"; +const properties = ["width", "height", "transform-origin", "transform"]; +function webOrientation(art, needRotate) { + const { $player } = art.template; + const scope = getScope(art); + let cancel = () => { + }; + let saved; + function clear() { + cancel(); + cancel = () => { + }; + const previous = saved; + saved = void 0; + if (previous && art.fullscreenWeb) { + for (const { name, value, priority } of previous) + $player.style.setProperty(name, value, priority); + } + const wasRotated = $player.classList.contains(className); + $player.classList.remove(className); + if (wasRotated) { + art.isRotate = false; + if (!isClosing(art)) + art.emit("resize"); + } + } + scope.add(clear); + function apply(emit) { + if (!art.fullscreenWeb || !needRotate()) + return; const insets = getSafeAreaInsets(); - const viewWidth = document.documentElement.clientWidth; - const viewHeight = document.documentElement.clientHeight; - const safeWidth = viewHeight - insets.top - insets.bottom; - const safeHeight = viewWidth - insets.left - insets.right; - setStyle($player, "width", `${safeWidth}px`); - setStyle($player, "height", `${safeHeight}px`); - setStyle($player, "transform-origin", "0 0"); - setStyle($player, "transform", `rotate(90deg) translate(${insets.top}px, -${viewWidth - insets.right}px)`); - addClass($player, WEB_CLASS); + if (isClosing(art) || !art.fullscreenWeb) + return; + const viewport = $player.ownerDocument.documentElement; + saved ?? (saved = properties.map((name) => ({ name, value: $player.style.getPropertyValue(name), priority: $player.style.getPropertyPriority(name) }))); + $player.style.width = `${viewport.clientHeight - insets.top - insets.bottom}px`; + $player.style.height = `${viewport.clientWidth - insets.left - insets.right}px`; + $player.style.transformOrigin = "0 0"; + $player.style.transform = `rotate(90deg) translate(${insets.top}px, -${viewport.clientWidth - insets.right}px)`; + $player.classList.add(className); art.isRotate = true; - art.emit("resize"); + if (emit) + art.emit("resize"); } - function clearWebRotate() { - setStyle($player, "width", ""); - setStyle($player, "height", ""); - setStyle($player, "transform-origin", ""); - setStyle($player, "transform", ""); - removeClass($player, WEB_CLASS); - art.isRotate = false; - art.emit("resize"); - } - function needRotate() { - const { videoWidth, videoHeight } = $video; - const vw = document.documentElement.clientWidth; - const vh = document.documentElement.clientHeight; - return videoWidth > videoHeight && vw < vh || videoWidth < videoHeight && vw > vh; - } - art.on("fullscreenWeb", (state2) => { - if (state2) { - if (needRotate()) { - const delay = Number(constructor.AUTO_ORIENTATION_TIME ?? 0); - setTimeout(() => { - if (art.fullscreenWeb && !hasClass($player, WEB_CLASS)) { - applyWebRotate(); - } - }, delay); - } - } else { - if (hasClass($player, WEB_CLASS)) - clearWebRotate(); + return (state2) => { + if (isClosing(art)) + return; + if (!state2) { + clear(); + return; } - }); - art.on("fullscreen", async (state2) => { - const canLock = !!screen?.orientation?.lock; - if (state2) { - if (canLock && needRotate()) { - try { - const last = screen.orientation.type; - const opposite = last.startsWith("portrait") ? "landscape" : "portrait"; - await screen.orientation.lock(opposite); - fsLocked = true; - addClass($player, FS_CLASS); - } catch (err) { - fsLocked = false; - notice.show = err; - } - } - } else { - if (hasClass($player, FS_CLASS)) { - removeClass($player, FS_CLASS); - } - if (canLock && fsLocked) { - try { - screen.orientation.unlock(); - } catch { - } - fsLocked = false; - } + if (saved) { + apply(false); + return; } + if (!needRotate()) + return; + cancel(); + cancel = timeout(scope, () => { + if (!saved) + apply(true); + }, Number(art.constructor.AUTO_ORIENTATION_TIME ?? 0)); + }; +} +function autoOrientation(art) { + const { $player, $video } = art.template; + const needRotate = () => { + const media = { width: $video.videoWidth, height: $video.videoHeight }; + const viewport = $player.ownerDocument.documentElement; + const view = { width: viewport.clientWidth, height: viewport.clientHeight }; + return positiveSize(media) && positiveSize(view) && (media.width > media.height && view.width < view.height || media.width < media.height && view.width > view.height); + }; + const web = webOrientation(art, needRotate); + const native = nativeOrientation(art, needRotate); + art.on("fullscreenWeb", web); + art.on("fullscreen", native); + getScope(art).add(() => { + art.off("fullscreenWeb", web); + art.off("fullscreen", native); }); return { name: "autoOrientation", get state() { - return hasClass($player, WEB_CLASS); + return $player.classList.contains("art-auto-orientation"); } }; } @@ -4676,8 +5415,9 @@ function installBuiltins(registry, option) { registry.add(lock); if (!isClosing(registry.art) && option.autoPlayback && !option.isLive) registry.add(autoPlayback); - if (!isClosing(registry.art) && option.autoOrientation && isMobile) + if (!isClosing(registry.art) && option.autoOrientation && isMobile) { registry.add(autoOrientation); + } if (!isClosing(registry.art) && option.fastForward && isMobile && !option.isLive) registry.add(fastForward); } @@ -5223,9 +5963,9 @@ function calculateSettingLayout(input) { return { width, height, left }; } function resizeSetting(setting2) { - const { art, active } = setting2; + const { art, active: active2 } = setting2; const { controls, constructor: { SETTING_WIDTH, SETTING_ITEM_HEIGHT }, template: { $player, $setting, $bottom } } = art; - if (!controls.setting || !setting2.show || !active) + if (!controls.setting || !setting2.show || !active2) return; const player = $player.getBoundingClientRect(); const control = controls.setting.getBoundingClientRect(); @@ -5234,8 +5974,8 @@ function resizeSetting(setting2) { const layout = calculateSettingLayout({ containerWidth: $player.clientWidth, containerHeight: $player.clientHeight, - requestedWidth: active[0]?.$parent?.width || SETTING_WIDTH, - rows: active.length + (active === setting2.option ? 0 : 1), + requestedWidth: active2[0]?.$parent?.width || SETTING_WIDTH, + rows: active2.length + (active2 === setting2.option ? 0 : 1), rowHeight: SETTING_ITEM_HEIGHT, controlCenter, bottom: Number.parseFloat(getComputedStyle($setting).bottom) || 0, @@ -5358,12 +6098,12 @@ async function act(setting2, item, element, event, callback, target, property, b const targetScope = settingScope(target); const generation = (generations.get(target) || 0) + 1; generations.set(target, generation); - const active = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; + const active2 = () => settingScopeActive(scope) && settingScopeActive(targetScope) && !isClosing(setting2.art) && generations.get(target) === generation; before?.(); - if (!active()) + if (!active2()) return; const value = await callback.call(setting2.art, item, element, event); - if (active()) + if (active2()) Reflect.set(target, property, value); } catch (error2) { console.warn("ArtPlayer setting callback failed:", error2); @@ -5490,19 +6230,19 @@ function suspendTree(setting2, root) { } throw error2; } - let active = true; + let active2 = true; return { items, resume() { - if (!active) + if (!active2) return; - active = false; + active2 = false; finish([...suspended.reverse().map((item) => item.resume), ...unpause]); }, dispose() { - if (!active) + if (!active2) return; - active = false; + active2 = false; finish([...suspended.reverse().map((item) => item.dispose), ...Array.from(panels).reverse().map((panel) => () => releaseSettingPanel(panel)), ...unpause]); } }; @@ -5544,12 +6284,12 @@ function updateSetting(setting2, target) { const previous = setting2.active; const layout = ["height", "width", "left", "right"].map((key) => [key, setting2.$parent.style.getPropertyValue(key), setting2.$parent.style.getPropertyPriority(key)]); const tree = suspendTree(setting2, item); - let active = true; + let active2 = true; let rendered = false; const cancel = () => { - if (!active) + if (!active2) return; - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -5587,11 +6327,11 @@ function updateSetting(setting2, target) { console.warn("ArtPlayer setting restore failed:", error2); } }; - const current2 = () => active && !isClosing(setting2.art) && pending.get(item) === cancel; + const current2 = () => active2 && !isClosing(setting2.art) && pending.get(item) === cancel; for (const affected of tree.items) pending.set(affected, cancel); const release = getScope(setting2.art).add(() => { - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -5612,7 +6352,7 @@ function updateSetting(setting2, target) { setting2.render(); if (!current2()) return item; - active = false; + active2 = false; for (const affected of tree.items) { if (pending.get(affected) === cancel) pending.delete(affected); @@ -6142,7 +6882,7 @@ class Storage { } } } -const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; +const css = ".art-video-player {\n --art-theme: #f00;\n --art-font-color: #fff;\n --art-background-color: #000;\n --art-text-shadow-color: rgba(0, 0, 0, 0.5);\n --art-transition-duration: 0.2s;\n --art-padding: 10px;\n --art-border-radius: 3px;\n --art-progress-height: 6px;\n --art-progress-color: rgba(255, 255, 255, 0.25);\n --art-progress-top-gap: 10px;\n --art-hover-color: rgba(255, 255, 255, 0.25);\n --art-loaded-color: rgba(255, 255, 255, 0.25);\n --art-state-size: 80px;\n --art-state-opacity: 0.8;\n --art-bottom-height: 100px;\n --art-bottom-offset: 20px;\n --art-bottom-gap: 5px;\n --art-highlight-width: 8px;\n --art-highlight-color: rgba(255, 255, 255, 0.5);\n --art-control-height: 46px;\n --art-control-opacity: 0.75;\n --art-control-icon-size: 36px;\n --art-control-icon-scale: 1.1;\n --art-volume-height: 120px;\n --art-volume-handle-size: 14px;\n --art-lock-size: 36px;\n --art-indicator-scale: 0;\n --art-indicator-size: 16px;\n --art-fullscreen-web-index: 9999;\n --art-settings-icon-size: 24px;\n --art-settings-max-height: 300px;\n --art-selector-max-height: 300px;\n --art-contextmenus-min-width: 250px;\n --art-subtitle-font-size: 20px;\n --art-subtitle-gap: 5px;\n --art-subtitle-bottom: 15px;\n --art-subtitle-border: #000;\n --art-widget-background: rgba(0, 0, 0, 0.85);\n --art-tip-background: rgba(0, 0, 0, 0.7);\n --art-scrollbar-size: 4px;\n --art-scrollbar-background: rgba(255, 255, 255, 0.25);\n --art-scrollbar-background-hover: rgba(255, 255, 255, 0.5);\n --art-mini-progress-height: 2px;\n}\n.art-bg-cover {\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n}\n.art-bottom-gradient {\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-backdrop-filter {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-truncate {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player {\n position: relative;\n margin: 0 auto;\n width: 100%;\n height: 100%;\n outline: 0;\n zoom: 1;\n padding: 0;\n text-align: left;\n direction: ltr;\n font-size: 14px;\n line-height: 1.3;\n user-select: none;\n box-sizing: border-box;\n color: var(--art-font-color);\n background-color: var(--art-background-color);\n text-shadow: 0 0 2px var(--art-text-shadow-color);\n font-family: PingFang SC, Helvetica Neue, Microsoft YaHei, Roboto, Arial, sans-serif;\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n -ms-touch-action: manipulation;\n touch-action: manipulation;\n -ms-high-contrast-adjust: none;\n}\n.art-video-player *,\n.art-video-player *::before,\n.art-video-player *::after {\n box-sizing: border-box;\n}\n.art-video-player ::-webkit-scrollbar {\n width: var(--art-scrollbar-size);\n height: var(--art-scrollbar-size);\n}\n.art-video-player ::-webkit-scrollbar-thumb {\n background-color: var(--art-scrollbar-background);\n}\n.art-video-player ::-webkit-scrollbar-thumb:hover {\n background-color: var(--art-scrollbar-background-hover);\n}\n.art-video-player img {\n max-width: 100%;\n vertical-align: top;\n}\n.art-video-player svg {\n fill: var(--art-font-color);\n}\n.art-video-player a {\n color: var(--art-font-color);\n text-decoration: none;\n}\n.art-icon {\n line-height: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.art-video-player.art-backdrop .art-contextmenus,\n.art-video-player.art-backdrop .art-info,\n.art-video-player.art-backdrop .art-settings,\n.art-video-player.art-backdrop .art-layer-auto-playback,\n.art-video-player.art-backdrop .art-selector-list,\n.art-video-player.art-backdrop .art-volume-inner {\n -webkit-backdrop-filter: saturate(180%) blur(20px);\n backdrop-filter: saturate(180%) blur(20px);\n background-color: rgba(0, 0, 0, 0.75) !important;\n}\n.art-video {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n}\n.art-poster {\n position: absolute;\n inset: 0;\n z-index: 11;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: none;\n}\n.art-video-player .art-subtitle {\n display: none;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n position: absolute;\n z-index: 20;\n width: 100%;\n padding: 0 5%;\n text-align: center;\n pointer-events: none;\n gap: var(--art-subtitle-gap);\n bottom: var(--art-subtitle-bottom);\n font-size: var(--art-subtitle-font-size);\n transition: bottom var(--art-transition-duration) ease;\n text-shadow: var(--art-subtitle-border) 1px 0 1px, var(--art-subtitle-border) 0 1px 1px, var(--art-subtitle-border) -1px 0 1px, var(--art-subtitle-border) 0 -1px 1px, var(--art-subtitle-border) 1px 1px 1px, var(--art-subtitle-border) -1px -1px 1px, var(--art-subtitle-border) 1px -1px 1px, var(--art-subtitle-border) -1px 1px 1px;\n}\n.art-video-player.art-subtitle-show .art-subtitle {\n display: flex;\n}\n.art-video-player.art-control-show .art-subtitle {\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-subtitle-bottom));\n}\n.art-danmuku {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n.art-video-player .art-layers {\n position: absolute;\n inset: 0;\n z-index: 40;\n width: 100%;\n height: 100%;\n display: none;\n pointer-events: none;\n}\n.art-video-player .art-layers .art-layer {\n pointer-events: auto;\n}\n.art-video-player.art-layer-show .art-layers {\n display: flex;\n}\n.art-video-player .art-mask {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player .art-mask .art-state {\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0;\n transform: scale(2);\n width: var(--art-state-size);\n height: var(--art-state-size);\n transition: all var(--art-transition-duration) ease;\n}\n.art-video-player.art-mask-show .art-state {\n pointer-events: auto;\n opacity: var(--art-state-opacity);\n transform: scale(1);\n}\n.art-video-player.art-loading-show .art-state {\n display: none;\n}\n.art-video-player .art-loading {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n inset: 0;\n z-index: 70;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-video-player.art-loading-show .art-loading {\n display: flex;\n}\n.art-video-player.art-loading-show .art-mask {\n display: none;\n}\n.art-video-player .art-bottom {\n position: absolute;\n inset: 0;\n z-index: 60;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n padding: 0 var(--art-padding);\n transition: all var(--art-transition-duration) ease;\n background-size: 100% var(--art-bottom-height);\n background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0.4), transparent);\n background-repeat: repeat-x;\n background-position: center bottom;\n}\n.art-video-player .art-bottom .art-controls,\n.art-video-player .art-bottom .art-progress {\n transform: translateY(var(--art-bottom-offset));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player.art-control-show .art-bottom,\n.art-video-player.art-hover .art-bottom {\n opacity: 1;\n}\n.art-video-player.art-control-show .art-bottom .art-controls,\n.art-video-player.art-hover .art-bottom .art-controls,\n.art-video-player.art-control-show .art-bottom .art-progress,\n.art-video-player.art-hover .art-bottom .art-progress {\n transform: translateY(0);\n}\n.art-bottom .art-progress {\n position: relative;\n z-index: 0;\n cursor: pointer;\n pointer-events: auto;\n padding-top: var(--art-progress-top-gap);\n padding-bottom: var(--art-bottom-gap);\n}\n.art-bottom .art-progress .art-control-progress {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: var(--art-progress-height);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner {\n display: flex;\n align-items: center;\n position: relative;\n height: 50%;\n width: 100%;\n transition: height var(--art-transition-duration) ease;\n background-color: var(--art-progress-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-hover {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-hover-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-loaded {\n position: absolute;\n inset: 0;\n z-index: 10;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-loaded-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-played {\n position: absolute;\n inset: 0;\n z-index: 20;\n width: 100%;\n height: 100%;\n width: 0%;\n background-color: var(--art-theme);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-highlight span {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n right: auto;\n pointer-events: auto;\n width: var(--art-highlight-width) !important;\n transform: translateX(calc(var(--art-highlight-width) / -2));\n background-color: var(--art-highlight-color);\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 40;\n left: 0;\n border-radius: 50%;\n width: var(--art-indicator-size);\n height: var(--art-indicator-size);\n transform: scale(var(--art-indicator-scale));\n margin-left: calc(var(--art-indicator-size) / -2);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator .art-icon {\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:hover {\n transform: scale(1.2) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator:active {\n transform: scale(1) !important;\n}\n.art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n z-index: 50;\n top: -25px;\n left: 0;\n padding: 3px 5px;\n line-height: 1;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n white-space: nowrap;\n background-color: var(--art-tip-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n}\n.art-bottom .art-progress .art-control-thumbnails {\n transform-origin: bottom center;\n transform: scale(0.5);\n opacity: 0;\n position: absolute;\n bottom: calc(var(--art-bottom-gap) + 10px);\n left: 0;\n border-radius: var(--art-border-radius);\n pointer-events: none;\n background-color: var(--art-widget-background);\n transition: transform var(--art-transition-duration) ease, opacity var(--art-transition-duration) ease;\n box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.2), 0 1px 2px -1px rgba(0, 0, 0, 0.2);\n}\n.art-bottom .art-progress:hover .art-control-progress .art-control-progress-inner {\n height: 100%;\n}\n.art-bottom:hover .art-progress .art-control-progress .art-control-progress-inner .art-progress-indicator {\n transform: scale(1);\n}\n.art-progress-hover .art-bottom .art-progress .art-control-progress .art-control-progress-inner .art-progress-tip,\n.art-progress-hover .art-bottom .art-progress .art-control-thumbnails {\n transform: scale(1);\n opacity: 1;\n}\n.art-video-player .art-controls {\n position: relative;\n z-index: 10;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n flex-shrink: 0;\n height: auto;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-left,\n.art-video-player .art-controls .art-controls-right {\n display: flex;\n flex-wrap: wrap;\n max-width: 100%;\n min-height: var(--art-control-height);\n}\n.art-video-player .art-controls .art-controls-center {\n display: none;\n justify-content: center;\n align-items: center;\n flex: 1;\n height: 100%;\n padding: 0 10px;\n}\n.art-video-player .art-controls .art-controls-right {\n justify-content: flex-end;\n margin-left: auto;\n}\n.art-video-player .art-controls .art-control {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n max-width: 100%;\n cursor: pointer;\n white-space: nowrap;\n opacity: var(--art-control-opacity);\n min-height: var(--art-control-height);\n min-width: var(--art-control-height);\n transition: opacity var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon {\n height: var(--art-control-icon-size);\n width: var(--art-control-icon-size);\n transform: scale(var(--art-control-icon-scale));\n transition: transform var(--art-transition-duration) ease;\n}\n.art-video-player .art-controls .art-control .art-icon:active {\n transform: scale(calc(var(--art-control-icon-scale) * 0.8));\n}\n.art-video-player .art-controls .art-control:hover {\n opacity: 1;\n}\n.art-control-volume {\n position: relative;\n}\n.art-control-volume .art-volume-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n left: 0;\n right: 0;\n padding: 0 5px;\n font-size: 12px;\n text-align: center;\n cursor: default;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n width: var(--art-control-height);\n height: var(--art-volume-height);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 10px;\n height: 100%;\n width: 100%;\n padding: 10px 0 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider {\n flex: 1;\n width: 100%;\n display: flex;\n cursor: pointer;\n position: relative;\n justify-content: center;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle {\n position: relative;\n display: flex;\n justify-content: center;\n width: 2px;\n border-radius: var(--art-border-radius);\n overflow: hidden;\n background-color: rgba(255, 255, 255, 0.25);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-handle .art-volume-loaded {\n position: absolute;\n inset: 0;\n z-index: 0;\n width: 100%;\n height: 100%;\n background-color: var(--art-theme);\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider .art-volume-indicator {\n position: absolute;\n width: var(--art-volume-handle-size);\n height: var(--art-volume-handle-size);\n margin-top: calc(var(--art-volume-handle-size) / -2);\n flex-shrink: 0;\n transform: scale(1);\n border-radius: 100%;\n background-color: var(--art-theme);\n transition: transform var(--art-transition-duration) ease;\n}\n.art-control-volume .art-volume-panel .art-volume-inner .art-volume-slider:active .art-volume-indicator {\n transform: scale(0.9);\n}\n.art-control-volume:hover .art-volume-panel {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player .art-notice {\n display: none;\n position: absolute;\n inset: 0;\n z-index: 80;\n width: 100%;\n height: 100%;\n height: auto;\n bottom: auto;\n padding: var(--art-padding);\n pointer-events: none;\n}\n.art-video-player .art-notice .art-notice-inner {\n display: inline-flex;\n padding: 5px;\n line-height: 1;\n border-radius: var(--art-border-radius);\n background-color: var(--art-tip-background);\n}\n.art-video-player.art-notice-show .art-notice {\n display: flex;\n}\n.art-video-player .art-contextmenus {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 120;\n padding: 5px 0;\n border-radius: var(--art-border-radius);\n font-size: 12px;\n background-color: var(--art-widget-background);\n min-width: var(--art-contextmenus-min-width);\n}\n.art-video-player .art-contextmenus .art-contextmenu {\n cursor: pointer;\n display: flex;\n padding: 10px 15px;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu span {\n padding: 0 8px;\n}\n.art-video-player .art-contextmenus .art-contextmenu span:hover,\n.art-video-player .art-contextmenus .art-contextmenu span.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-contextmenus .art-contextmenu:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-contextmenus .art-contextmenu:last-child {\n border-bottom: none;\n}\n.art-video-player.art-contextmenu-show .art-contextmenus {\n display: flex;\n}\n.art-video-player .art-settings {\n display: none;\n flex-direction: column;\n position: absolute;\n z-index: 90;\n left: auto;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: var(--art-border-radius);\n max-height: var(--art-settings-max-height);\n right: var(--art-padding);\n bottom: var(--art-controls-height, var(--art-control-height));\n transition: all var(--art-transition-duration) ease;\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-settings .art-setting-panel {\n display: none;\n flex-direction: column;\n}\n.art-video-player .art-settings .art-setting-panel.art-current {\n display: flex;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 5px;\n padding: 0 5px;\n cursor: pointer;\n overflow: hidden;\n transition: background-color var(--art-transition-duration) ease;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current {\n color: var(--art-theme);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-icon-check {\n visibility: hidden;\n height: 15px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item.art-current .art-icon-check {\n visibility: visible;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 1;\n min-width: 0;\n overflow: hidden;\n gap: 5px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n height: var(--art-settings-icon-size);\n width: var(--art-settings-icon-size);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-left .art-setting-item-left-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 0;\n max-width: 55%;\n gap: 5px;\n font-size: 12px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-tooltip {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.5);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-item-right-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-width: 32px;\n height: 24px;\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item .art-setting-item-right .art-setting-range {\n height: 3px;\n width: 80px;\n outline: none;\n appearance: none;\n background-color: rgba(255, 255, 255, 0.2);\n}\n.art-video-player .art-settings .art-setting-panel .art-setting-item-back {\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.art-video-player.art-setting-show .art-settings {\n display: flex;\n}\n.art-video-player .art-info {\n display: none;\n position: absolute;\n left: var(--art-padding);\n top: var(--art-padding);\n z-index: 100;\n padding: 10px;\n font-size: 12px;\n border-radius: var(--art-border-radius);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-info .art-info-panel {\n display: flex;\n flex-direction: column;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item {\n display: flex;\n align-items: center;\n gap: 5px;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-title {\n width: 100px;\n text-align: right;\n}\n.art-video-player .art-info .art-info-panel .art-info-item .art-info-content {\n width: 250px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: all;\n}\n.art-video-player .art-info .art-info-close {\n position: absolute;\n top: 5px;\n right: 5px;\n cursor: pointer;\n}\n.art-video-player.art-info-show .art-info {\n display: flex;\n}\n.art-hide-cursor * {\n cursor: none !important;\n}\n.art-video-player[data-aspect-ratio] {\n overflow: hidden;\n}\n.art-video-player[data-aspect-ratio] .art-video {\n object-fit: fill;\n box-sizing: content-box;\n}\n.art-fullscreen {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n}\n.art-fullscreen-web {\n --art-progress-height: 8px;\n --art-indicator-size: 20px;\n --art-control-height: 60px;\n --art-control-icon-scale: 1.3;\n position: fixed;\n inset: 0;\n z-index: var(--art-fullscreen-web-index);\n width: 100%;\n height: 100%;\n}\n.art-mini-popup {\n position: fixed;\n z-index: 9999;\n width: 320px;\n height: 180px;\n max-width: 100vw;\n max-height: 100vh;\n background: #000;\n border-radius: var(--art-border-radius);\n cursor: move;\n user-select: none;\n overflow: hidden;\n transition: opacity 0.2s ease;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);\n}\n.art-mini-popup svg {\n fill: #fff;\n}\n.art-mini-popup .art-video {\n pointer-events: none;\n}\n.art-mini-popup .art-mini-close {\n position: absolute;\n z-index: 20;\n right: 10px;\n top: 10px;\n cursor: pointer;\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n.art-mini-popup .art-mini-state {\n position: absolute;\n inset: 0;\n z-index: 30;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n background-color: rgba(0, 0, 0, 0.25);\n}\n.art-mini-popup .art-mini-state .art-icon {\n opacity: 0.75;\n cursor: pointer;\n transform: scale(3);\n pointer-events: auto;\n transition: transform 0.2s ease;\n}\n.art-mini-popup .art-mini-state .art-icon:active {\n transform: scale(2.5);\n}\n.art-mini-popup.art-mini-dragging {\n opacity: 0.9;\n}\n.art-mini-popup:hover .art-mini-close,\n.art-mini-popup:hover .art-mini-state {\n opacity: 1;\n}\n.art-video-player[data-flip='horizontal'] .art-video {\n transform: scaleX(-1);\n}\n.art-video-player[data-flip='vertical'] .art-video {\n transform: scaleY(-1);\n}\n.art-video-player .art-layer-lock {\n display: none;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n border-radius: 50%;\n transform: translateY(-50%);\n height: var(--art-lock-size);\n width: var(--art-lock-size);\n left: var(--art-padding);\n background-color: var(--art-tip-background);\n}\n.art-video-player .art-layer-auto-playback {\n display: none;\n gap: 10px;\n align-items: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n padding: 10px;\n line-height: 1;\n left: var(--art-padding);\n bottom: calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + 10px);\n background-color: var(--art-widget-background);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close {\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-close svg {\n width: 15px;\n height: 15px;\n fill: var(--art-theme);\n}\n.art-video-player .art-layer-auto-playback .art-auto-playback-jump {\n color: var(--art-theme);\n cursor: pointer;\n}\n.art-video-player.art-lock .art-subtitle {\n bottom: var(--art-subtitle-bottom) !important;\n}\n.art-video-player.art-mini-progress-bar .art-bottom,\n.art-video-player.art-lock .art-bottom {\n opacity: 1;\n padding: 0;\n background-image: none;\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-controls,\n.art-video-player.art-lock .art-bottom .art-controls,\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress,\n.art-video-player.art-lock .art-bottom .art-progress {\n transform: translateY(calc(var(--art-controls-height, var(--art-control-height)) + var(--art-bottom-gap) + var(--art-progress-height) / 4));\n}\n.art-video-player.art-mini-progress-bar .art-bottom .art-progress-indicator,\n.art-video-player.art-lock .art-bottom .art-progress-indicator {\n display: none !important;\n}\n.art-video-player.art-control-show .art-layer-lock {\n display: flex;\n}\n.art-control-selector {\n position: relative;\n display: flex;\n justify-content: center;\n}\n.art-control-selector .art-selector-list {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n position: absolute;\n border-radius: var(--art-border-radius);\n overflow-y: auto;\n overflow-x: hidden;\n opacity: 0;\n transform: translateY(10px);\n pointer-events: none;\n bottom: var(--art-control-height);\n max-height: var(--art-selector-max-height);\n background-color: var(--art-widget-background);\n transition: all var(--art-transition-duration) ease;\n}\n.art-control-selector .art-selector-list .art-selector-item {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 10px 15px;\n flex-shrink: 0;\n line-height: 1;\n}\n.art-control-selector .art-selector-list .art-selector-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.art-control-selector .art-selector-list .art-selector-item:hover,\n.art-control-selector .art-selector-list .art-selector-item.art-current {\n color: var(--art-theme);\n}\n.art-control-selector:hover .art-selector-list {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n.art-video-player {\n /*! Hint.css - v2.7.0 - 2021-10-01\n * https://kushagra.dev/lab/hint/\n * Copyright (c) 2021 Kushagra Gour */\n /*-------------------------------------*\\\n HINT.css - A CSS tooltip library\n \\*-------------------------------------*/\n /**\n * HINT.css is a tooltip library made in pure CSS.\n *\n * Source: https://github.com/chinchang/hint.css\n * Demo: http://kushagragour.in/lab/hint/\n *\n */\n /**\n * source: hint-core.scss\n *\n * Defines the basic styling for the tooltip.\n * Each tooltip is made of 2 parts:\n * 1) body (:after)\n * 2) arrow (:before)\n *\n * Classes added:\n * 1) hint\n */\n /**\n * source: hint-position.scss\n *\n * Defines the positoning logic for the tooltips.\n *\n * Classes added:\n * 1) hint--top\n * 2) hint--bottom\n * 3) hint--left\n * 4) hint--right\n */\n /**\n * set default color for tooltip arrows\n */\n /**\n * top tooltip\n */\n /**\n * bottom tooltip\n */\n /**\n * right tooltip\n */\n /**\n * left tooltip\n */\n /**\n * top-left tooltip\n */\n /**\n * top-right tooltip\n */\n /**\n * bottom-left tooltip\n */\n /**\n * bottom-right tooltip\n */\n /**\n * source: hint-sizes.scss\n *\n * Defines width restricted tooltips that can span\n * across multiple lines.\n *\n * Classes added:\n * 1) hint--small\n * 2) hint--medium\n * 3) hint--large\n *\n */\n /**\n * source: hint-theme.scss\n *\n * Defines basic theme for tooltips.\n *\n */\n /**\n * source: hint-color-types.scss\n *\n * Contains tooltips of various types based on color differences.\n *\n * Classes added:\n * 1) hint--error\n * 2) hint--warning\n * 3) hint--info\n * 4) hint--success\n *\n */\n /**\n * Error\n */\n /**\n * Warning\n */\n /**\n * Info\n */\n /**\n * Success\n */\n /**\n * source: hint-always.scss\n *\n * Defines a persisted tooltip which shows always.\n *\n * Classes added:\n * 1) hint--always\n *\n */\n /**\n * source: hint-rounded.scss\n *\n * Defines rounded corner tooltips.\n *\n * Classes added:\n * 1) hint--rounded\n *\n */\n /**\n * source: hint-effects.scss\n *\n * Defines various transition effects for the tooltips.\n *\n * Classes added:\n * 1) hint--no-animate\n * 2) hint--bounce\n *\n */\n}\n.art-video-player [class*='hint--'] {\n position: relative;\n display: inline-block;\n font-style: normal;\n /**\n * tooltip arrow\n */\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:before,\n.art-video-player [class*='hint--']:after {\n position: absolute;\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n visibility: hidden;\n opacity: 0;\n z-index: 1000000;\n pointer-events: none;\n -webkit-transition: 0.3s ease;\n -moz-transition: 0.3s ease;\n transition: 0.3s ease;\n -webkit-transition-delay: 0ms;\n -moz-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n visibility: visible;\n opacity: 1;\n}\n.art-video-player [class*='hint--']:hover:before,\n.art-video-player [class*='hint--']:hover:after {\n -webkit-transition-delay: 100ms;\n -moz-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.art-video-player [class*='hint--']:before {\n content: '';\n position: absolute;\n background: transparent;\n border: 6px solid transparent;\n z-index: 1000001;\n}\n.art-video-player [class*='hint--']:after {\n background: #000000;\n color: white;\n padding: 8px 10px;\n font-size: 12px;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n line-height: 12px;\n white-space: nowrap;\n}\n.art-video-player [class*='hint--'][aria-label]:after {\n content: attr(aria-label);\n}\n.art-video-player [class*='hint--'][data-hint]:after {\n content: attr(data-hint);\n}\n.art-video-player [aria-label='']:before,\n.art-video-player [aria-label='']:after,\n.art-video-player [data-hint='']:before,\n.art-video-player [data-hint='']:after {\n display: none !important;\n}\n.art-video-player .hint--top-left:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top-right:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--top:before {\n border-top-color: #000000;\n}\n.art-video-player .hint--bottom-left:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom-right:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--bottom:before {\n border-bottom-color: #000000;\n}\n.art-video-player .hint--left:before {\n border-left-color: #000000;\n}\n.art-video-player .hint--right:before {\n border-right-color: #000000;\n}\n.art-video-player .hint--top:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top:before,\n.art-video-player .hint--top:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--top:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top:hover:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--bottom:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom:before,\n.art-video-player .hint--bottom:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom:after {\n -webkit-transform: translateX(-50%);\n -moz-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.art-video-player .hint--bottom:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom:hover:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--right:before {\n margin-left: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--right:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--right:before,\n.art-video-player .hint--right:after {\n left: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--right:hover:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--right:hover:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--left:before {\n margin-right: -11px;\n margin-bottom: -6px;\n}\n.art-video-player .hint--left:after {\n margin-bottom: -14px;\n}\n.art-video-player .hint--left:before,\n.art-video-player .hint--left:after {\n right: 100%;\n bottom: 50%;\n}\n.art-video-player .hint--left:hover:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--left:hover:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--top-left:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-left:before,\n.art-video-player .hint--top-left:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--top-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--top-left:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--top-right:before {\n margin-bottom: -11px;\n}\n.art-video-player .hint--top-right:before,\n.art-video-player .hint--top-right:after {\n bottom: 100%;\n left: 50%;\n}\n.art-video-player .hint--top-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--top-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--top-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--top-right:hover:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--top-right:hover:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--bottom-left:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-left:before,\n.art-video-player .hint--bottom-left:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-left:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-left:after {\n -webkit-transform: translateX(-100%);\n -moz-transform: translateX(-100%);\n transform: translateX(-100%);\n}\n.art-video-player .hint--bottom-left:after {\n margin-left: 12px;\n}\n.art-video-player .hint--bottom-left:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-left:hover:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--bottom-right:before {\n margin-top: -11px;\n}\n.art-video-player .hint--bottom-right:before,\n.art-video-player .hint--bottom-right:after {\n top: 100%;\n left: 50%;\n}\n.art-video-player .hint--bottom-right:before {\n left: calc(50% - 6px);\n}\n.art-video-player .hint--bottom-right:after {\n -webkit-transform: translateX(0);\n -moz-transform: translateX(0);\n transform: translateX(0);\n}\n.art-video-player .hint--bottom-right:after {\n margin-left: -12px;\n}\n.art-video-player .hint--bottom-right:hover:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--bottom-right:hover:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--small:after,\n.art-video-player .hint--medium:after,\n.art-video-player .hint--large:after {\n white-space: normal;\n line-height: 1.4em;\n word-wrap: break-word;\n}\n.art-video-player .hint--small:after {\n width: 80px;\n}\n.art-video-player .hint--medium:after {\n width: 150px;\n}\n.art-video-player .hint--large:after {\n width: 300px;\n}\n.art-video-player [class*='hint--'] {\n /**\n * tooltip body\n */\n}\n.art-video-player [class*='hint--']:after {\n text-shadow: 0 -1px 0px black;\n box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);\n}\n.art-video-player .hint--error:after {\n background-color: #b34e4d;\n text-shadow: 0 -1px 0px #592726;\n}\n.art-video-player .hint--error.hint--top-left:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top-right:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--top:before {\n border-top-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-left:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom-right:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--bottom:before {\n border-bottom-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--left:before {\n border-left-color: #b34e4d;\n}\n.art-video-player .hint--error.hint--right:before {\n border-right-color: #b34e4d;\n}\n.art-video-player .hint--warning:after {\n background-color: #c09854;\n text-shadow: 0 -1px 0px #6c5328;\n}\n.art-video-player .hint--warning.hint--top-left:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top-right:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--top:before {\n border-top-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-left:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom-right:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--bottom:before {\n border-bottom-color: #c09854;\n}\n.art-video-player .hint--warning.hint--left:before {\n border-left-color: #c09854;\n}\n.art-video-player .hint--warning.hint--right:before {\n border-right-color: #c09854;\n}\n.art-video-player .hint--info:after {\n background-color: #3986ac;\n text-shadow: 0 -1px 0px #1a3c4d;\n}\n.art-video-player .hint--info.hint--top-left:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top-right:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--top:before {\n border-top-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-left:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom-right:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--bottom:before {\n border-bottom-color: #3986ac;\n}\n.art-video-player .hint--info.hint--left:before {\n border-left-color: #3986ac;\n}\n.art-video-player .hint--info.hint--right:before {\n border-right-color: #3986ac;\n}\n.art-video-player .hint--success:after {\n background-color: #458746;\n text-shadow: 0 -1px 0px #1a321a;\n}\n.art-video-player .hint--success.hint--top-left:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top-right:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--top:before {\n border-top-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-left:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom-right:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--bottom:before {\n border-bottom-color: #458746;\n}\n.art-video-player .hint--success.hint--left:before {\n border-left-color: #458746;\n}\n.art-video-player .hint--success.hint--right:before {\n border-right-color: #458746;\n}\n.art-video-player .hint--always:after,\n.art-video-player .hint--always:before {\n opacity: 1;\n visibility: visible;\n}\n.art-video-player .hint--always.hint--top:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top:after {\n -webkit-transform: translateX(-50%) translateY(-8px);\n -moz-transform: translateX(-50%) translateY(-8px);\n transform: translateX(-50%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-left:after {\n -webkit-transform: translateX(-100%) translateY(-8px);\n -moz-transform: translateX(-100%) translateY(-8px);\n transform: translateX(-100%) translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:before {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--top-right:after {\n -webkit-transform: translateY(-8px);\n -moz-transform: translateY(-8px);\n transform: translateY(-8px);\n}\n.art-video-player .hint--always.hint--bottom:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom:after {\n -webkit-transform: translateX(-50%) translateY(8px);\n -moz-transform: translateX(-50%) translateY(8px);\n transform: translateX(-50%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-left:after {\n -webkit-transform: translateX(-100%) translateY(8px);\n -moz-transform: translateX(-100%) translateY(8px);\n transform: translateX(-100%) translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:before {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--bottom-right:after {\n -webkit-transform: translateY(8px);\n -moz-transform: translateY(8px);\n transform: translateY(8px);\n}\n.art-video-player .hint--always.hint--left:before {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--left:after {\n -webkit-transform: translateX(-8px);\n -moz-transform: translateX(-8px);\n transform: translateX(-8px);\n}\n.art-video-player .hint--always.hint--right:before {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--always.hint--right:after {\n -webkit-transform: translateX(8px);\n -moz-transform: translateX(8px);\n transform: translateX(8px);\n}\n.art-video-player .hint--rounded:after {\n border-radius: 4px;\n}\n.art-video-player .hint--no-animate:before,\n.art-video-player .hint--no-animate:after {\n -webkit-transition-duration: 0ms;\n -moz-transition-duration: 0ms;\n transition-duration: 0ms;\n}\n.art-video-player .hint--bounce:before,\n.art-video-player .hint--bounce:after {\n -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(0.71, 1.7, 0.77, 1.24);\n}\n.art-video-player .hint--no-shadow:before,\n.art-video-player .hint--no-shadow:after {\n text-shadow: initial;\n box-shadow: initial;\n}\n.art-video-player .hint--no-arrow:before {\n display: none;\n}\n.art-video-player.art-mobile {\n --art-bottom-gap: 10px;\n --art-control-height: 38px;\n --art-control-icon-scale: 1;\n --art-state-size: 60px;\n --art-settings-max-height: 180px;\n --art-selector-max-height: 180px;\n --art-indicator-scale: 1;\n --art-control-opacity: 1;\n}\n.art-video-player.art-mobile .art-controls-left {\n margin-left: calc(var(--art-padding) / -1);\n}\n.art-video-player.art-mobile .art-controls-right {\n margin-right: calc(var(--art-padding) / -1);\n}\n"; function parseSubtitle(buffer, option) { const text = new TextDecoder(option.encoding).decode(buffer); switch (option.type || getExt(option.url)) { @@ -6215,19 +6955,19 @@ function renderSubtitle(subtitle) { return; const revision = state2.revision; const render = ++state2.render; - const active = () => !state2.scope.closed && state2.revision === revision && state2.render === render; + const active2 = () => !state2.scope.closed && state2.revision === revision && state2.render === render; const { art } = subtitle; const { $subtitle } = art.template; $subtitle.innerHTML = ""; if (!subtitle.activeCues.length) return; art.emit("subtitleBeforeUpdate", subtitle.activeCues); - if (!active()) + if (!active2()) return; const html2 = subtitle.activeCues.map((cue, index) => cue.text.split(/\r?\n/).filter((line) => line.trim()).map((line) => `
${art.option.subtitle.escape ? escape(line) : line}
`).join("")).join(""); - if (!active()) + if (!active2()) return; $subtitle.innerHTML = html2; art.emit("subtitleAfterUpdate", subtitle.activeCues); @@ -6537,8 +7277,8 @@ class Template { static get html() { return html; } - query(className) { - return query(className, this.$container); + query(className2) { + return query(className2, this.$container); } init() { const { option } = this.art; diff --git a/packages/artplayer/src/display/fullscreen-abandoned.ts b/packages/artplayer/src/display/fullscreen-abandoned.ts new file mode 100644 index 000000000..f9a974136 --- /dev/null +++ b/packages/artplayer/src/display/fullscreen-abandoned.ts @@ -0,0 +1,48 @@ +import type { NativeFullscreenAdapter } from './types' + +const abandoned = new WeakMap unknown>>() + +export function hasAbandonedFullscreen(adapter: NativeFullscreenAdapter): boolean { + return abandoned.get(adapter.document)?.has(adapter.target) ?? false +} + +export function clearAbandonedFullscreen(adapter: NativeFullscreenAdapter): void { + abandoned.get(adapter.document)?.delete(adapter.target) +} + +function exitNative(exit: () => unknown): void { + try { + void Promise.resolve(exit()).catch(() => {}) + } + catch {} +} + +function entriesFor(document: Document, elementProperty: string, changeEvent: string): WeakMap unknown> { + let entries = abandoned.get(document) + if (!entries) { + entries = new WeakMap() + abandoned.set(document, entries) + const pending = entries + // A document-lifetime guard for unabortable void APIs. Keys are weak and values + // contain only the native exit operation, never an ArtPlayer instance or scope. + document.addEventListener(changeEvent, () => { + const element = Reflect.get(document, elementProperty) as Element | null + const release = element && pending.get(element) + if (!release) + return + pending.delete(element) + exitNative(release) + }) + } + return entries +} + +export function abandonFullscreen(adapter: NativeFullscreenAdapter): void { + const { document, elementProperty, changeEvent, target, exit } = adapter + const entries = entriesFor(document, elementProperty, changeEvent) + entries.set(target, exit) + if (adapter.element === target) { + entries.delete(target) + exitNative(exit) + } +} diff --git a/packages/artplayer/src/display/fullscreen-adapter.ts b/packages/artplayer/src/display/fullscreen-adapter.ts new file mode 100644 index 000000000..cce690bbb --- /dev/null +++ b/packages/artplayer/src/display/fullscreen-adapter.ts @@ -0,0 +1,38 @@ +import type { NativeFullscreenAdapter } from './types' +import screenfull from '../libs/screenfull' + +interface MethodMap { + requestFullscreen: string + exitFullscreen: string + fullscreenElement: string + fullscreenEnabled: string + fullscreenchange: string + fullscreenerror: string +} + +function call(target: object, name: string, ...args: unknown[]): unknown { + const method: unknown = Reflect.get(target, name) + if (typeof method !== 'function') + throw new TypeError(`Fullscreen method ${name} is not available`) + return method.apply(target, args) +} + +export function fullscreenAdapter(target: HTMLElement): NativeFullscreenAdapter | undefined { + // Reuse the audited vendor mapping, not its unscoped request-promise listeners. + const raw = screenfull.raw as MethodMap | false + const document = target.ownerDocument + if (!raw || !Reflect.get(document, raw.fullscreenEnabled)) + return undefined + return { + document, + target, + get element(): Element | null { + return Reflect.get(document, raw.fullscreenElement) as Element | null + }, + elementProperty: raw.fullscreenElement, + changeEvent: raw.fullscreenchange, + errorEvent: raw.fullscreenerror, + request: () => call(target, raw.requestFullscreen, undefined), + exit: () => call(document, raw.exitFullscreen), + } +} diff --git a/packages/artplayer/src/display/fullscreen-request.ts b/packages/artplayer/src/display/fullscreen-request.ts new file mode 100644 index 000000000..b34ab5b8d --- /dev/null +++ b/packages/artplayer/src/display/fullscreen-request.ts @@ -0,0 +1,88 @@ +import type ResourceScope from '../lifecycle/scope' +import type { NativeFullscreenAdapter } from './types' +import { listen } from '../lifecycle/resources' +import { abandonFullscreen, clearAbandonedFullscreen } from './fullscreen-abandoned' + +export function requestFullscreen(adapter: NativeFullscreenAdapter, parent: ResourceScope, entering: boolean, lateCompletion: () => void, hasExited = () => adapter.element !== adapter.target): { promise: Promise, cancel: () => void } { + const scope = parent.child() + let done = false + let cancelled = false + let returned = false + let promiseResult = false + let eventFailed = false + let resolve!: () => void + let reject!: (error: unknown) => void + const promise = new Promise((accept, fail) => { + resolve = accept + reject = fail + }) + scope.add(() => { + if (!done) { + done = true + cancelled = true + resolve() + if (returned && !promiseResult && entering) + abandonFullscreen(adapter) + } + }) + function finish(failed = false, error?: unknown) { + if (done) + return + done = true + try { + scope.dispose() + } + catch (cleanupError) { + if (!failed) { + failed = true + error = cleanupError + } + } + if (failed) + reject(error) + else + resolve() + } + const changed = () => { + if (returned && !promiseResult && (entering ? adapter.element === adapter.target : hasExited())) + finish() + } + listen(scope, adapter.document, adapter.changeEvent, changed) + listen(scope, adapter.document, adapter.errorEvent, (event) => { + if (event.target === adapter.target || event.target === adapter.document) { + eventFailed = true + if (returned && !promiseResult) + finish(true, new Error('Fullscreen request failed')) + } + }) + if (!scope.closed) { + try { + // Invoke before yielding so the browser sees the caller's transient activation. + if (entering) + clearAbandonedFullscreen(adapter) + const result = entering ? adapter.request() : adapter.exit() + promiseResult = Boolean(result && typeof (result as PromiseLike).then === 'function') + returned = true + if (cancelled && !promiseResult && entering) + abandonFullscreen(adapter) + if (promiseResult) { + void Promise.resolve(result).then(() => { + if (cancelled) + lateCompletion() + else + finish() + }, error => finish(true, error)).catch(() => {}) + } + else if (eventFailed) { + finish(true, new Error('Fullscreen request failed')) + } + else { + changed() + } + } + catch (error) { + finish(true, error) + } + } + return { promise, cancel: () => scope.dispose() } +} diff --git a/packages/artplayer/src/display/mini-drag.ts b/packages/artplayer/src/display/mini-drag.ts new file mode 100644 index 000000000..a00de1042 --- /dev/null +++ b/packages/artplayer/src/display/mini-drag.ts @@ -0,0 +1,51 @@ +import type ResourceScope from '../lifecycle/scope' +import type { MiniHost } from './types' +import { listen } from '../lifecycle/resources' +import { clampMini, miniGeometry } from './mini-layout' + +export function miniDrag(art: MiniHost, element: HTMLElement, scope: ResourceScope, active: () => boolean): () => void { + let dragging = false + let startX = 0 + let startY = 0 + const cancel = (): undefined => { + dragging = false + element.classList.remove('art-mini-dragging') + element.style.transform = '' + } + listen(scope, element, 'mousedown', (event) => { + const mouse = event as MouseEvent + if (mouse.button !== 0 || !active()) + return + dragging = true + startX = mouse.clientX + startY = mouse.clientY + }) + const move = (event: MouseEvent) => { + if (!scope.closed && dragging && active()) { + element.classList.add('art-mini-dragging') + element.style.transform = `translate(${event.clientX - startX}px, ${event.clientY - startY}px)` + } + } + const end = () => { + if (scope.closed || !dragging || !active()) + return + const rect = element.getBoundingClientRect() + const position = clampMini(rect.left, rect.top, miniGeometry(element)) + cancel() + element.style.left = `${position.left}px` + element.style.top = `${position.top}px` + art.storage.set('left', position.left) + if (!scope.closed) + art.storage.set('top', position.top) + } + art.on('document:mousemove', move) + scope.add(() => { + art.off('document:mousemove', move) + }) + art.on('document:mouseup', end) + scope.add(() => { + art.off('document:mouseup', end) + }) + scope.add(cancel) + return cancel +} diff --git a/packages/artplayer/src/display/mini-layout.ts b/packages/artplayer/src/display/mini-layout.ts new file mode 100644 index 000000000..ee19e9952 --- /dev/null +++ b/packages/artplayer/src/display/mini-layout.ts @@ -0,0 +1,24 @@ +export interface MiniGeometry { + width: number + height: number + viewportWidth: number + viewportHeight: number +} + +export function clampMini(left: number, top: number, geometry: MiniGeometry): { left: number, top: number } { + const maxLeft = Math.max(0, geometry.viewportWidth - geometry.width) + const maxTop = Math.max(0, geometry.viewportHeight - geometry.height) + return { left: Math.max(0, Math.min(left, maxLeft)), top: Math.max(0, Math.min(top, maxTop)) } +} + +export function miniPosition(left: unknown, top: unknown, geometry: MiniGeometry): { left: number, top: number, reset: boolean } { + if (typeof left === 'number' && Number.isFinite(left) && typeof top === 'number' && Number.isFinite(top) + && left >= 0 && top >= 0 && left + geometry.width <= geometry.viewportWidth && top + geometry.height <= geometry.viewportHeight) { return { left, top, reset: false } } + return { ...clampMini(geometry.viewportWidth - geometry.width - 50, geometry.viewportHeight - geometry.height - 50, geometry), reset: true } +} + +export function miniGeometry(element: HTMLElement): MiniGeometry { + const { width, height } = element.getBoundingClientRect() + const view = element.ownerDocument.defaultView! + return { width, height, viewportWidth: view.innerWidth, viewportHeight: view.innerHeight } +} diff --git a/packages/artplayer/src/display/mini-view.ts b/packages/artplayer/src/display/mini-view.ts new file mode 100644 index 000000000..8d1ef01e5 --- /dev/null +++ b/packages/artplayer/src/display/mini-view.ts @@ -0,0 +1,79 @@ +import type ResourceScope from '../lifecycle/scope' +import type { MiniHost } from './types' +import { listen } from '../lifecycle/resources' +import { silencePromise } from '../utils/error' +import { miniDrag } from './mini-drag' + +export interface MiniView { + element: HTMLElement + cancelDrag: () => void + fresh: boolean +} + +export function createMiniView(art: MiniHost, parent: ResourceScope, active: () => boolean, hide: () => void): MiniView | undefined { + const scope = parent.child() + if (scope.closed) + return + const existing = art.template.$mini + if (existing) { + const display = existing.style.display + scope.add(() => { + existing.style.display = display + }) + return { element: existing, cancelDrag: () => {}, fresh: false } + } + const document = art.template.$player.ownerDocument + const element = document.createElement('div') + element.className = 'art-mini-popup' + scope.add(() => { + element.remove() + }) + try { + const close = document.createElement('div') + close.className = 'art-mini-close' + close.append(art.icons.close) + if (scope.closed) + return + const state = document.createElement('div') + state.className = 'art-mini-state' + const play = art.icons.play + const pause = art.icons.pause + if (scope.closed) + return + state.append(play, pause) + element.append(close, state) + listen(scope, close, 'click', hide) + listen(scope, play, 'click', () => { + silencePromise(art.play()) + }) + listen(scope, pause, 'click', () => { + art.pause() + }) + const update = () => { + if (scope.closed) + return + play.style.display = art.playing ? 'none' : 'flex' + pause.style.display = art.playing ? 'flex' : 'none' + } + update() + for (const name of ['video:playing', 'video:pause', 'video:timeupdate'] as const) { + art.on(name, update) + scope.add(() => { + art.off(name, update) + }) + } + const cancelDrag = miniDrag(art, element, scope, active) + if (scope.closed) + return + art.template.$mini = element + document.body.append(element) + if (!scope.closed) + return { element, cancelDrag, fresh: true } + } + catch (error) { + scope.dispose() + if (art.template.$mini === element) + delete art.template.$mini + throw error + } +} diff --git a/packages/artplayer/src/display/mini.ts b/packages/artplayer/src/display/mini.ts new file mode 100644 index 000000000..94dc00799 --- /dev/null +++ b/packages/artplayer/src/display/mini.ts @@ -0,0 +1,142 @@ +import type { MiniView } from './mini-view' +import type { Placement } from './placement' +import type { MiniHost } from './types' +import { getScope, isClosing } from '../lifecycle/instance' +import { miniGeometry, miniPosition } from './mini-layout' +import { createMiniView } from './mini-view' +import { capturePlacement, restorePlacement } from './placement' + +export function mini(art: MiniHost): PropertyDescriptor { + const { $player, $video } = art.template + const scope = getScope(art).child() + let view: MiniView | undefined + let placement: Placement | undefined + let revision = 0 + let creating = false + let queued = false + const active = () => !isClosing(art) && $player.classList.contains('art-mini') + + function restore() { + if (placement) { + const saved = placement + const current = revision + placement = undefined + try { + restorePlacement(saved) + } + catch (error) { + if (current === revision && !placement) + placement = saved + throw error + } + } + } + + function hide() { + if (isClosing(art)) + return + const current = ++revision + queued = false + restore() + if (isClosing(art) || current !== revision) + return + view?.cancelDrag() + $player.classList.remove('art-mini') + if (art.template.$mini) { + art.template.$mini.style.display = 'none' + art.emit('mini', false) + } + } + + scope.add(() => { + revision++ + try { + restore() + } + finally { + view?.cancelDrag() + $player.classList.remove('art-mini') + } + }) + + function show(): void { + if (isClosing(art)) + return + const current = ++revision + if (creating) { + queued = true + return + } + art.state = 'mini' + if (isClosing(art) || current !== revision) + return + placement ??= capturePlacement($video) + $player.classList.add('art-mini') + try { + if (!view) { + creating = true + try { + view = createMiniView(art, scope, active, hide) + } + finally { + creating = false + } + } + if (queued) { + queued = false + show() + return + } + if (!view || isClosing(art)) + return + if (current !== revision) { + if (!active()) + view.element.style.display = 'none' + return + } + if (view.fresh) + view.element.prepend($video) + else + view.element.append($video) + if (isClosing(art) || current !== revision) + return + view.element.style.display = view.fresh ? '' : 'flex' + view.fresh = false + const top = art.storage.get('top') + const left = art.storage.get('left') + const position = miniPosition(left, top, miniGeometry(view.element)) + if (isClosing(art) || current !== revision) + return + view.element.style.left = `${position.left}px` + view.element.style.top = `${position.top}px` + if (position.reset) { + art.storage.set('top', position.top) + if (isClosing(art) || current !== revision) + return + art.storage.set('left', position.left) + } + if (!isClosing(art) && current === revision) + art.emit('mini', true) + } + catch (error) { + const pendingReentry = queued + queued = false + if (!isClosing(art) && (current === revision || pendingReentry)) { + restore() + $player.classList.remove('art-mini') + if (view) + view.element.style.display = 'none' + } + throw error + } + } + return { + get: active, + set(value: boolean): void { + if (value) + show() + else + hide() + }, + } +} diff --git a/packages/artplayer/src/display/native-fullscreen.ts b/packages/artplayer/src/display/native-fullscreen.ts new file mode 100644 index 000000000..6275b3357 --- /dev/null +++ b/packages/artplayer/src/display/native-fullscreen.ts @@ -0,0 +1,106 @@ +import type { FullscreenHost, NativeFullscreenAdapter } from './types' +import { getScope, isClosing } from '../lifecycle/instance' +import { listen } from '../lifecycle/resources' +import { hasAbandonedFullscreen } from './fullscreen-abandoned' +import { requestFullscreen } from './fullscreen-request' + +export function nativeFullscreen(art: FullscreenHost, adapter: NativeFullscreenAdapter): PropertyDescriptor { + const scope = getScope(art).child() + const { $player, $video } = art.template + const ownsFullscreen = () => adapter.element === $player || adapter.element === $video + let last = ownsFullscreen() + let revision = 0 + let desired = last + let pending: ReturnType | undefined + let pendingEntry = false + let cancelledEntry = false + let requesting = false + + function exitOwned() { + if (!ownsFullscreen()) + return + try { + void Promise.resolve(adapter.exit()).catch(() => {}) + } + catch {} + } + + scope.add(() => { + revision += 1 + desired = false + $player.classList.remove('art-fullscreen') + exitOwned() + }) + listen(scope, adapter.document, adapter.changeEvent, () => { + const value = ownsFullscreen() + if (value && hasAbandonedFullscreen(adapter)) + return + if (value && cancelledEntry) { + exitOwned() + return + } + if (value === last || isClosing(art)) + return + last = value + const current = revision + const stale = () => isClosing(art) || ownsFullscreen() !== value || (current !== revision && desired !== value) + art.emit('fullscreen', value) + if (stale()) + return + if (value) + art.state = 'fullscreen' + if (stale()) + return + $player.classList.toggle('art-fullscreen', value) + art.emit('resize') + }) + listen(scope, adapter.document, adapter.errorEvent, (event) => { + const ownEvent = event.target === $player || event.target === $video + || (event.target === adapter.document && (requesting || pending !== undefined || ownsFullscreen())) + if (ownEvent && !isClosing(art)) + art.emit('fullscreenError', event) + }) + + return { + get: () => !isClosing(art) && ownsFullscreen(), + set(value: boolean): Promise { + if (isClosing(art)) + return Promise.resolve() + const current = ++revision + desired = Boolean(value) + if (desired) + cancelledEntry = false + else if (pendingEntry) + cancelledEntry = true + pending?.cancel() + pending = undefined + pendingEntry = false + if (!desired && !ownsFullscreen()) + return Promise.resolve() + requesting = true + pendingEntry = desired + const operation = requestFullscreen(adapter, scope, desired, () => { + if (isClosing(art) || !desired) + exitOwned() + }, () => !ownsFullscreen()) + requesting = false + if (revision === current) + pending = operation + else + operation.cancel() + const result = operation.promise.catch((error) => { + if (!isClosing(art) && revision === current) + art.notice.show = error + throw error + }).finally(() => { + if (revision === current) { + pending = undefined + pendingEntry = false + } + }) + // Assignment cannot consume a setter return, but descriptor callers still can. + void result.catch(() => {}) + return result + }, + } +} diff --git a/packages/artplayer/src/display/native-pip.ts b/packages/artplayer/src/display/native-pip.ts new file mode 100644 index 000000000..62fa1f1bb --- /dev/null +++ b/packages/artplayer/src/display/native-pip.ts @@ -0,0 +1,98 @@ +import type { PipHost } from './types' +import { getScope, isClosing } from '../lifecycle/instance' +import { listen } from '../lifecycle/resources' + +export function nativePip(art: PipHost): PropertyDescriptor { + const { $video } = art.template + const document = $video.ownerDocument + const scope = getScope(art).child() + const owns = () => document.pictureInPictureElement === $video + let last = owns() + let desired = last + let pending = false + let cancelled = false + let revision = 0 + $video.disablePictureInPicture = false + + function exitOwned() { + if (!owns()) + return + try { + void document.exitPictureInPicture().catch(() => {}) + } + catch {} + } + + function observe(result: Promise, entering: boolean, current: number) { + void result.then(() => { + if (entering && (isClosing(art) || !desired)) + exitOwned() + }, (error) => { + if (!isClosing(art) && revision === current) + art.notice.show = error + }).finally(() => { + if (revision === current) + pending = false + }).catch(() => {}) + } + + scope.add(() => { + revision++ + desired = false + exitOwned() + }) + listen(scope, $video, 'enterpictureinpicture', () => { + if (cancelled) { + exitOwned() + return + } + if (!owns() || last) + return + const current = revision + art.state = 'pip' + if (!isClosing(art) && current === revision && owns()) { + last = true + art.emit('pip', true) + } + }) + listen(scope, $video, 'leavepictureinpicture', () => { + if (!last || owns()) + return + last = false + art.emit('pip', false) + }) + + return { + // Native callers historically receive the media element, not a boolean. + get: () => !isClosing(art) && owns() ? $video : null, + set(value: boolean): void { + if (isClosing(art)) + return + const current = ++revision + desired = Boolean(value) + if (desired) + cancelled = false + else if (pending) + cancelled = true + pending = false + if (desired) { + art.state = 'pip' + if (isClosing(art) || revision !== current) + return + pending = true + try { + // Native invocation stays on the user gesture stack; the setter stays void. + observe($video.requestPictureInPicture!(), true, current) + } + catch (error) { + if (revision === current) + pending = false + throw error + } + } + else if (owns()) { + observe(document.exitPictureInPicture(), false, current) + } + }, + } +} diff --git a/packages/artplayer/src/display/orientation-native.ts b/packages/artplayer/src/display/orientation-native.ts new file mode 100644 index 000000000..fbc2d575f --- /dev/null +++ b/packages/artplayer/src/display/orientation-native.ts @@ -0,0 +1,87 @@ +import type { OrientationHost, OrientationLock } from './orientation-types' +import { getScope, isClosing } from '../lifecycle/instance' + +interface Request { + orientation: OrientationLock + cancelled: boolean + settled: boolean +} + +// Per-screen ownership prevents an old instance from unlocking a newer request. +const owners = new WeakMap() +const className = 'art-auto-orientation-fullscreen' + +function unlock(request: Request): void { + if (owners.get(request.orientation) !== request) + return + try { + request.orientation.unlock() + } + catch {} +} + +export function nativeOrientation(art: OrientationHost, needRotate: () => boolean): (state: boolean) => void { + const { $player } = art.template + let current: Request | undefined + + function cancel(): undefined { + const request = current + current = undefined + $player.classList.remove(className) + if (request) { + request.cancelled = true + unlock(request) + if (request.settled && owners.get(request.orientation) === request) + owners.delete(request.orientation) + } + } + + getScope(art).add(cancel) + return (state) => { + if (isClosing(art)) + return + if (!state) { + cancel() + return + } + if (current && !current.cancelled && owners.get(current.orientation) === current) + return + const orientation = $player.ownerDocument.defaultView?.screen?.orientation as OrientationLock | undefined + if (typeof orientation?.lock !== 'function' || typeof orientation.unlock !== 'function' || !needRotate()) + return + const request: Request = { orientation, cancelled: false, settled: false } + current = request + owners.set(orientation, request) + const active = () => !isClosing(art) && !request.cancelled && current === request && owners.get(orientation) === request + const failed = (error: unknown) => { + request.settled = true + const show = active() + if (owners.get(orientation) === request) + owners.delete(orientation) + if (current === request) + current = undefined + if (show) { + $player.classList.remove(className) + art.notice.show = error + } + } + try { + // Invoke before yielding; fullscreen entry already supplied the gesture. + const result = orientation.lock(orientation.type.startsWith('portrait') ? 'landscape' : 'portrait') + Promise.resolve(result).then(() => { + request.settled = true + if (active()) { + $player.classList.add(className) + } + else { + unlock(request) + if (owners.get(orientation) === request) + owners.delete(orientation) + } + }).catch(failed) + } + catch (error) { + failed(error) + } + } +} diff --git a/packages/artplayer/src/display/orientation-types.ts b/packages/artplayer/src/display/orientation-types.ts new file mode 100644 index 000000000..655e597d6 --- /dev/null +++ b/packages/artplayer/src/display/orientation-types.ts @@ -0,0 +1,16 @@ +import type { SubscriptionHost } from '../component/resources' + +export interface OrientationHost extends SubscriptionHost<{ fullscreenWeb: [boolean], fullscreen: [boolean] }> { + constructor: { AUTO_ORIENTATION_TIME?: number } + template: { $player: HTMLElement, $video: { readonly videoWidth: number, readonly videoHeight: number } } + fullscreenWeb: boolean + isRotate: boolean + notice: { set show(value: unknown) } + emit: (name: 'resize') => unknown +} + +export interface OrientationLock { + readonly type: string + lock: (mode: 'portrait' | 'landscape') => Promise + unlock: () => void +} diff --git a/packages/artplayer/src/display/orientation-web.ts b/packages/artplayer/src/display/orientation-web.ts new file mode 100644 index 000000000..f30a2a042 --- /dev/null +++ b/packages/artplayer/src/display/orientation-web.ts @@ -0,0 +1,72 @@ +import type { OrientationHost } from './orientation-types' +import { getScope, isClosing } from '../lifecycle/instance' +import { timeout } from '../lifecycle/resources' +import { getSafeAreaInsets } from '../utils' + +const className = 'art-auto-orientation' +const properties = ['width', 'height', 'transform-origin', 'transform'] as const + +export function webOrientation(art: OrientationHost, needRotate: () => boolean): (state: boolean) => void { + const { $player } = art.template + const scope = getScope(art) + let cancel = () => {} + let saved: { name: string, value: string, priority: string }[] | undefined + + function clear(): undefined { + cancel() + cancel = () => {} + const previous = saved + saved = undefined + // fullscreenWeb restores its complete entry style before emitting false. + if (previous && art.fullscreenWeb) { + for (const { name, value, priority } of previous) + $player.style.setProperty(name, value, priority) + } + const wasRotated = $player.classList.contains(className) + $player.classList.remove(className) + if (wasRotated) { + art.isRotate = false + if (!isClosing(art)) + art.emit('resize') + } + } + + scope.add(clear) + function apply(emit: boolean): void { + if (!art.fullscreenWeb || !needRotate()) + return + const insets = getSafeAreaInsets() + if (isClosing(art) || !art.fullscreenWeb) + return + const viewport = $player.ownerDocument.documentElement + saved ??= properties.map(name => ({ name, value: $player.style.getPropertyValue(name), priority: $player.style.getPropertyPriority(name) })) + $player.style.width = `${viewport.clientHeight - insets.top - insets.bottom}px` + $player.style.height = `${viewport.clientWidth - insets.left - insets.right}px` + $player.style.transformOrigin = '0 0' + $player.style.transform = `rotate(90deg) translate(${insets.top}px, -${viewport.clientWidth - insets.right}px)` + $player.classList.add(className) + art.isRotate = true + if (emit) + art.emit('resize') + } + + return (state) => { + if (isClosing(art)) + return + if (!state) { + clear() + return + } + if (saved) { + apply(false) + return + } + if (!needRotate()) + return + cancel() + cancel = timeout(scope, () => { + if (!saved) + apply(true) + }, Number(art.constructor.AUTO_ORIENTATION_TIME ?? 0)) + } +} diff --git a/packages/artplayer/src/display/placement.ts b/packages/artplayer/src/display/placement.ts new file mode 100644 index 000000000..ca5ee71c6 --- /dev/null +++ b/packages/artplayer/src/display/placement.ts @@ -0,0 +1,19 @@ +export interface Placement { + node: Node + parent: ParentNode | null + next: ChildNode | null +} + +export function capturePlacement(node: Node): Placement { + return { node, parent: node.parentNode, next: node.nextSibling } +} + +export function restorePlacement({ node, parent, next }: Placement): void { + if (!parent) { + node.parentNode?.removeChild(node) + return + } + const anchor = next?.parentNode === parent ? next : null + if (node.parentNode !== parent || node.nextSibling !== anchor) + parent.insertBefore(node, anchor) +} diff --git a/packages/artplayer/src/display/sizing-types.ts b/packages/artplayer/src/display/sizing-types.ts new file mode 100644 index 000000000..58e86f32f --- /dev/null +++ b/packages/artplayer/src/display/sizing-types.ts @@ -0,0 +1,29 @@ +import type { PlaybackNotice } from '../media/playback' +import type { Size } from './sizing' + +interface MediaDimensions { + readonly videoWidth: number + readonly videoHeight: number +} + +export interface AutoSizeHost { + template: { $container: HTMLElement, $player: HTMLElement, $video: MediaDimensions } + readonly width: number + readonly height: number + emit: (name: 'autoSize', size: Size) => unknown +} + +export interface AutoHeightHost { + template: { $container: HTMLElement, $video: MediaDimensions } + emit: (name: 'autoHeight', height: number) => unknown +} + +export interface AspectRatioHost extends PlaybackNotice { + template: { $player: HTMLElement, $video: HTMLElement } + emit: (name: 'aspectRatio', ratio: string) => unknown +} + +export interface FlipHost extends PlaybackNotice { + template: { $player: HTMLElement } + emit: (name: 'flip', flip: string) => unknown +} diff --git a/packages/artplayer/src/display/sizing.ts b/packages/artplayer/src/display/sizing.ts new file mode 100644 index 000000000..c16d38038 --- /dev/null +++ b/packages/artplayer/src/display/sizing.ts @@ -0,0 +1,24 @@ +export interface Size { + width: number + height: number +} + +export function positiveSize({ width, height }: Size): boolean { + return Number.isFinite(width) && width > 0 && Number.isFinite(height) && height > 0 +} + +export function containSize(container: Size, ratio: number): (Size & { axis: 'width' | 'height' }) | undefined { + if (!positiveSize(container) || !Number.isFinite(ratio) || ratio <= 0) + return + const result = container.width / container.height > ratio + ? { width: ratio * container.height, height: container.height, axis: 'width' as const } + : { width: container.width, height: container.width / ratio, axis: 'height' as const } + return positiveSize(result) ? result : undefined +} + +export function proportionalHeight(width: number, media: Size): number | undefined { + if (!Number.isFinite(width) || width <= 0 || !positiveSize(media)) + return + const height = media.height * (width / media.width) + return Number.isFinite(height) && height > 0 ? height : undefined +} diff --git a/packages/artplayer/src/display/types.ts b/packages/artplayer/src/display/types.ts new file mode 100644 index 000000000..0126af0a1 --- /dev/null +++ b/packages/artplayer/src/display/types.ts @@ -0,0 +1,71 @@ +import type { SubscriptionHost } from '../component/resources' +import type { OptionalMediaCapabilities } from '../media/types' + +export interface WebFullscreenHost { + constructor: { FULLSCREEN_WEB_IN_BODY: boolean } + template: { $container: HTMLElement, $player: HTMLElement } + state: string + emit: (name: 'fullscreenWeb' | 'resize', ...args: unknown[]) => unknown +} + +export interface WebFullscreenProperty { + fullscreenWeb: boolean +} + +export interface FullscreenHost { + template: { $player: HTMLElement, $video: HTMLElement & OptionalMediaCapabilities } + state: string + notice: { set show(value: unknown) } + i18n: { get: (key: string) => string } + emit: (name: 'fullscreen' | 'fullscreenError' | 'resize', ...args: unknown[]) => unknown + once: (name: 'video:loadedmetadata', listener: () => void) => unknown + on: (name: 'document:webkitfullscreenchange', listener: () => void) => unknown + off: (name: 'video:loadedmetadata' | 'document:webkitfullscreenchange', listener: () => void) => unknown +} + +export interface NativeFullscreenAdapter { + document: Document + target: HTMLElement + readonly element: Element | null + elementProperty: string + changeEvent: string + errorEvent: string + request: () => unknown + exit: () => unknown +} + +export interface PipHost { + template: { $video: HTMLElement & OptionalMediaCapabilities & { disablePictureInPicture?: boolean } } + state: string + notice: { set show(value: unknown) } + i18n: { get: (key: string) => string } + emit: (name: 'pip', value: boolean) => unknown +} + +export interface PipProperty { + get pip(): HTMLElement | null | boolean + set pip(value: boolean) +} + +export interface MiniEvents { + 'video:playing': [] + 'video:pause': [] + 'video:timeupdate': [] + 'document:mousemove': [MouseEvent] + 'document:mouseup': [MouseEvent] +} + +export interface MiniHost extends SubscriptionHost { + template: { $player: HTMLElement, $video: HTMLElement, $mini?: HTMLElement } + icons: { close: HTMLElement, play: HTMLElement, pause: HTMLElement } + storage: { get: (key: string) => unknown, set: (key: string, value: number) => unknown } + state: string + playing: boolean + play: () => unknown + pause: () => unknown + emit: (name: 'mini', value: boolean) => unknown +} + +export interface MiniProperty { + mini: boolean +} diff --git a/packages/artplayer/src/display/video-fullscreen-state.ts b/packages/artplayer/src/display/video-fullscreen-state.ts new file mode 100644 index 000000000..892a0c97a --- /dev/null +++ b/packages/artplayer/src/display/video-fullscreen-state.ts @@ -0,0 +1,40 @@ +import type { OptionalMediaCapabilities } from '../media/types' + +type Video = HTMLElement & OptionalMediaCapabilities + +const abandoned = new WeakSet