function YE(n,e){for(var t=0;ti[a]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function t(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=t(a);fetch(a.href,l)}})();var gf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Du(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function QE(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function i(){var a=!1;try{a=this instanceof i}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var a=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:function(){return n[i]}})}),t}var mp={exports:{}},Rc={};var r1;function ZE(){if(r1)return Rc;r1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var h in a)h!=="key"&&(l[h]=a[h])}else l=a;return a=l.ref,{$$typeof:n,type:i,key:u,ref:a!==void 0?a:null,props:l}}return Rc.Fragment=e,Rc.jsx=t,Rc.jsxs=t,Rc}var s1;function JE(){return s1||(s1=1,mp.exports=ZE()),mp.exports}var c=JE(),pp={exports:{}},bn={};var a1;function eC(){if(a1)return bn;a1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),C=Symbol.iterator;function N(L){return L===null||typeof L!="object"?null:(L=C&&L[C]||L["@@iterator"],typeof L=="function"?L:null)}var O={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function H(L,xe,Te){this.props=L,this.context=xe,this.refs=B,this.updater=Te||O}H.prototype.isReactComponent={},H.prototype.setState=function(L,xe){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,xe,"setState")},H.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function Y(){}Y.prototype=H.prototype;function U(L,xe,Te){this.props=L,this.context=xe,this.refs=B,this.updater=Te||O}var re=U.prototype=new Y;re.constructor=U,E(re,H.prototype),re.isPureReactComponent=!0;var W=Array.isArray;function X(){}var R={H:null,A:null,T:null,S:null},le=Object.prototype.hasOwnProperty;function k(L,xe,Te){var ye=Te.ref;return{$$typeof:n,type:L,key:xe,ref:ye!==void 0?ye:null,props:Te}}function j(L,xe){return k(L.type,xe,L.props)}function Z(L){return typeof L=="object"&&L!==null&&L.$$typeof===n}function V(L){var xe={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(Te){return xe[Te]})}var ne=/\/+/g;function me(L,xe){return typeof L=="object"&&L!==null&&L.key!=null?V(""+L.key):xe.toString(36)}function ue(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(X,X):(L.status="pending",L.then(function(xe){L.status==="pending"&&(L.status="fulfilled",L.value=xe)},function(xe){L.status==="pending"&&(L.status="rejected",L.reason=xe)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function q(L,xe,Te,ye,be){var mt=typeof L;(mt==="undefined"||mt==="boolean")&&(L=null);var Ke=!1;if(L===null)Ke=!0;else switch(mt){case"bigint":case"string":case"number":Ke=!0;break;case"object":switch(L.$$typeof){case n:case e:Ke=!0;break;case _:return Ke=L._init,q(Ke(L._payload),xe,Te,ye,be)}}if(Ke)return be=be(L),Ke=ye===""?"."+me(L,0):ye,W(be)?(Te="",Ke!=null&&(Te=Ke.replace(ne,"$&/")+"/"),q(be,xe,Te,"",function(ct){return ct})):be!=null&&(Z(be)&&(be=j(be,Te+(be.key==null||L&&L.key===be.key?"":(""+be.key).replace(ne,"$&/")+"/")+Ke)),xe.push(be)),1;Ke=0;var we=ye===""?".":ye+":";if(W(L))for(var Re=0;Re>>1,ge=q[te];if(0>>1;tea(Te,Q))yea(be,Te)?(q[te]=be,q[ye]=Q,te=ye):(q[te]=Te,q[xe]=Q,te=xe);else if(yea(be,Q))q[te]=be,q[ye]=Q,te=ye;else break e}}return P}function a(q,P){var Q=q.sortIndex-P.sortIndex;return Q!==0?Q:q.id-P.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var f=[],g=[],_=1,S=null,C=3,N=!1,O=!1,E=!1,B=!1,H=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function re(q){for(var P=t(g);P!==null;){if(P.callback===null)i(g);else if(P.startTime<=q)i(g),P.sortIndex=P.expirationTime,e(f,P);else break;P=t(g)}}function W(q){if(E=!1,re(q),!O)if(t(f)!==null)O=!0,X||(X=!0,V());else{var P=t(g);P!==null&&ue(W,P.startTime-q)}}var X=!1,R=-1,le=5,k=-1;function j(){return B?!0:!(n.unstable_now()-kq&&j());){var te=S.callback;if(typeof te=="function"){S.callback=null,C=S.priorityLevel;var ge=te(S.expirationTime<=q);if(q=n.unstable_now(),typeof ge=="function"){S.callback=ge,re(q),P=!0;break t}S===t(f)&&i(f),re(q)}else i(f);S=t(f)}if(S!==null)P=!0;else{var L=t(g);L!==null&&ue(W,L.startTime-q),P=!1}}break e}finally{S=null,C=Q,N=!1}P=void 0}}finally{P?V():X=!1}}}var V;if(typeof U=="function")V=function(){U(Z)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,me=ne.port2;ne.port1.onmessage=Z,V=function(){me.postMessage(null)}}else V=function(){H(Z,0)};function ue(q,P){R=H(function(){q(n.unstable_now())},P)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(q){q.callback=null},n.unstable_forceFrameRate=function(q){0>q||125te?(q.sortIndex=Q,e(g,q),t(f)===null&&q===t(g)&&(E?(Y(R),R=-1):E=!0,ue(W,Q-te))):(q.sortIndex=ge,e(f,q),O||N||(O=!0,X||(X=!0,V()))),q},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(q){var P=C;return function(){var Q=C;C=P;try{return q.apply(this,arguments)}finally{C=Q}}}})(bp)),bp}var c1;function nC(){return c1||(c1=1,yp.exports=tC()),yp.exports}var vp={exports:{}},vr={};var d1;function iC(){if(d1)return vr;d1=1;var n=Kf();function e(f){var g="https://react.dev/errors/"+f;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),vp.exports=iC(),vp.exports}var f1;function rC(){if(f1)return Oc;f1=1;var n=nC(),e=Kf(),t=J_();function i(r){var s="https://react.dev/errors/"+r;if(1ge||(r.current=te[ge],te[ge]=null,ge--)}function Te(r,s){ge++,te[ge]=r.current,r.current=s}var ye=L(null),be=L(null),mt=L(null),Ke=L(null);function we(r,s){switch(Te(mt,s),Te(be,r),Te(ye,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Cx(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Cx(s),r=Ax(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}xe(ye),Te(ye,r)}function Re(){xe(ye),xe(be),xe(mt)}function ct(r){r.memoizedState!==null&&Te(Ke,r);var s=ye.current,o=Ax(s,r.type);s!==o&&(Te(be,r),Te(ye,o))}function Oe(r){be.current===r&&(xe(ye),xe(be)),Ke.current===r&&(xe(Ke),Nc._currentValue=Q)}var je,Ue;function ze(r){if(je===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);je=s&&s[1]||"",Ue=-1)":-1y||ve[d]!==qe[y]){var ot=` `+ve[d].replace(" at new "," at ");return r.displayName&&ot.includes("")&&(ot=ot.replace("",r.displayName)),ot}while(1<=d&&0<=y);break}}}finally{gt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?ze(o):""}function bt(r,s){switch(r.tag){case 26:case 27:case 5:return ze(r.type);case 16:return ze("Lazy");case 13:return r.child!==s&&s!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return st(r.type,!1);case 11:return st(r.type.render,!1);case 1:return st(r.type,!0);case 31:return ze("Activity");default:return""}}function Qe(r){try{var s="",o=null;do s+=bt(r,o),o=r,r=r.return;while(r);return s}catch(d){return` Error generating stack: `+d.message+` `+d.stack}}var Ye=Object.prototype.hasOwnProperty,tt=n.unstable_scheduleCallback,$e=n.unstable_cancelCallback,ht=n.unstable_shouldYield,At=n.unstable_requestPaint,he=n.unstable_now,Ie=n.unstable_getCurrentPriorityLevel,Le=n.unstable_ImmediatePriority,ke=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,et=n.unstable_LowPriority,kt=n.unstable_IdlePriority,Lt=n.log,pt=n.unstable_setDisableYieldValue,Zt=null,qt=null;function Gt(r){if(typeof Lt=="function"&&pt(r),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Zt,r)}catch{}}var wt=Math.clz32?Math.clz32:kn,lt=Math.log,Yt=Math.LN2;function kn(r){return r>>>=0,r===0?32:31-(lt(r)/Yt|0)|0}var pn=256,xn=262144,rt=4194304;function M(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function F(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var y=0,b=r.suspendedLanes,D=r.pingedLanes;r=r.warmLanes;var $=d&134217727;return $!==0?(d=$&~b,d!==0?y=M(d):(D&=$,D!==0?y=M(D):o||(o=$&~r,o!==0&&(y=M(o))))):($=d&~b,$!==0?y=M($):D!==0?y=M(D):o||(o=d&~r,o!==0&&(y=M(o)))),y===0?0:s!==0&&s!==y&&(s&b)===0&&(b=y&-y,o=s&-s,b>=o||b===32&&(o&4194048)!==0)?s:y}function ie(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function De(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ve(){var r=rt;return rt<<=1,(rt&62914560)===0&&(rt=4194304),r}function yt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function Vt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Jt(r,s,o,d,y,b){var D=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var $=r.entanglements,ve=r.expirationTimes,qe=r.hiddenUpdates;for(o=D&~o;0"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var yn=/[\n"\\]/g;function Xt(r){return r.replace(yn,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function On(r,s,o,d,y,b,D,$){r.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?r.type=D:r.removeAttribute("type"),s!=null?D==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+fn(s)):r.value!==""+fn(s)&&(r.value=""+fn(s)):D!=="submit"&&D!=="reset"||r.removeAttribute("value"),s!=null?mi(r,D,fn(s)):o!=null?mi(r,D,fn(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?r.name=""+fn($):r.removeAttribute("name")}function Vn(r,s,o,d,y,b,D,$){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(r.type=b),s!=null||o!=null){if(!(b!=="submit"&&b!=="reset"||s!=null)){_t(r);return}o=o!=null?""+fn(o):"",s=s!=null?""+fn(s):o,$||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=$?r.checked:!!d,r.defaultChecked=!!d,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(r.name=D),_t(r)}function mi(r,s,o){s==="number"&&Ht(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function $n(r,s,o,d){if(r=r.options,s){s={};for(var y=0;y"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),G=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){G=!0}}),window.addEventListener("test",ee,ee),window.removeEventListener("test",ee,ee)}catch{G=!1}var ae=null,Be=null,Je=null;function We(){if(Je)return Je;var r,s=Be,o=s.length,d,y="value"in ae?ae.value:ae.textContent,b=y.length;for(r=0;r=Oo),Id=" ",Fu=!1;function Sl(r,s){switch(r){case"keyup":return j0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bd(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ia=!1;function R0(r,s){switch(r){case"compositionend":return Bd(s);case"keypress":return s.which!==32?null:(Fu=!0,Id);case"textInput":return r=s.data,r===Id&&Fu?null:r;default:return null}}function Uu(r,s){if(Ia)return r==="compositionend"||!La&&Sl(r,s)?(r=We(),Je=Be=ae=null,Ia=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:o,offset:s-r};r=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Pa(o)}}function sa(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?sa(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function kl(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Ht(r.document);s instanceof r.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)r=s.contentWindow;else break;s=Ht(r.document)}return s}function Gu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var F0=z&&"documentMode"in document&&11>=document.documentMode,Fa=null,Ku=null,Ua=null,El=!1;function Wu(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;El||Fa==null||Fa!==Ht(d)||(d=Fa,"selectionStart"in d&&Gu(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Ua&&Os(Ua,d)||(Ua=d,d=Dh(Ku,"onSelect"),0>=D,y-=D,Xr=1<<32-wt(s)+y|o<Sn?(Un=Kt,Kt=null):Un=Kt.sibling;var Zn=Ge(Me,Kt,He[Sn],dt);if(Zn===null){Kt===null&&(Kt=Un);break}r&&Kt&&Zn.alternate===null&&s(Me,Kt),Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn,Kt=Un}if(Sn===He.length)return o(Me,Kt),Ln&&Nn(Me,Sn),nn;if(Kt===null){for(;SnSn?(Un=Kt,Kt=null):Un=Kt.sibling;var ho=Ge(Me,Kt,Zn.value,dt);if(ho===null){Kt===null&&(Kt=Un);break}r&&Kt&&ho.alternate===null&&s(Me,Kt),Se=b(ho,Se,Sn),Qn===null?nn=ho:Qn.sibling=ho,Qn=ho,Kt=Un}if(Zn.done)return o(Me,Kt),Ln&&Nn(Me,Sn),nn;if(Kt===null){for(;!Zn.done;Sn++,Zn=He.next())Zn=ft(Me,Zn.value,dt),Zn!==null&&(Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn);return Ln&&Nn(Me,Sn),nn}for(Kt=d(Kt);!Zn.done;Sn++,Zn=He.next())Zn=Ze(Kt,Me,Sn,Zn.value,dt),Zn!==null&&(r&&Zn.alternate!==null&&Kt.delete(Zn.key===null?Sn:Zn.key),Se=b(Zn,Se,Sn),Qn===null?nn=Zn:Qn.sibling=Zn,Qn=Zn);return r&&Kt.forEach(function(XE){return s(Me,XE)}),Ln&&Nn(Me,Sn),nn}function di(Me,Se,He,dt){if(typeof He=="object"&&He!==null&&He.type===E&&He.key===null&&(He=He.props.children),typeof He=="object"&&He!==null){switch(He.$$typeof){case N:e:{for(var nn=He.key;Se!==null;){if(Se.key===nn){if(nn=He.type,nn===E){if(Se.tag===7){o(Me,Se.sibling),dt=y(Se,He.props.children),dt.return=Me,Me=dt;break e}}else if(Se.elementType===nn||typeof nn=="object"&&nn!==null&&nn.$$typeof===le&&Vo(nn)===Se.type){o(Me,Se.sibling),dt=y(Se,He.props),ac(dt,He),dt.return=Me,Me=dt;break e}o(Me,Se);break}else s(Me,Se);Se=Se.sibling}He.type===E?(dt=Is(He.props.children,Me.mode,dt,He.key),dt.return=Me,Me=dt):(dt=tc(He.type,He.key,He.props,null,Me.mode,dt),ac(dt,He),dt.return=Me,Me=dt)}return D(Me);case O:e:{for(nn=He.key;Se!==null;){if(Se.key===nn)if(Se.tag===4&&Se.stateNode.containerInfo===He.containerInfo&&Se.stateNode.implementation===He.implementation){o(Me,Se.sibling),dt=y(Se,He.children||[]),dt.return=Me,Me=dt;break e}else{o(Me,Se);break}else s(Me,Se);Se=Se.sibling}dt=Va(He,Me.mode,dt),dt.return=Me,Me=dt}return D(Me);case le:return He=Vo(He),di(Me,Se,He,dt)}if(ue(He))return Ft(Me,Se,He,dt);if(V(He)){if(nn=V(He),typeof nn!="function")throw Error(i(150));return He=nn.call(He),un(Me,Se,He,dt)}if(typeof He.then=="function")return di(Me,Se,eh(He),dt);if(He.$$typeof===U)return di(Me,Se,mn(Me,He),dt);th(Me,He)}return typeof He=="string"&&He!==""||typeof He=="number"||typeof He=="bigint"?(He=""+He,Se!==null&&Se.tag===6?(o(Me,Se.sibling),dt=y(Se,He),dt.return=Me,Me=dt):(o(Me,Se),dt=Uo(He,Me.mode,dt),dt.return=Me,Me=dt),D(Me)):o(Me,Se)}return function(Me,Se,He,dt){try{sc=0;var nn=di(Me,Se,He,dt);return jl=null,nn}catch(Kt){if(Kt===Ml||Kt===Zd)throw Kt;var Qn=Ui(29,Kt,null,Me.mode);return Qn.lanes=dt,Qn.return=Me,Qn}}}var Ko=bb(!0),vb=bb(!1),Wa=!1;function q0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function V0(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Xa(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ya(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ni&2)!==0){var y=d.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),d.pending=s,s=Nl(r),Kd(r,null,o),s}return Al(r,d,s,o),Nl(r)}function oc(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ln(r,o)}}function G0(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var y=null,b=null;if(o=o.firstBaseUpdate,o!==null){do{var D={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?y=b=D:b=b.next=D,o=o.next}while(o!==null);b===null?y=b=s:b=b.next=s}else y=b=s;o={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var K0=!1;function lc(){if(K0){var r=sr;if(r!==null)throw r}}function uc(r,s,o,d){K0=!1;var y=r.updateQueue;Wa=!1;var b=y.firstBaseUpdate,D=y.lastBaseUpdate,$=y.shared.pending;if($!==null){y.shared.pending=null;var ve=$,qe=ve.next;ve.next=null,D===null?b=qe:D.next=qe,D=ve;var ot=r.alternate;ot!==null&&(ot=ot.updateQueue,$=ot.lastBaseUpdate,$!==D&&($===null?ot.firstBaseUpdate=qe:$.next=qe,ot.lastBaseUpdate=ve))}if(b!==null){var ft=y.baseState;D=0,ot=qe=ve=null,$=b;do{var Ge=$.lane&-536870913,Ze=Ge!==$.lane;if(Ze?(Fn&Ge)===Ge:(d&Ge)===Ge){Ge!==0&&Ge===ls&&(K0=!0),ot!==null&&(ot=ot.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Ft=r,un=$;Ge=s;var di=o;switch(un.tag){case 1:if(Ft=un.payload,typeof Ft=="function"){ft=Ft.call(di,ft,Ge);break e}ft=Ft;break e;case 3:Ft.flags=Ft.flags&-65537|128;case 0:if(Ft=un.payload,Ge=typeof Ft=="function"?Ft.call(di,ft,Ge):Ft,Ge==null)break e;ft=S({},ft,Ge);break e;case 2:Wa=!0}}Ge=$.callback,Ge!==null&&(r.flags|=64,Ze&&(r.flags|=8192),Ze=y.callbacks,Ze===null?y.callbacks=[Ge]:Ze.push(Ge))}else Ze={lane:Ge,tag:$.tag,payload:$.payload,callback:$.callback,next:null},ot===null?(qe=ot=Ze,ve=ft):ot=ot.next=Ze,D|=Ge;if($=$.next,$===null){if($=y.shared.pending,$===null)break;Ze=$,$=Ze.next,Ze.next=null,y.lastBaseUpdate=Ze,y.shared.pending=null}}while(!0);ot===null&&(ve=ft),y.baseState=ve,y.firstBaseUpdate=qe,y.lastBaseUpdate=ot,b===null&&(y.shared.lanes=0),to|=D,r.lanes=D,r.memoizedState=ft}}function xb(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function _b(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;rb?b:8;var D=q.T,$={};q.T=$,hm(r,!1,s,o);try{var ve=y(),qe=q.S;if(qe!==null&&qe($,ve),ve!==null&&typeof ve=="object"&&typeof ve.then=="function"){var ot=Pk(ve,d);hc(r,s,ot,es(r))}else hc(r,s,d,es(r))}catch(ft){hc(r,s,{then:function(){},status:"rejected",reason:ft},es())}finally{P.p=b,D!==null&&$.types!==null&&(D.types=$.types),q.T=D}}function qk(){}function cm(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Jb(r).queue;Zb(r,y,s,Q,o===null?qk:function(){return ev(r),o(d)})}function Jb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:Q},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ca,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function ev(r){var s=Jb(r);s.next===null&&(s=r.alternate.memoizedState),hc(r,s.next.queue,{},es())}function dm(){return It(Nc)}function tv(){return Ki().memoizedState}function nv(){return Ki().memoizedState}function Vk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=es();r=Xa(o);var d=Ya(s,r,o);d!==null&&(Pr(d,s,o),oc(d,s,o)),s={cache:la()},r.payload=s;return}s=s.return}}function Gk(r,s,o){var d=es();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},dh(r)?rv(s,o):(o=Ju(r,s,o,d),o!==null&&(Pr(o,r,d),sv(o,s,d)))}function iv(r,s,o){var d=es();hc(r,s,o,d)}function hc(r,s,o,d){var y={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(dh(r))rv(s,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=s.lastRenderedReducer,b!==null))try{var D=s.lastRenderedState,$=b(D,o);if(y.hasEagerState=!0,y.eagerState=$,yr($,D))return Al(r,s,y,0),bi===null&&Cl(),!1}catch{}if(o=Ju(r,s,y,d),o!==null)return Pr(o,r,d),sv(o,s,d),!0}return!1}function hm(r,s,o,d){if(d={lane:2,revertLane:qm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},dh(r)){if(s)throw Error(i(479))}else s=Ju(r,o,d,2),s!==null&&Pr(s,r,2)}function dh(r){var s=r.alternate;return r===Tn||s!==null&&s===Tn}function rv(r,s){Ol=rh=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function sv(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,ln(r,o)}}var fc={readContext:It,use:oh,useCallback:zi,useContext:zi,useEffect:zi,useImperativeHandle:zi,useLayoutEffect:zi,useInsertionEffect:zi,useMemo:zi,useReducer:zi,useRef:zi,useState:zi,useDebugValue:zi,useDeferredValue:zi,useTransition:zi,useSyncExternalStore:zi,useId:zi,useHostTransitionStatus:zi,useFormState:zi,useActionState:zi,useOptimistic:zi,useMemoCache:zi,useCacheRefresh:zi};fc.useEffectEvent=zi;var av={readContext:It,use:oh,useCallback:function(r,s){return Sr().memoizedState=[r,s===void 0?null:s],r},useContext:It,useEffect:Hb,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,uh(4194308,4,Kb.bind(null,s,r),o)},useLayoutEffect:function(r,s){return uh(4194308,4,r,s)},useInsertionEffect:function(r,s){uh(4,2,r,s)},useMemo:function(r,s){var o=Sr();s=s===void 0?null:s;var d=r();if(Wo){Gt(!0);try{r()}finally{Gt(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Sr();if(o!==void 0){var y=o(s);if(Wo){Gt(!0);try{o(s)}finally{Gt(!1)}}}else y=s;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=Gk.bind(null,Tn,r),[d.memoizedState,r]},useRef:function(r){var s=Sr();return r={current:r},s.memoizedState=r},useState:function(r){r=sm(r);var s=r.queue,o=iv.bind(null,Tn,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:lm,useDeferredValue:function(r,s){var o=Sr();return um(o,r,s)},useTransition:function(){var r=sm(!1);return r=Zb.bind(null,Tn,r.queue,!0,!1),Sr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=Tn,y=Sr();if(Ln){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),bi===null)throw Error(i(349));(Fn&127)!==0||Cb(d,s,o)}y.memoizedState=o;var b={value:o,getSnapshot:s};return y.queue=b,Hb(Nb.bind(null,d,b,r),[r]),d.flags|=2048,Il(9,{destroy:void 0},Ab.bind(null,d,b,o,s),null),o},useId:function(){var r=Sr(),s=bi.identifierPrefix;if(Ln){var o=hr,d=Xr;o=(d&~(1<<32-wt(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=sh++,0<\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?D.createElement("select",{is:d.is}):D.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?D.createElement(y,{is:d.is}):D.createElement(y)}}b[zt]=s,b[Dt]=d;e:for(D=s.child;D!==null;){if(D.tag===5||D.tag===6)b.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===s)break e;for(;D.sibling===null;){if(D.return===null||D.return===s)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}s.stateNode=b;e:switch(mr(b,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ha(s)}}return ki(s),Em(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ha(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=mt.current,m(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=Yi,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[zt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||kx(r.nodeValue,o)),r||Us(s,!0)}else r=Mh(r).createTextNode(d),r[zt]=s,s.stateNode=r}return ki(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=m(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[zt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),r=!1}else o=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(Qr(s),s):(Qr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return ki(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=m(s),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(i(318));if(y=s.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));y[zt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),y=!1}else y=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(Qr(s),s):(Qr(s),null)}return Qr(s),(s.flags&128)!==0?(s.lanes=o,s):(o=d!==null,r=r!==null&&r.memoizedState!==null,o&&(d=s.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),b=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),b!==y&&(d.flags|=2048)),o!==r&&o&&(s.child.flags|=8192),gh(s,s.updateQueue),ki(s),null);case 4:return Re(),r===null&&Wm(s.stateNode.containerInfo),ki(s),null;case 10:return oe(s.type),ki(s),null;case 19:if(xe(Gi),d=s.memoizedState,d===null)return ki(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)pc(d,!1);else{if($i!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=ih(r),b!==null){for(s.flags|=128,pc(d,!1),r=b.updateQueue,s.updateQueue=r,gh(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Wd(o,r),o=o.sibling;return Te(Gi,Gi.current&1|2),Ln&&Nn(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&he()>_h&&(s.flags|=128,y=!0,pc(d,!1),s.lanes=4194304)}else{if(!y)if(r=ih(b),r!==null){if(s.flags|=128,y=!0,r=r.updateQueue,s.updateQueue=r,gh(s,r),pc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!Ln)return ki(s),null}else 2*he()-d.renderingStartTime>_h&&o!==536870912&&(s.flags|=128,y=!0,pc(d,!1),s.lanes=4194304);d.isBackwards?(b.sibling=s.child,s.child=b):(r=d.last,r!==null?r.sibling=b:s.child=b,d.last=b)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=he(),r.sibling=null,o=Gi.current,Te(Gi,y?o&1|2:o&1),Ln&&Nn(s,d.treeForkCount),r):(ki(s),null);case 22:case 23:return Qr(s),X0(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(ki(s),s.subtreeFlags&6&&(s.flags|=8192)):ki(s),o=s.updateQueue,o!==null&&gh(s,o.retryQueue),o=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==o&&(s.flags|=2048),r!==null&&xe(qo),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oe(Ti),ki(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Qk(r,s){switch(jr(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return oe(Ti),Re(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Oe(s),null;case 31:if(s.memoizedState!==null){if(Qr(s),s.alternate===null)throw Error(i(340));v()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(Qr(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));v()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return xe(Gi),null;case 4:return Re(),null;case 10:return oe(s.type),null;case 22:case 23:return Qr(s),X0(),r!==null&&xe(qo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(Ti),null;case 25:return null;default:return null}}function Dv(r,s){switch(jr(s),s.tag){case 3:oe(Ti),Re();break;case 26:case 27:case 5:Oe(s);break;case 4:Re();break;case 31:s.memoizedState!==null&&Qr(s);break;case 13:Qr(s);break;case 19:xe(Gi);break;case 10:oe(s.type);break;case 22:case 23:Qr(s),X0(),r!==null&&xe(qo);break;case 24:oe(Ti)}}function gc(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var y=d.next;o=y;do{if((o.tag&r)===r){d=void 0;var b=o.create,D=o.inst;d=b(),D.destroy=d}o=o.next}while(o!==y)}}catch($){oi(s,s.return,$)}}function Ja(r,s,o){try{var d=s.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var b=y.next;d=b;do{if((d.tag&r)===r){var D=d.inst,$=D.destroy;if($!==void 0){D.destroy=void 0,y=s;var ve=o,qe=$;try{qe()}catch(ot){oi(y,ve,ot)}}}d=d.next}while(d!==b)}}catch(ot){oi(s,s.return,ot)}}function Mv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{_b(s,o)}catch(d){oi(r,r.return,d)}}}function jv(r,s,o){o.props=Xo(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){oi(r,s,d)}}function yc(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(y){oi(r,s,y)}}function Hs(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(y){oi(r,s,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(y){oi(r,s,y)}else o.current=null}function Rv(r){var s=r.type,o=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(y){oi(r,r.return,y)}}function Cm(r,s,o){try{var d=r.stateNode;vE(d,r.type,o,s),d[Dt]=s}catch(y){oi(r,r.return,y)}}function Ov(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ao(r.type)||r.tag===4}function Am(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ov(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ao(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Nm(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(r,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(r),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=ii));else if(d!==4&&(d===27&&ao(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Nm(r,s,o),r=r.sibling;r!==null;)Nm(r,s,o),r=r.sibling}function yh(r,s,o){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?o.insertBefore(r,s):o.appendChild(r);else if(d!==4&&(d===27&&ao(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(yh(r,s,o),r=r.sibling;r!==null;)yh(r,s,o),r=r.sibling}function Lv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);mr(s,d,o),s[zt]=r,s[Dt]=o}catch(b){oi(r,r.return,b)}}var fa=!1,Ji=!1,Dm=!1,Iv=typeof WeakSet=="function"?WeakSet:Set,ar=null;function Zk(r,s){if(r=r.containerInfo,Qm=Ph,r=kl(r),Gu(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var y=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var D=0,$=-1,ve=-1,qe=0,ot=0,ft=r,Ge=null;t:for(;;){for(var Ze;ft!==o||y!==0&&ft.nodeType!==3||($=D+y),ft!==b||d!==0&&ft.nodeType!==3||(ve=D+d),ft.nodeType===3&&(D+=ft.nodeValue.length),(Ze=ft.firstChild)!==null;)Ge=ft,ft=Ze;for(;;){if(ft===r)break t;if(Ge===o&&++qe===y&&($=D),Ge===b&&++ot===d&&(ve=D),(Ze=ft.nextSibling)!==null)break;ft=Ge,Ge=ft.parentNode}ft=Ze}o=$===-1||ve===-1?null:{start:$,end:ve}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zm={focusedElem:r,selectionRange:o},Ph=!1,ar=s;ar!==null;)if(s=ar,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ar=r;else for(;ar!==null;){switch(s=ar,b=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o title"))),mr(b,d,o),b[zt]=r,Cn(b),d=b;break e;case"link":var D=$x("link","href",y).get(d+(o.href||""));if(D){for(var $=0;$di&&(D=di,di=un,un=D);var Me=Ci($,un),Se=Ci($,di);if(Me&&Se&&(Ze.rangeCount!==1||Ze.anchorNode!==Me.node||Ze.anchorOffset!==Me.offset||Ze.focusNode!==Se.node||Ze.focusOffset!==Se.offset)){var He=ft.createRange();He.setStart(Me.node,Me.offset),Ze.removeAllRanges(),un>di?(Ze.addRange(He),Ze.extend(Se.node,Se.offset)):(He.setEnd(Se.node,Se.offset),Ze.addRange(He))}}}}for(ft=[],Ze=$;Ze=Ze.parentNode;)Ze.nodeType===1&&ft.push({element:Ze,left:Ze.scrollLeft,top:Ze.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$o?32:o,q.T=null,o=Bm,Bm=null;var b=io,D=ba;if(nr=0,zl=io=null,ba=0,(ni&6)!==0)throw Error(i(331));var $=ni;if(ni|=4,Kv(b.current),qv(b,b.current,D,o),ni=$,Tc(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Zt,b)}catch{}return!0}finally{P.p=y,q.T=d,dx(r,s)}}function fx(r,s,o){s=Dr(o,s),s=gm(r.stateNode,s,2),r=Ya(r,s,2),r!==null&&(Vt(r,2),qs(r))}function oi(r,s,o){if(r.tag===3)fx(r,r,o);else for(;s!==null;){if(s.tag===3){fx(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(no===null||!no.has(d))){r=Dr(o,r),o=mv(2),d=Ya(s,o,2),d!==null&&(pv(o,d,s,r),Vt(d,2),qs(d));break}}s=s.return}}function zm(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new tE;var y=new Set;d.set(s,y)}else y=d.get(s),y===void 0&&(y=new Set,d.set(s,y));y.has(o)||(Rm=!0,y.add(o),r=aE.bind(null,r,s,o),s.then(r,r))}function aE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,bi===r&&(Fn&o)===o&&($i===4||$i===3&&(Fn&62914560)===Fn&&300>he()-xh?(ni&2)===0&&$l(r,0):Om|=o,Ul===Fn&&(Ul=0)),qs(r)}function mx(r,s){s===0&&(s=Ve()),r=oa(r,s),r!==null&&(Vt(r,s),qs(r))}function oE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),mx(r,o)}function lE(r,s){var o=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(o=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(s),mx(r,o)}function uE(r,s){return tt(r,s)}var Ch=null,ql=null,$m=!1,Ah=!1,Hm=!1,so=0;function qs(r){r!==ql&&r.next===null&&(ql===null?Ch=ql=r:ql=ql.next=r),Ah=!0,$m||($m=!0,dE())}function Tc(r,s){if(!Hm&&Ah){Hm=!0;do for(var o=!1,d=Ch;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var b=0;else{var D=d.suspendedLanes,$=d.pingedLanes;b=(1<<31-wt(42|r)+1)-1,b&=y&~(D&~$),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,bx(d,b))}else b=Fn,b=F(d,d===bi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ie(d,b)||(o=!0,bx(d,b));d=d.next}while(o);Hm=!1}}function cE(){px()}function px(){Ah=$m=!1;var r=0;so!==0&&_E()&&(r=so);for(var s=he(),o=null,d=Ch;d!==null;){var y=d.next,b=gx(d,s);b===0?(d.next=null,o===null?Ch=y:o.next=y,y===null&&(ql=o)):(o=d,(r!==0||(b&3)!==0)&&(Ah=!0)),d=y}nr!==0&&nr!==5||Tc(r),so!==0&&(so=0)}function gx(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0$)break;var ot=ve.transferSize,ft=ve.initiatorType;ot&&Ex(ft)&&(ve=ve.responseEnd,D+=ot*(ve<$?1:($-qe)/(ve-qe)))}if(--d,s+=8*(b+D)/(y.duration/1e3),r++,10"u"?null:document;function Px(r,s,o){var d=Vl;if(d&&typeof s=="string"&&s){var y=Xt(s);y='link[rel="'+r+'"][href="'+y+'"]',typeof o=="string"&&(y+='[crossorigin="'+o+'"]'),Bx.has(y)||(Bx.add(y),r={rel:r,crossOrigin:o,href:s},d.querySelector(y)===null&&(s=d.createElement("link"),mr(s,"link",r),Cn(s),d.head.appendChild(s)))}}function DE(r){va.D(r),Px("dns-prefetch",r,null)}function ME(r,s){va.C(r,s),Px("preconnect",r,s)}function jE(r,s,o){va.L(r,s,o);var d=Vl;if(d&&r&&s){var y='link[rel="preload"][as="'+Xt(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+Xt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+Xt(o.imageSizes)+'"]')):y+='[href="'+Xt(r)+'"]';var b=y;switch(s){case"style":b=Gl(r);break;case"script":b=Kl(r)}ds.has(b)||(r=S({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),ds.set(b,r),d.querySelector(y)!==null||s==="style"&&d.querySelector(Cc(b))||s==="script"&&d.querySelector(Ac(b))||(s=d.createElement("link"),mr(s,"link",r),Cn(s),d.head.appendChild(s)))}}function RE(r,s){va.m(r,s);var o=Vl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+Xt(d)+'"][href="'+Xt(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Kl(r)}if(!ds.has(b)&&(r=S({rel:"modulepreload",href:r},s),ds.set(b,r),o.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ac(b)))return}d=o.createElement("link"),mr(d,"link",r),Cn(d),o.head.appendChild(d)}}}function OE(r,s,o){va.S(r,s,o);var d=Vl;if(d&&r){var y=Wn(d).hoistableStyles,b=Gl(r);s=s||"default";var D=y.get(b);if(!D){var $={loading:0,preload:null};if(D=d.querySelector(Cc(b)))$.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ds.get(b))&&sp(r,o);var ve=D=d.createElement("link");Cn(ve),mr(ve,"link",r),ve._p=new Promise(function(qe,ot){ve.onload=qe,ve.onerror=ot}),ve.addEventListener("load",function(){$.loading|=1}),ve.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Rh(D,s,d)}D={type:"stylesheet",instance:D,count:1,state:$},y.set(b,D)}}}function LE(r,s){va.X(r,s);var o=Vl;if(o&&r){var d=Wn(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0},s),(s=ds.get(y))&&ap(r,s),b=o.createElement("script"),Cn(b),mr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function IE(r,s){va.M(r,s);var o=Vl;if(o&&r){var d=Wn(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0,type:"module"},s),(s=ds.get(y))&&ap(r,s),b=o.createElement("script"),Cn(b),mr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function Fx(r,s,o,d){var y=(y=mt.current)?jh(y):null;if(!y)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Gl(o.href),o=Wn(y).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=Gl(o.href);var b=Wn(y).hoistableStyles,D=b.get(r);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,D),(b=y.querySelector(Cc(r)))&&!b._p&&(D.instance=b,D.state.loading=5),ds.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ds.set(r,o),b||BE(y,r,o,D.state))),s&&d===null)throw Error(i(528,""));return D}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Kl(o),o=Wn(y).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Gl(r){return'href="'+Xt(r)+'"'}function Cc(r){return'link[rel="stylesheet"]['+r+"]"}function Ux(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function BE(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),mr(s,"link",o),Cn(s),r.head.appendChild(s))}function Kl(r){return'[src="'+Xt(r)+'"]'}function Ac(r){return"script[async]"+r}function zx(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Xt(o.href)+'"]');if(d)return s.instance=d,Cn(d),d;var y=S({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Cn(d),mr(d,"style",y),Rh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Gl(o.href);var b=r.querySelector(Cc(y));if(b)return s.state.loading|=4,s.instance=b,Cn(b),b;d=Ux(o),(y=ds.get(y))&&sp(d,y),b=(r.ownerDocument||r).createElement("link"),Cn(b);var D=b;return D._p=new Promise(function($,ve){D.onload=$,D.onerror=ve}),mr(b,"link",d),s.state.loading|=4,Rh(b,o.precedence,r),s.instance=b;case"script":return b=Kl(o.src),(y=r.querySelector(Ac(b)))?(s.instance=y,Cn(y),y):(d=o,(y=ds.get(b))&&(d=S({},o),ap(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),Cn(y),mr(y,"link",d),r.head.appendChild(y),s.instance=y);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Rh(d,o.precedence,r));return s.instance}function Rh(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,b=y,D=0;D title"):null)}function PE(r,s,o){if(o===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(r=s.disabled,typeof s.precedence=="string"&&r==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function qx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function FE(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var y=Gl(d.href),b=s.querySelector(Cc(y));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Lh.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=b,Cn(b);return}b=s.ownerDocument||s,d=Ux(d),(y=ds.get(y))&&sp(d,y),b=b.createElement("link"),Cn(b);var D=b;D._p=new Promise(function($,ve){D.onload=$,D.onerror=ve}),mr(b,"link",d),o.instance=b}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Lh.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var op=0;function UE(r,s){return r.stylesheets&&r.count===0&&Bh(r,r.stylesheets),0op?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Lh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bh(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Ih=null;function Bh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Ih=new Map,s.forEach(zE,r),Ih=null,Lh.call(r))}function zE(r,s){if(!(s.state.loading&4)){var o=Ih.get(r);if(o)var d=o.get(null);else{o=new Map,Ih.set(r,o);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),gp.exports=rC(),gp.exports}var ew=sC();function aC(...n){return n.filter(Boolean).join(" ")}const oC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",lC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},uC={xs:"px-2 py-1 text-xs",sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-3.5 py-2.5 text-sm"},cC={indigo:{primary:"!bg-indigo-600 !text-white shadow-sm hover:!bg-indigo-700 focus-visible:outline-indigo-600 dark:!bg-indigo-500 dark:hover:!bg-indigo-400 dark:focus-visible:outline-indigo-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-indigo-50 text-indigo-600 shadow-xs hover:bg-indigo-100 dark:bg-indigo-500/20 dark:text-indigo-400 dark:shadow-none dark:hover:bg-indigo-500/30"},blue:{primary:"!bg-blue-600 !text-white shadow-sm hover:!bg-blue-700 focus-visible:outline-blue-600 dark:!bg-blue-500 dark:hover:!bg-blue-400 dark:focus-visible:outline-blue-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-blue-50 text-blue-600 shadow-xs hover:bg-blue-100 dark:bg-blue-500/20 dark:text-blue-400 dark:shadow-none dark:hover:bg-blue-500/30"},emerald:{primary:"!bg-emerald-600 !text-white shadow-sm hover:!bg-emerald-700 focus-visible:outline-emerald-600 dark:!bg-emerald-500 dark:hover:!bg-emerald-400 dark:focus-visible:outline-emerald-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-emerald-50 text-emerald-700 shadow-xs hover:bg-emerald-100 dark:bg-emerald-500/20 dark:text-emerald-400 dark:shadow-none dark:hover:bg-emerald-500/30"},red:{primary:"!bg-red-600 !text-white shadow-sm hover:!bg-red-700 focus-visible:outline-red-600 dark:!bg-red-500 dark:hover:!bg-red-400 dark:focus-visible:outline-red-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-red-50 text-red-700 shadow-xs hover:bg-red-100 dark:bg-red-500/20 dark:text-red-400 dark:shadow-none dark:hover:bg-red-500/30"},amber:{primary:"!bg-amber-500 !text-white shadow-sm hover:!bg-amber-600 focus-visible:outline-amber-500 dark:!bg-amber-500 dark:hover:!bg-amber-400 dark:focus-visible:outline-amber-500",secondary:"bg-white text-gray-900 shadow-xs inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",soft:"bg-amber-50 text-amber-800 shadow-xs hover:bg-amber-100 dark:bg-amber-500/20 dark:text-amber-300 dark:shadow-none dark:hover:bg-amber-500/30"}};function dC(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4 animate-spin","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.25"}),c.jsx("path",{d:"M22 12a10 10 0 0 1-10 10",fill:"none",stroke:"currentColor",strokeWidth:"4",opacity:"0.9"})]})}function sn({children:n,variant:e="primary",color:t="indigo",size:i="md",rounded:a="md",leadingIcon:l,trailingIcon:u,isLoading:h=!1,disabled:f,className:g,type:_="button",...S}){const C=l||u||h?"gap-x-1.5":"";return c.jsxs("button",{type:_,disabled:f||h,className:aC(oC,lC[a],uC[i],cC[t][e],C,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(dC,{})}):l&&c.jsx("span",{className:"-ml-0.5",children:l}),c.jsx("span",{children:n}),u&&!h&&c.jsx("span",{className:"-mr-0.5",children:u})]})}function tw(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var a=n.length;for(e=0;ee in n?hC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xp=(n,e,t)=>(fC(n,typeof e!="symbol"?e+"":e,t),t);let mC=class{constructor(){xp(this,"current",this.detect()),xp(this,"handoffState","pending"),xp(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Js=new mC;function vd(n){var e;return Js.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function Ng(n){var e,t;return Js.isServer?null:n==null?document:(t=(e=n?.getRootNode)==null?void 0:e.call(n))!=null?t:document}function nw(n){var e,t;return(t=(e=Ng(n))==null?void 0:e.activeElement)!=null?t:null}function pC(n){return nw(n)===n}function Wf(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function Ma(){let n=[],e={addEventListener(t,i,a,l){return t.addEventListener(i,a,l),e.add(()=>t.removeEventListener(i,a,l))},requestAnimationFrame(...t){let i=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let i=setTimeout(...t);return e.add(()=>clearTimeout(i))},microTask(...t){let i={current:!0};return Wf(()=>{i.current&&t[0]()}),e.add(()=>{i.current=!1})},style(t,i,a){let l=t.style.getPropertyValue(i);return Object.assign(t.style,{[i]:a}),this.add(()=>{Object.assign(t.style,{[i]:l})})},group(t){let i=Ma();return t(i),this.add(()=>i.dispose())},add(t){return n.includes(t)||n.push(t),()=>{let i=n.indexOf(t);if(i>=0)for(let a of n.splice(i,1))a()}},dispose(){for(let t of n.splice(0))t()}};return e}function Xf(){let[n]=p.useState(Ma);return p.useEffect(()=>()=>n.dispose(),[n]),n}let qr=(n,e)=>{Js.isServer?p.useEffect(n,e):p.useLayoutEffect(n,e)};function xl(n){let e=p.useRef(n);return qr(()=>{e.current=n},[n]),e}let xi=function(n){let e=xl(n);return rn.useCallback((...t)=>e.current(...t),[e])};function xd(n){return p.useMemo(()=>n,Object.values(n))}let gC=p.createContext(void 0);function yC(){return p.useContext(gC)}function Dg(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Na(n,e,...t){if(n in e){let a=e[n];return typeof a=="function"?a(...t):a}let i=new Error(`Tried to handle "${n}" but there is no handler defined. Only defined handlers are: ${Object.keys(e).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(i,Na),i}var yf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(yf||{}),To=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(To||{});function vs(){let n=vC();return p.useCallback(e=>bC({mergeRefs:n,...e}),[n])}function bC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??xC;let f=iw(e,n);if(l)return Vh(f,t,i,u,h);let g=a??0;if(g&2){let{static:_=!1,...S}=f;if(_)return Vh(S,t,i,u,h)}if(g&1){let{unmount:_=!0,...S}=f;return Na(_?0:1,{0(){return null},1(){return Vh({...S,hidden:!0,style:{display:"none"}},t,i,u,h)}})}return Vh(f,t,i,u,h)}function Vh(n,e={},t,i,a){let{as:l=t,children:u,refName:h="ref",...f}=_p(n,["unmount","static"]),g=n.ref!==void 0?{[h]:n.ref}:{},_=typeof u=="function"?u(e):u;"className"in f&&f.className&&typeof f.className=="function"&&(f.className=f.className(e)),f["aria-labelledby"]&&f["aria-labelledby"]===f.id&&(f["aria-labelledby"]=void 0);let S={};if(e){let C=!1,N=[];for(let[O,E]of Object.entries(e))typeof E=="boolean"&&(C=!0),E===!0&&N.push(O.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(C){S["data-headlessui-state"]=N.join(" ");for(let O of N)S[`data-${O}`]=""}}if(Yc(l)&&(Object.keys(nl(f)).length>0||Object.keys(nl(S)).length>0))if(!p.isValidElement(_)||Array.isArray(_)&&_.length>1||wC(_)){if(Object.keys(nl(f)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(nl(f)).concat(Object.keys(nl(S))).map(C=>` - ${C}`).join(` `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(C=>` - ${C}`).join(` `)].join(` `))}else{let C=_.props,N=C?.className,O=typeof N=="function"?(...H)=>Dg(N(...H),f.className):Dg(N,f.className),E=O?{className:O}:{},B=iw(_.props,nl(_p(f,["ref"])));for(let H in S)H in B&&delete S[H];return p.cloneElement(_,Object.assign({},B,S,g,{ref:a(_C(_),g.ref)},E))}return p.createElement(l,Object.assign({},_p(f,["ref"]),!Yc(l)&&g,!Yc(l)&&S),_)}function vC(){let n=p.useRef([]),e=p.useCallback(t=>{for(let i of n.current)i!=null&&(typeof i=="function"?i(t):i.current=t)},[]);return(...t)=>{if(!t.every(i=>i==null))return n.current=t,e}}function xC(...n){return n.every(e=>e==null)?void 0:e=>{for(let t of n)t!=null&&(typeof t=="function"?t(e):t.current=e)}}function iw(...n){if(n.length===0)return{};if(n.length===1)return n[0];let e={},t={};for(let i of n)for(let a in i)a.startsWith("on")&&typeof i[a]=="function"?(t[a]!=null||(t[a]=[]),t[a].push(i[a])):e[a]=i[a];if(e.disabled||e["aria-disabled"])for(let i in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(t[i]=[a=>{var l;return(l=a?.preventDefault)==null?void 0:l.call(a)}]);for(let i in t)Object.assign(e,{[i](a,...l){let u=t[i];for(let h of u){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;h(a,...l)}}});return e}function Gr(n){var e;return Object.assign(p.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function nl(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function _p(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function _C(n){return rn.version.split(".")[0]>="19"?n.props.ref:n.ref}function Yc(n){return n===p.Fragment||n===Symbol.for("react.fragment")}function wC(n){return Yc(n.type)}let TC="span";var bf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(bf||{});function SC(n,e){var t;let{features:i=1,...a}=n,l={ref:e,"aria-hidden":(i&2)===2?!0:(t=a["aria-hidden"])!=null?t:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return vs()({ourProps:l,theirProps:a,slot:{},defaultTag:TC,name:"Hidden"})}let Mg=Gr(SC);function kC(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function ko(n){return kC(n)&&"tagName"in n}function pl(n){return ko(n)&&"accessKey"in n}function So(n){return ko(n)&&"tabIndex"in n}function EC(n){return ko(n)&&"style"in n}function CC(n){return pl(n)&&n.nodeName==="IFRAME"}function AC(n){return pl(n)&&n.nodeName==="INPUT"}let rw=Symbol();function NC(n,e=!0){return Object.assign(n,{[rw]:e})}function ia(...n){let e=p.useRef(n);p.useEffect(()=>{e.current=n},[n]);let t=xi(i=>{for(let a of e.current)a!=null&&(typeof a=="function"?a(i):a.current=i)});return n.every(i=>i==null||i?.[rw])?void 0:t}let py=p.createContext(null);py.displayName="DescriptionContext";function sw(){let n=p.useContext(py);if(n===null){let e=new Error("You used a component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,sw),e}return n}function DC(){let[n,e]=p.useState([]);return[n.length>0?n.join(" "):void 0,p.useMemo(()=>function(t){let i=xi(l=>(e(u=>[...u,l]),()=>e(u=>{let h=u.slice(),f=h.indexOf(l);return f!==-1&&h.splice(f,1),h}))),a=p.useMemo(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return rn.createElement(py.Provider,{value:a},t.children)},[e])]}let MC="p";function jC(n,e){let t=p.useId(),i=yC(),{id:a=`headlessui-description-${t}`,...l}=n,u=sw(),h=ia(e);qr(()=>u.register(a),[a,u.register]);let f=xd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return vs()({ourProps:g,theirProps:l,slot:f,defaultTag:MC,name:u.name||"Description"})}let RC=Gr(jC),OC=Object.assign(RC,{});var aw=(n=>(n.Space=" ",n.Enter="Enter",n.Escape="Escape",n.Backspace="Backspace",n.Delete="Delete",n.ArrowLeft="ArrowLeft",n.ArrowUp="ArrowUp",n.ArrowRight="ArrowRight",n.ArrowDown="ArrowDown",n.Home="Home",n.End="End",n.PageUp="PageUp",n.PageDown="PageDown",n.Tab="Tab",n))(aw||{});let LC=p.createContext(()=>{});function IC({value:n,children:e}){return rn.createElement(LC.Provider,{value:n},e)}let ow=class extends Map{constructor(e){super(),this.factory=e}get(e){let t=super.get(e);return t===void 0&&(t=this.factory(e),this.set(e,t)),t}};var BC=Object.defineProperty,PC=(n,e,t)=>e in n?BC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,FC=(n,e,t)=>(PC(n,e+"",t),t),lw=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},hs=(n,e,t)=>(lw(n,e,"read from private field"),t?t.call(n):e.get(n)),wp=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},p1=(n,e,t,i)=>(lw(n,e,"write to private field"),e.set(n,t),t),Gs,qc,Vc;let UC=class{constructor(e){wp(this,Gs,{}),wp(this,qc,new ow(()=>new Set)),wp(this,Vc,new Set),FC(this,"disposables",Ma()),p1(this,Gs,e),Js.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return hs(this,Gs)}subscribe(e,t){if(Js.isServer)return()=>{};let i={selector:e,callback:t,current:e(hs(this,Gs))};return hs(this,Vc).add(i),this.disposables.add(()=>{hs(this,Vc).delete(i)})}on(e,t){return Js.isServer?()=>{}:(hs(this,qc).get(e).add(t),this.disposables.add(()=>{hs(this,qc).get(e).delete(t)}))}send(e){let t=this.reduce(hs(this,Gs),e);if(t!==hs(this,Gs)){p1(this,Gs,t);for(let i of hs(this,Vc)){let a=i.selector(hs(this,Gs));uw(i.current,a)||(i.current=a,i.callback(a))}for(let i of hs(this,qc).get(e.type))i(hs(this,Gs),e)}}};Gs=new WeakMap,qc=new WeakMap,Vc=new WeakMap;function uw(n,e){return Object.is(n,e)?!0:typeof n!="object"||n===null||typeof e!="object"||e===null?!1:Array.isArray(n)&&Array.isArray(e)?n.length!==e.length?!1:Tp(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:Tp(n.entries(),e.entries()):g1(n)&&g1(e)?Tp(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Tp(n,e){do{let t=n.next(),i=e.next();if(t.done&&i.done)return!0;if(t.done||i.done||!Object.is(t.value,i.value))return!1}while(!0)}function g1(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}var zC=Object.defineProperty,$C=(n,e,t)=>e in n?zC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,y1=(n,e,t)=>($C(n,typeof e!="symbol"?e+"":e,t),t),HC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(HC||{});let qC={0(n,e){let t=e.id,i=n.stack,a=n.stack.indexOf(t);if(a!==-1){let l=n.stack.slice();return l.splice(a,1),l.push(t),i=l,{...n,stack:i}}return{...n,stack:[...n.stack,t]}},1(n,e){let t=e.id,i=n.stack.indexOf(t);if(i===-1)return n;let a=n.stack.slice();return a.splice(i,1),{...n,stack:a}}},VC=class cw extends UC{constructor(){super(...arguments),y1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),y1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new cw({stack:[]})}reduce(e,t){return Na(t.type,qC,e,t)}};const dw=new ow(()=>VC.new());var Sp={exports:{}},kp={};var b1;function GC(){if(b1)return kp;b1=1;var n=Kf();function e(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var t=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,a=n.useRef,l=n.useEffect,u=n.useMemo,h=n.useDebugValue;return kp.useSyncExternalStoreWithSelector=function(f,g,_,S,C){var N=a(null);if(N.current===null){var O={hasValue:!1,value:null};N.current=O}else O=N.current;N=u(function(){function B(W){if(!H){if(H=!0,Y=W,W=S(W),C!==void 0&&O.hasValue){var X=O.value;if(C(X,W))return U=X}return U=W}if(X=U,t(Y,W))return X;var R=S(W);return C!==void 0&&C(X,R)?(Y=W,X):(Y=W,U=R)}var H=!1,Y,U,re=_===void 0?null:_;return[function(){return B(g())},re===null?void 0:function(){return B(re())}]},[g,_,S,C]);var E=i(f,N[0],N[1]);return l(function(){O.hasValue=!0,O.value=E},[E]),h(E),E},kp}var v1;function KC(){return v1||(v1=1,Sp.exports=GC()),Sp.exports}var WC=KC();function hw(n,e,t=uw){return WC.useSyncExternalStoreWithSelector(xi(i=>n.subscribe(XC,i)),xi(()=>n.state),xi(()=>n.state),xi(e),t)}function XC(n){return n}function _d(n,e){let t=p.useId(),i=dw.get(e),[a,l]=hw(i,p.useCallback(u=>[i.selectors.isTop(u,t),i.selectors.inStack(u,t)],[i,t]));return qr(()=>{if(n)return i.actions.push(t),()=>i.actions.pop(t)},[i,n,t]),n?l?a:!0:!1}let jg=new Map,Qc=new Map;function x1(n){var e;let t=(e=Qc.get(n))!=null?e:0;return Qc.set(n,t+1),t!==0?()=>_1(n):(jg.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>_1(n))}function _1(n){var e;let t=(e=Qc.get(n))!=null?e:1;if(t===1?Qc.delete(n):Qc.set(n,t-1),t!==1)return;let i=jg.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,jg.delete(n))}function YC(n,{allowed:e,disallowed:t}={}){let i=_d(n,"inert-others");qr(()=>{var a,l;if(!i)return;let u=Ma();for(let f of(a=t?.())!=null?a:[])f&&u.add(x1(f));let h=(l=e?.())!=null?l:[];for(let f of h){if(!f)continue;let g=vd(f);if(!g)continue;let _=f.parentElement;for(;_&&_!==g.body;){for(let S of _.children)h.some(C=>S.contains(C))||u.add(x1(S));_=_.parentElement}}return u.dispose},[i,e,t])}function QC(n,e,t){let i=xl(a=>{let l=a.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&t()});p.useEffect(()=>{if(!n)return;let a=e===null?null:pl(e)?e:e.current;if(!a)return;let l=Ma();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}return()=>l.dispose()},[e,i,n])}let vf=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(","),ZC=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Sa=(n=>(n[n.First=1]="First",n[n.Previous=2]="Previous",n[n.Next=4]="Next",n[n.Last=8]="Last",n[n.WrapAround=16]="WrapAround",n[n.NoScroll=32]="NoScroll",n[n.AutoFocus=64]="AutoFocus",n))(Sa||{}),Rg=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Rg||{}),JC=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(JC||{});function e5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(vf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function t5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(ZC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var fw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(fw||{});function n5(n,e=0){var t;return n===((t=vd(n))==null?void 0:t.body)?!1:Na(e,{0(){return n.matches(vf)},1(){let i=n;for(;i!==null;){if(i.matches(vf))return!0;i=i.parentElement}return!1}})}var i5=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(i5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",n=>{n.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:n.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function Ca(n){n?.focus({preventScroll:!0})}let r5=["textarea","input"].join(",");function s5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,r5))!=null?t:!1}function a5(n,e=t=>t){return n.slice().sort((t,i)=>{let a=e(t),l=e(i);if(a===null||l===null)return 0;let u=a.compareDocumentPosition(l);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Zc(n,e,{sorted:t=!0,relativeTo:i=null,skipElements:a=[]}={}){let l=Array.isArray(n)?n.length>0?Ng(n[0]):document:Ng(n),u=Array.isArray(n)?t?a5(n):n:e&64?t5(n):e5(n);a.length>0&&u.length>1&&(u=u.filter(N=>!a.some(O=>O!=null&&"current"in O?O?.current===N:O===N))),i=i??l?.activeElement;let h=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),f=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,u.indexOf(i))-1;if(e&4)return Math.max(0,u.indexOf(i))+1;if(e&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),g=e&32?{preventScroll:!0}:{},_=0,S=u.length,C;do{if(_>=S||_+S<=0)return 0;let N=f+_;if(e&16)N=(N+S)%S;else{if(N<0)return 3;if(N>=S)return 1}C=u[N],C?.focus(g),_+=h}while(C!==nw(C));return e&6&&s5(C)&&C.select(),2}function mw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function o5(){return/Android/gi.test(window.navigator.userAgent)}function w1(){return mw()||o5()}function Gh(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return document.addEventListener(e,l,i),()=>document.removeEventListener(e,l,i)},[n,e,i])}function pw(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return window.addEventListener(e,l,i),()=>window.removeEventListener(e,l,i)},[n,e,i])}const T1=30;function l5(n,e,t){let i=xl(t),a=p.useCallback(function(h,f){if(h.defaultPrevented)return;let g=f(h);if(g===null||!g.getRootNode().contains(g)||!g.isConnected)return;let _=(function S(C){return typeof C=="function"?S(C()):Array.isArray(C)||C instanceof Set?C:[C]})(e);for(let S of _)if(S!==null&&(S.contains(g)||h.composed&&h.composedPath().includes(S)))return;return!n5(g,fw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=p.useRef(null);Gh(n,"pointerdown",h=>{var f,g;w1()||(l.current=((g=(f=h.composedPath)==null?void 0:f.call(h))==null?void 0:g[0])||h.target)},!0),Gh(n,"pointerup",h=>{if(w1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=p.useRef({x:0,y:0});Gh(n,"touchstart",h=>{u.current.x=h.touches[0].clientX,u.current.y=h.touches[0].clientY},!0),Gh(n,"touchend",h=>{let f={x:h.changedTouches[0].clientX,y:h.changedTouches[0].clientY};if(!(Math.abs(f.x-u.current.x)>=T1||Math.abs(f.y-u.current.y)>=T1))return a(h,()=>So(h.target)?h.target:null)},!0),pw(n,"blur",h=>a(h,()=>CC(window.document.activeElement)?window.document.activeElement:null),!0)}function gy(...n){return p.useMemo(()=>vd(...n),[...n])}function gw(n,e,t,i){let a=xl(t);p.useEffect(()=>{n=n??window;function l(u){a.current(u)}return n.addEventListener(e,l,i),()=>n.removeEventListener(e,l,i)},[n,e,i])}function u5(n){return p.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function c5(n,e){let t=n(),i=new Set;return{getSnapshot(){return t},subscribe(a){return i.add(a),()=>i.delete(a)},dispatch(a,...l){let u=e[a].call(t,...l);u&&(t=u,i.forEach(h=>h()))}}}function d5(){let n;return{before({doc:e}){var t;let i=e.documentElement,a=(t=e.defaultView)!=null?t:window;n=Math.max(0,a.innerWidth-i.clientWidth)},after({doc:e,d:t}){let i=e.documentElement,a=Math.max(0,i.clientWidth-i.offsetWidth),l=Math.max(0,n-a);t.style(i,"paddingRight",`${l}px`)}}}function h5(){return mw()?{before({doc:n,d:e,meta:t}){function i(a){for(let l of t().containers)for(let u of l())if(u.contains(a))return!0;return!1}e.microTask(()=>{var a;if(window.getComputedStyle(n.documentElement).scrollBehavior!=="auto"){let h=Ma();h.style(n.documentElement,"scrollBehavior","auto"),e.add(()=>e.microTask(()=>h.dispose()))}let l=(a=window.scrollY)!=null?a:window.pageYOffset,u=null;e.addEventListener(n,"click",h=>{if(So(h.target))try{let f=h.target.closest("a");if(!f)return;let{hash:g}=new URL(f.href),_=n.querySelector(g);So(_)&&!i(_)&&(u=_)}catch{}},!0),e.group(h=>{e.addEventListener(n,"touchstart",f=>{if(h.dispose(),So(f.target)&&EC(f.target))if(i(f.target)){let g=f.target;for(;g.parentElement&&i(g.parentElement);)g=g.parentElement;h.style(g,"overscrollBehavior","contain")}else h.style(f.target,"touchAction","none")})}),e.addEventListener(n,"touchmove",h=>{if(So(h.target)){if(AC(h.target))return;if(i(h.target)){let f=h.target;for(;f.parentElement&&f.dataset.headlessuiPortal!==""&&!(f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth);)f=f.parentElement;f.dataset.headlessuiPortal===""&&h.preventDefault()}else h.preventDefault()}},{passive:!1}),e.add(()=>{var h;let f=(h=window.scrollY)!=null?h:window.pageYOffset;l!==f&&window.scrollTo(0,l),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function f5(){return{before({doc:n,d:e}){e.style(n.documentElement,"overflow","hidden")}}}function S1(n){let e={};for(let t of n)Object.assign(e,t(e));return e}let ol=c5(()=>new Map,{PUSH(n,e){var t;let i=(t=this.get(n))!=null?t:{doc:n,count:0,d:Ma(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=S1(i.meta),this.set(n,i),this},POP(n,e){let t=this.get(n);return t&&(t.count--,t.meta.delete(e),t.computedMeta=S1(t.meta)),this},SCROLL_PREVENT(n){let e={doc:n.doc,d:n.d,meta(){return n.computedMeta}},t=[h5(),d5(),f5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});ol.subscribe(()=>{let n=ol.getSnapshot(),e=new Map;for(let[t]of n)e.set(t,t.documentElement.style.overflow);for(let t of n.values()){let i=e.get(t.doc)==="hidden",a=t.count!==0;(a&&!i||!a&&i)&&ol.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&ol.dispatch("TEARDOWN",t)}});function m5(n,e,t=()=>({containers:[]})){let i=u5(ol),a=e?i.get(e):void 0,l=a?a.count>0:!1;return qr(()=>{if(!(!e||!n))return ol.dispatch("PUSH",e,t),()=>ol.dispatch("POP",e,t)},[n,e]),l}function p5(n,e,t=()=>[document.body]){let i=_d(n,"scroll-lock");m5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function g5(n=0){let[e,t]=p.useState(n),i=p.useCallback(f=>t(f),[]),a=p.useCallback(f=>t(g=>g|f),[]),l=p.useCallback(f=>(e&f)===f,[e]),u=p.useCallback(f=>t(g=>g&~f),[]),h=p.useCallback(f=>t(g=>g^f),[]);return{flags:e,setFlag:i,addFlag:a,hasFlag:l,removeFlag:u,toggleFlag:h}}var y5={},k1,E1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((k1=process==null?void 0:y5)==null?void 0:k1.NODE_ENV)==="test"&&typeof((E1=Element?.prototype)==null?void 0:E1.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` `)),[]});var b5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(b5||{});function v5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function x5(n,e,t,i){let[a,l]=p.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=g5(n&&a?3:0),g=p.useRef(!1),_=p.useRef(!1),S=Xf();return qr(()=>{var C;if(n){if(t&&l(!0),!e){t&&h(3);return}return(C=i?.start)==null||C.call(i,t),_5(e,{inFlight:g,prepare(){_.current?_.current=!1:_.current=g.current,g.current=!0,!_.current&&(t?(h(3),f(4)):(h(4),f(2)))},run(){_.current?t?(f(3),h(4)):(f(4),h(3)):t?f(1):h(1)},done(){var N;_.current&&S5(e)||(g.current=!1,f(7),t||l(!1),(N=i?.end)==null||N.call(i,t))}})}},[n,t,e,S]),n?[a,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function _5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ma();return T5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(w5(n,i))})}),l.dispose}function w5(n,e){var t,i;let a=Ma();if(!n)return a.dispose;let l=!1;a.add(()=>{l=!0});let u=(i=(t=n.getAnimations)==null?void 0:t.call(n).filter(h=>h instanceof CSSTransition))!=null?i:[];return u.length===0?(e(),a.dispose):(Promise.allSettled(u.map(h=>h.finished)).then(()=>{l||e()}),a.dispose)}function T5(n,{inFlight:e,prepare:t}){if(e!=null&&e.current){t();return}let i=n.style.transition;n.style.transition="none",t(),n.offsetHeight,n.style.transition=i}function S5(n){var e,t;return((t=(e=n.getAnimations)==null?void 0:e.call(n))!=null?t:[]).some(i=>i instanceof CSSTransition&&i.playState!=="finished")}function yy(n,e){let t=p.useRef([]),i=xi(n);p.useEffect(()=>{let a=[...t.current];for(let[l,u]of e.entries())if(t.current[l]!==u){let h=i(e,a);return t.current=e,h}},[i,...e])}let Yf=p.createContext(null);Yf.displayName="OpenClosedContext";var As=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(As||{});function Qf(){return p.useContext(Yf)}function k5({value:n,children:e}){return rn.createElement(Yf.Provider,{value:n},e)}function E5({children:n}){return rn.createElement(Yf.Provider,{value:null},n)}function C5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let wo=[];C5(()=>{function n(e){if(!So(e.target)||e.target===document.body||wo[0]===e.target)return;let t=e.target;t=t.closest(vf),wo.unshift(t??e.target),wo=wo.filter(i=>i!=null&&i.isConnected),wo.splice(10)}window.addEventListener("click",n,{capture:!0}),window.addEventListener("mousedown",n,{capture:!0}),window.addEventListener("focus",n,{capture:!0}),document.body.addEventListener("click",n,{capture:!0}),document.body.addEventListener("mousedown",n,{capture:!0}),document.body.addEventListener("focus",n,{capture:!0})});function yw(n){let e=xi(n),t=p.useRef(!1);p.useEffect(()=>(t.current=!1,()=>{t.current=!0,Wf(()=>{t.current&&e()})}),[e])}let bw=p.createContext(!1);function A5(){return p.useContext(bw)}function C1(n){return rn.createElement(bw.Provider,{value:n.force},n.children)}function N5(n){let e=A5(),t=p.useContext(xw),[i,a]=p.useState(()=>{var l;if(!e&&t!==null)return(l=t.current)!=null?l:null;if(Js.isServer)return null;let u=n?.getElementById("headlessui-portal-root");if(u)return u;if(n===null)return null;let h=n.createElement("div");return h.setAttribute("id","headlessui-portal-root"),n.body.appendChild(h)});return p.useEffect(()=>{i!==null&&(n!=null&&n.body.contains(i)||n==null||n.body.appendChild(i))},[i,n]),p.useEffect(()=>{e||t!==null&&a(t.current)},[t,a,e]),i}let vw=p.Fragment,D5=Gr(function(n,e){let{ownerDocument:t=null,...i}=n,a=p.useRef(null),l=ia(NC(C=>{a.current=C}),e),u=gy(a.current),h=t??u,f=N5(h),g=p.useContext(Og),_=Xf(),S=vs();return yw(()=>{var C;f&&f.childNodes.length<=0&&((C=f.parentElement)==null||C.removeChild(f))}),f?yu.createPortal(rn.createElement("div",{"data-headlessui-portal":"",ref:C=>{_.dispose(),g&&C&&_.add(g.register(C))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:vw,name:"Portal"})),f):null});function M5(n,e){let t=ia(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=vs();return i?rn.createElement(D5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:vw,name:"Portal"})}let j5=p.Fragment,xw=p.createContext(null);function R5(n,e){let{target:t,...i}=n,a={ref:ia(e)},l=vs();return rn.createElement(xw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:j5,name:"Popover.Group"}))}let Og=p.createContext(null);function O5(){let n=p.useContext(Og),e=p.useRef([]),t=xi(l=>(e.current.push(l),n&&n.register(l),()=>i(l))),i=xi(l=>{let u=e.current.indexOf(l);u!==-1&&e.current.splice(u,1),n&&n.unregister(l)}),a=p.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,p.useMemo(()=>function({children:l}){return rn.createElement(Og.Provider,{value:a},l)},[a])]}let L5=Gr(M5),_w=Gr(R5),I5=Object.assign(L5,{Group:_w});function B5(n,e=typeof document<"u"?document.defaultView:null,t){let i=_d(n,"escape");gw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===aw.Escape&&t(a))})}function P5(){var n;let[e]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=p.useState((n=e?.matches)!=null?n:!1);return qr(()=>{if(!e)return;function a(l){i(l.matches)}return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function F5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=xi(()=>{var a,l;let u=vd(t),h=[];for(let f of n)f!==null&&(ko(f)?h.push(f):"current"in f&&ko(f.current)&&h.push(f.current));if(e!=null&&e.current)for(let f of e.current)h.push(f);for(let f of(a=u?.querySelectorAll("html > *, body > *"))!=null?a:[])f!==document.body&&f!==document.head&&ko(f)&&f.id!=="headlessui-portal-root"&&(t&&(f.contains(t)||f.contains((l=t?.getRootNode())==null?void 0:l.host))||h.some(g=>f.contains(g))||h.push(f));return h});return{resolveContainers:i,contains:xi(a=>i().some(l=>l.contains(a)))}}let ww=p.createContext(null);function A1({children:n,node:e}){let[t,i]=p.useState(null),a=Tw(e??t);return rn.createElement(ww.Provider,{value:a},n,a===null&&rn.createElement(Mg,{features:bf.Hidden,ref:l=>{var u,h;if(l){for(let f of(h=(u=vd(l))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?h:[])if(f!==document.body&&f!==document.head&&ko(f)&&f!=null&&f.contains(l)){i(f);break}}}}))}function Tw(n=null){var e;return(e=p.useContext(ww))!=null?e:n}function U5(){let n=typeof document>"u";return"useSyncExternalStore"in l1?(e=>e.useSyncExternalStore)(l1)(()=>()=>{},()=>!1,()=>!n):!1}function Zf(){let n=U5(),[e,t]=p.useState(Js.isHandoffComplete);return e&&Js.isHandoffComplete===!1&&t(!1),p.useEffect(()=>{e!==!0&&t(!0)},[e]),p.useEffect(()=>Js.handoff(),[]),n?!1:e}function by(){let n=p.useRef(!1);return qr(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var Gc=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(Gc||{});function z5(){let n=p.useRef(0);return pw(!0,"keydown",e=>{e.key==="Tab"&&(n.current=e.shiftKey?1:0)},!0),n}function Sw(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let e=new Set;for(let t of n.current)ko(t.current)&&e.add(t.current);return e}let $5="div";var sl=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(sl||{});function H5(n,e){let t=p.useRef(null),i=ia(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;Zf()||(h=0);let g=gy(t.current);K5(h,{ownerDocument:g});let _=W5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});X5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:_});let S=z5(),C=xi(Y=>{if(!pl(t.current))return;let U=t.current;(re=>re())(()=>{Na(S.current,{[Gc.Forwards]:()=>{Zc(U,Sa.First,{skipElements:[Y.relatedTarget,l]})},[Gc.Backwards]:()=>{Zc(U,Sa.Last,{skipElements:[Y.relatedTarget,l]})}})})}),N=_d(!!(h&2),"focus-trap#tab-lock"),O=Xf(),E=p.useRef(!1),B={ref:i,onKeyDown(Y){Y.key=="Tab"&&(E.current=!0,O.requestAnimationFrame(()=>{E.current=!1}))},onBlur(Y){if(!(h&4))return;let U=Sw(u);pl(t.current)&&U.add(t.current);let re=Y.relatedTarget;So(re)&&re.dataset.headlessuiFocusGuard!=="true"&&(kw(U,re)||(E.current?Zc(t.current,Na(S.current,{[Gc.Forwards]:()=>Sa.Next,[Gc.Backwards]:()=>Sa.Previous})|Sa.WrapAround,{relativeTo:Y.target}):So(Y.target)&&Ca(Y.target)))}},H=vs();return rn.createElement(rn.Fragment,null,N&&rn.createElement(Mg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}),H({ourProps:B,theirProps:f,defaultTag:$5,name:"FocusTrap"}),N&&rn.createElement(Mg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}))}let q5=Gr(H5),V5=Object.assign(q5,{features:sl});function G5(n=!0){let e=p.useRef(wo.slice());return yy(([t],[i])=>{i===!0&&t===!1&&Wf(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=wo.slice())},[n,wo,e]),xi(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function K5(n,{ownerDocument:e}){let t=!!(n&8),i=G5(t);yy(()=>{t||pC(e?.body)&&Ca(i())},[t]),yw(()=>{t&&Ca(i())})}function W5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=p.useRef(null),u=_d(!!(n&1),"focus-trap#initial-focus"),h=by();return yy(()=>{if(n===0)return;if(!u){a!=null&&a.current&&Ca(a.current);return}let f=t.current;f&&Wf(()=>{if(!h.current)return;let g=e?.activeElement;if(i!=null&&i.current){if(i?.current===g){l.current=g;return}}else if(f.contains(g)){l.current=g;return}if(i!=null&&i.current)Ca(i.current);else{if(n&16){if(Zc(f,Sa.First|Sa.AutoFocus)!==Rg.Error)return}else if(Zc(f,Sa.First)!==Rg.Error)return;if(a!=null&&a.current&&(Ca(a.current),e?.activeElement===a.current))return;console.warn("There are no focusable elements inside the ")}l.current=e?.activeElement})},[a,u,n]),l}function X5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=by(),u=!!(n&4);gw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=Sw(i);pl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let _=h.target;pl(_)?kw(f,_)?(a.current=_,Ca(_)):(h.preventDefault(),h.stopPropagation(),Ca(g)):Ca(a.current)},!0)}function kw(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function Ew(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Yc((e=n.as)!=null?e:Aw)||rn.Children.count(n.children)===1}let Jf=p.createContext(null);Jf.displayName="TransitionContext";var Y5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(Y5||{});function Q5(){let n=p.useContext(Jf);if(n===null)throw new Error("A is used but it is missing a parent or .");return n}function Z5(){let n=p.useContext(e0);if(n===null)throw new Error("A is used but it is missing a parent or .");return n}let e0=p.createContext(null);e0.displayName="NestingContext";function t0(n){return"children"in n?t0(n.children):n.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Cw(n,e){let t=xl(n),i=p.useRef([]),a=by(),l=Xf(),u=xi((N,O=To.Hidden)=>{let E=i.current.findIndex(({el:B})=>B===N);E!==-1&&(Na(O,{[To.Unmount](){i.current.splice(E,1)},[To.Hidden](){i.current[E].state="hidden"}}),l.microTask(()=>{var B;!t0(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=xi(N=>{let O=i.current.find(({el:E})=>E===N);return O?O.state!=="visible"&&(O.state="visible"):i.current.push({el:N,state:"visible"}),()=>u(N,To.Unmount)}),f=p.useRef([]),g=p.useRef(Promise.resolve()),_=p.useRef({enter:[],leave:[]}),S=xi((N,O,E)=>{f.current.splice(0),e&&(e.chains.current[O]=e.chains.current[O].filter(([B])=>B!==N)),e?.chains.current[O].push([N,new Promise(B=>{f.current.push(B)})]),e?.chains.current[O].push([N,new Promise(B=>{Promise.all(_.current[O].map(([H,Y])=>Y)).then(()=>B())})]),O==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>E(O)):E(O)}),C=xi((N,O,E)=>{Promise.all(_.current[O].splice(0).map(([B,H])=>H)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>E(O))});return p.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:C,wait:g,chains:_}),[h,u,i,S,C,_,g])}let Aw=p.Fragment,Nw=yf.RenderStrategy;function J5(n,e){var t,i;let{transition:a=!0,beforeEnter:l,afterEnter:u,beforeLeave:h,afterLeave:f,enter:g,enterFrom:_,enterTo:S,entered:C,leave:N,leaveFrom:O,leaveTo:E,...B}=n,[H,Y]=p.useState(null),U=p.useRef(null),re=Ew(n),W=ia(...re?[U,e,Y]:e===null?[]:[e]),X=(t=B.unmount)==null||t?To.Unmount:To.Hidden,{show:R,appear:le,initial:k}=Q5(),[j,Z]=p.useState(R?"visible":"hidden"),V=Z5(),{register:ne,unregister:me}=V;qr(()=>ne(U),[ne,U]),qr(()=>{if(X===To.Hidden&&U.current){if(R&&j!=="visible"){Z("visible");return}return Na(j,{hidden:()=>me(U),visible:()=>ne(U)})}},[j,U,ne,me,R,X]);let ue=Zf();qr(()=>{if(re&&ue&&j==="visible"&&U.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[U,j,ue,re]);let q=k&&!le,P=le&&R&&k,Q=p.useRef(!1),te=Cw(()=>{Q.current||(Z("hidden"),me(U))},V),ge=xi(Ke=>{Q.current=!0;let we=Ke?"enter":"leave";te.onStart(U,we,Re=>{Re==="enter"?l?.():Re==="leave"&&h?.()})}),L=xi(Ke=>{let we=Ke?"enter":"leave";Q.current=!1,te.onStop(U,we,Re=>{Re==="enter"?u?.():Re==="leave"&&f?.()}),we==="leave"&&!t0(te)&&(Z("hidden"),me(U))});p.useEffect(()=>{re&&a||(ge(R),L(R))},[R,re,a]);let xe=!(!a||!re||!ue||q),[,Te]=x5(xe,H,R,{start:ge,end:L}),ye=nl({ref:W,className:((i=Dg(B.className,P&&g,P&&_,Te.enter&&g,Te.enter&&Te.closed&&_,Te.enter&&!Te.closed&&S,Te.leave&&N,Te.leave&&!Te.closed&&O,Te.leave&&Te.closed&&E,!Te.transition&&R&&C))==null?void 0:i.trim())||void 0,...v5(Te)}),be=0;j==="visible"&&(be|=As.Open),j==="hidden"&&(be|=As.Closed),R&&j==="hidden"&&(be|=As.Opening),!R&&j==="visible"&&(be|=As.Closing);let mt=vs();return rn.createElement(e0.Provider,{value:te},rn.createElement(k5,{value:be},mt({ourProps:ye,theirProps:B,defaultTag:Aw,features:Nw,visible:j==="visible",name:"Transition.Child"})))}function eA(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=p.useRef(null),h=Ew(n),f=ia(...h?[u,e]:e===null?[]:[e]);Zf();let g=Qf();if(t===void 0&&g!==null&&(t=(g&As.Open)===As.Open),t===void 0)throw new Error("A is used but it is missing a `show={true | false}` prop.");let[_,S]=p.useState(t?"visible":"hidden"),C=Cw(()=>{t||S("hidden")}),[N,O]=p.useState(!0),E=p.useRef([t]);qr(()=>{N!==!1&&E.current[E.current.length-1]!==t&&(E.current.push(t),O(!1))},[E,t]);let B=p.useMemo(()=>({show:t,appear:i,initial:N}),[t,i,N]);qr(()=>{t?S("visible"):!t0(C)&&u.current!==null&&S("hidden")},[t,C]);let H={unmount:a},Y=xi(()=>{var W;N&&O(!1),(W=n.beforeEnter)==null||W.call(n)}),U=xi(()=>{var W;N&&O(!1),(W=n.beforeLeave)==null||W.call(n)}),re=vs();return rn.createElement(e0.Provider,{value:C},rn.createElement(Jf.Provider,{value:B},re({ourProps:{...H,as:p.Fragment,children:rn.createElement(Dw,{ref:f,...H,...l,beforeEnter:Y,beforeLeave:U})},theirProps:{},defaultTag:p.Fragment,features:Nw,visible:_==="visible",name:"Transition"})))}function tA(n,e){let t=p.useContext(Jf)!==null,i=Qf()!==null;return rn.createElement(rn.Fragment,null,!t&&i?rn.createElement(Lg,{ref:e,...n}):rn.createElement(Dw,{ref:e,...n}))}let Lg=Gr(eA),Dw=Gr(J5),vy=Gr(tA),Jc=Object.assign(Lg,{Child:vy,Root:Lg});var nA=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(nA||{}),iA=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(iA||{});let rA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},xy=p.createContext(null);xy.displayName="DialogContext";function n0(n){let e=p.useContext(xy);if(e===null){let t=new Error(`<${n} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,n0),t}return e}function sA(n,e){return Na(e.type,rA,n,e)}let N1=Gr(function(n,e){let t=p.useId(),{id:i=`headlessui-dialog-${t}`,open:a,onClose:l,initialFocus:u,role:h="dialog",autoFocus:f=!0,__demoMode:g=!1,unmount:_=!1,...S}=n,C=p.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(C.current||(C.current=!0,console.warn(`Invalid role [${h}] passed to . Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let N=Qf();a===void 0&&N!==null&&(a=(N&As.Open)===As.Open);let O=p.useRef(null),E=ia(O,e),B=gy(O.current),H=a?0:1,[Y,U]=p.useReducer(sA,{titleId:null,descriptionId:null,panelRef:p.createRef()}),re=xi(()=>l(!1)),W=xi(Te=>U({type:0,id:Te})),X=Zf()?H===0:!1,[R,le]=O5(),k={get current(){var Te;return(Te=Y.panelRef.current)!=null?Te:O.current}},j=Tw(),{resolveContainers:Z}=F5({mainTreeNode:j,portals:R,defaultContainers:[k]}),V=N!==null?(N&As.Closing)===As.Closing:!1;YC(g||V?!1:X,{allowed:xi(()=>{var Te,ye;return[(ye=(Te=O.current)==null?void 0:Te.closest("[data-headlessui-portal]"))!=null?ye:null]}),disallowed:xi(()=>{var Te;return[(Te=j?.closest("body > *:not(#headlessui-portal-root)"))!=null?Te:null]})});let ne=dw.get(null);qr(()=>{if(X)return ne.actions.push(i),()=>ne.actions.pop(i)},[ne,i,X]);let me=hw(ne,p.useCallback(Te=>ne.selectors.isTop(Te,i),[ne,i]));l5(me,Z,Te=>{Te.preventDefault(),re()}),B5(me,B?.defaultView,Te=>{Te.preventDefault(),Te.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),re()}),p5(g||V?!1:X,B,Z),QC(X,O,re);let[ue,q]=DC(),P=p.useMemo(()=>[{dialogState:H,close:re,setTitleId:W,unmount:_},Y],[H,re,W,_,Y]),Q=xd({open:H===0}),te={ref:E,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:H===0?!0:void 0,"aria-labelledby":Y.titleId,"aria-describedby":ue,unmount:_},ge=!P5(),L=sl.None;X&&!g&&(L|=sl.RestoreFocus,L|=sl.TabLock,f&&(L|=sl.AutoFocus),ge&&(L|=sl.InitialFocus));let xe=vs();return rn.createElement(E5,null,rn.createElement(C1,{force:!0},rn.createElement(I5,null,rn.createElement(xy.Provider,{value:P},rn.createElement(_w,{target:O},rn.createElement(C1,{force:!1},rn.createElement(q,{slot:Q},rn.createElement(le,null,rn.createElement(V5,{initialFocus:u,initialFocusFallback:O,containers:Z,features:L},rn.createElement(IC,{value:re},xe({ourProps:te,theirProps:S,slot:Q,defaultTag:aA,features:oA,visible:H===0,name:"Dialog"})))))))))))}),aA="div",oA=yf.RenderStrategy|yf.Static;function lA(n,e){let{transition:t=!1,open:i,...a}=n,l=Qf(),u=n.hasOwnProperty("open")||l!==null,h=n.hasOwnProperty("onClose");if(!u&&!h)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!h)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!l&&typeof n.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n.open}`);if(typeof n.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n.onClose}`);return(i!==void 0||t)&&!a.static?rn.createElement(A1,null,rn.createElement(Jc,{show:i,transition:t,unmount:a.unmount},rn.createElement(N1,{ref:e,...a}))):rn.createElement(A1,null,rn.createElement(N1,{ref:e,open:i,...a}))}let uA="div";function cA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=n0("Dialog.Panel"),g=ia(e,f.panelRef),_=xd({open:u===0}),S=xi(B=>{B.stopPropagation()}),C={ref:g,id:i,onClick:S},N=a?vy:p.Fragment,O=a?{unmount:h}:{},E=vs();return rn.createElement(N,{...O},E({ourProps:C,theirProps:l,slot:_,defaultTag:uA,name:"Dialog.Panel"}))}let dA="div";function hA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=n0("Dialog.Backdrop"),u=xd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?vy:p.Fragment,g=t?{unmount:l}:{},_=vs();return rn.createElement(f,{...g},_({ourProps:h,theirProps:i,slot:u,defaultTag:dA,name:"Dialog.Backdrop"}))}let fA="h2";function mA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=n0("Dialog.Title"),h=ia(e);p.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=xd({open:l===0}),g={ref:h,id:i};return vs()({ourProps:g,theirProps:a,slot:f,defaultTag:fA,name:"Dialog.Title"})}let pA=Gr(lA),gA=Gr(cA);Gr(hA);let yA=Gr(mA),au=Object.assign(pA,{Panel:gA,Title:yA,Description:OC});function bA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=p.useState(""),[u,h]=p.useState(""),[f,g]=p.useState([]),_=p.useRef(!1);p.useEffect(()=>{n&&!_.current&&(l(""),h(""),g(i??[])),_.current=n},[n,i]);function S(){const O=a.trim(),E=u.trim();!O||!E||(g(B=>[...B.filter(Y=>Y.name!==O),{name:O,value:E}]),l(""),h(""))}function C(O){g(E=>E.filter(B=>B.name!==O))}function N(){t(f),e()}return c.jsxs(au,{open:n,onClose:e,className:"relative z-50",children:[c.jsx("div",{className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),c.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:c.jsxs(au.Panel,{className:"w-full max-w-lg rounded-lg bg-white dark:bg-gray-800 p-6 shadow-xl dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[c.jsx(au.Title,{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Zusätzliche Cookies"}),c.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[c.jsx("input",{value:a,onChange:O=>l(O.target.value),placeholder:"Name (z. B. cf_clearance)",className:"col-span-1 truncate rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),c.jsx("input",{value:u,onChange:O=>h(O.target.value),placeholder:"Wert",className:"col-span-1 truncate sm:col-span-2 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"})]}),c.jsx("div",{className:"mt-2",children:c.jsx(sn,{size:"sm",variant:"secondary",onClick:S,disabled:!a.trim()||!u.trim(),children:"Hinzufügen"})}),c.jsx("div",{className:"mt-4",children:f.length===0?c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Noch keine Cookies hinzugefügt."}):c.jsxs("table",{className:"min-w-full text-sm border divide-y dark:divide-white/10",children:[c.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700/50",children:c.jsxs("tr",{children:[c.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Name"}),c.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Wert"}),c.jsx("th",{className:"px-3 py-2"})]})}),c.jsx("tbody",{className:"divide-y dark:divide-white/10",children:f.map(O=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:O.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:O.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>C(O.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},O.name))})]})}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx(sn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(sn,{variant:"primary",onClick:N,children:"Übernehmen"})]})]})})]})}function vA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const xA=p.forwardRef(vA);function Ig({tabs:n,value:e,onChange:t,className:i,ariaLabel:a="Ansicht auswählen",variant:l="underline",hideCountUntilMd:u=!1}){if(!n?.length)return null;const h=n.find(C=>C.id===e)??n[0],f=on("col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800 dark:focus:outline-indigo-500",l==="pillsBrand"?"dark:bg-gray-800/50":"dark:bg-white/5"),g=C=>on(C?"bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400":"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300",u?"ml-3 hidden rounded-full px-2.5 py-0.5 text-xs font-medium md:inline-block":"ml-3 rounded-full px-2.5 py-0.5 text-xs font-medium"),_=(C,N)=>N.count===void 0?null:c.jsx("span",{className:g(C),children:N.count}),S=()=>{switch(l){case"underline":case"underlineIcons":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex space-x-8",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-200",l==="underlineIcons"?"group inline-flex items-center border-b-2 px-1 py-4 text-sm font-medium":"flex items-center border-b-2 px-1 py-4 text-sm font-medium whitespace-nowrap",O&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[l==="underlineIcons"&&C.icon?c.jsx(C.icon,{"aria-hidden":"true",className:on(N?"text-indigo-500 dark:text-indigo-400":"text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-400","mr-2 -ml-0.5 size-5")}):null,c.jsx("span",{children:C.label}),_(N,C)]},C.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const C=l==="pills"?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-gray-200":l==="pillsGray"?"bg-gray-200 text-gray-800 dark:bg-white/10 dark:text-white":"bg-indigo-100 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300",N=l==="pills"?"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200":l==="pillsGray"?"text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200";return c.jsx("nav",{"aria-label":a,className:"flex space-x-4",children:n.map(O=>{const E=O.id===h.id,B=!!O.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(O.id),disabled:B,"aria-current":E?"page":void 0,className:on(E?C:N,"inline-flex items-center rounded-md px-3 py-2 text-sm font-medium",B&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:[c.jsx("span",{children:O.label}),O.count!==void 0?c.jsx("span",{className:on(E?"ml-2 bg-white/70 text-gray-900 dark:bg-white/10 dark:text-white":"ml-2 bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300","rounded-full px-2 py-0.5 text-xs font-medium"),children:O.count}):null]},O.id)})})}case"fullWidthUnderline":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsx("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:border-white/20 dark:hover:text-gray-300","flex-1 border-b-2 px-1 py-4 text-center text-sm font-medium",O&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:C.label},C.id)})})});case"barUnderline":return c.jsx("nav",{"aria-label":a,className:"isolate flex divide-x divide-gray-200 rounded-lg bg-white shadow-sm dark:divide-white/10 dark:bg-gray-800/50 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",children:n.map((C,N)=>{const O=C.id===h.id,E=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!E&&t(C.id),disabled:E,"aria-current":O?"page":void 0,className:on(O?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",N===0?"rounded-l-lg":"",N===n.length-1?"rounded-r-lg":"","group relative min-w-0 flex-1 overflow-hidden px-4 py-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10 dark:hover:bg-white/5",E&&"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center justify-center",children:[c.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",title:C.label,children:C.label}),C.count!==void 0?c.jsx("span",{className:"ml-2 shrink-0 tabular-nums min-w-[2.25rem] rounded-full bg-white/70 px-2 py-0.5 text-center text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-white",children:C.count}):null]}),c.jsx("span",{"aria-hidden":"true",className:on(O?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},C.id)})});case"simple":return c.jsx("nav",{className:"flex border-b border-gray-200 py-4 dark:border-white/10","aria-label":a,children:c.jsx("ul",{role:"list",className:"flex min-w-full flex-none gap-x-8 px-2 text-sm/6 font-semibold text-gray-500 dark:text-gray-400",children:n.map(C=>{const N=C.id===h.id,O=!!C.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!O&&t(C.id),disabled:O,"aria-current":N?"page":void 0,className:on(N?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",O&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:C.label})},C.id)})})});default:return null}};return c.jsxs("div",{className:i,children:[c.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[c.jsx("select",{value:h.id,onChange:C=>t(C.target.value),"aria-label":a,className:f,children:n.map(C=>c.jsx("option",{value:C.id,children:C.label},C.id))}),c.jsx(xA,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),c.jsx("div",{className:"hidden sm:block",children:S()})]})}function Ns({header:n,footer:e,grayBody:t=!1,grayFooter:i=!1,edgeToEdgeMobile:a=!1,well:l=!1,noBodyPadding:u=!1,className:h,bodyClassName:f,children:g}){const _=l;return c.jsxs("div",{className:on("overflow-hidden",a?"sm:rounded-lg":"rounded-lg",_?"bg-gray-50 dark:bg-gray-800 shadow-none":"bg-white shadow-sm dark:bg-gray-800 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",h),children:[n&&c.jsx("div",{className:"shrink-0 px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-white/10",children:n}),c.jsx("div",{className:on("min-h-0",u?"p-0":"px-4 py-5 sm:p-6",t&&"bg-gray-50 dark:bg-gray-800",f),children:g}),e&&c.jsx("div",{className:on("shrink-0 px-4 py-4 sm:px-6",i&&"bg-gray-50 dark:bg-gray-800/50","border-t border-gray-200 dark:border-white/10"),children:e})]})}function Bg({checked:n,onChange:e,id:t,name:i,disabled:a,required:l,ariaLabel:u,ariaLabelledby:h,ariaDescribedby:f,size:g="default",variant:_="simple",className:S}){const C=O=>{a||e(O.target.checked)},N=on("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:on("group relative inline-flex h-5 w-10 shrink-0 items-center justify-center rounded-full outline-offset-2 outline-indigo-600 has-focus-visible:outline-2 dark:outline-indigo-500",a&&"opacity-60",S),children:[c.jsx("span",{className:on("absolute mx-auto h-4 w-9 rounded-full bg-gray-200 inset-ring inset-ring-gray-900/5 transition-colors duration-200 ease-in-out dark:bg-gray-800/50 dark:inset-ring-white/10",n&&"bg-indigo-600 dark:bg-indigo-500")}),c.jsx("span",{className:on("absolute left-0 size-5 rounded-full border border-gray-300 bg-white shadow-xs transition-transform duration-200 ease-in-out dark:shadow-none",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:N})]}):c.jsxs("div",{className:on("group relative inline-flex w-11 shrink-0 rounded-full bg-gray-200 p-0.5 inset-ring inset-ring-gray-900/5 outline-offset-2 outline-indigo-600 transition-colors duration-200 ease-in-out has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-indigo-500",n&&"bg-indigo-600 dark:bg-indigo-500",a&&"opacity-60",S),children:[_==="icon"?c.jsxs("span",{className:on("relative size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",n&&"translate-x-5"),children:[c.jsx("span",{"aria-hidden":"true",className:on("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-in",n?"opacity-0 duration-100":"opacity-100 duration-200"),children:c.jsx("svg",{fill:"none",viewBox:"0 0 12 12",className:"size-3 text-gray-400 dark:text-gray-600",children:c.jsx("path",{d:"M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}),c.jsx("span",{"aria-hidden":"true",className:on("absolute inset-0 flex size-full items-center justify-center transition-opacity ease-out",n?"opacity-100 duration-200":"opacity-0 duration-100"),children:c.jsx("svg",{fill:"currentColor",viewBox:"0 0 12 12",className:"size-3 text-indigo-600 dark:text-indigo-500",children:c.jsx("path",{d:"M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z"})})})]}):c.jsx("span",{className:on("size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:N})]})}function wa({label:n,description:e,labelPosition:t="left",id:i,className:a,...l}){const u=p.useId(),h=i??`sw-${u}`,f=`${h}-label`,g=`${h}-desc`;return t==="right"?c.jsxs("div",{className:on("flex items-center justify-between gap-3",a),children:[c.jsx(Bg,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0}),c.jsxs("div",{className:"text-sm",children:[c.jsx("label",{id:f,htmlFor:h,className:"font-medium text-gray-900 dark:text-white",children:n})," ",e?c.jsx("span",{id:g,className:"text-gray-500 dark:text-gray-400",children:e}):null]})]}):c.jsxs("div",{className:on("flex items-center justify-between",a),children:[c.jsxs("span",{className:"flex grow flex-col",children:[c.jsx("label",{id:f,htmlFor:h,className:"text-sm/6 font-medium text-gray-900 dark:text-white",children:n}),e?c.jsx("span",{id:g,className:"text-sm text-gray-500 dark:text-gray-400",children:e}):null]}),c.jsx(Bg,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const bu=new Map;let D1=!1;function _A(){D1||(D1=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const n of bu.values())n.es&&(n.es.close(),n.es=null,n.dispatchers.clear());else for(const n of bu.values())n.refs>0&&!n.es&&Mw(n)}))}function Mw(n){if(!n.es&&!document.hidden){n.es=new EventSource(n.url);for(const[e,t]of n.listeners.entries()){const i=a=>{let l=null;try{l=JSON.parse(String(a.data??"null"))}catch{return}for(const u of t)u(l)};n.dispatchers.set(e,i),n.es.addEventListener(e,i)}n.es.onerror=()=>{}}}function wA(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function TA(n){let e=bu.get(n);return e||(e={url:n,es:null,refs:0,listeners:new Map,dispatchers:new Map},bu.set(n,e)),e}function ud(n,e,t){_A();const i=TA(n);let a=i.listeners.get(e);if(a||(a=new Set,i.listeners.set(e,a)),a.add(t),i.refs+=1,i.es){if(!i.dispatchers.has(e)){const l=u=>{let h=null;try{h=JSON.parse(String(u.data??"null"))}catch{return}for(const f of i.listeners.get(e)??[])f(h)};i.dispatchers.set(e,l),i.es.addEventListener(e,l)}}else Mw(i);return()=>{const l=bu.get(n);if(!l)return;const u=l.listeners.get(e);u&&(u.delete(t),u.size===0&&l.listeners.delete(e)),l.refs=Math.max(0,l.refs-1),l.refs===0&&(wA(l),bu.delete(n))}}async function SA(n,e){const t=await fetch(n,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const a=i&&(i.error||i.message)||t.statusText;throw new Error(a)}return i}const kA="/api/stream",EA="state";function M1({startUrl:n,stopUrl:e,onTrigger:t,title:i="Task",description:a="Startet eine Hintergrundaufgabe. Fortschritt & Abbrechen oben in der Taskliste.",startLabel:l="Start",startingLabel:u="Starte…",disabled:h=!1,busy:f=!1,onFinished:g,onStart:_,onProgress:S,onDone:C,onCancelled:N,onError:O}){const[E,B]=p.useState(null),[H,Y]=p.useState(!1),[U,re]=p.useState(null),W=p.useRef(null),X=p.useRef(!1),R=p.useRef(!1),le=p.useRef(!1),k=p.useRef(!1),j=p.useRef(""),Z=p.useRef(S),V=p.useRef(O);p.useEffect(()=>{Z.current=S},[S]),p.useEffect(()=>{V.current=O},[O]);async function ne(){if(e&&!le.current){le.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{le.current=!1}}}function me(){if(W.current)return W.current;const Q=new AbortController;W.current=Q;const te=()=>{R.current=!0,ne()};return Q.signal.addEventListener("abort",te,{once:!0}),Q}function ue(Q){X.current||(X.current=!0,_?.(Q))}p.useEffect(()=>{const Q=k.current,te=!!E?.running;if(k.current=te,Q&&!te){const ge=String(E?.error??"").trim();W.current=null,X.current=!1,R.current||ge==="abgebrochen"?(R.current=!1,N?.()):ge||C?.(),g?.()}},[E?.running,E?.error,g,C,N]),p.useEffect(()=>{if(t||!n)return;const Q=ud(kA,EA,te=>{if(B(te),te?.running){const L=me();ue(L),Z.current?.({done:te?.done??0,total:te?.total??0,currentFile:te?.currentFile??""})}const ge=String(te?.error??"").trim();ge&&ge!=="abgebrochen"&&ge!==j.current&&(j.current=ge,V.current?.(ge))});return()=>Q()},[n,t]);async function q(){if(f||E?.running)return;if(re(null),Y(!0),R.current=!1,j.current="",t){try{await t()}catch(te){const ge=te?.message??String(te);re(ge),O?.(ge)}finally{Y(!1)}return}if(!n){const te="Task ist nicht konfiguriert (startUrl fehlt).";re(te),O?.(te),Y(!1);return}const Q=me();try{const te=await SA(n,{method:"POST"});B(te),ue(Q),te?.running&&S?.({done:te?.done??0,total:te?.total??0,currentFile:te?.currentFile??""})}catch(te){W.current=null,X.current=!1;const ge=te?.message??String(te);re(ge),O?.(ge)}finally{Y(!1)}}const P=!!E?.running;return c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:i}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:a}),U?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:U}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(sn,{variant:"primary",onClick:q,disabled:h||f||H||P,children:H||f?u:l})})]})}function CA(n,e){const t=Number(n??0),i=Number(e??0);return!i||i<=0?0:Math.max(0,Math.min(100,Math.round(t/i*100)))}function AA({tasks:n,onCancel:e}){const t=(n||[]).filter(i=>i.status!=="idle");return c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsx("div",{className:"flex items-start justify-between gap-3",children:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Hintergrundaufgaben"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Laufende Hintergrundaufgaben (z.B. Assets/Previews)."})]})}),c.jsxs("div",{className:"mt-3 space-y-3",children:[t.length===0?c.jsx("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 text-sm text-gray-600 dark:border-white/10 dark:bg-white/5 dark:text-gray-300",children:"Keine laufenden Aufgaben."}):null,t.map(i=>{const a=CA(i.done,i.total),l=i.status==="running",u=l&&(i.total??0)>0,h=(i.title??"").trim(),f=(i.text??"").trim();return c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white px-3 py-2 dark:border-white/10 dark:bg-white/5 transition-opacity duration-500 "+(i.fading?"opacity-0":"opacity-100"),children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"shrink-0",children:l&&i.cancellable&&e?c.jsx("button",{type:"button",onClick:()=>e?.(i.id),className:`inline-flex h-7 w-7 items-center justify-center rounded-md\r text-red-700 hover:bg-red-50 hover:text-red-900\r dark:text-red-300 dark:hover:bg-red-500/10 dark:hover:text-red-200`,title:"Abbrechen","aria-label":"Task abbrechen",children:"✕"}):i.status==="done"?c.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-green-700 dark:text-green-300",title:"Fertig","aria-label":"Fertig",children:"✓"}):c.jsx("span",{className:"inline-block h-7 w-7"})}),c.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[c.jsxs("div",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",children:[h||"Aufgabe",f?c.jsxs("span",{className:"font-normal text-gray-600 dark:text-gray-300",children:[" · ",f]}):null]}),i.status==="done"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-[11px] font-semibold text-green-800 ring-1 ring-inset ring-green-200 dark:bg-green-500/20 dark:text-green-200 dark:ring-green-400/30",children:"fertig"}):i.status==="cancelled"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10",children:"abgebrochen"}):i.status==="error"?c.jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-red-100 px-2 py-0.5 text-[11px] font-semibold text-red-800 ring-1 ring-inset ring-red-200 dark:bg-red-500/20 dark:text-red-200 dark:ring-red-400/30",children:"fehler"}):null,c.jsx("div",{className:"flex-1"}),u?c.jsxs("div",{className:"shrink-0 flex items-center gap-3 text-xs text-gray-600 dark:text-gray-300",children:[c.jsxs("span",{className:"tabular-nums",children:[i.done??0,"/",i.total??0]}),c.jsxs("span",{className:"tabular-nums",children:[a,"%"]}),c.jsx("div",{className:"hidden sm:block h-2 w-40 overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:c.jsx("div",{className:"h-full bg-indigo-500",style:{width:`${a}%`}})})]}):null]})]}),i.status==="error"&&i.err?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:i.err}):null]},i.id)})]})]})}function NA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}const DA=p.forwardRef(NA);function MA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const j1=p.forwardRef(MA);function jA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"}))}const RA=p.forwardRef(jA);function OA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"}))}const Kh=p.forwardRef(OA);function LA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"}))}const IA=p.forwardRef(LA);function BA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"}))}const PA=p.forwardRef(BA);function FA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0 1 20.25 6v12A2.25 2.25 0 0 1 18 20.25H6A2.25 2.25 0 0 1 3.75 18V6A2.25 2.25 0 0 1 6 3.75h1.5m9 0h-9"}))}const R1=p.forwardRef(FA);function UA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"}))}const Ep=p.forwardRef(UA);function zA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const $A=p.forwardRef(zA);function HA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const qA=p.forwardRef(HA);function VA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"}))}const GA=p.forwardRef(VA);function KA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))}const WA=p.forwardRef(KA);function XA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const xf=p.forwardRef(XA);function YA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z"}))}const O1=p.forwardRef(YA);function QA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const ed=p.forwardRef(QA);function ZA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Zm6-10.125a1.875 1.875 0 1 1-3.75 0 1.875 1.875 0 0 1 3.75 0Zm1.294 6.336a6.721 6.721 0 0 1-3.17.789 6.721 6.721 0 0 1-3.168-.789 3.376 3.376 0 0 1 6.338 0Z"}))}const JA=p.forwardRef(ZA);function eN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"}))}const tN=p.forwardRef(eN);function nN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"}))}const iN=p.forwardRef(nN);function rN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"}))}const sN=p.forwardRef(rN);function aN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const L1=p.forwardRef(aN);function oN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const lN=p.forwardRef(oN);function uN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}const cN=p.forwardRef(uN);function dN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"}))}const hN=p.forwardRef(dN);function fN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const Cp=p.forwardRef(fN);function mN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"}))}const pN=p.forwardRef(mN);function gN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const _f=p.forwardRef(gN);function yN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.375 19.5h17.25m-17.25 0a1.125 1.125 0 0 1-1.125-1.125M3.375 19.5h7.5c.621 0 1.125-.504 1.125-1.125m-9.75 0V5.625m0 12.75v-1.5c0-.621.504-1.125 1.125-1.125m18.375 2.625V5.625m0 12.75c0 .621-.504 1.125-1.125 1.125m1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125m0 3.75h-7.5A1.125 1.125 0 0 1 12 18.375m9.75-12.75c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125m19.5 0v1.5c0 .621-.504 1.125-1.125 1.125M2.25 5.625v1.5c0 .621.504 1.125 1.125 1.125m0 0h17.25m-17.25 0h7.5c.621 0 1.125.504 1.125 1.125M3.375 8.25c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125m17.25-3.75h-7.5c-.621 0-1.125.504-1.125 1.125m8.625-1.125c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125M12 10.875v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 10.875c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125M13.125 12h7.5m-7.5 0c-.621 0-1.125.504-1.125 1.125M20.625 12c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125m-17.25 0h7.5M12 14.625v-1.5m0 1.5c0 .621-.504 1.125-1.125 1.125M12 14.625c0 .621.504 1.125 1.125 1.125m-2.25 0c.621 0 1.125.504 1.125 1.125m0 1.5v-1.5m0 0c0-.621.504-1.125 1.125-1.125m0 0h7.5"}))}const bN=p.forwardRef(yN);function vN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const I1=p.forwardRef(vN);function xN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"}))}const B1=p.forwardRef(xN);function _N({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const wN=p.forwardRef(_N);function TN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const wf=p.forwardRef(TN);function pr(...n){return n.filter(Boolean).join(" ")}function Tf({open:n,onClose:e,title:t,children:i,footer:a,icon:l,width:u="max-w-lg",layout:h="single",left:f,leftWidthClass:g="lg:w-80",scroll:_,bodyClassName:S,leftClassName:C,rightClassName:N,rightHeader:O,rightBodyClassName:E,mobileCollapsedImageSrc:B,mobileCollapsedImageAlt:H}){const Y=_??(h==="split"?"right":"body"),U=p.useRef(null),[re,W]=p.useState(!1);return p.useEffect(()=>{if(!n)return;const X=document.documentElement,R=document.body,le=X.style.overflow,k=R.style.overflow,j=R.style.paddingRight,Z=window.innerWidth-X.clientWidth;return X.style.overflow="hidden",R.style.overflow="hidden",Z>0&&(R.style.paddingRight=`${Z}px`),()=>{X.style.overflow=le,R.style.overflow=k,R.style.paddingRight=j}},[n]),p.useEffect(()=>{n&&W(!1)},[n]),p.useEffect(()=>{if(!n)return;const X=U.current;if(!X)return;const R=72,le=()=>{const k=X.scrollTop||0;W(j=>{const Z=k>R;return j===Z?j:Z})};return le(),X.addEventListener("scroll",le,{passive:!0}),()=>X.removeEventListener("scroll",le)},[n]),c.jsx(Jc,{show:n,as:p.Fragment,children:c.jsxs(au,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(Jc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:c.jsx("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/50"})}),c.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden px-4 py-6 sm:px-6",children:c.jsx("div",{className:"min-h-full flex items-start justify-center sm:items-center",children:c.jsx(Jc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:c.jsxs(au.Panel,{className:pr("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",u),children:[l?c.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:l}):null,c.jsxs("div",{className:pr("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",h==="split"?"hidden lg:flex":"flex"),children:[c.jsx("div",{className:"min-w-0",children:t?c.jsx(au.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]}),h==="single"?c.jsx("div",{className:pr("flex-1 min-h-0 h-full",Y==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",N),children:i}):c.jsxs("div",{className:pr("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",S),children:[c.jsxs("div",{ref:U,className:pr("lg:hidden flex-1 min-h-0 relative",Y==="right"||Y==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:pr("sticky top-0 z-50","bg-white/95 backdrop-blur dark:bg-gray-800/95","border-b border-gray-200/70 dark:border-white/10"),children:[c.jsxs("div",{className:pr("flex items-center justify-between gap-3 px-3",re?"py-2":"py-3"),children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[B?c.jsx("img",{src:B,alt:H||t||"",className:pr("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",re?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0",children:t?c.jsx("div",{className:pr("truncate font-semibold text-gray-900 dark:text-white",re?"text-sm":"text-base"),children:t}):null})]}),c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]}),O?c.jsx("div",{children:O}):null]}),f?c.jsx("div",{className:pr("lg:hidden px-2 pb-2",C),children:f}):null,c.jsx("div",{className:pr("px-2 pt-0 min-h-0",N),children:c.jsx("div",{className:pr("min-h-0",E),children:i})})]}),c.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[c.jsx("div",{className:pr("min-h-0",g,"shrink-0","overflow-hidden",C),children:f}),c.jsxs("div",{className:pr("flex-1 min-h-0 flex flex-col",N),children:[O?c.jsx("div",{className:"shrink-0",children:O}):null,c.jsx("div",{className:pr("flex-1 min-h-0",Y==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",E),children:i})]})]})]}),a?c.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:a}):null]})})})})]})})}function jw(n,e){const t=Number(n);return Number.isFinite(t)&&t>0?Math.floor(t):e}function SN(n){const e=(n.user||"").trim()||"postgres",t=(n.host||"").trim()||"127.0.0.1",i=jw(n.port,5432),a=(n.db||"").trim()||"postgres",l=(n.sslmode||"").trim()||"disable";return`postgres://${encodeURIComponent(e)}@${t}:${i}/${encodeURIComponent(a)}?sslmode=${encodeURIComponent(l)}`}function kN({open:n,onClose:e,initialUrl:t,initialHasPassword:i,onApply:a}){const[l,u]=p.useState("127.0.0.1"),[h,f]=p.useState(5432),[g,_]=p.useState("nsfwapp"),[S,C]=p.useState("postgres"),[N,O]=p.useState(""),[E,B]=p.useState("disable"),H=p.useMemo(()=>SN({user:S,host:l,port:h,db:g,sslmode:E}),[S,l,h,g,E]),Y=c.jsxs(c.Fragment,{children:[c.jsx(sn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(sn,{variant:"primary",onClick:()=>{a({databaseUrl:H,dbPassword:N}),e()},children:"Übernehmen"})]});return c.jsx(Tf,{open:n,onClose:e,title:"Postgres URL erstellen",width:"max-w-2xl",footer:Y,children:c.jsxs("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6 space-y-4",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Passwort wird ",c.jsx("span",{className:"font-semibold",children:"verschlüsselt"})," gespeichert (nicht in der URL).",t?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"mt-1",children:["Aktuelle URL: ",c.jsx("code",{className:"break-all",children:t})]})}):null,i?c.jsx("div",{className:"mt-1",children:"Passwort: ✅ gespeichert"}):null]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Host"}),c.jsx("input",{value:l,onChange:U=>u(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"127.0.0.1"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Port"}),c.jsx("input",{type:"number",min:1,max:65535,value:h,onChange:U=>f(jw(U.target.value,5432)),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Datenbank"}),c.jsx("input",{value:g,onChange:U=>_(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"nsfwapp"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"User"}),c.jsx("input",{value:S,onChange:U=>C(U.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"postgres"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Passwort"}),c.jsx("input",{value:N,onChange:U=>O(U.target.value),type:"password",className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"••••••••"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"SSL"}),c.jsxs("select",{value:E,onChange:U=>B(U.target.value),className:`sm:col-span-9 h-10 rounded-lg px-3 text-sm bg-white text-gray-900 ring-1 ring-gray-200 shadow-sm\r dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"disable",children:"disable"}),c.jsx("option",{value:"require",children:"require"}),c.jsx("option",{value:"verify-full",children:"verify-full"})]})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 text-xs text-gray-700 dark:border-white/10 dark:bg-white/5 dark:text-gray-200",children:[c.jsx("div",{className:"font-semibold mb-1",children:"Vorschau"}),c.jsx("code",{className:"break-all",children:H})]})]})})}function EN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.74a.75.75 0 0 1 1.04-.207Z",clipRule:"evenodd"}))}const Rw=p.forwardRef(EN);function CN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),p.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const gl=p.forwardRef(CN);function AN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.176 7.547 7.547 0 0 1-1.705-1.715.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.546 3.75 3.75 0 0 1 3.255 3.718Z",clipRule:"evenodd"}))}const Pg=p.forwardRef(AN);function NN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M7.493 18.5c-.425 0-.82-.236-.975-.632A7.48 7.48 0 0 1 6 15.125c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75A.75.75 0 0 1 15 2a2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23h-.777ZM2.331 10.727a11.969 11.969 0 0 0-.831 4.398 12 12 0 0 0 .52 3.507C2.28 19.482 3.105 20 3.994 20H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 0 1-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227Z"}))}const DN=p.forwardRef(NN);function MN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z"}))}const yl=p.forwardRef(MN);function jN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M6.75 5.25a.75.75 0 0 1 .75-.75H9a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H7.5a.75.75 0 0 1-.75-.75V5.25Zm7.5 0A.75.75 0 0 1 15 4.5h1.5a.75.75 0 0 1 .75.75v13.5a.75.75 0 0 1-.75.75H15a.75.75 0 0 1-.75-.75V5.25Z",clipRule:"evenodd"}))}const RN=p.forwardRef(jN);function ON({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.427 1.529-2.33 2.779-1.643l11.54 6.347c1.295.712 1.295 2.573 0 3.286L7.28 19.99c-1.25.687-2.779-.217-2.779-1.643V5.653Z",clipRule:"evenodd"}))}const LN=p.forwardRef(ON);function IN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.636 4.575a.75.75 0 0 1 0 1.061 9 9 0 0 0 0 12.728.75.75 0 1 1-1.06 1.06c-4.101-4.1-4.101-10.748 0-14.849a.75.75 0 0 1 1.06 0Zm12.728 0a.75.75 0 0 1 1.06 0c4.101 4.1 4.101 10.75 0 14.85a.75.75 0 1 1-1.06-1.061 9 9 0 0 0 0-12.728.75.75 0 0 1 0-1.06ZM7.757 6.697a.75.75 0 0 1 0 1.06 6 6 0 0 0 0 8.486.75.75 0 0 1-1.06 1.06 7.5 7.5 0 0 1 0-10.606.75.75 0 0 1 1.06 0Zm8.486 0a.75.75 0 0 1 1.06 0 7.5 7.5 0 0 1 0 10.606.75.75 0 0 1-1.06-1.06 6 6 0 0 0 0-8.486.75.75 0 0 1 0-1.06ZM9.879 8.818a.75.75 0 0 1 0 1.06 3 3 0 0 0 0 4.243.75.75 0 1 1-1.061 1.061 4.5 4.5 0 0 1 0-6.364.75.75 0 0 1 1.06 0Zm4.242 0a.75.75 0 0 1 1.061 0 4.5 4.5 0 0 1 0 6.364.75.75 0 0 1-1.06-1.06 3 3 0 0 0 0-4.243.75.75 0 0 1 0-1.061ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))}const BN=p.forwardRef(IN);function PN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}const vu=p.forwardRef(PN);function FN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const UN=p.forwardRef(FN),Wi={databaseUrl:"",hasDbPassword:!1,recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!0,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!0,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:5,enableNotifications:!0};function zN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function $N({onAssetsGenerated:n}){const[e,t]=p.useState(Wi),[i,a]=p.useState(!1),[l,u]=p.useState(0),h=p.useRef(null),[f,g]=p.useState(!1),[_,S]=p.useState(null),[C,N]=p.useState(null),[O,E]=p.useState(null),[B,H]=p.useState(null),Y=p.useRef(null),[U,re]=p.useState(!1),[W,X]=p.useState(""),R=Date.now(),le=l>R,j=i?"saving":le?"success":!!O&&!i&&!le?"error":"idle",Z=j==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:j==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(Rw,{className:"size-4"}),isLoading:!1}:j==="error"?{text:"Fehler",color:"red",icon:c.jsx(UN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[V,ne]=p.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[me,ue]=p.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),q=Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB??5),P=B?.pauseGB??q,Q=B?.resumeGB??q+3;p.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),p.useEffect(()=>{let ye=!0;return fetch("/api/settings",{cache:"no-store"}).then(async be=>{if(!be.ok)throw new Error(await be.text());return be.json()}).then(be=>{ye&&t({databaseUrl:String(be.databaseUrl??""),hasDbPassword:!!(be.hasDbPassword??!1),recordDir:(be.recordDir||Wi.recordDir).toString(),doneDir:(be.doneDir||Wi.doneDir).toString(),ffmpegPath:String(be.ffmpegPath??Wi.ffmpegPath??""),autoAddToDownloadList:be.autoAddToDownloadList??Wi.autoAddToDownloadList,autoStartAddedDownloads:be.autoStartAddedDownloads??Wi.autoStartAddedDownloads,useChaturbateApi:be.useChaturbateApi??Wi.useChaturbateApi,useMyFreeCamsWatcher:be.useMyFreeCamsWatcher??Wi.useMyFreeCamsWatcher,autoDeleteSmallDownloads:be.autoDeleteSmallDownloads??Wi.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:be.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB,blurPreviews:be.blurPreviews??Wi.blurPreviews,teaserPlayback:be.teaserPlayback??Wi.teaserPlayback,teaserAudio:be.teaserAudio??Wi.teaserAudio,lowDiskPauseBelowGB:be.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB,enableNotifications:be.enableNotifications??Wi.enableNotifications})}).catch(()=>{}),()=>{ye=!1}},[]),p.useEffect(()=>{let ye=!0;const be=async()=>{try{const Ke=await fetch("/api/status/disk",{cache:"no-store"});if(!Ke.ok)return;const we=await Ke.json();ye&&H(we)}catch{}};be();const mt=window.setInterval(be,5e3);return()=>{ye=!1,window.clearInterval(mt)}},[]);async function te(ye){E(null),N(null),S(ye);try{window.focus();const be=await fetch(`/api/settings/browse?target=${ye}`,{cache:"no-store"});if(be.status===204)return;if(!be.ok){const we=await be.text().catch(()=>"");throw new Error(we||`HTTP ${be.status}`)}const Ke=((await be.json()).path??"").trim();if(!Ke)return;t(we=>ye==="record"?{...we,recordDir:Ke}:ye==="done"?{...we,doneDir:Ke}:{...we,ffmpegPath:Ke})}catch(be){E(be?.message??String(be))}finally{S(null)}}async function ge(){E(null),N(null);const ye=e.recordDir.trim(),be=e.doneDir.trim(),mt=(e.ffmpegPath??"").trim(),Ke=String(e.databaseUrl??"").trim();if(!ye||!be){E("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const we=!!e.autoAddToDownloadList,Re=we?!!e.autoStartAddedDownloads:!1,ct=!!e.useChaturbateApi,Oe=!!e.useMyFreeCamsWatcher,je=!!e.autoDeleteSmallDownloads,Ue=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB)))),ze=!!e.blurPreviews,gt=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:Wi.teaserPlayback,st=!!e.teaserAudio,bt=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB))),Qe=!!e.enableNotifications;a(!0);try{const Ye=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:Ke,dbPassword:W||void 0,recordDir:ye,doneDir:be,ffmpegPath:mt,autoAddToDownloadList:we,autoStartAddedDownloads:Re,useChaturbateApi:ct,useMyFreeCamsWatcher:Oe,autoDeleteSmallDownloads:je,autoDeleteSmallDownloadsBelowMB:Ue,blurPreviews:ze,teaserPlayback:gt,teaserAudio:st,lowDiskPauseBelowGB:bt,enableNotifications:Qe})});if(!Ye.ok){const $e=await Ye.text().catch(()=>"");throw new Error($e||`HTTP ${Ye.status}`)}N("✅ Gespeichert.");const tt=Date.now()+2500;u(tt),h.current!=null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{u(0),h.current=null},2500),window.dispatchEvent(new CustomEvent("recorder-settings-updated"))}catch(Ye){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),E(Ye?.message??String(Ye))}finally{a(!1)}}function L(ye,be=3500,mt=500){window.setTimeout(()=>{ye(Ke=>({...Ke,fading:!0})),window.setTimeout(()=>{ye(Ke=>({...Ke,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},mt)},be)}async function xe(){E(null),N(null);const ye=Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB??0),be=(e.doneDir||Wi.doneDir).trim();if(!be){E("doneDir ist leer.");return}if(!ye||ye<=0){E("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen: • Löscht Dateien in "${be}" < ${ye} MB (Ordner "keep" wird übersprungen) • Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei Fortfahren?`)){g(!0),ue(Ke=>({...Ke,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const Ke=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!Ke.ok){const Ue=await Ke.text().catch(()=>"");throw new Error(Ue||`HTTP ${Ke.status}`)}const we=await Ke.json(),Re=Number(we.scannedFiles??0),ct=Number(we.orphanIdsRemoved??0),Oe=Number(we.generatedOrphansRemoved??0),je=ct+Oe;ue(Ue=>({...Ue,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Re} · Orphans: ${je}`})),L(ue)}catch(Ke){const we=Ke?.message??String(Ke);E(we),ue(Re=>({...Re,status:"error",text:"Fehler beim Aufräumen.",err:we})),L(ue)}finally{g(!1)}}}async function Te(){const ye=Y.current;if(Y.current=null,ne(be=>({...be,status:"cancelled",text:"Abgebrochen."})),ye){ye.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return c.jsx(Ns,{header:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Einstellungen"}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Recorder-Konfiguration, Automatisierung und Tasks."})]}),c.jsxs("div",{className:"flex items-start gap-2",children:[j!=="success"?c.jsx("div",{className:"hidden sm:flex min-w-0 max-w-[520px] items-stretch",children:O?c.jsx("div",{className:`\r inline-flex items-center\r px-3 py-[7px] text-sm\r rounded-md border border-red-200 bg-red-50 text-red-700\r dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200\r `,children:O}):C?c.jsx("div",{className:`\r inline-flex items-center\r px-3 py-[7px] text-sm\r rounded-md border border-green-200 bg-green-50 text-green-700\r dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200\r `,children:C}):null}):null,c.jsx(sn,{variant:"primary",color:Z.color,onClick:ge,disabled:i,className:"shrink-0",size:"md",isLoading:Z.isLoading,leadingIcon:Z.icon,children:Z.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(AA,{tasks:[V,me],onCancel:ye=>{ye==="generate-assets"&&Te()}}),j!=="success"?c.jsxs("div",{className:"sm:hidden",children:[O&&c.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200",children:O}),C&&c.jsx("div",{className:"rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200",children:C})]}):null,c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsx("div",{className:"flex items-start justify-between gap-4",children:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Aufgaben"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Hintergrundaufgaben wie z.B. Asset/Preview-Generierung."})]})}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(M1,{title:"Assets-Generator",description:"Erzeugt fehlende Assets (thumb/preview/meta). Fortschritt & Abbrechen oben in der Taskliste.",startLabel:"Start",startingLabel:"Starte…",startUrl:"/api/tasks/generate-assets",stopUrl:"/api/tasks/generate-assets",onFinished:n,onStart:ye=>{Y.current=ye,ne(be=>({...be,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:ye=>{const be=zN(ye.currentFile);ne(mt=>({...mt,status:"running",title:"Assets generieren",text:be||"",done:ye.done,total:ye.total}))},onDone:()=>{Y.current=null,ne(ye=>({...ye,status:"done",title:"Assets generieren"})),L(ne)},onCancelled:()=>{Y.current=null,ne(ye=>({...ye,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),L(ne)},onError:ye=>{Y.current=null,ne(be=>({...be,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:ye})),L(ne)}}),c.jsx(M1,{title:"Aufräumen",description:'Löscht Dateien im doneDir kleiner als die Mindestgröße (Ordner "keep" wird übersprungen) und entfernt verwaiste Assets.',startLabel:"Aufräumen",startingLabel:"Läuft…",onTrigger:xe,busy:f,disabled:i||!e.autoDeleteSmallDownloads,onError:ye=>{E(ye)}})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Pfad-Einstellungen"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aufnahme- und Zielverzeichnisse sowie optionaler ffmpeg-Pfad."})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Datenbank"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Postgres Verbindung. Passwort wird verschlüsselt gespeichert."})]}),c.jsx("div",{className:"space-y-3",children:c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Database URL"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:String(e.databaseUrl??""),onChange:ye=>t(be=>({...be,databaseUrl:ye.target.value})),placeholder:"postgres://user@host:5432/db?sslmode=disable",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>re(!0),disabled:i,children:"URL erstellen…"})]})]})})]}),c.jsx(kN,{open:U,onClose:()=>re(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:ye,dbPassword:be})=>{t(mt=>({...mt,databaseUrl:ye})),X(be||"")}}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Aufnahme-Ordner"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.recordDir,onChange:ye=>t(be=>({...be,recordDir:ye.target.value})),placeholder:"records (oder absolut: C:\\records / /mnt/data/records)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("record"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Fertige Downloads nach"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.doneDir,onChange:ye=>t(be=>({...be,doneDir:ye.target.value})),placeholder:"records/done",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("done"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"ffmpeg.exe"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.ffmpegPath??"",onChange:ye=>t(be=>({...be,ffmpegPath:ye.target.value})),placeholder:"Leer = automatisch (FFMPEG_PATH / ffmpeg im PATH)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(sn,{variant:"secondary",onClick:()=>te("ffmpeg"),disabled:i||_!==null,children:"Durchsuchen..."})]})]})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Automatisierung & Anzeige"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Verhalten beim Hinzufügen/Starten sowie Anzeigeoptionen."})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(wa,{checked:!!e.autoAddToDownloadList,onChange:ye=>t(be=>({...be,autoAddToDownloadList:ye,autoStartAddedDownloads:ye?be.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),c.jsx(wa,{checked:!!e.autoStartAddedDownloads,onChange:ye=>t(be=>({...be,autoStartAddedDownloads:ye})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),c.jsx(wa,{checked:!!e.useChaturbateApi,onChange:ye=>t(be=>({...be,useChaturbateApi:ye})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),c.jsx(wa,{checked:!!e.useMyFreeCamsWatcher,onChange:ye=>t(be=>({...be,useMyFreeCamsWatcher:ye})),label:"MyFreeCams Auto-Check (watched)",description:"Geht watched MyFreeCams-Models einzeln durch und startet einen Download. Wenn keine Output-Datei entsteht, ist der Stream nicht öffentlich (offline/away/private) und der Job wird wieder entfernt."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsx(wa,{checked:!!e.autoDeleteSmallDownloads,onChange:ye=>t(be=>({...be,autoDeleteSmallDownloads:ye,autoDeleteSmallDownloadsBelowMB:be.autoDeleteSmallDownloadsBelowMB??50})),label:"Kleine Downloads automatisch löschen",description:"Löscht fertige Downloads automatisch, wenn die Datei kleiner als die eingestellte Mindestgröße ist."}),c.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center "+(e.autoDeleteSmallDownloads?"":"opacity-50 pointer-events-none"),children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Mindestgröße"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Alles darunter wird gelöscht."})]}),c.jsx("div",{className:"sm:col-span-8",children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("input",{type:"number",min:0,step:1,value:e.autoDeleteSmallDownloadsBelowMB??50,onChange:ye=>t(be=>({...be,autoDeleteSmallDownloadsBelowMB:Number(ye.target.value||0)})),className:`h-9 w-32 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r dark:border-white/10 dark:bg-gray-900 dark:text-gray-100`}),c.jsx("span",{className:"shrink-0 text-xs text-gray-600 dark:text-gray-300",children:"MB"})]})})]})]}),c.jsx(wa,{checked:!!e.blurPreviews,onChange:ye=>t(be=>({...be,blurPreviews:ye})),label:"Vorschaubilder blurren",description:"Weichzeichnet Vorschaubilder/Teaser (praktisch auf mobilen Geräten oder im öffentlichen Umfeld)."}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Teaser abspielen"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Standbild spart Leistung. „Bei Hover (Standard)“: Desktop spielt bei Hover ab, Mobile im Viewport. „Alle“ kann viel CPU ziehen."})]}),c.jsxs("div",{className:"sm:col-span-8",children:[c.jsx("label",{className:"sr-only",htmlFor:"teaserPlayback",children:"Teaser abspielen"}),c.jsxs("select",{id:"teaserPlayback",value:e.teaserPlayback??"hover",onChange:ye=>t(be=>({...be,teaserPlayback:ye.target.value})),className:`h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"still",children:"Standbild"}),c.jsx("option",{value:"hover",children:"Bei Hover (Standard)"}),c.jsx("option",{value:"all",children:"Alle"})]})]})]}),c.jsx(wa,{checked:!!e.teaserAudio,onChange:ye=>t(be=>({...be,teaserAudio:ye})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(wa,{checked:!!e.enableNotifications,onChange:ye=>t(be=>({...be,enableNotifications:ye})),label:"Benachrichtigungen",description:"Wenn aktiv, zeigt das Frontend Toasts (z.B. wenn watched Models online/live gehen oder wenn ein queued Model wieder public wird)."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Speicherplatz-Notbremse"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aktiviert automatisch Stop + Autostart-Block bei wenig freiem Speicher (Resume bei +3 GB)."})]}),c.jsx("span",{className:"inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium "+(B?.emergency?"bg-red-100 text-red-800 dark:bg-red-500/20 dark:text-red-200":"bg-green-100 text-green-800 dark:bg-green-500/20 dark:text-green-200"),title:B?.emergency?"Notfallbremse greift gerade":"OK",children:B?.emergency?"AKTIV":"OK"})]}),c.jsxs("div",{className:"mt-3 text-sm text-gray-900 dark:text-gray-200",children:[c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Schwelle:"})," ","Pause unter ",c.jsx("span",{className:"tabular-nums",children:P})," GB"," · ","Resume ab"," ",c.jsx("span",{className:"tabular-nums",children:Q})," ","GB"]}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:B?`Frei: ${B.freeBytesHuman}${B.recordPath?` (Pfad: ${B.recordPath})`:""}`:"Status wird geladen…"}),B?.emergency&&c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:"Notfallbremse greift: laufende Downloads werden gestoppt und Autostart bleibt gesperrt, bis wieder genug frei ist."})]})]})]})]})]})})}function Ap(...n){return n.filter(Boolean).join(" ")}const HN={sm:{btn:"px-2.5 py-1.5 text-sm",icon:"size-5",iconOnly:"h-9 w-9"},md:{btn:"px-3 py-2 text-sm",icon:"size-5",iconOnly:"h-10 w-10"},lg:{btn:"px-3.5 py-2.5 text-sm",icon:"size-5",iconOnly:"h-11 w-11"}};function Fg({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=HN[i];return c.jsx("span",{className:Ap("isolate inline-flex rounded-md shadow-xs dark:shadow-none ring-1 ring-gray-300 dark:ring-gray-700 overflow-hidden",a),role:"group","aria-label":l,children:n.map((h,f)=>{const g=h.id===e,_=f===0,S=f===n.length-1,C=!h.label&&!!h.icon;return c.jsxs("button",{type:"button",disabled:h.disabled,onClick:()=>t(h.id),"aria-pressed":g,className:Ap("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!_&&"before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-gray-300 dark:before:bg-gray-700",_&&"rounded-l-md",S&&"rounded-r-md",g?"bg-indigo-100 text-indigo-800 hover:bg-indigo-200 dark:bg-indigo-500/40 dark:text-indigo-100 dark:hover:bg-indigo-500/50":"bg-white text-gray-900 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:hover:bg-white/20","disabled:opacity-50 disabled:cursor-not-allowed",C?`p-0 ${u.iconOnly}`:u.btn),title:typeof h.label=="string"?h.label:h.srLabel,children:[C&&h.srLabel?c.jsx("span",{className:"sr-only",children:h.srLabel}):null,h.icon?c.jsx("span",{className:Ap("shrink-0",C?"":"-ml-0.5",g?"text-indigo-600 dark:text-indigo-200":"text-gray-400 dark:text-gray-500"),children:h.icon}):null,h.label?c.jsx("span",{className:h.icon?"ml-1.5":"",children:h.label}):null]},h.id)})})}function qN(...n){return n.filter(Boolean).join(" ")}function VN(){if(typeof document>"u")return null;const n="__swipecard_hot_fx_layer__";let e=document.getElementById(n);return e||(e=document.createElement("div"),e.id=n,e.style.position="fixed",e.style.inset="0",e.style.pointerEvents="none",e.style.zIndex="2147483647",e.style.contain="layout style paint",document.body.appendChild(e)),e}const GN=p.forwardRef(function({children:e,enabled:t=!0,disabled:i=!1,onTap:a,onSwipeLeft:l,onSwipeRight:u,className:h,thresholdPx:f=140,thresholdRatio:g=.28,ignoreFromBottomPx:_=72,ignoreSelector:S="[data-swipe-ignore]",snapMs:C=180,commitMs:N=180,tapIgnoreSelector:O="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:E,hotTargetSelector:B="[data-hot-target]",doubleTapMs:H=360,doubleTapMaxMovePx:Y=48},U){const re=p.useRef(null),W=p.useRef(!1),X=p.useRef(0),R=p.useRef(null),le=p.useRef(0),k=p.useRef(null),j=p.useRef(null),Z=p.useRef(null),V=p.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[ne,me]=p.useState(0),[ue,q]=p.useState(null),[P,Q]=p.useState(0),te=p.useCallback(()=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0,re.current&&(re.current.style.touchAction="pan-y"),Q(C),me(0),q(null),window.setTimeout(()=>Q(0),C)},[C]),ge=p.useCallback(async(Oe,je)=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),re.current&&(re.current.style.touchAction="pan-y");const ze=re.current?.offsetWidth||360;Q(N),q(Oe==="right"?"right":"left");const gt=Oe==="right"?ze+40:-(ze+40);X.current=gt,me(gt);let st;je?st=Promise.resolve(Oe==="right"?u():l()).catch(()=>!1):st=Promise.resolve(!0);const bt=new Promise(Ye=>{window.setTimeout(Ye,N)}),[,Qe]=await Promise.all([bt,st]);return Qe===!1?(Q(C),q(null),me(0),window.setTimeout(()=>Q(0),C),!1):!0},[N,l,u,C]),L=p.useCallback(()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),xe=p.useCallback(()=>{R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0,Q(0),me(0),q(null);try{const Oe=re.current;Oe&&(Oe.style.touchAction="pan-y")}catch{}},[]),Te=p.useCallback((Oe,je)=>{const Ue=k.current,ze=re.current;if(!Ue||!ze)return;const gt=VN();if(!gt)return;let st=typeof Oe=="number"?Oe:window.innerWidth/2,bt=typeof je=="number"?je:window.innerHeight/2;const Qe=B?k.current?.querySelector(B)??ze.querySelector(B):null;let Ye=st,tt=bt;if(Qe){const Zt=Qe.getBoundingClientRect();Ye=Zt.left+Zt.width/2,tt=Zt.top+Zt.height/2}const $e=Ye-st,ht=tt-bt,At=document.createElement("div");At.style.position="absolute",At.style.left=`${st}px`,At.style.top=`${bt}px`,At.style.transform="translate(-50%, -50%)",At.style.pointerEvents="none",At.style.willChange="transform, opacity",At.style.zIndex="2147483647",At.style.lineHeight="1",At.style.userSelect="none",At.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const he=document.createElement("div");he.style.width="30px",he.style.height="30px",he.style.color="#f59e0b",he.style.display="block",At.appendChild(he),gt.appendChild(At);const Ie=ew.createRoot(he);Ie.render(c.jsx(Pg,{className:"w-full h-full","aria-hidden":"true"})),At.getBoundingClientRect();const Le=200,ke=500,Pe=400,et=Le+ke+Pe,kt=Le/et,Lt=(Le+ke)/et,pt=At.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:kt*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:kt},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Lt},{transform:`translate(calc(-50% + ${$e}px), calc(-50% + ${ht}px)) scale(0.85)`,opacity:.95,offset:Lt+(1-Lt)*.75},{transform:`translate(calc(-50% + ${$e}px), calc(-50% + ${ht}px)) scale(0.55)`,opacity:0,offset:1}],{duration:et,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});Qe&&window.setTimeout(()=>{try{Qe.animate([{transform:"translateZ(0) scale(1)",filter:"brightness(1)"},{transform:"translateZ(0) scale(1.10)",filter:"brightness(1.25)",offset:.35},{transform:"translateZ(0) scale(1)",filter:"brightness(1)"}],{duration:260,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)"})}catch{}},Le+ke+Math.round(Pe*.75)),pt.onfinish=()=>{try{Ie.unmount()}catch{}At.remove()}},[B]);p.useEffect(()=>()=>{j.current!=null&&window.clearTimeout(j.current)},[]),p.useImperativeHandle(U,()=>({swipeLeft:Oe=>ge("left",Oe?.runAction??!0),swipeRight:Oe=>ge("right",Oe?.runAction??!0),reset:()=>te()}),[ge,te]);const ye=Math.abs(ne),be=ne===0?null:ne>0?"right":"left",mt=le.current||Math.min(f,(re.current?.offsetWidth||360)*g),Ke=Math.max(0,Math.min(1,ye/Math.max(1,mt))),we=Math.max(0,Math.min(1,ye/Math.max(1,mt*1.35))),Re=Math.max(-6,Math.min(6,ne/28)),ct=ne===0?1:.995;return c.jsx("div",{ref:k,className:qN("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:re,className:"relative",style:{transform:ne!==0?`translate3d(${ne}px,0,0) rotate(${Re}deg) scale(${ct})`:void 0,transition:P?`transform ${P}ms ease`:void 0,touchAction:"pan-y",willChange:ne!==0?"transform":void 0,boxShadow:ne!==0?be==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+Ke*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+Ke*.12})`:void 0,borderRadius:ne!==0?"12px":void 0,filter:ne!==0?`saturate(${1+Ke*.08}) brightness(${1+Ke*.02})`:void 0},onPointerDown:Oe=>{if(!t||i)return;const je=Oe.target;let Ue=!!(O&&je?.closest?.(O));if(S&&je?.closest?.(S))return;let ze=!1;const gt=Oe.currentTarget,bt=Array.from(gt.querySelectorAll("video")).find(ht=>ht.controls);if(bt){const ht=bt.getBoundingClientRect();if(Oe.clientX>=ht.left&&Oe.clientX<=ht.right&&Oe.clientY>=ht.top&&Oe.clientY<=ht.bottom)if(ht.bottom-Oe.clientY<=72)ze=!0,Ue=!0;else{const ke=Oe.clientX-ht.left,Pe=ht.right-Oe.clientX;ke<=64||Pe<=64||(ze=!0,Ue=!0)}}const Ye=Oe.currentTarget.getBoundingClientRect().bottom-Oe.clientY;_&&Ye<=_&&(ze=!0),V.current={id:Oe.pointerId,x:Oe.clientX,y:Oe.clientY,dragging:!1,captured:!1,tapIgnored:Ue,noSwipe:ze};const $e=re.current?.offsetWidth||360;le.current=Math.min(f,$e*g),X.current=0},onPointerMove:Oe=>{if(!t||i||V.current.id!==Oe.pointerId||V.current.noSwipe)return;const je=Oe.clientX-V.current.x,Ue=Oe.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(Ue)>Math.abs(je)&&Math.abs(Ue)>8){V.current.id=null;return}if(Math.abs(je)<12)return;V.current.dragging=!0,Oe.currentTarget.style.touchAction="none",Q(0);try{Oe.currentTarget.setPointerCapture(Oe.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const ze=(Qe,Ye)=>{const tt=Ye*.9,$e=Math.abs(Qe);if($e<=tt)return Qe;const ht=$e-tt,At=tt+ht*.25;return Math.sign(Qe)*At},gt=re.current?.offsetWidth||360;X.current=ze(je,gt),R.current==null&&(R.current=requestAnimationFrame(()=>{R.current=null,me(X.current)}));const st=le.current,bt=je>st?"right":je<-st?"left":null;q(Qe=>{if(Qe===bt)return Qe;if(bt)try{navigator.vibrate?.(10)}catch{}return bt})},onPointerUp:Oe=>{if(!t||i||V.current.id!==Oe.pointerId)return;const je=le.current||Math.min(f,(re.current?.offsetWidth||360)*g),Ue=V.current.dragging,ze=V.current.captured,gt=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,ze)try{Oe.currentTarget.releasePointerCapture(Oe.pointerId)}catch{}if(Oe.currentTarget.style.touchAction="pan-y",!Ue){const bt=Date.now(),Qe=Z.current,Ye=Qe&&Math.hypot(Oe.clientX-Qe.x,Oe.clientY-Qe.y)<=Y;if(!!E&&Qe&&bt-Qe.t<=H&&Ye){if(Z.current=null,L(),W.current)return;W.current=!0;try{Te(Oe.clientX,Oe.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await E?.()}finally{W.current=!1}})()});return}if(gt){Z.current={t:bt,x:Oe.clientX,y:Oe.clientY},L(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null},E?H:0);return}xe(),Z.current={t:bt,x:Oe.clientX,y:Oe.clientY},L(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null,a?.()},E?H:0);return}const st=X.current;R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),st>je?ge("right",!0):st<-je?ge("left",!0):te(),X.current=0},onPointerCancel:Oe=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{Oe.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},R.current!=null&&(cancelAnimationFrame(R.current),R.current=null),X.current=0;try{Oe.currentTarget.style.touchAction="pan-y"}catch{}te()}},children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"relative z-10",children:e}),c.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ne===0?0:.12+we*.18,background:be==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":be==="left"?"linear-gradient(270deg, rgba(244,63,94,0.16) 0%, rgba(244,63,94,0.04) 45%, rgba(0,0,0,0) 100%)":"transparent"}}),c.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ue?1:0,boxShadow:ue==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ue==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function Ow({children:n,content:e}){const t=p.useRef(null),i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null),f=p.useRef(null),g=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},_=()=>{g(),f.current=window.setTimeout(()=>{l(!1),f.current=null},150)},S=()=>{g(),l(!0)},C=()=>{_()},N=()=>{g(),l(!1)},O=()=>{const B=t.current,H=i.current;if(!B||!H)return;const Y=8,U=8,re=B.getBoundingClientRect(),W=H.getBoundingClientRect();let X=re.bottom+Y;if(X+W.height>window.innerHeight-U){const k=re.top-W.height-Y;k>=U?X=k:X=Math.max(U,window.innerHeight-W.height-U)}let le=re.left;le+W.width>window.innerWidth-U&&(le=window.innerWidth-W.width-U),le=Math.max(U,le),h({left:le,top:X})};p.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>O());return()=>cancelAnimationFrame(B)},[a]),p.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>O());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),p.useEffect(()=>()=>g(),[]);const E=()=>typeof e=="function"?e(a,{close:N}):e;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:S,onMouseLeave:C,children:n}),a&&yu.createPortal(c.jsx("div",{ref:i,className:"fixed z-50",style:{left:u?.left??-9999,top:u?.top??-9999,visibility:u?"visible":"hidden"},onMouseEnter:S,onMouseLeave:C,children:c.jsx(Ns,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:E()})}),document.body)]})}const Sf=!0,KN=!1;function cd(n,e){if(!n)return;const t=e?.muted??Sf;n.muted=t,n.defaultMuted=t,n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline","")}function P1(n){return(n||"").split(/[\\/]/).pop()||""}function xu({job:n,getFileName:e,durationSeconds:t,onDuration:i,onResolution:a,animated:l=!1,animatedMode:u="frames",animatedTrigger:h="always",autoTickMs:f=15e3,thumbStepSec:g,thumbSpread:_,thumbSamples:S,clipSeconds:C=.75,clipCount:N=12,variant:O="thumb",className:E,showPopover:B=!0,blur:H=!1,inlineVideo:Y=!1,inlineNonce:U=0,inlineControls:re=!1,inlineLoop:W=!0,assetNonce:X=0,muted:R=Sf,popoverMuted:le=Sf,noGenerateTeaser:k,alwaysLoadStill:j=!1,teaserPreloadEnabled:Z=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:ne,preferScrubProgress:me=!1}){const ue=P1(n.output||"")||e(n.output||""),q=H?"blur-md":"",P=p.useMemo(()=>{const Ne=n?.meta;if(!Ne)return null;if(typeof Ne=="string")try{return JSON.parse(Ne)}catch{return null}return Ne},[n]),[Q,te]=p.useState(null),ge=p.useRef(new Set),L=p.useMemo(()=>!P&&!Q?null:P?Q?{...P,...Q}:P:Q,[P,Q]),xe=p.useMemo(()=>{let Ne=L?.previewClips;if(typeof Ne=="string"){const _t=Ne.trim();if(_t.length>0)try{const $t=JSON.parse(_t);return Array.isArray($t)&&$t.length>0,!0}catch{return!0}}if(Array.isArray(Ne)&&Ne.length>0)return!0;const Tt=L?.preview?.clips;return!!(Array.isArray(Tt)&&Tt.length>0)},[L]),[Te,ye]=p.useState(0),be=p.useMemo(()=>{let Ne=L?.previewClips;if(typeof Ne=="string")try{Ne=JSON.parse(Ne)}catch{Ne=null}!Array.isArray(Ne)&&Array.isArray(L?.preview?.clips)&&(Ne=L.preview.clips);const Tt=Ne;if(!Array.isArray(Tt)||Tt.length===0)return null;let _t=0;const $t=[];for(const Ht of Tt){const yn=Number(Ht?.startSeconds),Xt=Number(Ht?.durationSeconds);if(!Number.isFinite(yn)||yn<0||!Number.isFinite(Xt)||Xt<=0)continue;const On=_t,Vn=_t+Xt;$t.push({start:yn,dur:Xt,cumStart:On,cumEnd:Vn}),_t=Vn}return $t.length?$t:null},[L]),mt=p.useMemo(()=>be?be.map(Ne=>`${Ne.start.toFixed(3)}:${Ne.dur.toFixed(3)}`).join("|"):"",[be]),Ke=(typeof P?.videoWidth=="number"&&Number.isFinite(P.videoWidth)&&P.videoWidth>0?P.videoWidth:void 0)??(typeof n.videoWidth=="number"&&Number.isFinite(n.videoWidth)&&n.videoWidth>0?n.videoWidth:void 0),we=(typeof P?.videoHeight=="number"&&Number.isFinite(P.videoHeight)&&P.videoHeight>0?P.videoHeight:void 0)??(typeof n.videoHeight=="number"&&Number.isFinite(n.videoHeight)&&n.videoHeight>0?n.videoHeight:void 0),Re=(typeof P?.fileSize=="number"&&Number.isFinite(P.fileSize)&&P.fileSize>0?P.fileSize:void 0)??(typeof n.sizeBytes=="number"&&Number.isFinite(n.sizeBytes)&&n.sizeBytes>0?n.sizeBytes:void 0),ct=(typeof P?.fps=="number"&&Number.isFinite(P.fps)&&P.fps>0?P.fps:void 0)??(typeof n.fps=="number"&&Number.isFinite(n.fps)&&n.fps>0?n.fps:void 0),Oe=(typeof L?.durationSeconds=="number"&&Number.isFinite(L.durationSeconds)&&L.durationSeconds>0?L.durationSeconds:void 0)??(typeof n.durationSeconds=="number"&&Number.isFinite(n.durationSeconds)&&n.durationSeconds>0?n.durationSeconds:void 0)??(typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0),je=typeof Oe=="number"&&Number.isFinite(Oe)&&Oe>0?Oe>1440*60?Oe/1e3:Oe:void 0,Ue=typeof je=="number"&&Number.isFinite(je)&&je>0,ze=typeof Ke=="number"&&typeof we=="number"&&Number.isFinite(Ke)&&Number.isFinite(we)&&Ke>0&&we>0,gt={muted:R,playsInline:!0,preload:"metadata"},[st,bt]=p.useState(!0),[Qe,Ye]=p.useState(!0),[tt,$e]=p.useState(!1),[ht,At]=p.useState(!1),[he,Ie]=p.useState(!0),Le=p.useRef(""),ke=p.useRef(""),Pe=p.useRef(null),[et,kt]=p.useState(!1),[Lt,pt]=p.useState(!1),[Zt,qt]=p.useState(!1),[Gt,wt]=p.useState(0),[lt,Yt]=p.useState(!1),kn=Y===!0||Y==="always"?"always":Y==="hover"?"hover":"never",pn=kn==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",xn=Ne=>Ne.startsWith("HOT ")?Ne.slice(4):Ne,rt=p.useMemo(()=>{const Ne=P1(n.output||"")||e(n.output||"");if(!Ne)return"";const Tt=Ne.replace(/\.[^.]+$/,"");return xn(Tt).trim()},[n.output,e]),M=p.useMemo(()=>ue?`/api/record/video?file=${encodeURIComponent(ue)}`:"",[ue]),F=O==="fill"?"w-full h-full":"w-20 h-16",ie=p.useRef(null),De=p.useRef(null),Ve=p.useRef(null),yt=p.useRef({inline:null,teaser:null,clips:null}),Vt=(Ne,Tt)=>{Tt&&yt.current[Ne]!==Tt&&(yt.current[Ne]=Tt,ye(_t=>_t+1))},[Jt,gn]=p.useState(0),[,ln]=p.useState(0),_n=Ne=>Ne<0?0:Ne>1?1:Ne,En=(Ne,Tt,_t=C,$t=!1)=>{if(!Ne)return{ratio:0,globalSec:0,vvDur:0};const Ht=Number(Ne.duration);if(!(Number.isFinite(Ht)&&Ht>0))return{ratio:0,globalSec:0,vvDur:0};const Xt=Number(Ne.currentTime);if(!Number.isFinite(Xt)||Xt<0)return{ratio:0,globalSec:0,vvDur:Ht};const On=be;let Vn=0;if($t&&Array.isArray(On)&&On.length>0){const $n=On[On.length-1];if(Xt>=$n.cumEnd)Vn=typeof Tt=="number"&&Number.isFinite(Tt)&&Tt>0?Tt:$n.start+$n.dur;else{let ji=0,Bi=On.length-1,Yn=0;for(;ji<=Bi;){const Pn=ji+Bi>>1,Ri=On[Pn];if(Xt=Ri.cumEnd)ji=Pn+1;else{Yn=Pn;break}}return Vn=On[Yn].start,{ratio:On.length>0?_n(Yn/On.length):0,globalSec:Math.max(0,Vn),vvDur:Ht}}}return Number.isFinite(_t)&&_t>0?Vn=Math.floor(Xt/_t)*_t:Vn=Xt,{ratio:_n(Math.min(Vn,Ht)/Ht),globalSec:Math.max(0,Vn),vvDur:Ht}},Ut=Ne=>{if(Ne){try{Ne.pause()}catch{}try{Ne.removeAttribute("src"),Ne.src="",Ne.load()}catch{}}};p.useEffect(()=>{At(!1),Ie(!0),te(null),Le.current="",ke.current="",$e(!1)},[rt,X,k]),p.useEffect(()=>{const Ne=Tt=>{const _t=String(Tt?.detail?.file??"");!_t||_t!==ue||(Ut(ie.current),Ut(De.current),Ut(Ve.current))};return window.addEventListener("player:release",Ne),window.addEventListener("player:close",Ne),()=>{window.removeEventListener("player:release",Ne),window.removeEventListener("player:close",Ne)}},[ue]),p.useEffect(()=>{const Ne=Pe.current;if(!Ne)return;const Tt=new IntersectionObserver(_t=>{const $t=!!_t[0]?.isIntersecting;kt($t),$t&&qt(!0)},{threshold:.01,rootMargin:"0px"});return Tt.observe(Ne),()=>Tt.disconnect()},[]),p.useEffect(()=>{const Ne=Pe.current;if(!Ne)return;if(!Z){pt(et);return}let Tt=!0;const _t=new IntersectionObserver($t=>{$t[0]?.isIntersecting&&(pt(!0),Tt&&(Tt=!1,_t.disconnect()))},{threshold:0,rootMargin:V});return _t.observe(Ne),()=>_t.disconnect()},[Z,V,et]),p.useEffect(()=>{if(!l||u!=="frames"||!et||document.hidden)return;const Ne=window.setInterval(()=>wt(Tt=>Tt+1),f);return()=>window.clearInterval(Ne)},[l,u,et,f]);const hn=p.useMemo(()=>{if(!l||u!=="frames"||!Ue)return null;const Ne=je,Tt=Math.max(.25,g??3);if(_){const Ht=Math.max(4,Math.min(S??16,Math.floor(Ne))),yn=Gt%Ht,Xt=Math.max(.1,Ne-Tt),On=Math.min(.25,Xt*.02),Vn=yn/Ht*Xt+On;return Math.min(Ne-.05,Math.max(.05,Vn))}const _t=Math.max(Ne-.1,Tt),$t=Gt*Tt%_t;return Math.min(Ne-.05,Math.max(.05,$t))},[l,u,Ue,je,Gt,g,_,S]),cn=X??0,en=p.useMemo(()=>rt?hn==null?`/api/preview?id=${encodeURIComponent(rt)}&v=${cn}`:`/api/preview?id=${encodeURIComponent(rt)}&t=${hn}&v=${cn}`:"",[rt,hn,cn]),zt=p.useMemo(()=>{if(!rt)return"";const Ne=k?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(rt)}${Ne}&v=${cn}`},[rt,cn,k]),Dt=kn!=="never"&&et&&Qe&&(kn==="always"||kn==="hover"&<),Ot=l&&et&&!document.hidden&&Qe&&!Dt&&(h==="always"||lt)&&(u==="teaser"&&he&&!!zt||u==="clips"&&Ue),Hn=Ue&&typeof je=="number"?je:void 0,Rt=j||et||Zt||pn&<,qn=Lt||et||Zt||pn&<p.useEffect(()=>{let Ne=!1;if(i&&Ue){const Tt=Number(je),_t=`${ue}|dur|${Tt}`;Le.current!==_t&&(Le.current=_t,i(n,Tt),Ne=!0)}if(a&&ze){const Tt=Number(Ke),_t=Number(we),$t=`${ue}|res|${Tt}x${_t}`;ke.current!==$t&&(ke.current=$t,a(n,Tt,_t),Ne=!0)}Ne&&$e(!0)},[ue,n,i,a,Ue,ze,je,Ke,we]),p.useEffect(()=>{if(!rt||!ue||!l||u!=="teaser"||!qn||xe||ge.current.has(ue))return;let Ne=!1;const Tt=new AbortController,_t=async $t=>{try{const Ht=await fetch($t,{signal:Tt.signal,cache:"no-store",credentials:"include"});return Ht.ok?await Ht.json():null}catch{return null}};return(async()=>{const $t=await _t(`/api/record/done/meta?file=${encodeURIComponent(ue)}`);Ne||(ge.current.add(ue),$t&&te($t))})(),()=>{Ne=!0,Tt.abort()}},[rt,ue,l,u,qn,xe]);const _i=Ne=>{$e(!0);const Tt=Ne.currentTarget;if(i&&!Ue){const _t=Number(Tt.duration);if(Number.isFinite(_t)&&_t>0){const $t=`${ue}|dur|${_t}`;Le.current!==$t&&(Le.current=$t,i(n,_t))}}if(a&&!ze){const _t=Number(Tt.videoWidth),$t=Number(Tt.videoHeight);if(Number.isFinite(_t)&&Number.isFinite($t)&&_t>0&&$t>0){const Ht=`${ue}|res|${_t}x${$t}`;ke.current!==Ht&&(ke.current=Ht,a(n,_t,$t))}}};if(p.useEffect(()=>{bt(!0),Ye(!0),yt.current.inline=null,yt.current.teaser=null,yt.current.clips=null},[rt,X]),!M)return c.jsx("div",{className:[F,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Mn=qn,Wt=l&&u==="teaser"&&he&&!!zt&&!Dt&&qn,zn=Dt?ie:!Dt&&Ot&&u==="teaser"?De:!Dt&&Ot&&u==="clips"?Ve:null,Kn=!!zn&&et,jn=Dt?"inline":Ot&&u==="teaser"?"teaser":"clips",Wn=l&&u==="frames"&&Ue&&typeof hn=="number"&&Number.isFinite(hn)&&hn>=0,Cn=Wn?_n(hn/je):0,fi=!Dt&&me&&typeof ne=="number"&&Number.isFinite(ne),Xn=fi?_n(ne):Kn?Jt:Wn?Cn:0,_e=!Dt&&(fi||(Kn||Wn)),at=p.useMemo(()=>{if(!Ue)return null;const Ne=je;if(!(Ne>0))return null;let _t=L?.previewClips;if(typeof _t=="string")try{_t=JSON.parse(_t)}catch{_t=null}if(!Array.isArray(_t)||_t.length===0)return null;const $t=_t.map(Ht=>({start:Number(Ht?.startSeconds),dur:Number(Ht?.durationSeconds)})).filter(Ht=>Number.isFinite(Ht.start)&&Ht.start>=0&&Number.isFinite(Ht.dur)&&Ht.dur>0);return $t.length?$t.map(Ht=>{const yn=_n(Ht.start/Ne),Xt=_n(Ht.dur/Ne);return{left:yn,width:Xt,start:Ht.start,dur:Ht.dur}}):null},[L,Ue,je]),Ct=p.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Ue)return[];const Ne=je,Tt=Math.max(.25,C),_t=Math.max(8,Math.min(N??S??12,Math.floor(Ne))),$t=Math.max(.1,Ne-Tt),Ht=Math.min(.25,$t*.02),yn=[];for(let Xt=0;Xt<_t;Xt++){const On=Xt/_t*$t+Ht;yn.push(Math.min(Ne-.05,Math.max(.05,On)))}return yn},[l,u,Ue,je,S,C,N]),St=p.useMemo(()=>Ct.map(Ne=>Ne.toFixed(2)).join(","),[Ct]),Pt=p.useRef(0),tn=p.useRef(0);p.useEffect(()=>{const Ne=De.current;if(!Ne)return;if(!(Ot&&u==="teaser")){try{Ne.pause()}catch{}return}cd(Ne,{muted:R});const _t=Ne.play?.();_t&&typeof _t.catch=="function"&&_t.catch(()=>{})},[Ot,u,zt,R]),p.useEffect(()=>{if(!Kn){gn(0),ln(0);return}const Ne=zn?.current??null;if(!Ne){gn(0),ln(0);return}let Tt=!1,_t=null;const $t=()=>{if(Tt||!Ne.isConnected)return;const Xt=jn==="teaser"&&Array.isArray(be)&&be.length>0,On=En(Ne,Hn,C,Xt);gn(On.ratio),ln(On.globalSec)};$t(),_t=window.setInterval($t,100);const Ht=()=>$t(),yn=()=>$t();return Ne.addEventListener("loadedmetadata",Ht),Ne.addEventListener("durationchange",Ht),Ne.addEventListener("timeupdate",yn),()=>{Tt=!0,_t!=null&&window.clearInterval(_t),Ne.removeEventListener("loadedmetadata",Ht),Ne.removeEventListener("durationchange",Ht),Ne.removeEventListener("timeupdate",yn)}},[Kn,zn,Hn,mt,jn,be,Te]),p.useEffect(()=>{Dt&&cd(ie.current,{muted:R})},[Dt,R]),p.useEffect(()=>{const Ne=Ve.current;if(!Ne)return;if(!(Ot&&u==="clips")){Ot||Ne.pause();return}if(!Ct.length)return;Pt.current=Pt.current%Ct.length,tn.current=Ct[Pt.current];const Tt=()=>{try{Ne.currentTime=tn.current}catch{}const Ht=Ne.play();Ht&&typeof Ht.catch=="function"&&Ht.catch(()=>{})},_t=()=>Tt(),$t=()=>{if(Ct.length&&Ne.currentTime-tn.current>=C){Pt.current=(Pt.current+1)%Ct.length,tn.current=Ct[Pt.current];try{Ne.currentTime=tn.current+.01}catch{}}};return Ne.addEventListener("loadedmetadata",_t),Ne.addEventListener("timeupdate",$t),Ne.readyState>=1&&Tt(),()=>{Ne.removeEventListener("loadedmetadata",_t),Ne.removeEventListener("timeupdate",$t),Ne.pause()}},[Ot,u,St,C,Ct]);const wn=(Lt||et)&&(i||a)&&!tt&&!Dt&&(i&&!Ue||a&&!ze),vt=!!at&&(jn==="teaser"||!Dt&&fi&&u==="teaser"),fn=c.jsxs("div",{ref:Pe,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",F,E??""].join(" "),onMouseEnter:pn?()=>Yt(!0):void 0,onMouseLeave:pn?()=>Yt(!1):void 0,onFocus:pn?()=>Yt(!0):void 0,onBlur:pn?()=>Yt(!1):void 0,"data-duration":Ue?String(je):void 0,"data-res":ze?`${Ke}x${we}`:void 0,"data-size":typeof Re=="number"?String(Re):void 0,"data-fps":typeof ct=="number"?String(ct):void 0,children:[Rt&&en&&st?c.jsx("img",{src:en,loading:j?"eager":"lazy",decoding:"async",alt:ue,className:["absolute inset-0 w-full h-full object-cover",q].filter(Boolean).join(" "),onError:()=>bt(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Dt?p.createElement("video",{...gt,ref:Ne=>{ie.current=Ne,Vt("inline",Ne)},key:`inline-${rt}-${U}`,src:M,className:["absolute inset-0 w-full h-full object-cover",q,re?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:R,controls:re,loop:W,poster:Mn&&en||void 0,onLoadedMetadata:_i,onError:()=>Ye(!1)}):null,!Dt&&Wt&&!(Ot&&u==="teaser")?c.jsx("video",{src:zt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>At(!0),onCanPlay:()=>At(!0),onError:()=>{Ie(!1),At(!1)}},`teaser-prewarm-${rt}`):null,!Dt&&Ot&&u==="teaser"?c.jsx("video",{ref:Ne=>{De.current=Ne,Vt("teaser",Ne)},src:zt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q,ht?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:R,playsInline:!0,autoPlay:!0,loop:!0,preload:ht?"auto":"metadata",poster:Mn&&en||void 0,onLoadedData:()=>At(!0),onPlaying:()=>At(!0),onError:()=>{Ie(!1),At(!1)}},`teaser-mp4-${rt}`):null,!Dt&&Ot&&u==="clips"?c.jsx("video",{ref:Ne=>{Ve.current=Ne,Vt("clips",Ne)},src:M,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q].filter(Boolean).join(" "),muted:R,playsInline:!0,preload:"metadata",poster:Mn&&en||void 0,onError:()=>Ye(!1)},`clips-${rt}-${St}`):null,_e?c.jsxs("div",{"aria-hidden":"true",className:["absolute left-0 right-0 bottom-0 z-40 pointer-events-none","h-0.5 group-hover:h-1","transition-[height] duration-150 ease-out","rounded-none group-hover:rounded-full","bg-black/35 dark:bg-white/10","overflow-hidden group-hover:overflow-visible"].join(" "),children:[vt?c.jsx("div",{className:"absolute inset-0",children:at.map((Ne,Tt)=>c.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${Ne.left*100}%`,width:`${Ne.width*100}%`}},`seg-${Tt}-${Ne.left.toFixed(6)}-${Ne.width.toFixed(6)}`))}):null,c.jsx("div",{className:["absolute inset-0 origin-left",jn==="teaser"?"":"transition-transform duration-150 ease-out"].join(" "),style:{transform:`scaleX(${_n(Xn)})`,background:"rgba(99,102,241,0.95)"}})]}):null,wn?c.jsx("video",{src:M,preload:"metadata",muted:R,playsInline:!0,className:"hidden",onLoadedMetadata:_i}):null]});return B?c.jsx(Ow,{content:Ne=>Ne&&c.jsx("div",{className:"w-[420px]",children:c.jsx("div",{className:"aspect-video",children:c.jsx("video",{src:M,className:["w-full h-full bg-black",q].filter(Boolean).join(" "),muted:le,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:Tt=>Tt.stopPropagation(),onMouseDown:Tt=>Tt.stopPropagation()})})}),children:fn}):fn}function Rn(...n){return n.filter(Boolean).join(" ")}const WN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",XN=n=>n.startsWith("HOT ")?n.slice(4):n,YN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function QN(n){const t=XN(WN(n||"")).replace(/\.[^.]+$/,""),i=t.match(YN);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function Ds({job:n,variant:e="overlay",collapseToMenu:t=!1,inlineCount:i,busy:a=!1,compact:l=!1,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onToggleFavorite:_,onToggleLike:S,onToggleHot:C,onKeep:N,onDelete:O,onToggleWatch:E,onAddToDownloads:B,order:H,className:Y}){const U=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",re=l?"size-4":"size-5",W="h-full w-full",X=e==="table"?`inline-flex items-center justify-center rounded-md ${U} hover:bg-gray-100/70 dark:hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`:`inline-flex items-center justify-center rounded-md bg-white/75 ${U} text-gray-900 backdrop-blur ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/60 dark:focus-visible:ring-white/40 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`,R=e==="table"?{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-500 dark:text-gray-300",keep:"text-emerald-600 dark:text-emerald-300",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-300"}:{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-800/90 dark:text-white/90",keep:"text-emerald-600 dark:text-emerald-200",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-200"},le=H??["watch","favorite","like","hot","keep","delete","details"],k=rt=>le.includes(rt),j=String(n?.sourceUrl??"").trim(),Z=QN(n.output||""),V=Z?`Mehr zu ${Z} anzeigen`:"Mehr anzeigen",ne=k("favorite"),me=k("like"),ue=k("hot"),q=k("watch"),P=k("keep"),Q=k("delete"),te=k("details")&&!!Z,ge=k("add"),[L,xe]=p.useState("idle"),Te=p.useRef(null);p.useEffect(()=>()=>{Te.current&&window.clearTimeout(Te.current)},[]);const ye=()=>{xe("ok"),Te.current&&window.clearTimeout(Te.current),Te.current=window.setTimeout(()=>xe("idle"),800)},be=async()=>{if(a||L==="busy"||!B&&!!!j)return!1;xe("busy");try{let M=!0;return B?M=await B(n)!==!1:j?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:j}})),M=!0):M=!1,M?ye():xe("idle"),M}catch{return xe("idle"),!1}},[mt,Ke]=p.useState(0),[we,Re]=p.useState(4),ct=rt=>M=>{M.preventDefault(),M.stopPropagation(),!(a||!rt)&&Promise.resolve(rt(n)).catch(()=>{})},Oe=te?c.jsxs("button",{type:"button",className:Rn(X),title:V,"aria-label":V,disabled:a,onClick:rt=>{rt.preventDefault(),rt.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},children:[c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(L1,{className:Rn(W,R.off)})}),c.jsx("span",{className:"sr-only",children:V})]}):null,je=ge?c.jsxs("button",{type:"button",className:Rn(X),title:j?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||L==="busy"||!B&&!j,onClick:async rt=>{rt.preventDefault(),rt.stopPropagation(),await be()},children:[c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:L==="ok"?c.jsx(Rw,{className:Rn(W,"text-emerald-600 dark:text-emerald-300")}):c.jsx(j1,{className:Rn(W,R.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Ue=ne?c.jsx("button",{type:"button",className:X,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!_,onClick:ct(_),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(_f,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",h?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(vu,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",h?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.favOn)})]})}):null,ze=me?c.jsx("button",{type:"button",className:X,title:f?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-label":f?"Gefällt mir entfernen":"Als Gefällt mir markieren","aria-pressed":f,disabled:a||!S,onClick:ct(S),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(ed,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",f?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(yl,{className:Rn("absolute inset-0 transition-all duration-200 ease-out motion-reduce:transition-none",f?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.likeOn)})]})}):null,gt=ue?c.jsx("button",{type:"button","data-hot-target":!0,className:X,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!C,onClick:ct(C),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(O1,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(Pg,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.hotOn)})]})}):null,st=q?c.jsx("button",{type:"button",className:X,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!E,onClick:ct(E),children:c.jsxs("span",{className:Rn("relative inline-block",re),children:[c.jsx(xf,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",W,R.off)}),c.jsx(gl,{className:Rn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",W,R.watchOn)})]})}):null,bt=P?c.jsx("button",{type:"button",className:X,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!N,onClick:ct(N),children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(R1,{className:Rn(W,R.keep)})})}):null,Qe=Q?c.jsx("button",{type:"button",className:X,title:"Löschen","aria-label":"Löschen",disabled:a||!O,onClick:ct(O),children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(I1,{className:Rn(W,R.del)})})}):null,Ye={details:Oe,add:je,favorite:Ue,like:ze,watch:st,hot:gt,keep:bt,delete:Qe},tt=t,$e=le.filter(rt=>!!Ye[rt]),ht=tt&&typeof i!="number",Ie=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Le=l?2:3,ke=p.useMemo(()=>{if(!ht)return i??Le;const rt=mt||0;if(rt<=0)return Math.min($e.length,Le);for(let M=$e.length;M>=0;M--)if(M*Ie+Ie+(M>0?M*we:0)<=rt)return M;return 0},[ht,i,Le,mt,$e.length,Ie,we]),Pe=tt?$e.slice(0,ke):$e,et=tt?$e.slice(ke):[],[kt,Lt]=p.useState(!1),pt=p.useRef(null);p.useLayoutEffect(()=>{const rt=pt.current;if(!rt||typeof window>"u")return;const M=()=>{const ie=pt.current;if(!ie)return;const De=Math.floor(ie.getBoundingClientRect().width||0);De>0&&Ke(De);const Ve=window.getComputedStyle(ie),yt=Ve.columnGap||Ve.gap||"0",Vt=parseFloat(yt);Number.isFinite(Vt)&&Vt>=0&&Re(Vt)};M();const F=new ResizeObserver(()=>M());return F.observe(rt),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M),F.disconnect()}},[]);const Zt=p.useRef(null),qt=p.useRef(null),Gt=208,wt=4,lt=8,[Yt,kn]=p.useState(null);p.useEffect(()=>{if(!kt)return;const rt=F=>{F.key==="Escape"&&Lt(!1)},M=F=>{const ie=pt.current,De=qt.current,Ve=F.target;ie&&ie.contains(Ve)||De&&De.contains(Ve)||Lt(!1)};return window.addEventListener("keydown",rt),window.addEventListener("mousedown",M),()=>{window.removeEventListener("keydown",rt),window.removeEventListener("mousedown",M)}},[kt]),p.useLayoutEffect(()=>{if(!kt){kn(null);return}const rt=()=>{const M=Zt.current;if(!M)return;const F=M.getBoundingClientRect(),ie=window.innerWidth,De=window.innerHeight;let Ve=F.right-Gt;Ve=Math.max(lt,Math.min(Ve,ie-Gt-lt));let yt=F.bottom+wt;yt=Math.max(lt,Math.min(yt,De-lt));const Vt=Math.max(120,De-yt-lt);kn({top:yt,left:Ve,maxH:Vt})};return rt(),window.addEventListener("resize",rt),window.addEventListener("scroll",rt,!0),()=>{window.removeEventListener("resize",rt),window.removeEventListener("scroll",rt,!0)}},[kt]);const pn=()=>{Z&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},xn=rt=>rt==="details"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a,onClick:M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),pn()},children:[c.jsx(L1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):rt==="add"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!B&&!j,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await be()},children:[c.jsx(j1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):rt==="favorite"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!_,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await _?.(n)},children:[h?c.jsx(vu,{className:Rn("size-4",R.favOn)}):c.jsx(_f,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):rt==="like"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!S,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await S?.(n)},children:[f?c.jsx(yl,{className:Rn("size-4",R.favOn)}):c.jsx(ed,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):rt==="watch"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!E,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await E?.(n)},children:[g?c.jsx(gl,{className:Rn("size-4",R.favOn)}):c.jsx(xf,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):rt==="hot"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!C,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await C?.(n)},children:[u?c.jsx(Pg,{className:Rn("size-4",R.favOn)}):c.jsx(O1,{className:Rn("size-4",R.off)}),c.jsx("span",{className:"truncate",children:u?"HOT entfernen":"Als HOT markieren"})]},"hot"):rt==="keep"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!N,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await N?.(n)},children:[c.jsx(R1,{className:Rn("size-4",R.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):rt==="delete"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!O,onClick:async M=>{M.preventDefault(),M.stopPropagation(),Lt(!1),await O?.(n)},children:[c.jsx(I1,{className:Rn("size-4",R.del)}),c.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return c.jsxs("div",{ref:pt,className:Rn("relative flex items-center flex-nowrap",Y??"gap-2"),children:[Pe.map(rt=>{const M=Ye[rt];return M?c.jsx(p.Fragment,{children:M},rt):null}),tt&&et.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:Zt,type:"button",className:X,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":kt,disabled:a,onClick:rt=>{rt.preventDefault(),rt.stopPropagation(),!a&&Lt(M=>!M)},children:c.jsx("span",{className:Rn("inline-flex items-center justify-center",re),children:c.jsx(GA,{className:Rn(W,R.off)})})}),kt&&Yt&&typeof document<"u"?yu.createPortal(c.jsx("div",{ref:qt,role:"menu",className:"rounded-md bg-white/95 dark:bg-gray-900/95 shadow-lg ring-1 ring-black/10 dark:ring-white/10 p-1 z-[9999] overflow-auto",style:{position:"fixed",top:Yt.top,left:Yt.left,width:Gt,maxHeight:Yt.maxH},onClick:rt=>rt.stopPropagation(),children:et.map(xn)}),document.body):null]}):null]})}function ps({tag:n,children:e,title:t,active:i,onClick:a,maxWidthClassName:l="max-w-[11rem]",className:u,stopPropagation:h=!0}){const f=n??(typeof e=="string"||typeof e=="number"?String(e):""),g=on("inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs",l,"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-200"),C=on(g,i?"bg-sky-100 text-sky-800 dark:bg-sky-400/20 dark:text-sky-100":"",a?"cursor-pointer hover:bg-sky-100 dark:hover:bg-sky-400/20 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500":"",u),N=E=>E.stopPropagation(),O=h?{onPointerDown:N,onMouseDown:N}:{};return a?c.jsx("button",{type:"button",className:C,title:t??f,"aria-pressed":!!i,...O,onClick:E=>{h&&(E.preventDefault(),E.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:C,title:t??f,...O,onClick:h?N:void 0,children:e??n})}function dd({rowKey:n,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:a,maxVisible:l,maxWidthClassName:u,gapPx:h=6,className:f}){const[g,_]=p.useState(!1),S=p.useRef(null),C=p.useRef(null),N=p.useRef(null);p.useEffect(()=>_(!1),[n]),p.useEffect(()=>{if(!g)return;const R=le=>{le.key==="Escape"&&_(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[g]);const O=p.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),E=p.useMemo(()=>[...e].sort((R,le)=>R.localeCompare(le,void 0,{sensitivity:"base"})),[e]),[B,H]=p.useState(()=>{const R=Math.min(E.length,O);return Math.min(R,6)}),Y=p.useCallback(()=>{const R=S.current,le=C.current;if(!R||!le)return;const k=Math.floor(R.getBoundingClientRect().width);if(k<=0)return;const j=Math.min(E.length,O);if(j<=0){H(0);return}const V=Array.from(le.children).map(P=>P.offsetWidth).slice(0,j),ne=N.current?.offsetWidth??0,me=2,ue=P=>{let Q=0,te=0;for(let ge=0;ge0?h:0);if(Q+L<=P-me)Q+=L,te++;else break}return te};let q=ue(k);if(q0?ne+h:0,Q=Math.max(0,k-P);q=ue(Q),q=Math.max(0,q)}H(Math.max(0,Math.min(q,j)))},[E,O,h]);p.useLayoutEffect(()=>{Y()},[Y,E.join("\0"),u,O]),p.useEffect(()=>{const R=S.current;if(!R)return;const le=new ResizeObserver(()=>Y());return le.observe(R),()=>le.disconnect()},[Y]);const U=Math.min(E.length,O),re=E.slice(0,Math.min(B,U)),W=R=>R.stopPropagation(),X=E.length-re.length;return c.jsxs(c.Fragment,{children:[g?null:c.jsxs("div",{ref:S,className:["mt-2 h-6 flex items-center gap-1.5",f].filter(Boolean).join(" "),onClick:W,onMouseDown:W,onPointerDown:W,children:[c.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:c.jsx("div",{className:"flex flex-nowrap items-center gap-1.5",children:re.length>0?re.map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R)):c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),X>0?c.jsxs("button",{type:"button",className:["inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs","cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500","bg-gray-100 text-gray-700 hover:bg-gray-200/70","dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20"].join(" "),onClick:R=>{R.preventDefault(),R.stopPropagation(),_(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",X]}):null]}),g?c.jsxs("div",{className:["absolute inset-0 z-30","bg-white/60 dark:bg-gray-950","px-3 py-3","pointer-events-auto"].join(" "),onClick:W,onMouseDown:W,onPointerDown:W,role:"dialog","aria-label":"Tags",children:[c.jsx("button",{type:"button",className:`\r absolute right-2 top-2 z-10\r rounded-md bg-gray-100/80 px-2 py-1 text-xs font-semibold text-gray-700\r hover:bg-gray-200/80\r dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20\r `,onClick:()=>_(!1),"aria-label":"Schließen",title:"Schließen",children:"✕"}),c.jsx("div",{className:"h-full overflow-auto pr-1",children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R))})})]}):null,c.jsxs("div",{className:"absolute -left-[9999px] -top-[9999px] opacity-0 pointer-events-none",children:[c.jsx("div",{ref:C,className:"flex flex-nowrap items-center gap-1.5",children:E.slice(0,U).map(R=>c.jsx(ps,{tag:R,active:t.has(i(R)),onClick:a,maxWidthClassName:u},R))}),c.jsx("button",{ref:N,type:"button",className:"inline-flex items-center rounded-md bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-700 ring-1 ring-inset ring-gray-200",children:"+99"})]})]})}function F1(n,e,t){return Math.max(e,Math.min(t,n))}function ZN(n){const e=Math.max(0,Math.floor(n)),t=Math.floor(e/60),i=e%60;return`${t}:${String(i).padStart(2,"0")}`}function _y({imageCount:n,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:a,stepSeconds:l=0}){const u=p.useRef(null),h=p.useRef(null),f=p.useRef(void 0),g=p.useCallback(()=>{h.current=null,t(f.current)},[t]),_=p.useCallback(W=>{f.current=W,h.current==null&&(h.current=window.requestAnimationFrame(g))},[g]);p.useEffect(()=>()=>{h.current!=null&&(window.cancelAnimationFrame(h.current),h.current=null)},[]);const S=p.useCallback(W=>{if(!u.current||n<1)return;const X=u.current.getBoundingClientRect();if(X.width<=0)return;const R=W-X.left,le=F1(R/X.width,0,.999999);return F1(Math.floor(le*n),0,n-1)},[n]),C=p.useCallback(W=>{const X=S(W.clientX);_(X)},[S,_]),N=p.useCallback(W=>{const X=S(W.clientX);_(X)},[S,_]),O=p.useCallback(()=>{_(void 0)},[_]),E=p.useCallback(W=>{W.stopPropagation();const X=S(W.clientX);_(X);try{W.currentTarget.setPointerCapture?.(W.pointerId)}catch{}},[S,_]),B=p.useCallback(W=>{if(W.stopPropagation(),!i)return;const X=S(W.clientX);typeof X=="number"&&i(X)},[S,i]);if(!n||n<1)return null;const H=typeof e=="number"?(e+.5)/n*100:void 0,Y=typeof e=="number"?l>0?ZN(e*l):`${e+1}/${n}`:"",U=typeof e=="number",re=typeof H=="number"?{left:`clamp(24px, ${H}%, calc(100% - 24px))`,transform:"translateX(-50%)"}:void 0;return c.jsxs("div",{ref:u,className:["relative h-7 w-full select-none touch-none cursor-col-resize","opacity-0 transition-opacity duration-150","pointer-events-none","group-hover:opacity-100 group-focus-within:opacity-100","group-hover:pointer-events-auto group-focus-within:pointer-events-auto",a].filter(Boolean).join(" "),onPointerMove:C,onPointerEnter:N,onPointerLeave:O,onPointerDown:E,onMouseDown:W=>W.stopPropagation(),onClick:B,title:U?Y:`Preview scrubber (${n})`,role:"slider","aria-label":"Preview scrubber","aria-valuemin":1,"aria-valuemax":n,"aria-valuenow":typeof e=="number"?e+1:void 0,children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-4 bg-white/35 ring-1 ring-white/40 backdrop-blur-[1px]",children:typeof H=="number"?c.jsx("div",{className:"absolute inset-y-0 w-[2px] bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:`${H}%`,transform:"translateX(-50%)"}}):null}),c.jsx("div",{className:["pointer-events-none absolute bottom-[19px] z-10","rounded bg-black/70 px-1.5 py-0.5","text-[11px] leading-none text-white whitespace-nowrap","transition-opacity duration-100",U?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:re,children:Y})]})}const Lw=/^HOT[ \u00A0]+/i,Iw=n=>String(n||"").replaceAll(" "," "),ou=n=>Lw.test(Iw(n)),$r=n=>Iw(n).replace(Lw,"");function hd(n){if(!n)return"";const e=Math.round(Number(n.w)),t=Math.round(Number(n.h));if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return"";const i=Math.min(e,t),a=Math.max(12,Math.round(i*.02)),l=u=>Math.abs(i-u)<=a;return l(4320)?"8K":l(2160)||i>=2e3?"4K":l(1440)?"1440p":l(1080)?"1080p":l(720)?"720p":l(480)?"480p":l(360)?"360p":l(240)?"240p":`${i}p`}const JN=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a};function e3(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function Np(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function U1(n,e,t){return Math.max(e,Math.min(t,n))}const t3=5;function n3(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f{if(!e)return;const u=requestAnimationFrame(()=>{a(!0)});return()=>cancelAnimationFrame(u)},[e]);const l=["relative will-change-[filter,transform] transition-[filter,transform,opacity] duration-180 ease-out",n?"blur-[1.5px] saturate-90 scale-[0.995]":i?"blur-0 saturate-100 scale-100":"blur-[1.5px] saturate-90 scale-[0.995]"].filter(Boolean).join(" ");return c.jsx("div",{className:l,children:t})}function r3({animateOnMount:n,children:e}){const[t,i]=p.useState(!n);return p.useEffect(()=>{if(!n)return;const a=requestAnimationFrame(()=>{i(!0)});return()=>cancelAnimationFrame(a)},[n]),c.jsx("div",{className:"will-change-[transform,opacity] transition-[transform,opacity] duration-160 ease-out motion-reduce:transition-none",style:{transform:t?"translateY(0px) scale(1) translateZ(0)":"translateY(-15px) scale(0.97) translateZ(0)",opacity:t?1:.92,transformOrigin:"top center"},children:e})}function s3({rows:n,isSmall:e,isLoading:t,teaserPlayback:i,teaserAudio:a,hoverTeaserKey:l,blurPreviews:u,durations:h,teaserKey:f,inlinePlay:g,deletingKeys:_,keepingKeys:S,removingKeys:C,swipeRefs:N,assetNonce:O,handleScrubberClickIndex:E,keyFor:B,baseName:H,modelNameFromOutput:Y,runtimeOf:U,sizeBytesOf:re,formatBytes:W,lower:X,onHoverPreviewKeyChange:R,onOpenPlayer:le,openPlayer:k,startInlineAt:j,startInline:Z,tryAutoplayInline:V,registerTeaserHost:ne,handleDuration:me,deleteVideo:ue,keepVideo:q,modelsByKey:P,activeTagSet:Q,onToggleTagFilter:te,onToggleHot:ge,onToggleFavorite:L,onToggleLike:xe,onToggleWatch:Te,enqueueDeleteVideo:ye,enqueueKeepVideo:be,enqueueToggleHot:mt}){const Ke=p.useCallback(Le=>{const ke=Le?.meta;if(!ke)return null;if(typeof ke=="string")try{return JSON.parse(ke)}catch{return null}return ke},[]),we=p.useCallback(Le=>{const ke=Ke(Le),Pe=(typeof ke?.videoWidth=="number"&&Number.isFinite(ke.videoWidth)?ke.videoWidth:0)||(typeof Le.videoWidth=="number"&&Number.isFinite(Le.videoWidth)?Le.videoWidth:0),et=(typeof ke?.videoHeight=="number"&&Number.isFinite(ke.videoHeight)?ke.videoHeight:0)||(typeof Le.videoHeight=="number"&&Number.isFinite(Le.videoHeight)?Le.videoHeight:0);return Pe>0&&et>0?{w:Pe,h:et}:null},[Ke]),Re=p.useCallback(Le=>{const ke=Ke(Le);let Pe=ke?.previewSprite??ke?.preview?.sprite??ke?.sprite??Le?.previewSprite??Le?.preview?.sprite??null;if(typeof Pe=="string")try{Pe=JSON.parse(Pe)}catch{Pe=null}const et=Number(Pe?.count??Pe?.frames??Pe?.imageCount),kt=Number(Pe?.stepSeconds??Pe?.step??Pe?.intervalSeconds);if(Number.isFinite(et)&&et>=2)return{count:Math.max(2,Math.floor(et)),stepSeconds:Number.isFinite(kt)&&kt>0?kt:5};const Lt=B(Le),pt=h[Lt]??(typeof Le?.durationSeconds=="number"?Le.durationSeconds:void 0);return typeof pt=="number"&&Number.isFinite(pt)&&pt>1?{count:Math.max(2,Math.min(240,Math.floor(pt/5)+1)),stepSeconds:5}:null},[Ke,B,h]),[ct,Oe]=p.useState({}),[je,Ue]=p.useState({}),[ze,gt]=p.useState(null),st=p.useCallback((Le,ke)=>{Oe(Pe=>{if(ke===void 0){if(!(Le in Pe))return Pe;const et={...Pe};return delete et[Le],et}return Pe[Le]===ke?Pe:{...Pe,[Le]:ke}})},[]),bt=p.useCallback(Le=>{st(Le,void 0)},[st]),Qe=p.useCallback((Le,ke)=>{Ue(Pe=>{if(ke===void 0){if(!(Le in Pe))return Pe;const et={...Pe};return delete et[Le],et}return Pe[Le]===ke?Pe:{...Pe,[Le]:ke}})},[]),Ye=(Le,ke)=>{const Pe=B(Le),et=g?.key===Pe,kt=ke?.disableInline?!1:et,pt=!(!ke?.forceStill&&!!a&&(kt||l===Pe)),Zt=kt?g?.nonce??0:0,qt=!!ke?.forceLoadStill,Gt=ke?.forceStill?!1:ke?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Pe:!1,wt=_.has(Pe)||S.has(Pe)||C.has(Pe),lt=Y(Le.output),Yt=H(Le.output||""),kn=$r(Yt.replace(/\.[^.]+$/,"")).trim(),pn=X(lt),xn=P[pn],rt=Ke(Le),M=Re(Le),F=ct[Pe],ie=je[Pe]===!0,De=e3(rt?.previewSprite?.path,rt?.previewSpritePath,xn?.previewScrubberPath,kn?`/api/preview-sprite/${encodeURIComponent(kn)}`:void 0),Ve=De?De.replace(/\/+$/,""):void 0,yt=rt?.previewSprite?.stepSeconds??rt?.previewSpriteStepSeconds,Vt=typeof yt=="number"&&Number.isFinite(yt)&&yt>0?yt:M?.stepSeconds&&M.stepSeconds>0?M.stepSeconds:t3,Jt=Np(rt?.durationSeconds)??Np(Le?.durationSeconds)??Np(h[Pe]),gn=typeof Jt=="number"&&Jt>0?Math.max(1,Math.min(200,Math.floor(Jt/Vt)+1)):void 0,ln=rt?.previewSprite?.count??rt?.previewSpriteCount??xn?.previewScrubberCount??gn,_n=rt?.previewSprite?.cols??rt?.previewSpriteCols,En=rt?.previewSprite?.rows??rt?.previewSpriteRows,Ut=typeof ln=="number"&&Number.isFinite(ln)?Math.max(0,Math.floor(ln)):0,[hn,cn]=Ut>1?n3(Ut):[0,0],en=Number(_n),zt=Number(En),Dt=Number.isFinite(en)&&Number.isFinite(zt)&&en>0&&zt>0&&!(Ut>1&&en===1&&zt===1)&&(Ut<=1||en*zt>=Ut),Ot=Dt?Math.floor(en):hn,Hn=Dt?Math.floor(zt):cn,Rt=(typeof rt?.updatedAtUnix=="number"&&Number.isFinite(rt.updatedAtUnix)?rt.updatedAtUnix:void 0)??(typeof rt?.fileModUnix=="number"&&Number.isFinite(rt.fileModUnix)?rt.fileModUnix:void 0)??O??0,qn=Ve&&Rt?`${Ve}?v=${encodeURIComponent(String(Rt))}`:Ve||void 0,_i=!!qn&&Ut>1,Mn=_i&&Ot>0&&Hn>0,Wt=_i?Ut:0,zn=_i?Vt:0,Kn=typeof F=="number"&&Wt>1?U1(F/(Wt-1),0,1):void 0,jn=Mn&&typeof F=="number"?(()=>{const vt=U1(F,0,Math.max(0,Ut-1)),fn=vt%Ot,Ne=Math.floor(vt/Ot),Tt=Ot<=1?0:fn/(Ot-1)*100,_t=Hn<=1?0:Ne/(Hn-1)*100;return{backgroundImage:`url("${qn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Ot*100}% ${Hn*100}%`,backgroundPosition:`${Tt}% ${_t}%`}})():void 0,Wn=ou(Yt),Cn=!!xn?.favorite,fi=xn?.liked===!0,Xn=!!xn?.watching,li=JN(xn?.tags),_e=U(Le),at=W(re(Le)),Ct=we(Le),St=hd(Ct),Pt=`inline-prev-${encodeURIComponent(Pe)}`,tn=["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200",!e&&"hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",wt&&"pointer-events-none opacity-70",_.has(Pe)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",S.has(Pe)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",C.has(Pe)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),wn=c.jsx("div",{role:"button",tabIndex:0,className:tn,onClick:e?void 0:()=>k(Le),onKeyDown:vt=>{(vt.key==="Enter"||vt.key===" ")&&(vt.preventDefault(),le(Le))},children:c.jsx(i3,{blurred:ke?.blur,animateUnblurOnMount:ke?.animateUnblurOnMount,children:c.jsxs(Ns,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:Pt,ref:ke?.disableInline||ke?.isDecorative?void 0:ne(Pe),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||ke?.disablePreviewHover?void 0:()=>{gt(Pe),R?.(Pe)},onMouseLeave:()=>{!e&&!ke?.disablePreviewHover&&R?.(null),gt(vt=>vt===Pe?null:vt),bt(Pe),Qe(Pe,!1)},onClick:vt=>{vt.preventDefault(),vt.stopPropagation(),!(e||ke?.disableInline)&&Z(Pe)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[kt?null:c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0 "+(kt?"opacity-0":"opacity-100"),children:c.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[_e,Ct?`${Ct.w}×${Ct.h}`:St||"",at].filter(Boolean).join(" • "),children:[c.jsx("span",{children:_e}),St?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,St?c.jsx("span",{children:St}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:at})]})}),c.jsx(xu,{job:Le,getFileName:vt=>$r(H(vt)),className:"h-full w-full",variant:"fill",durationSeconds:h[Pe]??Le?.durationSeconds,onDuration:me,showPopover:!1,blur:kt?!1:!!u,animated:Gt,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!ke?.disableInline&&kt?"always":!1,inlineNonce:Zt,inlineControls:kt,inlineLoop:!1,muted:pt,popoverMuted:pt,assetNonce:O??0,alwaysLoadStill:qt,teaserPreloadEnabled:ke?.mobileStackTopOnlyVideo||ke?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:ke?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:Kn,preferScrubProgress:ie&&typeof F=="number"}),Mn&&qn?c.jsx("img",{src:qn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Mn&&jn&&!kt?c.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:c.jsx("div",{className:"h-full w-full",style:jn})}):null,!ke?.isDecorative&&!ke?.disableScrubber&&!kt&&Wt>1&&ze===Pe?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),onMouseEnter:()=>Qe(Pe,!0),onMouseLeave:()=>{Qe(Pe,!1),st(Pe,void 0)},children:c.jsx(_y,{className:"pointer-events-auto px-1",imageCount:Wt,activeIndex:F,onActiveIndexChange:vt=>st(Pe,vt),onIndexClick:vt=>{if(e||ke?.disableInline){E(Le,vt,Wt);return}const fn=zn>0?vt*zn:0;if(j){j(Pe,fn,Pt),requestAnimationFrame(()=>{V(Pt)||requestAnimationFrame(()=>V(Pt))});return}Z(Pe),requestAnimationFrame(()=>{V(Pt)||requestAnimationFrame(()=>V(Pt))})},stepSeconds:zn})}):null]})}),c.jsxs("div",{className:"relative min-h-[112px] overflow-hidden px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:lt}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Wn?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:$r(Yt)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[Xn?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,fi?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Cn?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:Le,variant:"table",busy:wt,collapseToMenu:!0,compact:!1,isHot:Wn,isFavorite:Cn,isLiked:fi,isWatching:Xn,onToggleWatch:Te,onToggleFavorite:L,onToggleLike:xe,onToggleHot:ge,onKeep:q,onDelete:ue,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation(),children:c.jsx(dd,{rowKey:Pe,tags:li,activeTagSet:Q,lower:X,onToggleTagFilter:te})})]})]})})});return{k:Pe,j:Le,busy:wt,isHot:Wn,inlineDomId:Pt,cardInner:wn}},tt=3,$e=e?n.slice(0,tt):[],At=e?n.slice(tt,tt+4):[],he=15,Ie=Math.min($e.length,tt)-1;return c.jsxs("div",{className:"relative",children:[e?c.jsx("div",{className:"relative overflow-y-visible touch-pan-y",style:{overflowX:"clip"},children:n.length===0?null:c.jsxs("div",{className:"relative mx-auto w-full max-w-[560px] overflow-y-visible",style:{overflowX:"clip"},children:[c.jsx("div",{className:"relative overflow-visible",style:{paddingTop:Ie>0?`${Ie}px`:void 0},children:(()=>{const Le=$e,ke=Le[0],Pe=Le.slice(1);return c.jsxs(c.Fragment,{children:[Pe.map((et,kt)=>{const Lt=kt+1,{k:pt,cardInner:Zt}=Ye(et,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),qt=Lt,Gt=-(qt*he),wt=1-qt*.03,lt=1-qt*.14;return c.jsx("div",{className:"absolute inset-x-0 top-0 pointer-events-none will-change-[transform,opacity] transition-[transform,opacity] duration-220 ease-out motion-reduce:transition-none",style:{zIndex:20-qt,transform:`translateY(${Gt}px) scale(${wt}) translateZ(0)`,opacity:lt,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[Zt,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},pt)}).reverse(),ke?(()=>{const et=ke,{k:kt,busy:Lt,isHot:pt,cardInner:Zt,inlineDomId:qt}=Ye(et,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(r3,{animateOnMount:!0,children:c.jsx(GN,{ref:Gt=>{Gt?N.current.set(kt,Gt):N.current.delete(kt)},enabled:!0,disabled:Lt,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!pt){if(mt){mt(et);return}await ge?.(et)}},onTap:()=>{Z(kt),requestAnimationFrame(()=>{V(qt)||requestAnimationFrame(()=>V(qt))})},onSwipeLeft:()=>ye?ye(et):ue(et),onSwipeRight:()=>be?be(et):q(et),children:Zt})})},kt)})():null]})})()}),At.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:At.map(Le=>{const ke=B(Le);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(xu,{job:Le,getFileName:H,className:"h-full w-full",showPopover:!1,blur:!!u,animated:!1,teaserPreloadEnabled:!0,teaserPreloadRootMargin:"1200px 0px",animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!1,inlineControls:!1,inlineLoop:!1,muted:!0,popoverMuted:!0,assetNonce:O??0,alwaysLoadStill:!0})},`preload-still-${ke}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Le=>{const{k:ke,cardInner:Pe}=Ye(Le);return c.jsx(p.Fragment,{children:Pe},ke)})}),t&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function a3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const o3=p.forwardRef(a3);function l3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const u3=p.forwardRef(l3);function c3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const d3=p.forwardRef(c3);function h3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const z1=p.forwardRef(h3);function Fr(...n){return n.filter(Boolean).join(" ")}function $1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function f3(n){return n==="center"?"justify-center":n==="right"?"justify-end":"justify-start"}function H1(n,e){const t=n===0,i=n===e-1;return t||i?"pl-2 pr-2":"px-2"}function q1(n){return n==null?{isNull:!0,kind:"string",value:""}:n instanceof Date?{isNull:!1,kind:"number",value:n.getTime()}:typeof n=="number"?{isNull:!1,kind:"number",value:n}:typeof n=="boolean"?{isNull:!1,kind:"number",value:n?1:0}:typeof n=="bigint"?{isNull:!1,kind:"number",value:Number(n)}:{isNull:!1,kind:"string",value:String(n).toLocaleLowerCase()}}function td({columns:n,rows:e,getRowKey:t,title:i,description:a,actions:l,fullWidth:u=!1,card:h=!0,striped:f=!1,stickyHeader:g=!1,compact:_=!1,isLoading:S=!1,emptyLabel:C="Keine Daten vorhanden.",className:N,rowClassName:O,onRowClick:E,onRowContextMenu:B,sort:H,onSortChange:Y,defaultSort:U=null}){const re=_?"py-2":"py-4",W=_?"py-3":"py-3.5",X=H!==void 0,[R,le]=p.useState(U),k=X?H:R,j=p.useCallback(V=>{X||le(V),Y?.(V)},[X,Y]),Z=p.useMemo(()=>{if(!k)return e;const V=n.find(ue=>ue.key===k.key);if(!V)return e;const ne=k.direction==="asc"?1:-1,me=e.map((ue,q)=>({r:ue,i:q}));return me.sort((ue,q)=>{let P=0;if(V.sortFn)P=V.sortFn(ue.r,q.r);else{const Q=V.sortValue?V.sortValue(ue.r):ue.r?.[V.key],te=V.sortValue?V.sortValue(q.r):q.r?.[V.key],ge=q1(Q),L=q1(te);ge.isNull&&!L.isNull?P=1:!ge.isNull&&L.isNull?P=-1:ge.kind==="number"&&L.kind==="number"?P=ge.valueL.value?1:0:P=String(ge.value).localeCompare(String(L.value),void 0,{numeric:!0})}return P===0?ue.i-q.i:P*ne}),me.map(ue=>ue.r)},[e,n,k]);return c.jsxs("div",{className:Fr(u?"":"px-4 sm:px-6 lg:px-8",N),children:[(i||a||l)&&c.jsxs("div",{className:"sm:flex sm:items-center",children:[c.jsxs("div",{className:"sm:flex-auto",children:[i&&c.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-white",children:i}),a&&c.jsx("p",{className:"mt-2 text-sm text-gray-700 dark:text-gray-300",children:a})]}),l&&c.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-16 sm:flex-none",children:l})]}),c.jsx("div",{className:Fr(i||a||l?"mt-8":""),children:c.jsx("div",{className:"flow-root",children:c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:Fr("inline-block min-w-full align-middle",u?"":"sm:px-6 lg:px-8"),children:c.jsx("div",{className:Fr(h&&"overflow-hidden shadow-sm outline-1 outline-black/5 rounded-lg dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"),children:c.jsxs("table",{className:"relative min-w-full divide-y divide-gray-200 dark:divide-white/10",children:[c.jsx("thead",{className:Fr(h&&"bg-gray-50/90 dark:bg-gray-800/70",g&&"sticky top-0 z-10 backdrop-blur-sm shadow-sm"),children:c.jsx("tr",{children:n.map((V,ne)=>{const me=H1(ne,n.length),ue=!!k&&k.key===V.key,q=ue?k.direction:void 0,P=V.sortable&&!V.srOnlyHeader?ue?q==="asc"?"ascending":"descending":"none":void 0,Q=()=>{if(!(!V.sortable||V.srOnlyHeader))return j(ue?q==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":P,className:Fr(W,me,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",$1(V.align),V.widthClassName,V.headerClassName),children:V.srOnlyHeader?c.jsx("span",{className:"sr-only",children:V.header}):V.sortable?c.jsxs("button",{type:"button",onClick:Q,className:Fr("group inline-flex w-full items-center gap-2 select-none rounded-md px-1.5 py-1 -my-1 hover:bg-gray-100/70 dark:hover:bg-white/5",f3(V.align)),children:[c.jsx("span",{children:V.header}),c.jsx("span",{className:Fr("flex-none rounded-sm text-gray-400 dark:text-gray-500",ue?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(o3,{"aria-hidden":"true",className:Fr("size-5 transition-transform",ue&&q==="asc"&&"rotate-180")})})]}):V.header},V.key)})})}),c.jsx("tbody",{className:Fr("divide-y divide-gray-200 dark:divide-white/10",h?"bg-white dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),children:S?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(re,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):Z.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(re,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:C})}):Z.map((V,ne)=>{const me=t?t(V,ne):String(ne);return c.jsx("tr",{className:Fr(f&&"even:bg-gray-50 dark:even:bg-gray-800/50",E&&"cursor-pointer",E&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",O?.(V,ne)),onClick:()=>E?.(V),onContextMenu:B?ue=>{ue.preventDefault(),B(V,ue)}:void 0,children:n.map((ue,q)=>{const P=H1(q,n.length),Q=ue.cell?.(V,ne)??ue.accessor?.(V)??V?.[ue.key];return c.jsx("td",{className:Fr(re,P,"text-sm whitespace-nowrap",$1(ue.align),ue.className,ue.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Q},ue.key)})},me)})})]})})})})})})]})}function m3({rows:n,isLoading:e,keyFor:t,baseName:i,lower:a,modelNameFromOutput:l,runtimeOf:u,sizeBytesOf:h,formatBytes:f,resolutions:g,durations:_,canHover:S,teaserAudio:C,hoverTeaserKey:N,setHoverTeaserKey:O,teaserPlayback:E="hover",teaserKey:B,registerTeaserHost:H,handleDuration:Y,handleResolution:U,blurPreviews:re,assetNonce:W,deletingKeys:X,keepingKeys:R,removingKeys:le,modelsByKey:k,activeTagSet:j,onToggleTagFilter:Z,onOpenPlayer:V,onSortModeChange:ne,page:me,onPageChange:ue,onToggleHot:q,onToggleFavorite:P,onToggleLike:Q,onToggleWatch:te,deleteVideo:ge,keepVideo:L,enqueueDeleteVideo:xe,enqueueKeepVideo:Te,enqueueToggleHot:ye}){const[be,mt]=p.useState(null),Ke=p.useCallback(Qe=>{const Ye=Qe?.durationSeconds;if(typeof Ye=="number"&&Number.isFinite(Ye)&&Ye>0)return Ye;const tt=Date.parse(String(Qe?.startedAt||"")),$e=Date.parse(String(Qe?.endedAt||""));if(Number.isFinite(tt)&&Number.isFinite($e)&&$e>tt){const ht=($e-tt)/1e3;if(ht>=1&&ht<=1440*60)return ht}return Number.POSITIVE_INFINITY},[]),we=p.useCallback(Qe=>{const Ye=String(Qe??"").trim();if(!Ye)return[];const tt=Ye.split(/[\n,;|]+/g).map(At=>At.trim()).filter(Boolean),$e=new Set,ht=[];for(const At of tt){const he=At.toLowerCase();$e.has(he)||($e.add(he),ht.push(At))}return ht.sort((At,he)=>At.localeCompare(he,void 0,{sensitivity:"base"})),ht},[]),Re=p.useCallback(Qe=>{const Ye=Qe?.meta;if(!Ye)return null;if(typeof Ye=="string")try{return JSON.parse(Ye)}catch{return null}return Ye},[]),ct=p.useCallback(Qe=>{const Ye=Re(Qe);let tt=Ye?.previewSprite??Ye?.preview?.sprite??null;if(typeof tt=="string")try{tt=JSON.parse(tt)}catch{tt=null}const $e=Number(tt?.count),ht=Number(tt?.stepSeconds);return!Number.isFinite($e)||$e<2?null:{count:Math.max(2,Math.floor($e)),stepSeconds:Number.isFinite(ht)&&ht>0?ht:5}},[Re]),[Oe,je]=p.useState({}),Ue=p.useCallback((Qe,Ye)=>{je(tt=>tt[Qe]===Ye?tt:{...tt,[Qe]:Ye})},[]),ze=p.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Qe=>{const Ye=t(Qe),$e=!(!!C&&N===Ye),ht=ct(Qe),At=Oe[Ye],he=i(Qe.output||""),Ie=$r(he.replace(/\.[^.]+$/,"")).trim(),Le=ht&&typeof At=="number"?Math.max(0,At*ht.stepSeconds):void 0,ke=Ie&&typeof Le=="number"?`/api/preview?id=${encodeURIComponent(Ie)}&t=${Le.toFixed(3)}&v=${W??0}`:"";return c.jsxs("div",{ref:H(Ye),className:"group relative py-1",onClick:Pe=>Pe.stopPropagation(),onMouseDown:Pe=>Pe.stopPropagation(),onMouseEnter:()=>{S&&O(Ye)},onMouseLeave:()=>{S&&O(null),Ue(Ye,void 0)},children:[c.jsx(xu,{job:Qe,getFileName:i,durationSeconds:_[Ye],muted:$e,popoverMuted:$e,onDuration:Y,onResolution:U,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:re,animated:E==="all"?!0:E==="hover"?B===Ye:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:W}),ht&&typeof At=="number"&&ke?c.jsx("img",{src:ke,alt:"","aria-hidden":"true",className:"pointer-events-none absolute left-0 top-1 z-[15] h-16 w-28 rounded-md object-cover ring-1 ring-black/5 dark:ring-white/10",draggable:!1}):null]})}},{key:"Model",header:"Model",sortable:!0,sortValue:Qe=>{const Ye=i(Qe.output||""),tt=ou(Ye),$e=l(Qe.output),ht=$r(Ye);return`${$e} ${tt?"HOT":""} ${ht}`.trim()},cell:Qe=>{const Ye=i(Qe.output||""),tt=ou(Ye),$e=$r(Ye),ht=l(Qe.output),At=a(l(Qe.output)),he=we(k[At]?.tags);return c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:ht}),c.jsxs("div",{className:"mt-0.5 min-w-0 text-xs text-gray-500 dark:text-gray-400",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"truncate",title:$e,children:$e||"—"}),(()=>{const Ie=t(Qe),Le=g[Ie]??null,ke=hd(Le);return ke?c.jsx("span",{className:`shrink-0 rounded-md bg-gray-100 px-1.5 py-0.5 text-[11px] font-semibold text-gray-700 ring-1 ring-inset ring-gray-200\r dark:bg-white/5 dark:text-gray-200 dark:ring-white/10`,title:Le?`${Le.w}×${Le.h}`:"Auflösung",children:ke}):null})(),tt?c.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[11px] font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null]}),he.length>0?c.jsx("div",{className:"mt-1",onClick:Ie=>Ie.stopPropagation(),onMouseDown:Ie=>Ie.stopPropagation(),children:c.jsx(dd,{rowKey:t(Qe),tags:he,activeTagSet:j,lower:a,onToggleTagFilter:Z,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Qe=>{const Ye=Date.parse(String(Qe.endedAt||""));return Number.isFinite(Ye)?Ye:Number.NEGATIVE_INFINITY},cell:Qe=>{const Ye=Date.parse(String(Qe.endedAt||""));if(!Number.isFinite(Ye))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const tt=new Date(Ye),$e=tt.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),ht=tt.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:tt.toISOString(),title:`${$e} ${ht}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[c.jsx("span",{className:"font-medium",children:$e}),c.jsx("span",{className:"mx-1 text-gray-400 dark:text-gray-600",children:"·"}),c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:ht})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Qe=>Ke(Qe),cell:Qe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(Qe)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Qe=>{const Ye=h(Qe);return typeof Ye=="number"?Ye:Number.NEGATIVE_INFINITY},cell:Qe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(Qe))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Qe=>{const Ye=t(Qe),tt=X.has(Ye)||R.has(Ye)||le.has(Ye),$e=i(Qe.output||""),ht=ou($e),At=a(l(Qe.output)),he=k[At],Ie=!!he?.favorite,Le=he?.liked===!0,ke=!!he?.watching;return c.jsx(Ds,{job:Qe,variant:"table",busy:tt,isHot:ht,isFavorite:Ie,isLiked:Le,isWatching:ke,onToggleWatch:te,onToggleFavorite:P,onToggleLike:Q,onToggleHot:q?async Pe=>{if(!(ye&&ye(Pe)))return q(Pe)}:void 0,onKeep:async Pe=>Te&&Te(Pe)?!0:L(Pe),onDelete:async Pe=>xe&&xe(Pe)?!0:ge(Pe),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,_,C,N,H,S,O,Y,U,re,E,B,W,a,l,k,j,Z,g,X,R,le,ct,Oe,Ue,te,P,Q,q,L,ge,h,f,u,we,Ke]),gt=p.useCallback(Qe=>{if(!Qe)return"completed_desc";const Ye=Qe,tt=String(Ye.key??Ye.columnKey??Ye.id??""),$e=String(Ye.dir??Ye.direction??Ye.order??"").toLowerCase(),ht=$e==="asc"||$e==="1"||$e==="true";return tt==="completedAt"?ht?"completed_asc":"completed_desc":tt==="runtime"?ht?"duration_asc":"duration_desc":tt==="size"?ht?"size_asc":"size_desc":tt==="Model"||tt==="video"?ht?"file_asc":"file_desc":ht?"completed_asc":"completed_desc"},[]),st=p.useCallback(Qe=>{mt(Qe),ne(gt(Qe)),me!==1&&ue(1)},[ne,gt,me,ue]),bt=p.useCallback(Qe=>{const Ye=t(Qe);return["transition-all duration-300",(X.has(Ye)||le.has(Ye))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",X.has(Ye)&&"animate-pulse",(R.has(Ye)||le.has(Ye))&&"pointer-events-none",R.has(Ye)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",le.has(Ye)&&"opacity-0"].filter(Boolean).join(" ")},[t,X,R,le]);return c.jsxs("div",{className:"relative",children:[c.jsx(td,{rows:n,columns:ze,getRowKey:Qe=>t(Qe),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:be,onSortChange:st,onRowClick:V,rowClassName:bt}),e&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function V1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function p3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function Dp(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function G1(n,e,t){return Math.max(e,Math.min(t,n))}const g3=5;function y3(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(fUe=>{if(!ge){re(je)(null);return}re(je)(Ue)},[re,ge]),xe=je=>{const Ue=String(je??"").trim();if(!Ue)return[];const ze=Ue.split(/[\n,;|]+/g).map(bt=>bt.trim()).filter(Boolean),gt=new Set,st=[];for(const bt of ze){const Qe=bt.toLowerCase();gt.has(Qe)||(gt.add(Qe),st.push(bt))}return st},Te=p.useCallback(je=>{const Ue=(typeof je?.meta?.videoWidth=="number"&&Number.isFinite(je.meta.videoWidth)?je.meta.videoWidth:0)||(typeof je?.videoWidth=="number"&&Number.isFinite(je.videoWidth)?je.videoWidth:0),ze=(typeof je?.meta?.videoHeight=="number"&&Number.isFinite(je.meta.videoHeight)?je.meta.videoHeight:0)||(typeof je?.videoHeight=="number"&&Number.isFinite(je.videoHeight)?je.videoHeight:0);return Ue>0&&ze>0?{w:Ue,h:ze}:null},[]),[ye,be]=p.useState(null),[mt,Ke]=p.useState({}),[we,Re]=p.useState(null),ct=p.useCallback((je,Ue)=>{Ke(ze=>{if(Ue===void 0){if(!(je in ze))return ze;const gt={...ze};return delete gt[je],gt}return ze[je]===Ue?ze:{...ze,[je]:Ue}})},[]),Oe=p.useCallback(je=>{ct(je,void 0)},[ct]);return c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:n.map(je=>{const Ue=_(je),gt=!(!!l&&u===Ue),st=C(je.output),bt=j(st),Qe=Z[bt],Ye=!!Qe?.favorite,tt=Qe?.liked===!0,$e=!!Qe?.watching,ht=xe(Qe?.tags),At=S(je.output||""),he=ou(At),Ie=$r(At),Le=N(je),ke=E(O(je)),Pe=Te(je),et=hd(Pe),kt=B.has(Ue)||H.has(Ue)||Y.has(Ue),Lt=U.has(Ue),pt=V1(Qe?.image,Qe?.imageUrl,je?.meta?.modelImage,je?.meta?.modelImageUrl),qt=$r(S(je.output||"")).replace(/\.[^.]+$/,"").trim(),Gt=p3(je?.meta),wt=V1(Gt?.previewSprite?.path,Gt?.previewSpritePath,Qe?.previewScrubberPath,qt?`/api/preview-sprite/${encodeURIComponent(qt)}`:void 0),lt=wt?wt.replace(/\/+$/,""):void 0,Yt=Gt?.previewSprite?.stepSeconds??Gt?.previewSpriteStepSeconds,kn=typeof Yt=="number"&&Number.isFinite(Yt)&&Yt>0?Yt:g3,pn=Dp(Gt?.durationSeconds)??Dp(je?.durationSeconds)??Dp(i[Ue]),xn=typeof pn=="number"&&pn>0?Math.max(1,Math.min(200,Math.floor(pn/kn)+1)):void 0,rt=Gt?.previewSprite?.count??Gt?.previewSpriteCount??Qe?.previewScrubberCount??xn,M=Gt?.previewSprite?.cols??Gt?.previewSpriteCols,F=Gt?.previewSprite?.rows??Gt?.previewSpriteRows,ie=typeof rt=="number"&&Number.isFinite(rt)?Math.max(0,Math.floor(rt)):0,[De,Ve]=ie>1?y3(ie):[0,0],yt=typeof M=="number"&&Number.isFinite(M)?Math.max(0,Math.floor(M)):De,Vt=typeof F=="number"&&Number.isFinite(F)?Math.max(0,Math.floor(F)):Ve,Jt=(typeof Gt?.updatedAtUnix=="number"&&Number.isFinite(Gt.updatedAtUnix)?Gt.updatedAtUnix:void 0)??(typeof Gt?.fileModUnix=="number"&&Number.isFinite(Gt.fileModUnix)?Gt.fileModUnix:void 0)??0,gn=lt&&Jt?`${lt}?v=${encodeURIComponent(String(Jt))}`:lt||void 0,ln=!!gn&&ie>1,_n=ln&&yt>0&&Vt>0,En=ln?ie:0,Ut=ln?kn:0,hn=ln,cn=mt[Ue],en=typeof cn=="number"&&En>1?G1(cn/(En-1),0,1):void 0,zt=_n&&typeof cn=="number"?(()=>{const Rt=G1(cn,0,Math.max(0,ie-1)),qn=Rt%yt,_i=Math.floor(Rt/yt),Mn=yt<=1?0:qn/(yt-1)*100,Wt=Vt<=1?0:_i/(Vt-1)*100;return{backgroundImage:`url("${gn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${yt*100}% ${Vt*100}%`,backgroundPosition:`${Mn}% ${Wt}%`}})():void 0,Dt=ye===Ue&&!!pt,Ot=!Dt&&!!zt,Hn=Dt||Ot;return c.jsxs("div",{role:"button",tabIndex:0,className:["group relative rounded-lg overflow-hidden outline-1 outline-black/5 dark:-outline-offset-1 dark:outline-white/10","bg-white dark:bg-gray-900/40","transition-all duration-200","hover:-translate-y-0.5 hover:shadow-md dark:hover:shadow-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500",kt&&"pointer-events-none opacity-70",B.has(Ue)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",Y.has(Ue)&&"opacity-0 translate-y-2 scale-[0.98]",Lt&&"hidden"].filter(Boolean).join(" "),onClick:()=>X(je),onKeyDown:Rt=>{(Rt.key==="Enter"||Rt.key===" ")&&X(je)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:L(Ue),onMouseEnter:()=>{Re(Ue),W?.(Ue)},onMouseLeave:()=>{Re(Rt=>Rt===Ue?null:Rt),W?.(null),Oe(Ue),be(Rt=>Rt===Ue?null:Rt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:je,getFileName:Rt=>$r(S(Rt)),durationSeconds:i[Ue]??je?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Hn?!1:a==="all"?!0:a==="hover"?h===Ue:!1,animatedMode:"teaser",animatedTrigger:"always",muted:gt,popoverMuted:gt,scrubProgressRatio:en,preferScrubProgress:typeof cn=="number"})}),_n&&gn?c.jsx("img",{src:gn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Ot&&zt?c.jsx("div",{className:"absolute inset-x-0 top-0 bottom-[6px] z-[5]","aria-hidden":"true",children:c.jsx("div",{className:"h-full w-full",style:zt})}):null,Dt&&pt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:pt,alt:st?`${st} preview`:"Model preview",className:"h-full w-full object-cover",draggable:!1}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/65 to-transparent px-2 py-1.5",children:c.jsx("div",{className:"text-[10px] font-semibold tracking-wide text-white/95",children:"MODEL PREVIEW"})})]}):null,hn&&we===Ue?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx(_y,{className:"pointer-events-auto px-1",imageCount:En,activeIndex:cn,onActiveIndexChange:Rt=>ct(Ue,Rt),onIndexClick:Rt=>{ct(Ue,Rt),g(je,Rt,En)},stepSeconds:Ut})}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",children:c.jsxs("div",{className:"flex items-center gap-1.5 text-right text-[11px] font-semibold leading-none text-white [text-shadow:_0_1px_0_rgba(0,0,0,0.95),_1px_0_0_rgba(0,0,0,0.95),_-1px_0_0_rgba(0,0,0,0.95),_0_-1px_0_rgba(0,0,0,0.95),_1px_1px_0_rgba(0,0,0,0.8),_-1px_1px_0_rgba(0,0,0,0.8),_1px_-1px_0_rgba(0,0,0,0.8),_-1px_-1px_0_rgba(0,0,0,0.8)]",title:[Le,Pe?`${Pe.w}×${Pe.h}`:et||"",ke].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Le}),et?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,et?c.jsx("span",{children:et}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:ke})]})})]})}),c.jsxs("div",{className:"relative min-h-[118px] px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[he?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:$r(Ie)||"—",children:$r(Ie)||"—"})]})}),c.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[c.jsx("div",{className:"min-w-0",children:c.jsx("span",{className:["block truncate text-xs text-gray-500 dark:text-gray-400",pt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:pt?`${st} (Hover: Model-Preview)`:st,onMouseEnter:Rt=>{Rt.stopPropagation(),pt&&be(Ue)},onMouseLeave:Rt=>{Rt.stopPropagation(),be(qn=>qn===Ue?null:qn)},onMouseDown:Rt=>Rt.stopPropagation(),onClick:Rt=>Rt.stopPropagation(),children:st||"—"})}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[$e?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,tt?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Ye?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:je,variant:"table",busy:kt,collapseToMenu:!0,compact:!0,isHot:he,isFavorite:Ye,isLiked:tt,isWatching:$e,onToggleWatch:q,onToggleFavorite:me,onToggleLike:ue,onToggleHot:async Rt=>{if(!(te&&te(Rt)))return k(Rt)},onKeep:async Rt=>Q&&Q(Rt)?!0:le(Rt),onDelete:async Rt=>P&&P(Rt)?!0:R(Rt),order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:Rt=>Rt.stopPropagation(),onMouseDown:Rt=>Rt.stopPropagation(),children:c.jsx(dd,{rowKey:Ue,tags:ht,activeTagSet:V,lower:j,onToggleTagFilter:ne})})]})]},Ue)})}),e&&n.length===0?c.jsx("div",{className:"absolute inset-0 z-20 grid place-items-center rounded-lg bg-white/50 backdrop-blur-[2px] dark:bg-gray-950/40",children:c.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white/80 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/70",children:[c.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-gray-300 border-t-transparent dark:border-white/20 dark:border-t-transparent"}),c.jsx("div",{className:"text-sm font-medium text-gray-800 dark:text-gray-100",children:"Lade…"})]})}):null]})}function K1(n,e,t){return Math.max(e,Math.min(t,n))}function Mp(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function v3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=Mp(a,Math.min(t,l)),h=Mp(Math.max(l-t+1,t+1),l),f=Math.max(Math.min(e-i,l-t-i*2-1),t+1),g=Math.min(Math.max(e+i,t+i*2+2),l-t),_=[];_.push(...u),f>t+1?_.push("ellipsis"):t+1t&&_.push(l-t),_.push(...h);const S=new Set;return _.filter(C=>{const N=String(C);return S.has(N)?!1:(S.add(N),!0)})}function x3({active:n,disabled:e,rounded:t,onClick:i,children:a,title:l}){const u=t==="l"?"rounded-l-md":t==="r"?"rounded-r-md":"";return c.jsx("button",{type:"button",disabled:e,onClick:e?void 0:i,title:l,className:on("relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:z-20 focus:outline-offset-0",u,e?"opacity-50 cursor-not-allowed":"cursor-pointer",n?"z-10 bg-indigo-600 text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:bg-indigo-500 dark:focus-visible:outline-indigo-500":"text-gray-900 inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:text-gray-200 dark:inset-ring-gray-700 dark:hover:bg-white/5"),"aria-current":n?"page":void 0,children:a})}function kf({page:n,pageSize:e,totalItems:t,onPageChange:i,siblingCount:a=1,boundaryCount:l=1,showSummary:u=!0,className:h,ariaLabel:f="Pagination",prevLabel:g="Previous",nextLabel:_="Next"}){const S=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),C=K1(n||1,1,S);if(S<=1)return null;const N=t===0?0:(C-1)*e+1,O=Math.min(C*e,t),E=v3(S,C,l,a),B=H=>i(K1(H,1,S));return c.jsxs("div",{className:on("flex items-center justify-between bg-white dark:border-white/10 dark:bg-transparent",h),children:[c.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[c.jsx("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:g}),c.jsx("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:_})]}),c.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[c.jsx("div",{children:u?c.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300 px-2",children:["Showing ",c.jsx("span",{className:"font-medium",children:N})," to"," ",c.jsx("span",{className:"font-medium",children:O})," of"," ",c.jsx("span",{className:"font-medium",children:t})," results"]}):null}),c.jsx("div",{children:c.jsxs("nav",{"aria-label":f,className:"isolate inline-flex -space-x-px rounded-md shadow-xs dark:shadow-none",children:[c.jsxs("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:g}),c.jsx(u3,{"aria-hidden":"true",className:"size-5"})]}),E.map((H,Y)=>H==="ellipsis"?c.jsx("span",{className:"relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 inset-ring inset-ring-gray-300 dark:text-gray-400 dark:inset-ring-gray-700",children:"…"},`e-${Y}`):c.jsx(x3,{active:H===C,onClick:()=>B(H),rounded:"none",children:H},H)),c.jsxs("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:_}),c.jsx(d3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Bw=p.createContext(null),jp=220;function _3(n){switch(n){case"success":return{Icon:$A,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:wN,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:WA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:tN,cls:"text-sky-600 dark:text-sky-400"}}}function w3(n){switch(n){case"success":return"border-emerald-200/80 dark:border-emerald-400/20";case"error":return"border-rose-200/80 dark:border-rose-400/20";case"warning":return"border-amber-200/80 dark:border-amber-400/20";default:return"border-sky-200/80 dark:border-sky-400/20"}}function T3(n){switch(n){case"success":return{line:"bg-emerald-500 dark:bg-emerald-400",progressTrack:"bg-emerald-500/10 dark:bg-emerald-400/10",progressFill:"bg-emerald-500/70 dark:bg-emerald-400/70",iconBg:"bg-emerald-50 dark:bg-emerald-400/10"};case"error":return{line:"bg-rose-500 dark:bg-rose-400",progressTrack:"bg-rose-500/10 dark:bg-rose-400/10",progressFill:"bg-rose-500/70 dark:bg-rose-400/70",iconBg:"bg-rose-50 dark:bg-rose-400/10"};case"warning":return{line:"bg-amber-500 dark:bg-amber-400",progressTrack:"bg-amber-500/10 dark:bg-amber-400/10",progressFill:"bg-amber-500/70 dark:bg-amber-400/70",iconBg:"bg-amber-50 dark:bg-amber-400/10"};default:return{line:"bg-sky-500 dark:bg-sky-400",progressTrack:"bg-sky-500/10 dark:bg-sky-400/10",progressFill:"bg-sky-500/70 dark:bg-sky-400/70",iconBg:"bg-sky-50 dark:bg-sky-400/10"}}}function S3(n){switch(n){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function k3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function E3({children:n,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[a,l]=p.useState([]),[u,h]=p.useState(!0),f=p.useRef({}),g=p.useRef({}),_=p.useRef({}),S=p.useRef({}),C=p.useRef({}),N=p.useCallback(k=>{const j=f.current[k];j&&(window.clearTimeout(j),delete f.current[k]);const Z=g.current[k];Z&&(window.clearTimeout(Z),delete g.current[k]),delete _.current[k],delete S.current[k],delete C.current[k]},[]),O=p.useCallback(async()=>{try{const k=await fetch("/api/settings",{cache:"no-store"});if(!k.ok)return;const j=await k.json();h(!!(j?.enableNotifications??!0))}catch{}},[]);p.useEffect(()=>{O();const k=()=>O();return window.addEventListener("recorder-settings-updated",k),()=>window.removeEventListener("recorder-settings-updated",k)},[O]),p.useEffect(()=>{u||(l(j=>j.map(Z=>Z.type==="error"?Z:{...Z,open:!1})),a.filter(j=>j.type!=="error").map(j=>j.id).forEach(j=>{N(j),g.current[j]=window.setTimeout(()=>{l(Z=>Z.filter(V=>V.id!==j)),delete g.current[j]},jp)}))},[u]);const E=p.useCallback(k=>{l(j=>j.map(Z=>Z.id===k?{...Z,open:!1}:Z)),N(k),g.current[k]=window.setTimeout(()=>{l(j=>j.filter(Z=>Z.id!==k)),delete g.current[k]},jp)},[N]),B=p.useCallback(()=>{l(k=>k.map(j=>({...j,open:!1}))),Object.keys(f.current).forEach(k=>{window.clearTimeout(f.current[k]),delete f.current[k]}),Object.keys(g.current).forEach(k=>{window.clearTimeout(g.current[k]),delete g.current[k]}),window.setTimeout(()=>l([]),jp)},[]),H=p.useCallback((k,j)=>{if(!j||j<=0)return;const Z=f.current[k];Z&&(window.clearTimeout(Z),delete f.current[k]),_.current[k]=Date.now(),S.current[k]=j,C.current[k]=!1,f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]),Y=p.useCallback(k=>{if(!u&&k.type!=="error")return"";const j=k3(),Z=k.durationMs??t;return l(V=>{const ne=[{...k,id:j,durationMs:Z,open:!0},...V],me=Math.max(1,e),ue=ne.slice(0,me);return ne.slice(me).forEach(P=>N(P.id)),ue}),Z&&Z>0&&H(j,Z),j},[t,e,u,N,H]),U=p.useCallback(k=>{if(C.current[k])return;const j=f.current[k];if(!j)return;window.clearTimeout(j),delete f.current[k];const Z=_.current[k]??Date.now(),V=S.current[k]??0,ne=Date.now()-Z,me=Math.max(0,V-ne);S.current[k]=me,C.current[k]=!0},[]),re=p.useCallback(k=>{if(!C.current[k])return;const j=S.current[k]??0;if(j<=0){E(k);return}C.current[k]=!1,_.current[k]=Date.now(),f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]);p.useEffect(()=>()=>{Object.values(f.current).forEach(k=>window.clearTimeout(k)),Object.values(g.current).forEach(k=>window.clearTimeout(k))},[]);const W=p.useMemo(()=>({push:Y,remove:E,clear:B}),[Y,E,B]),X=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",R=i.endsWith("left")?"sm:items-start":"sm:items-end",le=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return c.jsxs(Bw.Provider,{value:W,children:[n,c.jsx("style",{children:` @keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } } .toast-progress-bar { animation-name: toast-progress; animation-timing-function: linear; animation-fill-mode: forwards; transform-origin: left center; will-change: transform; } `}),c.jsx("div",{"aria-live":"assertive",className:["pointer-events-none fixed z-[80] inset-x-0",le].join(" "),children:c.jsx("div",{className:["flex w-full px-3 py-4 sm:px-6 sm:py-6",X].join(" "),children:c.jsx("div",{className:["flex w-full flex-col gap-2.5 sm:gap-3",R].join(" "),children:a.map(k=>{const{Icon:j,cls:Z}=_3(k.type),V=T3(k.type),ne=(k.title||"").trim()||S3(k.type),me=(k.message||"").trim(),ue=(k.imageUrl||"").trim(),q=(k.imageAlt||ne).trim(),P=typeof k.onClick=="function";return c.jsx(Jc,{appear:!0,show:k.open,enter:"transform transition ease-out duration-250",enterFrom:"opacity-0 -translate-y-3 sm:-translate-y-2",enterTo:"opacity-100 translate-y-0",leave:"transform transition ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-2 sm:-translate-y-3",children:c.jsx("div",{role:P?"button":"status",className:["pointer-events-auto relative w-[22rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-xl","border bg-white dark:bg-slate-900","shadow-sm","ring-1 ring-black/5 dark:ring-white/5",P?"cursor-pointer transition-[box-shadow,transform,background-color] duration-150 hover:bg-gray-50 dark:hover:bg-slate-800/90 hover:shadow-lg hover:ring-black/10 dark:hover:ring-white/10 active:scale-[0.998]":"",w3(k.type)].join(" "),onMouseEnter:()=>U(k.id),onMouseLeave:()=>re(k.id),onFocus:()=>U(k.id),onBlur:()=>re(k.id),onClick:()=>{k.onClick&&(k.onClick(),k.closeOnClick!==!1&&E(k.id))},onKeyDown:Q=>{k.onClick&&(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),k.onClick(),k.closeOnClick!==!1&&E(k.id))},tabIndex:P?0:void 0,"aria-label":P?`${ne} öffnen`:void 0,children:ue?c.jsxs("div",{className:"relative pr-12 sm:pr-14",children:[c.jsxs("div",{className:"flex items-stretch",children:[c.jsx("div",{className:"shrink-0",children:c.jsx("img",{src:ue,alt:q,loading:"lazy",referrerPolicy:"no-referrer",className:["h-full min-h-[72px] w-16 sm:w-[72px]","object-cover object-center","rounded-l-xl","border-r border-black/5 dark:border-white/10","bg-gray-100 dark:bg-white/5"].join(" ")})}),c.jsxs("div",{className:"min-w-0 flex-1 py-3 pl-3 pr-2 sm:py-3.5 sm:pl-3.5 sm:pr-3",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:Q=>{Q.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(z1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]}):c.jsxs("div",{className:"relative pr-12 py-2.5 sm:pr-14",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 sm:px-3.5",children:[c.jsx("div",{className:"shrink-0",children:c.jsx("div",{className:["inline-flex h-12 w-12 sm:h-14 sm:w-14 items-center justify-center rounded-full",V.iconBg,"ring-1 ring-black/5 dark:ring-white/10"].join(" "),children:c.jsx(j,{className:["size-5.5 sm:size-6",Z].join(" "),"aria-hidden":"true"})})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:Q=>{Q.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(z1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]})})},k.id)})})})})]})}function C3(){const n=p.useContext(Bw);if(!n)throw new Error("useToast must be used within ");return n}function Pw(){const{push:n,remove:e,clear:t}=C3(),i=a=>(l,u,h)=>n({type:a,title:l,message:u,...h});return{push:n,remove:e,clear:t,success:i("success"),error:i("error"),info:i("info"),warning:i("warning")}}function A3(n){return typeof n=="number"?n:n==="xs"?12:n==="sm"?16:n==="lg"?28:20}function W1(...n){return n.filter(Boolean).join(" ")}function X1({size:n="md",className:e,label:t,srLabel:i="Lädt…",center:a=!1}){const l=A3(n);return c.jsxs("span",{className:W1("inline-flex items-center gap-2",a&&"justify-center w-full"),role:"status","aria-live":"polite",children:[c.jsxs("svg",{width:l,height:l,viewBox:"0 0 24 24",className:W1("animate-spin text-gray-500",e),"aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"currentColor",strokeWidth:"3",opacity:"0.25"}),c.jsx("path",{fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",d:"M21 12a9 9 0 0 0-9-9",opacity:"0.95"})]}),t?c.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-200",children:t}):c.jsx("span",{className:"sr-only",children:i})]})}const wy=n=>(n||"").replaceAll("\\","/"),ir=n=>{const t=wy(n).split("/");return t[t.length-1]||""},vi=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):ir(n.output||"")||String(n?.output||"")},N3=n=>{const e=wy(String(n??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function Y1(n){if(!Number.isFinite(n)||n<=0)return"—";const e=Math.floor(n/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function Rp(n){if(typeof n!="number"||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function Q1(n){const[e,t]=p.useState(!1);return p.useEffect(()=>{const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}const Lc=n=>{const e=ir(n||""),t=$r(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i},ts=n=>(n||"").trim().toLowerCase(),D3=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a.sort((l,u)=>l.localeCompare(u,void 0,{sensitivity:"base"})),a},Op=n=>{const e=n,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function Z1(n){return new Promise(e=>window.setTimeout(e,n))}function M3(n){return n instanceof Error?n.message||String(n):String(n??"")}function J1(n){const e=M3(n).toLowerCase();return e.includes("wird gerade verwendet")||e.includes("wird gerade abgespielt")||e.includes("sharing violation")||e.includes("used by another process")||e.includes("file in use")||e.includes("409")}async function Lp(n,e){const t=await fetch(n,e);if(!t.ok){const a=(await t.text().catch(()=>"")||`HTTP ${t.status}`).trim();throw new Error(a)}return t}function j3(){const n=p.useRef([]),e=p.useRef(!1),t=p.useRef(!1),i=p.useRef(new Set),a=p.useCallback(()=>{if(t.current)return;t.current=!0;const f=()=>{t.current=!1,l()};typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(f,{timeout:250}):setTimeout(f,0)},[]),l=p.useCallback(async()=>{if(!e.current){e.current=!0;try{for(;n.current.length>0;){const f=n.current.shift();if(f){try{await f.run()}finally{i.current.delete(f.id)}await new Promise(g=>setTimeout(g,0))}}}finally{e.current=!1,n.current.length>0&&a()}}},[a]),u=p.useCallback((f,g)=>!f||i.current.has(f)?!1:(i.current.add(f),n.current.push({id:f,run:g}),a(),!0),[a]),h=p.useCallback(f=>i.current.has(f),[]);return{enqueue:u,isQueued:h}}function R3({jobs:n,doneJobs:e,blurPreviews:t,teaserPlayback:i,teaserAudio:a,onOpenPlayer:l,onDeleteJob:u,onToggleHot:h,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,onKeepJob:S,doneTotal:C,page:N,pageSize:O,onPageChange:E,assetNonce:B,sortMode:H,onSortModeChange:Y,modelsByKey:U,loadMode:re="paged"}){const W=re==="all",X=i??"hover",R=Q1("(hover: hover) and (pointer: fine)"),le=Pw(),k=j3(),j=p.useRef(new Map),[Z,V]=p.useState(null),[ne,me]=p.useState(null),ue=p.useRef(null),q=p.useRef(new WeakMap),[P,Q]=p.useState(()=>new Set),[te,ge]=p.useState(()=>new Set),[L,xe]=p.useState(!1),Te=p.useRef(!1),ye=p.useRef(!1),be=p.useRef(0),mt="finishedDownloads_lastUndo_v1",[Ke,we]=p.useState(()=>{if(typeof window>"u")return null;try{const z=localStorage.getItem(mt);if(!z)return null;const G=JSON.parse(z);if(!G||G.v!==1||!G.action)return null;const ee=Date.now()-Number(G.ts||0);return!Number.isFinite(ee)||ee<0||ee>1800*1e3?(localStorage.removeItem(mt),null):G.action}catch{return null}}),[Re,ct]=p.useState(!1);p.useEffect(()=>{try{if(!Ke){localStorage.removeItem(mt);return}const z={v:1,action:Ke,ts:Date.now()};localStorage.setItem(mt,JSON.stringify(z))}catch{}},[Ke]);const[Oe,je]=p.useState({}),[Ue,ze]=p.useState(null),[gt,st]=p.useState(null),[bt,Qe]=p.useState(0),Ye=p.useRef(null),tt=p.useRef({pending:0,t:0,timer:0}),$e=p.useCallback(z=>{!z||!Number.isFinite(z)||(tt.current.pending+=z,!tt.current.timer&&(tt.current.timer=window.setTimeout(()=>{tt.current.timer=0;const G=tt.current.pending;tt.current.pending=0,G&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:G}}))},120)))},[]),ht="finishedDownloads_view",At="finishedDownloads_includeKeep_v2",he="finishedDownloads_mobileOptionsOpen_v1",[Ie,Le]=p.useState("table"),[ke,Pe]=p.useState(!1),[et,kt]=p.useState(!1),Lt=p.useRef(new Map),[pt,Zt]=p.useState([]),qt=p.useMemo(()=>new Set(pt.map(ts)),[pt]),Gt=p.useMemo(()=>{const z={},G={};for(const[ee,ae]of Object.entries(U??{})){const Be=ts(ee),Je=D3(ae?.tags);z[Be]=Je,G[Be]=new Set(Je.map(ts))}return{tagsByModelKey:z,tagSetByModelKey:G}},[U]),[wt,lt]=p.useState(""),Yt=p.useDeferredValue(wt),kn=p.useMemo(()=>ts(Yt).split(/\s+/g).map(z=>z.trim()).filter(Boolean),[Yt]),pn=p.useCallback(()=>lt(""),[]),xn=p.useCallback(z=>{const G=ts(z);Zt(ee=>ee.some(Be=>ts(Be)===G)?ee.filter(Be=>ts(Be)!==G):[...ee,z])},[]),M=qt.size>0||kn.some(z=>z.length>=2),F=M||W,ie=p.useCallback(async z=>{const G=Ue==null;G&&xe(!0);try{const ee=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(H)}&withCount=1${ke?"&includeKeep=1":""}`,{cache:"no-store",signal:z});if(!ee.ok)return;const ae=await ee.json().catch(()=>null),Be=Array.isArray(ae?.items)?ae.items:[],Je=Number(ae?.count??ae?.totalCount??Be.length);ze(Be),st(Number.isFinite(Je)?Je:Be.length)}finally{G&&xe(!1)}},[H,ke]),De=p.useCallback(()=>Zt([]),[]);p.useEffect(()=>{try{const z=localStorage.getItem("finishedDownloads_pendingTags");if(!z)return;const G=JSON.parse(z),ee=Array.isArray(G)?G.map(ae=>String(ae||"").trim()).filter(Boolean):[];if(ee.length===0)return;yu.flushSync(()=>Zt(ee)),N!==1&&E(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const Ve=p.useCallback(()=>{Ye.current==null&&(Ye.current=window.setTimeout(()=>{Ye.current=null,Qe(z=>z+1)},80))},[N,O,H,ke]);p.useEffect(()=>{if(!F)return;const z=new AbortController,G=window.setTimeout(()=>{ie(z.signal).catch(()=>{})},250);return()=>{window.clearTimeout(G),z.abort()}},[F,ie]),p.useEffect(()=>{if(bt===0)return;const z=new AbortController;let G=!0,ee=!1;const ae=++be.current,Be=()=>{ee||(ee=!0,be.current===ae&&(Te.current=!1,ye.current&&(ye.current=!1,Ve())))};return be.current===ae&&(Te.current=!0),F?((async()=>{try{await ie(z.signal),G&&(hn.current=0)}catch{}finally{G&&Be()}})(),()=>{G=!1,z.abort(),Be()}):(xe(!0),(async()=>{try{const Je=await fetch(`/api/record/done?page=${N}&pageSize=${O}&sort=${encodeURIComponent(H)}&withCount=1${ke?"&includeKeep=1":""}`,{cache:"no-store",signal:z.signal});if(!G||z.signal.aborted)return;const We=Je.ok;if(Je.ok){const ut=await Je.json().catch(()=>null);if(!G||z.signal.aborted)return;const Mt=Array.isArray(ut?.items)?ut.items:Array.isArray(ut)?ut:[];ze(Mt);const Nt=Number(ut?.count??ut?.totalCount??Mt.length),jt=Number.isFinite(Nt)&&Nt>=0?Nt:0;st(jt);const Qt=Math.max(1,Math.ceil(jt/O));if(N>Qt){E(Qt),ze(null);return}}if(We)hn.current=0;else if(G&&!z.signal.aborted&&hn.current<2){hn.current+=1;const ut=hn.current;window.setTimeout(()=>{z.signal.aborted||Qe(Mt=>Mt+1)},400*ut)}}catch{}finally{G&&(xe(!1),Be())}})(),()=>{G=!1,z.abort(),Be()})},[bt,F,ie,N,O,H,ke,E]),p.useEffect(()=>{F||(ze(null),st(null))},[N,O,H,ke,F]),p.useEffect(()=>{if(!ke){M||(ze(null),st(null));return}if(M)return;const z=new AbortController;return(async()=>{try{const G=await fetch(`/api/record/done?page=${N}&pageSize=${O}&sort=${encodeURIComponent(H)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:z.signal});if(!G.ok)return;const ee=await G.json().catch(()=>null),ae=Array.isArray(ee?.items)?ee.items:[],Be=Number(ee?.count??ee?.totalCount??ae.length);ze(ae),st(Number.isFinite(Be)?Be:ae.length)}catch{}})(),()=>z.abort()},[ke,M,N,O,H]),p.useEffect(()=>{try{const z=localStorage.getItem(ht);Le(z==="table"||z==="cards"||z==="gallery"?z:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Le("table")}},[]),p.useEffect(()=>{try{localStorage.setItem(ht,Ie)}catch{}},[Ie]),p.useEffect(()=>{try{const z=localStorage.getItem(At);Pe(z==="1"||z==="true"||z==="yes")}catch{Pe(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(At,ke?"1":"0")}catch{}},[ke]),p.useEffect(()=>{try{const z=localStorage.getItem(he);kt(z==="1"||z==="true"||z==="yes")}catch{kt(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(he,et?"1":"0")}catch{}},[et]);const[yt,Vt]=p.useState({}),Jt=p.useRef({}),gn=p.useRef(null),[ln,_n]=p.useState({}),En=p.useRef({}),Ut=p.useRef(null),hn=p.useRef(0);p.useEffect(()=>{En.current=ln},[ln]);const cn=p.useCallback(()=>{Ut.current==null&&(Ut.current=window.setTimeout(()=>{Ut.current=null,_n({...En.current})},200))},[]);p.useEffect(()=>()=>{Ut.current!=null&&(window.clearTimeout(Ut.current),Ut.current=null)},[]),p.useEffect(()=>{Jt.current=yt},[yt]);const en=p.useCallback(()=>{gn.current==null&&(gn.current=window.setTimeout(()=>{gn.current=null,Vt({...Jt.current})},200))},[]);p.useEffect(()=>()=>{gn.current!=null&&(window.clearTimeout(gn.current),gn.current=null)},[]);const[zt,Dt]=p.useState(null),Ot=!a,Hn=p.useCallback(z=>{const ee=document.getElementById(z)?.querySelector("video");if(!ee)return!1;cd(ee,{muted:Ot});const ae=ee.play?.();return ae&&typeof ae.catch=="function"&&ae.catch(()=>{}),!0},[Ot]),Rt=p.useCallback(z=>{Dt(G=>G?.key===z?{key:z,nonce:G.nonce+1}:{key:z,nonce:1})},[]),qn=p.useCallback((z,G,ee)=>{const ae=Number.isFinite(G)&&G>0?G:0;Dt(Je=>Je?.key===z?{key:z,nonce:Je.nonce+1}:{key:z,nonce:1});const Be=Je=>{const ut=document.getElementById(ee)?.querySelector("video");if(!ut){Je>0&&requestAnimationFrame(()=>Be(Je-1));return}cd(ut,{muted:Ot});const Mt=()=>{try{const Gn=Number(ut.duration),rr=Number.isFinite(Gn)&&Gn>0?Math.max(0,Gn-.05):ae;ut.currentTime=Math.max(0,Math.min(ae,rr))}catch{}const Qt=ut.play?.();Qt&&typeof Qt.catch=="function"&&Qt.catch(()=>{})};if(ut.readyState>=1){Mt();return}const Nt=()=>{ut.removeEventListener("loadedmetadata",Nt),Mt()};ut.addEventListener("loadedmetadata",Nt,{once:!0});const jt=ut.play?.();jt&&typeof jt.catch=="function"&&jt.catch(()=>{})};requestAnimationFrame(()=>Be(8))},[Ot]),_i=p.useCallback(z=>{Dt(null),l(z)},[l]),Mn=p.useCallback((z,G)=>{const ee=Number.isFinite(G)&&G>=0?G:0;Dt(null),l(z,ee)},[l]),Wt=p.useCallback((z,G,ee)=>{const ae=Number.isFinite(G)?Math.floor(G):0,Be=Number.isFinite(ee)?Math.floor(ee):0;if(Be<=0){_i(z);return}const Je=vi(z),We=yt[Je]??z?.durationSeconds??0;if(!Number.isFinite(We)||We<=0){_i(z);return}const ut=Math.max(0,Math.min(ae,Be-1)),Mt=We/Be,Nt=ut*Mt;Mn(z,Nt)},[yt,vi,_i,Mn]),zn=p.useCallback((z,G)=>{ge(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),Kn=p.useCallback(z=>{Q(G=>{const ee=new Set(G);return ee.add(z),ee})},[]),[jn,Wn]=p.useState(()=>new Set),Cn=p.useCallback((z,G)=>{Wn(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),[fi,Xn]=p.useState(()=>new Set),li=p.useRef(new Map);p.useEffect(()=>()=>{for(const z of li.current.values())window.clearTimeout(z);li.current.clear()},[]);const _e=p.useCallback((z,G)=>{Xn(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),at=p.useCallback(z=>{const G=li.current.get(z);G!=null&&(window.clearTimeout(G),li.current.delete(z))},[]),Ct=p.useCallback(z=>{at(z),Q(G=>{const ee=new Set(G);return ee.delete(z),ee}),Xn(G=>{const ee=new Set(G);return ee.delete(z),ee}),ge(G=>{const ee=new Set(G);return ee.delete(z),ee}),Wn(G=>{const ee=new Set(G);return ee.delete(z),ee})},[at]),St=p.useCallback(z=>{_e(z,!0),at(z);const G=window.setTimeout(()=>{li.current.delete(z),Kn(z),_e(z,!1)},320);li.current.set(z,G)},[Kn,_e,at]),Pt=p.useCallback(async(z,G)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),G?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:z}})),await new Promise(ee=>requestAnimationFrame(()=>ee())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),await new Promise(ee=>window.setTimeout(ee,260))},[]),tn=p.useCallback(async(z,G,ee)=>{const ae=Math.max(1,ee?.attempts??4),Be=Math.max(50,ee?.baseDelayMs??220);let Je;for(let We=1;We<=ae;We++)try{return await Pt(z,{close:ee?.close??!0}),We>1?await Z1(Be*We):await Z1(80),await G()}catch(ut){if(Je=ut,!J1(ut)||We>=ae)throw ut;continue}throw Je instanceof Error?Je:new Error(String(Je??"Unbekannter Fehler"))},[Pt]),wn=p.useCallback(async z=>{const{file:G,rowKey:ee,setBusy:ae,isBusyNow:Be,optimisticRemove:Je,alreadyRemoved:We,run:ut,onSuccess:Mt,onError:Nt,labels:jt}=z;if(!G)return le.error(jt.invalidTitle,jt.invalidBody),{ok:!1};if(Be?.())return{ok:!1};ae?.(!0);try{Je&&!We&&St(ee);const Qt=await ut();return await Mt?.(Qt),{ok:!0,result:Qt}}catch(Qt){if(Je&&Ct(ee),await Nt?.(Qt),J1(Qt))le.error(jt.inUseTitle,`${G} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const Gn=Qt?.message?` — ${String(Qt.message)}`:"";le.error(jt.failTitle,`${jt.failPrefix??G}${Gn}`)}return{ok:!1}}finally{ae?.(!1)}},[le,St,Ct]),vt=p.useCallback(async(z,G)=>{const ee=ir(z.output||""),ae=vi(z);return(await wn({kind:"delete",job:z,file:ee,rowKey:ae,setBusy:Je=>zn(ae,Je),isBusyNow:()=>te.has(ae),optimisticRemove:!0,alreadyRemoved:G?.alreadyRemoved,labels:{invalidTitle:"Löschen nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht löschen.",inUseTitle:"Löschen fehlgeschlagen",failTitle:"Löschen fehlgeschlagen",failPrefix:ee},run:async()=>u?await tn(ee,async()=>await u(z),{close:!0,attempts:4,baseDelayMs:220}):await(await tn(ee,async()=>await Lp(`/api/record/delete?file=${encodeURIComponent(ee)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Je=>{if(u){const Mt=typeof Je?.undoToken=="string"?Je.undoToken:"";we(Mt?{kind:"delete",undoToken:Mt,originalFile:ee,rowKey:ae}:null);return}const We=Je?.from==="keep"?"keep":"done",ut=typeof Je?.undoToken=="string"?Je.undoToken:"";we(ut?{kind:"delete",undoToken:ut,originalFile:ee,rowKey:ae,from:We}:null),Ve(),$e(-1)}})).ok},[ir,vi,te,zn,u,tn,wn,Ve,$e]),fn=p.useCallback(async(z,G)=>{const ee=ir(z.output||""),ae=vi(z);return(await wn({kind:"keep",job:z,file:ee,rowKey:ae,setBusy:Je=>Cn(ae,Je),isBusyNow:()=>jn.has(ae)||te.has(ae),optimisticRemove:!0,alreadyRemoved:G?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:ee},run:async()=>S?await tn(ee,async()=>await S(z),{close:!0,attempts:4,baseDelayMs:220}):await(await tn(ee,async()=>await Lp(`/api/record/keep?file=${encodeURIComponent(ee)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Je=>{const We=typeof Je?.newFile=="string"&&Je.newFile?Je.newFile:ee;we({kind:"keep",keptFile:We,originalFile:ee,rowKey:ae}),Ve(),$e(ke?0:-1)}})).ok},[ir,vi,Cn,jn,te,tn,wn,Ve,$e,ke]),Ne=p.useCallback((z,G)=>{!z||!G||z===G||je(ee=>{const ae={...ee};for(const[Be,Je]of Object.entries(ae))(Be===z||Be===G||Je===z||Je===G)&&delete ae[Be];return ae[z]=G,ae})},[]),Tt=p.useCallback((z,G)=>{!z&&!G||je(ee=>{const ae={...ee};for(const[Be,Je]of Object.entries(ae))(Be===z||Be===G||Je===z||Je===G)&&delete ae[Be];return ae})},[]),_t=p.useCallback(async()=>{if(!Ke||Re)return;ct(!0);const z=G=>{Q(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),ge(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),Wn(ee=>{const ae=new Set(ee);return ae.delete(G),ae}),Xn(ee=>{const ae=new Set(ee);return ae.delete(G),ae})};try{if(Ke.kind==="delete"){const G=await fetch(`/api/record/restore?token=${encodeURIComponent(Ke.undoToken)}`,{method:"POST"});if(!G.ok){const Je=await G.text().catch(()=>"");throw new Error(Je||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.restoredFile||Ke.originalFile);Ke.rowKey&&z(Ke.rowKey),z(Ke.originalFile),z(ae);const Be=Ke.from==="keep"&&!ke?0:1;$e(Be),Ve(),we(null);return}if(Ke.kind==="keep"){const G=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Ke.keptFile)}`,{method:"POST"});if(!G.ok){const Be=await G.text().catch(()=>"");throw new Error(Be||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.newFile||Ke.originalFile);Ke.rowKey&&z(Ke.rowKey),z(Ke.originalFile),z(ae),$e(1),Ve(),we(null);return}if(Ke.kind==="hot"){const G=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Ke.currentFile)}`,{method:"POST"});if(!G.ok){const Je=await G.text().catch(()=>"");throw new Error(Je||`HTTP ${G.status}`)}const ee=await G.json().catch(()=>null),ae=String(ee?.oldFile||Ke.currentFile),Be=String(ee?.newFile||"");Be&&Ne(ae,Be),Ve(),we(null);return}}catch(G){le.error("Undo fehlgeschlagen",String(G?.message||G))}finally{ct(!1)}},[Ke,Re,le,Ve,ke,$e,Ne]),[$t,Ht]=p.useState(()=>new Set),yn=p.useCallback((z,G)=>{Ht(ee=>{const ae=new Set(ee);return G?ae.add(z):ae.delete(z),ae})},[]),Xt=p.useCallback(async z=>{const G=ir(z.output||""),ee=vi(z),ae=We=>ou(We)?$r(We):`HOT ${We}`,Be=G,Je=ae(Be);await wn({kind:"rename",job:z,file:G,rowKey:ee,setBusy:We=>yn(ee,We),isBusyNow:()=>$t.has(ee),optimisticRemove:!1,labels:{invalidTitle:"HOT nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht HOT togglen.",inUseTitle:"HOT umbenennen fehlgeschlagen",failTitle:"HOT umbenennen fehlgeschlagen",failPrefix:Be},run:async()=>(Ne(Be,Je),h?await h(z):await(await tn(Be,async()=>await Lp(`/api/record/toggle-hot?file=${encodeURIComponent(Be)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async We=>{const ut=typeof We?.oldFile=="string"&&We.oldFile?We.oldFile:Be,Mt=typeof We?.newFile=="string"&&We.newFile?We.newFile:Je;ut&&Mt&&ut!==Mt&&Ne(ut,Mt),we({kind:"hot",currentFile:Mt}),(!h||H==="file_asc"||H==="file_desc")&&Ve()},onError:async()=>{Tt(Be,Je),we(null)}})},[ir,vi,$t,yn,wn,Ne,Tt,h,tn,Ve,H]),On=p.useCallback(z=>{const G=vi(z),ee=ir(z.output||"");if(!G||!ee||te.has(G)||jn.has(G))return!1;zn(G,!0),St(G);const ae=`delete:${G}`,Be=k.enqueue(ae,async()=>{await vt(z,{alreadyRemoved:!0})});return Be||Ct(G),Be},[k,vi,ir,te,jn,zn,vt]),Vn=p.useCallback(z=>{const G=vi(z),ee=ir(z.output||"");if(!G||!ee||jn.has(G)||te.has(G))return!1;Cn(G,!0),St(G);const ae=`keep:${G}`,Be=k.enqueue(ae,async()=>{await fn(z,{alreadyRemoved:!0})});return Be||Ct(G),Be},[k,vi,ir,jn,te,Cn,fn]),mi=p.useCallback(z=>{const G=vi(z);if(!G||$t.has(G))return!1;const ee=`hot:${G}`;return k.enqueue(ee,async()=>{await Xt(z)})},[k,vi,Xt,$t]),$n=p.useCallback(z=>{const G=wy(z.output||""),ee=ir(G),ae=Oe[ee];if(!ae)return z;const Be=G.lastIndexOf("/"),Je=Be>=0?G.slice(0,Be+1):"";return{...z,output:Je+ae}},[Oe]),ji=Ue??e,Bi=gt??C,pi=p.useMemo(()=>{const z=new Map;for(const ee of ji){const ae=$n(ee);z.set(vi(ae),ae)}for(const ee of n){const ae=$n(ee),Be=vi(ae);z.has(Be)&&z.set(Be,{...z.get(Be),...ae})}return Array.from(z.values()).filter(ee=>P.has(vi(ee))||N3(ee.output)?!1:ee.status==="finished"||ee.status==="failed"||ee.status==="stopped")},[n,ji,P,$n]),gi=p.useRef(new Map);p.useEffect(()=>{const z=new Map;for(const G of pi){const ee=ir(G.output||"");ee&&z.set(ee,vi(G))}gi.current=z},[pi]),p.useEffect(()=>{const z=G=>{const ee=G.detail;if(!ee?.file)return;const ae=gi.current.get(ee.file)||ee.file;if(ee.phase==="start"){zn(ae,!0),St(ae);return}if(ee.phase==="error"){Ct(ae),Lt.current.get(ae)?.reset();return}if(ee.phase==="success"){zn(ae,!1);return}};return window.addEventListener("finished-downloads:delete",z),()=>window.removeEventListener("finished-downloads:delete",z)},[St,zn,Ve,Ct]),p.useEffect(()=>{const z=()=>{if(Te.current){ye.current||(ye.current=!0);return}Ye.current==null&&Ve()};return window.addEventListener("finished-downloads:reload",z),()=>window.removeEventListener("finished-downloads:reload",z)},[Ve]),p.useEffect(()=>{const z=G=>{const ee=G.detail,ae=String(ee?.oldFile??"").trim(),Be=String(ee?.newFile??"").trim();!ae||!Be||ae===Be||Ne(ae,Be)};return window.addEventListener("finished-downloads:rename",z),()=>window.removeEventListener("finished-downloads:rename",z)},[Ne]);const Pn=p.useMemo(()=>{const z=pi.filter(ee=>!P.has(vi(ee))),G=kn.length?z.filter(ee=>{const ae=ir(ee.output||""),Be=Lc(ee.output),Je=ts(Be),We=Gt.tagsByModelKey[Je]??[],ut=ts([ae,$r(ae),Be,ee.id,We.join(" ")].join(" "));for(const Mt of kn)if(!ut.includes(Mt))return!1;return!0}):z;return qt.size===0?G:G.filter(ee=>{const ae=ts(Lc(ee.output)),Be=Gt.tagSetByModelKey[ae];if(!Be||Be.size===0)return!1;for(const Je of qt)if(!Be.has(Je))return!1;return!0})},[pi,P,qt,Gt,kn]),Ri=F?Pn.length:Bi,ei=p.useMemo(()=>{if(!F)return Pn;const z=(N-1)*O,G=z+O;return Pn.slice(Math.max(0,z),Math.max(0,G))},[F,Pn,N,O]),ti=!F&&Ri===0,An=M&&Pn.length===0,ii=W&&Pn.length===0,Pi=L&&(ti||ii||An);p.useEffect(()=>{if(!M)return;const z=Math.max(1,Math.ceil(Pn.length/O));N>z&&E(z)},[M,Pn.length,N,O,E]),p.useEffect(()=>{if(!(X==="hover"&&!R&&(Ie==="cards"||Ie==="gallery"||Ie==="table"))){V(null),ue.current?.disconnect(),ue.current=null;return}if(Ie==="cards"&&zt?.key){V(zt.key);return}ue.current?.disconnect();const G=new IntersectionObserver(ee=>{let ae=null,Be=0;for(const Je of ee){if(!Je.isIntersecting)continue;const We=q.current.get(Je.target);We&&Je.intersectionRatio>Be&&(Be=Je.intersectionRatio,ae=We)}ae&&V(Je=>Je===ae?Je:ae)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});ue.current=G;for(const[ee,ae]of j.current)q.current.set(ae,ee),G.observe(ae);return()=>{G.disconnect(),ue.current===G&&(ue.current=null)}},[Ie,X,R,zt?.key]);const Oi=z=>{const G=vi(z),ee=yt[G]??z?.durationSeconds;if(typeof ee=="number"&&Number.isFinite(ee)&&ee>0)return Y1(ee*1e3);const ae=Date.parse(String(z.startedAt||"")),Be=Date.parse(String(z.endedAt||""));return Number.isFinite(ae)&&Number.isFinite(Be)&&Be>ae?Y1(Be-ae):"—"},se=p.useCallback(z=>G=>{const ee=j.current.get(z);ee&&ue.current&&ue.current.unobserve(ee),G?(j.current.set(z,G),q.current.set(G,z),ue.current?.observe(G)):j.current.delete(z)},[]),I=p.useCallback((z,G)=>{if(!Number.isFinite(G)||G<=0)return;const ee=vi(z),ae=Jt.current[ee];typeof ae=="number"&&Math.abs(ae-G)<.5||(Jt.current={...Jt.current,[ee]:G},en())},[en]),ce=p.useCallback((z,G,ee)=>{if(!Number.isFinite(G)||!Number.isFinite(ee)||G<=0||ee<=0)return;const ae=vi(z),Be=En.current[ae];Be&&Be.w===G&&Be.h===ee||(En.current={...En.current,[ae]:{w:G,h:ee}},cn())},[cn]),pe=Q1("(max-width: 639px)"),Ce="mt-10",Ae="mb-2";return p.useEffect(()=>{if(!pe||Ie!=="cards")return;const z=ei[0];if(!z){V(null);return}const G=vi(z);V(ae=>ae===G?ae:null);const ee=window.setTimeout(()=>{V(ae=>ae===G?ae:G)},140);return()=>window.clearTimeout(ee)},[pe,Ie,ei,vi]),p.useEffect(()=>{pe||(Lt.current=new Map)},[pe]),p.useEffect(()=>{ti&&N!==1&&E(1)},[ti,N,E]),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"sticky top-[56px] z-20",children:c.jsxs("div",{className:`\r rounded-xl border border-gray-200/70 bg-white/80 shadow-sm\r backdrop-blur supports-[backdrop-filter]:bg-white/60\r dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40\r `,children:[c.jsxs("div",{className:"flex items-center gap-3 p-3",children:[c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Ri})]}),c.jsxs("div",{className:"sm:hidden flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Ri})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[L?c.jsx(X1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"}):null,c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 flex-1",children:[c.jsx("input",{value:wt,onChange:z=>lt(z.target.value),placeholder:"Suchen…",className:`\r h-9 w-full max-w-[420px] rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r `}),(wt||"").trim()!==""?c.jsx(sn,{size:"sm",variant:"soft",onClick:pn,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(wa,{label:"Behaltene Downloads anzeigen",checked:ke,onChange:z=>{N!==1&&E(1),Pe(z)}})}),Ie!=="table"&&c.jsxs("div",{className:"hidden sm:block",children:[c.jsx("label",{className:"sr-only",htmlFor:"finished-sort",children:"Sortierung"}),c.jsxs("select",{id:"finished-sort",value:H,onChange:z=>{const G=z.target.value;Y(G),N!==1&&E(1)},className:`\r h-9 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r `,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}),c.jsx(sn,{size:"md",variant:"soft",disabled:!Ke||Re,onClick:_t,title:Ke?`Letzte Aktion rückgängig machen (${Ke.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Fg,{value:Ie,onChange:z=>Le(z),size:pe?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(bN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(hN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(pN,{className:pe?"size-4":"size-5"}),label:pe?void 0:"Galerie",srLabel:"Galerie"}]}),c.jsxs("button",{type:"button",className:`sm:hidden relative inline-flex items-center justify-center rounded-md border border-gray-200 bg-white p-2 shadow-sm\r hover:bg-gray-50 dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-white/10`,onClick:()=>kt(z=>!z),"aria-expanded":et,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(DA,{className:"size-5"}),M||ke?c.jsx("span",{className:"absolute -top-1 -right-1 h-2.5 w-2.5 rounded-full bg-indigo-500 ring-2 ring-white dark:ring-gray-950"}):null]})]})]}),pt.length>0?c.jsxs("div",{className:"hidden sm:flex items-center gap-2 border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[pt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:xn},z)),c.jsx(sn,{className:`\r ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r `,size:"sm",variant:"soft",onClick:De,children:"Zurücksetzen"})]})]}):null,c.jsxs("div",{id:"finished-mobile-options",className:["sm:hidden overflow-hidden transition-[max-height,opacity] duration-200 ease-in-out",et?"max-h-[720px] opacity-100":"max-h-0 opacity-0"].join(" "),children:[c.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 p-3",children:c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{value:wt,onChange:z=>lt(z.target.value),placeholder:"Suchen…",className:`\r h-10 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900\r focus:outline-none focus:ring-2 focus:ring-indigo-500\r dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r `}),(wt||"").trim()!==""?c.jsx(sn,{size:"sm",variant:"soft",onClick:pn,children:"Clear"}):null]})}),c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:"Keep anzeigen"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Behaltene Downloads in der Liste"})]}),c.jsx(Bg,{checked:ke,onChange:z=>{N!==1&&E(1),Pe(z)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),Ie!=="table"?c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-3 py-2 shadow-sm dark:border-white/10 dark:bg-gray-900/60",children:[c.jsx("div",{className:"text-xs font-medium text-gray-600 dark:text-gray-300 mb-1",children:"Sortierung"}),c.jsxs("select",{id:"finished-sort-mobile",value:H,onChange:z=>{const G=z.target.value;Y(G),N!==1&&E(1)},className:`\r w-full h-10 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r `,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}):null]})}),pt.length>0?c.jsx("div",{className:"border-t border-gray-200/60 dark:border-white/10 px-3 py-2",children:c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-300",children:"Tag-Filter"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[pt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:xn},z)),c.jsx(sn,{className:`\r ml-1 inline-flex items-center rounded-md px-2 py-1 text-xs font-medium\r text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-white/10\r `,size:"sm",variant:"soft",onClick:De,children:"Zurücksetzen"})]})]})}):null]})]})}),Pi?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Lade Downloads…"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Bitte warte einen Moment."})]}),c.jsx(X1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):ti||ii?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:c.jsx("span",{className:"text-lg",children:"📁"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine abgeschlossenen Downloads"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Im Zielordner ist aktuell nichts vorhanden."})]})]})}):An?c.jsxs(Ns,{grayBody:!0,children:[c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),pt.length>0||(wt||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[pt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:De,children:"Tag-Filter zurücksetzen"}):null,(wt||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:pn,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[Ie==="cards"&&c.jsx("div",{className:pe?`${Ce} ${Ae}`:"",children:c.jsx(s3,{rows:ei,isSmall:pe,isLoading:L,blurPreviews:t,durations:yt,teaserKey:Z,teaserPlayback:X,teaserAudio:a,hoverTeaserKey:ne,inlinePlay:zt,deletingKeys:te,keepingKeys:jn,removingKeys:fi,swipeRefs:Lt,keyFor:vi,baseName:ir,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,lower:ts,onOpenPlayer:l,openPlayer:_i,onOpenPlayerAt:Mn,handleScrubberClickIndex:Wt,startInlineAt:qn,startInline:Rt,tryAutoplayInline:Hn,registerTeaserHost:se,handleDuration:I,deleteVideo:vt,keepVideo:fn,releasePlayingFile:Pt,modelsByKey:U,onToggleHot:Xt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:qt,onToggleTagFilter:xn,onHoverPreviewKeyChange:me,assetNonce:B??0,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi})}),Ie==="table"&&c.jsx(m3,{rows:ei,isLoading:L,keyFor:vi,baseName:ir,lower:ts,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,resolutions:ln,durations:yt,canHover:R,teaserAudio:a,hoverTeaserKey:ne,setHoverTeaserKey:me,teaserPlayback:X,teaserKey:Z,registerTeaserHost:se,handleDuration:I,handleResolution:ce,blurPreviews:t,assetNonce:B,deletingKeys:te,keepingKeys:jn,removingKeys:fi,modelsByKey:U,activeTagSet:qt,onToggleTagFilter:xn,onOpenPlayer:l,handleScrubberClickIndex:Wt,onSortModeChange:Y,page:N,onPageChange:E,onToggleHot:Xt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,deleteVideo:vt,keepVideo:fn,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi}),Ie==="gallery"&&c.jsx(b3,{rows:ei,isLoading:L,blurPreviews:t,durations:yt,handleDuration:I,teaserKey:Z,teaserPlayback:X,teaserAudio:a,hoverTeaserKey:ne,keyFor:vi,baseName:ir,modelNameFromOutput:Lc,runtimeOf:Oi,sizeBytesOf:Op,formatBytes:Rp,deletingKeys:te,keepingKeys:jn,removingKeys:fi,deletedKeys:P,registerTeaserHost:se,onOpenPlayer:l,handleScrubberClickIndex:Wt,deleteVideo:vt,keepVideo:fn,onToggleHot:Xt,lower:ts,modelsByKey:U,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:qt,onToggleTagFilter:xn,onHoverPreviewKeyChange:me,enqueueDeleteVideo:On,enqueueKeepVideo:Vn,enqueueToggleHot:mi}),c.jsx(kf,{page:N,pageSize:O,totalItems:Ri,onPageChange:z=>{yu.flushSync(()=>{Dt(null),V(null),me(null)});for(const G of ei){const ee=ir(G.output||"");ee&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:ee}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:ee}})))}window.scrollTo({top:0,behavior:"auto"}),E(z)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Ip,e2;function i0(){if(e2)return Ip;e2=1;var n;return typeof window<"u"?n=window:typeof gf<"u"?n=gf:typeof self<"u"?n=self:n={},Ip=n,Ip}var O3=i0();const de=Du(O3),L3={},I3=Object.freeze(Object.defineProperty({__proto__:null,default:L3},Symbol.toStringTag,{value:"Module"})),B3=QE(I3);var Bp,t2;function Fw(){if(t2)return Bp;t2=1;var n=typeof gf<"u"?gf:typeof window<"u"?window:{},e=B3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Bp=t,Bp}var P3=Fw();const xt=Du(P3);var Wh={exports:{}},Pp={exports:{}},n2;function F3(){return n2||(n2=1,(function(n){function e(){return n.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i=a.length?{done:!0}:{done:!1,value:a[h++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(a,l){if(a){if(typeof a=="string")return t(a,l);var u=Object.prototype.toString.call(a).slice(8,-1);if(u==="Object"&&a.constructor&&(u=a.constructor.name),u==="Map"||u==="Set")return Array.from(a);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return t(a,l)}}function t(a,l){(l==null||l>a.length)&&(l=a.length);for(var u=0,h=new Array(l);u=400&&h.statusCode<=599){var g=f;if(l)if(n.TextDecoder){var _=t(h.headers&&h.headers["content-type"]);try{g=new TextDecoder(_).decode(f)}catch{}}else g=String.fromCharCode.apply(null,new Uint8Array(f));a({cause:g});return}a(null,f)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(a,l){var u=l.split("="),h=u[0],f=u[1];return h.trim()==="charset"?f.trim():a},"utf-8")}return $p=e,$p}var o2;function q3(){if(o2)return Wh.exports;o2=1;var n=i0(),e=F3(),t=U3(),i=z3(),a=$3();g.httpHandler=H3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(O){var E={};return O&&O.trim().split(` `).forEach(function(B){var H=B.indexOf(":"),Y=B.slice(0,H).trim().toLowerCase(),U=B.slice(H+1).trim();typeof E[Y]>"u"?E[Y]=U:Array.isArray(E[Y])?E[Y].push(U):E[Y]=[E[Y],U]}),E};Wh.exports=g,Wh.exports.default=g,g.XMLHttpRequest=n.XMLHttpRequest||C,g.XDomainRequest="withCredentials"in new g.XMLHttpRequest?g.XMLHttpRequest:n.XDomainRequest,u(["get","put","post","patch","head","delete"],function(N){g[N==="delete"?"del":N]=function(O,E,B){return E=f(O,E,B),E.method=N.toUpperCase(),_(E)}});function u(N,O){for(var E=0;E"u")throw new Error("callback argument missing");if(N.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var O={uri:N.uri||N.url,headers:N.headers||{},body:N.body,metadata:N.metadata||{},retry:N.retry,timeout:N.timeout},E=g.requestInterceptorsStorage.execute(N.requestType,O);N.uri=E.uri,N.headers=E.headers,N.body=E.body,N.metadata=E.metadata,N.retry=E.retry,N.timeout=E.timeout}var B=!1,H=function(Q,te,ge){B||(B=!0,N.callback(Q,te,ge))};function Y(){X.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(W,0)}function U(){var P=void 0;if(X.response?P=X.response:P=X.responseText||S(X),me)try{P=JSON.parse(P)}catch{}return P}function re(P){if(clearTimeout(ue),clearTimeout(N.retryTimeout),P instanceof Error||(P=new Error(""+(P||"Unknown XMLHttpRequest Error"))),P.statusCode=0,!le&&g.retryManager.getIsEnabled()&&N.retry&&N.retry.shouldRetry()){N.retryTimeout=setTimeout(function(){N.retry.moveToNextAttempt(),N.xhr=X,_(N)},N.retry.getCurrentFuzzedDelay());return}if(N.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var Q={headers:q.headers||{},body:q.body,responseUrl:X.responseURL,responseType:X.responseType},te=g.responseInterceptorsStorage.execute(N.requestType,Q);q.body=te.body,q.headers=te.headers}return H(P,q)}function W(){if(!le){var P;clearTimeout(ue),clearTimeout(N.retryTimeout),N.useXDR&&X.status===void 0?P=200:P=X.status===1223?204:X.status;var Q=q,te=null;if(P!==0?(Q={body:U(),statusCode:P,method:j,headers:{},url:k,rawRequest:X},X.getAllResponseHeaders&&(Q.headers=l(X.getAllResponseHeaders()))):te=new Error("Internal XMLHttpRequest Error"),N.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var ge={headers:Q.headers||{},body:Q.body,responseUrl:X.responseURL,responseType:X.responseType},L=g.responseInterceptorsStorage.execute(N.requestType,ge);Q.body=L.body,Q.headers=L.headers}return H(te,Q,Q.body)}}var X=N.xhr||null;X||(N.cors||N.useXDR?X=new g.XDomainRequest:X=new g.XMLHttpRequest);var R,le,k=X.url=N.uri||N.url,j=X.method=N.method||"GET",Z=N.body||N.data,V=X.headers=N.headers||{},ne=!!N.sync,me=!1,ue,q={body:void 0,headers:{},statusCode:0,method:j,url:k,rawRequest:X};if("json"in N&&N.json!==!1&&(me=!0,V.accept||V.Accept||(V.Accept="application/json"),j!=="GET"&&j!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),Z=JSON.stringify(N.json===!0?Z:N.json))),X.onreadystatechange=Y,X.onload=W,X.onerror=re,X.onprogress=function(){},X.onabort=function(){le=!0,clearTimeout(N.retryTimeout)},X.ontimeout=re,X.open(j,k,!ne,N.username,N.password),ne||(X.withCredentials=!!N.withCredentials),!ne&&N.timeout>0&&(ue=setTimeout(function(){if(!le){le=!0,X.abort("timeout");var P=new Error("XMLHttpRequest timeout");P.code="ETIMEDOUT",re(P)}},N.timeout)),X.setRequestHeader)for(R in V)V.hasOwnProperty(R)&&X.setRequestHeader(R,V[R]);else if(N.headers&&!h(N.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in N&&(X.responseType=N.responseType),"beforeSend"in N&&typeof N.beforeSend=="function"&&N.beforeSend(X),X.send(Z||null),X}function S(N){try{if(N.responseType==="document")return N.responseXML;var O=N.responseXML&&N.responseXML.documentElement.nodeName==="parsererror";if(N.responseType===""&&!O)return N.responseXML}catch{}return null}function C(){}return Wh.exports}var V3=q3();const Uw=Du(V3);var Hp={exports:{}},qp,l2;function G3(){if(l2)return qp;l2=1;var n=Fw(),e=Object.create||(function(){function k(){}return function(j){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return k.prototype=j,new k}})();function t(k,j){this.name="ParsingError",this.code=k.code,this.message=j||k.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(k){function j(V,ne,me,ue){return(V|0)*3600+(ne|0)*60+(me|0)+(ue|0)/1e3}var Z=k.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return Z?Z[3]?j(Z[1],Z[2],Z[3].replace(":",""),Z[4]):Z[1]>59?j(Z[1],Z[2],0,Z[4]):j(0,Z[1],Z[2],Z[4]):null}function a(){this.values=e(null)}a.prototype={set:function(k,j){!this.get(k)&&j!==""&&(this.values[k]=j)},get:function(k,j,Z){return Z?this.has(k)?this.values[k]:j[Z]:this.has(k)?this.values[k]:j},has:function(k){return k in this.values},alt:function(k,j,Z){for(var V=0;V=0&&j<=100)?(this.set(k,j),!0):!1}};function l(k,j,Z,V){var ne=V?k.split(V):[k];for(var me in ne)if(typeof ne[me]=="string"){var ue=ne[me].split(Z);if(ue.length===2){var q=ue[0].trim(),P=ue[1].trim();j(q,P)}}}function u(k,j,Z){var V=k;function ne(){var q=i(k);if(q===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return k=k.replace(/^[^\sa-zA-Z-]+/,""),q}function me(q,P){var Q=new a;l(q,function(te,ge){switch(te){case"region":for(var L=Z.length-1;L>=0;L--)if(Z[L].id===ge){Q.set(te,Z[L].region);break}break;case"vertical":Q.alt(te,ge,["rl","lr"]);break;case"line":var xe=ge.split(","),Te=xe[0];Q.integer(te,Te),Q.percent(te,Te)&&Q.set("snapToLines",!1),Q.alt(te,Te,["auto"]),xe.length===2&&Q.alt("lineAlign",xe[1],["start","center","end"]);break;case"position":xe=ge.split(","),Q.percent(te,xe[0]),xe.length===2&&Q.alt("positionAlign",xe[1],["start","center","end"]);break;case"size":Q.percent(te,ge);break;case"align":Q.alt(te,ge,["start","center","end","left","right"]);break}},/:/,/\s/),P.region=Q.get("region",null),P.vertical=Q.get("vertical","");try{P.line=Q.get("line","auto")}catch{}P.lineAlign=Q.get("lineAlign","start"),P.snapToLines=Q.get("snapToLines",!0),P.size=Q.get("size",100);try{P.align=Q.get("align","center")}catch{P.align=Q.get("align","middle")}try{P.position=Q.get("position","auto")}catch{P.position=Q.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},P.align)}P.positionAlign=Q.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},P.align)}function ue(){k=k.replace(/^\s+/,"")}if(ue(),j.startTime=ne(),ue(),k.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);k=k.substr(3),ue(),j.endTime=ne(),ue(),me(k,j)}var h=n.createElement&&n.createElement("textarea"),f={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},g={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},_={v:"title",lang:"lang"},S={rt:"ruby"};function C(k,j){function Z(){if(!j)return null;function Te(be){return j=j.substr(be.length),be}var ye=j.match(/^([^<]*)(<[^>]*>?)?/);return Te(ye[1]?ye[1]:ye[2])}function V(Te){return h.innerHTML=Te,Te=h.textContent,h.textContent="",Te}function ne(Te,ye){return!S[ye.localName]||S[ye.localName]===Te.localName}function me(Te,ye){var be=f[Te];if(!be)return null;var mt=k.document.createElement(be),Ke=_[Te];return Ke&&ye&&(mt[Ke]=ye.trim()),mt}for(var ue=k.document.createElement("div"),q=ue,P,Q=[];(P=Z())!==null;){if(P[0]==="<"){if(P[1]==="/"){Q.length&&Q[Q.length-1]===P.substr(2).replace(">","")&&(Q.pop(),q=q.parentNode);continue}var te=i(P.substr(1,P.length-2)),ge;if(te){ge=k.document.createProcessingInstruction("timestamp",te),q.appendChild(ge);continue}var L=P.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!L||(ge=me(L[1],L[3]),!ge)||!ne(q,ge))continue;if(L[2]){var xe=L[2].split(".");xe.forEach(function(Te){var ye=/^bg_/.test(Te),be=ye?Te.slice(3):Te;if(g.hasOwnProperty(be)){var mt=ye?"background-color":"color",Ke=g[be];ge.style[mt]=Ke}}),ge.className=xe.join(" ")}Q.push(L[1]),q.appendChild(ge),q=ge;continue}q.appendChild(k.document.createTextNode(V(P)))}return ue}var N=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function O(k){for(var j=0;j=Z[0]&&k<=Z[1])return!0}return!1}function E(k){var j=[],Z="",V;if(!k||!k.childNodes)return"ltr";function ne(q,P){for(var Q=P.childNodes.length-1;Q>=0;Q--)q.push(P.childNodes[Q])}function me(q){if(!q||!q.length)return null;var P=q.pop(),Q=P.textContent||P.innerText;if(Q){var te=Q.match(/^.*(\n|\r)/);return te?(q.length=0,te[0]):Q}if(P.tagName==="ruby")return me(q);if(P.childNodes)return ne(q,P),me(q)}for(ne(j,k);Z=me(j);)for(var ue=0;ue=0&&k.line<=100))return k.line;if(!k.track||!k.track.textTrackList||!k.track.textTrackList.mediaElement)return-1;for(var j=k.track,Z=j.textTrackList,V=0,ne=0;nek.left&&this.topk.top},U.prototype.overlapsAny=function(k){for(var j=0;j=k.top&&this.bottom<=k.bottom&&this.left>=k.left&&this.right<=k.right},U.prototype.overlapsOppositeAxis=function(k,j){switch(j){case"+x":return this.leftk.right;case"+y":return this.topk.bottom}},U.prototype.intersectPercentage=function(k){var j=Math.max(0,Math.min(this.right,k.right)-Math.max(this.left,k.left)),Z=Math.max(0,Math.min(this.bottom,k.bottom)-Math.max(this.top,k.top)),V=j*Z;return V/(this.height*this.width)},U.prototype.toCSSCompatValues=function(k){return{top:this.top-k.top,bottom:k.bottom-this.bottom,left:this.left-k.left,right:k.right-this.right,height:this.height,width:this.width}},U.getSimpleBoxPosition=function(k){var j=k.div?k.div.offsetHeight:k.tagName?k.offsetHeight:0,Z=k.div?k.div.offsetWidth:k.tagName?k.offsetWidth:0,V=k.div?k.div.offsetTop:k.tagName?k.offsetTop:0;k=k.div?k.div.getBoundingClientRect():k.tagName?k.getBoundingClientRect():k;var ne={left:k.left,right:k.right,top:k.top||V,height:k.height||j,bottom:k.bottom||V+(k.height||j),width:k.width||Z};return ne};function re(k,j,Z,V){function ne(be,mt){for(var Ke,we=new U(be),Re=1,ct=0;ctOe&&(Ke=new U(be),Re=Oe),be=new U(we)}return Ke||we}var me=new U(j),ue=j.cue,q=B(ue),P=[];if(ue.snapToLines){var Q;switch(ue.vertical){case"":P=["+y","-y"],Q="height";break;case"rl":P=["+x","-x"],Q="width";break;case"lr":P=["-x","+x"],Q="width";break}var te=me.lineHeight,ge=te*Math.round(q),L=Z[Q]+te,xe=P[0];Math.abs(ge)>L&&(ge=ge<0?-1:1,ge*=Math.ceil(L/te)*te),q<0&&(ge+=ue.vertical===""?Z.height:Z.width,P=P.reverse()),me.move(xe,ge)}else{var Te=me.lineHeight/Z.height*100;switch(ue.lineAlign){case"center":q-=Te/2;break;case"end":q-=Te;break}switch(ue.vertical){case"":j.applyStyles({top:j.formatStyle(q,"%")});break;case"rl":j.applyStyles({left:j.formatStyle(q,"%")});break;case"lr":j.applyStyles({right:j.formatStyle(q,"%")});break}P=["+y","-x","+x","-y"],me=new U(j)}var ye=ne(me,P);j.move(ye.toCSSCompatValues(Z))}function W(){}W.StringDecoder=function(){return{decode:function(k){if(!k)return"";if(typeof k!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(k))}}},W.convertCueToDOMTree=function(k,j){return!k||!j?null:C(k,j)};var X=.05,R="sans-serif",le="1.5%";return W.processCues=function(k,j,Z){if(!k||!j||!Z)return null;for(;Z.firstChild;)Z.removeChild(Z.firstChild);var V=k.document.createElement("div");V.style.position="absolute",V.style.left="0",V.style.right="0",V.style.top="0",V.style.bottom="0",V.style.margin=le,Z.appendChild(V);function ne(te){for(var ge=0;ge")===-1){j.cue.id=ue;continue}case"CUE":try{u(ue,j.cue,j.regionList)}catch(te){j.reportOrThrowError(te),j.cue=null,j.state="BADCUE";continue}j.state="CUETEXT";continue;case"CUETEXT":var Q=ue.indexOf("-->")!==-1;if(!ue||Q&&(P=!0)){j.oncue&&j.oncue(j.cue),j.cue=null,j.state="ID";continue}j.cue.text&&(j.cue.text+=` `),j.cue.text+=ue.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":ue||(j.state="ID");continue}}}catch(te){j.reportOrThrowError(te),j.state==="CUETEXT"&&j.cue&&j.oncue&&j.oncue(j.cue),j.cue=null,j.state=j.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var k=this;try{if(k.buffer+=k.decoder.decode(),(k.cue||k.state==="HEADER")&&(k.buffer+=` `,k.parse()),k.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(j){k.reportOrThrowError(j)}return k.onflush&&k.onflush(),this}},qp=W,qp}var Vp,u2;function K3(){if(u2)return Vp;u2=1;var n="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(u){if(typeof u!="string")return!1;var h=e[u.toLowerCase()];return h?u.toLowerCase():!1}function a(u){if(typeof u!="string")return!1;var h=t[u.toLowerCase()];return h?u.toLowerCase():!1}function l(u,h,f){this.hasBeenReset=!1;var g="",_=!1,S=u,C=h,N=f,O=null,E="",B=!0,H="auto",Y="start",U="auto",re="auto",W=100,X="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(R){g=""+R}},pauseOnExit:{enumerable:!0,get:function(){return _},set:function(R){_=!!R}},startTime:{enumerable:!0,get:function(){return S},set:function(R){if(typeof R!="number")throw new TypeError("Start time must be set to a number.");S=R,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return C},set:function(R){if(typeof R!="number")throw new TypeError("End time must be set to a number.");C=R,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return N},set:function(R){N=""+R,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return O},set:function(R){O=R,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return E},set:function(R){var le=i(R);if(le===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");E=le,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return B},set:function(R){B=!!R,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return H},set:function(R){if(typeof R!="number"&&R!==n)throw new SyntaxError("Line: an invalid number or illegal string was specified.");H=R,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return Y},set:function(R){var le=a(R);le?(Y=le,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return U},set:function(R){if(R<0||R>100)throw new Error("Position must be between 0 and 100.");U=R,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return re},set:function(R){var le=a(R);le?(re=le,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return W},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");W=R,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return X},set:function(R){var le=a(R);if(!le)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");X=le,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Vp=l,Vp}var Gp,c2;function W3(){if(c2)return Gp;c2=1;var n={"":!0,up:!0};function e(a){if(typeof a!="string")return!1;var l=n[a.toLowerCase()];return l?a.toLowerCase():!1}function t(a){return typeof a=="number"&&a>=0&&a<=100}function i(){var a=100,l=3,u=0,h=100,f=0,g=100,_="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(S){if(!t(S))throw new Error("Width must be between 0 and 100.");a=S}},lines:{enumerable:!0,get:function(){return l},set:function(S){if(typeof S!="number")throw new TypeError("Lines must be set to a number.");l=S}},regionAnchorY:{enumerable:!0,get:function(){return h},set:function(S){if(!t(S))throw new Error("RegionAnchorX must be between 0 and 100.");h=S}},regionAnchorX:{enumerable:!0,get:function(){return u},set:function(S){if(!t(S))throw new Error("RegionAnchorY must be between 0 and 100.");u=S}},viewportAnchorY:{enumerable:!0,get:function(){return g},set:function(S){if(!t(S))throw new Error("ViewportAnchorY must be between 0 and 100.");g=S}},viewportAnchorX:{enumerable:!0,get:function(){return f},set:function(S){if(!t(S))throw new Error("ViewportAnchorX must be between 0 and 100.");f=S}},scroll:{enumerable:!0,get:function(){return _},set:function(S){var C=e(S);C===!1?console.warn("Scroll: an invalid or illegal string was specified."):_=C}}})}return Gp=i,Gp}var d2;function X3(){if(d2)return Hp.exports;d2=1;var n=i0(),e=Hp.exports={WebVTT:G3(),VTTCue:K3(),VTTRegion:W3()};n.vttjs=e,n.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,a=n.VTTCue,l=n.VTTRegion;return e.shim=function(){n.VTTCue=t,n.VTTRegion=i},e.restore=function(){n.VTTCue=a,n.VTTRegion=l},n.VTTCue||e.shim(),Hp.exports}var Y3=X3();const h2=Du(Y3);function Xi(){return Xi=Object.assign?Object.assign.bind():function(n){for(var e=1;e-1},e.trigger=function(i){var a=this.listeners[i];if(a)if(arguments.length===2)for(var l=a.length,u=0;u-1;t=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const J3=" ",Kp=function(n){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(n||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},eD=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},kr=function(n){const e={};if(!n)return e;const t=n.split(eD());let i=t.length,a;for(;i--;)t[i]!==""&&(a=/([^=]*)=(.*)/.exec(t[i]).slice(1),a[0]=a[0].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^\s+|\s+$/g,""),a[1]=a[1].replace(/^['"](.*)['"]$/g,"$1"),e[a[0]]=a[1]);return e},m2=n=>{const e=n.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class tD extends Ty{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((l,u)=>{const h=u(e);return h===e?l:l.concat([h])},[e]).forEach(l=>{for(let u=0;ul),this.customParsers.push(l=>{if(e.exec(l))return this.trigger("data",{type:"custom",data:i(l),customType:t,segment:a}),!0})}addTagMapper({expression:e,map:t}){const i=a=>e.test(a)?t(a):a;this.tagMappers.push(i)}}const nD=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),fo=function(n){const e={};return Object.keys(n).forEach(function(t){e[nD(t)]=n[t]}),e},Wp=function(n){const{serverControl:e,targetDuration:t,partTargetDuration:i}=n;if(!e)return;const a="#EXT-X-SERVER-CONTROL",l="holdBack",u="partHoldBack",h=t&&t*3,f=i&&i*2;t&&!e.hasOwnProperty(l)&&(e[l]=h,this.trigger("info",{message:`${a} defaulting HOLD-BACK to targetDuration * 3 (${h}).`})),h&&e[l]{a.uri||!a.parts&&!a.preloadHints||(!a.map&&l&&(a.map=l),!a.key&&u&&(a.key=u),!a.timeline&&typeof S=="number"&&(a.timeline=S),this.manifest.preloadSegment=a)}),this.parseStream.on("data",function(E){let B,H;if(t.manifest.definitions){for(const Y in t.manifest.definitions)if(E.uri&&(E.uri=E.uri.replace(`{$${Y}}`,t.manifest.definitions[Y])),E.attributes)for(const U in E.attributes)typeof E.attributes[U]=="string"&&(E.attributes[U]=E.attributes[U].replace(`{$${Y}}`,t.manifest.definitions[Y]))}({tag(){({version(){E.version&&(this.manifest.version=E.version)},"allow-cache"(){this.manifest.allowCache=E.allowed,"allowed"in E||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in E&&(a.byterange=Y,Y.length=E.length,"offset"in E||(E.offset=C)),"offset"in E&&(a.byterange=Y,Y.offset=E.offset),C=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),E.title&&(a.title=E.title),E.duration>0&&(a.duration=E.duration),E.duration===0&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!E.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(E.attributes.METHOD==="NONE"){u=null;return}if(!E.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(E.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:E.attributes};return}if(E.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:E.attributes.URI};return}if(E.attributes.KEYFORMAT===_){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(E.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(E.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),E.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(E.attributes.KEYID&&E.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:E.attributes.KEYFORMAT,keyId:E.attributes.KEYID.substring(2)},pssh:zw(E.attributes.URI.split(",")[1])};return}E.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:E.attributes.METHOD||"AES-128",uri:E.attributes.URI},typeof E.attributes.IV<"u"&&(u.iv=E.attributes.IV)},"media-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+E.number});return}this.manifest.mediaSequence=E.number},"discontinuity-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+E.number});return}this.manifest.discontinuitySequence=E.number,S=E.number},"playlist-type"(){if(!/VOD|EVENT/.test(E.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+E.playlist});return}this.manifest.playlistType=E.playlistType},map(){l={},E.uri&&(l.uri=E.uri),E.byterange&&(l.byterange=E.byterange),u&&(l.key=u)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||g,!E.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}a.attributes||(a.attributes={}),Xi(a.attributes,E.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||g,!(E.attributes&&E.attributes.TYPE&&E.attributes["GROUP-ID"]&&E.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[E.attributes.TYPE];Y[E.attributes["GROUP-ID"]]=Y[E.attributes["GROUP-ID"]]||{},B=Y[E.attributes["GROUP-ID"]],H={default:/yes/i.test(E.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(E.attributes.AUTOSELECT),E.attributes.LANGUAGE&&(H.language=E.attributes.LANGUAGE),E.attributes.URI&&(H.uri=E.attributes.URI),E.attributes["INSTREAM-ID"]&&(H.instreamId=E.attributes["INSTREAM-ID"]),E.attributes.CHARACTERISTICS&&(H.characteristics=E.attributes.CHARACTERISTICS),E.attributes.FORCED&&(H.forced=/yes/i.test(E.attributes.FORCED)),B[E.attributes.NAME]=H},discontinuity(){S+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=E.dateTimeString,this.manifest.dateTimeObject=E.dateTimeObject),a.dateTimeString=E.dateTimeString,a.dateTimeObject=E.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(E.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight((U,re)=>(re.programDateTime=U-re.duration*1e3,re.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(E.duration)||E.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+E.duration});return}this.manifest.targetDuration=E.duration,Wp.call(this,this.manifest)},start(){if(!E.attributes||isNaN(E.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:E.attributes["TIME-OFFSET"],precise:E.attributes.PRECISE}},"cue-out"(){a.cueOut=E.data},"cue-out-cont"(){a.cueOutCont=E.data},"cue-in"(){a.cueIn=E.data},skip(){this.manifest.skip=fo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",E.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const Y=this.manifest.segments.length,U=fo(E.attributes);a.parts=a.parts||[],a.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=N),N=U.byterange.offset+U.byterange.length);const re=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${re} for segment #${Y}`,E.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((W,X)=>{W.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${X} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=fo(E.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wp.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,U=fo(E.attributes),re=U.type&&U.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=re?N:0,re&&(N=U.byterange.offset+U.byterange.length)));const W=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${W} for segment #${Y}`,E.attributes,["TYPE","URI"]),!!U.type)for(let X=0;XX.id===U.id);this.manifest.dateRanges[W]=Xi(this.manifest.dateRanges[W],U),O[U.id]=Xi(O[U.id],U),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=fo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",E.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(U,re)=>{if(U in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${U}`});return}this.manifest.definitions[U]=re};if("QUERYPARAM"in E.attributes){if("NAME"in E.attributes||"IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const U=this.params.get(E.attributes.QUERYPARAM);if(!U){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${E.attributes.QUERYPARAM}`});return}Y(E.attributes.QUERYPARAM,decodeURIComponent(U));return}if("NAME"in E.attributes){if("IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in E.attributes)||typeof E.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${E.attributes.NAME}`});return}Y(E.attributes.NAME,E.attributes.VALUE);return}if("IMPORT"in E.attributes){if(!this.mainDefinitions[E.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${E.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(E.attributes.IMPORT,this.mainDefinitions[E.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:E.attributes,uri:E.uri,timeline:S}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",E.attributes,["BANDWIDTH","URI"])}}[E.tagType]||f).call(t)},uri(){a.uri=E.uri,i.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),u&&(a.key=u),a.timeline=S,l&&(a.map=l),N=0,this.lastProgramDateTime!==null&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=a.duration*1e3),a={}},comment(){},custom(){E.segment?(a.custom=a.custom||{},a.custom[E.customType]=E.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[E.customType]=E.data)}})[E.type].call(t)})}requiredCompatibilityversion(e,t){(eS&&(_-=S,_-=S,_-=gr(2))}return Number(_)},mD=function(e,t){var i={},a=i.le,l=a===void 0?!1:a;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=gr(e);for(var u=dD(e),h=new Uint8Array(new ArrayBuffer(u)),f=0;f=t.length&&g.call(t,function(_,S){var C=f[S]?f[S]&e[u+S]:e[u+S];return _===C})},gD=function(e,t,i){t.forEach(function(a){for(var l in e.mediaGroups[a])for(var u in e.mediaGroups[a][l]){var h=e.mediaGroups[a][l][u];i(h,a,l,u)}})},Ic={},xa={},Zo={},y2;function s0(){if(y2)return Zo;y2=1;function n(l,u,h){if(h===void 0&&(h=Array.prototype),l&&typeof h.find=="function")return h.find.call(l,u);for(var f=0;f=0&&M=0){for(var Ve=F.length-1;De0},lookupPrefix:function(M){for(var F=this;F;){var ie=F._nsMap;if(ie){for(var De in ie)if(Object.prototype.hasOwnProperty.call(ie,De)&&ie[De]===M)return De}F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},lookupNamespaceURI:function(M){for(var F=this;F;){var ie=F._nsMap;if(ie&&Object.prototype.hasOwnProperty.call(ie,M))return ie[M];F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},isDefaultNamespace:function(M){var F=this.lookupPrefix(M);return F==null}};function xe(M){return M=="<"&&"<"||M==">"&&">"||M=="&"&&"&"||M=='"'&&"""||"&#"+M.charCodeAt()+";"}f(_,L),f(_,L.prototype);function Te(M,F){if(F(M))return!0;if(M=M.firstChild)do if(Te(M,F))return!0;while(M=M.nextSibling)}function ye(){this.ownerDocument=this}function be(M,F,ie){M&&M._inc++;var De=ie.namespaceURI;De===t.XMLNS&&(F._nsMap[ie.prefix?ie.localName:""]=ie.value)}function mt(M,F,ie,De){M&&M._inc++;var Ve=ie.namespaceURI;Ve===t.XMLNS&&delete F._nsMap[ie.prefix?ie.localName:""]}function Ke(M,F,ie){if(M&&M._inc){M._inc++;var De=F.childNodes;if(ie)De[De.length++]=ie;else{for(var Ve=F.firstChild,yt=0;Ve;)De[yt++]=Ve,Ve=Ve.nextSibling;De.length=yt,delete De[De.length]}}}function we(M,F){var ie=F.previousSibling,De=F.nextSibling;return ie?ie.nextSibling=De:M.firstChild=De,De?De.previousSibling=ie:M.lastChild=ie,F.parentNode=null,F.previousSibling=null,F.nextSibling=null,Ke(M.ownerDocument,M),F}function Re(M){return M&&(M.nodeType===L.DOCUMENT_NODE||M.nodeType===L.DOCUMENT_FRAGMENT_NODE||M.nodeType===L.ELEMENT_NODE)}function ct(M){return M&&(je(M)||Ue(M)||Oe(M)||M.nodeType===L.DOCUMENT_FRAGMENT_NODE||M.nodeType===L.COMMENT_NODE||M.nodeType===L.PROCESSING_INSTRUCTION_NODE)}function Oe(M){return M&&M.nodeType===L.DOCUMENT_TYPE_NODE}function je(M){return M&&M.nodeType===L.ELEMENT_NODE}function Ue(M){return M&&M.nodeType===L.TEXT_NODE}function ze(M,F){var ie=M.childNodes||[];if(e(ie,je)||Oe(F))return!1;var De=e(ie,Oe);return!(F&&De&&ie.indexOf(De)>ie.indexOf(F))}function gt(M,F){var ie=M.childNodes||[];function De(yt){return je(yt)&&yt!==F}if(e(ie,De))return!1;var Ve=e(ie,Oe);return!(F&&Ve&&ie.indexOf(Ve)>ie.indexOf(F))}function st(M,F,ie){if(!Re(M))throw new V(k,"Unexpected parent node type "+M.nodeType);if(ie&&ie.parentNode!==M)throw new V(j,"child not in parent");if(!ct(F)||Oe(F)&&M.nodeType!==L.DOCUMENT_NODE)throw new V(k,"Unexpected node type "+F.nodeType+" for parent node type "+M.nodeType)}function bt(M,F,ie){var De=M.childNodes||[],Ve=F.childNodes||[];if(F.nodeType===L.DOCUMENT_FRAGMENT_NODE){var yt=Ve.filter(je);if(yt.length>1||e(Ve,Ue))throw new V(k,"More than one element or text in fragment");if(yt.length===1&&!ze(M,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(je(F)&&!ze(M,ie))throw new V(k,"Only one element can be added and only after doctype");if(Oe(F)){if(e(De,Oe))throw new V(k,"Only one doctype is allowed");var Vt=e(De,je);if(ie&&De.indexOf(Vt)1||e(Ve,Ue))throw new V(k,"More than one element or text in fragment");if(yt.length===1&&!gt(M,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(je(F)&&!gt(M,ie))throw new V(k,"Only one element can be added and only after doctype");if(Oe(F)){let gn=function(ln){return Oe(ln)&&ln!==ie};var Jt=gn;if(e(De,gn))throw new V(k,"Only one doctype is allowed");var Vt=e(De,je);if(ie&&De.indexOf(Vt)0&&Te(ie.documentElement,function(Ve){if(Ve!==ie&&Ve.nodeType===S){var yt=Ve.getAttribute("class");if(yt){var Vt=M===yt;if(!Vt){var Jt=u(yt);Vt=F.every(h(Jt))}Vt&&De.push(Ve)}}}),De})},createElement:function(M){var F=new ht;F.ownerDocument=this,F.nodeName=M,F.tagName=M,F.localName=M,F.childNodes=new ne;var ie=F.attributes=new q;return ie._ownerElement=F,F},createDocumentFragment:function(){var M=new pt;return M.ownerDocument=this,M.childNodes=new ne,M},createTextNode:function(M){var F=new Ie;return F.ownerDocument=this,F.appendData(M),F},createComment:function(M){var F=new Le;return F.ownerDocument=this,F.appendData(M),F},createCDATASection:function(M){var F=new ke;return F.ownerDocument=this,F.appendData(M),F},createProcessingInstruction:function(M,F){var ie=new Zt;return ie.ownerDocument=this,ie.tagName=ie.nodeName=ie.target=M,ie.nodeValue=ie.data=F,ie},createAttribute:function(M){var F=new At;return F.ownerDocument=this,F.name=M,F.nodeName=M,F.localName=M,F.specified=!0,F},createEntityReference:function(M){var F=new Lt;return F.ownerDocument=this,F.nodeName=M,F},createElementNS:function(M,F){var ie=new ht,De=F.split(":"),Ve=ie.attributes=new q;return ie.childNodes=new ne,ie.ownerDocument=this,ie.nodeName=F,ie.tagName=F,ie.namespaceURI=M,De.length==2?(ie.prefix=De[0],ie.localName=De[1]):ie.localName=F,Ve._ownerElement=ie,ie},createAttributeNS:function(M,F){var ie=new At,De=F.split(":");return ie.ownerDocument=this,ie.nodeName=F,ie.name=F,ie.namespaceURI=M,ie.specified=!0,De.length==2?(ie.prefix=De[0],ie.localName=De[1]):ie.localName=F,ie}},g(ye,L);function ht(){this._nsMap={}}ht.prototype={nodeType:S,hasAttribute:function(M){return this.getAttributeNode(M)!=null},getAttribute:function(M){var F=this.getAttributeNode(M);return F&&F.value||""},getAttributeNode:function(M){return this.attributes.getNamedItem(M)},setAttribute:function(M,F){var ie=this.ownerDocument.createAttribute(M);ie.value=ie.nodeValue=""+F,this.setAttributeNode(ie)},removeAttribute:function(M){var F=this.getAttributeNode(M);F&&this.removeAttributeNode(F)},appendChild:function(M){return M.nodeType===W?this.insertBefore(M,null):$e(this,M)},setAttributeNode:function(M){return this.attributes.setNamedItem(M)},setAttributeNodeNS:function(M){return this.attributes.setNamedItemNS(M)},removeAttributeNode:function(M){return this.attributes.removeNamedItem(M.nodeName)},removeAttributeNS:function(M,F){var ie=this.getAttributeNodeNS(M,F);ie&&this.removeAttributeNode(ie)},hasAttributeNS:function(M,F){return this.getAttributeNodeNS(M,F)!=null},getAttributeNS:function(M,F){var ie=this.getAttributeNodeNS(M,F);return ie&&ie.value||""},setAttributeNS:function(M,F,ie){var De=this.ownerDocument.createAttributeNS(M,F);De.value=De.nodeValue=""+ie,this.setAttributeNode(De)},getAttributeNodeNS:function(M,F){return this.attributes.getNamedItemNS(M,F)},getElementsByTagName:function(M){return new me(this,function(F){var ie=[];return Te(F,function(De){De!==F&&De.nodeType==S&&(M==="*"||De.tagName==M)&&ie.push(De)}),ie})},getElementsByTagNameNS:function(M,F){return new me(this,function(ie){var De=[];return Te(ie,function(Ve){Ve!==ie&&Ve.nodeType===S&&(M==="*"||Ve.namespaceURI===M)&&(F==="*"||Ve.localName==F)&&De.push(Ve)}),De})}},ye.prototype.getElementsByTagName=ht.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=ht.prototype.getElementsByTagNameNS,g(ht,L);function At(){}At.prototype.nodeType=C,g(At,L);function he(){}he.prototype={data:"",substringData:function(M,F){return this.data.substring(M,M+F)},appendData:function(M){M=this.data+M,this.nodeValue=this.data=M,this.length=M.length},insertData:function(M,F){this.replaceData(M,0,F)},appendChild:function(M){throw new Error(le[k])},deleteData:function(M,F){this.replaceData(M,F,"")},replaceData:function(M,F,ie){var De=this.data.substring(0,M),Ve=this.data.substring(M+F);ie=De+ie+Ve,this.nodeValue=this.data=ie,this.length=ie.length}},g(he,L);function Ie(){}Ie.prototype={nodeName:"#text",nodeType:N,splitText:function(M){var F=this.data,ie=F.substring(M);F=F.substring(0,M),this.data=this.nodeValue=F,this.length=F.length;var De=this.ownerDocument.createTextNode(ie);return this.parentNode&&this.parentNode.insertBefore(De,this.nextSibling),De}},g(Ie,he);function Le(){}Le.prototype={nodeName:"#comment",nodeType:Y},g(Le,he);function ke(){}ke.prototype={nodeName:"#cdata-section",nodeType:O},g(ke,he);function Pe(){}Pe.prototype.nodeType=re,g(Pe,L);function et(){}et.prototype.nodeType=X,g(et,L);function kt(){}kt.prototype.nodeType=B,g(kt,L);function Lt(){}Lt.prototype.nodeType=E,g(Lt,L);function pt(){}pt.prototype.nodeName="#document-fragment",pt.prototype.nodeType=W,g(pt,L);function Zt(){}Zt.prototype.nodeType=H,g(Zt,L);function qt(){}qt.prototype.serializeToString=function(M,F,ie){return Gt.call(M,F,ie)},L.prototype.toString=Gt;function Gt(M,F){var ie=[],De=this.nodeType==9&&this.documentElement||this,Ve=De.prefix,yt=De.namespaceURI;if(yt&&Ve==null){var Ve=De.lookupPrefix(yt);if(Ve==null)var Vt=[{namespace:yt,prefix:null}]}return Yt(this,ie,M,F,Vt),ie.join("")}function wt(M,F,ie){var De=M.prefix||"",Ve=M.namespaceURI;if(!Ve||De==="xml"&&Ve===t.XML||Ve===t.XMLNS)return!1;for(var yt=ie.length;yt--;){var Vt=ie[yt];if(Vt.prefix===De)return Vt.namespace!==Ve}return!0}function lt(M,F,ie){M.push(" ",F,'="',ie.replace(/[<>&"\t\n\r]/g,xe),'"')}function Yt(M,F,ie,De,Ve){if(Ve||(Ve=[]),De)if(M=De(M),M){if(typeof M=="string"){F.push(M);return}}else return;switch(M.nodeType){case S:var yt=M.attributes,Vt=yt.length,Dt=M.firstChild,Jt=M.tagName;ie=t.isHTML(M.namespaceURI)||ie;var gn=Jt;if(!ie&&!M.prefix&&M.namespaceURI){for(var ln,_n=0;_n=0;En--){var Ut=Ve[En];if(Ut.prefix===""&&Ut.namespace===M.namespaceURI){ln=Ut.namespace;break}}if(ln!==M.namespaceURI)for(var En=Ve.length-1;En>=0;En--){var Ut=Ve[En];if(Ut.namespace===M.namespaceURI){Ut.prefix&&(gn=Ut.prefix+":"+Jt);break}}}F.push("<",gn);for(var hn=0;hn"),ie&&/^script$/i.test(Jt))for(;Dt;)Dt.data?F.push(Dt.data):Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;else for(;Dt;)Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;F.push("")}else F.push("/>");return;case U:case W:for(var Dt=M.firstChild;Dt;)Yt(Dt,F,ie,De,Ve.slice()),Dt=Dt.nextSibling;return;case C:return lt(F,M.name,M.value);case N:return F.push(M.data.replace(/[<&>]/g,xe));case O:return F.push("");case Y:return F.push("");case re:var Ot=M.publicId,Hn=M.systemId;if(F.push("");else if(Hn&&Hn!=".")F.push(" SYSTEM ",Hn,">");else{var Rt=M.internalSubset;Rt&&F.push(" [",Rt,"]"),F.push(">")}return;case H:return F.push("");case E:return F.push("&",M.nodeName,";");default:F.push("??",M.nodeName)}}function kn(M,F,ie){var De;switch(F.nodeType){case S:De=F.cloneNode(!1),De.ownerDocument=M;case W:break;case C:ie=!0;break}if(De||(De=F.cloneNode(!1)),De.ownerDocument=M,De.parentNode=null,ie)for(var Ve=F.firstChild;Ve;)De.appendChild(kn(M,Ve,ie)),Ve=Ve.nextSibling;return De}function pn(M,F,ie){var De=new F.constructor;for(var Ve in F)if(Object.prototype.hasOwnProperty.call(F,Ve)){var yt=F[Ve];typeof yt!="object"&&yt!=De[Ve]&&(De[Ve]=yt)}switch(F.childNodes&&(De.childNodes=new ne),De.ownerDocument=M,De.nodeType){case S:var Vt=F.attributes,Jt=De.attributes=new q,gn=Vt.length;Jt._ownerElement=De;for(var ln=0;ln",lt:"<",quot:'"'}),n.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:` `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),n.entityMap=n.HTML_ENTITIES})(Yp)),Yp}var Xh={},x2;function bD(){if(x2)return Xh;x2=1;var n=s0().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),a=0,l=1,u=2,h=3,f=4,g=5,_=6,S=7;function C(k,j){this.message=k,this.locator=j,Error.captureStackTrace&&Error.captureStackTrace(this,C)}C.prototype=new Error,C.prototype.name=C.name;function N(){}N.prototype={parse:function(k,j,Z){var V=this.domBuilder;V.startDocument(),re(j,j={}),O(k,j,Z,V,this.errorHandler),V.endDocument()}};function O(k,j,Z,V,ne){function me($e){if($e>65535){$e-=65536;var ht=55296+($e>>10),At=56320+($e&1023);return String.fromCharCode(ht,At)}else return String.fromCharCode($e)}function ue($e){var ht=$e.slice(1,-1);return Object.hasOwnProperty.call(Z,ht)?Z[ht]:ht.charAt(0)==="#"?me(parseInt(ht.substr(1).replace("x","0x"))):(ne.error("entity not found:"+$e),$e)}function q($e){if($e>ye){var ht=k.substring(ye,$e).replace(/&#?\w+;/g,ue);L&&P(ye),V.characters(ht,0,$e-ye),ye=$e}}function P($e,ht){for(;$e>=te&&(ht=ge.exec(k));)Q=ht.index,te=Q+ht[0].length,L.lineNumber++;L.columnNumber=$e-Q+1}for(var Q=0,te=0,ge=/.*(?:\r\n?|\n)|.*$/g,L=V.locator,xe=[{currentNSMap:j}],Te={},ye=0;;){try{var be=k.indexOf("<",ye);if(be<0){if(!k.substr(ye).match(/^\s*$/)){var mt=V.doc,Ke=mt.createTextNode(k.substr(ye));mt.appendChild(Ke),V.currentElement=Ke}return}switch(be>ye&&q(be),k.charAt(be+1)){case"/":var st=k.indexOf(">",be+3),we=k.substring(be+2,st).replace(/[ \t\n\r]+$/g,""),Re=xe.pop();st<0?(we=k.substring(be+2).replace(/[\s<].*/,""),ne.error("end tag name: "+we+" is not complete:"+Re.tagName),st=be+1+we.length):we.match(/\sye?ye=st:q(Math.max(be,ye)+1)}}function E(k,j){return j.lineNumber=k.lineNumber,j.columnNumber=k.columnNumber,j}function B(k,j,Z,V,ne,me){function ue(L,xe,Te){Z.attributeNames.hasOwnProperty(L)&&me.fatalError("Attribute "+L+" redefined"),Z.addValue(L,xe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,ne),Te)}for(var q,P,Q=++j,te=a;;){var ge=k.charAt(Q);switch(ge){case"=":if(te===l)q=k.slice(j,Q),te=h;else if(te===u)te=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(te===h||te===l)if(te===l&&(me.warning('attribute value must after "="'),q=k.slice(j,Q)),j=Q+1,Q=k.indexOf(ge,j),Q>0)P=k.slice(j,Q),ue(q,P,j-1),te=g;else throw new Error("attribute value no end '"+ge+"' match");else if(te==f)P=k.slice(j,Q),ue(q,P,j),me.warning('attribute "'+q+'" missed start quot('+ge+")!!"),j=Q+1,te=g;else throw new Error('attribute value must after "="');break;case"/":switch(te){case a:Z.setTagName(k.slice(j,Q));case g:case _:case S:te=S,Z.closed=!0;case f:case l:break;case u:Z.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return me.error("unexpected end of input"),te==a&&Z.setTagName(k.slice(j,Q)),Q;case">":switch(te){case a:Z.setTagName(k.slice(j,Q));case g:case _:case S:break;case f:case l:P=k.slice(j,Q),P.slice(-1)==="/"&&(Z.closed=!0,P=P.slice(0,-1));case u:te===u&&(P=q),te==f?(me.warning('attribute "'+P+'" missed quot(")!'),ue(q,P,j)):((!n.isHTML(V[""])||!P.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+P+'" missed value!! "'+P+'" instead!!'),ue(P,P,j));break;case h:throw new Error("attribute value missed!!")}return Q;case"€":ge=" ";default:if(ge<=" ")switch(te){case a:Z.setTagName(k.slice(j,Q)),te=_;break;case l:q=k.slice(j,Q),te=u;break;case f:var P=k.slice(j,Q);me.warning('attribute "'+P+'" missed quot(")!!'),ue(q,P,j);case g:te=_;break}else switch(te){case u:Z.tagName,(!n.isHTML(V[""])||!q.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+q+'" missed value!! "'+q+'" instead2!!'),ue(q,q,j),j=Q,te=l;break;case g:me.warning('attribute space is required"'+q+'"!!');case _:te=l,j=Q;break;case h:te=f,j=Q;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}Q++}}function H(k,j,Z){for(var V=k.tagName,ne=null,ge=k.length;ge--;){var me=k[ge],ue=me.qName,q=me.value,L=ue.indexOf(":");if(L>0)var P=me.prefix=ue.slice(0,L),Q=ue.slice(L+1),te=P==="xmlns"&&Q;else Q=ue,P=null,te=ue==="xmlns"&&"";me.localName=Q,te!==!1&&(ne==null&&(ne={},re(Z,Z={})),Z[te]=ne[te]=q,me.uri=n.XMLNS,j.startPrefixMapping(te,q))}for(var ge=k.length;ge--;){me=k[ge];var P=me.prefix;P&&(P==="xml"&&(me.uri=n.XML),P!=="xmlns"&&(me.uri=Z[P||""]))}var L=V.indexOf(":");L>0?(P=k.prefix=V.slice(0,L),Q=k.localName=V.slice(L+1)):(P=null,Q=k.localName=V);var xe=k.uri=Z[P||""];if(j.startElement(xe,Q,V,k),k.closed){if(j.endElement(xe,Q,V),ne)for(P in ne)Object.prototype.hasOwnProperty.call(ne,P)&&j.endPrefixMapping(P)}else return k.currentNSMap=Z,k.localNSMap=ne,!0}function Y(k,j,Z,V,ne){if(/^(?:script|textarea)$/i.test(Z)){var me=k.indexOf("",j),ue=k.substring(j+1,me);if(/[&<]/.test(ue))return/^script$/i.test(Z)?(ne.characters(ue,0,ue.length),me):(ue=ue.replace(/&#?\w+;/g,V),ne.characters(ue,0,ue.length),me)}return j+1}function U(k,j,Z,V){var ne=V[Z];return ne==null&&(ne=k.lastIndexOf(""),ne",j+4);return me>j?(Z.comment(k,j+4,me-j-4),me+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(j+3,6)=="CDATA["){var me=k.indexOf("]]>",j+9);return Z.startCDATA(),Z.characters(k,j+9,me-j-9),Z.endCDATA(),me+3}var ue=le(k,j),q=ue.length;if(q>1&&/!doctype/i.test(ue[0][0])){var P=ue[1][0],Q=!1,te=!1;q>3&&(/^public$/i.test(ue[2][0])?(Q=ue[3][0],te=q>4&&ue[4][0]):/^system$/i.test(ue[2][0])&&(te=ue[3][0]));var ge=ue[q-1];return Z.startDTD(P,Q,te),Z.endDTD(),ge.index+ge[0].length}}return-1}function X(k,j,Z){var V=k.indexOf("?>",j);if(V){var ne=k.substring(j,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return ne?(ne[0].length,Z.processingInstruction(ne[1],ne[2]),V+2):-1}return-1}function R(){this.attributeNames={}}R.prototype={setTagName:function(k){if(!i.test(k))throw new Error("invalid tagName:"+k);this.tagName=k},addValue:function(k,j,Z){if(!i.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:j,offset:Z}},length:0,getLocalName:function(k){return this[k].localName},getLocator:function(k){return this[k].locator},getQName:function(k){return this[k].qName},getURI:function(k){return this[k].uri},getValue:function(k){return this[k].value}};function le(k,j){var Z,V=[],ne=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(ne.lastIndex=j,ne.exec(k);Z=ne.exec(k);)if(V.push(Z),Z[1])return V}return Xh.XMLReader=N,Xh.ParseError=C,Xh}var _2;function vD(){if(_2)return Bc;_2=1;var n=s0(),e=Kw(),t=yD(),i=bD(),a=e.DOMImplementation,l=n.NAMESPACE,u=i.ParseError,h=i.XMLReader;function f(B){return B.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` `)}function g(B){this.options=B||{locator:{}}}g.prototype.parseFromString=function(B,H){var Y=this.options,U=new h,re=Y.domBuilder||new S,W=Y.errorHandler,X=Y.locator,R=Y.xmlns||{},le=/\/x?html?$/.test(H),k=le?t.HTML_ENTITIES:t.XML_ENTITIES;X&&re.setDocumentLocator(X),U.errorHandler=_(W,re,X),U.domBuilder=Y.domBuilder||re,le&&(R[""]=l.HTML),R.xml=R.xml||l.XML;var j=Y.normalizeLineEndings||f;return B&&typeof B=="string"?U.parse(j(B),R,k):U.errorHandler.error("invalid doc source"),re.doc};function _(B,H,Y){if(!B){if(H instanceof S)return H;B=H}var U={},re=B instanceof Function;Y=Y||{};function W(X){var R=B[X];!R&&re&&(R=B.length==2?function(le){B(X,le)}:B),U[X]=R&&function(le){R("[xmldom "+X+"] "+le+N(Y))}||function(){}}return W("warning"),W("error"),W("fatalError"),U}function S(){this.cdata=!1}function C(B,H){H.lineNumber=B.lineNumber,H.columnNumber=B.columnNumber}S.prototype={startDocument:function(){this.doc=new a().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(B,H,Y,U){var re=this.doc,W=re.createElementNS(B,Y||H),X=U.length;E(this,W),this.currentElement=W,this.locator&&C(this.locator,W);for(var R=0;R=H+Y||H?new java.lang.String(B,H,Y)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){S.prototype[B]=function(){return null}});function E(B,H){B.currentElement?B.currentElement.appendChild(H):B.doc.appendChild(H)}return Bc.__DOMHandler=S,Bc.normalizeLineEndings=f,Bc.DOMParser=g,Bc}var w2;function xD(){if(w2)return Ic;w2=1;var n=Kw();return Ic.DOMImplementation=n.DOMImplementation,Ic.XMLSerializer=n.XMLSerializer,Ic.DOMParser=vD().DOMParser,Ic}var _D=xD();const T2=n=>!!n&&typeof n=="object",ur=(...n)=>n.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):T2(e[i])&&T2(t[i])?e[i]=ur(e[i],t[i]):e[i]=t[i]}),e),{}),Ww=n=>Object.keys(n).map(e=>n[e]),wD=(n,e)=>{const t=[];for(let i=n;in.reduce((e,t)=>e.concat(t),[]),Xw=n=>{if(!n.length)return[];const e=[];for(let t=0;tn.reduce((t,i,a)=>(i[e]&&t.push(a),t),[]),SD=(n,e)=>Ww(n.reduce((t,i)=>(i.forEach(a=>{t[e(a)]=a}),t),{}));var Tu={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:n="",source:e="",range:t="",indexRange:i=""})=>{const a={uri:e,resolvedUri:r0(n||"",e)};if(t||i){const u=(t||i).split("-");let h=de.BigInt?de.BigInt(u[0]):parseInt(u[0],10),f=de.BigInt?de.BigInt(u[1]):parseInt(u[1],10);h{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=de.BigInt(n.offset)+de.BigInt(n.length)-de.BigInt(1):e=n.offset+n.length-1,`${n.offset}-${e}`},S2=n=>(n&&typeof n!="number"&&(n=parseInt(n,10)),isNaN(n)?null:n),ED={static(n){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:a}=n,l=S2(n.endNumber),u=e/t;return typeof l=="number"?{start:0,end:l}:typeof a=="number"?{start:0,end:a/u}:{start:0,end:i/u}},dynamic(n){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:a=1,duration:l,periodStart:u=0,minimumUpdatePeriod:h=0,timeShiftBufferDepth:f=1/0}=n,g=S2(n.endNumber),_=(e+t)/1e3,S=i+u,N=_+h-S,O=Math.ceil(N*a/l),E=Math.floor((_-S-f)*a/l),B=Math.floor((_-S)*a/l);return{start:Math.max(0,E),end:typeof g=="number"?g:Math.min(O,B)}}},CD=n=>e=>{const{duration:t,timescale:i=1,periodStart:a,startNumber:l=1}=n;return{number:l+e,duration:t/i,timeline:a,time:e*t}},Sy=n=>{const{type:e,duration:t,timescale:i=1,periodDuration:a,sourceDuration:l}=n,{start:u,end:h}=ED[e](n),f=wD(u,h).map(CD(n));if(e==="static"){const g=f.length-1,_=typeof a=="number"?a:l;f[g].duration=_-t/i*g}return f},Yw=n=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:a="",periodStart:l,presentationTime:u,number:h=0,duration:f}=n;if(!e)throw new Error(Tu.NO_BASE_URL);const g=fd({baseUrl:e,source:t.sourceURL,range:t.range}),_=fd({baseUrl:e,source:e,indexRange:a});if(_.map=g,f){const S=Sy(n);S.length&&(_.duration=S[0].duration,_.timeline=S[0].timeline)}else i&&(_.duration=i,_.timeline=l);return _.presentationTime=u||l,_.number=h,[_]},ky=(n,e,t)=>{const i=n.sidx.map?n.sidx.map:null,a=n.sidx.duration,l=n.timeline||0,u=n.sidx.byterange,h=u.offset+u.length,f=e.timescale,g=e.references.filter(B=>B.referenceType!==1),_=[],S=n.endList?"static":"dynamic",C=n.sidx.timeline;let N=C,O=n.mediaSequence||0,E;typeof e.firstOffset=="bigint"?E=de.BigInt(h)+e.firstOffset:E=h+e.firstOffset;for(let B=0;BSD(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),DD=(n,e)=>{for(let t=0;t{let e=[];return gD(n,AD,(t,i,a,l)=>{e=e.concat(t.playlists||[])}),e},E2=({playlist:n,mediaSequence:e})=>{n.mediaSequence=e,n.segments.forEach((t,i)=>{t.number=n.mediaSequence+i})},MD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=DD(n,i.attributes.NAME);if(!a||i.sidx)return;const l=i.segments[0],u=a.segments.findIndex(function(f){return Math.abs(f.presentationTime-l.presentationTime)a.timeline||a.segments.length&&i.timeline>a.segments[a.segments.length-1].timeline)&&i.discontinuitySequence--;return}a.segments[u].discontinuity&&!l.discontinuity&&(l.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),E2({playlist:i,mediaSequence:a.segments[u].number})})},jD=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(k2(n)),i=e.playlists.concat(k2(e));return e.timelineStarts=Qw([n.timelineStarts,e.timelineStarts]),MD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},a0=n=>n&&n.uri+"-"+kD(n.byterange),Qp=n=>{const e=n.reduce(function(i,a){return i[a.attributes.baseUrl]||(i[a.attributes.baseUrl]=[]),i[a.attributes.baseUrl].push(a),i},{});let t=[];return Object.values(e).forEach(i=>{const a=Ww(i.reduce((l,u)=>{const h=u.attributes.id+(u.attributes.lang||"");return l[h]?(u.segments&&(u.segments[0]&&(u.segments[0].discontinuity=!0),l[h].segments.push(...u.segments)),u.attributes.contentProtection&&(l[h].attributes.contentProtection=u.attributes.contentProtection)):(l[h]=u,l[h].attributes.timelineStarts=[]),l[h].attributes.timelineStarts.push({start:u.attributes.periodStart,timeline:u.attributes.periodStart}),l},{}));t=t.concat(a)}),t.map(i=>(i.discontinuityStarts=TD(i.segments||[],"discontinuity"),i))},Ey=(n,e)=>{const t=a0(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&ky(n,i,n.sidx.resolvedUri),n},RD=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=Ey(n[t],e);return n},OD=({attributes:n,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:a,discontinuityStarts:l},u)=>{const h={attributes:{NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs,"PROGRAM-ID":1},uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuitySequence:a,discontinuityStarts:l,timelineStarts:n.timelineStarts,mediaSequence:i,segments:e};return n.contentProtection&&(h.contentProtection=n.contentProtection),n.serviceLocation&&(h.attributes.serviceLocation=n.serviceLocation),t&&(h.sidx=t),u&&(h.attributes.AUDIO="audio",h.attributes.SUBTITLES="subs"),h},LD=({attributes:n,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:a})=>{typeof e>"u"&&(e=[{uri:n.baseUrl,timeline:n.periodStart,resolvedUri:n.baseUrl||"",duration:n.sourceDuration,number:0}],n.duration=n.sourceDuration);const l={NAME:n.id,BANDWIDTH:n.bandwidth,"PROGRAM-ID":1};n.codecs&&(l.CODECS=n.codecs);const u={attributes:l,uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,timelineStarts:n.timelineStarts,discontinuityStarts:i,discontinuitySequence:a,mediaSequence:t,segments:e};return n.serviceLocation&&(u.attributes.serviceLocation=n.serviceLocation),u},ID=(n,e={},t=!1)=>{let i;const a=n.reduce((l,u)=>{const h=u.attributes.role&&u.attributes.role.value||"",f=u.attributes.lang||"";let g=u.attributes.label||"main";if(f&&!u.attributes.label){const S=h?` (${h})`:"";g=`${u.attributes.lang}${S}`}l[g]||(l[g]={language:f,autoselect:!0,default:h==="main",playlists:[],uri:""});const _=Ey(OD(u,t),e);return l[g].playlists.push(_),typeof i>"u"&&h==="main"&&(i=u,i.default=!0),l},{});if(!i){const l=Object.keys(a)[0];a[l].default=!0}return a},BD=(n,e={})=>n.reduce((t,i)=>{const a=i.attributes.label||i.attributes.lang||"text",l=i.attributes.lang||"und";return t[a]||(t[a]={language:l,default:!1,autoselect:!1,playlists:[],uri:""}),t[a].playlists.push(Ey(LD(i),e)),t},{}),PD=n=>n.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:a,language:l}=i;e[l]={autoselect:!1,default:!1,instreamId:a,language:l},i.hasOwnProperty("aspectRatio")&&(e[l].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[l].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[l]["3D"]=i["3D"])}),e),{}),FD=({attributes:n,segments:e,sidx:t,discontinuityStarts:i})=>{const a={attributes:{NAME:n.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:n.width,height:n.height},CODECS:n.codecs,BANDWIDTH:n.bandwidth,"PROGRAM-ID":1},uri:"",endList:n.type==="static",timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuityStarts:i,timelineStarts:n.timelineStarts,segments:e};return n.frameRate&&(a.attributes["FRAME-RATE"]=n.frameRate),n.contentProtection&&(a.contentProtection=n.contentProtection),n.serviceLocation&&(a.attributes.serviceLocation=n.serviceLocation),t&&(a.sidx=t),a},UD=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",zD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",$D=({attributes:n})=>n.mimeType==="text/vtt"||n.contentType==="text",HD=(n,e)=>{n.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,a)=>{i.number=a})})},C2=n=>n?Object.keys(n).reduce((e,t)=>{const i=n[t];return e.concat(i.playlists)},[]):[],qD=({dashPlaylists:n,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:a,eventStream:l})=>{if(!n.length)return{};const{sourceDuration:u,type:h,suggestedPresentationDelay:f,minimumUpdatePeriod:g}=n[0].attributes,_=Qp(n.filter(UD)).map(FD),S=Qp(n.filter(zD)),C=Qp(n.filter($D)),N=n.map(re=>re.attributes.captionServices).filter(Boolean),O={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:RD(_,i)};g>=0&&(O.minimumUpdatePeriod=g*1e3),e&&(O.locations=e),t&&(O.contentSteering=t),h==="dynamic"&&(O.suggestedPresentationDelay=f),l&&l.length>0&&(O.eventStream=l);const E=O.playlists.length===0,B=S.length?ID(S,i,E):null,H=C.length?BD(C,i):null,Y=_.concat(C2(B),C2(H)),U=Y.map(({timelineStarts:re})=>re);return O.timelineStarts=Qw(U),HD(Y,O.timelineStarts),B&&(O.mediaGroups.AUDIO.audio=B),H&&(O.mediaGroups.SUBTITLES.subs=H),N.length&&(O.mediaGroups["CLOSED-CAPTIONS"].cc=PD(N)),a?jD({oldManifest:a,newManifest:O}):O},VD=(n,e,t)=>{const{NOW:i,clientOffset:a,availabilityStartTime:l,timescale:u=1,periodStart:h=0,minimumUpdatePeriod:f=0}=n,g=(i+a)/1e3,_=l+h,C=g+f-_;return Math.ceil((C*u-e)/t)},Zw=(n,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:a="",sourceDuration:l,timescale:u=1,startNumber:h=1,periodStart:f}=n,g=[];let _=-1;for(let S=0;S_&&(_=E);let B;if(O<0){const U=S+1;U===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=VD(n,_,N):B=(l*u-_)/N:B=(e[U].t-_)/N}else B=O+1;const H=h+g.length+B;let Y=h+g.length;for(;Y(e,t,i,a)=>{if(e==="$$")return"$";if(typeof n[t]>"u")return e;const l=""+n[t];return t==="RepresentationID"||(i?a=parseInt(a,10):a=1,l.length>=a)?l:`${new Array(a-l.length+1).join("0")}${l}`},A2=(n,e)=>n.replace(GD,KD(e)),WD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?Sy(n):Zw(n,e),XD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=fd({baseUrl:n.baseUrl,source:A2(i.sourceURL,t),range:i.range});return WD(n,e).map(u=>{t.Number=u.number,t.Time=u.time;const h=A2(n.media||"",t),f=n.timescale||1,g=n.presentationTimeOffset||0,_=n.periodStart+(u.time-g)/f;return{uri:h,timeline:u.timeline,duration:u.duration,resolvedUri:r0(n.baseUrl||"",h),map:a,number:u.number,presentationTime:_}})},YD=(n,e)=>{const{baseUrl:t,initialization:i={}}=n,a=fd({baseUrl:t,source:i.sourceURL,range:i.range}),l=fd({baseUrl:t,source:e.media,range:e.mediaRange});return l.map=a,l},QD=(n,e)=>{const{duration:t,segmentUrls:i=[],periodStart:a}=n;if(!t&&!e||t&&e)throw new Error(Tu.SEGMENT_TIME_UNSPECIFIED);const l=i.map(f=>YD(n,f));let u;return t&&(u=Sy(n)),e&&(u=Zw(n,e)),u.map((f,g)=>{if(l[g]){const _=l[g],S=n.timescale||1,C=n.presentationTimeOffset||0;return _.timeline=f.timeline,_.duration=f.duration,_.number=f.number,_.presentationTime=a+(f.time-C)/S,_}}).filter(f=>f)},ZD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=XD,t=ur(n,e.template)):e.base?(i=Yw,t=ur(n,e.base)):e.list&&(i=QD,t=ur(n,e.list));const a={attributes:n};if(!i)return a;const l=i(t,e.segmentTimeline);if(t.duration){const{duration:u,timescale:h=1}=t;t.duration=u/h}else l.length?t.duration=l.reduce((u,h)=>Math.max(u,Math.ceil(h.duration)),0):t.duration=0;return a.attributes=t,a.segments=l,e.base&&t.indexRange&&(a.sidx=l[0],a.segments=[]),a},JD=n=>n.map(ZD),Di=(n,e)=>Xw(n.childNodes).filter(({tagName:t})=>t===e),wd=n=>n.textContent.trim(),e4=n=>parseFloat(n.split("/").reduce((e,t)=>e/t)),Xl=n=>{const h=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(n);if(!h)return 0;const[f,g,_,S,C,N]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(_||0)*86400+parseFloat(S||0)*3600+parseFloat(C||0)*60+parseFloat(N||0)},t4=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),N2={mediaPresentationDuration(n){return Xl(n)},availabilityStartTime(n){return t4(n)/1e3},minimumUpdatePeriod(n){return Xl(n)},suggestedPresentationDelay(n){return Xl(n)},type(n){return n},timeShiftBufferDepth(n){return Xl(n)},start(n){return Xl(n)},width(n){return parseInt(n,10)},height(n){return parseInt(n,10)},bandwidth(n){return parseInt(n,10)},frameRate(n){return e4(n)},startNumber(n){return parseInt(n,10)},timescale(n){return parseInt(n,10)},presentationTimeOffset(n){return parseInt(n,10)},duration(n){const e=parseInt(n,10);return isNaN(e)?Xl(n):e},d(n){return parseInt(n,10)},t(n){return parseInt(n,10)},r(n){return parseInt(n,10)},presentationTime(n){return parseInt(n,10)},DEFAULT(n){return n}},er=n=>n&&n.attributes?Xw(n.attributes).reduce((e,t)=>{const i=N2[t.name]||N2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},n4={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},o0=(n,e)=>e.length?wu(n.map(function(t){return e.map(function(i){const a=wd(i),l=r0(t.baseUrl,a),u=ur(er(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Cy=n=>{const e=Di(n,"SegmentTemplate")[0],t=Di(n,"SegmentList")[0],i=t&&Di(t,"SegmentURL").map(S=>ur({tag:"SegmentURL"},er(S))),a=Di(n,"SegmentBase")[0],l=t||e,u=l&&Di(l,"SegmentTimeline")[0],h=t||a||e,f=h&&Di(h,"Initialization")[0],g=e&&er(e);g&&f?g.initialization=f&&er(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const _={template:g,segmentTimeline:u&&Di(u,"S").map(S=>er(S)),list:t&&ur(er(t),{segmentUrls:i,initialization:er(f)}),base:a&&ur(er(a),{initialization:er(f)})};return Object.keys(_).forEach(S=>{_[S]||delete _[S]}),_},i4=(n,e,t)=>i=>{const a=Di(i,"BaseURL"),l=o0(e,a),u=ur(n,er(i)),h=Cy(i);return l.map(f=>({segmentInfo:ur(t,h),attributes:ur(u,f)}))},r4=n=>n.reduce((e,t)=>{const i=er(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=n4[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Di(t,"cenc:pssh")[0];if(l){const u=wd(l);e[a].pssh=u&&zw(u)}}return e},{}),s4=n=>{if(n.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof n.value!="string"?[]:n.value.split(";")).map(t=>{let i,a;return a=t,/^CC\d=/.test(t)?[i,a]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:a}});if(n.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof n.value!="string"?[]:n.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[a,l=""]=t.split("=");i.channel=a,i.language=t,l.split(",").forEach(u=>{const[h,f]=u.split(":");h==="lang"?i.language=f:h==="er"?i.easyReader=Number(f):h==="war"?i.aspectRatio=Number(f):h==="3D"&&(i["3D"]=Number(f))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},a4=n=>wu(Di(n.node,"EventStream").map(e=>{const t=er(e),i=t.schemeIdUri;return Di(e,"Event").map(a=>{const l=er(a),u=l.presentationTime||0,h=t.timescale||1,f=l.duration||0,g=u/h+n.attributes.start;return{schemeIdUri:i,value:t.value,id:l.id,start:g,end:g+f/h,messageData:wd(a)||l.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),o4=(n,e,t)=>i=>{const a=er(i),l=o0(e,Di(i,"BaseURL")),u=Di(i,"Role")[0],h={role:er(u)};let f=ur(n,a,h);const g=Di(i,"Accessibility")[0],_=s4(er(g));_&&(f=ur(f,{captionServices:_}));const S=Di(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=ur(f,{label:B})}const C=r4(Di(i,"ContentProtection"));Object.keys(C).length&&(f=ur(f,{contentProtection:C}));const N=Cy(i),O=Di(i,"Representation"),E=ur(t,N);return wu(O.map(i4(f,l,E)))},l4=(n,e)=>(t,i)=>{const a=o0(e,Di(t.node,"BaseURL")),l=ur(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Di(t.node,"AdaptationSet"),h=Cy(t.node);return wu(u.map(o4(l,a,h)))},u4=(n,e)=>{if(n.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!n.length)return null;const t=ur({serverURL:wd(n[0])},er(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},c4=({attributes:n,priorPeriodAttributes:e,mpdType:t})=>typeof n.start=="number"?n.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,d4=(n,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:a=0,eventHandler:l=function(){}}=e,u=Di(n,"Period");if(!u.length)throw new Error(Tu.INVALID_NUMBER_OF_PERIOD);const h=Di(n,"Location"),f=er(n),g=o0([{baseUrl:t}],Di(n,"BaseURL")),_=Di(n,"ContentSteering");f.type=f.type||"static",f.sourceDuration=f.mediaPresentationDuration||0,f.NOW=i,f.clientOffset=a,h.length&&(f.locations=h.map(wd));const S=[];return u.forEach((C,N)=>{const O=er(C),E=S[N-1];O.start=c4({attributes:O,priorPeriodAttributes:E?E.attributes:null,mpdType:f.type}),S.push({node:C,attributes:O})}),{locations:f.locations,contentSteeringInfo:u4(_,l),representationInfo:wu(S.map(l4(f,g))),eventStream:wu(S.map(a4))}},Jw=n=>{if(n==="")throw new Error(Tu.DASH_EMPTY_MANIFEST);const e=new _D.DOMParser;let t,i;try{t=e.parseFromString(n,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Tu.DASH_INVALID_XML);return i},h4=n=>{const e=Di(n,"UTCTiming")[0];if(!e)return null;const t=er(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Tu.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},f4=(n,e={})=>{const t=d4(Jw(n),e),i=JD(t.representationInfo);return qD({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},m4=n=>h4(Jw(n));var Zp,D2;function p4(){if(D2)return Zp;D2=1;var n=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),a;return i.getBigUint64?(a=i.getBigUint64(0),a0;l+=12,u--)a.references.push({referenceType:(t[l]&128)>>>7,referencedSize:i.getUint32(l)&2147483647,subsegmentDuration:i.getUint32(l+4),startsWithSap:!!(t[l+8]&128),sapType:(t[l+8]&112)>>>4,sapDeltaTime:i.getUint32(l+8)&268435455});return a};return Jp=e,Jp}var y4=g4();const b4=Du(y4);var v4=an([73,68,51]),x4=function(e,t){t===void 0&&(t=0),e=an(e);var i=e[t+5],a=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],l=(i&16)>>4;return l?a+20:a+10},Kc=function n(e,t){return t===void 0&&(t=0),e=an(e),e.length-t<10||!Ni(e,v4,{offset:t})?t:(t+=x4(e,t),n(e,t))},j2=function(e){return typeof e=="string"?Gw(e):e},_4=function(e){return Array.isArray(e)?e.map(function(t){return j2(t)}):[j2(e)]},w4=function n(e,t,i){i===void 0&&(i=!1),t=_4(t),e=an(e);var a=[];if(!t.length)return a;for(var l=0;l>>0,h=e.subarray(l+4,l+8);if(u===0)break;var f=l+u;if(f>e.length){if(i)break;f=e.length}var g=e.subarray(l+8,f);Ni(h,t[0])&&(t.length===1?a.push(g):a.push.apply(a,n(g,t.slice(1),i))),l=f}return a},Yh={EBML:an([26,69,223,163]),DocType:an([66,130]),Segment:an([24,83,128,103]),SegmentInfo:an([21,73,169,102]),Tracks:an([22,84,174,107]),Track:an([174]),TrackNumber:an([215]),DefaultDuration:an([35,227,131]),TrackEntry:an([174]),TrackType:an([131]),FlagDefault:an([136]),CodecID:an([134]),CodecPrivate:an([99,162]),VideoTrack:an([224]),AudioTrack:an([225]),Cluster:an([31,67,182,117]),Timestamp:an([231]),TimestampScale:an([42,215,177]),BlockGroup:an([160]),BlockDuration:an([155]),Block:an([161]),SimpleBlock:an([163])},zg=[128,64,32,16,8,4,2,1],T4=function(e){for(var t=1,i=0;i=t.length)return t.length;var a=Ef(t,i,!1);if(Ni(e.bytes,a.bytes))return i;var l=Ef(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},O2=function n(e,t){t=S4(t),e=an(e);var i=[];if(!t.length)return i;for(var a=0;ae.length?e.length:h+u.value,g=e.subarray(h,f);Ni(t[0],l.bytes)&&(t.length===1?i.push(g):i=i.concat(n(g,t.slice(1))));var _=l.length+u.length+g.length;a+=_}return i},E4=an([0,0,0,1]),C4=an([0,0,1]),A4=an([0,0,3]),N4=function(e){for(var t=[],i=1;i>1&63),i.indexOf(g)!==-1&&(u=l+f),l+=f+(t==="h264"?1:2)}return e.subarray(0,0)},D4=function(e,t,i){return eT(e,"h264",t,i)},M4=function(e,t,i){return eT(e,"h265",t,i)},Er={webm:an([119,101,98,109]),matroska:an([109,97,116,114,111,115,107,97]),flac:an([102,76,97,67]),ogg:an([79,103,103,83]),ac3:an([11,119]),riff:an([82,73,70,70]),avi:an([65,86,73]),wav:an([87,65,86,69]),"3gp":an([102,116,121,112,51,103]),mp4:an([102,116,121,112]),fmp4:an([115,116,121,112]),mov:an([102,116,121,112,113,116]),moov:an([109,111,111,118]),moof:an([109,111,111,102])},Su={aac:function(e){var t=Kc(e);return Ni(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Kc(e);return Ni(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=O2(e,[Yh.EBML,Yh.DocType])[0];return Ni(t,Er.webm)},mkv:function(e){var t=O2(e,[Yh.EBML,Yh.DocType])[0];return Ni(t,Er.matroska)},mp4:function(e){if(Su["3gp"](e)||Su.mov(e))return!1;if(Ni(e,Er.mp4,{offset:4})||Ni(e,Er.fmp4,{offset:4})||Ni(e,Er.moof,{offset:4})||Ni(e,Er.moov,{offset:4}))return!0},mov:function(e){return Ni(e,Er.mov,{offset:4})},"3gp":function(e){return Ni(e,Er["3gp"],{offset:4})},ac3:function(e){var t=Kc(e);return Ni(e,Er.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},eg,L2;function O4(){if(L2)return eg;L2=1;var n=9e4,e,t,i,a,l,u,h;return e=function(f){return f*n},t=function(f,g){return f*g},i=function(f){return f/n},a=function(f,g){return f/g},l=function(f,g){return e(a(f,g))},u=function(f,g){return t(i(f),g)},h=function(f,g,_){return i(_?f:f-g)},eg={ONE_SECOND_IN_TS:n,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:a,audioTsToVideoTs:l,videoTsToAudioTs:u,metadataTsToSeconds:h},eg}var ll=O4();var Hg="8.23.4";const ka={},Eo=function(n,e){return ka[n]=ka[n]||[],e&&(ka[n]=ka[n].concat(e)),ka[n]},L4=function(n,e){Eo(n,e)},tT=function(n,e){const t=Eo(n).indexOf(e);return t<=-1?!1:(ka[n]=ka[n].slice(),ka[n].splice(t,1),!0)},I4=function(n,e){Eo(n,[].concat(e).map(t=>{const i=(...a)=>(tT(n,i),t(...a));return i}))},Cf={prefixed:!0},hf=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],I2=hf[0];let Wc;for(let n=0;n(i,a,l)=>{const u=e.levels[a],h=new RegExp(`^(${u})$`);let f=n;if(i!=="log"&&l.unshift(i.toUpperCase()+":"),t&&(f=`%c${n}`,l.unshift(t)),l.unshift(f+":"),Ur){Ur.push([].concat(l));const _=Ur.length-1e3;Ur.splice(0,_>0?_:0)}if(!de.console)return;let g=de.console[i];!g&&i==="debug"&&(g=de.console.info||de.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](de.console,l)};function qg(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=B4(n,l,t),l.createLogger=(u,h,f)=>{const g=h!==void 0?h:e,_=f!==void 0?f:t,S=`${n} ${g} ${u}`;return qg(S,g,_)},l.createNewLogger=(u,h,f)=>qg(u,h,f),l.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},l.level=u=>{if(typeof u=="string"){if(!l.levels.hasOwnProperty(u))throw new Error(`"${u}" in not a valid log level`);i=u}return i},l.history=()=>Ur?[].concat(Ur):[],l.history.filter=u=>(Ur||[]).filter(h=>new RegExp(`.*${u}.*`).test(h[0])),l.history.clear=()=>{Ur&&(Ur.length=0)},l.history.disable=()=>{Ur!==null&&(Ur.length=0,Ur=null)},l.history.enable=()=>{Ur===null&&(Ur=[])},l.error=(...u)=>a("error",i,u),l.warn=(...u)=>a("warn",i,u),l.debug=(...u)=>a("debug",i,u),l}const Dn=qg("VIDEOJS"),nT=Dn.createLogger,P4=Object.prototype.toString,iT=function(n){return ea(n)?Object.keys(n):[]};function lu(n,e){iT(n).forEach(t=>e(n[t],t))}function rT(n,e,t=0){return iT(n).reduce((i,a)=>e(i,n[a],a),t)}function ea(n){return!!n&&typeof n=="object"}function ku(n){return ea(n)&&P4.call(n)==="[object Object]"&&n.constructor===Object}function hi(...n){const e={};return n.forEach(t=>{t&&lu(t,(i,a)=>{if(!ku(i)){e[a]=i;return}ku(e[a])||(e[a]={}),e[a]=hi(e[a],i)})}),e}function sT(n={}){const e=[];for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];e.push(i)}return e}function l0(n,e,t,i=!0){const a=u=>Object.defineProperty(n,e,{value:u,enumerable:!0,writable:!0}),l={configurable:!0,enumerable:!0,get(){const u=t();return a(u),u}};return i&&(l.set=a),Object.defineProperty(n,e,l)}var F4=Object.freeze({__proto__:null,each:lu,reduce:rT,isObject:ea,isPlain:ku,merge:hi,values:sT,defineLazyProperty:l0});let Ny=!1,aT=null,js=!1,oT,lT=!1,uu=!1,cu=!1,ta=!1,Dy=null,u0=null;const U4=!!(de.cast&&de.cast.framework&&de.cast.framework.CastReceiverContext);let uT=null,Af=!1,c0=!1,Nf=!1,d0=!1,Df=!1,Mf=!1,jf=!1;const md=!!(Mu()&&("ontouchstart"in de||de.navigator.maxTouchPoints||de.DocumentTouch&&de.document instanceof de.DocumentTouch)),mo=de.navigator&&de.navigator.userAgentData;mo&&mo.platform&&mo.brands&&(js=mo.platform==="Android",uu=!!mo.brands.find(n=>n.brand==="Microsoft Edge"),cu=!!mo.brands.find(n=>n.brand==="Chromium"),ta=!uu&&cu,Dy=u0=(mo.brands.find(n=>n.brand==="Chromium")||{}).version||null,c0=mo.platform==="Windows");if(!cu){const n=de.navigator&&de.navigator.userAgent||"";Ny=/iPod/i.test(n),aT=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),js=/Android/i.test(n),oT=(function(){const e=n.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),lT=/Firefox/i.test(n),uu=/Edg/i.test(n),cu=/Chrome/i.test(n)||/CriOS/i.test(n),ta=!uu&&cu,Dy=u0=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),uT=(function(){const e=/MSIE\s(\d+)\.\d/.exec(n);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(n)&&/rv:11.0/.test(n)&&(t=11),t})(),Df=/Tizen/i.test(n),Mf=/Web0S/i.test(n),jf=Df||Mf,Af=/Safari/i.test(n)&&!ta&&!js&&!uu&&!jf,c0=/Windows/i.test(n),Nf=/iPad/i.test(n)||Af&&md&&!/iPhone/i.test(n),d0=/iPhone/i.test(n)&&!Nf}const xr=d0||Nf||Ny,h0=(Af||xr)&&!ta;var cT=Object.freeze({__proto__:null,get IS_IPOD(){return Ny},get IOS_VERSION(){return aT},get IS_ANDROID(){return js},get ANDROID_VERSION(){return oT},get IS_FIREFOX(){return lT},get IS_EDGE(){return uu},get IS_CHROMIUM(){return cu},get IS_CHROME(){return ta},get CHROMIUM_VERSION(){return Dy},get CHROME_VERSION(){return u0},IS_CHROMECAST_RECEIVER:U4,get IE_VERSION(){return uT},get IS_SAFARI(){return Af},get IS_WINDOWS(){return c0},get IS_IPAD(){return Nf},get IS_IPHONE(){return d0},get IS_TIZEN(){return Df},get IS_WEBOS(){return Mf},get IS_SMART_TV(){return jf},TOUCH_ENABLED:md,IS_IOS:xr,IS_ANY_SAFARI:h0});function B2(n){return typeof n=="string"&&!!n.trim()}function z4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Mu(){return xt===de.document}function ju(n){return ea(n)&&n.nodeType===1}function dT(){try{return de.parent!==de.self}catch{return!0}}function hT(n){return function(e,t){if(!B2(e))return xt[n](null);B2(t)&&(t=xt.querySelector(t));const i=ju(t)?t:xt;return i[n]&&i[n](e)}}function dn(n="div",e={},t={},i){const a=xt.createElement(n);return Object.getOwnPropertyNames(e).forEach(function(l){const u=e[l];l==="textContent"?Ao(a,u):(a[l]!==u||l==="tabIndex")&&(a[l]=u)}),Object.getOwnPropertyNames(t).forEach(function(l){a.setAttribute(l,t[l])}),i&&My(a,i),a}function Ao(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function Vg(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function id(n,e){return z4(e),n.classList.contains(e)}function dl(n,...e){return n.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n}function f0(n,...e){return n?(n.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n):(Dn.warn("removeClass was called with an element that doesn't exist"),null)}function fT(n,e,t){return typeof t=="function"&&(t=t(n,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>n.classList.toggle(i,t)),n}function mT(n,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?n.removeAttribute(t):n.setAttribute(t,i===!0?"":i)})}function vo(n){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(n&&n.attributes&&n.attributes.length>0){const i=n.attributes;for(let a=i.length-1;a>=0;a--){const l=i[a].name;let u=i[a].value;t.includes(l)&&(u=u!==null),e[l]=u}}return e}function pT(n,e){return n.getAttribute(e)}function Eu(n,e,t){n.setAttribute(e,t)}function m0(n,e){n.removeAttribute(e)}function gT(){xt.body.focus(),xt.onselectstart=function(){return!1}}function yT(){xt.onselectstart=function(){return!0}}function Cu(n){if(n&&n.getBoundingClientRect&&n.parentNode){const e=n.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Au(n,"height"))),t.width||(t.width=parseFloat(Au(n,"width"))),t}}function pd(n){if(!n||n&&!n.offsetParent)return{left:0,top:0,width:0,height:0};const e=n.offsetWidth,t=n.offsetHeight;let i=0,a=0;for(;n.offsetParent&&n!==xt[Cf.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function p0(n,e){const t={x:0,y:0};if(xr){let _=n;for(;_&&_.nodeName.toLowerCase()!=="html";){const S=Au(_,"transform");if(/^matrix/.test(S)){const C=S.slice(7,-1).split(/,\s/).map(Number);t.x+=C[4],t.y+=C[5]}else if(/^matrix3d/.test(S)){const C=S.slice(9,-1).split(/,\s/).map(Number);t.x+=C[12],t.y+=C[13]}if(_.assignedSlot&&_.assignedSlot.parentElement&&de.WebKitCSSMatrix){const C=de.getComputedStyle(_.assignedSlot.parentElement).transform,N=new de.WebKitCSSMatrix(C);t.x+=N.m41,t.y+=N.m42}_=_.parentNode||_.host}}const i={},a=pd(e.target),l=pd(n),u=l.width,h=l.height;let f=e.offsetY-(l.top-a.top),g=e.offsetX-(l.left-a.left);return e.changedTouches&&(g=e.changedTouches[0].pageX-l.left,f=e.changedTouches[0].pageY+l.top,xr&&(g-=t.x,f-=t.y)),i.y=1-Math.max(0,Math.min(1,f/h)),i.x=Math.max(0,Math.min(1,g/u)),i}function bT(n){return ea(n)&&n.nodeType===3}function g0(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function vT(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),ju(e)||bT(e))return e;if(typeof e=="string"&&/\S/.test(e))return xt.createTextNode(e)}).filter(e=>e)}function My(n,e){return vT(e).forEach(t=>n.appendChild(t)),n}function xT(n,e){return My(g0(n),e)}function gd(n){return n.button===void 0&&n.buttons===void 0||n.button===0&&n.buttons===void 0||n.type==="mouseup"&&n.button===0&&n.buttons===0||n.type==="mousedown"&&n.button===0&&n.buttons===0?!0:!(n.button!==0||n.buttons!==1)}const Co=hT("querySelector"),_T=hT("querySelectorAll");function Au(n,e){if(!n||!e)return"";if(typeof de.getComputedStyle=="function"){let t;try{t=de.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function wT(n){[...xt.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(a=>a.cssText).join(""),i=xt.createElement("style");i.textContent=t,n.document.head.appendChild(i)}catch{const i=xt.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,n.document.head.appendChild(i)}})}var TT=Object.freeze({__proto__:null,isReal:Mu,isEl:ju,isInFrame:dT,createEl:dn,textContent:Ao,prependTo:Vg,hasClass:id,addClass:dl,removeClass:f0,toggleClass:fT,setAttributes:mT,getAttributes:vo,getAttribute:pT,setAttribute:Eu,removeAttribute:m0,blockTextSelection:gT,unblockTextSelection:yT,getBoundingClientRect:Cu,findPosition:pd,getPointerPosition:p0,isTextNode:bT,emptyEl:g0,normalizeContent:vT,appendContent:My,insertContent:xT,isSingleLeftClick:gd,$:Co,$$:_T,computedStyle:Au,copyStyleSheetsToWindow:wT});let ST=!1,Gg;const $4=function(){if(Gg.options.autoSetup===!1)return;const n=Array.prototype.slice.call(xt.getElementsByTagName("video")),e=Array.prototype.slice.call(xt.getElementsByTagName("audio")),t=Array.prototype.slice.call(xt.getElementsByTagName("video-js")),i=n.concat(e,t);if(i&&i.length>0)for(let a=0,l=i.length;a-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function _r(n,e,t){if(!Ar.has(n))return;const i=Ar.get(n);if(!i.handlers)return;if(Array.isArray(e))return jy(_r,n,e,t);const a=function(u,h){i.handlers[h]=[],P2(u,h)};if(e===void 0){for(const u in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},u)&&a(n,u);return}const l=i.handlers[e];if(l){if(!t){a(n,e);return}if(t.guid)for(let u=0;u=e&&(n(...a),t=l)}},CT=function(n,e,t,i=de){let a;const l=()=>{i.clearTimeout(a),a=null},u=function(){const h=this,f=arguments;let g=function(){a=null,g=null,t||n.apply(h,f)};!a&&t&&n.apply(h,f),i.clearTimeout(a),a=i.setTimeout(g,e)};return u.cancel=l,u};var W4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:bs,bind_:Si,throttle:na,debounce:CT});let Pc;class as{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},ss(this,e,t),this.addEventListener=i}off(e,t){_r(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},b0(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Ry(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=y0(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ru(this,e)}queueTrigger(e){Pc||(Pc=new Map);const t=e.type||e;let i=Pc.get(this);i||(i=new Map,Pc.set(this,i));const a=i.get(t);i.delete(t),de.clearTimeout(a);const l=de.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Pc.delete(this)),this.trigger(e)},0);i.set(t,l)}}as.prototype.allowedEvents_={};as.prototype.addEventListener=as.prototype.on;as.prototype.removeEventListener=as.prototype.off;as.prototype.dispatchEvent=as.prototype.trigger;const v0=n=>typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:n.name_?n.name_:n.constructor&&n.constructor.name?n.constructor.name:typeof n,Aa=n=>n instanceof as||!!n.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof n[e]=="function"),X4=(n,e)=>{Aa(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Xg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,Rf=(n,e,t)=>{if(!n||!n.nodeName&&!Aa(n))throw new Error(`Invalid target for ${v0(e)}#${t}; must be a DOM node or evented object.`)},AT=(n,e,t)=>{if(!Xg(n))throw new Error(`Invalid event type for ${v0(e)}#${t}; must be a non-empty string or array.`)},NT=(n,e,t)=>{if(typeof n!="function")throw new Error(`Invalid listener for ${v0(e)}#${t}; must be a function.`)},tg=(n,e,t)=>{const i=e.length<3||e[0]===n||e[0]===n.eventBusEl_;let a,l,u;return i?(a=n.eventBusEl_,e.length>=3&&e.shift(),[l,u]=e):(a=e[0],l=e[1],u=e[2]),Rf(a,n,t),AT(l,n,t),NT(u,n,t),u=Si(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},Jo=(n,e,t,i)=>{Rf(n,n,e),n.nodeName?K4[e](n,t,i):n[e](t,i)},Y4={on(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"on");if(Jo(t,"on",i,a),!e){const l=()=>this.off(t,i,a);l.guid=a.guid;const u=()=>this.off("dispose",l);u.guid=a.guid,Jo(this,"on","dispose",l),Jo(t,"on","dispose",u)}},one(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"one");if(e)Jo(t,"one",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"one",i,l)}},any(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"any");if(e)Jo(t,"any",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"any",i,l)}},off(n,e,t){if(!n||Xg(n))_r(this.eventBusEl_,n,e);else{const i=n,a=e;Rf(i,this,"off"),AT(a,this,"off"),NT(t,this,"off"),t=Si(this,t),this.off("dispose",t),i.nodeName?(_r(i,a,t),_r(i,"dispose",t)):Aa(i)&&(i.off(a,t),i.off("dispose",t))}},trigger(n,e){Rf(this.eventBusEl_,this,"trigger");const t=n&&typeof n!="string"?n.type:n;if(!Xg(t))throw new Error(`Invalid event type for ${v0(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ru(this.eventBusEl_,n,e)}};function Oy(n,e={}){const{eventBusKey:t}=e;if(t){if(!n[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);n.eventBusEl_=n[t]}else n.eventBusEl_=dn("span",{className:"vjs-event-bus"});return Object.assign(n,Y4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Ar.has(i)&&Ar.delete(i)}),de.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const Q4={state:{},setState(n){typeof n=="function"&&(n=n());let e;return lu(n,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Aa(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function DT(n,e){return Object.assign(n,Q4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Aa(n)&&n.on("statechanged",n.handleStateChanged),n}const rd=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toLowerCase())},qi=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},MT=function(n,e){return qi(n)===qi(e)};var Z4=Object.freeze({__proto__:null,toLowerCase:rd,toTitleCase:qi,titleCaseEquals:MT});class nt{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=hi({},this.options_),t=this.options_=hi(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const a=e&&e.id&&e.id()||"no_player";this.id_=`${a}_component_${ys()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(a=>this.addClass(a)),["on","off","one","any","trigger"].forEach(a=>{this[a]=void 0}),t.evented!==!1&&(Oy(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),DT(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=hi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return dn(e,t,i)}localize(e,t,i=e){const a=this.player_.language&&this.player_.language(),l=this.player_.languages&&this.player_.languages(),u=l&&l[a],h=a&&a.split("-")[0],f=l&&l[h];let g=i;return u&&u[e]?g=u[e]:f&&f[e]&&(g=f[e]),t&&(g=g.replace(/\{(\d+)\}/g,function(_,S){const C=t[S-1];let N=C;return typeof C>"u"&&(N=_),N})),g}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,a)=>i.concat(a),[]);let t=this;for(let i=0;i=0;a--)if(this.children_[a]===e){t=!0,this.children_.splice(a,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[qi(e.name())]=null,this.childNameIndex_[rd(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=u=>{const h=u.name;let f=u.opts;if(t[h]!==void 0&&(f=t[h]),f===!1)return;f===!0&&(f={}),f.playerOptions=this.options_.playerOptions;const g=this.addChild(h,f);g&&(this[h]=g)};let a;const l=nt.getComponent("Tech");Array.isArray(e)?a=e:a=Object.keys(e),a.concat(Object.keys(this.options_).filter(function(u){return!a.some(function(h){return typeof h=="string"?u===h:u===h.name})})).map(u=>{let h,f;return typeof u=="string"?(h=u,f=e[h]||this.options_[h]||{}):(h=u.name,f=u),{name:h,opts:f}}).filter(u=>{const h=nt.getComponent(u.opts.componentClass||qi(u.name));return h&&!l.isTech(h)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Co(e,t||this.contentEl())}$$(e,t){return _T(e,t||this.contentEl())}hasClass(e){return id(this.el_,e)}addClass(...e){dl(this.el_,...e)}removeClass(...e){f0(this.el_,...e)}toggleClass(e,t){fT(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return pT(this.el_,e)}setAttribute(e,t){Eu(this.el_,e,t)}removeAttribute(e){m0(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const a=this.el_.style[e],l=a.indexOf("px");return parseInt(l!==-1?a.slice(0,l):this.el_["offset"+qi(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Au(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${qi(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,a=200;let l;this.on("touchstart",function(h){h.touches.length===1&&(t={pageX:h.touches[0].pageX,pageY:h.touches[0].pageY},e=de.performance.now(),l=!0)}),this.on("touchmove",function(h){if(h.touches.length>1)l=!1;else if(t){const f=h.touches[0].pageX-t.pageX,g=h.touches[0].pageY-t.pageY;Math.sqrt(f*f+g*g)>i&&(l=!1)}});const u=function(){l=!1};this.on("touchleave",u),this.on("touchcancel",u),this.on("touchend",function(h){t=null,l===!0&&de.performance.now()-e{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),de.clearTimeout(e)),e}setInterval(e,t){e=Si(this,e),this.clearTimersOnDispose_();const i=de.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),de.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Si(this,e),t=de.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Si(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),de.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,a)=>this[t](a))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(l){const u=de.getComputedStyle(l,null),h=u.getPropertyValue("visibility");return u.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(h)}function i(l){return!(!t(l.parentElement)||!t(l)||l.style.opacity==="0"||de.getComputedStyle(l).height==="0px"||de.getComputedStyle(l).width==="0px")}function a(l){if(l.offsetWidth+l.offsetHeight+l.getBoundingClientRect().height+l.getBoundingClientRect().width===0)return!1;const u={x:l.getBoundingClientRect().left+l.offsetWidth/2,y:l.getBoundingClientRect().top+l.offsetHeight/2};if(u.x<0||u.x>(xt.documentElement.clientWidth||de.innerWidth)||u.y<0||u.y>(xt.documentElement.clientHeight||de.innerHeight))return!1;let h=xt.elementFromPoint(u.x,u.y);for(;h;){if(h===l)return!0;if(h.parentNode)h=h.parentNode;else return!1}}return e||(e=this.el()),!!(a(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=nt.getComponent("Tech"),a=i&&i.isTech(t),l=nt===t||nt.prototype.isPrototypeOf(t.prototype);if(a||!l){let h;throw a?h="techs must be registered using Tech.registerTech()":h="must be a Component subclass",new Error(`Illegal component, "${e}"; ${h}.`)}e=qi(e),nt.components_||(nt.components_={});const u=nt.getComponent("Player");if(e==="Player"&&u&&u.players){const h=u.players,f=Object.keys(h);if(h&&f.length>0){for(let g=0;gt)throw new Error(`Failed to execute '${n}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function F2(n,e,t,i){return J4(n,i,t.length-1),t[i][e]}function ng(n){let e;return n===void 0||n.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:n.length,start:F2.bind(null,"start",0,n),end:F2.bind(null,"end",1,n)},de.Symbol&&de.Symbol.iterator&&(e[de.Symbol.iterator]=()=>(n||[]).values()),e}function Ms(n,e){return Array.isArray(n)?ng(n):n===void 0||e===void 0?ng():ng([[n,e]])}const jT=function(n,e){n=n<0?0:n;let t=Math.floor(n%60),i=Math.floor(n/60%60),a=Math.floor(n/3600);const l=Math.floor(e/60%60),u=Math.floor(e/3600);return(isNaN(n)||n===1/0)&&(a=i=t="-"),a=a>0||u>0?a+":":"",i=((a||l>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,a+i+t};let Ly=jT;function RT(n){Ly=n}function OT(){Ly=jT}function bl(n,e=n){return Ly(n,e)}var eM=Object.freeze({__proto__:null,createTimeRanges:Ms,createTimeRange:Ms,setFormatTime:RT,resetFormatTime:OT,formatTime:bl});function LT(n,e){let t=0,i,a;if(!e)return 0;(!n||!n.length)&&(n=Ms(0,0));for(let l=0;le&&(a=e),t+=a-i;return t/e}function Ii(n){if(n instanceof Ii)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:ea(n)&&(typeof n.code=="number"&&(this.code=n.code),Object.assign(this,n)),this.message||(this.message=Ii.defaultMessages[this.code]||"")}Ii.prototype.code=0;Ii.prototype.message="";Ii.prototype.status=null;Ii.prototype.metadata=null;Ii.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ii.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Ii.MEDIA_ERR_CUSTOM=0;Ii.prototype.MEDIA_ERR_CUSTOM=0;Ii.MEDIA_ERR_ABORTED=1;Ii.prototype.MEDIA_ERR_ABORTED=1;Ii.MEDIA_ERR_NETWORK=2;Ii.prototype.MEDIA_ERR_NETWORK=2;Ii.MEDIA_ERR_DECODE=3;Ii.prototype.MEDIA_ERR_DECODE=3;Ii.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.MEDIA_ERR_ENCRYPTED=5;Ii.prototype.MEDIA_ERR_ENCRYPTED=5;function sd(n){return n!=null&&typeof n.then=="function"}function Xs(n){sd(n)&&n.then(null,e=>{})}const Yg=function(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,a)=>(n[i]&&(t[i]=n[i]),t),{cues:n.cues&&Array.prototype.map.call(n.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},tM=function(n){const e=n.$$("track"),t=Array.prototype.map.call(e,a=>a.track);return Array.prototype.map.call(e,function(a){const l=Yg(a.track);return a.src&&(l.src=a.src),l}).concat(Array.prototype.filter.call(n.textTracks(),function(a){return t.indexOf(a)===-1}).map(Yg))},nM=function(n,e){return n.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(a=>i.addCue(a))}),e.textTracks()};var Qg={textTracksToJson:tM,jsonToTextTracks:nM,trackToJson:Yg};const ig="vjs-modal-dialog";class Ou extends nt{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=dn("div",{className:`${ig}-content`},{role:"document"}),this.descEl_=dn("p",{className:`${ig}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ao(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${ig} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const a=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=a,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,a=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),xT(t,e),this.trigger("modalfill"),a?i.insertBefore(t,a):i.appendChild(t);const l=this.getChild("closeButton");l&&i.appendChild(l.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),g0(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=xt.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let a;for(let l=0;l(t instanceof de.HTMLAnchorElement||t instanceof de.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof de.HTMLInputElement||t instanceof de.HTMLSelectElement||t instanceof de.HTMLTextAreaElement||t instanceof de.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof de.HTMLIFrameElement||t instanceof de.HTMLObjectElement||t instanceof de.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ou.prototype.options_={pauseOnOpen:!0,temporary:!0};nt.registerComponent("ModalDialog",Ou);class vl extends as{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},Aa(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,a=this.length;i=0;t--)if(e[t].enabled){rg(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&rg(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,rg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const sg=function(n,e){for(let t=0;t=0;t--)if(e[t].selected){sg(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,sg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Iy extends vl{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class iM{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t0&&(de.console&&de.console.groupCollapsed&&de.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>Dn.error(a)),de.console&&de.console.groupEnd&&de.console.groupEnd()),t.flush()},$2=function(n,e){const t={uri:n},i=x0(n);i&&(t.cors=i);const a=e.tech_.crossOrigin()==="use-credentials";a&&(t.withCredentials=a),Uw(t,Si(this,function(l,u,h){if(l)return Dn.error(l,u);e.loaded_=!0,typeof de.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],f=>{if(f.type==="vttjserror"){Dn.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return z2(h,e)}):z2(h,e)}))};class Td extends By{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=hi(e,{kind:aM[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=U2[t.mode]||"disabled";const a=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const l=new Of(this.cues_),u=new Of(this.activeCues_);let h=!1;this.timeupdateHandler=Si(this,function(g={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){g.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,h&&(this.trigger("cuechange"),h=!1),g.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const f=()=>{this.stopTracking()};this.tech_.one("dispose",f),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return a},set(){}},mode:{get(){return i},set(g){U2[g]&&i!==g&&(i=g,!this.preload_&&i!=="disabled"&&this.cues.length===0&&$2(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?l:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return u;const g=this.tech_.currentTime(),_=[];for(let S=0,C=this.cues.length;S=g&&_.push(N)}if(h=!1,_.length!==this.activeCues_.length)h=!0;else for(let S=0;S<_.length;S++)this.activeCues_.indexOf(_[S])===-1&&(h=!0);return this.activeCues_=_,u.setCues_(this.activeCues_),u},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&$2(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new de.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const a in e)a in t||(t[a]=e[a]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let a=0;a{t=Da.LOADED,this.trigger({type:"load",target:this})})}}Da.prototype.allowedEvents_={load:"load"};Da.NONE=0;Da.LOADING=1;Da.LOADED=2;Da.ERROR=3;const gs={audio:{ListClass:IT,TrackClass:FT,capitalName:"Audio"},video:{ListClass:BT,TrackClass:UT,capitalName:"Video"},text:{ListClass:Iy,TrackClass:Td,capitalName:"Text"}};Object.keys(gs).forEach(function(n){gs[n].getterName=`${n}Tracks`,gs[n].privateName=`${n}Tracks_`});const Nu={remoteText:{ListClass:Iy,TrackClass:Td,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:iM,TrackClass:Da,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Cr=Object.assign({},gs,Nu);Nu.names=Object.keys(Nu);gs.names=Object.keys(gs);Cr.names=[].concat(Nu.names).concat(gs.names);function lM(n,e,t,i,a={}){const l=n.textTracks();a.kind=e,t&&(a.label=t),i&&(a.language=i),a.tech=n;const u=new Cr.text.TrackClass(a);return l.addTrack(u),u}class vn extends nt{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Cr.names.forEach(i=>{const a=Cr[i];e&&e[a.getterName]&&(this[a.privateName]=e[a.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Cr.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Si(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ms(0,0)}bufferedPercent(){return LT(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(gs.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let a=i.length;for(;a--;){const l=i[a];t==="text"&&this.removeRemoteTextTrack(l),i.removeTrack(l)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ii(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ms(0,0):Ms()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){gs.names.forEach(e=>{const t=gs[e],i=()=>{this.trigger(`${e}trackchange`)},a=this[t.getterName]();a.addEventListener("removetrack",i),a.addEventListener("addtrack",i),this.on("dispose",()=>{a.removeEventListener("removetrack",i),a.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!de.WebVTT)if(xt.body.contains(this.el())){if(!this.options_["vtt.js"]&&ku(h2)&&Object.keys(h2).length>0){this.trigger("vttjsloaded");return}const e=xt.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),de.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=h=>e.addTrack(h.track),a=h=>e.removeTrack(h.track);t.on("addtrack",i),t.on("removetrack",a),this.addWebVttScript_();const l=()=>this.trigger("texttrackchange"),u=()=>{l();for(let h=0;hthis.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=ys();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return vn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof vn||e instanceof vn||e===vn}static registerTech(e,t){if(vn.techs_||(vn.techs_={}),!vn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!vn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!vn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qi(e),vn.techs_[e]=t,vn.techs_[rd(e)]=t,e!=="Tech"&&vn.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(vn.techs_&&vn.techs_[e])return vn.techs_[e];if(e=qi(e),de&&de.videojs&&de.videojs[e])return Dn.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),de.videojs[e]}}}Cr.names.forEach(function(n){const e=Cr[n];vn.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});vn.prototype.featuresVolumeControl=!0;vn.prototype.featuresMuteControl=!0;vn.prototype.featuresFullscreenResize=!1;vn.prototype.featuresPlaybackRate=!1;vn.prototype.featuresProgressEvents=!1;vn.prototype.featuresSourceset=!1;vn.prototype.featuresTimeupdateEvents=!1;vn.prototype.featuresNativeTextTracks=!1;vn.prototype.featuresVideoFrameCallback=!1;vn.withSourceHandlers=function(n){n.registerSourceHandler=function(t,i){let a=n.sourceHandlers;a||(a=n.sourceHandlers=[]),i===void 0&&(i=a.length),a.splice(i,0,t)},n.canPlayType=function(t){const i=n.sourceHandlers||[];let a;for(let l=0;lil(e,hl[e.type],t,n),1)}function dM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function hM(n,e,t){return n.reduceRight(Uy(t),e[t]())}function fM(n,e,t,i){return e[t](n.reduce(Uy(t),i))}function H2(n,e,t,i=null){const a="call"+qi(t),l=n.reduce(Uy(a),i),u=l===If,h=u?null:e[t](l);return gM(n,t,h,u),h}const mM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},pM={setCurrentTime:1,setMuted:1,setVolume:1},q2={play:1,pause:1};function Uy(n){return(e,t)=>e===If?If:t[n]?t[n](e):e}function gM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function yM(n){Lf.hasOwnProperty(n.id())&&delete Lf[n.id()]}function bM(n,e){const t=Lf[n.id()];let i=null;if(t==null)return i=e(n),Lf[n.id()]=[[e,i]],i;for(let a=0;a{if(!e)return"";if(n.cache_.source.src===e&&n.cache_.source.type)return n.cache_.source.type;const t=n.cache_.sources.filter(a=>a.src===e);if(t.length)return t[0].type;const i=n.$$("source");for(let a=0;a `;const G2=Df?10009:Mf?461:8,Yl={codes:{play:415,pause:19,ff:417,rw:412,back:G2},names:{415:"play",19:"pause",417:"ff",412:"rw",[G2]:"back"},isEventKey(n,e){return e=e.toLowerCase(),!!(this.names[n.keyCode]&&this.names[n.keyCode]===e)},getEventName(n){if(this.names[n.keyCode])return this.names[n.keyCode];if(this.codes[n.code]){const e=this.codes[n.code];return this.names[e]}return null}},K2=5;class wM extends as{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(Yl.isEventKey(t,"play")||Yl.isEventKey(t,"pause")||Yl.isEventKey(t,"ff")||Yl.isEventKey(t,"rw")){t.preventDefault();const i=Yl.getEventName(t);this.performMediaAction_(i)}else Yl.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+K2);break;case"rw":this.userSeek_(this.player_.currentTime()-K2);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const a=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(a&&a.name()==="CloseButton"?this.refocusComponent():(this.pause(),a&&a.el()&&(this.lastFocusedComponent_=a)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(a){for(const l of a)l.hasOwnProperty("el_")&&l.getIsFocusable()&&l.getIsAvailableToBeFocused(l.el())&&t.push(l),l.hasOwnProperty("children_")&&l.children_.length>0&&i(l.children_)}return e.children_.forEach(a=>{if(a.hasOwnProperty("el_"))if(a.getIsFocusable&&a.getIsAvailableToBeFocused&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el())){t.push(a);return}else a.hasOwnProperty("children_")&&a.children_.length>0?i(a.children_):a.hasOwnProperty("items")&&a.items.length>0?i(a.items):this.findSuitableDOMChild(a)&&t.push(a);if(a.name_==="ErrorDisplay"&&a.opened_){const l=a.el_.querySelector(".vjs-errors-ok-button-container");l&&l.querySelectorAll("button").forEach((h,f)=>{t.push({name:()=>"ModalButton"+(f+1),el:()=>h,getPositions:()=>{const g=h.getBoundingClientRect(),_={x:g.x,y:g.y,width:g.width,height:g.height,top:g.top,right:g.right,bottom:g.bottom,left:g.left},S={x:g.left+g.width/2,y:g.top+g.height/2,width:0,height:0,top:g.top+g.height/2,right:g.left+g.width/2,bottom:g.top+g.height/2,left:g.left+g.width/2};return{boundingClientRect:_,center:S}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:g=>!0,focus:()=>h.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let a=0;a0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),a=this.focusableComponents.filter(u=>u!==t&&this.isInDirection_(i.boundingClientRect,u.getPositions().boundingClientRect,e)),l=this.findBestCandidate_(i.center,a,e);l?this.focus(l):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let a=1/0,l=null;for(const u of t){const h=u.getPositions().center,f=this.calculateDistance_(e,h,i);f=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;ethis.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&Dn.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const a=dn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=dn("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ao(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("ClickableComponent",_0);class Zg extends _0{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return dn("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(dn("picture",{className:"vjs-poster",tabIndex:-1},{},dn("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Xs(this.player_.play()):this.player_.pause())}}Zg.prototype.crossorigin=Zg.prototype.crossOrigin;nt.registerComponent("PosterImage",Zg);const fs="#222",W2="#ccc",SM={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function ag(n,e){let t;if(n.length===4)t=n[1]+n[1]+n[2]+n[2]+n[3]+n[3];else if(n.length===7)t=n.slice(1);else throw new Error("Invalid color code provided, "+n+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Vs(n,e,t){try{n.style[e]=t}catch{return}}function X2(n){return n?`${n}px`:""}class kM extends nt{constructor(e,t,i){super(e,t,i);const a=u=>this.updateDisplay(u),l=u=>{this.updateDisplayOverlay(),this.updateDisplay(u)};e.on("loadstart",u=>this.toggleDisplay(u)),e.on("useractive",a),e.on("userinactive",a),e.on("texttrackchange",a),e.on("loadedmetadata",u=>{this.updateDisplayOverlay(),this.preselectTrack(u)}),e.ready(Si(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=de.screen.orientation||de,h=de.screen.orientation?"change":"orientationchange";u.addEventListener(h,l),e.on("dispose",()=>u.removeEventListener(h,l));const f=this.options_.playerOptions.tracks||[];for(let g=0;g0&&h.forEach(_=>{if(_.style.inset){const S=_.style.inset.split(" ");S.length===3&&Object.assign(_.style,{top:S[0],right:S[1],bottom:S[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!de.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,a=this.player_.videoWidth()/this.player_.videoHeight();let l=0,u=0;Math.abs(i-a)>.1&&(i>a?l=Math.round((e-t*a)/2):u=Math.round((t-e/a)/2)),Vs(this.el_,"insetInline",X2(l)),Vs(this.el_,"insetBlock",X2(u))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let a=i.length;for(;a--;){const l=i[a];if(!l)continue;const u=l.displayState;if(t.color&&(u.firstChild.style.color=t.color),t.textOpacity&&Vs(u.firstChild,"color",ag(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(u.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Vs(u.firstChild,"backgroundColor",ag(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Vs(u,"backgroundColor",ag(t.windowColor,t.windowOpacity)):u.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?u.firstChild.style.textShadow=`2px 2px 3px ${fs}, 2px 2px 4px ${fs}, 2px 2px 5px ${fs}`:t.edgeStyle==="raised"?u.firstChild.style.textShadow=`1px 1px ${fs}, 2px 2px ${fs}, 3px 3px ${fs}`:t.edgeStyle==="depressed"?u.firstChild.style.textShadow=`1px 1px ${W2}, 0 1px ${W2}, -1px -1px ${fs}, 0 -1px ${fs}`:t.edgeStyle==="uniform"&&(u.firstChild.style.textShadow=`0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}`)),t.fontPercent&&t.fontPercent!==1){const h=de.parseFloat(u.style.fontSize);u.style.fontSize=h*t.fontPercent+"px",u.style.height="auto",u.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?u.firstChild.style.fontVariant="small-caps":u.firstChild.style.fontFamily=SM[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof de.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;ithis.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Xs(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),a=i&&i.getChild("playToggle");if(!a){this.player_.tech(!0).focus();return}const l=()=>a.focus();sd(t)?t.then(l,()=>{}):this.setTimeout(l,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}$T.prototype.controlText_="Play Video";nt.registerComponent("BigPlayButton",$T);class CM extends wr{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("CloseButton",CM);class HT extends wr{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Xs(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}HT.prototype.controlText_="Play";nt.registerComponent("PlayToggle",HT);class Lu extends nt{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=dn("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=dn("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=bl(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Dn.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=xt.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Lu.prototype.labelText_="Time";Lu.prototype.controlText_="Time";nt.registerComponent("TimeDisplay",Lu);class zy extends Lu{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}zy.prototype.labelText_="Current Time";zy.prototype.controlText_="Current Time";nt.registerComponent("CurrentTimeDisplay",zy);class $y extends Lu{constructor(e,t){super(e,t);const i=a=>this.updateContent(a);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}$y.prototype.labelText_="Duration";$y.prototype.controlText_="Duration";nt.registerComponent("DurationDisplay",$y);class AM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}nt.registerComponent("TimeDivider",AM);class Hy extends Lu{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(dn("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Hy.prototype.labelText_="Remaining Time";Hy.prototype.controlText_="Remaining Time";nt.registerComponent("RemainingTimeDisplay",Hy);class NM extends nt{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=dn("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(dn("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(xt.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}nt.registerComponent("LiveDisplay",NM);class qT extends wr{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=dn("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}qT.prototype.controlText_="Seek to live, currently playing live";nt.registerComponent("SeekToLive",qT);function Sd(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var DM=Object.freeze({__proto__:null,clamp:Sd});class qy extends nt{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ta&&e.preventDefault(),gT(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;yT(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Sd(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=p0(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,a=t&&t.horizontalSeek;i?a&&e.key==="ArrowLeft"||!a&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):a&&e.key==="ArrowRight"||!a&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}nt.registerComponent("Slider",qy);const og=(n,e)=>Sd(n/e*100,0,100).toFixed(2)+"%";class MM extends nt{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=dn("span",{className:"vjs-control-text"}),i=dn("span",{textContent:this.localize("Loaded")}),a=xt.createTextNode(": ");return this.percentageEl_=dn("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(a),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),a=t&&t.isLive()?t.seekableEnd():this.player_.duration(),l=this.player_.bufferedEnd(),u=this.partEls_,h=og(l,a);this.percent_!==h&&(this.el_.style.width=h,Ao(this.percentageEl_,h),this.percent_=h);for(let f=0;fi.length;f--)this.el_.removeChild(u[f-1]);u.length=i.length})}}nt.registerComponent("LoadProgressBar",MM);class jM extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const a=pd(this.el_),l=Cu(this.player_.el()),u=e.width*t;if(!l||!a)return;let h=e.left-l.left+u,f=e.width-u+(l.right-e.right);f||(f=e.width-u,h=u);let g=a.width/2;ha.width&&(g=a.width),g=Math.round(g),this.el_.style.right=`-${g}px`,this.write(i)}write(e){Ao(this.el_,e)}updateTime(e,t,i,a){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let l;const u=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const h=this.player_.liveTracker.liveWindow(),f=h-t*h;l=(f<1?"":"-")+bl(f,h)}else l=bl(i,u);this.update(e,t,l),a&&a()})}}nt.registerComponent("TimeTooltip",jM);class Vy extends nt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const a=this.getChild("timeTooltip");if(!a)return;const l=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,l)}}Vy.prototype.options_={children:[]};!xr&&!js&&Vy.prototype.options_.children.push("timeTooltip");nt.registerComponent("PlayProgressBar",Vy);class VT extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}VT.prototype.options_={children:["timeTooltip"]};nt.registerComponent("MouseTimeDisplay",VT);class w0 extends qy{constructor(e,t){t=hi(w0.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(xr||js)||e.options_.disableSeekWhileScrubbingOnSTV;(!xr&&!js||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Si(this,this.update),this.update=na(this.update_,bs),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in xt&&"visibilityState"in xt&&this.on(xt,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){xt.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,bs))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(xt.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),a=this.player_.liveTracker;let l=this.player_.duration();a&&a.isLive()&&(l=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==l)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[bl(i,l),bl(l,l)],"{1} of {2}")),this.currentTime_=i,this.duration_=l),this.bar&&this.bar.update(Cu(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){gd(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!gd(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const a=this.calculateDistance(e),l=this.player_.liveTracker;if(!l||!l.isLive())i=a*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(a>=.99){l.seekToLiveEdge();return}const u=l.seekableStart(),h=l.liveCurrentTime();if(i=u+a*l.liveWindow(),i>=h&&(i=h),i<=u&&(i=u+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Xs(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in xt&&"visibilityState"in xt&&this.off(xt,"visibilitychange",this.toggleVisibility_),super.dispose()}}w0.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};nt.registerComponent("SeekBar",w0);class GT extends nt{constructor(e,t){super(e,t),this.handleMouseMove=na(Si(this,this.handleMouseMove),bs),this.throttledHandleMouseSeek=na(Si(this,this.handleMouseSeek),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),a=t.getChild("mouseTimeDisplay");if(!i&&!a)return;const l=t.el(),u=pd(l);let h=p0(l,e).x;h=Sd(h,0,1),a&&a.update(u,h),i&&i.update(u,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Xs(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}GT.prototype.options_={children:["seekBar"]};nt.registerComponent("ProgressControl",GT);class KT extends wr{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){xt.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in de?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof xt.exitPictureInPicture=="function"&&super.show()}}KT.prototype.controlText_="Picture-in-Picture";nt.registerComponent("PictureInPictureToggle",KT);class WT extends wr{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),xt[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}WT.prototype.controlText_="Fullscreen";nt.registerComponent("FullscreenToggle",WT);const RM=function(n,e){e.tech_&&!e.tech_.featuresVolumeControl&&n.addClass("vjs-hidden"),n.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};class OM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}nt.registerComponent("VolumeLevel",OM);class LM extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,a){if(!i){const l=Cu(this.el_),u=Cu(this.player_.el()),h=e.width*t;if(!u||!l)return;const f=e.left-u.left+h,g=e.width-h+(u.right-e.right);let _=l.width/2;f<_?_+=_-f:g<_&&(_=g),_<0?_=0:_>l.width&&(_=l.width),this.el_.style.right=`-${_}px`}this.write(`${a}%`)}write(e){Ao(this.el_,e)}updateVolume(e,t,i,a,l){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,a.toFixed(0)),l&&l()})}}nt.registerComponent("VolumeLevelTooltip",LM);class XT extends nt{constructor(e,t){super(e,t),this.update=na(Si(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const a=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,a,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}XT.prototype.options_={children:["volumeLevelTooltip"]};nt.registerComponent("MouseVolumeLevelDisplay",XT);class T0 extends qy{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){gd(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),a=Cu(i),l=this.vertical();let u=p0(i,e);u=l?u.y:u.x,u=Sd(u,0,1),t.update(a,u,l)}gd(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}T0.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!xr&&!js&&T0.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");T0.prototype.playerEvent="volumechange";nt.registerComponent("VolumeBar",T0);class YT extends nt{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||ku(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),RM(this,e),this.throttledHandleMouseMove=na(Si(this,this.handleMouseMove),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}YT.prototype.options_={children:["volumeBar"]};nt.registerComponent("VolumeControl",YT);const IM=function(n,e){e.tech_&&!e.tech_.featuresMuteControl&&n.addClass("vjs-hidden"),n.on(e,"loadstart",function(){e.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};class QT extends wr{constructor(e,t){super(e,t),IM(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const a=i<.1?.1:i;this.player_.volume(a),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),xr&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),f0(this.el_,[0,1,2,3].reduce((i,a)=>i+`${a?" ":""}vjs-vol-${a}`,"")),dl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}QT.prototype.controlText_="Mute";nt.registerComponent("MuteToggle",QT);class ZT extends nt{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||ku(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),ss(xt,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),_r(xt,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}ZT.prototype.options_={children:["muteToggle","volumeControl"]};nt.registerComponent("VolumePanel",ZT);class JT extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()?i.seekableEnd():this.player_.duration();let l;t+this.skipTime<=a?l=t+this.skipTime:l=a,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}JT.prototype.controlText_="Skip Forward";nt.registerComponent("SkipForward",JT);class eS extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()&&i.seekableStart();let l;a&&t-this.skipTime<=a?l=a:t>=this.skipTime?l=t-this.skipTime:l=0,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}eS.prototype.controlText_="Skip Backward";nt.registerComponent("SkipBackward",eS);class tS extends nt{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof nt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof nt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=dn(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),ss(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||xt.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(a=>a.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}nt.registerComponent("Menu",tS);class Gy extends nt{constructor(e,t={}){super(e,t),this.menuButton_=new wr(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=wr.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const a=l=>this.handleClick(l);this.handleMenuKeyUp_=l=>this.handleMenuKeyUp(l),this.on(this.menuButton_,"tap",a),this.on(this.menuButton_,"click",a),this.on(this.menuButton_,"keydown",l=>this.handleKeyDown(l)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),ss(xt,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",l=>this.handleMouseLeave(l)),this.on("keydown",l=>this.handleSubmenuKeyDown(l))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new tS(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=dn("li",{className:"vjs-menu-title",textContent:qi(this.options_.title),tabIndex:-1}),i=new nt(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t{this.handleTracksChange.apply(this,h)},u=(...h)=>{this.handleSelectedLanguageChange.apply(this,h)};if(e.on(["loadstart","texttrackchange"],l),a.addEventListener("change",l),a.addEventListener("selectedlanguagechange",u),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],l),a.removeEventListener("change",l),a.removeEventListener("selectedlanguagechange",u)}),a.onchange===void 0){let h;this.on(["tap","click"],function(){if(typeof de.Event!="object")try{h=new de.Event("change")}catch{}h||(h=xt.createEvent("Event"),h.initEvent("change",!0,!0)),a.dispatchEvent(h)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let a=0;a-1&&u.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let a=0,l=t.length;a-1&&u.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}nt.registerComponent("OffTextTrackMenuItem",nS);class Iu extends Ky{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ed){let i;this.label_&&(i=`${this.label_} off`),e.push(new nS(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const a=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let l=0;l-1){const h=new t(this.player_,{track:u,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});h.addClass(`vjs-${u.kind}-menu-item`),e.push(h)}}return e}}nt.registerComponent("TextTrackButton",Iu);class iS extends kd{constructor(e,t){const i=t.track,a=t.cue,l=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=a.text,t.selected=a.startTime<=l&&l{this.items.forEach(a=>{a.selected(this.track_.activeCues[0]===a.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(qi(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,a=t.length;i-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(qi(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Qy(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,rS),e}}Jy.prototype.kinds_=["captions","subtitles"];Jy.prototype.controlText_="Subtitles";nt.registerComponent("SubsCapsButton",Jy);class sS extends kd{constructor(e,t){const i=t.track,a=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const l=(...u)=>{this.handleTracksChange.apply(this,u)};a.addEventListener("change",l),this.on("dispose",()=>{a.removeEventListener("change",l)})}createEl(e,t,i){const a=super.createEl(e,t,i),l=a.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(l.appendChild(dn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(dn("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),a}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;ithis.update(l))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}eb.prototype.contentElType="button";nt.registerComponent("PlaybackRateMenuItem",eb);class oS extends Gy{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=dn("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new eb(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}oS.prototype.controlText_="Playback Rate";nt.registerComponent("PlaybackRateMenuButton",oS);class lS extends nt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}nt.registerComponent("Spacer",lS);class BM extends lS{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}nt.registerComponent("CustomControlSpacer",BM);class uS extends nt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}uS.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};nt.registerComponent("ControlBar",uS);class cS extends Ou{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}cS.prototype.options_=Object.assign({},Ou.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});nt.registerComponent("ErrorDisplay",cS);class dS extends nt{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),dn("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${ys()}`)+"-"+t[1].replace(/\W+/g,""),a=dn("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return a.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),a}))}}nt.registerComponent("TextTrackSelect",dS);class fl extends nt{constructor(e,t={}){super(e,t);const i=dn("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const a=this.options_.selects;for(const l of a){const u=this.options_.selectConfigs[l],h=u.className,f=u.id.replace("%s",this.options_.id_);let g=null;const _=`vjs_select_${ys()}`;if(this.options_.type==="colors"){g=dn("span",{className:h});const C=dn("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});C.setAttribute("for",_),g.appendChild(C)}const S=new dS(e,{SelectOptions:u.options,legendId:this.options_.legendId,id:_,labelId:f});this.addChild(S),this.options_.type==="colors"&&(g.appendChild(S.el()),this.el().appendChild(g))}}createEl(){return dn("fieldset",{className:this.options_.className})}}nt.registerComponent("TextTrackFieldset",fl);class hS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(u)}createEl(){return dn("div",{className:"vjs-track-settings-colors"})}}nt.registerComponent("TextTrackSettingsColors",hS);class fS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(u)}createEl(){return dn("div",{className:"vjs-track-settings-font"})}}nt.registerComponent("TextTrackSettingsFont",fS);class mS extends nt{constructor(e,t={}){super(e,t);const i=new wr(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const a=this.localize("Done"),l=new wr(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return dn("div",{className:"vjs-track-settings-controls"})}}nt.registerComponent("TrackSettingsControls",mS);const lg="vjs-text-track-settings",Y2=["#000","Black"],Q2=["#00F","Blue"],Z2=["#0FF","Cyan"],J2=["#0F0","Green"],e_=["#F0F","Magenta"],t_=["#F00","Red"],n_=["#FFF","White"],i_=["#FF0","Yellow"],ug=["1","Opaque"],cg=["0.5","Semi-Transparent"],r_=["0","Transparent"],xo={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Y2,n_,t_,J2,Q2,i_,e_,Z2],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ug,cg,r_],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[n_,Y2,t_,J2,Q2,i_,e_,Z2],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:n=>n==="1.00"?null:Number(n)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ug,cg],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[r_,cg,ug],className:"vjs-window-opacity vjs-opacity"}};xo.windowColor.options=xo.backgroundColor.options;function pS(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function PM(n,e){const t=n.options[n.options.selectedIndex].value;return pS(t,e)}function FM(n,e,t){if(e){for(let i=0;i{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),lu(xo,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return rT(xo,(e,t,i)=>{const a=PM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){lu(xo,(t,i)=>{FM(this.$(t.selector),e[i],t.parser)})}setDefaults(){lu(xo,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(de.localStorage.getItem(lg))}catch(t){Dn.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?de.localStorage.setItem(lg,JSON.stringify(e)):de.localStorage.removeItem(lg)}catch(t){Dn.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}nt.registerComponent("TextTrackSettings",UM);class zM extends nt{constructor(e,t){let i=t.ResizeObserver||de.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=hi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||de.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=CT(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const l=this.debouncedHandler_;let u=this.unloadListener_=function(){_r(this,"resize",l),_r(this,"unload",u),u=null};ss(this.el_.contentWindow,"unload",u),ss(this.el_.contentWindow,"resize",l)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}nt.registerComponent("ResizeManager",zM);const $M={trackingThreshold:20,liveTolerance:15};class HM extends nt{constructor(e,t){const i=hi($M,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=a=>this.handlePlay(a),this.handleFirstTimeupdate_=a=>this.handleFirstTimeupdate(a),this.handleSeeked_=a=>this.handleSeeked(a),this.seekToLiveEdge_=a=>this.seekToLiveEdge(a),this.reset_(),this.on(this.player_,"durationchange",a=>this.handleDurationchange(a)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(de.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const a=this.liveCurrentTime(),l=this.player_.currentTime();let u=this.player_.paused()||this.seekedBehindLive_||Math.abs(a-l)>this.options_.liveTolerance;(!this.timeupdateSeen_||a===1/0)&&(u=!1),u!==this.behindLiveEdge_&&(this.behindLiveEdge_=u,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,bs),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}nt.registerComponent("LiveTracker",HM);class qM extends nt{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:dn("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ys()}`}),description:dn("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ys()}`})},dn("div",{className:"vjs-title-bar"},{},sT(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(a=>{const l=this.state[a],u=this.els[a],h=i[a];g0(u),l&&Ao(u,l),t&&(t.removeAttribute(h),l&&t.setAttribute(h,u.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}nt.registerComponent("TitleBar",qM);const VM={initialDisplay:4e3,position:[],takeFocus:!1};class GM extends wr{constructor(e,t){t=hi(VM,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=dn("button",{},{type:"button",class:this.buildCSSClass()},dn("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}nt.registerComponent("TransientButton",GM);const Jg=n=>{const e=n.el();if(e.hasAttribute("src"))return n.triggerSourceset(e.src),!0;const t=n.$$("source"),i=[];let a="";if(!t.length)return!1;for(let l=0;l{let t={};for(let i=0;igS([n.el(),de.HTMLMediaElement.prototype,de.Element.prototype,KM],"innerHTML"),s_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=WM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Jg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",hi(i,{set:a(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(l=>{e[l]=t[l]}),Object.defineProperty(e,"innerHTML",i)},n.one("sourceset",e.resetSourceWatch_)},XM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?PT(de.Element.prototype.getAttribute.call(this,"src")):""},set(n){return de.Element.prototype.setAttribute.call(this,"src",n),n}}),YM=n=>gS([n.el(),de.HTMLMediaElement.prototype,XM],"src"),QM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=YM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",hi(t,{set:l=>{const u=t.set.call(e,l);return n.triggerSourceset(e.src),u}})),e.setAttribute=(l,u)=>{const h=i.call(e,l,u);return/src/i.test(l)&&n.triggerSourceset(e.src),h},e.load=()=>{const l=a.call(e);return Jg(n)||(n.triggerSourceset(""),s_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Jg(n)||s_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Bt extends vn{constructor(e,t){super(e,t);const i=e.source;let a=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const l=this.el_.childNodes;let u=l.length;const h=[];for(;u--;){const f=l[u];f.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(f),this.remoteTextTracks().addTrack(f.track),this.textTracks().addTrack(f.track),!a&&!this.el_.hasAttribute("crossorigin")&&x0(f.src)&&(a=!0)):h.push(f))}for(let f=0;f{t=[];for(let l=0;le.removeEventListener("change",i));const a=()=>{for(let l=0;l{e.removeEventListener("change",i),e.removeEventListener("change",a),e.addEventListener("change",a)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",a)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(a=>{this.el()[`${i}Tracks`].removeEventListener(a,this[`${i}TracksListeners_`][a])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=gs[e],i=this.el()[t.getterName],a=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const l={change:h=>{const f={type:"change",target:a,currentTarget:a,srcElement:a};a.trigger(f),e==="text"&&this[Nu.remoteText.getterName]().trigger(f)},addtrack(h){a.addTrack(h.track)},removetrack(h){a.removeTrack(h.track)}},u=function(){const h=[];for(let f=0;f{const f=l[h];i.addEventListener(h,f),this.on("dispose",g=>i.removeEventListener(h,f))}),this.on("loadstart",u),this.on("dispose",h=>this.off("loadstart",u))}proxyNativeTracks_(){gs.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),Bt.disposeMediaElement(e),e=i}else{e=xt.createElement("video");const i=this.options_.tag&&vo(this.options_.tag),a=hi({},i);(!md||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,mT(e,Object.assign(a,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Eu(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&h0?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Dn(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&js&&ta&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Xs(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Dn.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const a=dn("source",{},i);return this.el_.appendChild(a),!0}removeSourceElement(e){if(!e)return Dn.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Dn.warn(`No matching source element found with src: ${e}`),!1}reset(){Bt.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=xt.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),de.performance&&(e.creationTime=de.performance.now()),e}}l0(Bt,"TEST_VID",function(){if(!Mu())return;const n=xt.createElement("video"),e=xt.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Bt.isSupported=function(){try{Bt.TEST_VID.volume=.5}catch{return!1}return!!(Bt.TEST_VID&&Bt.TEST_VID.canPlayType)};Bt.canPlayType=function(n){return Bt.TEST_VID.canPlayType(n)};Bt.canPlaySource=function(n,e){return Bt.canPlayType(n.type)};Bt.canControlVolume=function(){try{const n=Bt.TEST_VID.volume;Bt.TEST_VID.volume=n/2+.1;const e=n!==Bt.TEST_VID.volume;return e&&xr?(de.setTimeout(()=>{Bt&&Bt.prototype&&(Bt.prototype.featuresVolumeControl=n!==Bt.TEST_VID.volume)}),!1):e}catch{return!1}};Bt.canMuteVolume=function(){try{const n=Bt.TEST_VID.muted;return Bt.TEST_VID.muted=!n,Bt.TEST_VID.muted?Eu(Bt.TEST_VID,"muted","muted"):m0(Bt.TEST_VID,"muted","muted"),n!==Bt.TEST_VID.muted}catch{return!1}};Bt.canControlPlaybackRate=function(){if(js&&ta&&u0<58)return!1;try{const n=Bt.TEST_VID.playbackRate;return Bt.TEST_VID.playbackRate=n/2+.1,n!==Bt.TEST_VID.playbackRate}catch{return!1}};Bt.canOverrideAttributes=function(){try{const n=()=>{};Object.defineProperty(xt.createElement("video"),"src",{get:n,set:n}),Object.defineProperty(xt.createElement("audio"),"src",{get:n,set:n}),Object.defineProperty(xt.createElement("video"),"innerHTML",{get:n,set:n}),Object.defineProperty(xt.createElement("audio"),"innerHTML",{get:n,set:n})}catch{return!1}return!0};Bt.supportsNativeTextTracks=function(){return h0||xr&&ta};Bt.supportsNativeVideoTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.videoTracks)};Bt.supportsNativeAudioTracks=function(){return!!(Bt.TEST_VID&&Bt.TEST_VID.audioTracks)};Bt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([n,e]){l0(Bt.prototype,n,()=>Bt[e](),!0)});Bt.prototype.featuresVolumeControl=Bt.canControlVolume();Bt.prototype.movingMediaElementInDOM=!xr;Bt.prototype.featuresFullscreenResize=!0;Bt.prototype.featuresProgressEvents=!0;Bt.prototype.featuresTimeupdateEvents=!0;Bt.prototype.featuresVideoFrameCallback=!!(Bt.TEST_VID&&Bt.TEST_VID.requestVideoFrameCallback);Bt.disposeMediaElement=function(n){if(n){for(n.parentNode&&n.parentNode.removeChild(n);n.hasChildNodes();)n.removeChild(n.firstChild);n.removeAttribute("src"),typeof n.load=="function"&&(function(){try{n.load()}catch{}})()}};Bt.resetMediaElement=function(n){if(!n)return;const e=n.querySelectorAll("source");let t=e.length;for(;t--;)n.removeChild(e[t]);n.removeAttribute("src"),typeof n.load=="function"&&(function(){try{n.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Bt.prototype["set"+qi(n)]=function(e){this.el_[n]=e,e?this.el_.setAttribute(n,n):this.el_.removeAttribute(n)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Bt.prototype["set"+qi(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Bt.prototype[n]=function(){return this.el_[n]()}});vn.withSourceHandlers(Bt);Bt.nativeSourceHandler={};Bt.nativeSourceHandler.canPlayType=function(n){try{return Bt.TEST_VID.canPlayType(n)}catch{return""}};Bt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Bt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Fy(n.src);return Bt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Bt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Bt.nativeSourceHandler.dispose=function(){};Bt.registerSourceHandler(Bt.nativeSourceHandler);vn.registerTech("Html5",Bt);const yS=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],dg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ey=["tiny","xsmall","small","medium","large","xlarge","huge"],ff={};ey.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;ff[n]=`vjs-layout-${e}`});const ZM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let Mi=class nu extends nt{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${ys()}`,t=Object.assign(nu.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const u=e.closest("[lang]");u&&(t.language=u.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=u=>this.documentFullscreenChange_(u),this.boundFullWindowOnEscKey_=u=>this.fullWindowOnEscKey(u),this.boundUpdateStyleEl_=u=>this.updateStyleEl_(u),this.boundApplyInitTime_=u=>this.applyInitTime_(u),this.boundUpdateCurrentBreakpoint_=u=>this.updateCurrentBreakpoint_(u),this.boundHandleTechClick_=u=>this.handleTechClick_(u),this.boundHandleTechDoubleClick_=u=>this.handleTechDoubleClick_(u),this.boundHandleTechTouchStart_=u=>this.handleTechTouchStart_(u),this.boundHandleTechTouchMove_=u=>this.handleTechTouchMove_(u),this.boundHandleTechTouchEnd_=u=>this.handleTechTouchEnd_(u),this.boundHandleTechTap_=u=>this.handleTechTap_(u),this.boundUpdatePlayerHeightOnAudioOnlyMode_=u=>this.updatePlayerHeightOnAudioOnlyMode_(u),this.isFullscreen_=!1,this.log=nT(this.id_),this.fsApi_=Cf,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&vo(e),this.language(this.options_.language),t.languages){const u={};Object.getOwnPropertyNames(t.languages).forEach(function(h){u[h.toLowerCase()]=t.languages[h]}),this.languages_=u}else this.languages_=nu.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(u=>{if(typeof this[u]!="function")throw new Error(`plugin "${u}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),Oy(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ss(xt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const a=hi(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(u=>{this[u](t.plugins[u])}),t.debug&&this.debug(!0),this.options_.playerOptions=a,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const h=new de.DOMParser().parseFromString(_M,"image/svg+xml");if(h.querySelector("parsererror"))Dn.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const g=h.documentElement;g.style.display="none",this.el_.appendChild(g),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new wM(this),this.addClass("vjs-spatial-navigation-enabled")),md&&this.addClass("vjs-touch-enabled"),xr||this.addClass("vjs-workinghover"),nu.players[this.id_]=this;const l=Hg.split(".")[0];this.addClass(`vjs-v${l}`),this.userActive(!0),this.reportUserActivity(),this.one("play",u=>this.listenForUserActivity_(u)),this.on("keydown",u=>this.handleKeyDown(u)),this.on("languagechange",u=>this.handleLanguagechange(u)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),_r(xt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_r(xt,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),nu.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),yM(this),Cr.names.forEach(e=>{const t=Cr[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const a=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:a||(t=this.el_=super.createEl("div"));const l=vo(e);if(a){for(t=this.el_=e,e=this.tag=xt.createElement("video");t.children.length;)e.appendChild(t.firstChild);id(t,"video-js")||dl(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(f=>{try{e[f]=t[f]}catch{}})}e.setAttribute("tabindex","-1"),l.tabindex="-1",ta&&c0&&(e.setAttribute("role","application"),l.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in l&&delete l.width,"height"in l&&delete l.height,Object.getOwnPropertyNames(l).forEach(function(f){a&&f==="class"||t.setAttribute(f,l[f]),a&&e.setAttribute(f,l[f])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const u=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(f=>cT[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),de.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=kT("vjs-styles-dimensions");const f=Co(".vjs-styles-defaults"),g=Co("head");g.insertBefore(this.styleEl_,f?f.nextSibling:g.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const h=e.getElementsByTagName("a");for(let f=0;f"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Dn.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const a=parseFloat(t);if(isNaN(a)){Dn.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=a,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Aa(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),X4(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(de.VIDEOJS_NO_DYNAMIC_STYLE===!0){const h=typeof this.width_=="number"?this.width_:this.options_.width,f=typeof this.height_=="number"?this.height_:this.options_.height,g=this.tech_&&this.tech_.el();g&&(h>=0&&(g.width=h),f>=0&&(g.height=f));return}let e,t,i,a;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const l=i.split(":"),u=l[1]/l[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/u:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*u,/^[^a-zA-Z]/.test(this.id())?a="dimensions-"+this.id():a=this.id()+"-dimensions",this.addClass(a),ET(this.styleEl_,` .${a} { width: ${e}px; height: ${t}px; } .${a}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${u*100}%; } `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=qi(e),a=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(vn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let l=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(l=!1);const u={source:t,autoplay:l,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${a}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Cr.names.forEach(f=>{const g=Cr[f];u[g.getterName]=this[g.privateName]}),Object.assign(u,this.options_[i]),Object.assign(u,this.options_[a]),Object.assign(u,this.options_[e.toLowerCase()]),this.tag&&(u.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(u.startTime=this.cache_.currentTime);const h=vn.getTech(e);if(!h)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new h(u),this.tech_.ready(Si(this,this.handleTechReady_),!0),Qg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),yS.forEach(f=>{this.on(this.tech_,f,g=>this[`handleTech${qi(f)}_`](g))}),Object.keys(dg).forEach(f=>{this.on(this.tech_,f,g=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${dg[f]}_`].bind(this),event:g});return}this[`handleTech${dg[f]}_`](g)})}),this.on(this.tech_,"loadstart",f=>this.handleTechLoadStart_(f)),this.on(this.tech_,"sourceset",f=>this.handleTechSourceset_(f)),this.on(this.tech_,"waiting",f=>this.handleTechWaiting_(f)),this.on(this.tech_,"ended",f=>this.handleTechEnded_(f)),this.on(this.tech_,"seeking",f=>this.handleTechSeeking_(f)),this.on(this.tech_,"play",f=>this.handleTechPlay_(f)),this.on(this.tech_,"pause",f=>this.handleTechPause_(f)),this.on(this.tech_,"durationchange",f=>this.handleTechDurationChange_(f)),this.on(this.tech_,"fullscreenchange",(f,g)=>this.handleTechFullscreenChange_(f,g)),this.on(this.tech_,"fullscreenerror",(f,g)=>this.handleTechFullscreenError_(f,g)),this.on(this.tech_,"enterpictureinpicture",f=>this.handleTechEnterPictureInPicture_(f)),this.on(this.tech_,"leavepictureinpicture",f=>this.handleTechLeavePictureInPicture_(f)),this.on(this.tech_,"error",f=>this.handleTechError_(f)),this.on(this.tech_,"posterchange",f=>this.handleTechPosterChange_(f)),this.on(this.tech_,"textdata",f=>this.handleTechTextData_(f)),this.on(this.tech_,"ratechange",f=>this.handleTechRateChange_(f)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&Vg(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Cr.names.forEach(e=>{const t=Cr[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Qg.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Dn.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. `),this.tech_}version(){return{"video.js":Hg}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const a=this.muted();this.muted(!0);const l=()=>{this.muted(a)};this.playTerminatedQueue_.push(l);const u=this.play();if(sd(u))return u.catch(h=>{throw l(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${h||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),sd(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!sd(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=xM(this,t)),this.cache_.source=hi({},e,{src:t,type:i});const a=this.cache_.sources.filter(f=>f.src&&f.src===t),l=[],u=this.$$("source"),h=[];for(let f=0;fthis.updateSourceCaches_(l);const i=this.currentSource().src,a=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(a)&&(!this.lastSource_||this.lastSource_.tech!==a&&this.lastSource_.player!==i)&&(t=()=>{}),t(a),e.src||this.tech_.any(["sourceset","loadstart"],l=>{if(l.type==="sourceset")return;const u=this.techGet_("currentSrc");this.lastSource_.tech=u,this.updateSourceCaches_(u)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Xs(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!xt.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let a=xt[this.fsApi_.fullscreenElement]===i;!a&&i.matches&&(a=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(a)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in pM)return fM(this.middleware_,this.tech_,e,t);if(e in q2)return H2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Dn(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in mM)return hM(this.middleware_,this.tech_,e);if(e in q2)return H2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Dn(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Dn(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Dn(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Xs){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(h0||xr);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=u=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const a=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),a===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(a)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ms(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Ms(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ms(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return LT(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,a)=>{function l(){t.off("fullscreenerror",h),t.off("fullscreenchange",u)}function u(){l(),i()}function h(g,_){l(),a(_)}t.one("fullscreenchange",u),t.one("fullscreenerror",h);const f=t.requestFullscreenHelper_(e);f&&(f.then(l,l),f.then(i,a))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function a(){e.off("fullscreenerror",u),e.off("fullscreenchange",l)}function l(){a(),t()}function u(f,g){a(),i(g)}e.one("fullscreenchange",l),e.one("fullscreenerror",u);const h=e.exitFullscreenHelper_();h&&(h.then(a,a),h.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=xt[this.fsApi_.exitFullscreen]();return e&&Xs(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=xt.documentElement.style.overflow,ss(xt,"keydown",this.boundFullWindowOnEscKey_),xt.documentElement.style.overflow="hidden",dl(xt.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,_r(xt,"keydown",this.boundFullWindowOnEscKey_),xt.documentElement.style.overflow=this.docOrigOverflow,f0(xt.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&de.documentPictureInPicture){const e=xt.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(dn("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),de.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(wT(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const a=i.target.querySelector(".video-js");e.parentNode.replaceChild(a,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in xt&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(de.documentPictureInPicture&&de.documentPictureInPicture.window)return de.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in xt)return xt.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(a=>{const l=a.tagName.toLowerCase();if(a.isContentEditable)return!0;const u=["button","checkbox","hidden","radio","reset","submit"];return l==="input"?u.indexOf(a.type)===-1:["textarea"].indexOf(l)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=u=>e.key.toLowerCase()==="f",muteKey:a=u=>e.key.toLowerCase()==="m",playPauseKey:l=u=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const u=nt.getComponent("FullscreenToggle");xt[this.fsApi_.fullscreenEnabled]!==!1&&u.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),nt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):l.call(this,e)&&(e.preventDefault(),e.stopPropagation(),nt.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,a=this.options_.techOrder;i[h,vn.getTech(h)]).filter(([h,f])=>f?f.isSupported():(Dn.error(`The "${h}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(h,f,g){let _;return h.some(S=>f.some(C=>{if(_=g(S,C),_)return!0})),_};let a;const l=h=>(f,g)=>h(g,f),u=([h,f],g)=>{if(f.canPlaySource(g,this.options_[h.toLowerCase()]))return{source:g,tech:h}};return this.options_.sourceOrder?a=i(e,t,l(u)):a=i(t,e,u),a||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=zT(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),cM(this,i[0],(a,l)=>{if(this.middleware_=l,t||(this.cache_.sources=i),this.updateSourceCaches_(a),this.src_(a)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}dM(l,this.tech_)}),i.length>1){const a=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},l=()=>{this.off("error",a)};this.one("error",a),this.one("playing",l),this.resetRetryOnError_=()=>{this.off("error",a),this.off("playing",l)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?MT(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Xs(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Aa(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:a}=this.controlBar||{},{seekBar:l}=i||{};e&&e.updateContent(),t&&t.updateContent(),a&&a.updateContent(),l&&(l.update(),l.loadProgressBar&&l.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Eo("beforeerror").forEach(t=>{const i=t(this,e);if(!(ea(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Ii(e),this.addClass("vjs-error"),Dn.error(`(CODE:${this.error_.code} ${Ii.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Eo("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const a=Si(this,this.reportUserActivity),l=function(S){(S.screenX!==t||S.screenY!==i)&&(t=S.screenX,i=S.screenY,a())},u=function(){a(),this.clearInterval(e),e=this.setInterval(a,250)},h=function(S){a(),this.clearInterval(e)};this.on("mousedown",u),this.on("mousemove",l),this.on("mouseup",h),this.on("mouseleave",h);const f=this.getChild("controlBar");f&&!xr&&!js&&(f.on("mouseenter",function(S){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),f.on("mouseleave",function(S){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",a),this.on("keyup",a);let g;const _=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(g);const S=this.options_.inactivityTimeout;S<=0||(g=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},S))};this.setInterval(_,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(a=>{a!==t&&a.el_&&!a.hasClass("vjs-hidden")&&(a.hide(),this.audioOnlyCache_.hiddenChildren.push(a))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Aa(this)&&this.trigger("languagechange"))}languages(){return hi(nu.prototype.options_.languages,this.languages_)}toJSON(){const e=hi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;ithis.addRemoteTextTrack(S,!1)),this.titleBar&&this.titleBar.update({title:_,description:u||a||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),l=>({kind:l.kind,label:l.label,language:l.language,src:l.src})),a={src:t,textTracks:i};return e&&(a.poster=e,a.artwork=[{src:a.poster,type:Bf(a.poster)}]),a}return hi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=vo(e),a=i["data-setup"];if(id(e,"vjs-fill")&&(i.fill=!0),id(e,"vjs-fluid")&&(i.fluid=!0),a!==null)try{Object.assign(i,JSON.parse(a||"{}"))}catch(l){Dn.error("data-setup",l)}if(Object.assign(t,i),e.hasChildNodes()){const l=e.childNodes;for(let u=0,h=l.length;utypeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};Mi.prototype.videoTracks=()=>{};Mi.prototype.audioTracks=()=>{};Mi.prototype.textTracks=()=>{};Mi.prototype.remoteTextTracks=()=>{};Mi.prototype.remoteTextTrackEls=()=>{};Cr.names.forEach(function(n){const e=Cr[n];Mi.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Mi.prototype.crossorigin=Mi.prototype.crossOrigin;Mi.players={};const Fc=de.navigator;Mi.prototype.options_={techOrder:vn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Fc&&(Fc.languages&&Fc.languages[0]||Fc.userLanguage||Fc.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};yS.forEach(function(n){Mi.prototype[`handleTech${qi(n)}_`]=function(){return this.trigger(n)}});nt.registerComponent("Player",Mi);const Pf="plugin",du="activePlugins_",iu={},Ff=n=>iu.hasOwnProperty(n),mf=n=>Ff(n)?iu[n]:void 0,bS=(n,e)=>{n[du]=n[du]||{},n[du][e]=!0},Uf=(n,e,t)=>{const i=(t?"before":"")+"pluginsetup";n.trigger(i,e),n.trigger(i+":"+e.name,e)},JM=function(n,e){const t=function(){Uf(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return bS(this,n),Uf(this,{name:n,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},a_=(n,e)=>(e.prototype.name=n,function(...t){Uf(this,{name:n,plugin:e,instance:null},!0);const i=new e(this,...t);return this[n]=()=>i,Uf(this,i.getEventHash()),i});class Vr{constructor(e){if(this.constructor===Vr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Oy(this),delete this.trigger,DT(this,this.constructor.defaultState),bS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ru(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[du][e]=!1,this.player=this.state=null,t[e]=a_(e,iu[e])}static isBasic(e){const t=typeof e=="string"?mf(e):e;return typeof t=="function"&&!Vr.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Ff(e))Dn.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Mi.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return iu[e]=t,e!==Pf&&(Vr.isBasic(t)?Mi.prototype[e]=JM(e,t):Mi.prototype[e]=a_(e,t)),t}static deregisterPlugin(e){if(e===Pf)throw new Error("Cannot de-register base plugin.");Ff(e)&&(delete iu[e],delete Mi.prototype[e])}static getPlugins(e=Object.keys(iu)){let t;return e.forEach(i=>{const a=mf(i);a&&(t=t||{},t[i]=a)}),t}static getPluginVersion(e){const t=mf(e);return t&&t.VERSION||""}}Vr.getPlugin=mf;Vr.BASE_PLUGIN_NAME=Pf;Vr.registerPlugin(Pf,Vr);Mi.prototype.usingPlugin=function(n){return!!this[du]&&this[du][n]===!0};Mi.prototype.hasPlugin=function(n){return!!Ff(n)};function ej(n,e){let t=!1;return function(...i){return t||Dn.warn(n),t=!0,e.apply(this,i)}}function Rs(n,e,t,i){return ej(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var tj={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const vS=n=>n.indexOf("#")===0?n.slice(1):n;function Fe(n,e,t){let i=Fe.getPlayer(n);if(i)return e&&Dn.warn(`Player "${n}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const a=typeof n=="string"?Co("#"+vS(n)):n;if(!ju(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");const u=("getRootNode"in a?a.getRootNode()instanceof de.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;(!a.ownerDocument.defaultView||!u.contains(a))&&Dn.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(a.parentNode&&a.parentNode.hasAttribute&&a.parentNode.hasAttribute("data-vjs-player")?a.parentNode:a).cloneNode(!0)),Eo("beforesetup").forEach(f=>{const g=f(a,hi(e));if(!ea(g)||Array.isArray(g)){Dn.error("please return an object in beforesetup hooks");return}e=hi(e,g)});const h=nt.getComponent("Player");return i=new h(a,e,t),Eo("setup").forEach(f=>f(i)),i}Fe.hooks_=ka;Fe.hooks=Eo;Fe.hook=L4;Fe.hookOnce=I4;Fe.removeHook=tT;if(de.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Mu()){let n=Co(".vjs-styles-defaults");if(!n){n=kT("vjs-styles-defaults");const e=Co("head");e&&e.insertBefore(n,e.firstChild),ET(n,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}Kg(1,Fe);Fe.VERSION=Hg;Fe.options=Mi.prototype.options_;Fe.getPlayers=()=>Mi.players;Fe.getPlayer=n=>{const e=Mi.players;let t;if(typeof n=="string"){const i=vS(n),a=e[i];if(a)return a;t=Co("#"+i)}else t=n;if(ju(t)){const{player:i,playerId:a}=t;if(i||e[a])return i||e[a]}};Fe.getAllPlayers=()=>Object.keys(Mi.players).map(n=>Mi.players[n]).filter(Boolean);Fe.players=Mi.players;Fe.getComponent=nt.getComponent;Fe.registerComponent=(n,e)=>(vn.isTech(e)&&Dn.warn(`The ${n} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),nt.registerComponent.call(nt,n,e));Fe.getTech=vn.getTech;Fe.registerTech=vn.registerTech;Fe.use=uM;Object.defineProperty(Fe,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Fe.middleware,"TERMINATOR",{value:If,writeable:!1,enumerable:!0});Fe.browser=cT;Fe.obj=F4;Fe.mergeOptions=Rs(9,"videojs.mergeOptions","videojs.obj.merge",hi);Fe.defineLazyProperty=Rs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",l0);Fe.bind=Rs(9,"videojs.bind","native Function.prototype.bind",Si);Fe.registerPlugin=Vr.registerPlugin;Fe.deregisterPlugin=Vr.deregisterPlugin;Fe.plugin=(n,e)=>(Dn.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Vr.registerPlugin(n,e));Fe.getPlugins=Vr.getPlugins;Fe.getPlugin=Vr.getPlugin;Fe.getPluginVersion=Vr.getPluginVersion;Fe.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Fe.options.languages=hi(Fe.options.languages,{[n]:e}),Fe.options.languages[n]};Fe.log=Dn;Fe.createLogger=nT;Fe.time=eM;Fe.createTimeRange=Rs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ms);Fe.createTimeRanges=Rs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ms);Fe.formatTime=Rs(9,"videojs.formatTime","videojs.time.formatTime",bl);Fe.setFormatTime=Rs(9,"videojs.setFormatTime","videojs.time.setFormatTime",RT);Fe.resetFormatTime=Rs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",OT);Fe.parseUrl=Rs(9,"videojs.parseUrl","videojs.url.parseUrl",Py);Fe.isCrossOrigin=Rs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",x0);Fe.EventTarget=as;Fe.any=Ry;Fe.on=ss;Fe.one=b0;Fe.off=_r;Fe.trigger=Ru;Fe.xhr=Uw;Fe.TrackList=vl;Fe.TextTrack=Td;Fe.TextTrackList=Iy;Fe.AudioTrack=FT;Fe.AudioTrackList=IT;Fe.VideoTrack=UT;Fe.VideoTrackList=BT;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(n=>{Fe[n]=function(){return Dn.warn(`videojs.${n}() is deprecated; use videojs.dom.${n}() instead`),TT[n].apply(null,arguments)}});Fe.computedStyle=Rs(9,"videojs.computedStyle","videojs.dom.computedStyle",Au);Fe.dom=TT;Fe.fn=W4;Fe.num=DM;Fe.str=Z4;Fe.url=oM;Fe.Error=tj;class nj{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class zf extends Fe.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new nj(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,a=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;ti,n.qualityLevels.VERSION=xS,i},_S=function(n){return ij(this,Fe.obj.merge({},n))};Fe.registerPlugin("qualityLevels",_S);_S.VERSION=xS;const zr=r0,$f=(n,e)=>e&&e.responseURL&&n!==e.responseURL?e.responseURL:n,xs=n=>Fe.log.debug?Fe.log.debug.bind(Fe,"VHS:",`${n} >`):function(){};function ri(...n){const e=Fe.obj||Fe;return(e.merge||e.mergeOptions).apply(e,n)}function cr(...n){const e=Fe.time||Fe;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function rj(n){if(n.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges: `;for(let t=0;t ${a}. Duration (${a-i}) `}return e}const Ys=1/30,Qs=Ys*3,wS=function(n,e){const t=[];let i;if(n&&n.length)for(i=0;i=e})},Zh=function(n,e){return wS(n,function(t){return t-Ys>=e})},sj=function(n){if(n.length<2)return cr();const e=[];for(let t=1;t{const e=[];if(!n||!n.length)return"";for(let t=0;t "+n.end(t));return e.join(", ")},oj=function(n,e,t=1){return((n.length?n.end(n.length-1):0)-e)/t},ul=n=>{const e=[];for(let t=0;tl)){if(e>a&&e<=l){t+=l-e;continue}t+=l-a}}return t},nb=(n,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=n.partTargetDuration)}),t},ty=n=>(n.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(a,l){e.push({duration:a.duration,segmentIndex:i,partIndex:l,part:a,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),SS=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},kS=({preloadSegment:n})=>{if(!n)return;const{parts:e,preloadHints:t}=n;let i=(t||[]).reduce((a,l)=>a+(l.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},ES=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=SS(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},uj=function(n,e){let t=0,i=e-n.mediaSequence,a=n.segments[i];if(a){if(typeof a.start<"u")return{result:a.start,precise:!0};if(typeof a.end<"u")return{result:a.end-a.duration,precise:!0}}for(;i--;){if(a=n.segments[i],typeof a.end<"u")return{result:t+a.end,precise:!0};if(t+=nb(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},cj=function(n,e){let t=0,i,a=e-n.mediaSequence;for(;a"u"&&(e=n.mediaSequence+n.segments.length),e"u"){if(n.totalDuration)return n.totalDuration;if(!n.endList)return de.Infinity}return CS(n,e,t)},ad=function({defaultDuration:n,durationList:e,startIndex:t,endIndex:i}){let a=0;if(t>i&&([t,i]=[i,t]),t<0){for(let l=t;l0)for(let g=f-1;g>=0;g--){const _=h[g];if(u+=_.duration,l){if(u<0)continue}else if(u+Ys<=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a-ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e}}if(f<0){for(let g=f;g<0;g++)if(u-=n.targetDuration,u<0)return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e};f=0}for(let g=f;gYs,C=u===0,N=S&&u+Ys>=0;if(!((C||N)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-Ys>=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a+ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:e}},DS=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},ib=function(n){return n.excludeUntil&&n.excludeUntil===1/0},S0=function(n){const e=DS(n);return!n.disabled&&!e},fj=function(n){return n.disabled},mj=function(n){for(let e=0;e{if(n.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(i=>S0(i)?(i.attributes.BANDWIDTH||0)!n&&!e||!n&&e||n&&!e?!1:!!(n===e||n.id&&e.id&&n.id===e.id||n.resolvedUri&&e.resolvedUri&&n.resolvedUri===e.resolvedUri||n.uri&&e.uri&&n.uri===e.uri),o_=function(n,e){const t=n&&n.mediaGroups&&n.mediaGroups.AUDIO||{};let i=!1;for(const a in t){for(const l in t[a])if(i=e(t[a][l]),i)break;if(i)break}return!!i},Cd=n=>{if(!n||!n.playlists||!n.playlists.length)return o_(n,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;eHw(l))||o_(n,l=>rb(t,l))))return!1}return!0};var Hr={liveEdgeDelay:ES,duration:AS,seekable:dj,getMediaInfoForTime:hj,isEnabled:S0,isDisabled:fj,isExcluded:DS,isIncompatible:ib,playlistEnd:NS,isAes:mj,hasAttribute:MS,estimateSegmentRequestTime:pj,isLowestEnabledRendition:ny,isAudioOnly:Cd,playlistMatch:rb,segmentDurationWithParts:nb};const{log:jS}=Fe,hu=(n,e)=>`${n}-${e}`,RS=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,gj=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new iD;n&&u.on("warn",n),e&&u.on("info",e),i.forEach(g=>u.addParser(g)),a.forEach(g=>u.addTagMapper(g)),u.push(t),u.end();const h=u.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(g){h.hasOwnProperty(g)&&delete h[g]}),h.segments&&h.segments.forEach(function(g){["parts","preloadHints"].forEach(function(_){g.hasOwnProperty(_)&&delete g[_]})})),!h.targetDuration){let g=10;h.segments&&h.segments.length&&(g=h.segments.reduce((_,S)=>Math.max(_,S.duration),0)),n&&n({message:`manifest has no targetDuration defaulting to ${g}`}),h.targetDuration=g}const f=SS(h);if(f.length&&!h.partTargetDuration){const g=f.reduce((_,S)=>Math.max(_,S.duration),0);n&&(n({message:`manifest has no partTargetDuration defaulting to ${g}`}),jS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),h.partTargetDuration=g}return h},Bu=(n,e)=>{n.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(n.mediaGroups[t])for(const i in n.mediaGroups[t])for(const a in n.mediaGroups[t][i]){const l=n.mediaGroups[t][i][a];e(l,t,i,a)}})},OS=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},yj=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];OS({playlist:t,id:hu(e,t.uri)}),t.resolvedUri=zr(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||jS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},bj=n=>{Bu(n,e=>{e.uri&&(e.resolvedUri=zr(n.uri,e.uri))})},vj=(n,e)=>{const t=hu(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:de.location.href,resolvedUri:de.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},LS=(n,e,t=RS)=>{n.uri=e;for(let a=0;a{if(!a.playlists||!a.playlists.length){if(i&&l==="AUDIO"&&!a.uri)for(let f=0;f(a.set(l.id,l),a),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,a)=>{if(!this.processedDateRanges_.has(a)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const l=e[i.class].push(i);i.classListIndex=l-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const a=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&a[i.classListIndex+1]?i.endTime=a[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,a)=>{i.startDate.getTime(){const a=e.status<200||e.status>299,l=e.status>=400&&e.status<=499,u={uri:e.uri,requestType:n},h=a&&!l||i;if(t&&l)u.error=Xi({},t),u.errorType=Fe.Error.NetworkRequestFailed;else if(e.aborted)u.errorType=Fe.Error.NetworkRequestAborted;else if(e.timedout)u.errorType=Fe.Error.NetworkRequestTimeout;else if(h){const f=i?Fe.Error.NetworkBodyParserFailed:Fe.Error.NetworkBadStatus;u.errorType=f,u.status=e.status,u.headers=e.headers}return u},xj=xs("CodecUtils"),BS=function(n){const e=n.attributes||{};if(e.CODECS)return Ks(e.CODECS)},PS=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},_j=(n,e)=>{if(!PS(n,e))return!0;const t=e.attributes||{},i=n.mediaGroups.AUDIO[t.AUDIO];for(const a in i)if(!i[a].uri&&!i[a].playlists)return!0;return!1},yd=function(n){const e={};return n.forEach(({mediaType:t,type:i,details:a})=>{e[t]=e[t]||[],e[t].push($w(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){xj(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},u_=function(n){let e=0;return n.audio&&e++,n.video&&e++,e},od=function(n,e){const t=e.attributes||{},i=yd(BS(e)||[]);if(PS(n,e)&&!i.audio&&!_j(n,e)){const a=yd(sD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:wj}=Fe,Tj=(n,e)=>{if(e.endList||!e.serverControl)return n;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let a=e.mediaSequence+e.segments.length;if(i){const l=i.parts||[],u=kS(e)-1;u>-1&&u!==l.length-1&&(t._HLS_part=u),(u>-1||l.length)&&a--}t._HLS_msn=a}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new de.URL(n);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(a){t.hasOwnProperty(a)&&i.searchParams.set(a,t[a])}),n=i.toString()}return n},Sj=(n,e)=>{if(!n)return e;const t=ri(n,e);if(n.preloadHints&&!e.preloadHints&&delete t.preloadHints,n.parts&&!e.parts)delete t.parts;else if(n.parts&&e.parts)for(let i=0;i{const i=n.slice(),a=e.slice();t=t||0;const l=[];let u;for(let h=0;h{!n.resolvedUri&&n.uri&&(n.resolvedUri=zr(e,n.uri)),n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=zr(e,n.key.uri)),n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=zr(e,n.map.uri)),n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=zr(e,n.map.key.uri)),n.parts&&n.parts.length&&n.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))}),n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))})},US=function(n){const e=n.segments||[],t=n.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;in===e||n.segments&&e.segments&&n.segments.length===e.segments.length&&n.endList===e.endList&&n.mediaSequence===e.mediaSequence&&n.preloadSegment===e.preloadSegment,iy=(n,e,t=zS)=>{const i=ri(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=US(e);const l=ri(a,e);if(l.preloadSegment&&!e.preloadSegment&&delete l.preloadSegment,a.segments){if(e.skip){e.segments=e.segments||[];for(let u=0;u{FS(u,l.resolvedUri)});for(let u=0;u{if(u.playlists)for(let _=0;_{const t=n.segments||[],i=t[t.length-1],a=i&&i.parts&&i.parts[i.parts.length-1],l=a&&a.duration||i&&i.duration;return e&&l?l*1e3:(n.partTargetDuration||n.targetDuration||10)*500},c_=(n,e,t)=>{if(!n)return;const i=[];return n.forEach(a=>{if(!a.attributes)return;const{BANDWIDTH:l,RESOLUTION:u,CODECS:h}=a.attributes;i.push({id:a.id,bandwidth:l,resolution:u,codecs:h})}),{type:e,isLive:t,renditions:i}};class su extends wj{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=xs("PlaylistLoader");const{withCredentials:a=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=a,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const l=t.options_;this.customTagParsers=l&&l.customTagParsers||[],this.customTagMappers=l&&l.customTagMappers||[],this.llhls=l&&l.llhls,this.dateRangesStorage_=new l_,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=zr(this.main.uri,e.uri);this.llhls&&(t=Tj(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,a)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:a,id:l}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[l],status:e.status,message:`HLS playlist request error at URL: ${a}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ml({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=gj({onwarn:({message:a})=>this.logger_(`m3u8-parser warn for ${e}: ${a}`),oninfo:({message:a})=>this.logger_(`m3u8-parser info for ${e}: ${a}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:Fe.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const a=i.attributes||{},{width:l,height:u}=a.RESOLUTION||{};if(l&&u)return!0;const h=BS(i)||[];return!!yd(h).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:a}){this.request=null,this.state="HAVE_METADATA";const l={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:l});const u=t||this.parseManifest_({url:i,manifestString:e});u.lastRequest=Date.now(),OS({playlist:u,uri:i,id:a});const h=iy(this.main,u);this.targetDuration=u.partTargetDuration||u.targetDuration,this.pendingMedia_=null,h?(this.main=h,this.media_=this.main.playlists[a]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ry(this.media(),!!h)),l.parsedPlaylist=c_(this.main.playlists,l.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:l}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),de.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new l_,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(de.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=de.setTimeout(this.media.bind(this,e,!1),h);return}const i=this.state,a=!this.media_||e.id!==this.media_.id,l=this.main.playlists[e.id];if(l&&l.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,a&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ry(e,!0)),!a)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const u={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:u}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(h,f)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=$f(e.resolvedUri,f),h)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:u}),this.haveMetadata({playlistString:f.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=de.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=de.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:ml({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=$f(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const a=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=c_(a.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(a)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,LS(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=US(i),i.segments.forEach(a=>{FS(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||de.location.href;this.main=vj(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,a=e.ID;let l=i.playlists.length;for(;l--;){const u=i.playlists[l];if(u.attributes["PATHWAY-ID"]===a){const h=u.resolvedUri,f=u.id;if(t){const g=this.createCloneURI_(u.resolvedUri,e),_=hu(a,g),S=this.createCloneAttributes_(a,u.attributes),C=this.createClonePlaylist_(u,_,e,S);i.playlists[l]=C,i.playlists[_]=C,i.playlists[g]=C}else i.playlists.splice(l,1);delete i.playlists[f],delete i.playlists[h]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,a=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!i.mediaGroups[l]||!i.mediaGroups[l][a])){for(const u in i.mediaGroups[l])if(u===a){for(const h in i.mediaGroups[l][u])i.mediaGroups[l][u][h].playlists.forEach((g,_)=>{const S=i.playlists[g.id],C=S.id,N=S.resolvedUri;delete i.playlists[C],delete i.playlists[N]});delete i.mediaGroups[l][u]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,a=i.playlists.length,l=this.createCloneURI_(t.resolvedUri,e),u=hu(e.ID,l),h=this.createCloneAttributes_(e.ID,t.attributes),f=this.createClonePlaylist_(t,u,e,h);i.playlists[a]=f,i.playlists[u]=f,i.playlists[l]=f,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],a=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!a.mediaGroups[l]||a.mediaGroups[l][t]))for(const u in a.mediaGroups[l]){if(u===i)a.mediaGroups[l][t]={};else continue;for(const h in a.mediaGroups[l][u]){const f=a.mediaGroups[l][u][h];a.mediaGroups[l][t][h]=Xi({},f);const g=a.mediaGroups[l][t][h],_=this.createCloneURI_(f.resolvedUri,e);g.resolvedUri=_,g.uri=_,g.playlists=[],f.playlists.forEach((S,C)=>{const N=a.playlists[S.id],O=RS(l,t,h),E=hu(t,O);if(N&&!a.playlists[E]){const B=this.createClonePlaylist_(N,E,e),H=B.resolvedUri;a.playlists[E]=B,a.playlists[H]=B}g.playlists[C]=this.createClonePlaylist_(S,E,e)})}}})}createClonePlaylist_(e,t,i,a){const l=this.createCloneURI_(e.resolvedUri,i),u={resolvedUri:l,uri:l,id:t};return e.segments&&(u.segments=[]),a&&(u.attributes=a),ri(e,u)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const a=t["URI-REPLACEMENT"].PARAMS;for(const l of Object.keys(a))i.searchParams.set(l,a[l]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(a=>{t[a]&&(i[a]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const a=e.contentProtection[i].attributes.keyId;t.add(a.toLowerCase())}return t}}const sy=function(n,e,t,i){const a=n.responseType==="arraybuffer"?n.response:n.responseText;!e&&a&&(n.responseTime=Date.now(),n.roundTripTime=n.responseTime-n.requestTime,n.bytesReceived=a.byteLength||a.length,n.bandwidth||(n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3))),t.headers&&(n.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(n.timedout=!0),!e&&!n.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(n&&(a||n.responseText)))),i(e,n)},Ej=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},Cj=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},$S=function(){const n=function e(t,i){t=ri({timeout:45e3},t);const a=e.beforeRequest||Fe.Vhs.xhr.beforeRequest,l=e._requestCallbackSet||Fe.Vhs.xhr._requestCallbackSet||new Set,u=e._responseCallbackSet||Fe.Vhs.xhr._responseCallbackSet;a&&typeof a=="function"&&(Fe.log.warn("beforeRequest is deprecated, use onRequest instead."),l.add(a));const h=Fe.Vhs.xhr.original===!0?Fe.xhr:Fe.Vhs.xhr,f=Ej(l,t);l.delete(a);const g=h(f||t,function(S,C){return Cj(u,g,S,C),sy(g,S,C,i)}),_=g.abort;return g.abort=function(){return g.aborted=!0,_.apply(g,arguments)},g.uri=t.uri,g.requestType=t.requestType,g.requestTime=Date.now(),g};return n.original=!0,n},Aj=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=de.BigInt(n.offset)+de.BigInt(n.length)-de.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},ay=function(n){const e={};return n.byterange&&(e.Range=Aj(n.byterange)),e},Nj=function(n,e){return n.start(e)+"-"+n.end(e)},Dj=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Mj=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},HS=function(n){const e={};return Object.keys(n).forEach(t=>{const i=n[t];Vw(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Hf=function(n){const e=n.byterange||{length:1/0,offset:0};return[e.length,e.offset,n.resolvedUri].join(",")},qS=function(n){return n.resolvedUri},VS=n=>{const e=Array.prototype.slice.call(n),t=16;let i="",a,l;for(let u=0;uVS(n),Rj=n=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,a=e.videoTimingInfo.transmuxedPresentationStart+t,l=n-a;return new Date(e.dateTimeObject.getTime()+l*1e3)},Ij=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,Bj=(n,e)=>{let t;try{t=new Date(n)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(th?null:(t>new Date(l)&&(i=a),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Hr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Pj=(n,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let l=0;lt){if(n>t+a.duration*GS)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Fj=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},Uj=n=>{if(!n.segments||n.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!n||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=Pj(e,n);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const a={mediaSeconds:e},l=Lj(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},KS=({programTime:n,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:a=!0,tech:l,callback:u})=>{if(!u)throw new Error("seekToProgramTime: callback must be provided");if(typeof n>"u"||!e||!i)return u({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!l.hasStarted_)return u({message:"player must be playing a live stream to start buffering"});if(!Uj(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=Bj(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=Fj(f.dateTimeObject,n);if(h.type==="estimate"){if(t===0)return u({message:`${n} is not buffered yet. Try again`});i(h.estimatedStart+g),l.one("seeked",()=>{KS({programTime:n,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:a,tech:l,callback:u})});return}const _=f.start+g,S=()=>u(null,l.currentTime());l.one("seeked",S),a&&l.pause(),i(_)},fg=(n,e)=>{if(n.readyState===4)return e()},$j=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,C,N,O){return C.abort(),u=!0,t(S,C,N,O)},f=function(S,C){if(u)return;if(S)return S.metadata=ml({requestType:i,request:C,error:S}),h(S,C,"",a);const N=C.responseText.substring(a&&a.byteLength||0,C.responseText.length);if(a=pD(a,Gw(N,!0)),l=l||Kc(a),a.length<10||l&&a.lengthh(S,C,"",a));const O=Ay(a);return O==="ts"&&a.length<188?fg(C,()=>h(S,C,"",a)):!O&&a.length<376?fg(C,()=>h(S,C,"",a)):h(null,C,O,a)},_=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:C,loaded:N}){return sy(S,null,{statusCode:S.status},f)})}},function(S,C){return sy(_,S,C,f)});return _},{EventTarget:Hj}=Fe,d_=function(n,e){if(!zS(n,e)||n.sidx&&e.sidx&&(n.sidx.offset!==e.sidx.offset||n.sidx.length!==e.sidx.length))return!1;if(!n.sidx&&e.sidx||n.sidx&&!e.sidx||n.segments&&!e.segments||!n.segments&&e.segments)return!1;if(!n.segments&&!e.segments)return!0;for(let t=0;t{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},Vj=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=f4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return LS(l,e,qj),l},Gj=(n,e)=>{Bu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},Kj=(n,e,t)=>{let i=!0,a=ri(n,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let l=0;l{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,_=iy(a,l.playlists[0],d_);_&&(a=_,f in a.mediaGroups[u][h]||(a.mediaGroups[u][h][f]=l),a.mediaGroups[u][h][f].playlists[0]=a.playlists[g],i=!1)}}),Gj(a,e),e.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(i=!1),i?null:a},Wj=(n,e)=>(!n.map&&!e.map||!!(n.map&&e.map&&n.map.byterange.offset===e.map.byterange.offset&&n.map.byterange.length===e.map.byterange.length))&&n.uri===e.uri&&n.byterange.offset===e.byterange.offset&&n.byterange.length===e.byterange.length,h_=(n,e)=>{const t={};for(const i in n){const l=n[i].sidx;if(l){const u=a0(l);if(!e[u])break;const h=e[u].sidxInfo;Wj(h,l)&&(t[u]=e[u])}}return t},Xj=(n,e)=>{let i=h_(n.playlists,e);return Bu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ri(i,h_(f,e))}}),i};class oy extends Hj{constructor(e,t,i={},a){super(),this.isPaused_=!0,this.mainPlaylistLoader_=a||this,a||(this.isMain_=!0);const{withCredentials:l=!1}=i;if(this.vhs_=t,this.withCredentials=l,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=xs("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const a=e.sidx&&a0(e.sidx);if(!e.sidx||!a||this.mainPlaylistLoader_.sidxMapping_[a]){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>i(!1),0);return}const l=$f(e.sidx.resolvedUri),u=(f,g)=>{if(this.requestErrored_(f,g,t))return;const _=this.mainPlaylistLoader_.sidxMapping_,{requestType:S}=g;let C;try{C=b4(an(g.response).subarray(8))}catch(N){N.metadata=ml({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(N,g,t);return}return _[a]={sidxInfo:e.sidx,sidx:C},ky(e,C,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=$j(l,this.vhs_.xhr,(f,g,_,S)=>{if(f)return u(f,g);if(!_||_!=="mp4"){const O=_||"unknown";return u({status:g.status,message:`Unsupported ${O} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:C,length:N}=e.sidx.byterange;if(S.length>=N+C)return u(f,{response:S.subarray(C,C+N),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:ay({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},de.clearTimeout(this.minimumUpdatePeriodTimeout_),de.clearTimeout(this.mediaRequest_),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,a=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(de.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,de.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=de.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=de.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,a)=>{if(i){const{requestType:u}=a;i.metadata=ml({requestType:u,request:a,error:i})}if(this.requestErrored_(i,a)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const l=a.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=a.responseText,a.responseHeaders&&a.responseHeaders.date?this.mainLoaded_=Date.parse(a.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=$f(this.mainPlaylistLoader_.srcUrl,a),l){this.handleMain_(),this.syncClientServerClock_(()=>e(a,l));return}return e(a,l)})}syncClientServerClock_(e){const t=m4(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:zr(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,a)=>{if(!this.request)return;if(i){const{requestType:u}=a;return this.error.metadata=ml({requestType:u,request:a,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let l;t.method==="HEAD"?!a.responseHeaders||!a.responseHeaders.date?l=this.mainLoaded_:l=Date.parse(a.responseHeaders.date):l=Date.parse(a.responseText),this.mainPlaylistLoader_.clientOffset_=l-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){de.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=Vj({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(l){this.error=l,this.error.metadata={errorType:Fe.Error.StreamingDashManifestParserError,error:l},this.trigger("error")}e&&(i=Kj(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const a=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(a&&a!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=a),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:l,endList:u}=i,h=[];i.playlists.forEach(g=>{h.push({id:g.id,bandwidth:g.attributes.BANDWIDTH,resolution:g.attributes.RESOLUTION,codecs:g.attributes.CODECS})});const f={duration:l,isLive:!u,renditions:h};t.parsedManifest=f,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(de.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=de.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=Xj(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const a=()=>{this.media().endList||(this.mediaUpdateTimeout=de.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},ry(this.media(),!!i)))};a()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const a=e.contentProtection[i].attributes["cenc:default_KID"];a&&t.add(a.replace(/-/g,"").toLowerCase())}return t}}}var lr={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Yj=n=>{const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0;t-1):!1},this.trigger=function(v){var w,x,T,A;if(w=m[v],!!w)if(arguments.length===2)for(T=w.length,x=0;x"u")){for(m in ne)ne.hasOwnProperty(m)&&(ne[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);me=new Uint8Array([105,115,111,109]),q=new Uint8Array([97,118,99,49]),ue=new Uint8Array([0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Q=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),te={video:P,audio:Q},xe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),L=new Uint8Array([0,0,0,0,0,0,0,0]),Te=new Uint8Array([0,0,0,0,0,0,0,0]),ye=Te,be=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),mt=Te,ge=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(m){var v=[],w=0,x,T,A;for(x=1;x>>1,m.samplingfrequencyindex<<7|m.channelcount<<3,6,1,2]))},_=function(){return h(ne.ftyp,me,ue,me,q)},X=function(m){return h(ne.hdlr,te[m])},S=function(m){return h(ne.mdat,m)},W=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,m.duration>>>24&255,m.duration>>>16&255,m.duration>>>8&255,m.duration&255,85,196,0,0]);return m.samplerate&&(v[12]=m.samplerate>>>24&255,v[13]=m.samplerate>>>16&255,v[14]=m.samplerate>>>8&255,v[15]=m.samplerate&255),h(ne.mdhd,v)},re=function(m){return h(ne.mdia,W(m),X(m.type),N(m))},C=function(m){return h(ne.mfhd,new Uint8Array([0,0,0,0,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255]))},N=function(m){return h(ne.minf,m.type==="video"?h(ne.vmhd,ge):h(ne.smhd,L),f(),le(m))},O=function(m,v){for(var w=[],x=v.length;x--;)w[x]=j(v[x]);return h.apply(null,[ne.moof,C(m)].concat(w))},E=function(m){for(var v=m.length,w=[];v--;)w[v]=Y(m[v]);return h.apply(null,[ne.moov,H(4294967295)].concat(w).concat(B(m)))},B=function(m){for(var v=m.length,w=[];v--;)w[v]=Z(m[v]);return h.apply(null,[ne.mvex].concat(w))},H=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return h(ne.mvhd,v)},R=function(m){var v=m.samples||[],w=new Uint8Array(4+v.length),x,T;for(T=0;T>>8),A.push(x[J].byteLength&255),A=A.concat(Array.prototype.slice.call(x[J]));for(J=0;J>>8),K.push(T[J].byteLength&255),K=K.concat(Array.prototype.slice.call(T[J]));if(oe=[ne.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(w.width&65280)>>8,w.width&255,(w.height&65280)>>8,w.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h(ne.avcC,new Uint8Array([1,w.profileIdc,w.profileCompatibility,w.levelIdc,255].concat([x.length],A,[T.length],K))),h(ne.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],w.sarRatio){var fe=w.sarRatio[0],Ee=w.sarRatio[1];oe.push(h(ne.pasp,new Uint8Array([(fe&4278190080)>>24,(fe&16711680)>>16,(fe&65280)>>8,fe&255,(Ee&4278190080)>>24,(Ee&16711680)>>16,(Ee&65280)>>8,Ee&255])))}return h.apply(null,oe)},v=function(w){return h(ne.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(w.channelcount&65280)>>8,w.channelcount&255,(w.samplesize&65280)>>8,w.samplesize&255,0,0,0,0,(w.samplerate&65280)>>8,w.samplerate&255,0,0]),g(w))}})(),U=function(m){var v=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,0,(m.duration&4278190080)>>24,(m.duration&16711680)>>16,(m.duration&65280)>>8,m.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(m.width&65280)>>8,m.width&255,0,0,(m.height&65280)>>8,m.height&255,0,0]);return h(ne.tkhd,v)},j=function(m){var v,w,x,T,A,K,J;return v=h(ne.tfhd,new Uint8Array([0,0,0,58,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),K=Math.floor(m.baseMediaDecodeTime/u),J=Math.floor(m.baseMediaDecodeTime%u),w=h(ne.tfdt,new Uint8Array([1,0,0,0,K>>>24&255,K>>>16&255,K>>>8&255,K&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255])),A=92,m.type==="audio"?(x=V(m,A),h(ne.traf,v,w,x)):(T=R(m),x=V(m,T.length+A),h(ne.traf,v,w,x,T))},Y=function(m){return m.duration=m.duration||4294967295,h(ne.trak,U(m),re(m))},Z=function(m){var v=new Uint8Array([0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return m.type!=="video"&&(v[v.length-1]=0),h(ne.trex,v)},(function(){var m,v,w;w=function(x,T){var A=0,K=0,J=0,oe=0;return x.length&&(x[0].duration!==void 0&&(A=1),x[0].size!==void 0&&(K=2),x[0].flags!==void 0&&(J=4),x[0].compositionTimeOffset!==void 0&&(oe=8)),[0,0,A|K|J|oe,1,(x.length&4278190080)>>>24,(x.length&16711680)>>>16,(x.length&65280)>>>8,x.length&255,(T&4278190080)>>>24,(T&16711680)>>>16,(T&65280)>>>8,T&255]},v=function(x,T){var A,K,J,oe,fe,Ee;for(oe=x.samples||[],T+=20+16*oe.length,J=w(oe,T),K=new Uint8Array(J.length+oe.length*16),K.set(J),A=J.length,Ee=0;Ee>>24,K[A++]=(fe.duration&16711680)>>>16,K[A++]=(fe.duration&65280)>>>8,K[A++]=fe.duration&255,K[A++]=(fe.size&4278190080)>>>24,K[A++]=(fe.size&16711680)>>>16,K[A++]=(fe.size&65280)>>>8,K[A++]=fe.size&255,K[A++]=fe.flags.isLeading<<2|fe.flags.dependsOn,K[A++]=fe.flags.isDependedOn<<6|fe.flags.hasRedundancy<<4|fe.flags.paddingValue<<1|fe.flags.isNonSyncSample,K[A++]=fe.flags.degradationPriority&61440,K[A++]=fe.flags.degradationPriority&15,K[A++]=(fe.compositionTimeOffset&4278190080)>>>24,K[A++]=(fe.compositionTimeOffset&16711680)>>>16,K[A++]=(fe.compositionTimeOffset&65280)>>>8,K[A++]=fe.compositionTimeOffset&255;return h(ne.trun,K)},m=function(x,T){var A,K,J,oe,fe,Ee;for(oe=x.samples||[],T+=20+8*oe.length,J=w(oe,T),A=new Uint8Array(J.length+oe.length*8),A.set(J),K=J.length,Ee=0;Ee>>24,A[K++]=(fe.duration&16711680)>>>16,A[K++]=(fe.duration&65280)>>>8,A[K++]=fe.duration&255,A[K++]=(fe.size&4278190080)>>>24,A[K++]=(fe.size&16711680)>>>16,A[K++]=(fe.size&65280)>>>8,A[K++]=fe.size&255;return h(ne.trun,A)},V=function(x,T){return x.type==="audio"?m(x,T):v(x,T)}})();var Ke={ftyp:_,mdat:S,moof:O,moov:E,initSegment:function(m){var v=_(),w=E(m),x;return x=new Uint8Array(v.byteLength+w.byteLength),x.set(v),x.set(w,v.byteLength),x}},we=function(m){var v,w,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v1&&(v=m.shift(),m.byteLength-=v.byteLength,m.nalCount-=v.nalCount,m[0][0].dts=v.dts,m[0][0].pts=v.pts,m[0][0].duration+=v.duration),m},Oe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},je=function(m,v){var w=Oe();return w.dataOffset=v,w.compositionTimeOffset=m.pts-m.dts,w.duration=m.duration,w.size=4*m.length,w.size+=m.byteLength,m.keyFrame&&(w.flags.dependsOn=2,w.flags.isNonSyncSample=0),w},Ue=function(m,v){var w,x,T,A,K,J=v||0,oe=[];for(w=0;wqt.ONE_SECOND_IN_TS/2))){for(fe=Zt()[m.samplerate],fe||(fe=v[0].data),Ee=0;Ee=w?m:(v.minSegmentDts=1/0,m.filter(function(x){return x.dts>=w?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},Yt=function(m){var v,w,x=[];for(v=0;v=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(m),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},zt.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},zt.prototype.addText=function(m){this.rows[this.rowIdx]+=m},zt.prototype.backspace=function(){if(!this.isEmpty()){var m=this.rows[this.rowIdx];this.rows[this.rowIdx]=m.substr(0,m.length-1)}};var Dt=function(m,v,w){this.serviceNum=m,this.text="",this.currentWindow=new zt(-1),this.windows=[],this.stream=w,typeof v=="string"&&this.createTextDecoder(v)};Dt.prototype.init=function(m,v){this.startPts=m;for(var w=0;w<8;w++)this.windows[w]=new zt(w),typeof v=="function"&&(this.windows[w].beforeRowOverflow=v)},Dt.prototype.setCurrentWindow=function(m){this.currentWindow=this.windows[m]},Dt.prototype.createTextDecoder=function(m){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(m)}catch(v){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+m+" encoding. "+v})}};var Ot=function(m){m=m||{},Ot.prototype.init.call(this);var v=this,w=m.captionServices||{},x={},T;Object.keys(w).forEach(A=>{T=w[A],/^SERVICE/.test(A)&&(x[A]=T.encoding)}),this.serviceEncodings=x,this.current708Packet=null,this.services={},this.push=function(A){A.type===3?(v.new708Packet(),v.add708Bytes(A)):(v.current708Packet===null&&v.new708Packet(),v.add708Bytes(A))}};Ot.prototype=new _n,Ot.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ot.prototype.add708Bytes=function(m){var v=m.ccData,w=v>>>8,x=v&255;this.current708Packet.ptsVals.push(m.pts),this.current708Packet.data.push(w),this.current708Packet.data.push(x)},Ot.prototype.push708Packet=function(){var m=this.current708Packet,v=m.data,w=null,x=null,T=0,A=v[T++];for(m.seq=A>>6,m.sizeCode=A&63;T>5,x=A&31,w===7&&x>0&&(A=v[T++],w=A),this.pushServiceBlock(w,T,x),x>0&&(T+=x-1)},Ot.prototype.pushServiceBlock=function(m,v,w){var x,T=v,A=this.current708Packet.data,K=this.services[m];for(K||(K=this.initService(m,T));T("0"+(It&255).toString(16)).slice(-2)).join("")}if(T?(Xe=[J,oe],m++):Xe=[J],v.textDecoder_&&!x)Ee=v.textDecoder_.decode(new Uint8Array(Xe));else if(T){const it=Et(Xe);Ee=String.fromCharCode(parseInt(it,16))}else Ee=cn(K|J);return fe.pendingNewLine&&!fe.isEmpty()&&fe.newLine(this.getPts(m)),fe.pendingNewLine=!1,fe.addText(Ee),m},Ot.prototype.multiByteCharacter=function(m,v){var w=this.current708Packet.data,x=w[m+1],T=w[m+2];return en(x)&&en(T)&&(m=this.handleText(++m,v,{isMultiByte:!0})),m},Ot.prototype.setCurrentWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;return v.setCurrentWindow(T),m},Ot.prototype.defineWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;v.setCurrentWindow(T);var A=v.currentWindow;return x=w[++m],A.visible=(x&32)>>5,A.rowLock=(x&16)>>4,A.columnLock=(x&8)>>3,A.priority=x&7,x=w[++m],A.relativePositioning=(x&128)>>7,A.anchorVertical=x&127,x=w[++m],A.anchorHorizontal=x,x=w[++m],A.anchorPoint=(x&240)>>4,A.rowCount=x&15,x=w[++m],A.columnCount=x&63,x=w[++m],A.windowStyle=(x&56)>>3,A.penStyle=x&7,A.virtualRowCount=A.rowCount+1,m},Ot.prototype.setWindowAttributes=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.winAttr;return x=w[++m],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=w[++m],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=w[++m],T.borderType+=(x&128)>>5,T.wordWrap=(x&64)>>6,T.printDirection=(x&48)>>4,T.scrollDirection=(x&12)>>2,T.justify=x&3,x=w[++m],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,m},Ot.prototype.flushDisplayed=function(m,v){for(var w=[],x=0;x<8;x++)v.windows[x].visible&&!v.windows[x].isEmpty()&&w.push(v.windows[x].getText());v.endPts=m,v.text=w.join(` `),this.pushCaption(v),v.startPts=m},Ot.prototype.pushCaption=function(m){m.text!==""&&(this.trigger("data",{startPts:m.startPts,endPts:m.endPts,text:m.text,stream:"cc708_"+m.serviceNum}),m.text="",m.startPts=m.endPts)},Ot.prototype.displayWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<>4,T.offset=(x&12)>>2,T.penSize=x&3,x=w[++m],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,m},Ot.prototype.setPenColor=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penColor;return x=w[++m],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=w[++m],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=w[++m],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,m},Ot.prototype.setPenLocation=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=w[++m],T.row=x&15,x=w[++m],T.column=x&63,m},Ot.prototype.reset=function(m,v){var w=this.getPts(m);return this.flushDisplayed(w,v),this.initService(v.serviceNum,m)};var Hn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Rt=function(m){return m===null?"":(m=Hn[m]||m,String.fromCharCode(m))},qn=14,_i=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Mn=function(){for(var m=[],v=qn+1;v--;)m.push({text:"",indent:0,offset:0});return m},Wt=function(m,v){Wt.prototype.init.call(this),this.field_=m||0,this.dataChannel_=v||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(w){var x,T,A,K,J;if(x=w.ccData&32639,x===this.lastControlCode_){this.lastControlCode_=null;return}if((x&61440)===4096?this.lastControlCode_=x:x!==this.PADDING_&&(this.lastControlCode_=null),A=x>>>8,K=x&255,x!==this.PADDING_)if(x===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(x===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(w.pts),this.flushDisplayed(w.pts),T=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=T,this.startPts_=w.pts;else if(x===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(w.pts);else if(x===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(w.pts);else if(x===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(w.pts);else if(x===this.CARRIAGE_RETURN_)this.clearFormatting(w.pts),this.flushDisplayed(w.pts),this.shiftRowsUp_(),this.startPts_=w.pts;else if(x===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(x===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(w.pts),this.displayed_=Mn();else if(x===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Mn();else if(x===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(w.pts),this.displayed_=Mn()),this.mode_="paintOn",this.startPts_=w.pts;else if(this.isSpecialCharacter(A,K))A=(A&3)<<8,J=Rt(A|K),this[this.mode_](w.pts,J),this.column_++;else if(this.isExtCharacter(A,K))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),A=(A&3)<<8,J=Rt(A|K),this[this.mode_](w.pts,J),this.column_++;else if(this.isMidRowCode(A,K))this.clearFormatting(w.pts),this[this.mode_](w.pts," "),this.column_++,(K&14)===14&&this.addFormatting(w.pts,["i"]),(K&1)===1&&this.addFormatting(w.pts,["u"]);else if(this.isOffsetControlCode(A,K)){const fe=K&3;this.nonDisplayed_[this.row_].offset=fe,this.column_+=fe}else if(this.isPAC(A,K)){var oe=_i.indexOf(x&7968);if(this.mode_==="rollUp"&&(oe-this.rollUpRows_+1<0&&(oe=this.rollUpRows_-1),this.setRollUp(w.pts,oe)),oe!==this.row_&&oe>=0&&oe<=14&&(this.clearFormatting(w.pts),this.row_=oe),K&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(w.pts,["u"]),(x&16)===16){const fe=(x&14)>>1;this.column_=fe*4,this.nonDisplayed_[this.row_].indent+=fe}this.isColorPAC(K)&&(K&14)===14&&this.addFormatting(w.pts,["i"])}else this.isNormalChar(A)&&(K===0&&(K=null),J=Rt(A),J+=Rt(K),this[this.mode_](w.pts,J),this.column_+=J.length)}};Wt.prototype=new _n,Wt.prototype.flushDisplayed=function(m){const v=x=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+x+"."})},w=[];this.displayed_.forEach((x,T)=>{if(x&&x.text&&x.text.length){try{x.text=x.text.trim()}catch{v(T)}x.text.length&&w.push({text:x.text,line:T+1,position:10+Math.min(70,x.indent*10)+x.offset*2.5})}else x==null&&v(T)}),w.length&&this.trigger("data",{startPts:this.startPts_,endPts:m,content:w,stream:this.name_})},Wt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Mn(),this.nonDisplayed_=Mn(),this.lastControlCode_=null,this.column_=0,this.row_=qn,this.rollUpRows_=2,this.formatting_=[]},Wt.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Wt.prototype.isSpecialCharacter=function(m,v){return m===this.EXT_&&v>=48&&v<=63},Wt.prototype.isExtCharacter=function(m,v){return(m===this.EXT_+1||m===this.EXT_+2)&&v>=32&&v<=63},Wt.prototype.isMidRowCode=function(m,v){return m===this.EXT_&&v>=32&&v<=47},Wt.prototype.isOffsetControlCode=function(m,v){return m===this.OFFSET_&&v>=33&&v<=35},Wt.prototype.isPAC=function(m,v){return m>=this.BASE_&&m=64&&v<=127},Wt.prototype.isColorPAC=function(m){return m>=64&&m<=79||m>=96&&m<=127},Wt.prototype.isNormalChar=function(m){return m>=32&&m<=127},Wt.prototype.setRollUp=function(m,v){if(this.mode_!=="rollUp"&&(this.row_=qn,this.mode_="rollUp",this.flushDisplayed(m),this.nonDisplayed_=Mn(),this.displayed_=Mn()),v!==void 0&&v!==this.row_)for(var w=0;w"},"");this[this.mode_](m,w)},Wt.prototype.clearFormatting=function(m){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(w,x){return w+""},"");this.formatting_=[],this[this.mode_](m,v)}},Wt.prototype.popOn=function(m,v){var w=this.nonDisplayed_[this.row_].text;w+=v,this.nonDisplayed_[this.row_].text=w},Wt.prototype.rollUp=function(m,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w},Wt.prototype.shiftRowsUp_=function(){var m;for(m=0;mv&&(w=-1);Math.abs(v-m)>Cn;)m+=w*Wn;return m},li=function(m){var v,w;li.prototype.init.call(this),this.type_=m||fi,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==fi&&x.type!==this.type_||(w===void 0&&(w=x.dts),x.dts=Xn(x.dts,w),x.pts=Xn(x.pts,w),v=x.dts,this.trigger("data",x))},this.flush=function(){w=v,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){w=void 0,v=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};li.prototype=new jn;var _e={TimestampRolloverStream:li,handleRollover:Xn},at=(m,v,w)=>{if(!m)return-1;for(var x=w;x";m.data[0]===Pt.Utf8&&(w=St(m.data,0,v),!(w<0)&&(m.mimeType=vt(m.data,v,w),v=w+1,m.pictureType=m.data[v],v++,x=St(m.data,0,v),!(x<0)&&(m.description=wn(m.data,v,x),v=x+1,m.mimeType===T?m.url=vt(m.data,v,m.data.length):m.pictureData=m.data.subarray(v,m.data.length))))},"T*":function(m){m.data[0]===Pt.Utf8&&(m.value=wn(m.data,1,m.data.length).replace(/\0*$/,""),m.values=m.value.split("\0"))},TXXX:function(m){var v;m.data[0]===Pt.Utf8&&(v=St(m.data,0,1),v!==-1&&(m.description=wn(m.data,1,v),m.value=wn(m.data,v+1,m.data.length).replace(/\0*$/,""),m.data=m.value))},"W*":function(m){m.url=vt(m.data,0,m.data.length).replace(/\0.*$/,"")},WXXX:function(m){var v;m.data[0]===Pt.Utf8&&(v=St(m.data,0,1),v!==-1&&(m.description=wn(m.data,1,v),m.url=vt(m.data,v+1,m.data.length).replace(/\0.*$/,"")))},PRIV:function(m){var v;for(v=0;v>>2;It*=4,It+=it[7]&3,Ee.timeStamp=It,J.pts===void 0&&J.dts===void 0&&(J.pts=Ee.timeStamp,J.dts=Ee.timeStamp),this.trigger("timestamp",Ee)}J.frames.push(Ee),oe+=10,oe+=fe}while(oe>>4>1&&(K+=T[K]+1),A.pid===0)A.type="pat",m(T.subarray(K),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",m(T.subarray(K),A),this.trigger("data",A);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,K,A]):this.processPes_(T,K,A)},this.processPes_=function(T,A,K){K.pid===this.programMapTable.video?K.streamType=$n.H264_STREAM_TYPE:K.pid===this.programMapTable.audio?K.streamType=$n.ADTS_STREAM_TYPE:K.streamType=this.programMapTable["timed-metadata"][K.pid],K.type="pes",K.data=T.subarray(A),this.trigger("data",K)}},Yn.prototype=new Vn,Yn.STREAM_TYPES={h264:27,adts:15},pi=function(){var m=this,v=!1,w={data:[],size:0},x={data:[],size:0},T={data:[],size:0},A,K=function(oe,fe){var Ee;const Xe=oe[0]<<16|oe[1]<<8|oe[2];fe.data=new Uint8Array,Xe===1&&(fe.packetLength=6+(oe[4]<<8|oe[5]),fe.dataAlignmentIndicator=(oe[6]&4)!==0,Ee=oe[7],Ee&192&&(fe.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,fe.pts*=4,fe.pts+=(oe[13]&6)>>>1,fe.dts=fe.pts,Ee&64&&(fe.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,fe.dts*=4,fe.dts+=(oe[18]&6)>>>1)),fe.data=oe.subarray(9+oe[8]))},J=function(oe,fe,Ee){var Xe=new Uint8Array(oe.size),Et={type:fe},it=0,It=0,mn=!1,Vi;if(!(!oe.data.length||oe.size<9)){for(Et.trackId=oe.data[0].pid,it=0;it>5,oe=((v[T+6]&3)+1)*1024,fe=oe*ii/Oi[(v[T+2]&60)>>>2],v.byteLength-T>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:Oi[(v[T+2]&60)>>>2],samplingfrequencyindex:(v[T+2]&60)>>>2,samplesize:16,data:v.subarray(T+7+K,T+A)}),w++,T+=A}typeof Ee=="number"&&(this.skipWarn_(Ee,T),Ee=null),v=v.subarray(T)}},this.flush=function(){w=0,this.trigger("done")},this.reset=function(){v=void 0,this.trigger("reset")},this.endTimeline=function(){v=void 0,this.trigger("endedtimeline")}},Pi.prototype=new An;var se=Pi,I;I=function(m){var v=m.byteLength,w=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=m.byteLength-v,A=new Uint8Array(4),K=Math.min(4,v);if(K===0)throw new Error("no bytes available");A.set(m.subarray(T,T+K)),w=new DataView(A.buffer).getUint32(0),x=K*8,v-=K},this.skipBits=function(T){var A;x>T?(w<<=T,x-=T):(T-=x,A=Math.floor(T/8),T-=A*8,v-=A,this.loadWord(),w<<=T,x-=T)},this.readBits=function(T){var A=Math.min(x,T),K=w>>>32-A;return x-=A,x>0?w<<=A:v>0&&this.loadWord(),A=T-A,A>0?K<>>T)!==0)return w<<=T,x-=T,T;return this.loadWord(),T+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var T=this.skipLeadingZeros();return this.readBits(T+1)-1},this.readExpGolomb=function(){var T=this.readUnsignedExpGolomb();return 1&T?1+T>>>1:-1*(T>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var ce=I,pe=t,Ce=ce,Ae,z,G;z=function(){var m=0,v,w;z.prototype.init.call(this),this.push=function(x){var T;w?(T=new Uint8Array(w.byteLength+x.data.byteLength),T.set(w),T.set(x.data,w.byteLength),w=T):w=x.data;for(var A=w.byteLength;m3&&this.trigger("data",w.subarray(m+3)),w=null,m=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},z.prototype=new pe,G={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ae=function(){var m=new z,v,w,x,T,A,K,J;Ae.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(w=oe.trackId,x=oe.pts,T=oe.dts,m.push(oe))},m.on("data",function(oe){var fe={trackId:w,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(fe.nalUnitTypeCode){case 5:fe.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:fe.nalUnitType="sei_rbsp",fe.escapedRBSP=A(oe.subarray(1));break;case 7:fe.nalUnitType="seq_parameter_set_rbsp",fe.escapedRBSP=A(oe.subarray(1)),fe.config=K(fe.escapedRBSP);break;case 8:fe.nalUnitType="pic_parameter_set_rbsp";break;case 9:fe.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",fe)}),m.on("done",function(){v.trigger("done")}),m.on("partialdone",function(){v.trigger("partialdone")}),m.on("reset",function(){v.trigger("reset")}),m.on("endedtimeline",function(){v.trigger("endedtimeline")}),this.flush=function(){m.flush()},this.partialFlush=function(){m.partialFlush()},this.reset=function(){m.reset()},this.endTimeline=function(){m.endTimeline()},J=function(oe,fe){var Ee=8,Xe=8,Et,it;for(Et=0;Et>4;return w=w>=0?w:0,T?w+20:w+10},Je=function(m,v){return m.length-v<10||m[v]!==73||m[v+1]!==68||m[v+2]!==51?v:(v+=Be(m,v),Je(m,v))},We=function(m){var v=Je(m,0);return m.length>=v+2&&(m[v]&255)===255&&(m[v+1]&240)===240&&(m[v+1]&22)===16},ut=function(m){return m[0]<<21|m[1]<<14|m[2]<<7|m[3]},Mt=function(m,v,w){var x,T="";for(x=v;x>5,x=m[v+4]<<3,T=m[v+3]&6144;return T|x|w},Qt=function(m,v){return m[v]===73&&m[v+1]===68&&m[v+2]===51?"timed-metadata":m[v]&!0&&(m[v+1]&240)===240?"audio":null},Gn=function(m){for(var v=0;v+5>>2]}return null},rr=function(m){var v,w,x,T;v=10,m[5]&64&&(v+=4,v+=ut(m.subarray(10,14)));do{if(w=ut(m.subarray(v+4,v+8)),w<1)return null;if(T=String.fromCharCode(m[v],m[v+1],m[v+2],m[v+3]),T==="PRIV"){x=m.subarray(v+10,v+w+10);for(var A=0;A>>2;return oe*=4,oe+=J[7]&3,oe}break}}v+=10,v+=w}while(v=3;){if(m[T]===73&&m[T+1]===68&&m[T+2]===51){if(m.length-T<10||(x=No.parseId3TagSize(m,T),T+x>m.length))break;K={type:"timed-metadata",data:m.subarray(T,T+x)},this.trigger("data",K),T+=x;continue}else if((m[T]&255)===255&&(m[T+1]&240)===240){if(m.length-T<7||(x=No.parseAdtsSize(m,T),T+x>m.length))break;J={type:"audio",data:m.subarray(T,T+x),pts:v,dts:v},this.trigger("data",J),T+=x;continue}T++}A=m.length-T,A>0?m=m.subarray(T):m=new Uint8Array},this.reset=function(){m=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){m=new Uint8Array,this.trigger("endedtimeline")}},os.prototype=new ja;var wi=os,Fi=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],_s=Fi,Do=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],k0=Do,Ra=t,Mo=Ke,jo=bt,_l=pn,Kr=ie,ws=ti,Ro=pt,Ad=se,E0=ee.H264Stream,C0=wi,A0=dr.isLikelyAacData,Pu=pt.ONE_SECOND_IN_TS,Nd=_s,Dd=k0,wl,Oa,Tl,ra,N0=function(m,v){v.stream=m,this.trigger("log",v)},Md=function(m,v){for(var w=Object.keys(v),x=0;x=-1e4&&Ee<=oe&&(!Xe||fe>Ee)&&(Xe=it,fe=Ee)));return Xe?Xe.gop:null},this.alignGopsAtStart_=function(J){var oe,fe,Ee,Xe,Et,it,It,mn;for(Et=J.byteLength,it=J.nalCount,It=J.duration,oe=fe=0;oeEe.pts){oe++;continue}fe++,Et-=Xe.byteLength,it-=Xe.nalCount,It-=Xe.duration}return fe===0?J:fe===J.length?null:(mn=J.slice(fe),mn.byteLength=Et,mn.duration=It,mn.nalCount=it,mn.pts=mn[0].pts,mn.dts=mn[0].dts,mn)},this.alignGopsAtEnd_=function(J){var oe,fe,Ee,Xe,Et,it;for(oe=T.length-1,fe=J.length-1,Et=null,it=!1;oe>=0&&fe>=0;){if(Ee=T[oe],Xe=J[fe],Ee.pts===Xe.pts){it=!0;break}if(Ee.pts>Xe.pts){oe--;continue}oe===T.length-1&&(Et=fe),fe--}if(!it&&Et===null)return null;var It;if(it?It=fe:It=Et,It===0)return J;var mn=J.slice(It),Vi=mn.reduce(function(Tr,zs){return Tr.byteLength+=zs.byteLength,Tr.duration+=zs.duration,Tr.nalCount+=zs.nalCount,Tr},{byteLength:0,duration:0,nalCount:0});return mn.byteLength=Vi.byteLength,mn.duration=Vi.duration,mn.nalCount=Vi.nalCount,mn.pts=mn[0].pts,mn.dts=mn[0].dts,mn},this.alignGopsWith=function(J){T=J}},wl.prototype=new Ra,ra=function(m,v){this.numberOfTracks=0,this.metadataStream=v,m=m||{},typeof m.remux<"u"?this.remuxTracks=!!m.remux:this.remuxTracks=!0,typeof m.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=m.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,ra.prototype.init.call(this),this.push=function(w){if(w.content||w.text)return this.pendingCaptions.push(w);if(w.frames)return this.pendingMetadata.push(w);this.pendingTracks.push(w.track),this.pendingBytes+=w.boxes.byteLength,w.track.type==="video"&&(this.videoTrack=w.track,this.pendingBoxes.push(w.boxes)),w.track.type==="audio"&&(this.audioTrack=w.track,this.pendingBoxes.unshift(w.boxes))}},ra.prototype=new Ra,ra.prototype.flush=function(m){var v=0,w={captions:[],captionStreams:{},metadata:[],info:{}},x,T,A,K=0,J;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(K=this.videoTrack.timelineStartInfo.pts,Dd.forEach(function(oe){w.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(K=this.audioTrack.timelineStartInfo.pts,Nd.forEach(function(oe){w.info[oe]=this.audioTrack[oe]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?w.type=this.pendingTracks[0].type:w.type="combined",this.emittedTracks+=this.pendingTracks.length,A=Mo.initSegment(this.pendingTracks),w.initSegment=new Uint8Array(A.byteLength),w.initSegment.set(A),w.data=new Uint8Array(this.pendingBytes),J=0;J=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},ra.prototype.setRemux=function(m){this.remuxTracks=m},Tl=function(m){var v=this,w=!0,x,T;Tl.prototype.init.call(this),m=m||{},this.baseMediaDecodeTime=m.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new ws.MetadataStream,A.aacStream=new C0,A.audioTimestampRolloverStream=new ws.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new ws.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Ad,A.coalesceStream=new ra(m,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(K){A.aacStream.setTimestamp(K.timeStamp)}),A.aacStream.on("data",function(K){K.type!=="timed-metadata"&&K.type!=="audio"||A.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:v.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Oa(T,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x}))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,A)},this.setupTsPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="ts",A.metadataStream=new ws.MetadataStream,A.packetStream=new ws.TransportPacketStream,A.parseStream=new ws.TransportParseStream,A.elementaryStream=new ws.ElementaryStream,A.timestampRolloverStream=new ws.TimestampRolloverStream,A.adtsStream=new Ad,A.h264Stream=new E0,A.captionStream=new ws.CaptionStream(m),A.coalesceStream=new ra(m,A.metadataStream),A.headOfPipeline=A.packetStream,A.packetStream.pipe(A.parseStream).pipe(A.elementaryStream).pipe(A.timestampRolloverStream),A.timestampRolloverStream.pipe(A.h264Stream),A.timestampRolloverStream.pipe(A.adtsStream),A.timestampRolloverStream.pipe(A.metadataStream).pipe(A.coalesceStream),A.h264Stream.pipe(A.captionStream).pipe(A.coalesceStream),A.elementaryStream.on("data",function(K){var J;if(K.type==="metadata"){for(J=K.tracks.length;J--;)!x&&K.tracks[J].type==="video"?(x=K.tracks[J],x.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime):!T&&K.tracks[J].type==="audio"&&(T=K.tracks[J],T.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime);x&&!A.videoSegmentStream&&(A.coalesceStream.numberOfTracks++,A.videoSegmentStream=new wl(x,m),A.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!m.keepOriginalTimestamps&&(T.timelineStartInfo=oe,A.audioSegmentStream.setEarliestDts(oe.dts-v.baseMediaDecodeTime))}),A.videoSegmentStream.on("processedGopsInfo",v.trigger.bind(v,"gopInfo")),A.videoSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"videoSegmentTimingInfo")),A.videoSegmentStream.on("baseMediaDecodeTime",function(oe){T&&A.audioSegmentStream.setVideoBaseMediaDecodeTime(oe)}),A.videoSegmentStream.on("timingInfo",v.trigger.bind(v,"videoTimingInfo")),A.h264Stream.pipe(A.videoSegmentStream).pipe(A.coalesceStream)),T&&!A.audioSegmentStream&&(A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Oa(T,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.audioSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"audioSegmentTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream)),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x})}}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("id3Frame",function(K){K.dispatchType=A.metadataStream.dispatchType,v.trigger("id3Frame",K)}),A.coalesceStream.on("caption",this.trigger.bind(this,"caption")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,A)},this.setBaseMediaDecodeTime=function(A){var K=this.transmuxPipeline_;m.keepOriginalTimestamps||(this.baseMediaDecodeTime=A),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Kr.clearDtsInfo(T),K.audioTimestampRolloverStream&&K.audioTimestampRolloverStream.discontinuity()),x&&(K.videoSegmentStream&&(K.videoSegmentStream.gopCache_=[]),x.timelineStartInfo.dts=void 0,x.timelineStartInfo.pts=void 0,Kr.clearDtsInfo(x),K.captionStream.reset()),K.timestampRolloverStream&&K.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(A){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(A)},this.setRemux=function(A){var K=this.transmuxPipeline_;m.remux=A,K&&K.coalesceStream&&K.coalesceStream.setRemux(A)},this.alignGopsWith=function(A){x&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(A)},this.getLogTrigger_=function(A){var K=this;return function(J){J.stream=A,K.trigger("log",J)}},this.push=function(A){if(w){var K=A0(A);K&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!K&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),w=!1}this.transmuxPipeline_.headOfPipeline.push(A)},this.flush=function(){w=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Tl.prototype=new Ra;var D0={Transmuxer:Tl},M0=function(m){return m>>>0},j0=function(m){return("00"+m.toString(16)).slice(-2)},La={toUnsigned:M0,toHexString:j0},Oo=function(m){var v="";return v+=String.fromCharCode(m[0]),v+=String.fromCharCode(m[1]),v+=String.fromCharCode(m[2]),v+=String.fromCharCode(m[3]),v},Od=Oo,Ld=La.toUnsigned,Id=Od,Fu=function(m,v){var w=[],x,T,A,K,J;if(!v.length)return null;for(x=0;x1?x+T:m.byteLength,A===v[0]&&(v.length===1?w.push(m.subarray(x+8,K)):(J=Fu(m.subarray(x+8,K),v.slice(1)),J.length&&(w=w.concat(J)))),x=K;return w},Sl=Fu,Bd=La.toUnsigned,Ia=l.getUint64,R0=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ia(m.subarray(4)):v.baseMediaDecodeTime=Bd(m[4]<<24|m[5]<<16|m[6]<<8|m[7]),v},Uu=R0,O0=function(m){var v=new DataView(m.buffer,m.byteOffset,m.byteLength),w={version:m[0],flags:new Uint8Array(m.subarray(1,4)),trackId:v.getUint32(4)},x=w.flags[2]&1,T=w.flags[2]&2,A=w.flags[2]&8,K=w.flags[2]&16,J=w.flags[2]&32,oe=w.flags[0]&65536,fe=w.flags[0]&131072,Ee;return Ee=8,x&&(Ee+=4,w.baseDataOffset=v.getUint32(12),Ee+=4),T&&(w.sampleDescriptionIndex=v.getUint32(Ee),Ee+=4),A&&(w.defaultSampleDuration=v.getUint32(Ee),Ee+=4),K&&(w.defaultSampleSize=v.getUint32(Ee),Ee+=4),J&&(w.defaultSampleFlags=v.getUint32(Ee)),oe&&(w.durationIsEmpty=!0),!x&&fe&&(w.baseDataOffsetIsMoof=!0),w},zu=O0,Pd=function(m){return{isLeading:(m[0]&12)>>>2,dependsOn:m[0]&3,isDependedOn:(m[1]&192)>>>6,hasRedundancy:(m[1]&48)>>>4,paddingValue:(m[1]&14)>>>1,isNonSyncSample:m[1]&1,degradationPriority:m[2]<<8|m[3]}},Lo=Pd,Ba=Lo,L0=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4)),samples:[]},w=new DataView(m.buffer,m.byteOffset,m.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,A=v.flags[1]&1,K=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,fe=w.getUint32(4),Ee=8,Xe;for(x&&(v.dataOffset=w.getInt32(Ee),Ee+=4),T&&fe&&(Xe={flags:Ba(m.subarray(Ee,Ee+4))},Ee+=4,A&&(Xe.duration=w.getUint32(Ee),Ee+=4),K&&(Xe.size=w.getUint32(Ee),Ee+=4),oe&&(v.version===1?Xe.compositionTimeOffset=w.getInt32(Ee):Xe.compositionTimeOffset=w.getUint32(Ee),Ee+=4),v.samples.push(Xe),fe--);fe--;)Xe={},A&&(Xe.duration=w.getUint32(Ee),Ee+=4),K&&(Xe.size=w.getUint32(Ee),Ee+=4),J&&(Xe.flags=Ba(m.subarray(Ee,Ee+4)),Ee+=4),oe&&(v.version===1?Xe.compositionTimeOffset=w.getInt32(Ee):Xe.compositionTimeOffset=w.getUint32(Ee),Ee+=4),v.samples.push(Xe);return v},Io=L0,$u={tfdt:Uu,trun:Io},Hu={parseTfdt:$u.tfdt,parseTrun:$u.trun},qu=function(m){for(var v=0,w=String.fromCharCode(m[v]),x="";w!=="\0";)x+=w,v++,w=String.fromCharCode(m[v]);return x+=w,x},Vu={uint8ToCString:qu},Bo=Vu.uint8ToCString,Fd=l.getUint64,Ud=function(m){var v=4,w=m[0],x,T,A,K,J,oe,fe,Ee;if(w===0){x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length;var Xe=new DataView(m.buffer);A=Xe.getUint32(v),v+=4,J=Xe.getUint32(v),v+=4,oe=Xe.getUint32(v),v+=4,fe=Xe.getUint32(v),v+=4}else if(w===1){var Xe=new DataView(m.buffer);A=Xe.getUint32(v),v+=4,K=Fd(m.subarray(v)),v+=8,oe=Xe.getUint32(v),v+=4,fe=Xe.getUint32(v),v+=4,x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length}Ee=new Uint8Array(m.subarray(v,m.byteLength));var Et={scheme_id_uri:x,value:T,timescale:A||1,presentation_time:K,presentation_time_delta:J,event_duration:oe,id:fe,message_data:Ee};return B0(w,Et)?Et:void 0},I0=function(m,v,w,x){return m||m===0?m/v:x+w/v},B0=function(m,v){var w=v.scheme_id_uri!=="\0",x=m===0&&zd(v.presentation_time_delta)&&w,T=m===1&&zd(v.presentation_time)&&w;return!(m>1)&&x||T},zd=function(m){return m!==void 0||m!==null},P0={parseEmsgBox:Ud,scaleTime:I0},Po;typeof window<"u"?Po=window:typeof n<"u"?Po=n:typeof self<"u"?Po=self:Po={};var yr=Po,Os=La.toUnsigned,Pa=La.toHexString,Ci=Sl,sa=Od,kl=P0,Gu=zu,F0=Io,Fa=Uu,Ku=l.getUint64,Ua,El,Wu,Ls,aa,Fo,Xu,Ts=yr,$d=_t.parseId3Frames;Ua=function(m){var v={},w=Ci(m,["moov","trak"]);return w.reduce(function(x,T){var A,K,J,oe,fe;return A=Ci(T,["tkhd"])[0],!A||(K=A[0],J=K===0?12:20,oe=Os(A[J]<<24|A[J+1]<<16|A[J+2]<<8|A[J+3]),fe=Ci(T,["mdia","mdhd"])[0],!fe)?null:(K=fe[0],J=K===0?12:20,x[oe]=Os(fe[J]<<24|fe[J+1]<<16|fe[J+2]<<8|fe[J+3]),x)},v)},El=function(m,v){var w;w=Ci(v,["moof","traf"]);var x=w.reduce(function(T,A){var K=Ci(A,["tfhd"])[0],J=Os(K[4]<<24|K[5]<<16|K[6]<<8|K[7]),oe=m[J]||9e4,fe=Ci(A,["tfdt"])[0],Ee=new DataView(fe.buffer,fe.byteOffset,fe.byteLength),Xe;fe[0]===1?Xe=Ku(fe.subarray(4,12)):Xe=Ee.getUint32(4);let Et;return typeof Xe=="bigint"?Et=Xe/Ts.BigInt(oe):typeof Xe=="number"&&!isNaN(Xe)&&(Et=Xe/oe),Et11?(T.codec+=".",T.codec+=Pa(it[9]),T.codec+=Pa(it[10]),T.codec+=Pa(it[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(it=Et.subarray(28),It=sa(it.subarray(4,8)),It==="esds"&&it.length>20&&it[19]!==0?(T.codec+="."+Pa(it[19]),T.codec+="."+Pa(it[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var mn=Ci(x,["mdia","mdhd"])[0];mn&&(T.timescale=Fo(mn)),w.push(T)}),w},Xu=function(m,v=0){var w=Ci(m,["emsg"]);return w.map(x=>{var T=kl.parseEmsgBox(new Uint8Array(x)),A=$d(T.message_data);return{cueTime:kl.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,v),duration:kl.scaleTime(T.event_duration,T.timescale),frames:A}})};var za={findBox:Ci,parseType:sa,timescale:Ua,startTime:El,compositionStartTime:Wu,videoTrackIds:Ls,tracks:aa,getTimescaleFromMediaHeader:Fo,getEmsgID3:Xu};const{parseTrun:Hd}=Hu,{findBox:qd}=za;var Vd=yr,U0=function(m){var v=qd(m,["moof","traf"]),w=qd(m,["mdat"]),x=[];return w.forEach(function(T,A){var K=v[A];x.push({mdat:T,traf:K})}),x},Gd=function(m,v,w){var x=v,T=w.defaultSampleDuration||0,A=w.defaultSampleSize||0,K=w.trackId,J=[];return m.forEach(function(oe){var fe=Hd(oe),Ee=fe.samples;Ee.forEach(function(Xe){Xe.duration===void 0&&(Xe.duration=T),Xe.size===void 0&&(Xe.size=A),Xe.trackId=K,Xe.dts=x,Xe.compositionTimeOffset===void 0&&(Xe.compositionTimeOffset=0),typeof x=="bigint"?(Xe.pts=x+Vd.BigInt(Xe.compositionTimeOffset),x+=Vd.BigInt(Xe.duration)):(Xe.pts=x+Xe.compositionTimeOffset,x+=Xe.duration)}),J=J.concat(Ee)}),J},Yu={getMdatTrafPairs:U0,parseSamples:Gd},Qu=ln.discardEmulationPreventionBytes,Wr=zn.CaptionStream,$a=Sl,Nr=Uu,Ha=zu,{getMdatTrafPairs:Zu,parseSamples:Cl}=Yu,Al=function(m,v){for(var w=m,x=0;x0?Nr(Ee[0]).baseMediaDecodeTime:0,Et=$a(K,["trun"]),it,It;v===fe&&Et.length>0&&(it=Cl(Et,Xe,oe),It=Ju(A,it,fe),w[fe]||(w[fe]={seiNals:[],logs:[]}),w[fe].seiNals=w[fe].seiNals.concat(It.seiNals),w[fe].logs=w[fe].logs.concat(It.logs))}),w},Kd=function(m,v,w){var x;if(v===null)return null;x=oa(m,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:w}},Nl=function(){var m=!1,v,w,x,T,A,K;this.isInitialized=function(){return m},this.init=function(J){v=new Wr,m=!0,K=J?J.isPartial:!1,v.on("data",function(oe){oe.startTime=oe.startPts/T,oe.endTime=oe.endPts/T,A.captions.push(oe),A.captionStreams[oe.stream]=!0}),v.on("log",function(oe){A.logs.push(oe)})},this.isNewInit=function(J,oe){return J&&J.length===0||oe&&typeof oe=="object"&&Object.keys(oe).length===0?!1:x!==J[0]||T!==oe[x]},this.parse=function(J,oe,fe){var Ee;if(this.isInitialized()){if(!oe||!fe)return null;if(this.isNewInit(oe,fe))x=oe[0],T=fe[x];else if(x===null||!T)return w.push(J),null}else return null;for(;w.length>0;){var Xe=w.shift();this.parse(Xe,oe,fe)}return Ee=Kd(J,x,T),Ee&&Ee.logs&&(A.logs=A.logs.concat(Ee.logs)),Ee===null||!Ee.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ee.seiNals),this.flushStream(),A)},this.pushNals=function(J){if(!this.isInitialized()||!J||J.length===0)return null;J.forEach(function(oe){v.push(oe)})},this.flushStream=function(){if(!this.isInitialized())return null;K?v.partialFlush():v.flush()},this.clearParsedCaptions=function(){A.captions=[],A.captionStreams={},A.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;v.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){w=[],x=null,T=null,A?this.clearParsedCaptions():A={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},qa=Nl;const{parseTfdt:z0}=Hu,Ui=Sl,{getTimescaleFromMediaHeader:ec}=za,{parseSamples:Ss,getMdatTrafPairs:Wd}=Yu;var Is=function(){let m=9e4;this.init=function(v){const w=Ui(v,["moov","trak","mdia","mdhd"])[0];w&&(m=ec(w))},this.parseSegment=function(v){const w=[],x=Wd(v);let T=0;return x.forEach(function(A){const K=A.mdat,J=A.traf,oe=Ui(J,["tfdt"])[0],fe=Ui(J,["tfhd"])[0],Ee=Ui(J,["trun"]);if(oe&&(T=z0(oe).baseMediaDecodeTime),Ee.length&&fe){const Xe=Ss(Ee,T,fe);let Et=0;Xe.forEach(function(it){const It="utf-8",mn=new TextDecoder(It),Vi=K.slice(Et,Et+it.size);if(Ui(Vi,["vtte"])[0]){Et+=it.size;return}Ui(Vi,["vttc"]).forEach(function(Ho){const Ti=Ui(Ho,["payl"])[0],la=Ui(Ho,["sttg"])[0],ks=it.pts/m,$s=(it.pts+it.duration)/m;let si,ls;if(Ti)try{si=mn.decode(Ti)}catch(sr){console.error(sr)}if(la)try{ls=mn.decode(la)}catch(sr){console.error(sr)}it.duration&&si&&w.push({cueText:si,start:ks,end:$s,settings:ls})}),Et+=it.size})}}),w}},Uo=Kn,nc=function(m){var v=m[1]&31;return v<<=8,v|=m[2],v},Va=function(m){return!!(m[1]&64)},zo=function(m){var v=0;return(m[3]&48)>>>4>1&&(v+=m[4]+1),v},Dr=function(m,v){var w=nc(m);return w===0?"pat":w===v?"pmt":v?"pes":null},Ga=function(m){var v=Va(m),w=4+zo(m);return v&&(w+=m[w]+1),(m[w+10]&31)<<8|m[w+11]},Ka=function(m){var v={},w=Va(m),x=4+zo(m);if(w&&(x+=m[x]+1),!!(m[x+5]&1)){var T,A,K;T=(m[x+1]&15)<<8|m[x+2],A=3+T-4,K=(m[x+10]&15)<<8|m[x+11];for(var J=12+K;J=m.byteLength)return null;var x=null,T;return T=m[w+7],T&192&&(x={},x.pts=(m[w+9]&14)<<27|(m[w+10]&255)<<20|(m[w+11]&254)<<12|(m[w+12]&255)<<5|(m[w+13]&254)>>>3,x.pts*=4,x.pts+=(m[w+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(m[w+14]&14)<<27|(m[w+15]&255)<<20|(m[w+16]&254)<<12|(m[w+17]&255)<<5|(m[w+18]&254)>>>3,x.dts*=4,x.dts+=(m[w+18]&6)>>>1)),x},br=function(m){switch(m){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Mr=function(m){for(var v=4+zo(m),w=m.subarray(v),x=0,T=0,A=!1,K;T3&&(K=br(w[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},Bs={parseType:Dr,parsePat:Ga,parsePmt:Ka,parsePayloadUnitStartIndicator:Va,parsePesType:Dl,parsePesTime:$o,videoPacketContainsKeyFrame:Mr},Xr=Kn,hr=_e.handleRollover,Nn={};Nn.ts=Bs,Nn.aac=dr;var Ps=pt.ONE_SECOND_IN_TS,tr=188,jr=71,Xd=function(m,v){for(var w=0,x=tr,T,A;x=0;){if(m[x]===jr&&(m[T]===jr||T===m.byteLength)){if(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K==="pes"&&(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="audio",w.audio.push(fe),Ee=!0))),Ee)break;x-=tr,T-=tr;continue}x--,T--}},yi=function(m,v,w){for(var x=0,T=tr,A,K,J,oe,fe,Ee,Xe,Et,it=!1,It={data:[],size:0};T=0;){if(m[x]===jr&&m[T]===jr){if(A=m.subarray(x,T),K=Nn.ts.parseType(A,v.pid),K==="pes"&&(J=Nn.ts.parsePesType(A,v.table),oe=Nn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&oe&&(fe=Nn.ts.parsePesTime(A),fe&&(fe.type="video",w.video.push(fe),it=!0))),it)break;x-=tr,T-=tr;continue}x--,T--}},Ln=function(m,v){if(m.audio&&m.audio.length){var w=v;(typeof w>"u"||isNaN(w))&&(w=m.audio[0].dts),m.audio.forEach(function(A){A.dts=hr(A.dts,w),A.pts=hr(A.pts,w),A.dtsTime=A.dts/Ps,A.ptsTime=A.pts/Ps})}if(m.video&&m.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=m.video[0].dts),m.video.forEach(function(A){A.dts=hr(A.dts,x),A.pts=hr(A.pts,x),A.dtsTime=A.dts/Ps,A.ptsTime=A.pts/Ps}),m.firstKeyFrame){var T=m.firstKeyFrame;T.dts=hr(T.dts,x),T.pts=hr(T.pts,x),T.dtsTime=T.dts/Ps,T.ptsTime=T.pts/Ps}}},Fs=function(m){for(var v=!1,w=0,x=null,T=null,A=0,K=0,J;m.length-K>=3;){var oe=Nn.aac.parseType(m,K);switch(oe){case"timed-metadata":if(m.length-K<10){v=!0;break}if(A=Nn.aac.parseId3TagSize(m,K),A>m.length){v=!0;break}T===null&&(J=m.subarray(K,K+A),T=Nn.aac.parseAacTimestamp(J)),K+=A;break;case"audio":if(m.length-K<7){v=!0;break}if(A=Nn.aac.parseAdtsSize(m,K),A>m.length){v=!0;break}x===null&&(J=m.subarray(K,K+A),x=Nn.aac.parseSampleRate(J)),w++,K+=A;break;default:K++;break}if(v)return null}if(x===null||T===null)return null;var fe=Ps/x,Ee={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+w*1024*fe,pts:T+w*1024*fe}]};return Ee},Rr=function(m){var v={pid:null,table:null},w={};Xd(m,v);for(var x in v.table)if(v.table.hasOwnProperty(x)){var T=v.table[x];switch(T){case Xr.H264_STREAM_TYPE:w.video=[],yi(m,v,w),w.video.length===0&&delete w.video;break;case Xr.ADTS_STREAM_TYPE:w.audio=[],Yi(m,v,w),w.audio.length===0&&delete w.audio;break}}return w},ic=function(m,v){var w=Nn.aac.isLikelyAacData(m),x;return w?x=Fs(m):x=Rr(m),!x||!x.audio&&!x.video?null:(Ln(x,v),x)},Us={inspect:ic,parseAudioPes_:Yi};const Yd=function(m,v){v.on("data",function(w){const x=w.initSegment;w.initSegment={data:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength};const T=w.data;w.data=T.buffer,m.postMessage({action:"data",segment:w,byteOffset:T.byteOffset,byteLength:T.byteLength},[w.data])}),v.on("done",function(w){m.postMessage({action:"done"})}),v.on("gopInfo",function(w){m.postMessage({action:"gopInfo",gopInfo:w})}),v.on("videoSegmentTimingInfo",function(w){const x={start:{decode:pt.videoTsToSeconds(w.start.dts),presentation:pt.videoTsToSeconds(w.start.pts)},end:{decode:pt.videoTsToSeconds(w.end.dts),presentation:pt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:pt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=pt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(w){const x={start:{decode:pt.videoTsToSeconds(w.start.dts),presentation:pt.videoTsToSeconds(w.start.pts)},end:{decode:pt.videoTsToSeconds(w.end.dts),presentation:pt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:pt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=pt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(w){m.postMessage({action:"id3Frame",id3Frame:w})}),v.on("caption",function(w){m.postMessage({action:"caption",caption:w})}),v.on("trackinfo",function(w){m.postMessage({action:"trackinfo",trackInfo:w})}),v.on("audioTimingInfo",function(w){m.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:pt.videoTsToSeconds(w.start),end:pt.videoTsToSeconds(w.end)}})}),v.on("videoTimingInfo",function(w){m.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:pt.videoTsToSeconds(w.start),end:pt.videoTsToSeconds(w.end)}})}),v.on("log",function(w){m.postMessage({action:"log",log:w})})};class rc{constructor(v,w){this.options=w||{},this.self=v,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new D0.Transmuxer(this.options),Yd(this.self,this.transmuxer)}pushMp4Captions(v){this.captionParser||(this.captionParser=new qa,this.captionParser.init());const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.captionParser.parse(w,v.trackIds,v.timescales);this.self.postMessage({action:"mp4Captions",captions:x&&x.captions||[],logs:x&&x.logs||[],data:w.buffer},[w.buffer])}initMp4WebVttParser(v){this.webVttParser||(this.webVttParser=new Is);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.webVttParser.init(w)}getMp4WebVttText(v){this.webVttParser||(this.webVttParser=new Is);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.webVttParser.parseSegment(w);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:x||[],data:w.buffer},[w.buffer])}probeMp4StartTime({timescales:v,data:w}){const x=za.startTime(v,w);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:w},[w.buffer])}probeMp4Tracks({data:v}){const w=za.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:w,data:v},[v.buffer])}probeEmsgID3({data:v,offset:w}){const x=za.getEmsgID3(v,w);this.self.postMessage({action:"probeEmsgID3",id3Frames:x,emsgData:v},[v.buffer])}probeTs({data:v,baseStartTime:w}){const x=typeof w=="number"&&!isNaN(w)?w*pt.ONE_SECOND_IN_TS:void 0,T=Us.inspect(v,x);let A=null;T&&(A={hasVideo:T.video&&T.video.length===2||!1,hasAudio:T.audio&&T.audio.length===2||!1},A.hasVideo&&(A.videoStart=T.video[0].ptsTime),A.hasAudio&&(A.audioStart=T.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:A,data:v},[v.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(v){const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.transmuxer.push(w)}reset(){this.transmuxer.reset()}setTimestampOffset(v){const w=v.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(pt.secondsToVideoTs(w)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(pt.secondsToVideoTs(v.appendStart)))}setRemux(v){this.transmuxer.setRemux(v.remux)}flush(v){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(v){this.transmuxer.alignGopsWith(v.gopsToAlignWith.slice())}}self.onmessage=function(m){if(m.data.action==="init"&&m.data.options){this.messageHandlers=new rc(self,m.data.options);return}this.messageHandlers||(this.messageHandlers=new rc(self)),m.data&&m.data.action&&m.data.action!=="init"&&this.messageHandlers[m.data.action]&&this.messageHandlers[m.data.action](m.data)}}));var Jj=XS(Zj);const eR=(n,e,t)=>{const{type:i,initSegment:a,captions:l,captionStreams:u,metadata:h,videoFrameDtsTime:f,videoFramePtsTime:g}=n.data.segment;e.buffer.push({captions:l,captionStreams:u,metadata:h});const _=n.data.segment.boxes||{data:n.data.segment.data},S={type:i,data:new Uint8Array(_.data,_.data.byteOffset,_.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};typeof f<"u"&&(S.videoFrameDtsTime=f),typeof g<"u"&&(S.videoFramePtsTime=g),t(S)},tR=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},nR=(n,e)=>{e.gopInfo=n.data.gopInfo},ZS=n=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:a,remux:l,onData:u,onTrackInfo:h,onAudioTimingInfo:f,onVideoTimingInfo:g,onVideoSegmentTimingInfo:_,onAudioSegmentTimingInfo:S,onId3:C,onCaptions:N,onDone:O,onEndedTimeline:E,onTransmuxerLog:B,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:U}=n,re={buffer:[]};let W=H;const X=le=>{e.currentTransmux===n&&(le.data.action==="data"&&eR(le,re,u),le.data.action==="trackinfo"&&h(le.data.trackInfo),le.data.action==="gopInfo"&&nR(le,re),le.data.action==="audioTimingInfo"&&f(le.data.audioTimingInfo),le.data.action==="videoTimingInfo"&&g(le.data.videoTimingInfo),le.data.action==="videoSegmentTimingInfo"&&_(le.data.videoSegmentTimingInfo),le.data.action==="audioSegmentTimingInfo"&&S(le.data.audioSegmentTimingInfo),le.data.action==="id3Frame"&&C([le.data.id3Frame],le.data.id3Frame.dispatchType),le.data.action==="caption"&&N(le.data.caption),le.data.action==="endedtimeline"&&(W=!1,E()),le.data.action==="log"&&B(le.data.log),le.data.type==="transmuxed"&&(W||(e.onmessage=null,tR({transmuxedData:re,callback:O}),JS(e))))},R=()=>{const le={message:"Received an error message from the transmuxer worker",metadata:{errorType:Fe.Error.StreamingFailedToTransmuxSegment,segmentInfo:al({segment:Y})}};O(null,le)};if(e.onmessage=X,e.onerror=R,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(a)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:a}),typeof l<"u"&&e.postMessage({action:"setRemux",remux:l}),t.byteLength){const le=t instanceof ArrayBuffer?t:t.buffer,k=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:le,byteOffset:k,byteLength:t.byteLength},[le])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},JS=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():ZS(n.currentTransmux))},f_=(n,e)=>{n.postMessage({action:e}),JS(n)},ek=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,f_(e,n);return}e.transmuxQueue.push(f_.bind(null,e,n))},iR=n=>{ek("reset",n)},rR=n=>{ek("endTimeline",n)},tk=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,ZS(n);return}n.transmuxer.transmuxQueue.push(n)},sR=n=>{const e=new Jj;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:n}),e};var mg={reset:iR,endTimeline:rR,transmux:tk,createTransmuxer:sR};const fu=function(n){const e=n.transmuxer,t=n.endAction||n.action,i=n.callback,a=Xi({},n,{endAction:null,transmuxer:null,callback:null}),l=u=>{u.data.action===t&&(e.removeEventListener("message",l),u.data.data&&(u.data.data=new Uint8Array(u.data.data,n.byteOffset||0,n.byteLength||u.data.data.byteLength),n.data&&(n.data=u.data.data)),i(u.data))};if(e.addEventListener("message",l),n.data){const u=n.data instanceof ArrayBuffer;a.byteOffset=u?0:n.data.byteOffset,a.byteLength=n.data.byteLength;const h=[u?n.data:n.data.buffer];e.postMessage(a,h)}else e.postMessage(a)},Zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},nk="wvtt",ly=n=>{n.forEach(e=>{e.abort()})},aR=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),oR=n=>{const e=n.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=n.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},sb=(n,e)=>{const{requestType:t}=e,i=ml({requestType:t,request:e,error:n});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Zs.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Zs.ABORTED,xhr:e,metadata:i}:n?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Zs.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Zs.FAILURE,xhr:e,metadata:i}:null},m_=(n,e,t,i)=>(a,l)=>{const u=l.response,h=sb(a,l);if(h)return t(h,n);if(u.byteLength!==16)return t({status:l.status,message:"Invalid HLS key at URL: "+l.uri,code:Zs.FAILURE,xhr:l},n);const f=new DataView(u),g=new Uint32Array([f.getUint32(0),f.getUint32(4),f.getUint32(8),f.getUint32(12)]);for(let S=0;S{e===nk&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},uR=(n,e,t)=>{e===nk&&fu({action:"getMp4WebVttText",data:n.bytes,transmuxer:n.transmuxer,callback:({data:i,mp4VttCues:a})=>{n.bytes=i,t(null,n,{mp4VttCues:a})}})},ik=(n,e)=>{const t=Ay(n.map.bytes);if(t!=="mp4"){const i=n.map.resolvedUri||n.map.uri,a=t||"unknown";return e({internal:!0,message:`Found unsupported ${a} container for initialization segment at URL: ${i}`,code:Zs.FAILURE,metadata:{mediaType:a}})}fu({action:"probeMp4Tracks",data:n.map.bytes,transmuxer:n.transmuxer,callback:({tracks:i,data:a})=>(n.map.bytes=a,i.forEach(function(l){n.map.tracks=n.map.tracks||{},!n.map.tracks[l.type]&&(n.map.tracks[l.type]=l,typeof l.id=="number"&&l.timescale&&(n.map.timescales=n.map.timescales||{},n.map.timescales[l.id]=l.timescale),l.type==="text"&&lR(n,l.codec))}),e(null))})},cR=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=sb(i,a);if(l)return e(l,n);const u=new Uint8Array(a.response);if(t({type:"segmentloaded",segment:n}),n.map.key)return n.map.encryptedBytes=u,e(null,n);n.map.bytes=u,ik(n,function(h){if(h)return h.xhr=a,h.status=a.status,e(h,n);e(null,n)})},dR=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=sb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:Yj(l.responseText.substring(n.lastReachedChar||0));return n.stats=aR(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},hR=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{const O=n.map&&n.map.tracks||{},E=!!(O.audio&&O.video);let B=i.bind(null,n,"audio","start");const H=i.bind(null,n,"audio","end");let Y=i.bind(null,n,"video","start");const U=i.bind(null,n,"video","end"),re=()=>tk({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:E,onData:W=>{W.type=W.type==="combined"?"video":W.type,_(n,W)},onTrackInfo:W=>{t&&(E&&(W.isMuxed=!0),t(n,W))},onAudioTimingInfo:W=>{B&&typeof W.start<"u"&&(B(W.start),B=null),H&&typeof W.end<"u"&&H(W.end)},onVideoTimingInfo:W=>{Y&&typeof W.start<"u"&&(Y(W.start),Y=null),U&&typeof W.end<"u"&&U(W.end)},onVideoSegmentTimingInfo:W=>{const X={pts:{start:W.start.presentation,end:W.end.presentation},dts:{start:W.start.decode,end:W.end.decode}};N({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:X}),a(W)},onAudioSegmentTimingInfo:W=>{const X={pts:{start:W.start.pts,end:W.end.pts},dts:{start:W.start.dts,end:W.end.dts}};N({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:X}),l(W)},onId3:(W,X)=>{u(n,W,X)},onCaptions:W=>{h(n,[W])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:C,onDone:(W,X)=>{S&&(W.type=W.type==="combined"?"video":W.type,N({type:"segmenttransmuxingcomplete",segment:n}),S(X,n,W))},segment:n,triggerSegmentEventFn:N});fu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:W=>{n.bytes=e=W.data;const X=W.result;X&&(t(n,{hasAudio:X.hasAudio,hasVideo:X.hasVideo,isMuxed:E}),t=null),re()}})},rk=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{let O=new Uint8Array(e);if(R4(O)){n.isFmp4=!0;const{tracks:E}=n.map;if(E.text&&(!E.audio||!E.video)){_(n,{data:O,type:"text"}),uR(n,E.text.codec,S);return}const H={isFmp4:!0,hasVideo:!!E.video,hasAudio:!!E.audio};E.audio&&E.audio.codec&&E.audio.codec!=="enca"&&(H.audioCodec=E.audio.codec),E.video&&E.video.codec&&E.video.codec!=="encv"&&(H.videoCodec=E.video.codec),E.video&&E.audio&&(H.isMuxed=!0),t(n,H);const Y=(U,re)=>{_(n,{data:O,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),re&&re.length&&u(n,re),U&&U.length&&h(n,U),S(null,n,{})};fu({action:"probeMp4StartTime",timescales:n.map.timescales,data:O,transmuxer:n.transmuxer,callback:({data:U,startTime:re})=>{e=U.buffer,n.bytes=O=U,H.hasAudio&&!H.isMuxed&&i(n,"audio","start",re),H.hasVideo&&i(n,"video","start",re),fu({action:"probeEmsgID3",data:O,transmuxer:n.transmuxer,offset:re,callback:({emsgData:W,id3Frames:X})=>{if(e=W.buffer,n.bytes=O=W,!E.video||!W.byteLength||!n.transmuxer){Y(void 0,X);return}fu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:O,timescales:n.map.timescales,trackIds:[E.video.id],callback:R=>{e=R.data.buffer,n.bytes=O=R.data,R.logs.forEach(function(le){C(ri(le,{stream:"mp4CaptionParser"}))}),Y(R.captions,X)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=Ay(O)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}hR({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})},sk=function({id:n,key:e,encryptedBytes:t,decryptionWorker:i,segment:a,doneFn:l},u){const h=g=>{if(g.data.source===n){i.removeEventListener("message",h);const _=g.data.decrypted;u(new Uint8Array(_.bytes,_.byteOffset,_.byteLength))}};i.onerror=()=>{const g="An error occurred in the decryption worker",_=al({segment:a}),S={message:g,metadata:{error:new Error(g),errorType:Fe.Error.StreamingFailedToDecryptSegment,segmentInfo:_,keyInfo:{uri:a.key.resolvedUri||a.map.key.resolvedUri}}};l(S,a)},i.addEventListener("message",h);let f;e.bytes.slice?f=e.bytes.slice():f=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(HS({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},fR=({decryptionWorker:n,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{N({type:"segmentdecryptionstart"}),sk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},O=>{e.bytes=O,N({type:"segmentdecryptioncomplete",segment:e}),rk({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})})},mR=({activeXhrs:n,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})=>{let O=0,E=!1;return(B,H)=>{if(!E){if(B)return E=!0,ly(n),S(B,H);if(O+=1,O===n.length){const Y=function(){if(H.encryptedBytes)return fR({decryptionWorker:e,segment:H,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N});rk({segment:H,bytes:H.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:N})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return N({type:"segmentdecryptionstart",segment:H}),sk({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:S},U=>{H.map.bytes=U,N({type:"segmentdecryptioncomplete",segment:H}),ik(H,re=>{if(re)return ly(n),S(re,H);Y()})});Y()}}}},pR=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},gR=({segment:n,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_})=>S=>{if(!S.target.aborted)return n.stats=ri(n.stats,oR(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},yR=({xhr:n,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:a,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:H})=>{const Y=[],U=mR({activeXhrs:Y,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:H});if(i.key&&!i.key.bytes){const le=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&le.push(i.map.key);const k=ri(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),j=m_(i,le,U,H),Z={uri:i.key.resolvedUri};H({type:"segmentkeyloadstart",segment:i,keyInfo:Z});const V=n(k,j);Y.push(V)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const V=ri(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ne=m_(i,[i.map.key],U,H),me={uri:i.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:i,keyInfo:me});const ue=n(V,ne);Y.push(ue)}const k=ri(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:ay(i.map),requestType:"segment-media-initialization"}),j=cR({segment:i,finishProcessingFn:U,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:i});const Z=n(k,j);Y.push(Z)}const re=ri(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:ay(i),requestType:"segment"}),W=dR({segment:i,finishProcessingFn:U,responseType:re.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:i});const X=n(re,W);X.addEventListener("progress",gR({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:N,dataFn:O})),Y.push(X);const R={};return Y.forEach(le=>{le.addEventListener("loadend",pR({loadendState:R,abortFn:a}))}),()=>ly(Y)},Jh=xs("PlaylistSelector"),p_=function(n){if(!n||!n.playlist)return;const e=n.playlist;return JSON.stringify({id:e.id,bandwidth:n.bandwidth,width:n.width,height:n.height,codecs:e.attributes&&e.attributes.CODECS||""})},mu=function(n,e){if(!n)return"";const t=de.getComputedStyle(n);return t?t[e]:""},pu=function(n,e){const t=n.slice();n.sort(function(i,a){const l=e(i,a);return l===0?t.indexOf(i)-t.indexOf(a):l})},ab=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||de.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||de.Number.MAX_VALUE,t-i},bR=function(n,e){let t,i;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(t=n.attributes.RESOLUTION.width),t=t||de.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||de.Number.MAX_VALUE,t===i&&n.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?n.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let ak=function(n){const{main:e,bandwidth:t,playerWidth:i,playerHeight:a,playerObjectFit:l,limitRenditionByPlayerDimensions:u,playlistController:h}=n;if(!e)return;const f={bandwidth:t,width:i,height:a,limitRenditionByPlayerDimensions:u};let g=e.playlists;Hr.isAudioOnly(e)&&(g=h.getAudioTrackPlaylists_(),f.audioOnly=!0);let _=g.map(R=>{let le;const k=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,j=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return le=R.attributes&&R.attributes.BANDWIDTH,le=le||de.Number.MAX_VALUE,{bandwidth:le,width:k,height:j,playlist:R}});pu(_,(R,le)=>R.bandwidth-le.bandwidth),_=_.filter(R=>!Hr.isIncompatible(R.playlist));let S=_.filter(R=>Hr.isEnabled(R.playlist));S.length||(S=_.filter(R=>!Hr.isDisabled(R.playlist)));const C=S.filter(R=>R.bandwidth*lr.BANDWIDTH_VARIANCER.bandwidth===N.bandwidth)[0];if(u===!1){const R=O||S[0]||_[0];if(R&&R.playlist){let le="sortedPlaylistReps";return O&&(le="bandwidthBestRep"),S[0]&&(le="enabledPlaylistReps"),Jh(`choosing ${p_(R)} using ${le} with options`,f),R.playlist}return Jh("could not choose a playlist with options",f),null}const E=C.filter(R=>R.width&&R.height);pu(E,(R,le)=>R.width-le.width);const B=E.filter(R=>R.width===i&&R.height===a);N=B[B.length-1];const H=B.filter(R=>R.bandwidth===N.bandwidth)[0];let Y,U,re;H||(Y=E.filter(R=>l==="cover"?R.width>i&&R.height>a:R.width>i||R.height>a),U=Y.filter(R=>R.width===Y[0].width&&R.height===Y[0].height),N=U[U.length-1],re=U.filter(R=>R.bandwidth===N.bandwidth)[0]);let W;if(h.leastPixelDiffSelector){const R=E.map(le=>(le.pixelDiff=Math.abs(le.width-i)+Math.abs(le.height-a),le));pu(R,(le,k)=>le.pixelDiff===k.pixelDiff?k.bandwidth-le.bandwidth:le.pixelDiff-k.pixelDiff),W=R[0]}const X=W||re||H||O||S[0]||_[0];if(X&&X.playlist){let R="sortedPlaylistReps";return W?R="leastPixelDiffRep":re?R="resolutionPlusOneRep":H?R="resolutionBestRep":O?R="bandwidthBestRep":S[0]&&(R="enabledPlaylistReps"),Jh(`choosing ${p_(X)} using ${R} with options`,f),X.playlist}return Jh("could not choose a playlist with options",f),null};const g_=function(){let n=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),ak({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(mu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(mu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?mu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},vR=function(n){let e=-1,t=-1;if(n<0||n>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&de.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=n*this.systemBandwidth+(1-n)*e,t=this.systemBandwidth),ak({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(mu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(mu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?mu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},xR=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(O=>!Hr.isIncompatible(O));let _=g.filter(Hr.isEnabled);_.length||(_=g.filter(O=>!Hr.isDisabled(O)));const C=_.filter(Hr.hasAttribute.bind(null,"BANDWIDTH")).map(O=>{const B=f.getSyncPoint(O,a,h,t)?1:2,Y=Hr.estimateSegmentRequestTime(l,i,O)*B-u;return{playlist:O,rebufferingImpact:Y}}),N=C.filter(O=>O.rebufferingImpact<=0);return pu(N,(O,E)=>ab(E.playlist,O.playlist)),N.length?N[0]:(pu(C,(O,E)=>O.rebufferingImpact-E.rebufferingImpact),C[0]||null)},_R=function(){const n=this.playlists.main.playlists.filter(Hr.isEnabled);return pu(n,(t,i)=>ab(t,i)),n.filter(t=>!!od(this.playlists.main,t).video)[0]||null},wR=n=>{let e=0,t;return n.bytes&&(t=new Uint8Array(n.bytes),n.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function ok(n){try{return new URL(n).pathname.split("/").slice(-2).join("/")}catch{return""}}const TR=function(n,e,t){if(!n[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const a=e.textTracks().getTrackById(i);if(a)n[t]=a;else{const l=e.options_.vhs&&e.options_.vhs.captionServices||{};let u=t,h=t,f=!1;const g=l[i];g&&(u=g.label,h=g.language,f=g.default),n[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:f,label:u,language:h},!1).track}}},SR=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(a=>{const l=a.stream;a.content?a.content.forEach(u=>{const h=new i(a.startTime+t,a.endTime+t,u.text);h.line=u.line,h.align="left",h.position=u.position,h.positionAlign="line-left",n[l].addCue(h)}):n[l].addCue(new i(a.startTime+t,a.endTime+t,a.text))})},kR=function(n){Object.defineProperties(n.frame,{id:{get(){return Fe.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),n.value.key}},value:{get(){return Fe.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),n.value.data}},privateData:{get(){return Fe.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),n.value.data}}})},ER=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=de.WebKitDataCue||de.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(_=>{const S=_.cueTime+t;typeof S!="number"||de.isNaN(S)||S<0||!(S<1/0)||!_.frames||!_.frames.length||_.frames.forEach(C=>{const N=new a(S,S,C.value||C.url||C.data||"");N.frame=C,N.value=C,kR(N),l.addCue(N)})}),!l.cues||!l.cues.length))return;const u=l.cues,h=[];for(let _=0;_{const C=_[S.startTime]||[];return C.push(S),_[S.startTime]=C,_},{}),g=Object.keys(f).sort((_,S)=>Number(_)-Number(S));g.forEach((_,S)=>{const C=f[_],N=isFinite(i)?i:_,O=Number(g[S+1])||N;C.forEach(E=>{E.endTime=O})})},CR={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},AR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),NR=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=de.WebKitDataCue||de.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(AR.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:CR[l],data:a[l]},(l==="scte35Out"||l==="scte35In")&&(u.value.data=new Uint8Array(u.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(u)}a.processDateRange()})},y_=(n,e,t)=>{n.metadataTrack_||(n.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Fe.browser.IS_ANY_SAFARI||(n.metadataTrack_.inBandMetadataTrackDispatchType=e))},Xc=function(n,e,t){let i,a;if(t&&t.cues)for(i=t.cues.length;i--;)a=t.cues[i],a.startTime>=n&&a.endTime<=e&&t.removeCue(a)},DR=function(n){const e=n.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const a=e[i],l=`${a.startTime}-${a.endTime}-${a.text}`;t[l]?n.removeCue(a):t[l]=a}},MR=(n,e,t)=>{if(typeof e>"u"||e===null||!n.length)return[];const i=Math.ceil((e-t+3)*ll.ONE_SECOND_IN_TS);let a;for(a=0;ai);a++);return n.slice(a)},jR=(n,e,t)=>{if(!e.length)return n;if(t)return e.slice();const i=e[0].pts;let a=0;for(a;a=i);a++);return n.slice(0,a).concat(e)},RR=(n,e,t,i)=>{const a=Math.ceil((e-i)*ll.ONE_SECOND_IN_TS),l=Math.ceil((t-i)*ll.ONE_SECOND_IN_TS),u=n.slice();let h=n.length;for(;h--&&!(n[h].pts<=l););if(h===-1)return u;let f=h+1;for(;f--&&!(n[f].pts<=a););return f=Math.max(f,0),u.splice(f,h-f+1),u},OR=function(n,e){if(!n&&!e||!n&&e||n&&!e)return!1;if(n===e)return!0;const t=Object.keys(n).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let a=0;at))return l}return i.length===0?0:i[i.length-1]},Uc=1,IR=500,b_=n=>typeof n=="number"&&isFinite(n),ef=1/60,BR=(n,e,t)=>n!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,PR=(n,e,t)=>{let i=e-lr.BACK_BUFFER_LENGTH;n.length&&(i=Math.max(i,n.start(0)));const a=e-t;return Math.min(a,i)},Ql=n=>{const{startOfSegment:e,duration:t,segment:i,part:a,playlist:{mediaSequence:l,id:u,segments:h=[]},mediaIndex:f,partIndex:g,timeline:_}=n,S=h.length-1;let C="mediaIndex/partIndex increment";n.getMediaInfoForTime?C=`getMediaInfoForTime (${n.getMediaInfoForTime})`:n.isSyncRequest&&(C="getSyncSegmentCandidate (isSyncRequest)"),n.independent&&(C+=` with independent ${n.independent}`);const N=typeof g=="number",O=n.segment.uri?"segment":"pre-segment",E=N?kS({preloadSegment:i})-1:0;return`${O} [${l+f}/${l+S}]`+(N?` part [${g}/${E}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(N?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${_}] selected by [${C}] playlist [${u}]`},v_=n=>`${n}TimingInfo`,FR=({segmentTimeline:n,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:a})=>!a&&n===e?null:n{if(e===t)return!1;if(i==="audio"){const l=n.lastTimelineChange({type:"main"});return!l||l.to!==t}if(i==="main"&&a){const l=n.pendingTimelineChange({type:"audio"});return!(l&&l.to===t)}return!1},UR=n=>{if(!n)return!1;const e=n.pendingTimelineChange({type:"audio"}),t=n.pendingTimelineChange({type:"main"}),i=e&&t,a=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&a)},zR=n=>{const e=n.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=n.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to{const e=n.pendingSegment_;if(!e)return;if(uy({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&UR(n.timelineChangeController_)){if(zR(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},$R=n=>{let e=0;return["video","audio"].forEach(function(t){const i=n[`${t}TimingInfo`];if(!i)return;const{start:a,end:l}=i;let u;typeof a=="bigint"||typeof l=="bigint"?u=de.BigInt(l)-de.BigInt(a):typeof a=="number"&&typeof l=="number"&&(u=l-a),typeof u<"u"&&u>e&&(e=u)}),typeof e=="bigint"&&en?Math.round(n)>e+Ys:!1,HR=(n,e)=>{if(e!=="hls")return null;const t=$R({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo});if(!t)return null;const i=n.playlist.targetDuration,a=x_({segmentDuration:t,maxDuration:i*2}),l=x_({segmentDuration:t,maxDuration:i}),u=`Segment with index ${n.mediaIndex} from playlist ${n.playlist.id} has a duration of ${t} when the reported duration is ${n.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return a||l?{severity:a?"warn":"info",message:u}:null},al=({type:n,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),a=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:n||e.type,uri:e.resolvedUri||e.uri,start:a,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class cy extends Fe.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=xs(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Xi({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Xi({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():po(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return mg.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,de.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&mg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return cr();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:a}=e;if(i&&t&&!this.audioDisabled_&&!a)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];return t&&!a&&e.bytes&&(this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),a||e}segmentKey(e,t=!1){if(!e)return null;const i=qS(e);let a=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!a&&e.bytes&&(this.keyCache_[i]=a={resolvedUri:e.resolvedUri,bytes:e.bytes});const l={resolvedUri:(a||e).resolvedUri};return a&&(l.bytes=a.bytes),l}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,a=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let l=null;if(i&&(i.id?l=i.id:i.uri&&(l=i.uri)),this.logger_(`playlist update [${l} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update: currentTime: ${this.currentTime_()} bufferedEnd: ${hg(this.buffered_())} `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const u=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${u}]`),this.mediaIndex!==null)if(this.mediaIndex-=u,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const h=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!h.parts||!h.parts.length||!h.parts[this.partIndex])){const f=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=f}}a&&(a.mediaIndex-=u,a.mediaIndex<0?(a.mediaIndex=null,a.partIndex=null):(a.mediaIndex>=0&&(a.segment=e.segments[a.mediaIndex]),a.partIndex>=0&&a.segment.parts&&(a.part=a.segment.parts[a.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&mg.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},a=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let l=1;const u=()=>{l--,l===0&&i()};(a||!this.audioDisabled_)&&(l++,this.sourceUpdater_.removeAudio(e,t,u)),(a||this.loaderType_==="main")&&(this.gopBuffer_=RR(this.gopBuffer_,e,t,this.timeMapping_),l++,this.sourceUpdater_.removeVideo(e,t,u));for(const h in this.inbandTextTracks_)Xc(e,t,this.inbandTextTracks_[h]);Xc(e,t,this.segmentMetadataTrack_),u()}monitorBuffer_(){this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&de.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=de.setTimeout(this.monitorBufferTick_.bind(this),IR)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const a=typeof e=="number"&&t.segments[e],l=e+1===t.segments.length,u=!a||!a.parts||i+1===a.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&l&&u}chooseNextRequest_(){const e=this.buffered_(),t=hg(e)||0,i=tb(e,this.currentTime_()),a=!this.hasPlayed_()&&i>=1,l=i>=this.goalBufferLength_(),u=this.playlist_.segments;if(!u.length||a||l)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const h={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(h.isSyncRequest)h.mediaIndex=LR(this.currentTimeline_,u,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${h.mediaIndex}`);else if(this.mediaIndex!==null){const C=u[this.mediaIndex],N=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=C.end?C.end:t,C.parts&&C.parts[N+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=N+1):h.mediaIndex=this.mediaIndex+1}else{let C,N,O;const E=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch: For TargetTime: ${E}. CurrentTime: ${this.currentTime_()} BufferedEnd: ${t} Fetch At Buffer: ${this.fetchAtBuffer_} `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const B=this.getSyncInfoFromMediaSequenceSync_(E);if(!B){const H="No sync info found while using media sequence sync";return this.error({message:H,metadata:{errorType:Fe.Error.StreamingFailedToSelectNextSegment,error:new Error(H)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${B.start} --> ${B.end})`),C=B.segmentIndex,N=B.partIndex,O=B.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const B=Hr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:E,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});C=B.segmentIndex,N=B.partIndex,O=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${E}`:`currentTime ${E}`,h.mediaIndex=C,h.startOfSegment=O,h.partIndex=N,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${h.mediaIndex} `)}const f=u[h.mediaIndex];let g=f&&typeof h.partIndex=="number"&&f.parts&&f.parts[h.partIndex];if(!f||typeof h.partIndex=="number"&&!g)return null;typeof h.partIndex!="number"&&f.parts&&(h.partIndex=0,g=f.parts[0]);const _=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&g&&!_&&!g.independent)if(h.partIndex===0){const C=u[h.mediaIndex-1],N=C.parts&&C.parts.length&&C.parts[C.parts.length-1];N&&N.independent&&(h.mediaIndex-=1,h.partIndex=C.parts.length-1,h.independent="previous segment")}else f.parts[h.partIndex-1].independent&&(h.partIndex-=1,h.independent="previous part");const S=this.mediaSource_&&this.mediaSource_.readyState==="ended";return h.mediaIndex>=u.length-1&&S&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,h.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(h))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const a=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return a?(a.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),a):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:a,startOfSegment:l,isSyncRequest:u,partIndex:h,forceTimestampOffset:f,getMediaInfoForTime:g}=e,_=i.segments[a],S=typeof h=="number"&&_.parts[h],C={requestId:"segment-loader-"+Math.random(),uri:S&&S.resolvedUri||_.resolvedUri,mediaIndex:a,partIndex:S?h:null,isSyncRequest:u,startOfSegment:l,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:_.timeline,duration:S&&S.duration||_.duration,segment:_,part:S,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:g,independent:t},N=typeof f<"u"?f:this.isPendingTimestampOffset_;C.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:_.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:N});const O=hg(this.sourceUpdater_.audioBuffered());return typeof O=="number"&&(C.audioAppendStart=O-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(C.gopsToAlignWith=MR(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),C}timestampOffsetForSegment_(e){return FR(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,a=this.pendingSegment_.duration,l=Hr.estimateSegmentRequestTime(a,i,this.playlist_,e.bytesReceived),u=oj(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=xR({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:u,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!h)return;const g=l-u-h.rebufferingImpact;let _=.5;u<=Ys&&(_=1),!(!h.playlist||h.playlist.uri===this.playlist_.uri||g<_)&&(this.bandwidth=h.playlist.attributes.BANDWIDTH*lr.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Ql(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:a}=t,l={segmentInfo:al({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:a}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:l}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},OR(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this))))}handleTimingInfo_(e,t,i,a){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const l=this.pendingSegment_,u=v_(t);l[u]=l[u]||{},l[u][i]=a,this.logger_(`timinginfo: ${t} - ${i} - ${a}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():po(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const a=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),l={};t.forEach(u=>{l[u.stream]=l[u.stream]||{startTime:1/0,captions:[],endTime:0};const h=l[u.stream];h.startTime=Math.min(h.startTime,u.startTime+a),h.endTime=Math.max(h.endTime,u.endTime+a),h.captions.push(u)}),Object.keys(l).forEach(u=>{const{startTime:h,endTime:f,captions:g}=l[u],_=this.inbandTextTracks_;this.logger_(`adding cues from ${h} -> ${f} for ${u}`),TR(_,this.vhs_.tech_,u),Xc(h,f,_[u]),SR({captionArray:g,inbandTextTracks:_,timestampOffset:a})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!uy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:a,isMuxed:l}=t;return!(a&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!l&&!e.audioTimingInfo||uy({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){po(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[v_(t.type)].start;else{const a=this.getCurrentMediaInfo_(),l=this.loaderType_==="main"&&a&&a.hasVideo;let u;l&&(u=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:l,firstVideoFrameTimeForData:u,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const a=this.chooseNextRequest_();if(a.mediaIndex!==i.mediaIndex||a.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:a}){if(i){const l=Hf(i);if(this.activeInitSegmentId_===l)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=l}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=a,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},a){const l=this.sourceUpdater_.audioBuffered(),u=this.sourceUpdater_.videoBuffered();l.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ul(l).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ul(u).join(", "));const h=l.length?l.start(0):0,f=l.length?l.end(l.length-1):0,g=u.length?u.start(0):0,_=u.length?u.end(u.length-1):0;if(f-h<=Uc&&_-g<=Uc){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${ul(l).join(", ")}, video buffer: ${ul(u).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const C=this.currentTime_()-Uc;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${C}`),this.remove(0,C,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Uc}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=de.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Uc*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},a){if(a){if(a.code===IS){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",a),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:Fe.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:a,bytes:l}){if(!l){const h=[a];let f=a.byteLength;i&&(h.unshift(i),f+=i.byteLength),l=wR({bytes:f,segments:h})}const u={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:u}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:l},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:l}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const a=this.pendingSegment_.segment,l=`${e}TimingInfo`;a[l]||(a[l]={}),a[l].transmuxerPrependedSeconds=i.prependedContentDuration||0,a[l].transmuxedPresentationStart=i.start.presentation,a[l].transmuxedDecodeStart=i.start.decode,a[l].transmuxedPresentationEnd=i.end.presentation,a[l].transmuxedDecodeEnd=i.end.decode,a[l].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:a}=t;if(!a||!a.byteLength||i==="audio"&&this.audioDisabled_)return;const l=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:l,data:a})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){po(this),this.loadQueue_.push(()=>{const t=Xi({},e,{forceTimestampOffset:!0});Xi(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),a=this.mediaIndex!==null,l=e.timeline!==this.currentTimeline_&&e.timeline>0,u=i||a&&l;this.logger_(`Requesting ${ok(e.uri)} ${Ql(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=yR({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:u,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:h,level:f,stream:g})=>{this.logger_(`${Ql(e)} logged from transmuxer stream ${g} as a ${f}: ${h}`)},triggerSegmentEventFn:({type:h,segment:f,keyInfo:g,trackInfo:_,timingInfo:S})=>{const N={segmentInfo:al({segment:f})};g&&(N.keyInfo=g),_&&(N.trackInfo=_),S&&(N.timingInfo=S),this.trigger({type:h,metadata:N})}})}trimBackBuffer_(e){const t=PR(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,a=e.segment.key||e.segment.map&&e.segment.map.key,l=e.segment.map&&!e.segment.map.bytes,u={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:a,isMediaInitialization:l},h=e.playlist.segments[e.mediaIndex-1];if(h&&h.timeline===t.timeline&&(h.videoTimingInfo?u.baseStartTime=h.videoTimingInfo.transmuxedDecodeEnd:h.audioTimingInfo&&(u.baseStartTime=h.audioTimingInfo.transmuxedDecodeEnd)),t.key){const f=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);u.key=this.segmentKey(t.key),u.key.iv=f}return t.map&&(u.map=this.initSegmentForMap(t.map)),u}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e"u"||g.end!==a+l?a:h.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:a,isMuxed:l}=t,u=this.loaderType_==="main"&&a,h=!this.audioDisabled_&&i&&!l;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}u&&e.waitingOnAppends++,h&&e.waitingOnAppends++,u&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),h&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=BR(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),a=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;a&&(e.timingInfo.end=typeof a.end=="number"?a.end:a.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const f={segmentInfo:al({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:f})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=HR(e,this.sourceType_);if(t&&(t.severity==="warn"?Fe.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Ql(e)}`);return}this.logger_(`Appended ${Ql(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,a=e.part,l=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,u=a&&a.end&&this.currentTime_()-a.end>e.playlist.partTargetDuration*3;if(l||u){this.logger_(`bad ${l?"segment":"part"} ${Ql(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duratione.toUpperCase())},qR=["video","audio"],dy=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},VR=(n,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),gu("audio",e),gu("video",e));return}if(n!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||dy(n,e))){if(i.type!==n){if(t=VR(n,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[n]=i,i.action(n,e),!i.doneFn){e.queuePending[n]=null,gu(n,e);return}}},uk=(n,e)=>{const t=e[`${n}Buffer`],i=lk(n);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[n]=null,e[`${n}Buffer`]=null)},Ws=(n,e)=>n&&e&&Array.prototype.indexOf.call(n.sourceBuffers,e)!==-1,ns={appendBuffer:(n,e,t)=>(i,a)=>{const l=a[`${i}Buffer`];if(Ws(a.mediaSource,l)){a.logger_(`Appending segment ${e.mediaIndex}'s ${n.length} bytes to ${i}Buffer`);try{l.appendBuffer(n)}catch(u){a.logger_(`Error with code ${u.code} `+(u.code===IS?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),a.queuePending[i]=null,t(u)}}},remove:(n,e)=>(t,i)=>{const a=i[`${t}Buffer`];if(Ws(i.mediaSource,a)){i.logger_(`Removing ${n} to ${e} from ${t}Buffer`);try{a.remove(n,e)}catch{i.logger_(`Remove ${n} to ${e} from ${t}Buffer failed`)}}},timestampOffset:n=>(e,t)=>{const i=t[`${e}Buffer`];Ws(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${n}`),i.timestampOffset=n)},callback:n=>(e,t)=>{n()},endOfStream:n=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${n||""})`);try{e.mediaSource.endOfStream(n)}catch(t){Fe.log.warn("Failed to call media source endOfStream",t)}}},duration:n=>e=>{e.logger_(`Setting mediaSource duration to ${n}`);try{e.mediaSource.duration=n}catch(t){Fe.log.warn("Failed to set media source duration",t)}},abort:()=>(n,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${n}Buffer`];if(Ws(e.mediaSource,t)){e.logger_(`calling abort on ${n}Buffer`);try{t.abort()}catch(i){Fe.log.warn(`Failed to abort on ${n}Buffer`,i)}}},addSourceBuffer:(n,e)=>t=>{const i=lk(n),a=_u(e);t.logger_(`Adding ${n}Buffer with codec ${e} to mediaSource`);const l=t.mediaSource.addSourceBuffer(a);l.addEventListener("updateend",t[`on${i}UpdateEnd_`]),l.addEventListener("error",t[`on${i}Error_`]),t.codecs[n]=e,t[`${n}Buffer`]=l},removeSourceBuffer:n=>e=>{const t=e[`${n}Buffer`];if(uk(n,e),!!Ws(e.mediaSource,t)){e.logger_(`Removing ${n}Buffer with codec ${e.codecs[n]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Fe.log.warn(`Failed to removeSourceBuffer ${n}Buffer`,i)}}},changeType:n=>(e,t)=>{const i=t[`${e}Buffer`],a=_u(n);if(!Ws(t.mediaSource,i))return;const l=n.substring(0,n.indexOf(".")),u=t.codecs[e];if(u.substring(0,u.indexOf("."))===l)return;const f={codecsChangeInfo:{from:u,to:n}};t.trigger({type:"codecschange",metadata:f}),t.logger_(`changing ${e}Buffer codec from ${u} to ${n}`);try{i.changeType(a),t.codecs[e]=n}catch(g){f.errorType=Fe.Error.StreamingCodecsChangeError,f.error=g,g.metadata=f,t.error_=g,t.trigger("error"),Fe.log.warn(`Failed to changeType on ${e}Buffer`,g)}}},is=({type:n,sourceUpdater:e,action:t,doneFn:i,name:a})=>{e.queue.push({type:n,action:t,doneFn:i,name:a}),gu(n,e)},__=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=rj(i);if(e.logger_(`received "updateend" event for ${n} Source Buffer: `,a),e.queuePending[n]){const l=e.queuePending[n].doneFn;e.queuePending[n]=null,l&&l(e[`${n}Error_`])}gu(n,e)};class ck extends Fe.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=xs("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=__("video",this),this.onAudioUpdateEnd_=__("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){is({type:"mediaSource",sourceUpdater:this,action:ns.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){is({type:e,sourceUpdater:this,action:ns.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Fe.log.error("removeSourceBuffer is not supported!");return}is({type:"mediaSource",sourceUpdater:this,action:ns.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Fe.browser.IS_FIREFOX&&de.MediaSource&&de.MediaSource.prototype&&typeof de.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return de.SourceBuffer&&de.SourceBuffer.prototype&&typeof de.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Fe.log.error("changeType is not supported!");return}is({type:e,sourceUpdater:this,action:ns.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:a,bytes:l}=e;if(this.processedAppend_=!0,a==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${l.length} until video append`);return}const u=t;if(is({type:a,sourceUpdater:this,action:ns.appendBuffer(l,i||{mediaIndex:-1},u),doneFn:t,name:"appendBuffer"}),a==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const h=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${h.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,h.forEach(f=>{this.appendBuffer.apply(this,f)})}}audioBuffered(){return Ws(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:cr()}videoBuffered(){return Ws(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:cr()}buffered(){const e=Ws(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Ws(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():aj(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ea){is({type:"mediaSource",sourceUpdater:this,action:ns.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ea){typeof e!="string"&&(e=void 0),is({type:"mediaSource",sourceUpdater:this,action:ns.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Ea){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}is({type:"audio",sourceUpdater:this,action:ns.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Ea){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}is({type:"video",sourceUpdater:this,action:ns.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(dy("audio",this)||dy("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(is({type:"audio",sourceUpdater:this,action:ns.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(is({type:"video",sourceUpdater:this,action:ns.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&is({type:"audio",sourceUpdater:this,action:ns.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&is({type:"video",sourceUpdater:this,action:ns.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),qR.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>uk(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const w_=n=>decodeURIComponent(escape(String.fromCharCode.apply(null,n))),GR=n=>{const e=new Uint8Array(n);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},T_=new Uint8Array(` `.split("").map(n=>n.charCodeAt(0)));class KR extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class WR extends cy{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return cr();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return cr([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];if(t&&!a&&e.bytes){const l=T_.byteLength+e.bytes.byteLength,u=new Uint8Array(l);u.set(e.bytes),u.set(T_,e.bytes.byteLength),this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:u}}return a||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Xc(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Zs.TIMEOUT&&this.handleTimeout_(),e.code===Zs.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const a=this.pendingSegment_,l=i.mp4VttCues&&i.mp4VttCues.length;l&&(a.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(a.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const u=a.segment;if(u.map&&(u.map.bytes=t.map.bytes),a.bytes=t.bytes,typeof de.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}u.requested=!0;try{this.parseVTTCues_(a)}catch(h){this.stopForError({message:h.message,metadata:{errorType:Fe.Error.StreamingVttParserError,error:h}});return}if(l||this.updateTimeMapping_(a,this.syncController_.timelines[a.timeline],this.playlist_),a.cues.length?a.timingInfo={start:a.cues[0].startTime,end:a.cues[a.cues.length-1].endTime}:a.timingInfo={start:a.startOfSegment,end:a.startOfSegment+a.duration},a.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}a.byteLength=a.bytes.byteLength,this.mediaSecondsLoaded+=u.duration,a.cues.forEach(h=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new de.VTTCue(h.startTime,h.endTime,h.text):h)}),DR(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",a=t&&t.type==="text";i&&a&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const a=i.start+t,l=i.end+t,u=new de.VTTCue(a,l,i.cueText);i.settings&&i.settings.split(" ").forEach(h=>{const f=h.split(":"),g=f[0],_=f[1];u[g]=isNaN(_)?_:Number(_)}),e.cues.push(u)})}parseVTTCues_(e){let t,i=!1;if(typeof de.WebVTT!="function")throw new KR;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof de.TextDecoder=="function"?t=new de.TextDecoder("utf8"):(t=de.WebVTT.StringDecoder(),i=!0);const a=new de.WebVTT.Parser(de,de.vttjs,t);if(a.oncue=e.cues.push.bind(e.cues),a.ontimestampmap=u=>{e.timestampmap=u},a.onparsingerror=u=>{Fe.log.warn("Error encountered when parsing cues: "+u.message)},e.segment.map){let u=e.segment.map.bytes;i&&(u=w_(u)),a.parse(u)}let l=e.bytes;i&&(l=w_(l)),a.parse(l),a.flush()}updateTimeMapping_(e,t,i){const a=e.segment;if(!t)return;if(!e.cues.length){a.empty=!0;return}const{MPEGTS:l,LOCAL:u}=e.timestampmap,f=l/ll.ONE_SECOND_IN_TS-u+t.mapping;if(e.cues.forEach(g=>{const _=g.endTime-g.startTime,S=this.handleRollover_(g.startTime+f,t.time);g.startTime=Math.max(S,0),g.endTime=Math.max(S+_,0)}),!i.syncInfo){const g=e.cues[0].startTime,_=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(g,_-a.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*ll.ONE_SECOND_IN_TS;const a=t*ll.ONE_SECOND_IN_TS;let l;for(a4294967296;)i+=l;return i/ll.ONE_SECOND_IN_TS}}const XR=function(n,e){const t=n.cues;for(let i=0;i=a.adStartTime&&e<=a.adEndTime)return a}return null},YR=function(n,e,t=0){if(!n.segments)return;let i=t,a;for(let l=0;l=this.start&&e0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class dk{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:a}=e;if(this.isReliable_=this.isReliablePlaylist_(i,a),!!this.isReliable_)return this.updateStorage_(a,i,this.calculateBaseTime_(i,a,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const a of i)if(a.isInRange(e))return a}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const a=new Map;let l=` `,u=i,h=t;this.start_=u,e.forEach((f,g)=>{const _=this.storage_.get(h),S=u,C=S+f.duration,N=!!(_&&_.segmentSyncInfo&&_.segmentSyncInfo.isAppended),O=new S_({start:S,end:C,appended:N,segmentIndex:g});f.syncInfo=O;let E=u;const B=(f.parts||[]).map((H,Y)=>{const U=E,re=E+H.duration,W=!!(_&&_.partsSyncInfo&&_.partsSyncInfo[Y]&&_.partsSyncInfo[Y].isAppended),X=new S_({start:U,end:re,appended:W,segmentIndex:g,partIndex:Y});return E=re,l+=`Media Sequence: ${h}.${Y} | Range: ${U} --> ${re} | Appended: ${W} `,H.syncInfo=X,X});a.set(h,new QR(O,B)),l+=`${ok(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${C} | Appended: ${N} `,h++,u=C}),this.end_=u,this.storage_=a,this.diagnostics_=l}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const a=Math.min(...this.storage_.keys());if(et!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(n,e,t,i,a,l)=>{const u=n.getMediaSequenceSync(l);if(!u||!u.isReliable)return null;const h=u.getSyncInfoForTime(a);return h?{time:h.start,partIndex:h.partIndex,segmentIndex:h.segmentIndex}:null}},{name:"ProgramDateTime",run:(n,e,t,i,a)=>{if(!Object.keys(n.timelineToDatetimeMappings).length)return null;let l=null,u=null;const h=ty(e);a=a||0;for(let f=0;f{let l=null,u=null;a=a||0;const h=ty(e);for(let f=0;f=N)&&(u=N,l={time:C,segmentIndex:_.segmentIndex,partIndex:_.partIndex})}}return l}},{name:"Discontinuity",run:(n,e,t,i,a)=>{let l=null;if(a=a||0,e.discontinuityStarts&&e.discontinuityStarts.length){let u=null;for(let h=0;h=S)&&(u=S,l={time:_.time,segmentIndex:f,partIndex:null})}}}return l}},{name:"Playlist",run:(n,e,t,i,a)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class JR extends Fe.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new dk,i=new k_(t),a=new k_(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:a},this.logger_=xs("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,a,l){if(t!==1/0)return pg.find(({name:f})=>f==="VOD").run(this,e,t);const u=this.runStrategies_(e,t,i,a,l);if(!u.length)return null;for(const h of u){const{syncPoint:f,strategy:g}=h,{segmentIndex:_,time:S}=f;if(_<0)continue;const C=e.segments[_],N=S,O=N+C.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${_}. Time: [${N} -> ${O}]}`),a>=N&&a0&&(a.time*=-1),Math.abs(a.time+ad({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:a.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,a,l){const u=[];for(let h=0;hZR){Fe.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let a=i-1;a>=0;a--){const l=e.segments[a];if(l&&typeof l.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+a,time:l.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),a=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:a.start}));const l=a.dateTimeObject;a.discontinuity&&t&&l&&(this.timelineToDatetimeMappings[a.timeline]=-(l.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const a=e.segment,l=e.part;let u=this.timelines[e.timeline],h,f;if(typeof e.timestampOffset=="number")u={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=u,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${u.time}] [mapping: ${u.mapping}]`)),h=e.startOfSegment,f=t.end+u.mapping;else if(u)h=t.start+u.mapping,f=t.end+u.mapping;else return!1;return l&&(l.start=h,l.end=f),(!a.start||hf){let g;h<0?g=i.start-ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:l}):g=i.end+ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:l}),this.discontinuities[u]={time:g,accuracy:f}}}}dispose(){this.trigger("dispose"),this.off()}}class e8 extends Fe.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const a={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:a})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const t8=YS(QS(function(){var n=(function(){function E(){this.listeners={}}var B=E.prototype;return B.on=function(Y,U){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push(U)},B.off=function(Y,U){if(!this.listeners[Y])return!1;var re=this.listeners[Y].indexOf(U);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(re,1),re>-1},B.trigger=function(Y){var U=this.listeners[Y];if(U)if(arguments.length===2)for(var re=U.length,W=0;W>7)*283)^re]=re;for(W=X=0;!Y[W];W^=k||1,X=le[X]||1)for(V=X^X<<1^X<<2^X<<3^X<<4,V=V>>8^V&255^99,Y[W]=V,U[V]=W,Z=R[j=R[k=R[W]]],me=Z*16843009^j*65537^k*257^W*16843008,ne=R[V]*257^V*16843008,re=0;re<4;re++)B[re][W]=ne=ne<<24^ne>>>8,H[re][V]=me=me<<24^me>>>8;for(re=0;re<5;re++)B[re]=B[re].slice(0),H[re]=H[re].slice(0);return E};let i=null;class a{constructor(B){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let H,Y,U;const re=this._tables[0][4],W=this._tables[1],X=B.length;let R=1;if(X!==4&&X!==6&&X!==8)throw new Error("Invalid aes key size");const le=B.slice(0),k=[];for(this._key=[le,k],H=X;H<4*X+28;H++)U=le[H-1],(H%X===0||X===8&&H%X===4)&&(U=re[U>>>24]<<24^re[U>>16&255]<<16^re[U>>8&255]<<8^re[U&255],H%X===0&&(U=U<<8^U>>>24^R<<24,R=R<<1^(R>>7)*283)),le[H]=le[H-X]^U;for(Y=0;H;Y++,H--)U=le[Y&3?H:H-4],H<=4||Y<4?k[Y]=U:k[Y]=W[0][re[U>>>24]]^W[1][re[U>>16&255]]^W[2][re[U>>8&255]]^W[3][re[U&255]]}decrypt(B,H,Y,U,re,W){const X=this._key[1];let R=B^X[0],le=U^X[1],k=Y^X[2],j=H^X[3],Z,V,ne;const me=X.length/4-2;let ue,q=4;const P=this._tables[1],Q=P[0],te=P[1],ge=P[2],L=P[3],xe=P[4];for(ue=0;ue>>24]^te[le>>16&255]^ge[k>>8&255]^L[j&255]^X[q],V=Q[le>>>24]^te[k>>16&255]^ge[j>>8&255]^L[R&255]^X[q+1],ne=Q[k>>>24]^te[j>>16&255]^ge[R>>8&255]^L[le&255]^X[q+2],j=Q[j>>>24]^te[R>>16&255]^ge[le>>8&255]^L[k&255]^X[q+3],q+=4,R=Z,le=V,k=ne;for(ue=0;ue<4;ue++)re[(3&-ue)+W]=xe[R>>>24]<<24^xe[le>>16&255]<<16^xe[k>>8&255]<<8^xe[j&255]^X[q++],Z=R,R=le,le=k,k=j,j=Z}}class l extends n{constructor(){super(n),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(B){this.jobs.push(B),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const u=function(E){return E<<24|(E&65280)<<8|(E&16711680)>>8|E>>>24},h=function(E,B,H){const Y=new Int32Array(E.buffer,E.byteOffset,E.byteLength>>2),U=new a(Array.prototype.slice.call(B)),re=new Uint8Array(E.byteLength),W=new Int32Array(re.buffer);let X,R,le,k,j,Z,V,ne,me;for(X=H[0],R=H[1],le=H[2],k=H[3],me=0;me{const Y=E[H];C(Y)?B[H]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:B[H]=Y}),B};self.onmessage=function(E){const B=E.data,H=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),Y=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),U=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(H,Y,U,function(re,W){self.postMessage(O({source:B.source,decrypted:W}),[W.buffer])})}}));var n8=XS(t8);const i8=n=>{let e=n.default?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},hk=(n,e)=>{n.abort(),n.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},hy=(n,e)=>{e.activePlaylistLoader=n,n.load()},r8=(n,e)=>()=>{const{segmentLoaders:{[n]:t,main:i},mediaTypes:{[n]:a}}=e,l=a.activeTrack(),u=a.getActiveGroup(),h=a.activePlaylistLoader,f=a.lastGroup_;if(!(u&&f&&u.id===f.id)&&(a.lastGroup_=u,a.lastTrack_=l,hk(t,a),!(!u||u.isMainPlaylist))){if(!u.playlistLoader){h&&i.resetEverything();return}t.resyncLoader(),hy(u.playlistLoader,a)}},s8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},a8=(n,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[n]:i,main:a},mediaTypes:{[n]:l}}=e,u=l.activeTrack(),h=l.getActiveGroup(),f=l.activePlaylistLoader,g=l.lastTrack_;if(!(g&&u&&g.id===u.id)&&(l.lastGroup_=h,l.lastTrack_=u,hk(i,l),!!h)){if(h.isMainPlaylist){if(!u||!g||u.id===g.id)return;const _=e.vhs.playlistController_,S=_.selectPlaylist();if(_.media()===S)return;l.logger_(`track change. Switching main audio from ${g.id} to ${u.id}`),t.pause(),a.resetEverything(),_.fastQualityChange_(S);return}if(n==="AUDIO"){if(!h.playlistLoader){a.setAudio(!0),a.resetEverything();return}i.setAudio(!0),a.setAudio(!1)}if(f===h.playlistLoader){hy(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),hy(h.playlistLoader,l)}},qf={AUDIO:(n,e)=>()=>{const{mediaTypes:{[n]:t},excludePlaylist:i}=e,a=t.activeTrack(),l=t.activeGroup(),u=(l.filter(f=>f.default)[0]||l[0]).id,h=t.tracks[u];if(a===h){i({error:{message:"Problem encountered loading the default audio track."}});return}Fe.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const f in t.tracks)t.tracks[f].enabled=t.tracks[f]===h;t.onTrackChanged()},SUBTITLES:(n,e)=>()=>{const{mediaTypes:{[n]:t}}=e;Fe.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},E_={AUDIO:(n,e,t)=>{if(!e)return;const{tech:i,requestOptions:a,segmentLoaders:{[n]:l}}=t;e.on("loadedmetadata",()=>{const u=e.media();l.playlist(u,a),(!i.paused()||u.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))},SUBTITLES:(n,e,t)=>{const{tech:i,requestOptions:a,segmentLoaders:{[n]:l},mediaTypes:{[n]:u}}=t;e.on("loadedmetadata",()=>{const h=e.media();l.playlist(h,a),l.track(u.activeTrack()),(!i.paused()||h.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))}},o8={AUDIO:(n,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[n]:a},requestOptions:l,main:{mediaGroups:u},mediaTypes:{[n]:{groups:h,tracks:f,logger_:g}},mainPlaylistLoader:_}=e,S=Cd(_.main);(!u[n]||Object.keys(u[n]).length===0)&&(u[n]={main:{default:{default:!0}}},S&&(u[n].main.default.playlists=_.main.playlists));for(const C in u[n]){h[C]||(h[C]=[]);for(const N in u[n][C]){let O=u[n][C][N],E;if(S?(g(`AUDIO group '${C}' label '${N}' is a main playlist`),O.isMainPlaylist=!0,E=null):i==="vhs-json"&&O.playlists?E=new su(O.playlists[0],t,l):O.resolvedUri?E=new su(O.resolvedUri,t,l):O.playlists&&i==="dash"?E=new oy(O.playlists[0],t,l,_):E=null,O=ri({id:N,playlistLoader:E},O),E_[n](n,O.playlistLoader,e),h[C].push(O),typeof f[N]>"u"){const B=new Fe.AudioTrack({id:N,kind:i8(O),enabled:!1,language:O.language,default:O.default,label:N});f[N]=B}}}a.on("error",qf[n](n,e))},SUBTITLES:(n,e)=>{const{tech:t,vhs:i,sourceType:a,segmentLoaders:{[n]:l},requestOptions:u,main:{mediaGroups:h},mediaTypes:{[n]:{groups:f,tracks:g}},mainPlaylistLoader:_}=e;for(const S in h[n]){f[S]||(f[S]=[]);for(const C in h[n][S]){if(!i.options_.useForcedSubtitles&&h[n][S][C].forced)continue;let N=h[n][S][C],O;if(a==="hls")O=new su(N.resolvedUri,i,u);else if(a==="dash"){if(!N.playlists.filter(B=>B.excludeUntil!==1/0).length)return;O=new oy(N.playlists[0],i,u,_)}else a==="vhs-json"&&(O=new su(N.playlists?N.playlists[0]:N.resolvedUri,i,u));if(N=ri({id:C,playlistLoader:O},N),E_[n](n,N.playlistLoader,e),f[S].push(N),typeof g[C]>"u"){const E=t.addRemoteTextTrack({id:C,kind:"subtitles",default:N.default&&N.autoselect,language:N.language,label:C},!1).track;g[C]=E}}}l.on("error",qf[n](n,e))},"CLOSED-CAPTIONS":(n,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[n]:{groups:a,tracks:l}}}=e;for(const u in i[n]){a[u]||(a[u]=[]);for(const h in i[n][u]){const f=i[n][u][h];if(!/^(?:CC|SERVICE)/.test(f.instreamId))continue;const g=t.options_.vhs&&t.options_.vhs.captionServices||{};let _={label:h,language:f.language,instreamId:f.instreamId,default:f.default&&f.autoselect};if(g[_.instreamId]&&(_=ri(_,g[_.instreamId])),_.default===void 0&&delete _.default,a[u].push(ri({id:h},f)),typeof l[h]>"u"){const S=t.addRemoteTextTrack({id:_.instreamId,kind:"captions",default:_.default,language:_.language,label:_.label},!1).track;l[h]=S}}}}},fk=(n,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:i,mediaTypes:{[n]:{groups:a}}}=e,l=i.media();if(!l)return null;let u=null;l.attributes[n]&&(u=a[l.attributes[n]]);const h=Object.keys(a);if(!u)if(n==="AUDIO"&&h.length>1&&Cd(e.main))for(let f=0;f"u"?u:t===null||!u?null:u.filter(f=>f.id===t.id)[0]||null},u8={AUDIO:(n,e)=>()=>{const{mediaTypes:{[n]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(n,e)=>()=>{const{mediaTypes:{[n]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},c8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},d8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{o8[g](g,n)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:a,segmentLoaders:{["AUDIO"]:l,main:u}}=n;["AUDIO","SUBTITLES"].forEach(g=>{e[g].activeGroup=l8(g,n),e[g].activeTrack=u8[g](g,n),e[g].onGroupChanged=r8(g,n),e[g].onGroupChanging=s8(g,n),e[g].onTrackChanged=a8(g,n),e[g].getActiveGroup=c8(g,n)});const h=e.AUDIO.activeGroup();if(h){const g=(h.filter(S=>S.default)[0]||h[0]).id;e.AUDIO.tracks[g].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(u.setAudio(!1),l.setAudio(!0)):u.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(g=>e[g].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(g=>e[g].onGroupChanging())});const f=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",f),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),a.on("dispose",()=>{i.audioTracks().removeEventListener("change",f),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const g in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[g])},h8=()=>{const n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{n[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ea,activeTrack:Ea,getActiveGroup:Ea,onGroupChanged:Ea,onTrackChanged:Ea,lastTrack_:null,logger_:xs(`MediaGroups[${e}]`)}}),n};class C_{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=zr(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class f8 extends Fe.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new C_,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=xs("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=zr(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const a={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:a}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(l,u)=>{if(l){if(u.status===410){this.logger_(`manifest request 410 ${l}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(u.status===429){const g=u.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${l}.`),this.logger_(`content steering will retry in ${g} seconds.`),this.startTTLTimeout_(parseInt(g,10));return}this.logger_(`manifest failed to load ${l}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:a});let h;try{h=JSON.parse(this.request_.responseText)}catch(g){const _={errorType:Fe.Error.StreamingContentSteeringParserError,error:g};this.trigger({type:"error",metadata:_})}this.assignSteeringProperties_(h);const f={contentSteeringInfo:a.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:f}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new de.URL(e),i=new de.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(de.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new de.URL(e),i=this.getPathway(),a=this.getBandwidth_();if(i){const l=`_${this.manifestType_}_pathway`;t.searchParams.set(l,i)}if(a){const l=`_${this.manifestType_}_throughput`;t.searchParams.set(l,a)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(a=>{for(const l of a)if(this.availablePathways_.has(l))return l;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=a=>this.excludedSteeringManifestURLs.has(a);if(this.proxyServerUrl_){const a=this.setProxyServerUrl_(e);if(!t(a))return a}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=de.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){de.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new C_}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(zr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const m8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},p8=10;let go;const g8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],y8=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},b8=function({currentPlaylist:n,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:u,bufferBasedABR:h,log:f}){if(!i)return Fe.log.warn("We received no playlist to switch to. Please check your stream."),!1;const g=`allowing switch ${n&&n.id||"null"} -> ${i.id}`;if(!n)return f(`${g} as current playlist is not set`),!0;if(i.id===n.id)return!1;const _=!!ru(e,t).length;if(!n.endList)return!_&&typeof n.partTargetDuration=="number"?(f(`not ${g} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(f(`${g} as current playlist is live`),!0);const S=tb(e,t),C=h?lr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:lr.MAX_BUFFER_LOW_WATER_LINE;if(uO)&&S>=a){let E=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(E+=` and next bandwidth > current bandwidth (${N} > ${O})`),f(E),!0}return f(`not ${g} as no switching criteria met`),!1};class v8 extends Fe.EventTarget{constructor(e){super(),this.fastQualityChange_=m8(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:a,bandwidth:l,externVhs:u,useCueTags:h,playlistExclusionDuration:f,enableLowInitialPlaylist:g,sourceType:_,cacheEncryptionKeys:S,bufferBasedABR:C,leastPixelDiffSelector:N,captionServices:O,experimentalUseMMS:E}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:B}=e;(B===null||typeof B>"u")&&(B=1/0),go=u,this.bufferBasedABR=!!C,this.leastPixelDiffSelector=!!N,this.withCredentials=i,this.tech_=a,this.vhs_=a.vhs,this.player_=e.player_,this.sourceType_=_,this.useCueTags_=h,this.playlistExclusionDuration=f,this.maxPlaylistRetries=B,this.enableLowInitialPlaylist=g,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:B,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=h8(),E&&de.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new de.ManagedMediaSource,this.usingManagedMediaSource_=!0,Fe.log("Using ManagedMediaSource")):de.MediaSource&&(this.mediaSource=new de.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=cr(),this.hasPlayed_=!1,this.syncController_=new JR(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new n8,this.sourceUpdater_=new ck(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new e8,this.keyStatusMap_=new Map;const H={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:O,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:l,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:S,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new oy(t,this.vhs_,ri(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new su(t,this.vhs_,ri(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new cy(ri(H,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new cy(ri(H,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new WR(ri(H,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((re,W)=>{function X(){a.off("vttjserror",R),re()}function R(){a.off("vttjsloaded",X),W()}a.one("vttjsloaded",X),a.one("vttjserror",R),a.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new f8(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),g8.forEach(re=>{this[re+"_"]=y8.bind(this,re)}),this.logger_=xs("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const re=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-re,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const a=this.media(),l=a&&(a.id||a.uri),u=e&&(e.id||e.uri);if(l&&l!==u){this.logger_(`switch media ${l} -> ${u} from ${t}`);const h={renditionInfo:{id:u,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:h}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,a=this.contentSteeringController_.getPathway();if(i&&a){const u=(i.length?i[0].playlists:i.playlists).filter(h=>h.attributes.serviceLocation===a);u.length&&this.mediaTypes_[e].activePlaylistLoader.media(u[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=de.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(de.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,a=Object.keys(i);let l;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)l=this.mediaTypes_.AUDIO.activeTrack();else{const h=i.main||a.length&&i[a[0]];for(const f in h)if(h[f].default){l={label:f};break}}if(!l)return t;const u=[];for(const h in i)if(i[h][l.label]){const f=i[h][l.label];if(f.playlists&&f.playlists.length)u.push.apply(u,f.playlists);else if(f.uri)u.push(f);else if(e.playlists.length)for(let g=0;g{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;ny(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),d8({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;ny(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(Xi({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let a=!0;const l=Object.keys(i.AUDIO);for(const u in i.AUDIO)for(const h in i.AUDIO[u])i.AUDIO[u][h].uri||(a=!1);a&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),go.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),l.length&&Object.keys(i.AUDIO[l[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),a=this.bufferLowWaterLine(),l=this.bufferHighWaterLine(),u=this.tech_.buffered();return b8({buffered:u,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const a=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(a)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:p8}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.audioSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.subtitleSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const a=go.Playlist.playlistEnd(e,i),l=this.tech_.currentTime(),u=this.tech_.buffered();if(!u.length)return a-l<=Qs;const h=u.end(u.length-1);return h-l<=Qs&&a-h<=Qs}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const a=this.mainPlaylistLoader_.main.playlists,l=a.filter(S0),u=l.length===1&&l[0]===e;if(a.length===1&&i!==1/0)return Fe.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(u);if(u){if(this.main().contentSteering){const O=this.pathwayAttribute_(e),E=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(O),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(O)},E);return}let N=!1;a.forEach(O=>{if(O===e)return;const E=O.excludeUntil;typeof E<"u"&&E!==1/0&&(N=!0,delete O.excludeUntil)}),N&&(Fe.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let h;e.playlistErrors_>this.maxPlaylistRetries?h=1/0:h=Date.now()+i*1e3,e.excludeUntil=h,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const f=this.selectPlaylist();if(!f){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const g=t.internal?this.logger_:Fe.log.warn,_=t.message?" "+t.message:"";g(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${_} Switching to playlist ${f.id}.`),f.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),f.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const S=f.targetDuration/2*1e3||5*1e3,C=typeof f.lastRequest=="number"&&Date.now()-f.lastRequest<=S;return this.switchMedia_(f,"exclude",u||C)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],a=e==="all";(a||e==="main")&&i.push(this.mainPlaylistLoader_);const l=[];(a||e==="audio")&&l.push("AUDIO"),(a||e==="subtitle")&&(l.push("CLOSED-CAPTIONS"),l.push("SUBTITLES")),l.forEach(u=>{const h=this.mediaTypes_[u]&&this.mediaTypes_[u].activePlaylistLoader;h&&i.push(h)}),["main","audio","subtitle"].forEach(u=>{const h=this[`${u}SegmentLoader_`];h&&(e===u||e==="all")&&i.push(h)}),i.forEach(u=>t.forEach(h=>{typeof u[h]=="function"&&u[h]()}))}setCurrentTime(e){const t=ru(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:go.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const a=this.syncController_.getMediaSequenceSync(t);if(a&&a.isReliable){const h=a.start,f=a.end;if(!isFinite(h)||!isFinite(f))return null;const g=go.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),_=Math.max(h,f-g);return cr([[h,_]])}const l=this.syncController_.getExpiredTime(i,this.duration());if(l===null)return null;const u=go.Playlist.seekable(i,l,go.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return u.length?u:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),a=e.end(0),l=t.start(0),u=t.end(0);return l>a||i>u?e:cr([[Math.max(i,l),Math.min(a,u)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${TS(this.seekable_)}]`);const a={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:a}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const a=this.seekable();if(!a.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(a=>{a.playlistLoader&&a.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=od(this.main(),t),a={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(a.video=i.video||e.main.videoCodec||oD),e.main.isMuxed&&(a.video+=`,${i.audio||e.main.audioCodec||g2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||l)&&(a.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||g2,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!a.audio&&!a.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const u=(g,_)=>g?nd(_,this.usingManagedMediaSource_):Xp(_),h={};let f;if(["video","audio"].forEach(function(g){if(a.hasOwnProperty(g)&&!u(e[g].isFmp4,a[g])){const _=e[g].isFmp4?"browser":"muxer";h[_]=h[_]||[],h[_].push(a[g]),g==="audio"&&(f=_)}}),l&&f&&t.attributes.AUDIO){const g=t.attributes.AUDIO;this.main().playlists.forEach(_=>{(_.attributes&&_.attributes.AUDIO)===g&&_!==t&&(_.excludeUntil=1/0)}),this.logger_(`excluding audio group ${g} as ${f} does not support codec(s): "${a.audio}"`)}if(Object.keys(h).length){const g=Object.keys(h).reduce((_,S)=>(_&&(_+=", "),_+=`${S} does not support codec(s): "${h[S].join(",")}"`,_),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:g},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const g=[];if(["video","audio"].forEach(_=>{const S=(Ks(this.sourceUpdater_.codecs[_]||"")[0]||{}).type,C=(Ks(a[_]||"")[0]||{}).type;S&&C&&S.toLowerCase()!==C.toLowerCase()&&g.push(`"${this.sourceUpdater_.codecs[_]}" -> "${a[_]}"`)}),g.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${g.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return a}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const a=e[i];if(t.indexOf(a.id)!==-1)return;t.push(a.id);const l=od(this.main,a),u=[];l.audio&&!Xp(l.audio)&&!nd(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!Xp(l.video)&&!nd(l.video,this.usingManagedMediaSource_)&&u.push(`video codec ${l.video}`),l.text&&l.text==="stpp.ttml.im1t"&&u.push(`text codec ${l.text}`),u.length&&(a.excludeUntil=1/0,this.logger_(`excluding ${a.id} for unsupported: ${u.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,a=yd(Ks(e)),l=u_(a),u=a.video&&Ks(a.video)[0]||null,h=a.audio&&Ks(a.audio)[0]||null;Object.keys(i).forEach(f=>{const g=i[f];if(t.indexOf(g.id)!==-1||g.excludeUntil===1/0)return;t.push(g.id);const _=[],S=od(this.mainPlaylistLoader_.main,g),C=u_(S);if(!(!S.audio&&!S.video)){if(C!==l&&_.push(`codec count "${C}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const N=S.video&&Ks(S.video)[0]||null,O=S.audio&&Ks(S.audio)[0]||null;N&&u&&N.type.toLowerCase()!==u.type.toLowerCase()&&_.push(`video codec "${N.type}" !== "${u.type}"`),O&&h&&O.type.toLowerCase()!==h.type.toLowerCase()&&_.push(`audio codec "${O.type}" !== "${h.type}"`)}_.length&&(g.excludeUntil=1/0,this.logger_(`excluding ${g.id}: ${_.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),YR(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=lr.GOAL_BUFFER_LENGTH,i=lr.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,lr.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=lr.BUFFER_LOW_WATER_LINE,i=lr.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,lr.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,lr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return lr.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){y_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),NR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();y_(this.inbandTextTracks_,e,this.tech_),ER({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:a,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(Xi({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const l=this.contentSteeringController_.getAvailablePathways(),u=[];for(const h of t.playlists){const f=h.attributes.serviceLocation;if(f&&(u.push(f),!l.has(f)))return!0}return!!(!u.length&&l.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,a=new Set;let l=!1;Object.keys(i).forEach(u=>{const h=i[u],f=this.pathwayAttribute_(h),g=f&&e!==f;h.excludeUntil===1/0&&h.lastExcludeReason_==="content-steering"&&!g&&(delete h.excludeUntil,delete h.lastExcludeReason_,l=!0);const S=!h.excludeUntil&&h.excludeUntil!==1/0;!a.has(h.id)&&g&&S&&(a.add(h.id),h.excludeUntil=1/0,h.lastExcludeReason_="content-steering",this.logger_(`excluding ${h.id} for ${h.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(u=>{const h=this.mediaTypes_[u];if(h.activePlaylistLoader){const f=h.activePlaylistLoader.media_;f&&f.attributes.serviceLocation!==e&&(l=!0)}}),l&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,a=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||a&&a.size){for(const[u,h]of i.entries())a.get(u)||(this.mainPlaylistLoader_.updateOrDeleteClone(h),this.contentSteeringController_.excludePathway(u));for(const[u,h]of a.entries()){const f=i.get(u);if(!f){t.filter(_=>_.attributes["PATHWAY-ID"]===h["BASE-ID"]).forEach(_=>{this.mainPlaylistLoader_.addClonePathway(h,_)}),this.contentSteeringController_.addAvailablePathway(u);continue}this.equalPathwayClones_(f,h)||(this.mainPlaylistLoader_.updateOrDeleteClone(h,!0),this.contentSteeringController_.addAvailablePathway(u))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...a])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,a=t["URI-REPLACEMENT"].PARAMS;for(const l in i)if(i[l]!==a[l])return!1;for(const l in a)if(i[l]!==a[l])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=this.mainPlaylistLoader_.getKeyIdSet(i);!a||!a.size||a.forEach(l=>{const u="usable",h=this.keyStatusMap_.has(l)&&this.keyStatusMap_.get(l)===u,f=i.lastExcludeReason_===t&&i.excludeUntil===1/0;h?h&&f&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${l} is ${u}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${l} doesn't exist in the keyStatusMap or is not ${u}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,l=i.excludeUntil===1/0&&i.lastExcludeReason_===t;a&&l&&(delete i.excludeUntil,Fe.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const l=(typeof e=="string"?e:GR(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${l} added to the keyStatusMap`),this.keyStatusMap_.set(l,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const x8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=ib(a),u=S0(a);if(typeof i>"u")return u;i?delete a.disabled:a.disabled=!0;const h={renditionInfo:{id:e,bandwidth:a.attributes.BANDWIDTH,resolution:a.attributes.RESOLUTION,codecs:a.attributes.CODECS},cause:"fast-quality"};return i!==u&&!l&&(i?(t(a),n.trigger({type:"renditionenabled",metadata:h})):n.trigger({type:"renditiondisabled",metadata:h})),i};class _8{constructor(e,t,i){const{playlistController_:a}=e,l=a.fastQualityChange_.bind(a);if(t.attributes){const u=t.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=od(a.main(),t),this.playlist=t,this.id=i,this.enabled=x8(e.playlists,t.id,l)}}const w8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=Cd(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!ib(i)).map((i,a)=>new _8(n,i,i.id)):[]}},A_=["seeking","seeked","pause","playing","error"];class T8 extends Fe.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=xs("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),a=()=>this.techWaiting_(),l=()=>this.resetTimeUpdate_(),u=this.playlistController_,h=["main","subtitle","audio"],f={};h.forEach(_=>{f[_]={reset:()=>this.resetSegmentDownloads_(_),updateend:()=>this.checkSegmentDownloads_(_)},u[`${_}SegmentLoader_`].on("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].on("playlistupdate",f[_].reset),this.tech_.on(["seeked","seeking"],f[_].reset)});const g=_=>{["main","audio"].forEach(S=>{u[`${S}SegmentLoader_`][_]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),g("off"))},this.clearSeekingAppendCheck_=()=>g("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),g("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",a),this.tech_.on(A_,l),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",a),this.tech_.off(A_,l),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),h.forEach(_=>{u[`${_}SegmentLoader_`].off("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].off("playlistupdate",f[_].reset),this.tech_.off(["seeked","seeking"],f[_].reset)}),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&de.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=de.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],a=i.buffered_(),l=lj(this[`${e}Buffered_`],a);if(this[`${e}Buffered_`]=a,l){const u={bufferedRanges:a};t.trigger({type:"bufferedrangeschanged",metadata:u}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:ul(a)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Qs>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(cr([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),a=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let l;if(a&&(l=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const O=t.start(0);l=O+(O===t.end(0)?0:Qs)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${TS(t)}. Seeking to ${l}.`),this.tech_.setCurrentTime(l),!0;const u=this.playlistController_.sourceUpdater_,h=this.tech_.buffered(),f=u.audioBuffer?u.audioBuffered():null,g=u.videoBuffer?u.videoBuffered():null,_=this.media(),S=_.partTargetDuration?_.partTargetDuration:(_.targetDuration-Ys)*2,C=[f,g];for(let O=0;O ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const h=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${h}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(h),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,a=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const u=Zh(a,t);return u.length>0?(this.logger_(`Stopped at ${t} and seeking to ${u.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,a=!1){if(!e.length)return!1;let l=e.end(e.length-1)+Qs;const u=!i.endList,h=typeof i.partTargetDuration=="number";return u&&(h||a)&&(l=e.end(e.length-1)+i.targetDuration*3),t>l}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:l,end:u}}return null}}const S8={errorInterval:30,getSource(n){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return n(t)}},mk=function(n,e){let t=0,i=0;const a=ri(S8,e);n.ready(()=>{n.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const l=function(){i&&n.currentTime(i)},u=function(_){_!=null&&(i=n.duration()!==1/0&&n.currentTime()||0,n.one("loadedmetadata",l),n.src(_),n.trigger({type:"usage",name:"vhs-error-reload"}),n.play())},h=function(){if(Date.now()-t{Object.defineProperty(Li,n,{get(){return Fe.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),lr[n]},set(e){if(Fe.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Fe.log.warn(`value of Vhs.${n} must be greater than or equal to 0`);return}lr[n]=e}})});const gk="videojs-vhs",yk=function(n,e){const t=e.media();let i=-1;for(let a=0;a{n.addQualityLevel(t)}),yk(n,e.playlists)};Li.canPlaySource=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const M8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=yd(Ks(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const a=_u(i.video),l=_u(i.audio),u={};for(const h in n)u[h]={},l&&(u[h].audioContentType=l),a&&(u[h].videoContentType=a),e.contentProtection&&e.contentProtection[h]&&e.contentProtection[h].pssh&&(u[h].pssh=e.contentProtection[h].pssh),typeof n[h]=="string"&&(u[h].url=n[h]);return ri(n,u)},j8=(n,e)=>n.reduce((t,i)=>{if(!i.contentProtection)return t;const a=e.reduce((l,u)=>{const h=i.contentProtection[u];return h&&h.pssh&&(l[u]={pssh:h.pssh}),l},{});return Object.keys(a).length&&t.push(a),t},[]),R8=({player:n,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!n.eme.initializeMediaKeys)return Promise.resolve();const a=t?i.concat([t]):i,l=j8(a,Object.keys(e)),u=[],h=[];return l.forEach(f=>{h.push(new Promise((g,_)=>{n.tech_.one("keysessioncreated",g)})),u.push(new Promise((g,_)=>{n.eme.initializeMediaKeys({keySystems:f},S=>{if(S){_(S);return}g()})}))}),Promise.race([Promise.all(u),Promise.race(h)])},O8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=M8(e,t,i);return a?(n.currentSource().keySystems=a,a&&!n.eme?(Fe.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},bk=()=>{if(!de.localStorage)return null;const n=de.localStorage.getItem(gk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},L8=n=>{if(!de.localStorage)return!1;let e=bk();e=e?ri(e,n):n;try{de.localStorage.setItem(gk,JSON.stringify(e))}catch{return!1}return e},I8=n=>n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n,vk=(n,e)=>{n._requestCallbackSet||(n._requestCallbackSet=new Set),n._requestCallbackSet.add(e)},xk=(n,e)=>{n._responseCallbackSet||(n._responseCallbackSet=new Set),n._responseCallbackSet.add(e)},_k=(n,e)=>{n._requestCallbackSet&&(n._requestCallbackSet.delete(e),n._requestCallbackSet.size||delete n._requestCallbackSet)},wk=(n,e)=>{n._responseCallbackSet&&(n._responseCallbackSet.delete(e),n._responseCallbackSet.size||delete n._responseCallbackSet)};Li.supportsNativeHls=(function(){if(!xt||!xt.createElement)return!1;const n=xt.createElement("video");return Fe.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(n.canPlayType(t))}):!1})();Li.supportsNativeDash=(function(){return!xt||!xt.createElement||!Fe.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(xt.createElement("video").canPlayType("application/dash+xml"))})();Li.supportsTypeNatively=n=>n==="hls"?Li.supportsNativeHls:n==="dash"?Li.supportsNativeDash:!1;Li.isSupported=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Li.xhr.onRequest=function(n){vk(Li.xhr,n)};Li.xhr.onResponse=function(n){xk(Li.xhr,n)};Li.xhr.offRequest=function(n){_k(Li.xhr,n)};Li.xhr.offResponse=function(n){wk(Li.xhr,n)};const B8=Fe.getComponent("Component");class Tk extends B8{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=xs("VhsHandler"),t.options_&&t.options_.playerId){const a=Fe.getPlayer(t.options_.playerId);this.player_=a}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(xt,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],a=>{const l=xt.fullscreenElement||xt.webkitFullscreenElement||xt.mozFullScreenElement||xt.msFullscreenElement;l&&l.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=ri(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=bk();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=lr.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===lr.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=I8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Li,this.options_.sourceType=qw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new v8(this.options_);const i=ri({liveRangeSafeTimeDelta:Qs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new T8(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const l=Fe.players[this.tech_.options_.playerId];let u=this.playlistController_.error;typeof u=="object"&&!u.code?u.code=3:typeof u=="string"&&(u={message:u,code:3}),l.error(u)});const a=this.options_.bufferBasedABR?Li.movingAverageBandwidthSelector(.55):Li.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Li.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(l){this.playlistController_.selectPlaylist=l.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(l){this.playlistController_.mainSegmentLoader_.throughput.rate=l,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let l=this.playlistController_.mainSegmentLoader_.bandwidth;const u=de.navigator.connection||de.navigator.mozConnection||de.navigator.webkitConnection,h=1e7;if(this.options_.useNetworkInformationApi&&u){const f=u.downlink*1e3*1e3;f>=h&&l>=h?l=Math.max(l,f):l=f}return l},set(l){this.playlistController_.mainSegmentLoader_.bandwidth=l,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const l=1/(this.bandwidth||1);let u;return this.throughput>0?u=1/this.throughput:u=0,Math.floor(1/(l+u))},set(){Fe.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>ul(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ul(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&L8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{w8(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=de.URL.createObjectURL(this.playlistController_.mediaSource),(Fe.browser.IS_ANY_SAFARI||Fe.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),R8({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=O8({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=Fe.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{D8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{yk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":pk,"mux.js":E8,"mpd-parser":C8,"m3u8-parser":A8,"aes-decrypter":N8}}version(){return this.constructor.version()}canChangeType(){return ck.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&de.URL.revokeObjectURL&&(de.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return zj({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return KS({programTime:e,playlist:this.playlistController_.media(),retryCount:a,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{vk(this.xhr,e)},this.xhr.onResponse=e=>{xk(this.xhr,e)},this.xhr.offRequest=e=>{_k(this.xhr,e)},this.xhr.offResponse=e=>{wk(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,a=>{this.player_.trigger(Xi({},a))})}),t.forEach(i=>{this.playbackWatcher_.on(i,a=>{this.player_.trigger(Xi({},a))})})}}const Vf={name:"videojs-http-streaming",VERSION:pk,canHandleSource(n,e={}){const t=ri(Fe.options,e);return!t.vhs.experimentalUseMMS&&!nd("avc1.4d400d,mp4a.40.2",!1)?!1:Vf.canPlayType(n.type,t)},handleSource(n,e,t={}){const i=ri(Fe.options,t);return e.vhs=new Tk(n,e,i),e.vhs.xhr=$S(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=qw(n);if(!t)return"";const i=Vf.getOverrideNative(e);return!Li.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(n={}){const{vhs:e={}}=n,t=!(Fe.browser.IS_ANY_SAFARI||Fe.browser.IS_IOS),{overrideNative:i=t}=e;return i}},P8=()=>nd("avc1.4d400d,mp4a.40.2",!0);P8()&&Fe.getTech("Html5").registerSourceHandler(Vf,0);Fe.VhsHandler=Tk;Fe.VhsSourceHandler=Vf;Fe.Vhs=Li;Fe.use||Fe.registerComponent("Vhs",Li);Fe.options.vhs=Fe.options.vhs||{};(!Fe.getPlugin||!Fe.getPlugin("reloadSourceOnError"))&&Fe.registerPlugin("reloadSourceOnError",k8);const F8="",rl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${F8}${e}`};async function gg(n,e){const t=await fetch(rl(n),{...e,credentials:"include",headers:{...e?.headers??{},"Content-Type":e?.headers?.["Content-Type"]??"application/json"}});return t.status===401&&(location.pathname.startsWith("/login")||(location.href="/login")),t}function ob({src:n,muted:e=Sf,className:t}){const i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null);return p.useEffect(()=>{let f=!1,g=null;const _=i.current;if(!_)return;l(!1),h(null),cd(_,{muted:e});const S=()=>{try{_.pause(),_.removeAttribute("src"),_.load()}catch{}};S(),_.src=n,_.load(),_.play().catch(()=>{});let C=Date.now();const N=()=>{C=Date.now()};_.addEventListener("timeupdate",N),g=window.setInterval(()=>{f||!_.paused&&Date.now()-C>12e3&&(S(),_.src=n,_.load(),_.play().catch(()=>{}),C=Date.now())},4e3);const O=()=>{l(!0)};return _.addEventListener("error",O),()=>{f=!0,g&&window.clearInterval(g),g=null,_.removeEventListener("timeupdate",N),_.removeEventListener("error",O),S()}},[n,e]),a?c.jsx("div",{className:"text-xs text-gray-400 italic",children:u==="private"?"Private":u==="offline"?"Offline":"–"}):c.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const f=i.current;f&&(f.muted=!1,f.play().catch(()=>{}))}})}const ms=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",lb=n=>n.startsWith("HOT ")?n.slice(4):n,U8=n=>(n||"").trim().toLowerCase(),z8=n=>{const e=String(n??"").trim();if(!e)return[];const t=e.split(/[\n,;|]+/g).map(l=>l.trim()).filter(Boolean),i=new Set,a=[];for(const l of t){const u=l.toLowerCase();i.has(u)||(i.add(u),a.push(l))}return a.sort((l,u)=>l.localeCompare(u,void 0,{sensitivity:"base"})),a};function $8(n){if(!Number.isFinite(n)||n<=0)return"—";const e=Math.floor(n/1e3),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}h ${i}m`:i>0?`${i}m ${a}s`:`${a}s`}function H8(n){if(typeof n!="number"||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function N_(n){if(!n)return"—";const e=n instanceof Date?n:new Date(n),t=e.getTime();return Number.isFinite(t)?e.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}const tf=(...n)=>{for(const e of n){const t=typeof e=="string"?Number(e):e;if(typeof t=="number"&&Number.isFinite(t)&&t>0)return t}return null};function q8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function V8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function G8(n){const e=ms(n||""),t=lb(e);if(!t)return null;const a=t.replace(/\.[^.]+$/,"").match(/_(\d{1,2})_(\d{1,2})_(\d{4})__(\d{1,2})-(\d{2})-(\d{2})$/);if(!a)return null;const l=Number(a[1]),u=Number(a[2]),h=Number(a[3]),f=Number(a[4]),g=Number(a[5]),_=Number(a[6]);return[l,u,h,f,g,_].every(S=>Number.isFinite(S))?new Date(h,l-1,u,f,g,_):null}const K8=n=>{const e=ms(n||""),t=lb(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i},W8=n=>{const e=n,t=e.sizeBytes??e.fileSizeBytes??e.bytes??e.size??null;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null};function _a(...n){return n.filter(Boolean).join(" ")}function X8(n){const[e,t]=p.useState(!1);return p.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}function Y8(n){!n||n.__absTimelineShimInstalled||(n.__absTimelineShimInstalled=!0,n.__origCurrentTime=n.currentTime.bind(n),n.__origDuration=n.duration.bind(n),n.__setRelativeTime=e=>{try{n.__origCurrentTime(Math.max(0,e||0))}catch{}},n.currentTime=function(e){const t=Number(this.__timeOffsetSec??0)||0;if(typeof e=="number"&&Number.isFinite(e)){const a=Math.max(0,e);return typeof this.__serverSeekAbs=="function"?(this.__serverSeekAbs(a),a):this.__origCurrentTime(Math.max(0,a-t))}const i=Number(this.__origCurrentTime()??0)||0;return Math.max(0,t+i)},n.duration=function(){const e=Number(this.__fullDurationSec??0)||0;if(e>0)return e;const t=Number(this.__timeOffsetSec??0)||0,i=Number(this.__origDuration()??0)||0;return Math.max(0,t+i)})}function Q8({job:n,expanded:e,onClose:t,onToggleExpand:i,modelKey:a,modelsByKey:l,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onKeep:_,onDelete:S,onToggleHot:C,onToggleFavorite:N,onToggleLike:O,onToggleWatch:E,onStopJob:B,startMuted:H=KN,startAtSec:Y=0}){const U=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),re=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),W=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),X=p.useMemo(()=>H8(W8(n)),[n]),R=n,[le,k]=p.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[j,Z]=p.useState(()=>n.status==="running"),[V,ne]=p.useState(()=>({h:0,fps:null})),me=n.status==="running",[ue,q]=p.useState(!1),P=me&&ue,Q=p.useMemo(()=>(W||"").replace(/\.[^.]+$/,""),[W]),te=p.useMemo(()=>me?n.id:Q||n.id,[me,n.id,Q]);p.useEffect(()=>{if(me||le>0)return;const se=ms(n.output?.trim()||"");if(!se)return;let I=!0;const ce=new AbortController;return(async()=>{try{const pe=rl(`/api/record/done/meta?file=${encodeURIComponent(se)}`),Ce=await gg(pe,{signal:ce.signal,cache:"no-store"});if(!Ce.ok)return;const Ae=await Ce.json(),z=Number(Ae?.durationSeconds||Ae?.meta?.durationSeconds||0)||0;if(!I||z<=0)return;k(z);const G=$e.current;if(G&&!G.isDisposed?.())try{G.__fullDurationSec=z,G.trigger?.("durationchange"),G.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{I=!1,ce.abort()}},[me,le,n.output]);const ge=re.startsWith("HOT "),L=p.useMemo(()=>{const se=(a||"").trim();return se||K8(n.output)},[a,n.output]),xe=p.useMemo(()=>lb(re),[re]),Te=p.useMemo(()=>{const se=Number(le||0)||0;return se>0?$8(se*1e3):"—"},[le]),ye=p.useMemo(()=>{const se=G8(n.output);if(se)return N_(se);const I=R.startedAt??R.endedAt??R.createdAt??R.fileCreatedAt??R.ctime??null,ce=I?new Date(I):null;return N_(ce&&Number.isFinite(ce.getTime())?ce:null)},[n.output,R.startedAt,R.endedAt,R.createdAt,R.fileCreatedAt,R.ctime]),be=p.useMemo(()=>U8((a||L||"").trim()),[a,L]),mt=p.useMemo(()=>{const se=l?.[be];return z8(se?.tags)},[l,be]),Ke=p.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(te)}&file=preview.webp`),[te]),we=p.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(te)}&play=1&file=index_hq.m3u8`),[te]),[Re,ct]=p.useState(Ke);p.useEffect(()=>{ct(Ke)},[Ke]);const Oe=p.useMemo(()=>tf(V.h,R.videoHeight,R.height,R.meta?.height),[V.h,R.videoHeight,R.height,R.meta?.height]),je=p.useMemo(()=>tf(V.fps,R.fps,R.frameRate,R.meta?.fps,R.meta?.frameRate),[V.fps,R.fps,R.frameRate,R.meta?.fps,R.meta?.frameRate]),[Ue,ze]=p.useState(null),gt=p.useMemo(()=>V8(Ue??Oe),[Ue,Oe]),st=p.useMemo(()=>q8(je),[je]);p.useEffect(()=>{const se=I=>I.key==="Escape"&&t();return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[t]);const bt=p.useMemo(()=>{const se=`/api/preview?id=${encodeURIComponent(te)}&file=index_hq.m3u8&play=1`;return rl(me?`${se}&t=${Date.now()}`:se)},[te,me]);p.useEffect(()=>{if(!me){q(!1);return}let se=!0;const I=new AbortController;return q(!1),(async()=>{for(let pe=0;pe<120&&se&&!I.signal.aborted;pe++){try{const Ce=await gg(bt,{method:"GET",cache:"no-store",signal:I.signal,headers:{"cache-control":"no-cache"}});if(Ce.ok){const Ae=await Ce.text(),z=Ae.includes("#EXTM3U"),G=/#EXTINF:/i.test(Ae)||/\.ts(\?|$)/i.test(Ae)||/\.m4s(\?|$)/i.test(Ae);if(z&&G){se&&q(!0);return}}}catch{}await new Promise(Ce=>setTimeout(Ce,500))}})(),()=>{se=!1,I.abort()}},[me,bt]);const Qe=p.useCallback(se=>{const I=new URLSearchParams;return se.file&&I.set("file",se.file),se.id&&I.set("id",se.id),rl(`/api/record/video?${I.toString()}`)},[]),Ye=p.useMemo(()=>{if(me)return{src:"",type:""};if(!j)return{src:"",type:""};const se=ms(n.output?.trim()||"");if(se){const I=se.toLowerCase().split(".").pop(),ce=I==="mp4"?"video/mp4":I==="ts"?"video/mp2t":"application/octet-stream";return{src:Qe({file:se}),type:ce}}return{src:Qe({id:n.id}),type:"video/mp4"}},[me,j,n.output,n.id,Qe]),tt=p.useRef(null),$e=p.useRef(null),ht=p.useRef(null),[At,he]=p.useState(!1),Ie=p.useCallback(()=>{const se=$e.current;if(!se||se.isDisposed?.())return;const I=typeof se.videoHeight=="function"?se.videoHeight():0;typeof I=="number"&&I>0&&Number.isFinite(I)&&ze(I)},[]),Le=p.useCallback(()=>{try{const se=$e.current?.tech?.(!0)?.el?.()||$e.current?.el?.()?.querySelector?.("video.vjs-tech")||ht.current;if(!se||!(se instanceof HTMLVideoElement))return null;const I=Number(se.videoWidth||0),ce=Number(se.videoHeight||0);if(!Number.isFinite(I)||!Number.isFinite(ce)||I<=0||ce<=0)return null;let pe=Mn.current;pe||(pe=document.createElement("canvas"),Mn.current=pe);const Ae=Math.min(1,640/I),z=Math.max(1,Math.round(I*Ae)),G=Math.max(1,Math.round(ce*Ae));pe.width!==z&&(pe.width=z),pe.height!==G&&(pe.height=G);const ee=pe.getContext("2d",{alpha:!1});return ee?(ee.drawImage(se,0,0,z,G),pe.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),ke=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),Pe=p.useMemo(()=>{const se=Number(Y);return Number.isFinite(se)&&se>=0?se:0},[Y]),et=p.useRef("");p.useEffect(()=>{if(me){Z(!0);return}const se=ms(n.output?.trim()||"");if(!se){Z(!0);return}let I=!0;const ce=new AbortController;return Z(!1),(async()=>{for(let pe=0;pe<80&&I&&!ce.signal.aborted;pe++){try{const Ce=rl(`/api/record/done/meta?file=${encodeURIComponent(se)}`),Ae=await gg(Ce,{signal:ce.signal,cache:"no-store"});if(Ae.ok){const z=await Ae.json(),G=!!z?.metaExists,ee=Number(z?.durationSeconds||0)||0,ae=Number(z?.height||0)||0,Be=Number(z?.fps||0)||0;if(ee>0){k(ee);const Je=$e.current;if(Je&&!Je.isDisposed?.())try{Je.__fullDurationSec=ee,Je.trigger?.("durationchange"),Je.trigger?.("timeupdate")}catch{}}if(ae>0&&ne({h:ae,fps:Be>0?Be:null}),G){Z(!0);return}}}catch{}await new Promise(Ce=>setTimeout(Ce,250))}I&&Z(!0)})(),()=>{I=!1,ce.abort()}},[me,ke,n.output]);const[,kt]=p.useState(0);p.useEffect(()=>{if(typeof window>"u")return;const se=window.visualViewport;if(!se)return;const I=()=>kt(ce=>ce+1);return I(),se.addEventListener("resize",I),se.addEventListener("scroll",I),window.addEventListener("resize",I),window.addEventListener("orientationchange",I),()=>{se.removeEventListener("resize",I),se.removeEventListener("scroll",I),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I)}},[]);const[Lt,pt]=p.useState(30),[Zt,qt]=p.useState(null),Gt=!e,wt=X8("(min-width: 640px)"),lt=Gt&&wt,Yt=e||lt,kn="player_window_v1",pn=420,xn=280,rt=12,M=320,F=200;p.useEffect(()=>{if(!At)return;const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.el();if(!I)return;const ce=I.querySelector(".vjs-control-bar");if(!ce)return;const pe=()=>{const Ae=Math.round(ce.getBoundingClientRect().height||0);Ae>0&&pt(Ae)};pe();let Ce=null;return typeof ResizeObserver<"u"&&(Ce=new ResizeObserver(pe),Ce.observe(ce)),window.addEventListener("resize",pe),()=>{window.removeEventListener("resize",pe),Ce?.disconnect()}},[At,e]),p.useEffect(()=>he(!0),[]),p.useEffect(()=>{if(!Yt){qt(null);return}let se=document.getElementById("player-root");se||(se=document.createElement("div"),se.id="player-root");let I=null;if(wt){const ce=Array.from(document.querySelectorAll("dialog[open]"));I=ce.length?ce[ce.length-1]:null}I=I??document.body,I.appendChild(se),se.style.position="relative",se.style.zIndex="2147483647",qt(se)},[wt,Yt]),p.useEffect(()=>{const se=$e.current;if(!se||se.isDisposed?.()||me||(Y8(se),!ms(n.output?.trim()||"")))return;const ce=Number(le||0)||0;return ce>0&&(se.__fullDurationSec=ce),se.__serverSeekAbs=pe=>{const Ce=Math.max(0,Number(pe)||0);try{se.__origCurrentTime?.(Ce);try{se.trigger?.("timeupdate")}catch{}}catch{try{se.currentTime?.(Ce)}catch{}}},()=>{try{delete se.__serverSeekAbs}catch{}}},[n.output,me]),p.useLayoutEffect(()=>{if(!At||!tt.current||$e.current||me||!j)return;const se=document.createElement("video");se.className="video-js vjs-big-play-centered w-full h-full",se.setAttribute("playsinline","true"),tt.current.appendChild(se),ht.current=se;const I=Fe(se,{autoplay:!0,muted:H,controls:!0,preload:"metadata",playsinline:!0,responsive:!0,fluid:!1,fill:!0,liveui:!1,html5:{vhs:{lowLatencyMode:!0}},inactivityTimeout:0,controlBar:{skipButtons:{backward:10,forward:10},volumePanel:{inline:!1},children:["skipBackward","playToggle","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","spacer","playbackRateMenuButton","fullscreenToggle"]},playbackRates:[.5,1,1.25,1.5,2]});return $e.current=I,I.one("loadedmetadata",()=>{Ie()}),I.userActive(!0),I.on("userinactive",()=>I.userActive(!0)),()=>{try{$e.current&&($e.current.dispose(),$e.current=null)}finally{ht.current&&(ht.current.remove(),ht.current=null)}}},[At,H,me,j,Oe,Ie]),p.useEffect(()=>{const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.el();I&&I.classList.toggle("is-live-download",!!P)},[P]);const ie=p.useCallback(()=>{const se=$e.current;if(!(!se||se.isDisposed?.())){try{se.pause(),se.reset?.()}catch{}try{se.src({src:"",type:"video/mp4"}),se.load?.()}catch{}}},[]),De=p.useCallback(se=>{const I=$e.current;if(!I||I.isDisposed?.())return;const ce=Math.max(0,Number(se)||0);try{const pe=Number(I.duration?.()??0),Ce=Number.isFinite(pe)&&pe>0?Math.max(0,pe-.05):ce;I.currentTime(Math.min(ce,Ce)),I.trigger?.("timeupdate")}catch{try{I.currentTime(ce)}catch{}}},[]);p.useEffect(()=>{if(!At)return;if(!me&&!j){ie();return}const se=$e.current;if(!se||se.isDisposed?.())return;const I=se.currentTime()||0;if(se.muted(H),!Ye.src){try{se.pause(),se.reset?.(),se.error(null)}catch{}return}se.__timeOffsetSec=0;const ce=Number(le||0)||0;se.__fullDurationSec=ce;const pe=String(se.currentSrc?.()||"");if(et.current="",pe&&pe===Ye.src){const Ae=se.play?.();Ae&&typeof Ae.catch=="function"&&Ae.catch(()=>{});return}se.src({src:Ye.src,type:Ye.type});const Ce=()=>{const Ae=se.play?.();Ae&&typeof Ae.catch=="function"&&Ae.catch(()=>{})};se.one("loadedmetadata",()=>{if(se.isDisposed?.())return;Ie();try{const z=Number(le||0)||0;z>0&&(se.__fullDurationSec=z)}catch{}try{se.playbackRate(1)}catch{}const Ae=/mpegurl/i.test(Ye.type);if(I>0&&!Ae)try{const z=Number(se.__timeOffsetSec??0)||0,G=Math.max(0,I-z);se.__setRelativeTime?.(G)}catch{}try{se.trigger?.("timeupdate")}catch{}Ce()}),Ce()},[At,me,j,Ye.src,Ye.type,H,Ie,le,ie]),p.useEffect(()=>{if(!At||me||!j||!Ye.src)return;const se=$e.current;if(!se||se.isDisposed?.())return;if(!(Pe>0)){et.current="";return}const I=`${ke}|${Ye.src}|${Pe.toFixed(3)}`;if(et.current===I)return;let ce=!1;const pe=()=>{if(ce)return;const G=$e.current;if(!G||G.isDisposed?.())return;const ee=String(G.currentSrc?.()||"");if(!ee||ee!==Ye.src)return;const ae=G.tech?.(!0)?.el?.()||G.el?.()?.querySelector?.("video.vjs-tech");if(!((ae instanceof HTMLVideoElement?Number(ae.readyState||0):0)<1)){De(Pe),et.current=I;try{const Je=G.play?.();Je&&typeof Je.catch=="function"&&Je.catch(()=>{})}catch{}}};if(pe(),et.current===I)return;const Ce=()=>pe();se.one?.("loadedmetadata",Ce),se.one?.("canplay",Ce),se.one?.("durationchange",Ce);const Ae=window.setTimeout(pe,0),z=window.setTimeout(pe,120);return()=>{ce=!0,window.clearTimeout(Ae),window.clearTimeout(z);try{se.off?.("loadedmetadata",Ce)}catch{}try{se.off?.("canplay",Ce)}catch{}try{se.off?.("durationchange",Ce)}catch{}}},[At,me,j,Ye.src,ke,Pe,De]),p.useEffect(()=>{if(!At)return;const se=$e.current;if(!se||se.isDisposed?.())return;const I=()=>{n.status==="running"&&q(!1)};return se.on("error",I),()=>{try{se.off("error",I)}catch{}}},[At,n.status]),p.useEffect(()=>{const se=$e.current;!se||se.isDisposed?.()||queueMicrotask(()=>se.trigger("resize"))},[e]),p.useEffect(()=>{const se=I=>{const pe=(I.detail?.file??"").trim();if(!pe)return;const Ce=ms(n.output?.trim()||"");Ce&&Ce===pe&&ie()};return window.addEventListener("player:release",se),()=>window.removeEventListener("player:release",se)},[n.output,ie]),p.useEffect(()=>{const se=I=>{const pe=(I.detail?.file??"").trim();if(!pe)return;const Ce=ms(n.output?.trim()||"");Ce&&Ce===pe&&(ie(),t())};return window.addEventListener("player:close",se),()=>window.removeEventListener("player:close",se)},[n.output,ie,t]);const Ve=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const se=window.visualViewport;if(se&&Number.isFinite(se.width)&&Number.isFinite(se.height)){const Ce=Math.floor(se.width),Ae=Math.floor(se.height),z=Math.floor(se.offsetLeft||0),G=Math.floor(se.offsetTop||0),ee=Math.max(0,Math.floor(window.innerHeight-(se.height+se.offsetTop)));return{w:Ce,h:Ae,ox:z,oy:G,bottomInset:ee}}const I=document.documentElement,ce=I?.clientWidth||window.innerWidth,pe=I?.clientHeight||window.innerHeight;return{w:ce,h:pe,ox:0,oy:0,bottomInset:0}},yt=p.useRef(null);p.useEffect(()=>{if(typeof window>"u")return;const{w:se,h:I}=Ve();yt.current={w:se,h:I}},[]);const Vt=p.useCallback(()=>{const se=n,I=tf($e.current?.videoWidth?.(),se.videoWidth,se.width,se.meta?.width)??0,ce=tf(Ue,$e.current?.videoHeight?.(),se.videoHeight,se.height,se.meta?.height)??0;return I>0&&ce>0?I/ce:16/9},[n,Ue]),Jt=p.useCallback(se=>{if(typeof window>"u")return se;const I=Vt(),ce=30,{w:pe,h:Ce}=Ve(),Ae=pe-rt*2,z=Math.max(1,Ce-rt*2-ce),G=Math.max(1,F-ce);let ee=Math.max(M,Math.min(se.w,Ae)),ae=ee/I;aez&&(ae=z,ee=ae*I),ee>Ae&&(ee=Ae,ae=ee/I);const Be=Math.round(ae+ce),Je=Math.max(rt,Math.min(se.x,pe-ee-rt)),We=Math.max(rt,Math.min(se.y,Ce-Be-rt));return{x:Je,y:We,w:Math.round(ee),h:Be}},[Vt]),gn=p.useCallback(()=>{if(typeof window>"u")return{x:rt,y:rt,w:pn,h:xn};try{const z=window.localStorage.getItem(kn);if(z){const G=JSON.parse(z);if(typeof G.x=="number"&&typeof G.y=="number"&&typeof G.w=="number"&&typeof G.h=="number")return Jt({x:G.x,y:G.y,w:G.w,h:G.h})}}catch{}const{w:se,h:I}=Ve(),ce=pn,pe=xn,Ce=Math.max(rt,se-ce-rt),Ae=Math.max(rt,I-pe-rt);return Jt({x:Ce,y:Ae,w:ce,h:pe})},[Jt]),[ln,_n]=p.useState(()=>gn()),En=lt&&ln.w<380,Ut=p.useCallback(se=>{if(!(typeof window>"u"))try{window.localStorage.setItem(kn,JSON.stringify(se))}catch{}},[]),hn=p.useRef(ln);p.useEffect(()=>{hn.current=ln},[ln]),p.useEffect(()=>{lt&&_n(gn())},[lt,gn]),p.useEffect(()=>{if(!lt)return;const se=()=>{const I=yt.current,{w:ce,h:pe}=Ve();_n(Ce=>{if(!I)return Jt(Ce);const Ae=24,z=Ce.x-rt,G=I.w-rt-(Ce.x+Ce.w),ee=I.h-rt-(Ce.y+Ce.h),ae=Math.abs(z)<=Ae,Be=Math.abs(G)<=Ae,Je=Math.abs(ee)<=Ae;let We=Jt(Ce);return Je&&(We={...We,y:Math.max(rt,pe-We.h-rt)}),Be?We={...We,x:Math.max(rt,ce-We.w-rt)}:ae&&(We={...We,x:rt}),Jt(We)}),yt.current={w:ce,h:pe}};return yt.current=(()=>{const{w:I,h:ce}=Ve();return{w:I,h:ce}})(),window.addEventListener("resize",se),()=>window.removeEventListener("resize",se)},[lt,Jt]);const cn=p.useRef(null);p.useEffect(()=>{const se=$e.current;if(!(!se||se.isDisposed?.()))return cn.current!=null&&cancelAnimationFrame(cn.current),cn.current=requestAnimationFrame(()=>{cn.current=null;try{se.trigger("resize")}catch{}}),()=>{cn.current!=null&&(cancelAnimationFrame(cn.current),cn.current=null)}},[lt,ln.w,ln.h]);const[en,zt]=p.useState(!1),[Dt,Ot]=p.useState(!1),[Hn,Rt]=p.useState(null),[qn,_i]=p.useState(null),Mn=p.useRef(null),Wt=p.useRef(null),zn=p.useRef(null),Kn=p.useRef(null),jn=p.useCallback(se=>{const{w:I,h:ce}=Ve(),pe=rt,Ce=I-se.w-rt,Ae=ce-se.h-rt,G=se.x+se.w/2{const I=Kn.current;if(!I)return;const ce=se.clientX-I.sx,pe=se.clientY-I.sy,Ce=I.start,Ae=Jt({x:Ce.x+ce,y:Ce.y+pe,w:Ce.w,h:Ce.h});zn.current={x:Ae.x,y:Ae.y},Rt(jn(Ae)),Wt.current==null&&(Wt.current=requestAnimationFrame(()=>{Wt.current=null;const z=zn.current;z&&_n(G=>({...G,x:z.x,y:z.y}))}))},[Jt,jn]),Cn=p.useCallback(()=>{Kn.current&&(Ot(!1),Rt(null),Wt.current!=null&&(cancelAnimationFrame(Wt.current),Wt.current=null),Kn.current=null,window.removeEventListener("pointermove",Wn),window.removeEventListener("pointerup",Cn),_n(se=>{const I=jn(Jt(se));return queueMicrotask(()=>Ut(I)),I}))},[Wn,jn,Jt,Ut]),fi=p.useCallback(se=>{if(!lt||en||se.button!==0)return;se.preventDefault(),se.stopPropagation();const I=hn.current;Kn.current={sx:se.clientX,sy:se.clientY,start:I},Ot(!0);const ce=Le();_i(ce),Rt(jn(I)),window.addEventListener("pointermove",Wn),window.addEventListener("pointerup",Cn)},[lt,en,Wn,Cn,jn,Le]),Xn=p.useRef(null),li=p.useRef(null),_e=p.useRef(null),at=p.useCallback(se=>{const I=_e.current;if(!I)return;const ce=se.clientX-I.sx,pe=se.clientY-I.sy,Ce=I.ratio,Ae=I.dir.includes("w"),z=I.dir.includes("e"),G=I.dir.includes("n"),ee=I.dir.includes("s");let ae=I.start.w,Be=I.start.h,Je=I.start.x,We=I.start.y;const{w:ut,h:Mt}=Ve(),Nt=24,jt=I.start.x+I.start.w,Qt=I.start.y+I.start.h,Gn=Math.abs(ut-rt-jt)<=Nt,rr=Math.abs(Mt-rt-Qt)<=Nt,dr=wi=>{wi=Math.max(M,wi);let Fi=wi/Ce;return Fi{wi=Math.max(F,wi);let Fi=wi*Ce;return Fi=Math.abs(pe)){const Fi=z?I.start.w+ce:I.start.w-ce,{newW:_s,newH:Do}=dr(Fi);ae=_s,Be=Do}else{const Fi=ee?I.start.h+pe:I.start.h-pe,{newW:_s,newH:Do}=ja(Fi);ae=_s,Be=Do}Ae&&(Je=I.start.x+(I.start.w-ae)),G&&(We=I.start.y+(I.start.h-Be))}else if(z||Ae){const wi=z?I.start.w+ce:I.start.w-ce,{newW:Fi,newH:_s}=dr(wi);ae=Fi,Be=_s,Ae&&(Je=I.start.x+(I.start.w-ae)),We=rr?I.start.y+(I.start.h-Be):I.start.y}else if(G||ee){const wi=ee?I.start.h+pe:I.start.h-pe,{newW:Fi,newH:_s}=ja(wi);ae=Fi,Be=_s,G&&(We=I.start.y+(I.start.h-Be)),Gn?Je=I.start.x+(I.start.w-ae):Je=I.start.x}const os=Jt({x:Je,y:We,w:ae,h:Be});li.current=os,Xn.current==null&&(Xn.current=requestAnimationFrame(()=>{Xn.current=null;const wi=li.current;wi&&_n(wi)}))},[Jt]),Ct=p.useCallback(()=>{_e.current&&(zt(!1),Rt(null),_i(null),Xn.current!=null&&(cancelAnimationFrame(Xn.current),Xn.current=null),_e.current=null,window.removeEventListener("pointermove",at),window.removeEventListener("pointerup",Ct),Ut(hn.current))},[at,Ut]),St=p.useCallback(se=>I=>{if(!lt||I.button!==0)return;I.preventDefault(),I.stopPropagation();const ce=hn.current;_e.current={dir:se,sx:I.clientX,sy:I.clientY,start:ce,ratio:ce.w/ce.h},zt(!0),window.addEventListener("pointermove",at),window.addEventListener("pointerup",Ct)},[lt,at,Ct]),[Pt,tn]=p.useState(!1),[wn,vt]=p.useState(!1);p.useEffect(()=>{const se=window.matchMedia?.("(hover: hover) and (pointer: fine)"),I=()=>tn(!!se?.matches);return I(),se?.addEventListener?.("change",I),()=>se?.removeEventListener?.("change",I)},[]);const fn=lt&&(wn||Dt||en),[Ne,Tt]=p.useState(!1);if(p.useEffect(()=>{n.status!=="running"&&Tt(!1)},[n.id,n.status]),!At||Yt&&!Zt)return null;const _t="inline-flex items-center justify-center rounded-md p-2 transition bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 active:scale-[0.98] dark:bg-black/45 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-500",Ht=String(n.phase??"").toLowerCase(),yn=Ht==="stopping"||Ht==="remuxing"||Ht==="moving",Xt=!B||!me||yn||Ne,On=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:me?c.jsxs(c.Fragment,{children:[c.jsx(sn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Xt,title:yn||Ne?"Stoppe…":"Stop","aria-label":yn||Ne?"Stoppe…":"Stop",onClick:async se=>{if(se.preventDefault(),se.stopPropagation(),!Xt)try{Tt(!0),await B?.(n.id)}finally{Tt(!1)}},className:_a("shadow-none shrink-0",lt&&En&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:yn||Ne?"Stoppe…":lt&&En?"Stop":"Stoppen"})}),c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,busy:yn||Ne,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,isHot:u||ge,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,onToggleHot:C?async se=>{ie(),await new Promise(ce=>setTimeout(ce,150)),await C(se),await new Promise(ce=>setTimeout(ce,0));const I=$e.current;if(I&&!I.isDisposed?.()){const ce=I.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{})}}:void 0,onKeep:_?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await _(se)}:void 0,onDelete:S?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await S(se)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),Vn=e||lt,mi=me?"calc(4px + env(safe-area-inset-bottom))":`calc(${Lt+2}px + env(safe-area-inset-bottom))`,$n="top-2",ji=e&&wt,Bi=c.jsx("div",{className:_a("relative overflow-visible",e||lt?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!lt||!Pt||vt(!0)},onMouseLeave:()=>{!lt||!Pt||vt(!1)},children:c.jsxs("div",{className:_a("relative w-full h-full",lt&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Lt}px`},children:[me?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(ob,{src:we,muted:H,className:"w-full h-full object-contain object-bottom"}),c.jsxs("div",{className:"absolute right-2 bottom-2 z-[60] pointer-events-none inline-flex items-center gap-1.5 rounded-full bg-red-600/90 px-2 py-1 text-[11px] font-semibold text-white shadow-sm",children:[c.jsx("span",{className:"inline-block size-1.5 rounded-full bg-white animate-pulse"}),"Live"]})]}):c.jsx("div",{ref:tt,className:"absolute inset-0"}),c.jsxs("div",{className:_a("absolute inset-x-0 z-30 pointer-events-none","top-0"),children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-16 bg-gradient-to-b from-black/35 to-transparent"}),c.jsx("div",{className:_a("absolute inset-x-2",$n),children:c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2",children:[c.jsx("div",{className:"min-w-0 pointer-events-auto overflow-visible",children:ji?null:On}),lt?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:fi,onClick:se=>{se.preventDefault(),se.stopPropagation()},className:_a(_t,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",fn?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",Dt&&"scale-[0.98] opacity-90"),children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"})]}):null,c.jsxs("div",{className:"shrink-0 flex items-center gap-1 pointer-events-auto",children:[c.jsx("button",{type:"button",className:_t,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(IA,{className:"h-5 w-5"}):c.jsx(PA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:_t,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"h-5 w-5"})})]})]})})]}),c.jsxs("div",{className:_a("player-ui pointer-events-none absolute inset-x-2 z-50","flex items-end justify-between gap-2","transition-all duration-200 ease-out"),style:{bottom:mi},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white",children:L}),c.jsx("div",{className:"truncate text-[11px] text-white/80",children:c.jsxs("span",{className:"inline-flex items-center gap-1 min-w-0 align-middle",children:[c.jsx("span",{className:"truncate",children:xe||U}),u||ge?c.jsx("span",{className:"shrink-0 rounded bg-amber-500/25 px-1.5 py-0.5 font-semibold text-white",children:"HOT"}):null]})})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 text-[11px] text-white",children:[gt!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:gt}):null,me?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Te}),X!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:X}):null]})]})]})}),Yn=c.jsx("div",{className:"w-[360px] shrink-0 border-r border-white/10 bg-black/40 text-white",children:c.jsxs("div",{className:"h-full p-4 flex flex-col gap-3 overflow-y-auto",children:[c.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-white/10 bg-black/30",children:c.jsx("div",{className:"relative aspect-video",children:c.jsx("img",{src:Re,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}})})}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"text-lg font-semibold truncate",children:L}),c.jsx("div",{className:"text-xs text-white/70 break-all",children:xe||U})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[me?c.jsx(sn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Xt,title:yn||Ne?"Stoppe…":"Stop","aria-label":yn||Ne?"Stoppe…":"Stop",onClick:async se=>{if(se.preventDefault(),se.stopPropagation(),!Xt)try{Tt(!0),await B?.(n.id)}finally{Tt(!1)}},className:"shadow-none",children:yn||Ne?"Stoppe…":"Stoppen"}):null,c.jsx(Ds,{job:n,variant:"table",collapseToMenu:!1,busy:yn||Ne,isHot:u||ge,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?se=>E(se):void 0,onToggleFavorite:N?se=>N(se):void 0,onToggleLike:O?se=>O(se):void 0,onToggleHot:C?async se=>{ie(),await new Promise(ce=>setTimeout(ce,150)),await C(se),await new Promise(ce=>setTimeout(ce,0));const I=$e.current;if(I&&!I.isDisposed?.()){const ce=I.play?.();ce&&typeof ce.catch=="function"&&ce.catch(()=>{})}}:void 0,onKeep:_?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await _(se)}:void 0,onDelete:S?async se=>{ie(),t(),await new Promise(I=>setTimeout(I,150)),await S(se)}:void 0,order:me?["watch","favorite","like","details"]:["watch","favorite","like","hot","details","keep","delete"],className:"flex items-center justify-start gap-1"})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-sm",children:[c.jsx("div",{className:"text-white/60",children:"Status"}),c.jsx("div",{className:"font-medium",children:n.status}),c.jsx("div",{className:"text-white/60",children:"Auflösung"}),c.jsx("div",{className:"font-medium",children:gt}),c.jsx("div",{className:"text-white/60",children:"FPS"}),c.jsx("div",{className:"font-medium",children:st}),c.jsx("div",{className:"text-white/60",children:"Laufzeit"}),c.jsx("div",{className:"font-medium",children:Te}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:X}),c.jsx("div",{className:"text-white/60",children:"Datum"}),c.jsx("div",{className:"font-medium",children:ye}),c.jsx("div",{className:"col-span-2",children:mt.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:mt.map(se=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:se},se))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),pi=lt&&Dt&&Hn?c.jsx("div",{className:"pointer-events-none absolute z-0 player-snap-ghost overflow-hidden rounded-lg border-2 border-dashed border-white/70 bg-black/55 shadow-2xl dark:border-white/60",style:{left:Hn.x-ln.x,top:Hn.y-ln.y,width:Hn.w,height:Hn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:qn||Re,alt:"",className:"absolute inset-0 h-full w-full object-contain opacity-80",draggable:!1,onError:()=>{}}),c.jsx("div",{className:"absolute inset-x-0 top-0 h-14 bg-gradient-to-b from-black/55 to-transparent"}),c.jsxs("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 opacity-80",children:[c.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"}),c.jsx("div",{className:"h-8 w-8 rounded-md bg-white/15 ring-1 ring-white/20"})]}),c.jsxs("div",{className:"absolute top-2 left-2 h-8 rounded-md bg-white/12 px-2 flex items-center gap-1 ring-1 ring-white/15",children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-white/50"})]}),c.jsxs("div",{className:"absolute inset-x-2 bottom-2 flex items-end justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white/95",children:L}),c.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[xe||U,u||ge?c.jsx("span",{className:"ml-1.5 rounded bg-amber-500/30 px-1.5 py-0.5 text-white",children:"HOT"}):null]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-[10px] text-white/90",children:[gt!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:gt}):null,!me&&Te!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Te}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,gi=c.jsx(Ns,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:_a("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",Vn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":lt?"rounded-lg":"rounded-none"),bodyClassName:"flex flex-col flex-1 min-h-0 p-0",children:c.jsxs("div",{className:"flex flex-1 min-h-0",children:[ji?Yn:null,Bi]})}),{w:Pn,h:Ri,ox:ei,oy:ti,bottomInset:An}=Ve(),ii={left:ei+16,top:ti+16,width:Math.max(0,Pn-32),height:Math.max(0,Ri-32)},Pi=e?ii:lt?{left:ln.x,top:ln.y,width:ln.w,height:ln.h}:void 0,Oi=c.jsxs(c.Fragment,{children:[c.jsx("style",{children:` /* Live-Download: Progress/Seek-Bar ausblenden */ .is-live-download .vjs-progress-control { display: none !important; } /* ---------- Video.js Layout-Fix (Finished Player) ---------- Ziel: - Video endet immer direkt über der Controlbar - Aspect Ratio bleibt erhalten - Resize stabil (kein "Wandern") */ /* Container schwarz, falls Letterboxing sichtbar wird */ .vjs-mini .video-js, .vjs-mini .video-js .vjs-tech, .vjs-mini .video-js .vjs-poster { background-color: transparent !important; } /* ECHTES Video (