450 lines
1.3 MiB
450 lines
1.3 MiB
function QE(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in n)){const l=Object.getOwnPropertyDescriptor(i,a);l&&Object.defineProperty(n,a,l.get?l:{enumerable:!0,get:()=>i[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 bf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ru(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function ZE(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 y0={exports:{}},Lc={};var i1;function JE(){if(i1)return Lc;i1=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 Lc.Fragment=e,Lc.jsx=t,Lc.jsxs=t,Lc}var r1;function eC(){return r1||(r1=1,y0.exports=JE()),y0.exports}var c=eC(),b0={exports:{}},kn={};var s1;function tC(){if(s1)return kn;s1=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"),w=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),A=Symbol.iterator;function C(L){return L===null||typeof L!="object"?null:(L=A&&L[A]||L["@@iterator"],typeof L=="function"?L:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,B={};function V(L,pe,we){this.props=L,this.context=pe,this.refs=B,this.updater=we||j}V.prototype.isReactComponent={},V.prototype.setState=function(L,pe){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,pe,"setState")},V.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function W(){}W.prototype=V.prototype;function H(L,pe,we){this.props=L,this.context=pe,this.refs=B,this.updater=we||j}var ie=H.prototype=new W;ie.constructor=H,k(ie,V.prototype),ie.isPureReactComponent=!0;var Y=Array.isArray;function G(){}var O={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function E(L,pe,we){var Be=we.ref;return{$$typeof:n,type:L,key:pe,ref:Be!==void 0?Be:null,props:we}}function R(L,pe){return E(L.type,pe,L.props)}function ee(L){return typeof L=="object"&&L!==null&&L.$$typeof===n}function q(L){var pe={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(we){return pe[we]})}var Q=/\/+/g;function ue(L,pe){return typeof L=="object"&&L!==null&&L.key!=null?q(""+L.key):pe.toString(36)}function se(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(G,G):(L.status="pending",L.then(function(pe){L.status==="pending"&&(L.status="fulfilled",L.value=pe)},function(pe){L.status==="pending"&&(L.status="rejected",L.reason=pe)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function $(L,pe,we,Be,Ve){var Oe=typeof L;(Oe==="undefined"||Oe==="boolean")&&(L=null);var Te=!1;if(L===null)Te=!0;else switch(Oe){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(L.$$typeof){case n:case e:Te=!0;break;case w:return Te=L._init,$(Te(L._payload),pe,we,Be,Ve)}}if(Te)return Ve=Ve(L),Te=Be===""?"."+ue(L,0):Be,Y(Ve)?(we="",Te!=null&&(we=Te.replace(Q,"$&/")+"/"),$(Ve,pe,we,"",function(xe){return xe})):Ve!=null&&(ee(Ve)&&(Ve=R(Ve,we+(Ve.key==null||L&&L.key===Ve.key?"":(""+Ve.key).replace(Q,"$&/")+"/")+Te)),pe.push(Ve)),1;Te=0;var _t=Be===""?".":Be+":";if(Y(L))for(var dt=0;dt<L.length;dt++)Be=L[dt],Oe=_t+ue(Be,dt),Te+=$(Be,pe,we,Oe,Ve);else if(dt=C(L),typeof dt=="function")for(L=dt.call(L),dt=0;!(Be=L.next()).done;)Be=Be.value,Oe=_t+ue(Be,dt++),Te+=$(Be,pe,we,Oe,Ve);else if(Oe==="object"){if(typeof L.then=="function")return $(se(L),pe,we,Be,Ve);throw pe=String(L),Error("Objects are not valid as a React child (found: "+(pe==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":pe)+"). If you meant to render a collection of children, use an array instead.")}return Te}function F(L,pe,we){if(L==null)return L;var Be=[],Ve=0;return $(L,Be,"","",function(Oe){return pe.call(we,Oe,Ve++)}),Be}function X(L){if(L._status===-1){var pe=L._result;pe=pe(),pe.then(function(we){(L._status===0||L._status===-1)&&(L._status=1,L._result=we)},function(we){(L._status===0||L._status===-1)&&(L._status=2,L._result=we)}),L._status===-1&&(L._status=0,L._result=pe)}if(L._status===1)return L._result.default;throw L._result}var le=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var pe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(pe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},de={map:F,forEach:function(L,pe,we){F(L,function(){pe.apply(this,arguments)},we)},count:function(L){var pe=0;return F(L,function(){pe++}),pe},toArray:function(L){return F(L,function(pe){return pe})||[]},only:function(L){if(!ee(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return kn.Activity=S,kn.Children=de,kn.Component=V,kn.Fragment=t,kn.Profiler=a,kn.PureComponent=H,kn.StrictMode=i,kn.Suspense=f,kn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,kn.__COMPILER_RUNTIME={__proto__:null,c:function(L){return O.H.useMemoCache(L)}},kn.cache=function(L){return function(){return L.apply(null,arguments)}},kn.cacheSignal=function(){return null},kn.cloneElement=function(L,pe,we){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var Be=k({},L.props),Ve=L.key;if(pe!=null)for(Oe in pe.key!==void 0&&(Ve=""+pe.key),pe)!re.call(pe,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&pe.ref===void 0||(Be[Oe]=pe[Oe]);var Oe=arguments.length-2;if(Oe===1)Be.children=we;else if(1<Oe){for(var Te=Array(Oe),_t=0;_t<Oe;_t++)Te[_t]=arguments[_t+2];Be.children=Te}return E(L.type,Ve,Be)},kn.createContext=function(L){return L={$$typeof:u,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},kn.createElement=function(L,pe,we){var Be,Ve={},Oe=null;if(pe!=null)for(Be in pe.key!==void 0&&(Oe=""+pe.key),pe)re.call(pe,Be)&&Be!=="key"&&Be!=="__self"&&Be!=="__source"&&(Ve[Be]=pe[Be]);var Te=arguments.length-2;if(Te===1)Ve.children=we;else if(1<Te){for(var _t=Array(Te),dt=0;dt<Te;dt++)_t[dt]=arguments[dt+2];Ve.children=_t}if(L&&L.defaultProps)for(Be in Te=L.defaultProps,Te)Ve[Be]===void 0&&(Ve[Be]=Te[Be]);return E(L,Oe,Ve)},kn.createRef=function(){return{current:null}},kn.forwardRef=function(L){return{$$typeof:h,render:L}},kn.isValidElement=ee,kn.lazy=function(L){return{$$typeof:w,_payload:{_status:-1,_result:L},_init:X}},kn.memo=function(L,pe){return{$$typeof:g,type:L,compare:pe===void 0?null:pe}},kn.startTransition=function(L){var pe=O.T,we={};O.T=we;try{var Be=L(),Ve=O.S;Ve!==null&&Ve(we,Be),typeof Be=="object"&&Be!==null&&typeof Be.then=="function"&&Be.then(G,le)}catch(Oe){le(Oe)}finally{pe!==null&&we.types!==null&&(pe.types=we.types),O.T=pe}},kn.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},kn.use=function(L){return O.H.use(L)},kn.useActionState=function(L,pe,we){return O.H.useActionState(L,pe,we)},kn.useCallback=function(L,pe){return O.H.useCallback(L,pe)},kn.useContext=function(L){return O.H.useContext(L)},kn.useDebugValue=function(){},kn.useDeferredValue=function(L,pe){return O.H.useDeferredValue(L,pe)},kn.useEffect=function(L,pe){return O.H.useEffect(L,pe)},kn.useEffectEvent=function(L){return O.H.useEffectEvent(L)},kn.useId=function(){return O.H.useId()},kn.useImperativeHandle=function(L,pe,we){return O.H.useImperativeHandle(L,pe,we)},kn.useInsertionEffect=function(L,pe){return O.H.useInsertionEffect(L,pe)},kn.useLayoutEffect=function(L,pe){return O.H.useLayoutEffect(L,pe)},kn.useMemo=function(L,pe){return O.H.useMemo(L,pe)},kn.useOptimistic=function(L,pe){return O.H.useOptimistic(L,pe)},kn.useReducer=function(L,pe,we){return O.H.useReducer(L,pe,we)},kn.useRef=function(L){return O.H.useRef(L)},kn.useState=function(L){return O.H.useState(L)},kn.useSyncExternalStore=function(L,pe,we){return O.H.useSyncExternalStore(L,pe,we)},kn.useTransition=function(){return O.H.useTransition()},kn.version="19.2.3",kn}var a1;function Qf(){return a1||(a1=1,b0.exports=tC()),b0.exports}var m=Qf();const fn=Ru(m),o1=QE({__proto__:null,default:fn},[m]);var v0={exports:{}},Ic={},x0={exports:{}},_0={};var l1;function nC(){return l1||(l1=1,(function(n){function e($,F){var X=$.length;$.push(F);e:for(;0<X;){var le=X-1>>>1,de=$[le];if(0<a(de,F))$[le]=F,$[X]=de,X=le;else break e}}function t($){return $.length===0?null:$[0]}function i($){if($.length===0)return null;var F=$[0],X=$.pop();if(X!==F){$[0]=X;e:for(var le=0,de=$.length,L=de>>>1;le<L;){var pe=2*(le+1)-1,we=$[pe],Be=pe+1,Ve=$[Be];if(0>a(we,X))Be<de&&0>a(Ve,we)?($[le]=Ve,$[Be]=X,le=Be):($[le]=we,$[pe]=X,le=pe);else if(Be<de&&0>a(Ve,X))$[le]=Ve,$[Be]=X,le=Be;else break e}}return F}function a($,F){var X=$.sortIndex-F.sortIndex;return X!==0?X:$.id-F.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=[],w=1,S=null,A=3,C=!1,j=!1,k=!1,B=!1,V=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function ie($){for(var F=t(g);F!==null;){if(F.callback===null)i(g);else if(F.startTime<=$)i(g),F.sortIndex=F.expirationTime,e(f,F);else break;F=t(g)}}function Y($){if(k=!1,ie($),!j)if(t(f)!==null)j=!0,G||(G=!0,q());else{var F=t(g);F!==null&&se(Y,F.startTime-$)}}var G=!1,O=-1,re=5,E=-1;function R(){return B?!0:!(n.unstable_now()-E<re)}function ee(){if(B=!1,G){var $=n.unstable_now();E=$;var F=!0;try{e:{j=!1,k&&(k=!1,W(O),O=-1),C=!0;var X=A;try{t:{for(ie($),S=t(f);S!==null&&!(S.expirationTime>$&&R());){var le=S.callback;if(typeof le=="function"){S.callback=null,A=S.priorityLevel;var de=le(S.expirationTime<=$);if($=n.unstable_now(),typeof de=="function"){S.callback=de,ie($),F=!0;break t}S===t(f)&&i(f),ie($)}else i(f);S=t(f)}if(S!==null)F=!0;else{var L=t(g);L!==null&&se(Y,L.startTime-$),F=!1}}break e}finally{S=null,A=X,C=!1}F=void 0}}finally{F?q():G=!1}}}var q;if(typeof H=="function")q=function(){H(ee)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,ue=Q.port2;Q.port1.onmessage=ee,q=function(){ue.postMessage(null)}}else q=function(){V(ee,0)};function se($,F){O=V(function(){$(n.unstable_now())},F)}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($){$.callback=null},n.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):re=0<$?Math.floor(1e3/$):5},n.unstable_getCurrentPriorityLevel=function(){return A},n.unstable_next=function($){switch(A){case 1:case 2:case 3:var F=3;break;default:F=A}var X=A;A=F;try{return $()}finally{A=X}},n.unstable_requestPaint=function(){B=!0},n.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var X=A;A=$;try{return F()}finally{A=X}},n.unstable_scheduleCallback=function($,F,X){var le=n.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?le+X:le):X=le,$){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=X+de,$={id:w++,callback:F,priorityLevel:$,startTime:X,expirationTime:de,sortIndex:-1},X>le?($.sortIndex=X,e(g,$),t(f)===null&&$===t(g)&&(k?(W(O),O=-1):k=!0,se(Y,X-le))):($.sortIndex=de,e(f,$),j||C||(j=!0,G||(G=!0,q()))),$},n.unstable_shouldYield=R,n.unstable_wrapCallback=function($){var F=A;return function(){var X=A;A=F;try{return $.apply(this,arguments)}finally{A=X}}}})(_0)),_0}var u1;function iC(){return u1||(u1=1,x0.exports=nC()),x0.exports}var w0={exports:{}},kr={};var c1;function rC(){if(c1)return kr;c1=1;var n=Qf();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)g+="&args[]="+encodeURIComponent(arguments[w])}return"Minified React error #"+f+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(f,g,w){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:S==null?null:""+S,children:f,containerInfo:g,implementation:w}}var u=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,g){if(f==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return kr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,kr.createPortal=function(f,g){var w=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(e(299));return l(f,g,null,w)},kr.flushSync=function(f){var g=u.T,w=i.p;try{if(u.T=null,i.p=2,f)return f()}finally{u.T=g,i.p=w,i.d.f()}},kr.preconnect=function(f,g){typeof f=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,i.d.C(f,g))},kr.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},kr.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var w=g.as,S=h(w,g.crossOrigin),A=typeof g.integrity=="string"?g.integrity:void 0,C=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;w==="style"?i.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:S,integrity:A,fetchPriority:C}):w==="script"&&i.d.X(f,{crossOrigin:S,integrity:A,fetchPriority:C,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},kr.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var w=h(g.as,g.crossOrigin);i.d.M(f,{crossOrigin:w,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&i.d.M(f)},kr.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var w=g.as,S=h(w,g.crossOrigin);i.d.L(f,w,{crossOrigin:S,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},kr.preloadModule=function(f,g){if(typeof f=="string")if(g){var w=h(g.as,g.crossOrigin);i.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:w,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else i.d.m(f)},kr.requestFormReset=function(f){i.d.r(f)},kr.unstable_batchedUpdates=function(f,g){return f(g)},kr.useFormState=function(f,g,w){return u.H.useFormState(f,g,w)},kr.useFormStatus=function(){return u.H.useHostTransitionStatus()},kr.version="19.2.3",kr}var d1;function Z_(){if(d1)return w0.exports;d1=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),w0.exports=rC(),w0.exports}var h1;function sC(){if(h1)return Ic;h1=1;var n=iC(),e=Qf(),t=Z_();function i(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var s=r,o=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(o=s.return),r=s.return;while(r)}return s.tag===3?o:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function f(r){if(l(r)!==r)throw Error(i(188))}function g(r){var s=r.alternate;if(!s){if(s=l(r),s===null)throw Error(i(188));return s!==r?null:r}for(var o=r,d=s;;){var y=o.return;if(y===null)break;var b=y.alternate;if(b===null){if(d=y.return,d!==null){o=d;continue}break}if(y.child===b.child){for(b=y.child;b;){if(b===o)return f(y),r;if(b===d)return f(y),s;b=b.sibling}throw Error(i(188))}if(o.return!==d.return)o=y,d=b;else{for(var M=!1,z=y.child;z;){if(z===o){M=!0,o=y,d=b;break}if(z===d){M=!0,d=y,o=b;break}z=z.sibling}if(!M){for(z=b.child;z;){if(z===o){M=!0,o=b,d=y;break}if(z===d){M=!0,d=b,o=y;break}z=z.sibling}if(!M)throw Error(i(189))}}if(o.alternate!==d)throw Error(i(190))}if(o.tag!==3)throw Error(i(188));return o.stateNode.current===o?r:s}function w(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=w(r),s!==null)return s;r=r.sibling}return null}var S=Object.assign,A=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),H=Symbol.for("react.context"),ie=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),ee=Symbol.iterator;function q(r){return r===null||typeof r!="object"?null:(r=ee&&r[ee]||r["@@iterator"],typeof r=="function"?r:null)}var Q=Symbol.for("react.client.reference");function ue(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Q?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case k:return"Fragment";case V:return"Profiler";case B:return"StrictMode";case Y:return"Suspense";case G:return"SuspenseList";case E:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case j:return"Portal";case H:return r.displayName||"Context";case W:return(r._context.displayName||"Context")+".Consumer";case ie:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case O:return s=r.displayName||null,s!==null?s:ue(r.type)||"Memo";case re:s=r._payload,r=r._init;try{return ue(r(s))}catch{}}return null}var se=Array.isArray,$=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},le=[],de=-1;function L(r){return{current:r}}function pe(r){0>de||(r.current=le[de],le[de]=null,de--)}function we(r,s){de++,le[de]=r.current,r.current=s}var Be=L(null),Ve=L(null),Oe=L(null),Te=L(null);function _t(r,s){switch(we(Oe,s),we(Ve,r),we(Be,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Ex(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Ex(s),r=Cx(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}pe(Be),we(Be,r)}function dt(){pe(Be),pe(Ve),pe(Oe)}function xe(r){r.memoizedState!==null&&we(Te,r);var s=Be.current,o=Cx(s,r.type);s!==o&&(we(Ve,r),we(Be,o))}function Ne(r){Ve.current===r&&(pe(Be),pe(Ve)),Te.current===r&&(pe(Te),Mc._currentValue=X)}var Se,Ie;function $e(r){if(Se===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Se=s&&s[1]||"",Ie=-1<o.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Se+r+Ie}var Ct=!1;function st(r,s){if(!r||Ct)return"";Ct=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(Ye){var Ke=Ye}Reflect.construct(r,[],ct)}else{try{ct.call()}catch(Ye){Ke=Ye}r.call(ct.prototype)}}else{try{throw Error()}catch(Ye){Ke=Ye}(ct=r())&&typeof ct.catch=="function"&&ct.catch(function(){})}}catch(Ye){if(Ye&&Ke&&typeof Ye.stack=="string")return[Ye.stack,Ke.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=d.DetermineComponentFrameRoot(),M=b[0],z=b[1];if(M&&z){var be=M.split(`
|
||
`),ze=z.split(`
|
||
`);for(y=d=0;d<be.length&&!be[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ze.length&&!ze[y].includes("DetermineComponentFrameRoot");)y++;if(d===be.length||y===ze.length)for(d=be.length-1,y=ze.length-1;1<=d&&0<=y&&be[d]!==ze[y];)y--;for(;1<=d&&0<=y;d--,y--)if(be[d]!==ze[y]){if(d!==1||y!==1)do if(d--,y--,0>y||be[d]!==ze[y]){var rt=`
|
||
`+be[d].replace(" at new "," at ");return r.displayName&&rt.includes("<anonymous>")&&(rt=rt.replace("<anonymous>",r.displayName)),rt}while(1<=d&&0<=y);break}}}finally{Ct=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?$e(o):""}function gt(r,s){switch(r.tag){case 26:case 27:case 5:return $e(r.type);case 16:return $e("Lazy");case 13:return r.child!==s&&s!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("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 $e("Activity");default:return""}}function He(r){try{var s="",o=null;do s+=gt(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
|
||
Error generating stack: `+d.message+`
|
||
`+d.stack}}var We=Object.prototype.hasOwnProperty,Je=n.unstable_scheduleCallback,et=n.unstable_cancelCallback,mt=n.unstable_shouldYield,Mt=n.unstable_requestPaint,fe=n.unstable_now,qe=n.unstable_getCurrentPriorityLevel,Le=n.unstable_ImmediatePriority,Ce=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,Qe=n.unstable_LowPriority,At=n.unstable_IdlePriority,Xt=n.log,kt=n.unstable_setDisableYieldValue,mn=null,It=null;function $t(r){if(typeof Xt=="function"&&kt(r),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(mn,r)}catch{}}var Ot=Math.clz32?Math.clz32:Pn,en=Math.log,Sn=Math.LN2;function Pn(r){return r>>>=0,r===0?32:31-(en(r)/Sn|0)|0}var St=256,Tn=262144,tt=4194304;function D(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 P(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var y=0,b=r.suspendedLanes,M=r.pingedLanes;r=r.warmLanes;var z=d&134217727;return z!==0?(d=z&~b,d!==0?y=D(d):(M&=z,M!==0?y=D(M):o||(o=z&~r,o!==0&&(y=D(o))))):(z=d&~b,z!==0?y=D(z):M!==0?y=D(M):o||(o=d&~r,o!==0&&(y=D(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 ne(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Re(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 Ge(){var r=tt;return tt<<=1,(tt&62914560)===0&&(tt=4194304),r}function yt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function tn(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function un(r,s,o,d,y,b){var M=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 z=r.entanglements,be=r.expirationTimes,ze=r.hiddenUpdates;for(o=M&~o;0<o;){var rt=31-Ot(o),ct=1<<rt;z[rt]=0,be[rt]=-1;var Ke=ze[rt];if(Ke!==null)for(ze[rt]=null,rt=0;rt<Ke.length;rt++){var Ye=Ke[rt];Ye!==null&&(Ye.lane&=-536870913)}o&=~ct}d!==0&&vn(r,d,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(M&~s))}function vn(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-Ot(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function cn(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-Ot(o),y=1<<d;y&s|r[d]&s&&(r[d]|=s),o&=~y}}function Cn(r,s){var o=s&-s;return o=(o&42)!==0?1:xn(o),(o&(r.suspendedLanes|s))!==0?0:o}function xn(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function on(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Rn(){var r=F.p;return r!==0?r:(r=window.event,r===void 0?32:Yx(r.type))}function qt(r,s){var o=F.p;try{return F.p=r,s()}finally{F.p=o}}var Bt=Math.random().toString(36).slice(2),Zt="__reactFiber$"+Bt,zt="__reactProps$"+Bt,Pt="__reactContainer$"+Bt,Nn="__reactEvents$"+Bt,Ft="__reactListeners$"+Bt,Qn="__reactHandles$"+Bt,Xn="__reactResources$"+Bt,Gn="__reactMarker$"+Bt;function ln(r){delete r[Zt],delete r[zt],delete r[Nn],delete r[Ft],delete r[Qn]}function Zn(r){var s=r[Zt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Pt]||o[Zt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=Ox(r);r!==null;){if(o=r[Zt])return o;r=Ox(r)}return s}r=o,o=r.parentNode}return null}function ti(r){if(r=r[Zt]||r[Pt]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function jn(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Kn(r){var s=r[Xn];return s||(s=r[Xn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function rn(r){r[Gn]=!0}var Di=new Set,oi={};function ni(r,s){di(r,s),di(r+"Capture",s)}function di(r,s){for(oi[r]=s,r=0;r<s.length;r++)Di.add(s[r])}var Ci=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Fn={},On={};function $n(r){return We.call(On,r)?!0:We.call(Fn,r)?!1:Ci.test(r)?On[r]=!0:(Fn[r]=!0,!1)}function _e(r,s,o){if($n(s))if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var d=s.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+o)}}function nt(r,s,o){if(o===null)r.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+o)}}function ht(r,s,o,d){if(d===null)r.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttributeNS(s,o,""+d)}}function Ht(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function De(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function vt(r,s,o){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,b=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return y.call(this)},set:function(M){o=""+M,b.call(this,M)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(M){o=""+M},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function wt(r){if(!r._valueTracker){var s=De(r)?"checked":"value";r._valueTracker=vt(r,s,""+r[s])}}function Nt(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=De(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function Gt(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var Kt=/[\n"\\]/g;function sn(r){return r.replace(Kt,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Mn(r,s,o,d,y,b,M,z){r.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.type=M:r.removeAttribute("type"),s!=null?M==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Ht(s)):r.value!==""+Ht(s)&&(r.value=""+Ht(s)):M!=="submit"&&M!=="reset"||r.removeAttribute("value"),s!=null?nr(r,M,Ht(s)):o!=null?nr(r,M,Ht(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?r.name=""+Ht(z):r.removeAttribute("name")}function Yn(r,s,o,d,y,b,M,z){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)){wt(r);return}o=o!=null?""+Ht(o):"",s=s!=null?""+Ht(s):o,z||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=z?r.checked:!!d,r.defaultChecked=!!d,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(r.name=M),wt(r)}function nr(r,s,o){s==="number"&&Gt(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Wn(r,s,o,d){if(r=r.options,s){s={};for(var y=0;y<o.length;y++)s["$"+o[y]]=!0;for(o=0;o<r.length;o++)y=s.hasOwnProperty("$"+r[o].value),r[o].selected!==y&&(r[o].selected=y),y&&d&&(r[o].defaultSelected=!0)}else{for(o=""+Ht(o),s=null,y=0;y<r.length;y++){if(r[y].value===o){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}s!==null||r[y].disabled||(s=r[y])}s!==null&&(s.selected=!0)}}function Wi(r,s,o){if(s!=null&&(s=""+Ht(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Ht(o):""}function Hi(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(se(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Ht(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),wt(r)}function bi(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var Si=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Xi(r,s,o){var d=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,o):typeof o!="number"||o===0||Si.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function ii(r,s,o){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||s!=null&&s.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in s)d=s[y],s.hasOwnProperty(y)&&o[y]!==d&&Xi(r,y,d)}else for(var b in s)s.hasOwnProperty(b)&&Xi(r,b,s[b])}function Mi(r){if(r.indexOf("-")===-1)return!1;switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ti=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Bi=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ir(r){return Bi.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function hi(){}var Yi=null;function Pi(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var ae=null,ke=null;function pt(r){var s=ti(r);if(s&&(r=s.stateNode)){var o=r[zt]||null;e:switch(r=s.stateNode,s.type){case"input":if(Mn(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=r;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+sn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var y=d[zt]||null;if(!y)throw Error(i(90));Mn(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(s=0;s<o.length;s++)d=o[s],d.form===r.form&&Nt(d)}break e;case"textarea":Wi(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Wn(r,!!o.multiple,s,!1)}}}var xt=!1;function Rt(r,s,o){if(xt)return r(s,o);xt=!0;try{var d=r(s);return d}finally{if(xt=!1,(ae!==null||ke!==null)&&(Sh(),ae&&(s=ae,r=ke,ke=ae=null,pt(s),r)))for(s=0;s<r.length;s++)pt(r[s])}}function Et(r,s){var o=r.stateNode;if(o===null)return null;var d=o[zt]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var Z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ce=!1;if(Z)try{var ve={};Object.defineProperty(ve,"passive",{get:function(){ce=!0}}),window.addEventListener("test",ve,ve),window.removeEventListener("test",ve,ve)}catch{ce=!1}var Me=null,I=null,U=null;function te(){if(U)return U;var r,s=I,o=s.length,d,y="value"in Me?Me.value:Me.textContent,b=y.length;for(r=0;r<o&&s[r]===y[r];r++);var M=o-r;for(d=1;d<=M&&s[o-d]===y[b-d];d++);return U=y.slice(r,1<d?1-d:void 0)}function ye(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function ge(){return!0}function at(){return!1}function lt(r){function s(o,d,y,b,M){this._reactName=o,this._targetInst=y,this.type=d,this.nativeEvent=b,this.target=M,this.currentTarget=null;for(var z in r)r.hasOwnProperty(z)&&(o=r[z],this[z]=o?o(b):b[z]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ge:at,this.isPropagationStopped=at,this}return S(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=ge)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=ge)},persist:function(){},isPersistent:ge}),s}var ut={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dt=lt(ut),Yt=S({},ut,{view:0,detail:0}),Lt=lt(Yt),ft,bt,Ut,Jt=S({},Yt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uu,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ut&&(Ut&&r.type==="mousemove"?(ft=r.screenX-Ut.screenX,bt=r.screenY-Ut.screenY):bt=ft=0,Ut=r),ft)},movementY:function(r){return"movementY"in r?r.movementY:bt}}),Qt=lt(Jt),wn=S({},Jt,{dataTransfer:0}),fi=lt(wn),fs=S({},Yt,{relatedTarget:0}),Fi=lt(fs),Ro=S({},ut,{animationName:0,elapsedTime:0,pseudoElement:0}),jo=lt(Ro),wl=S({},ut,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Jr=lt(wl),As=S({},ut,{data:0}),Oo=lt(As),Ad={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nm={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Dm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Mm(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=Dm[r])?!!s[r]:!1}function Uu(){return Mm}var Nd=S({},Yt,{key:function(r){if(r.key){var s=Ad[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=ye(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Nm[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uu,charCode:function(r){return r.type==="keypress"?ye(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ye(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Dd=lt(Nd),Sl=S({},Jt,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pa=lt(Sl),Tl=S({},Yt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uu}),da=lt(Tl),Rm=S({},ut,{propertyName:0,elapsedTime:0,pseudoElement:0}),Md=lt(Rm),Rd=S({},Jt,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),jd=lt(Rd),jm=S({},ut,{newState:0,oldState:0}),Om=lt(jm),Lm=[9,13,27,32],Fa=Z&&"CompositionEvent"in window,Lo=null;Z&&"documentMode"in document&&(Lo=document.documentMode);var Od=Z&&"TextEvent"in window&&!Lo,Ld=Z&&(!Fa||Lo&&8<Lo&&11>=Lo),Id=" ",zu=!1;function kl(r,s){switch(r){case"keyup":return Lm.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 Ua=!1;function Im(r,s){switch(r){case"compositionend":return Bd(s);case"keypress":return s.which!==32?null:(zu=!0,Id);case"textInput":return r=s.data,r===Id&&zu?null:r;default:return null}}function Hu(r,s){if(Ua)return r==="compositionend"||!Fa&&kl(r,s)?(r=te(),U=I=Me=null,Ua=!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.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Ld&&s.locale!=="ko"?null:s.data;default:return null}}var Bm={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function $u(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Bm[r.type]:s==="textarea"}function Pd(r,s,o,d){ae?ke?ke.push(d):ke=[d]:ae=d,s=Dh(s,"onChange"),0<s.length&&(o=new Dt("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var Io=null,za=null;function Pm(r){xx(r,0)}function Bo(r){var s=jn(r);if(Nt(s))return r}function qu(r,s){if(r==="change")return s}var Vu=!1;if(Z){var Gu;if(Z){var Ku="oninput"in document;if(!Ku){var Po=document.createElement("div");Po.setAttribute("oninput","return;"),Ku=typeof Po.oninput=="function"}Gu=Ku}else Gu=!1;Vu=Gu&&(!document.documentMode||9<document.documentMode)}function Fd(){Io&&(Io.detachEvent("onpropertychange",Ud),za=Io=null)}function Ud(r){if(r.propertyName==="value"&&Bo(za)){var s=[];Pd(s,za,r,Pi(r)),Rt(Pm,s)}}function Fm(r,s,o){r==="focusin"?(Fd(),Io=s,za=o,Io.attachEvent("onpropertychange",Ud)):r==="focusout"&&Fd()}function Um(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Bo(za)}function zd(r,s){if(r==="click")return Bo(s)}function zm(r,s){if(r==="input"||r==="change")return Bo(s)}function Fo(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var Sr=typeof Object.is=="function"?Object.is:Fo;function zs(r,s){if(Sr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var o=Object.keys(r),d=Object.keys(s);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var y=o[d];if(!We.call(s,y)||!Sr(r[y],s[y]))return!1}return!0}function Ha(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ri(r,s){var o=Ha(r);r=0;for(var d;o;){if(o.nodeType===3){if(d=r+o.textContent.length,r<=s&&d>=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=Ha(o)}}function ha(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?ha(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function El(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Gt(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=Gt(r.document)}return s}function Wu(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 Hm=Z&&"documentMode"in document&&11>=document.documentMode,$a=null,Xu=null,qa=null,Cl=!1;function Yu(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Cl||$a==null||$a!==Gt(d)||(d=$a,"selectionStart"in d&&Wu(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}),qa&&zs(qa,d)||(qa=d,d=Dh(Xu,"onSelect"),0<d.length&&(s=new Dt("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=$a)))}function Hs(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var fa={animationend:Hs("Animation","AnimationEnd"),animationiteration:Hs("Animation","AnimationIteration"),animationstart:Hs("Animation","AnimationStart"),transitionrun:Hs("Transition","TransitionRun"),transitionstart:Hs("Transition","TransitionStart"),transitioncancel:Hs("Transition","TransitionCancel"),transitionend:Hs("Transition","TransitionEnd")},Uo={},Qu={};Z&&(Qu=document.createElement("div").style,"AnimationEvent"in window||(delete fa.animationend.animation,delete fa.animationiteration.animation,delete fa.animationstart.animation),"TransitionEvent"in window||delete fa.transitionend.transition);function Ns(r){if(Uo[r])return Uo[r];if(!fa[r])return r;var s=fa[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Qu)return Uo[r]=s[o];return r}var Hd=Ns("animationend"),Va=Ns("animationiteration"),$d=Ns("animationstart"),qd=Ns("transitionrun"),Vd=Ns("transitionstart"),$m=Ns("transitioncancel"),Gd=Ns("transitionend"),Zu=new Map,Ju="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Ju.push("scrollEnd");function es(r,s){Zu.set(r,s),ni(s,[r])}var Ga=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Lr=[],Ka=0,ec=0;function Al(){for(var r=Ka,s=ec=Ka=0;s<r;){var o=Lr[s];Lr[s++]=null;var d=Lr[s];Lr[s++]=null;var y=Lr[s];Lr[s++]=null;var b=Lr[s];if(Lr[s++]=null,d!==null&&y!==null){var M=d.pending;M===null?y.next=y:(y.next=M.next,M.next=y),d.pending=y}b!==0&&Kd(o,y,b)}}function Nl(r,s,o,d){Lr[Ka++]=r,Lr[Ka++]=s,Lr[Ka++]=o,Lr[Ka++]=d,ec|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function tc(r,s,o,d){return Nl(r,s,o,d),Dl(r)}function ma(r,s){return Nl(r,null,null,s),Dl(r)}function Kd(r,s,o){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o);for(var y=!1,b=r.return;b!==null;)b.childLanes|=o,d=b.alternate,d!==null&&(d.childLanes|=o),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(y=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,y&&s!==null&&(y=31-Ot(o),r=b.hiddenUpdates,d=r[y],d===null?r[y]=[s]:d.push(s),s.lane=o|536870912),b):null}function Dl(r){if(50<Tc)throw Tc=0,zp=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Wa={};function qm(r,s,o,d){this.tag=r,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $i(r,s,o,d){return new qm(r,s,o,d)}function nc(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ds(r,s){var o=r.alternate;return o===null?(o=$i(r.tag,s,r.key,r.mode),o.elementType=r.elementType,o.type=r.type,o.stateNode=r.stateNode,o.alternate=r,r.alternate=o):(o.pendingProps=s,o.type=r.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=r.flags&65011712,o.childLanes=r.childLanes,o.lanes=r.lanes,o.child=r.child,o.memoizedProps=r.memoizedProps,o.memoizedState=r.memoizedState,o.updateQueue=r.updateQueue,s=r.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=r.sibling,o.index=r.index,o.ref=r.ref,o.refCleanup=r.refCleanup,o}function Wd(r,s){r.flags&=65011714;var o=r.alternate;return o===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=o.childLanes,r.lanes=o.lanes,r.child=o.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=o.memoizedProps,r.memoizedState=o.memoizedState,r.updateQueue=o.updateQueue,r.type=o.type,s=o.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function ic(r,s,o,d,y,b){var M=0;if(d=r,typeof r=="function")nc(r)&&(M=1);else if(typeof r=="string")M=FE(r,o,Be.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case E:return r=$i(31,o,s,y),r.elementType=E,r.lanes=b,r;case k:return $s(o.children,y,b,s);case B:M=8,y|=24;break;case V:return r=$i(12,o,s,y|2),r.elementType=V,r.lanes=b,r;case Y:return r=$i(13,o,s,y),r.elementType=Y,r.lanes=b,r;case G:return r=$i(19,o,s,y),r.elementType=G,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case H:M=10;break e;case W:M=9;break e;case ie:M=11;break e;case O:M=14;break e;case re:M=16,d=null;break e}M=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=$i(M,o,s,y),s.elementType=r,s.type=d,s.lanes=b,s}function $s(r,s,o,d){return r=$i(7,r,d,s),r.lanes=o,r}function zo(r,s,o){return r=$i(6,r,null,s),r.lanes=o,r}function rc(r){var s=$i(18,null,null,0);return s.stateNode=r,s}function Xa(r,s,o){return s=$i(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var Ho=new WeakMap;function Ir(r,s){if(typeof r=="object"&&r!==null){var o=Ho.get(r);return o!==void 0?o:(s={value:r,source:s,stack:He(s)},Ho.set(r,s),s)}return{value:r,source:s,stack:He(s)}}var Ya=[],Qa=0,Ml=null,$o=0,Tr=[],Br=0,qs=null,ts=1,br="";function Ln(r,s){Ya[Qa++]=$o,Ya[Qa++]=Ml,Ml=r,$o=s}function Vs(r,s,o){Tr[Br++]=ts,Tr[Br++]=br,Tr[Br++]=qs,qs=r;var d=ts;r=br;var y=32-Ot(d)-1;d&=~(1<<y),o+=1;var b=32-Ot(s)+y;if(30<b){var M=y-y%5;b=(d&(1<<M)-1).toString(32),d>>=M,y-=M,ts=1<<32-Ot(s)+y|o<<y|d,br=b+r}else ts=1<<b|o<<y|d,br=r}function cr(r){r.return!==null&&(Ln(r,1),Vs(r,1,0))}function Pr(r){for(;r===Ml;)Ml=Ya[--Qa],Ya[Qa]=null,$o=Ya[--Qa],Ya[Qa]=null;for(;r===qs;)qs=Tr[--Br],Tr[Br]=null,br=Tr[--Br],Tr[Br]=null,ts=Tr[--Br],Tr[Br]=null}function Xd(r,s){Tr[Br++]=ts,Tr[Br++]=br,Tr[Br++]=qs,ts=s.id,br=s.overflow,qs=r}var rr=null,vi=null,Un=!1,Gs=null,Fr=!1,sc=Error(i(519));function Ks(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw x(Ir(s,r)),sc}function Yd(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Zt]=r,s[zt]=d,o){case"dialog":Hn("cancel",s),Hn("close",s);break;case"iframe":case"object":case"embed":Hn("load",s);break;case"video":case"audio":for(o=0;o<Ec.length;o++)Hn(Ec[o],s);break;case"source":Hn("error",s);break;case"img":case"image":case"link":Hn("error",s),Hn("load",s);break;case"details":Hn("toggle",s);break;case"input":Hn("invalid",s),Yn(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Hn("invalid",s);break;case"textarea":Hn("invalid",s),Hi(s,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||d.suppressHydrationWarning===!0||Tx(s.textContent,o)?(d.popover!=null&&(Hn("beforetoggle",s),Hn("toggle",s)),d.onScroll!=null&&Hn("scroll",s),d.onScrollEnd!=null&&Hn("scrollend",s),d.onClick!=null&&(s.onclick=hi),s=!0):s=!1,s||Ks(r,!0)}function ac(r){for(rr=r.return;rr;)switch(rr.tag){case 5:case 31:case 13:Fr=!1;return;case 27:case 3:Fr=!0;return;default:rr=rr.return}}function p(r){if(r!==rr)return!1;if(!Un)return ac(r),Un=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||n0(r.type,r.memoizedProps)),o=!o),o&&vi&&Ks(r),ac(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));vi=jx(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));vi=jx(r)}else s===27?(s=vi,co(r.type)?(r=o0,o0=null,vi=r):vi=s):vi=rr?gs(r.stateNode.nextSibling):null;return!0}function v(){vi=rr=null,Un=!1}function _(){var r=Gs;return r!==null&&($r===null?$r=r:$r.push.apply($r,r),Gs=null),r}function x(r){Gs===null?Gs=[r]:Gs.push(r)}var T=L(null),N=null,K=null;function J(r,s,o){we(T,s._currentValue),s._currentValue=o}function oe(r){r._currentValue=T.current,pe(T)}function me(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Ae(r,s,o,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var b=y.dependencies;if(b!==null){var M=y.child;b=b.firstContext;e:for(;b!==null;){var z=b;b=y;for(var be=0;be<s.length;be++)if(z.context===s[be]){b.lanes|=o,z=b.alternate,z!==null&&(z.lanes|=o),me(b.return,o,r),d||(M=null);break e}b=z.next}}else if(y.tag===18){if(M=y.return,M===null)throw Error(i(341));M.lanes|=o,b=M.alternate,b!==null&&(b.lanes|=o),me(M,o,r),M=null}else M=y.child;if(M!==null)M.return=y;else for(M=y;M!==null;){if(M===r){M=null;break}if(y=M.sibling,y!==null){y.return=M.return,M=y;break}M=M.return}y=M}}function Xe(r,s,o,d){r=null;for(var y=s,b=!1;y!==null;){if(!b){if((y.flags&524288)!==0)b=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var M=y.alternate;if(M===null)throw Error(i(387));if(M=M.memoizedProps,M!==null){var z=y.type;Sr(y.pendingProps.value,M.value)||(r!==null?r.push(z):r=[z])}}else if(y===Te.current){if(M=y.alternate,M===null)throw Error(i(387));M.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Mc):r=[Mc])}y=y.return}r!==null&&Ae(s,r,o,d),s.flags|=262144}function jt(r){for(r=r.firstContext;r!==null;){if(!Sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function it(r){N=r,K=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Vt(r){return Qi(N,r)}function _n(r,s){return N===null&&it(r),Qi(r,s)}function Qi(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},K===null){if(r===null)throw Error(i(308));K=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else K=K.next=s;return o}var Nr=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(o,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(o){return o()})}},Ws=n.unstable_scheduleCallback,qo=n.unstable_NormalPriority,ki={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pa(){return{controller:new Nr,data:new Map,refCount:0}}function Ms(r){r.refCount--,r.refCount===0&&Ws(qo,function(){r.controller.abort()})}var Xs=null,li=0,ms=0,fr=null;function Pk(r,s){if(Xs===null){var o=Xs=[];li=0,ms=Kp(),fr={status:"pending",value:void 0,then:function(d){o.push(d)}}}return li++,s.then(cb,cb),s}function cb(){if(--li===0&&Xs!==null){fr!==null&&(fr.status="fulfilled");var r=Xs;Xs=null,ms=0,fr=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Fk(r,s){var o=[],d={status:"pending",value:null,reason:null,then:function(y){o.push(y)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var y=0;y<o.length;y++)(0,o[y])(s)},function(y){for(d.status="rejected",d.reason=y,y=0;y<o.length;y++)(0,o[y])(void 0)}),d}var db=$.S;$.S=function(r,s){Wv=fe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Pk(r,s),db!==null&&db(r,s)};var Vo=L(null);function Vm(){var r=Vo.current;return r!==null?r:xi.pooledCache}function Qd(r,s){s===null?we(Vo,Vo.current):we(Vo,s.pool)}function hb(){var r=Vm();return r===null?null:{parent:ki._currentValue,pool:r}}var Rl=Error(i(460)),Gm=Error(i(474)),Zd=Error(i(542)),Jd={then:function(){}};function fb(r){return r=r.status,r==="fulfilled"||r==="rejected"}function mb(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(hi,hi),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,gb(r),r;default:if(typeof s.status=="string")s.then(hi,hi);else{if(r=xi,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=s,r.status="pending",r.then(function(d){if(s.status==="pending"){var y=s;y.status="fulfilled",y.value=d}},function(d){if(s.status==="pending"){var y=s;y.status="rejected",y.reason=d}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,gb(r),r}throw Ko=s,Rl}}function Go(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ko=o,Rl):o}}var Ko=null;function pb(){if(Ko===null)throw Error(i(459));var r=Ko;return Ko=null,r}function gb(r){if(r===Rl||r===Zd)throw Error(i(483))}var jl=null,oc=0;function eh(r){var s=oc;return oc+=1,jl===null&&(jl=[]),mb(jl,r,s)}function lc(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function th(r,s){throw s.$$typeof===A?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function yb(r){function s(je,Ee){if(r){var Ue=je.deletions;Ue===null?(je.deletions=[Ee],je.flags|=16):Ue.push(Ee)}}function o(je,Ee){if(!r)return null;for(;Ee!==null;)s(je,Ee),Ee=Ee.sibling;return null}function d(je){for(var Ee=new Map;je!==null;)je.key!==null?Ee.set(je.key,je):Ee.set(je.index,je),je=je.sibling;return Ee}function y(je,Ee){return je=Ds(je,Ee),je.index=0,je.sibling=null,je}function b(je,Ee,Ue){return je.index=Ue,r?(Ue=je.alternate,Ue!==null?(Ue=Ue.index,Ue<Ee?(je.flags|=67108866,Ee):Ue):(je.flags|=67108866,Ee)):(je.flags|=1048576,Ee)}function M(je){return r&&je.alternate===null&&(je.flags|=67108866),je}function z(je,Ee,Ue,ot){return Ee===null||Ee.tag!==6?(Ee=zo(Ue,je.mode,ot),Ee.return=je,Ee):(Ee=y(Ee,Ue),Ee.return=je,Ee)}function be(je,Ee,Ue,ot){var dn=Ue.type;return dn===k?rt(je,Ee,Ue.props.children,ot,Ue.key):Ee!==null&&(Ee.elementType===dn||typeof dn=="object"&&dn!==null&&dn.$$typeof===re&&Go(dn)===Ee.type)?(Ee=y(Ee,Ue.props),lc(Ee,Ue),Ee.return=je,Ee):(Ee=ic(Ue.type,Ue.key,Ue.props,null,je.mode,ot),lc(Ee,Ue),Ee.return=je,Ee)}function ze(je,Ee,Ue,ot){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==Ue.containerInfo||Ee.stateNode.implementation!==Ue.implementation?(Ee=Xa(Ue,je.mode,ot),Ee.return=je,Ee):(Ee=y(Ee,Ue.children||[]),Ee.return=je,Ee)}function rt(je,Ee,Ue,ot,dn){return Ee===null||Ee.tag!==7?(Ee=$s(Ue,je.mode,ot,dn),Ee.return=je,Ee):(Ee=y(Ee,Ue),Ee.return=je,Ee)}function ct(je,Ee,Ue){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ee=zo(""+Ee,je.mode,Ue),Ee.return=je,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case C:return Ue=ic(Ee.type,Ee.key,Ee.props,null,je.mode,Ue),lc(Ue,Ee),Ue.return=je,Ue;case j:return Ee=Xa(Ee,je.mode,Ue),Ee.return=je,Ee;case re:return Ee=Go(Ee),ct(je,Ee,Ue)}if(se(Ee)||q(Ee))return Ee=$s(Ee,je.mode,Ue,null),Ee.return=je,Ee;if(typeof Ee.then=="function")return ct(je,eh(Ee),Ue);if(Ee.$$typeof===H)return ct(je,_n(je,Ee),Ue);th(je,Ee)}return null}function Ke(je,Ee,Ue,ot){var dn=Ee!==null?Ee.key:null;if(typeof Ue=="string"&&Ue!==""||typeof Ue=="number"||typeof Ue=="bigint")return dn!==null?null:z(je,Ee,""+Ue,ot);if(typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case C:return Ue.key===dn?be(je,Ee,Ue,ot):null;case j:return Ue.key===dn?ze(je,Ee,Ue,ot):null;case re:return Ue=Go(Ue),Ke(je,Ee,Ue,ot)}if(se(Ue)||q(Ue))return dn!==null?null:rt(je,Ee,Ue,ot,null);if(typeof Ue.then=="function")return Ke(je,Ee,eh(Ue),ot);if(Ue.$$typeof===H)return Ke(je,Ee,_n(je,Ue),ot);th(je,Ue)}return null}function Ye(je,Ee,Ue,ot,dn){if(typeof ot=="string"&&ot!==""||typeof ot=="number"||typeof ot=="bigint")return je=je.get(Ue)||null,z(Ee,je,""+ot,dn);if(typeof ot=="object"&&ot!==null){switch(ot.$$typeof){case C:return je=je.get(ot.key===null?Ue:ot.key)||null,be(Ee,je,ot,dn);case j:return je=je.get(ot.key===null?Ue:ot.key)||null,ze(Ee,je,ot,dn);case re:return ot=Go(ot),Ye(je,Ee,Ue,ot,dn)}if(se(ot)||q(ot))return je=je.get(Ue)||null,rt(Ee,je,ot,dn,null);if(typeof ot.then=="function")return Ye(je,Ee,Ue,eh(ot),dn);if(ot.$$typeof===H)return Ye(je,Ee,Ue,_n(Ee,ot),dn);th(Ee,ot)}return null}function nn(je,Ee,Ue,ot){for(var dn=null,Jn=null,an=Ee,Dn=Ee=0,Vn=null;an!==null&&Dn<Ue.length;Dn++){an.index>Dn?(Vn=an,an=null):Vn=an.sibling;var ei=Ke(je,an,Ue[Dn],ot);if(ei===null){an===null&&(an=Vn);break}r&&an&&ei.alternate===null&&s(je,an),Ee=b(ei,Ee,Dn),Jn===null?dn=ei:Jn.sibling=ei,Jn=ei,an=Vn}if(Dn===Ue.length)return o(je,an),Un&&Ln(je,Dn),dn;if(an===null){for(;Dn<Ue.length;Dn++)an=ct(je,Ue[Dn],ot),an!==null&&(Ee=b(an,Ee,Dn),Jn===null?dn=an:Jn.sibling=an,Jn=an);return Un&&Ln(je,Dn),dn}for(an=d(an);Dn<Ue.length;Dn++)Vn=Ye(an,je,Dn,Ue[Dn],ot),Vn!==null&&(r&&Vn.alternate!==null&&an.delete(Vn.key===null?Dn:Vn.key),Ee=b(Vn,Ee,Dn),Jn===null?dn=Vn:Jn.sibling=Vn,Jn=Vn);return r&&an.forEach(function(go){return s(je,go)}),Un&&Ln(je,Dn),dn}function yn(je,Ee,Ue,ot){if(Ue==null)throw Error(i(151));for(var dn=null,Jn=null,an=Ee,Dn=Ee=0,Vn=null,ei=Ue.next();an!==null&&!ei.done;Dn++,ei=Ue.next()){an.index>Dn?(Vn=an,an=null):Vn=an.sibling;var go=Ke(je,an,ei.value,ot);if(go===null){an===null&&(an=Vn);break}r&&an&&go.alternate===null&&s(je,an),Ee=b(go,Ee,Dn),Jn===null?dn=go:Jn.sibling=go,Jn=go,an=Vn}if(ei.done)return o(je,an),Un&&Ln(je,Dn),dn;if(an===null){for(;!ei.done;Dn++,ei=Ue.next())ei=ct(je,ei.value,ot),ei!==null&&(Ee=b(ei,Ee,Dn),Jn===null?dn=ei:Jn.sibling=ei,Jn=ei);return Un&&Ln(je,Dn),dn}for(an=d(an);!ei.done;Dn++,ei=Ue.next())ei=Ye(an,je,Dn,ei.value,ot),ei!==null&&(r&&ei.alternate!==null&&an.delete(ei.key===null?Dn:ei.key),Ee=b(ei,Ee,Dn),Jn===null?dn=ei:Jn.sibling=ei,Jn=ei);return r&&an.forEach(function(YE){return s(je,YE)}),Un&&Ln(je,Dn),dn}function gi(je,Ee,Ue,ot){if(typeof Ue=="object"&&Ue!==null&&Ue.type===k&&Ue.key===null&&(Ue=Ue.props.children),typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case C:e:{for(var dn=Ue.key;Ee!==null;){if(Ee.key===dn){if(dn=Ue.type,dn===k){if(Ee.tag===7){o(je,Ee.sibling),ot=y(Ee,Ue.props.children),ot.return=je,je=ot;break e}}else if(Ee.elementType===dn||typeof dn=="object"&&dn!==null&&dn.$$typeof===re&&Go(dn)===Ee.type){o(je,Ee.sibling),ot=y(Ee,Ue.props),lc(ot,Ue),ot.return=je,je=ot;break e}o(je,Ee);break}else s(je,Ee);Ee=Ee.sibling}Ue.type===k?(ot=$s(Ue.props.children,je.mode,ot,Ue.key),ot.return=je,je=ot):(ot=ic(Ue.type,Ue.key,Ue.props,null,je.mode,ot),lc(ot,Ue),ot.return=je,je=ot)}return M(je);case j:e:{for(dn=Ue.key;Ee!==null;){if(Ee.key===dn)if(Ee.tag===4&&Ee.stateNode.containerInfo===Ue.containerInfo&&Ee.stateNode.implementation===Ue.implementation){o(je,Ee.sibling),ot=y(Ee,Ue.children||[]),ot.return=je,je=ot;break e}else{o(je,Ee);break}else s(je,Ee);Ee=Ee.sibling}ot=Xa(Ue,je.mode,ot),ot.return=je,je=ot}return M(je);case re:return Ue=Go(Ue),gi(je,Ee,Ue,ot)}if(se(Ue))return nn(je,Ee,Ue,ot);if(q(Ue)){if(dn=q(Ue),typeof dn!="function")throw Error(i(150));return Ue=dn.call(Ue),yn(je,Ee,Ue,ot)}if(typeof Ue.then=="function")return gi(je,Ee,eh(Ue),ot);if(Ue.$$typeof===H)return gi(je,Ee,_n(je,Ue),ot);th(je,Ue)}return typeof Ue=="string"&&Ue!==""||typeof Ue=="number"||typeof Ue=="bigint"?(Ue=""+Ue,Ee!==null&&Ee.tag===6?(o(je,Ee.sibling),ot=y(Ee,Ue),ot.return=je,je=ot):(o(je,Ee),ot=zo(Ue,je.mode,ot),ot.return=je,je=ot),M(je)):o(je,Ee)}return function(je,Ee,Ue,ot){try{oc=0;var dn=gi(je,Ee,Ue,ot);return jl=null,dn}catch(an){if(an===Rl||an===Zd)throw an;var Jn=$i(29,an,null,je.mode);return Jn.lanes=ot,Jn.return=je,Jn}}}var Wo=yb(!0),bb=yb(!1),Za=!1;function Km(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wm(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 Ja(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function eo(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ri&2)!==0){var y=d.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),d.pending=s,s=Dl(r),Kd(r,null,o),s}return Nl(r,d,s,o),Dl(r)}function uc(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,cn(r,o)}}function Xm(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 M={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?y=b=M:b=b.next=M,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 Ym=!1;function cc(){if(Ym){var r=fr;if(r!==null)throw r}}function dc(r,s,o,d){Ym=!1;var y=r.updateQueue;Za=!1;var b=y.firstBaseUpdate,M=y.lastBaseUpdate,z=y.shared.pending;if(z!==null){y.shared.pending=null;var be=z,ze=be.next;be.next=null,M===null?b=ze:M.next=ze,M=be;var rt=r.alternate;rt!==null&&(rt=rt.updateQueue,z=rt.lastBaseUpdate,z!==M&&(z===null?rt.firstBaseUpdate=ze:z.next=ze,rt.lastBaseUpdate=be))}if(b!==null){var ct=y.baseState;M=0,rt=ze=be=null,z=b;do{var Ke=z.lane&-536870913,Ye=Ke!==z.lane;if(Ye?(qn&Ke)===Ke:(d&Ke)===Ke){Ke!==0&&Ke===ms&&(Ym=!0),rt!==null&&(rt=rt.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var nn=r,yn=z;Ke=s;var gi=o;switch(yn.tag){case 1:if(nn=yn.payload,typeof nn=="function"){ct=nn.call(gi,ct,Ke);break e}ct=nn;break e;case 3:nn.flags=nn.flags&-65537|128;case 0:if(nn=yn.payload,Ke=typeof nn=="function"?nn.call(gi,ct,Ke):nn,Ke==null)break e;ct=S({},ct,Ke);break e;case 2:Za=!0}}Ke=z.callback,Ke!==null&&(r.flags|=64,Ye&&(r.flags|=8192),Ye=y.callbacks,Ye===null?y.callbacks=[Ke]:Ye.push(Ke))}else Ye={lane:Ke,tag:z.tag,payload:z.payload,callback:z.callback,next:null},rt===null?(ze=rt=Ye,be=ct):rt=rt.next=Ye,M|=Ke;if(z=z.next,z===null){if(z=y.shared.pending,z===null)break;Ye=z,z=Ye.next,Ye.next=null,y.lastBaseUpdate=Ye,y.shared.pending=null}}while(!0);rt===null&&(be=ct),y.baseState=be,y.firstBaseUpdate=ze,y.lastBaseUpdate=rt,b===null&&(y.shared.lanes=0),so|=M,r.lanes=M,r.memoizedState=ct}}function vb(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function xb(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)vb(o[r],s)}var Ol=L(null),nh=L(0);function _b(r,s){r=Ta,we(nh,r),we(Ol,s),Ta=r|s.baseLanes}function Qm(){we(nh,Ta),we(Ol,Ol.current)}function Zm(){Ta=nh.current,pe(Ol),pe(nh)}var ns=L(null),ps=null;function to(r){var s=r.alternate;we(Zi,Zi.current&1),we(ns,r),ps===null&&(s===null||Ol.current!==null||s.memoizedState!==null)&&(ps=r)}function Jm(r){we(Zi,Zi.current),we(ns,r),ps===null&&(ps=r)}function wb(r){r.tag===22?(we(Zi,Zi.current),we(ns,r),ps===null&&(ps=r)):no()}function no(){we(Zi,Zi.current),we(ns,ns.current)}function is(r){pe(ns),ps===r&&(ps=null),pe(Zi)}var Zi=L(0);function ih(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||s0(o)||a0(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ga=0,An=null,mi=null,sr=null,rh=!1,Ll=!1,Xo=!1,sh=0,hc=0,Il=null,Uk=0;function qi(){throw Error(i(321))}function ep(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!Sr(r[o],s[o]))return!1;return!0}function tp(r,s,o,d,y,b){return ga=b,An=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$.H=r===null||r.memoizedState===null?sv:gp,Xo=!1,b=o(d,y),Xo=!1,Ll&&(b=Tb(s,o,d,y)),Sb(r),b}function Sb(r){$.H=pc;var s=mi!==null&&mi.next!==null;if(ga=0,sr=mi=An=null,rh=!1,hc=0,Il=null,s)throw Error(i(300));r===null||ar||(r=r.dependencies,r!==null&&jt(r)&&(ar=!0))}function Tb(r,s,o,d){An=r;var y=0;do{if(Ll&&(Il=null),hc=0,Ll=!1,25<=y)throw Error(i(301));if(y+=1,sr=mi=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}$.H=av,b=s(o,d)}while(Ll);return b}function zk(){var r=$.H,s=r.useState()[0];return s=typeof s.then=="function"?fc(s):s,r=r.useState()[0],(mi!==null?mi.memoizedState:null)!==r&&(An.flags|=1024),s}function np(){var r=sh!==0;return sh=0,r}function ip(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function rp(r){if(rh){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}rh=!1}ga=0,sr=mi=An=null,Ll=!1,hc=sh=0,Il=null}function Dr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sr===null?An.memoizedState=sr=r:sr=sr.next=r,sr}function Ji(){if(mi===null){var r=An.alternate;r=r!==null?r.memoizedState:null}else r=mi.next;var s=sr===null?An.memoizedState:sr.next;if(s!==null)sr=s,mi=r;else{if(r===null)throw An.alternate===null?Error(i(467)):Error(i(310));mi=r,r={memoizedState:mi.memoizedState,baseState:mi.baseState,baseQueue:mi.baseQueue,queue:mi.queue,next:null},sr===null?An.memoizedState=sr=r:sr=sr.next=r}return sr}function ah(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fc(r){var s=hc;return hc+=1,Il===null&&(Il=[]),r=mb(Il,r,s),s=An,(sr===null?s.memoizedState:sr.next)===null&&(s=s.alternate,$.H=s===null||s.memoizedState===null?sv:gp),r}function oh(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return fc(r);if(r.$$typeof===H)return Vt(r)}throw Error(i(438,String(r)))}function sp(r){var s=null,o=An.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=An.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(s={data:d.data.map(function(y){return y.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=ah(),An.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(r),d=0;d<r;d++)o[d]=R;return s.index++,o}function ya(r,s){return typeof s=="function"?s(r):s}function lh(r){var s=Ji();return ap(s,mi,r)}function ap(r,s,o){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=o;var y=r.baseQueue,b=d.pending;if(b!==null){if(y!==null){var M=y.next;y.next=b.next,b.next=M}s.baseQueue=y=b,d.pending=null}if(b=r.baseState,y===null)r.memoizedState=b;else{s=y.next;var z=M=null,be=null,ze=s,rt=!1;do{var ct=ze.lane&-536870913;if(ct!==ze.lane?(qn&ct)===ct:(ga&ct)===ct){var Ke=ze.revertLane;if(Ke===0)be!==null&&(be=be.next={lane:0,revertLane:0,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null}),ct===ms&&(rt=!0);else if((ga&Ke)===Ke){ze=ze.next,Ke===ms&&(rt=!0);continue}else ct={lane:0,revertLane:ze.revertLane,gesture:null,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},be===null?(z=be=ct,M=b):be=be.next=ct,An.lanes|=Ke,so|=Ke;ct=ze.action,Xo&&o(b,ct),b=ze.hasEagerState?ze.eagerState:o(b,ct)}else Ke={lane:ct,revertLane:ze.revertLane,gesture:ze.gesture,action:ze.action,hasEagerState:ze.hasEagerState,eagerState:ze.eagerState,next:null},be===null?(z=be=Ke,M=b):be=be.next=Ke,An.lanes|=ct,so|=ct;ze=ze.next}while(ze!==null&&ze!==s);if(be===null?M=b:be.next=z,!Sr(b,r.memoizedState)&&(ar=!0,rt&&(o=fr,o!==null)))throw o;r.memoizedState=b,r.baseState=M,r.baseQueue=be,d.lastRenderedState=b}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function op(r){var s=Ji(),o=s.queue;if(o===null)throw Error(i(311));o.lastRenderedReducer=r;var d=o.dispatch,y=o.pending,b=s.memoizedState;if(y!==null){o.pending=null;var M=y=y.next;do b=r(b,M.action),M=M.next;while(M!==y);Sr(b,s.memoizedState)||(ar=!0),s.memoizedState=b,s.baseQueue===null&&(s.baseState=b),o.lastRenderedState=b}return[b,d]}function kb(r,s,o){var d=An,y=Ji(),b=Un;if(b){if(o===void 0)throw Error(i(407));o=o()}else o=s();var M=!Sr((mi||y).memoizedState,o);if(M&&(y.memoizedState=o,ar=!0),y=y.queue,cp(Ab.bind(null,d,y,r),[r]),y.getSnapshot!==s||M||sr!==null&&sr.memoizedState.tag&1){if(d.flags|=2048,Bl(9,{destroy:void 0},Cb.bind(null,d,y,o,s),null),xi===null)throw Error(i(349));b||(ga&127)!==0||Eb(d,s,o)}return o}function Eb(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=An.updateQueue,s===null?(s=ah(),An.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function Cb(r,s,o,d){s.value=o,s.getSnapshot=d,Nb(s)&&Db(r)}function Ab(r,s,o){return o(function(){Nb(s)&&Db(r)})}function Nb(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!Sr(r,o)}catch{return!0}}function Db(r){var s=ma(r,2);s!==null&&qr(s,r,2)}function lp(r){var s=Dr();if(typeof r=="function"){var o=r;if(r=o(),Xo){$t(!0);try{o()}finally{$t(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:r},s}function Mb(r,s,o,d){return r.baseState=o,ap(r,mi,typeof d=="function"?d:ya)}function Hk(r,s,o,d,y){if(dh(r))throw Error(i(485));if(r=s.action,r!==null){var b={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){b.listeners.push(M)}};$.T!==null?o(!0):b.isTransition=!1,d(b),o=s.pending,o===null?(b.next=s.pending=b,Rb(s,b)):(b.next=o.next,s.pending=o.next=b)}}function Rb(r,s){var o=s.action,d=s.payload,y=r.state;if(s.isTransition){var b=$.T,M={};$.T=M;try{var z=o(y,d),be=$.S;be!==null&&be(M,z),jb(r,s,z)}catch(ze){up(r,s,ze)}finally{b!==null&&M.types!==null&&(b.types=M.types),$.T=b}}else try{b=o(y,d),jb(r,s,b)}catch(ze){up(r,s,ze)}}function jb(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){Ob(r,s,d)},function(d){return up(r,s,d)}):Ob(r,s,o)}function Ob(r,s,o){s.status="fulfilled",s.value=o,Lb(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,Rb(r,o)))}function up(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,Lb(s),s=s.next;while(s!==d)}r.action=null}function Lb(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function Ib(r,s){return s}function Bb(r,s){if(Un){var o=xi.formState;if(o!==null){e:{var d=An;if(Un){if(vi){t:{for(var y=vi,b=Fr;y.nodeType!==8;){if(!b){y=null;break t}if(y=gs(y.nextSibling),y===null){y=null;break t}}b=y.data,y=b==="F!"||b==="F"?y:null}if(y){vi=gs(y.nextSibling),d=y.data==="F!";break e}}Ks(d)}d=!1}d&&(s=o[0])}}return o=Dr(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ib,lastRenderedState:s},o.queue=d,o=nv.bind(null,An,d),d.dispatch=o,d=lp(!1),b=pp.bind(null,An,!1,d.queue),d=Dr(),y={state:s,dispatch:null,action:r,pending:null},d.queue=y,o=Hk.bind(null,An,y,b,o),y.dispatch=o,d.memoizedState=r,[s,o,!1]}function Pb(r){var s=Ji();return Fb(s,mi,r)}function Fb(r,s,o){if(s=ap(r,s,Ib)[0],r=lh(ya)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=fc(s)}catch(M){throw M===Rl?Zd:M}else d=s;s=Ji();var y=s.queue,b=y.dispatch;return o!==s.memoizedState&&(An.flags|=2048,Bl(9,{destroy:void 0},$k.bind(null,y,o),null)),[d,b,r]}function $k(r,s){r.action=s}function Ub(r){var s=Ji(),o=mi;if(o!==null)return Fb(s,o,r);Ji(),s=s.memoizedState,o=Ji();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Bl(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=An.updateQueue,s===null&&(s=ah(),An.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=r.next=r:(d=o.next,o.next=r,r.next=d,s.lastEffect=r),r}function zb(){return Ji().memoizedState}function uh(r,s,o,d){var y=Dr();An.flags|=r,y.memoizedState=Bl(1|s,{destroy:void 0},o,d===void 0?null:d)}function ch(r,s,o,d){var y=Ji();d=d===void 0?null:d;var b=y.memoizedState.inst;mi!==null&&d!==null&&ep(d,mi.memoizedState.deps)?y.memoizedState=Bl(s,b,o,d):(An.flags|=r,y.memoizedState=Bl(1|s,b,o,d))}function Hb(r,s){uh(8390656,8,r,s)}function cp(r,s){ch(2048,8,r,s)}function qk(r){An.flags|=4;var s=An.updateQueue;if(s===null)s=ah(),An.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function $b(r){var s=Ji().memoizedState;return qk({ref:s,nextImpl:r}),function(){if((ri&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function qb(r,s){return ch(4,2,r,s)}function Vb(r,s){return ch(4,4,r,s)}function Gb(r,s){if(typeof s=="function"){r=r();var o=s(r);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Kb(r,s,o){o=o!=null?o.concat([r]):null,ch(4,4,Gb.bind(null,s,r),o)}function dp(){}function Wb(r,s){var o=Ji();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&ep(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function Xb(r,s){var o=Ji();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&ep(s,d[1]))return d[0];if(d=r(),Xo){$t(!0);try{r()}finally{$t(!1)}}return o.memoizedState=[d,s],d}function hp(r,s,o){return o===void 0||(ga&1073741824)!==0&&(qn&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=Yv(),An.lanes|=r,so|=r,o)}function Yb(r,s,o,d){return Sr(o,s)?o:Ol.current!==null?(r=hp(r,o,d),Sr(r,s)||(ar=!0),r):(ga&42)===0||(ga&1073741824)!==0&&(qn&261930)===0?(ar=!0,r.memoizedState=o):(r=Yv(),An.lanes|=r,so|=r,s)}function Qb(r,s,o,d,y){var b=F.p;F.p=b!==0&&8>b?b:8;var M=$.T,z={};$.T=z,pp(r,!1,s,o);try{var be=y(),ze=$.S;if(ze!==null&&ze(z,be),be!==null&&typeof be=="object"&&typeof be.then=="function"){var rt=Fk(be,d);mc(r,s,rt,as(r))}else mc(r,s,d,as(r))}catch(ct){mc(r,s,{then:function(){},status:"rejected",reason:ct},as())}finally{F.p=b,M!==null&&z.types!==null&&(M.types=z.types),$.T=M}}function Vk(){}function fp(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Zb(r).queue;Qb(r,y,s,X,o===null?Vk:function(){return Jb(r),o(d)})}function Zb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:X},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Jb(r){var s=Zb(r);s.next===null&&(s=r.alternate.memoizedState),mc(r,s.next.queue,{},as())}function mp(){return Vt(Mc)}function ev(){return Ji().memoizedState}function tv(){return Ji().memoizedState}function Gk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=as();r=Ja(o);var d=eo(s,r,o);d!==null&&(qr(d,s,o),uc(d,s,o)),s={cache:pa()},r.payload=s;return}s=s.return}}function Kk(r,s,o){var d=as();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},dh(r)?iv(s,o):(o=tc(r,s,o,d),o!==null&&(qr(o,r,d),rv(o,s,d)))}function nv(r,s,o){var d=as();mc(r,s,o,d)}function mc(r,s,o,d){var y={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(dh(r))iv(s,y);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=s.lastRenderedReducer,b!==null))try{var M=s.lastRenderedState,z=b(M,o);if(y.hasEagerState=!0,y.eagerState=z,Sr(z,M))return Nl(r,s,y,0),xi===null&&Al(),!1}catch{}if(o=tc(r,s,y,d),o!==null)return qr(o,r,d),rv(o,s,d),!0}return!1}function pp(r,s,o,d){if(d={lane:2,revertLane:Kp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},dh(r)){if(s)throw Error(i(479))}else s=tc(r,o,d,2),s!==null&&qr(s,r,2)}function dh(r){var s=r.alternate;return r===An||s!==null&&s===An}function iv(r,s){Ll=rh=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function rv(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,cn(r,o)}}var pc={readContext:Vt,use:oh,useCallback:qi,useContext:qi,useEffect:qi,useImperativeHandle:qi,useLayoutEffect:qi,useInsertionEffect:qi,useMemo:qi,useReducer:qi,useRef:qi,useState:qi,useDebugValue:qi,useDeferredValue:qi,useTransition:qi,useSyncExternalStore:qi,useId:qi,useHostTransitionStatus:qi,useFormState:qi,useActionState:qi,useOptimistic:qi,useMemoCache:qi,useCacheRefresh:qi};pc.useEffectEvent=qi;var sv={readContext:Vt,use:oh,useCallback:function(r,s){return Dr().memoizedState=[r,s===void 0?null:s],r},useContext:Vt,useEffect:Hb,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,uh(4194308,4,Gb.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=Dr();s=s===void 0?null:s;var d=r();if(Xo){$t(!0);try{r()}finally{$t(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Dr();if(o!==void 0){var y=o(s);if(Xo){$t(!0);try{o(s)}finally{$t(!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=Kk.bind(null,An,r),[d.memoizedState,r]},useRef:function(r){var s=Dr();return r={current:r},s.memoizedState=r},useState:function(r){r=lp(r);var s=r.queue,o=nv.bind(null,An,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:dp,useDeferredValue:function(r,s){var o=Dr();return hp(o,r,s)},useTransition:function(){var r=lp(!1);return r=Qb.bind(null,An,r.queue,!0,!1),Dr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=An,y=Dr();if(Un){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),xi===null)throw Error(i(349));(qn&127)!==0||Eb(d,s,o)}y.memoizedState=o;var b={value:o,getSnapshot:s};return y.queue=b,Hb(Ab.bind(null,d,b,r),[r]),d.flags|=2048,Bl(9,{destroy:void 0},Cb.bind(null,d,b,o,s),null),o},useId:function(){var r=Dr(),s=xi.identifierPrefix;if(Un){var o=br,d=ts;o=(d&~(1<<32-Ot(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=sh++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=Uk++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:mp,useFormState:Bb,useActionState:Bb,useOptimistic:function(r){var s=Dr();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=pp.bind(null,An,!0,o),o.dispatch=s,[r,s]},useMemoCache:sp,useCacheRefresh:function(){return Dr().memoizedState=Gk.bind(null,An)},useEffectEvent:function(r){var s=Dr(),o={impl:r};return s.memoizedState=o,function(){if((ri&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},gp={readContext:Vt,use:oh,useCallback:Wb,useContext:Vt,useEffect:cp,useImperativeHandle:Kb,useInsertionEffect:qb,useLayoutEffect:Vb,useMemo:Xb,useReducer:lh,useRef:zb,useState:function(){return lh(ya)},useDebugValue:dp,useDeferredValue:function(r,s){var o=Ji();return Yb(o,mi.memoizedState,r,s)},useTransition:function(){var r=lh(ya)[0],s=Ji().memoizedState;return[typeof r=="boolean"?r:fc(r),s]},useSyncExternalStore:kb,useId:ev,useHostTransitionStatus:mp,useFormState:Pb,useActionState:Pb,useOptimistic:function(r,s){var o=Ji();return Mb(o,mi,r,s)},useMemoCache:sp,useCacheRefresh:tv};gp.useEffectEvent=$b;var av={readContext:Vt,use:oh,useCallback:Wb,useContext:Vt,useEffect:cp,useImperativeHandle:Kb,useInsertionEffect:qb,useLayoutEffect:Vb,useMemo:Xb,useReducer:op,useRef:zb,useState:function(){return op(ya)},useDebugValue:dp,useDeferredValue:function(r,s){var o=Ji();return mi===null?hp(o,r,s):Yb(o,mi.memoizedState,r,s)},useTransition:function(){var r=op(ya)[0],s=Ji().memoizedState;return[typeof r=="boolean"?r:fc(r),s]},useSyncExternalStore:kb,useId:ev,useHostTransitionStatus:mp,useFormState:Ub,useActionState:Ub,useOptimistic:function(r,s){var o=Ji();return mi!==null?Mb(o,mi,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:sp,useCacheRefresh:tv};av.useEffectEvent=$b;function yp(r,s,o,d){s=r.memoizedState,o=o(d,s),o=o==null?s:S({},s,o),r.memoizedState=o,r.lanes===0&&(r.updateQueue.baseState=o)}var bp={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=as(),y=Ja(d);y.payload=s,o!=null&&(y.callback=o),s=eo(r,y,d),s!==null&&(qr(s,r,d),uc(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=as(),y=Ja(d);y.tag=1,y.payload=s,o!=null&&(y.callback=o),s=eo(r,y,d),s!==null&&(qr(s,r,d),uc(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=as(),d=Ja(o);d.tag=2,s!=null&&(d.callback=s),s=eo(r,d,o),s!==null&&(qr(s,r,o),uc(s,r,o))}};function ov(r,s,o,d,y,b,M){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,b,M):s.prototype&&s.prototype.isPureReactComponent?!zs(o,d)||!zs(y,b):!0}function lv(r,s,o,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,d),s.state!==r&&bp.enqueueReplaceState(s,s.state,null)}function Yo(r,s){var o=s;if("ref"in s){o={};for(var d in s)d!=="ref"&&(o[d]=s[d])}if(r=r.defaultProps){o===s&&(o=S({},o));for(var y in r)o[y]===void 0&&(o[y]=r[y])}return o}function uv(r){Ga(r)}function cv(r){console.error(r)}function dv(r){Ga(r)}function hh(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function hv(r,s,o){try{var d=r.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function vp(r,s,o){return o=Ja(o),o.tag=3,o.payload={element:null},o.callback=function(){hh(r,s)},o}function fv(r){return r=Ja(r),r.tag=3,r}function mv(r,s,o,d){var y=o.type.getDerivedStateFromError;if(typeof y=="function"){var b=d.value;r.payload=function(){return y(b)},r.callback=function(){hv(s,o,d)}}var M=o.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(r.callback=function(){hv(s,o,d),typeof y!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var z=d.stack;this.componentDidCatch(d.value,{componentStack:z!==null?z:""})})}function Wk(r,s,o,d,y){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&Xe(s,o,y,!0),o=ns.current,o!==null){switch(o.tag){case 31:case 13:return ps===null?Th():o.alternate===null&&Vi===0&&(Vi=3),o.flags&=-257,o.flags|=65536,o.lanes=y,d===Jd?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),qp(r,d,y)),!1;case 22:return o.flags|=65536,d===Jd?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([d]):o.add(d)),qp(r,d,y)),!1}throw Error(i(435,o.tag))}return qp(r,d,y),Th(),!1}if(Un)return s=ns.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=y,d!==sc&&(r=Error(i(422),{cause:d}),x(Ir(r,o)))):(d!==sc&&(s=Error(i(423),{cause:d}),x(Ir(s,o))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Ir(d,o),y=vp(r.stateNode,d,y),Xm(r,y),Vi!==4&&(Vi=2)),!1;var b=Error(i(520),{cause:d});if(b=Ir(b,o),Sc===null?Sc=[b]:Sc.push(b),Vi!==4&&(Vi=2),s===null)return!0;d=Ir(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=y&-y,o.lanes|=r,r=vp(o.stateNode,d,r),Xm(o,r),!1;case 1:if(s=o.type,b=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ao===null||!ao.has(b))))return o.flags|=65536,y&=-y,o.lanes|=y,y=fv(y),mv(y,r,o,d),Xm(o,y),!1}o=o.return}while(o!==null);return!1}var xp=Error(i(461)),ar=!1;function vr(r,s,o,d){s.child=r===null?bb(s,null,o,d):Wo(s,r.child,o,d)}function pv(r,s,o,d,y){o=o.render;var b=s.ref;if("ref"in d){var M={};for(var z in d)z!=="ref"&&(M[z]=d[z])}else M=d;return it(s),d=tp(r,s,o,M,b,y),z=np(),r!==null&&!ar?(ip(r,s,y),ba(r,s,y)):(Un&&z&&cr(s),s.flags|=1,vr(r,s,d,y),s.child)}function gv(r,s,o,d,y){if(r===null){var b=o.type;return typeof b=="function"&&!nc(b)&&b.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=b,yv(r,s,b,d,y)):(r=ic(o.type,null,d,s,s.mode,y),r.ref=s.ref,r.return=s,s.child=r)}if(b=r.child,!Ap(r,y)){var M=b.memoizedProps;if(o=o.compare,o=o!==null?o:zs,o(M,d)&&r.ref===s.ref)return ba(r,s,y)}return s.flags|=1,r=Ds(b,d),r.ref=s.ref,r.return=s,s.child=r}function yv(r,s,o,d,y){if(r!==null){var b=r.memoizedProps;if(zs(b,d)&&r.ref===s.ref)if(ar=!1,s.pendingProps=d=b,Ap(r,y))(r.flags&131072)!==0&&(ar=!0);else return s.lanes=r.lanes,ba(r,s,y)}return _p(r,s,o,d,y)}function bv(r,s,o,d){var y=d.children,b=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((s.flags&128)!==0){if(b=b!==null?b.baseLanes|o:o,r!==null){for(d=s.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~b}else d=0,s.child=null;return vv(r,s,b,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Qd(s,b!==null?b.cachePool:null),b!==null?_b(s,b):Qm(),wb(s);else return d=s.lanes=536870912,vv(r,s,b!==null?b.baseLanes|o:o,o,d)}else b!==null?(Qd(s,b.cachePool),_b(s,b),no(),s.memoizedState=null):(r!==null&&Qd(s,null),Qm(),no());return vr(r,s,y,o),s.child}function gc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function vv(r,s,o,d,y){var b=Vm();return b=b===null?null:{parent:ki._currentValue,pool:b},s.memoizedState={baseLanes:o,cachePool:b},r!==null&&Qd(s,null),Qm(),wb(s),r!==null&&Xe(r,s,d,!0),s.childLanes=y,null}function fh(r,s){return s=ph({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function xv(r,s,o){return Wo(s,r.child,null,o),r=fh(s,s.pendingProps),r.flags|=2,is(s),s.memoizedState=null,r}function Xk(r,s,o){var d=s.pendingProps,y=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Un){if(d.mode==="hidden")return r=fh(s,d),s.lanes=536870912,gc(null,r);if(Jm(s),(r=vi)?(r=Rx(r,Fr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:qs!==null?{id:ts,overflow:br}:null,retryLane:536870912,hydrationErrors:null},o=rc(r),o.return=s,s.child=o,rr=s,vi=null)):r=null,r===null)throw Ks(s);return s.lanes=536870912,null}return fh(s,d)}var b=r.memoizedState;if(b!==null){var M=b.dehydrated;if(Jm(s),y)if(s.flags&256)s.flags&=-257,s=xv(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(ar||Xe(r,s,o,!1),y=(o&r.childLanes)!==0,ar||y){if(d=xi,d!==null&&(M=Cn(d,o),M!==0&&M!==b.retryLane))throw b.retryLane=M,ma(r,M),qr(d,r,M),xp;Th(),s=xv(r,s,o)}else r=b.treeContext,vi=gs(M.nextSibling),rr=s,Un=!0,Gs=null,Fr=!1,r!==null&&Xd(s,r),s=fh(s,d),s.flags|=4096;return s}return r=Ds(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function mh(r,s){var o=s.ref;if(o===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(i(284));(r===null||r.ref!==o)&&(s.flags|=4194816)}}function _p(r,s,o,d,y){return it(s),o=tp(r,s,o,d,void 0,y),d=np(),r!==null&&!ar?(ip(r,s,y),ba(r,s,y)):(Un&&d&&cr(s),s.flags|=1,vr(r,s,o,y),s.child)}function _v(r,s,o,d,y,b){return it(s),s.updateQueue=null,o=Tb(s,d,o,y),Sb(r),d=np(),r!==null&&!ar?(ip(r,s,b),ba(r,s,b)):(Un&&d&&cr(s),s.flags|=1,vr(r,s,o,b),s.child)}function wv(r,s,o,d,y){if(it(s),s.stateNode===null){var b=Wa,M=o.contextType;typeof M=="object"&&M!==null&&(b=Vt(M)),b=new o(d,b),s.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=bp,s.stateNode=b,b._reactInternals=s,b=s.stateNode,b.props=d,b.state=s.memoizedState,b.refs={},Km(s),M=o.contextType,b.context=typeof M=="object"&&M!==null?Vt(M):Wa,b.state=s.memoizedState,M=o.getDerivedStateFromProps,typeof M=="function"&&(yp(s,o,M,d),b.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(M=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),M!==b.state&&bp.enqueueReplaceState(b,b.state,null),dc(s,d,b,y),cc(),b.state=s.memoizedState),typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){b=s.stateNode;var z=s.memoizedProps,be=Yo(o,z);b.props=be;var ze=b.context,rt=o.contextType;M=Wa,typeof rt=="object"&&rt!==null&&(M=Vt(rt));var ct=o.getDerivedStateFromProps;rt=typeof ct=="function"||typeof b.getSnapshotBeforeUpdate=="function",z=s.pendingProps!==z,rt||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(z||ze!==M)&&lv(s,b,d,M),Za=!1;var Ke=s.memoizedState;b.state=Ke,dc(s,d,b,y),cc(),ze=s.memoizedState,z||Ke!==ze||Za?(typeof ct=="function"&&(yp(s,o,ct,d),ze=s.memoizedState),(be=Za||ov(s,o,be,d,Ke,ze,M))?(rt||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(s.flags|=4194308)):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=ze),b.props=d,b.state=ze,b.context=M,d=be):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{b=s.stateNode,Wm(r,s),M=s.memoizedProps,rt=Yo(o,M),b.props=rt,ct=s.pendingProps,Ke=b.context,ze=o.contextType,be=Wa,typeof ze=="object"&&ze!==null&&(be=Vt(ze)),z=o.getDerivedStateFromProps,(ze=typeof z=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(M!==ct||Ke!==be)&&lv(s,b,d,be),Za=!1,Ke=s.memoizedState,b.state=Ke,dc(s,d,b,y),cc();var Ye=s.memoizedState;M!==ct||Ke!==Ye||Za||r!==null&&r.dependencies!==null&&jt(r.dependencies)?(typeof z=="function"&&(yp(s,o,z,d),Ye=s.memoizedState),(rt=Za||ov(s,o,rt,d,Ke,Ye,be)||r!==null&&r.dependencies!==null&&jt(r.dependencies))?(ze||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,Ye,be),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,Ye,be)),typeof b.componentDidUpdate=="function"&&(s.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof b.componentDidUpdate!="function"||M===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=Ye),b.props=d,b.state=Ye,b.context=be,d=rt):(typeof b.componentDidUpdate!="function"||M===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&Ke===r.memoizedState||(s.flags|=1024),d=!1)}return b=d,mh(r,s),d=(s.flags&128)!==0,b||d?(b=s.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:b.render(),s.flags|=1,r!==null&&d?(s.child=Wo(s,r.child,null,y),s.child=Wo(s,null,o,y)):vr(r,s,o,y),s.memoizedState=b.state,r=s.child):r=ba(r,s,y),r}function Sv(r,s,o,d){return v(),s.flags|=256,vr(r,s,o,d),s.child}var wp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sp(r){return{baseLanes:r,cachePool:hb()}}function Tp(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=ss),r}function Tv(r,s,o){var d=s.pendingProps,y=!1,b=(s.flags&128)!==0,M;if((M=b)||(M=r!==null&&r.memoizedState===null?!1:(Zi.current&2)!==0),M&&(y=!0,s.flags&=-129),M=(s.flags&32)!==0,s.flags&=-33,r===null){if(Un){if(y?to(s):no(),(r=vi)?(r=Rx(r,Fr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:qs!==null?{id:ts,overflow:br}:null,retryLane:536870912,hydrationErrors:null},o=rc(r),o.return=s,s.child=o,rr=s,vi=null)):r=null,r===null)throw Ks(s);return a0(r)?s.lanes=32:s.lanes=536870912,null}var z=d.children;return d=d.fallback,y?(no(),y=s.mode,z=ph({mode:"hidden",children:z},y),d=$s(d,y,o,null),z.return=s,d.return=s,z.sibling=d,s.child=z,d=s.child,d.memoizedState=Sp(o),d.childLanes=Tp(r,M,o),s.memoizedState=wp,gc(null,d)):(to(s),kp(s,z))}var be=r.memoizedState;if(be!==null&&(z=be.dehydrated,z!==null)){if(b)s.flags&256?(to(s),s.flags&=-257,s=Ep(r,s,o)):s.memoizedState!==null?(no(),s.child=r.child,s.flags|=128,s=null):(no(),z=d.fallback,y=s.mode,d=ph({mode:"visible",children:d.children},y),z=$s(z,y,o,null),z.flags|=2,d.return=s,z.return=s,d.sibling=z,s.child=d,Wo(s,r.child,null,o),d=s.child,d.memoizedState=Sp(o),d.childLanes=Tp(r,M,o),s.memoizedState=wp,s=gc(null,d));else if(to(s),a0(z)){if(M=z.nextSibling&&z.nextSibling.dataset,M)var ze=M.dgst;M=ze,d=Error(i(419)),d.stack="",d.digest=M,x({value:d,source:null,stack:null}),s=Ep(r,s,o)}else if(ar||Xe(r,s,o,!1),M=(o&r.childLanes)!==0,ar||M){if(M=xi,M!==null&&(d=Cn(M,o),d!==0&&d!==be.retryLane))throw be.retryLane=d,ma(r,d),qr(M,r,d),xp;s0(z)||Th(),s=Ep(r,s,o)}else s0(z)?(s.flags|=192,s.child=r.child,s=null):(r=be.treeContext,vi=gs(z.nextSibling),rr=s,Un=!0,Gs=null,Fr=!1,r!==null&&Xd(s,r),s=kp(s,d.children),s.flags|=4096);return s}return y?(no(),z=d.fallback,y=s.mode,be=r.child,ze=be.sibling,d=Ds(be,{mode:"hidden",children:d.children}),d.subtreeFlags=be.subtreeFlags&65011712,ze!==null?z=Ds(ze,z):(z=$s(z,y,o,null),z.flags|=2),z.return=s,d.return=s,d.sibling=z,s.child=d,gc(null,d),d=s.child,z=r.child.memoizedState,z===null?z=Sp(o):(y=z.cachePool,y!==null?(be=ki._currentValue,y=y.parent!==be?{parent:be,pool:be}:y):y=hb(),z={baseLanes:z.baseLanes|o,cachePool:y}),d.memoizedState=z,d.childLanes=Tp(r,M,o),s.memoizedState=wp,gc(r.child,d)):(to(s),o=r.child,r=o.sibling,o=Ds(o,{mode:"visible",children:d.children}),o.return=s,o.sibling=null,r!==null&&(M=s.deletions,M===null?(s.deletions=[r],s.flags|=16):M.push(r)),s.child=o,s.memoizedState=null,o)}function kp(r,s){return s=ph({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function ph(r,s){return r=$i(22,r,null,s),r.lanes=0,r}function Ep(r,s,o){return Wo(s,r.child,null,o),r=kp(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function kv(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),me(r.return,s,o)}function Cp(r,s,o,d,y,b){var M=r.memoizedState;M===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:y,treeForkCount:b}:(M.isBackwards=s,M.rendering=null,M.renderingStartTime=0,M.last=d,M.tail=o,M.tailMode=y,M.treeForkCount=b)}function Ev(r,s,o){var d=s.pendingProps,y=d.revealOrder,b=d.tail;d=d.children;var M=Zi.current,z=(M&2)!==0;if(z?(M=M&1|2,s.flags|=128):M&=1,we(Zi,M),vr(r,s,d,o),d=Un?$o:0,!z&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&kv(r,o,s);else if(r.tag===19)kv(r,o,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(o=s.child,y=null;o!==null;)r=o.alternate,r!==null&&ih(r)===null&&(y=o),o=o.sibling;o=y,o===null?(y=s.child,s.child=null):(y=o.sibling,o.sibling=null),Cp(s,!1,y,o,b,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,y=s.child,s.child=null;y!==null;){if(r=y.alternate,r!==null&&ih(r)===null){s.child=y;break}r=y.sibling,y.sibling=o,o=y,y=r}Cp(s,!0,o,null,b,d);break;case"together":Cp(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function ba(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),so|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(Xe(r,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(i(153));if(s.child!==null){for(r=s.child,o=Ds(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=Ds(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function Ap(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&jt(r)))}function Yk(r,s,o){switch(s.tag){case 3:_t(s,s.stateNode.containerInfo),J(s,ki,r.memoizedState.cache),v();break;case 27:case 5:xe(s);break;case 4:_t(s,s.stateNode.containerInfo);break;case 10:J(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Jm(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(to(s),s.flags|=128,null):(o&s.child.childLanes)!==0?Tv(r,s,o):(to(s),r=ba(r,s,o),r!==null?r.sibling:null);to(s);break;case 19:var y=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(Xe(r,s,o,!1),d=(o&s.childLanes)!==0),y){if(d)return Ev(r,s,o);s.flags|=128}if(y=s.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),we(Zi,Zi.current),d)break;return null;case 22:return s.lanes=0,bv(r,s,o,s.pendingProps);case 24:J(s,ki,r.memoizedState.cache)}return ba(r,s,o)}function Cv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)ar=!0;else{if(!Ap(r,o)&&(s.flags&128)===0)return ar=!1,Yk(r,s,o);ar=(r.flags&131072)!==0}else ar=!1,Un&&(s.flags&1048576)!==0&&Vs(s,$o,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Go(s.elementType),s.type=r,typeof r=="function")nc(r)?(d=Yo(r,d),s.tag=1,s=wv(null,s,r,d,o)):(s.tag=0,s=_p(null,s,r,d,o));else{if(r!=null){var y=r.$$typeof;if(y===ie){s.tag=11,s=pv(null,s,r,d,o);break e}else if(y===O){s.tag=14,s=gv(null,s,r,d,o);break e}}throw s=ue(r)||r,Error(i(306,s,""))}}return s;case 0:return _p(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,y=Yo(d,s.pendingProps),wv(r,s,d,y,o);case 3:e:{if(_t(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var b=s.memoizedState;y=b.element,Wm(r,s),dc(s,d,null,o);var M=s.memoizedState;if(d=M.cache,J(s,ki,d),d!==b.cache&&Ae(s,[ki],o,!0),cc(),d=M.element,b.isDehydrated)if(b={element:d,isDehydrated:!1,cache:M.cache},s.updateQueue.baseState=b,s.memoizedState=b,s.flags&256){s=Sv(r,s,d,o);break e}else if(d!==y){y=Ir(Error(i(424)),s),x(y),s=Sv(r,s,d,o);break e}else for(r=s.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,vi=gs(r.firstChild),rr=s,Un=!0,Gs=null,Fr=!0,o=bb(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(v(),d===y){s=ba(r,s,o);break e}vr(r,s,d,o)}s=s.child}return s;case 26:return mh(r,s),r===null?(o=Px(s.type,null,s.pendingProps,null))?s.memoizedState=o:Un||(o=s.type,r=s.pendingProps,d=Mh(Oe.current).createElement(o),d[Zt]=s,d[zt]=r,xr(d,o,r),rn(d),s.stateNode=d):s.memoizedState=Px(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return xe(s),r===null&&Un&&(d=s.stateNode=Lx(s.type,s.pendingProps,Oe.current),rr=s,Fr=!0,y=vi,co(s.type)?(o0=y,vi=gs(d.firstChild)):vi=y),vr(r,s,s.pendingProps.children,o),mh(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Un&&((y=d=vi)&&(d=EE(d,s.type,s.pendingProps,Fr),d!==null?(s.stateNode=d,rr=s,vi=gs(d.firstChild),Fr=!1,y=!0):y=!1),y||Ks(s)),xe(s),y=s.type,b=s.pendingProps,M=r!==null?r.memoizedProps:null,d=b.children,n0(y,b)?d=null:M!==null&&n0(y,M)&&(s.flags|=32),s.memoizedState!==null&&(y=tp(r,s,zk,null,null,o),Mc._currentValue=y),mh(r,s),vr(r,s,d,o),s.child;case 6:return r===null&&Un&&((r=o=vi)&&(o=CE(o,s.pendingProps,Fr),o!==null?(s.stateNode=o,rr=s,vi=null,r=!0):r=!1),r||Ks(s)),null;case 13:return Tv(r,s,o);case 4:return _t(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Wo(s,null,d,o):vr(r,s,d,o),s.child;case 11:return pv(r,s,s.type,s.pendingProps,o);case 7:return vr(r,s,s.pendingProps,o),s.child;case 8:return vr(r,s,s.pendingProps.children,o),s.child;case 12:return vr(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,J(s,s.type,d.value),vr(r,s,d.children,o),s.child;case 9:return y=s.type._context,d=s.pendingProps.children,it(s),y=Vt(y),d=d(y),s.flags|=1,vr(r,s,d,o),s.child;case 14:return gv(r,s,s.type,s.pendingProps,o);case 15:return yv(r,s,s.type,s.pendingProps,o);case 19:return Ev(r,s,o);case 31:return Xk(r,s,o);case 22:return bv(r,s,o,s.pendingProps);case 24:return it(s),d=Vt(ki),r===null?(y=Vm(),y===null&&(y=xi,b=pa(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=o),y=b),s.memoizedState={parent:d,cache:y},Km(s),J(s,ki,y)):((r.lanes&o)!==0&&(Wm(r,s),dc(s,null,null,o),cc()),y=r.memoizedState,b=s.memoizedState,y.parent!==d?(y={parent:d,cache:d},s.memoizedState=y,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=y),J(s,ki,d)):(d=b.cache,J(s,ki,d),d!==y.cache&&Ae(s,[ki],o,!0))),vr(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function va(r){r.flags|=4}function Np(r,s,o,d,y){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(ex())r.flags|=8192;else throw Ko=Jd,Gm}else r.flags&=-16777217}function Av(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!$x(s))if(ex())r.flags|=8192;else throw Ko=Jd,Gm}function gh(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?Ge():536870912,r.lanes|=s,zl|=s)}function yc(r,s){if(!Un)switch(r.tailMode){case"hidden":s=r.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?r.tail=null:o.sibling=null;break;case"collapsed":o=r.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ai(r){var s=r.alternate!==null&&r.alternate.child===r.child,o=0,d=0;if(s)for(var y=r.child;y!==null;)o|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)o|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=o,s}function Qk(r,s,o){var d=s.pendingProps;switch(Pr(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ai(s),null;case 1:return Ai(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),oe(ki),dt(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(p(s)?va(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,_())),Ai(s),null;case 26:var y=s.type,b=s.memoizedState;return r===null?(va(s),b!==null?(Ai(s),Av(s,b)):(Ai(s),Np(s,y,null,d,o))):b?b!==r.memoizedState?(va(s),Ai(s),Av(s,b)):(Ai(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&va(s),Ai(s),Np(s,y,r,d,o)),null;case 27:if(Ne(s),o=Oe.current,y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&va(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ai(s),null}r=Be.current,p(s)?Yd(s):(r=Lx(y,d,o),s.stateNode=r,va(s))}return Ai(s),null;case 5:if(Ne(s),y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&va(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ai(s),null}if(b=Be.current,p(s))Yd(s);else{var M=Mh(Oe.current);switch(b){case 1:b=M.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:b=M.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":b=M.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":b=M.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":b=M.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?M.createElement("select",{is:d.is}):M.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?M.createElement(y,{is:d.is}):M.createElement(y)}}b[Zt]=s,b[zt]=d;e:for(M=s.child;M!==null;){if(M.tag===5||M.tag===6)b.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===s)break e;for(;M.sibling===null;){if(M.return===null||M.return===s)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}s.stateNode=b;e:switch(xr(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&&va(s)}}return Ai(s),Np(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&va(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=Oe.current,p(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=rr,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[Zt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||Tx(r.nodeValue,o)),r||Ks(s,!0)}else r=Mh(r).createTextNode(d),r[Zt]=s,s.stateNode=r}return Ai(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=p(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;Ai(s),r=!1}else o=_(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(is(s),s):(is(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Ai(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=p(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;Ai(s),y=!1}else y=_(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(is(s),s):(is(s),null)}return is(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),Ai(s),null);case 4:return dt(),r===null&&Qp(s.stateNode.containerInfo),Ai(s),null;case 10:return oe(s.type),Ai(s),null;case 19:if(pe(Zi),d=s.memoizedState,d===null)return Ai(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)yc(d,!1);else{if(Vi!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=ih(r),b!==null){for(s.flags|=128,yc(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 we(Zi,Zi.current&1|2),Un&&Ln(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&fe()>_h&&(s.flags|=128,y=!0,yc(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),yc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!Un)return Ai(s),null}else 2*fe()-d.renderingStartTime>_h&&o!==536870912&&(s.flags|=128,y=!0,yc(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=fe(),r.sibling=null,o=Zi.current,we(Zi,y?o&1|2:o&1),Un&&Ln(s,d.treeForkCount),r):(Ai(s),null);case 22:case 23:return is(s),Zm(),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&&(Ai(s),s.subtreeFlags&6&&(s.flags|=8192)):Ai(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&&pe(Vo),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oe(ki),Ai(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Zk(r,s){switch(Pr(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return oe(ki),dt(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Ne(s),null;case 31:if(s.memoizedState!==null){if(is(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(is(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 pe(Zi),null;case 4:return dt(),null;case 10:return oe(s.type),null;case 22:case 23:return is(s),Zm(),r!==null&&pe(Vo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(ki),null;case 25:return null;default:return null}}function Nv(r,s){switch(Pr(s),s.tag){case 3:oe(ki),dt();break;case 26:case 27:case 5:Ne(s);break;case 4:dt();break;case 31:s.memoizedState!==null&&is(s);break;case 13:is(s);break;case 19:pe(Zi);break;case 10:oe(s.type);break;case 22:case 23:is(s),Zm(),r!==null&&pe(Vo);break;case 24:oe(ki)}}function bc(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,M=o.inst;d=b(),M.destroy=d}o=o.next}while(o!==y)}}catch(z){ci(s,s.return,z)}}function io(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 M=d.inst,z=M.destroy;if(z!==void 0){M.destroy=void 0,y=s;var be=o,ze=z;try{ze()}catch(rt){ci(y,be,rt)}}}d=d.next}while(d!==b)}}catch(rt){ci(s,s.return,rt)}}function Dv(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{xb(s,o)}catch(d){ci(r,r.return,d)}}}function Mv(r,s,o){o.props=Yo(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){ci(r,s,d)}}function vc(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){ci(r,s,y)}}function Ys(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(y){ci(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){ci(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){ci(r,r.return,y)}}function Dp(r,s,o){try{var d=r.stateNode;xE(d,r.type,o,s),d[zt]=s}catch(y){ci(r,r.return,y)}}function jv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&co(r.type)||r.tag===4}function Mp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||jv(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&&co(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 Rp(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=hi));else if(d!==4&&(d===27&&co(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Rp(r,s,o),r=r.sibling;r!==null;)Rp(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&&co(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 Ov(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);xr(s,d,o),s[Zt]=r,s[zt]=o}catch(b){ci(r,r.return,b)}}var xa=!1,or=!1,jp=!1,Lv=typeof WeakSet=="function"?WeakSet:Set,mr=null;function Jk(r,s){if(r=r.containerInfo,e0=Ph,r=El(r),Wu(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 M=0,z=-1,be=-1,ze=0,rt=0,ct=r,Ke=null;t:for(;;){for(var Ye;ct!==o||y!==0&&ct.nodeType!==3||(z=M+y),ct!==b||d!==0&&ct.nodeType!==3||(be=M+d),ct.nodeType===3&&(M+=ct.nodeValue.length),(Ye=ct.firstChild)!==null;)Ke=ct,ct=Ye;for(;;){if(ct===r)break t;if(Ke===o&&++ze===y&&(z=M),Ke===b&&++rt===d&&(be=M),(Ye=ct.nextSibling)!==null)break;ct=Ke,Ke=ct.parentNode}ct=Ye}o=z===-1||be===-1?null:{start:z,end:be}}else o=null}o=o||{start:0,end:0}}else o=null;for(t0={focusedElem:r,selectionRange:o},Ph=!1,mr=s;mr!==null;)if(s=mr,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,mr=r;else for(;mr!==null;){switch(s=mr,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<r.length;o++)y=r[o],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&b!==null){r=void 0,o=s,y=b.memoizedProps,b=b.memoizedState,d=o.stateNode;try{var nn=Yo(o.type,y);r=d.getSnapshotBeforeUpdate(nn,b),d.__reactInternalSnapshotBeforeUpdate=r}catch(yn){ci(o,o.return,yn)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)r0(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":r0(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=s.sibling,r!==null){r.return=s.return,mr=r;break}mr=s.return}}function Iv(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:wa(r,o),d&4&&bc(5,o);break;case 1:if(wa(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(M){ci(o,o.return,M)}else{var y=Yo(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(y,s,r.__reactInternalSnapshotBeforeUpdate)}catch(M){ci(o,o.return,M)}}d&64&&Dv(o),d&512&&vc(o,o.return);break;case 3:if(wa(r,o),d&64&&(r=o.updateQueue,r!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{xb(r,s)}catch(M){ci(o,o.return,M)}}break;case 27:s===null&&d&4&&Ov(o);case 26:case 5:wa(r,o),s===null&&d&4&&Rv(o),d&512&&vc(o,o.return);break;case 12:wa(r,o);break;case 31:wa(r,o),d&4&&Fv(r,o);break;case 13:wa(r,o),d&4&&Uv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=lE.bind(null,o),AE(r,o))));break;case 22:if(d=o.memoizedState!==null||xa,!d){s=s!==null&&s.memoizedState!==null||or,y=xa;var b=or;xa=d,(or=s)&&!b?Sa(r,o,(o.subtreeFlags&8772)!==0):wa(r,o),xa=y,or=b}break;case 30:break;default:wa(r,o)}}function Bv(r){var s=r.alternate;s!==null&&(r.alternate=null,Bv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&ln(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var ji=null,Ur=!1;function _a(r,s,o){for(o=o.child;o!==null;)Pv(r,s,o),o=o.sibling}function Pv(r,s,o){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(mn,o)}catch{}switch(o.tag){case 26:or||Ys(o,s),_a(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:or||Ys(o,s);var d=ji,y=Ur;co(o.type)&&(ji=o.stateNode,Ur=!1),_a(r,s,o),Ac(o.stateNode),ji=d,Ur=y;break;case 5:or||Ys(o,s);case 6:if(d=ji,y=Ur,ji=null,_a(r,s,o),ji=d,Ur=y,ji!==null)if(Ur)try{(ji.nodeType===9?ji.body:ji.nodeName==="HTML"?ji.ownerDocument.body:ji).removeChild(o.stateNode)}catch(b){ci(o,s,b)}else try{ji.removeChild(o.stateNode)}catch(b){ci(o,s,b)}break;case 18:ji!==null&&(Ur?(r=ji,Dx(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Xl(r)):Dx(ji,o.stateNode));break;case 4:d=ji,y=Ur,ji=o.stateNode.containerInfo,Ur=!0,_a(r,s,o),ji=d,Ur=y;break;case 0:case 11:case 14:case 15:io(2,o,s),or||io(4,o,s),_a(r,s,o);break;case 1:or||(Ys(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&Mv(o,s,d)),_a(r,s,o);break;case 21:_a(r,s,o);break;case 22:or=(d=or)||o.memoizedState!==null,_a(r,s,o),or=d;break;default:_a(r,s,o)}}function Fv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Xl(r)}catch(o){ci(s,s.return,o)}}}function Uv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{Xl(r)}catch(o){ci(s,s.return,o)}}function eE(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Lv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Lv),s;default:throw Error(i(435,r.tag))}}function bh(r,s){var o=eE(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var y=uE.bind(null,r,d);d.then(y,y)}})}function zr(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var y=o[d],b=r,M=s,z=M;e:for(;z!==null;){switch(z.tag){case 27:if(co(z.type)){ji=z.stateNode,Ur=!1;break e}break;case 5:ji=z.stateNode,Ur=!1;break e;case 3:case 4:ji=z.stateNode.containerInfo,Ur=!0;break e}z=z.return}if(ji===null)throw Error(i(160));Pv(b,M,y),ji=null,Ur=!1,b=y.alternate,b!==null&&(b.return=null),y.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)zv(s,r),s=s.sibling}var Rs=null;function zv(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:zr(s,r),Hr(r),d&4&&(io(3,r,r.return),bc(3,r),io(5,r,r.return));break;case 1:zr(s,r),Hr(r),d&512&&(or||o===null||Ys(o,o.return)),d&64&&xa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(o=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var y=Rs;if(zr(s,r),Hr(r),d&512&&(or||o===null||Ys(o,o.return)),d&4){var b=o!==null?o.memoizedState:null;if(d=r.memoizedState,o===null)if(d===null)if(r.stateNode===null){e:{d=r.type,o=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":b=y.getElementsByTagName("title")[0],(!b||b[Gn]||b[Zt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(d),y.head.insertBefore(b,y.querySelector("head > title"))),xr(b,d,o),b[Zt]=r,rn(b),d=b;break e;case"link":var M=zx("link","href",y).get(d+(o.href||""));if(M){for(var z=0;z<M.length;z++)if(b=M[z],b.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&b.getAttribute("rel")===(o.rel==null?null:o.rel)&&b.getAttribute("title")===(o.title==null?null:o.title)&&b.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){M.splice(z,1);break t}}b=y.createElement(d),xr(b,d,o),y.head.appendChild(b);break;case"meta":if(M=zx("meta","content",y).get(d+(o.content||""))){for(z=0;z<M.length;z++)if(b=M[z],b.getAttribute("content")===(o.content==null?null:""+o.content)&&b.getAttribute("name")===(o.name==null?null:o.name)&&b.getAttribute("property")===(o.property==null?null:o.property)&&b.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&b.getAttribute("charset")===(o.charSet==null?null:o.charSet)){M.splice(z,1);break t}}b=y.createElement(d),xr(b,d,o),y.head.appendChild(b);break;default:throw Error(i(468,d))}b[Zt]=r,rn(b),d=b}r.stateNode=d}else Hx(y,r.type,r.stateNode);else r.stateNode=Ux(y,d,r.memoizedProps);else b!==d?(b===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):b.count--,d===null?Hx(y,r.type,r.stateNode):Ux(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Dp(r,r.memoizedProps,o.memoizedProps)}break;case 27:zr(s,r),Hr(r),d&512&&(or||o===null||Ys(o,o.return)),o!==null&&d&4&&Dp(r,r.memoizedProps,o.memoizedProps);break;case 5:if(zr(s,r),Hr(r),d&512&&(or||o===null||Ys(o,o.return)),r.flags&32){y=r.stateNode;try{bi(y,"")}catch(nn){ci(r,r.return,nn)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,Dp(r,y,o!==null?o.memoizedProps:y)),d&1024&&(jp=!0);break;case 6:if(zr(s,r),Hr(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(nn){ci(r,r.return,nn)}}break;case 3:if(Oh=null,y=Rs,Rs=Rh(s.containerInfo),zr(s,r),Rs=y,Hr(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Xl(s.containerInfo)}catch(nn){ci(r,r.return,nn)}jp&&(jp=!1,Hv(r));break;case 4:d=Rs,Rs=Rh(r.stateNode.containerInfo),zr(s,r),Hr(r),Rs=d;break;case 12:zr(s,r),Hr(r);break;case 31:zr(s,r),Hr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 13:zr(s,r),Hr(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(xh=fe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 22:y=r.memoizedState!==null;var be=o!==null&&o.memoizedState!==null,ze=xa,rt=or;if(xa=ze||y,or=rt||be,zr(s,r),or=rt,xa=ze,Hr(r),d&8192)e:for(s=r.stateNode,s._visibility=y?s._visibility&-2:s._visibility|1,y&&(o===null||be||xa||or||Qo(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){be=o=s;try{if(b=be.stateNode,y)M=b.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{z=be.stateNode;var ct=be.memoizedProps.style,Ke=ct!=null&&ct.hasOwnProperty("display")?ct.display:null;z.style.display=Ke==null||typeof Ke=="boolean"?"":(""+Ke).trim()}}catch(nn){ci(be,be.return,nn)}}}else if(s.tag===6){if(o===null){be=s;try{be.stateNode.nodeValue=y?"":be.memoizedProps}catch(nn){ci(be,be.return,nn)}}}else if(s.tag===18){if(o===null){be=s;try{var Ye=be.stateNode;y?Mx(Ye,!0):Mx(be.stateNode,!1)}catch(nn){ci(be,be.return,nn)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,bh(r,o))));break;case 19:zr(s,r),Hr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,bh(r,d)));break;case 30:break;case 21:break;default:zr(s,r),Hr(r)}}function Hr(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(jv(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var y=o.stateNode,b=Mp(r);yh(r,b,y);break;case 5:var M=o.stateNode;o.flags&32&&(bi(M,""),o.flags&=-33);var z=Mp(r);yh(r,z,M);break;case 3:case 4:var be=o.stateNode.containerInfo,ze=Mp(r);Rp(r,ze,be);break;default:throw Error(i(161))}}catch(rt){ci(r,r.return,rt)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Hv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Hv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function wa(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Iv(r,s.alternate,s),s=s.sibling}function Qo(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:io(4,s,s.return),Qo(s);break;case 1:Ys(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Mv(s,s.return,o),Qo(s);break;case 27:Ac(s.stateNode);case 26:case 5:Ys(s,s.return),Qo(s);break;case 22:s.memoizedState===null&&Qo(s);break;case 30:Qo(s);break;default:Qo(s)}r=r.sibling}}function Sa(r,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,y=r,b=s,M=b.flags;switch(b.tag){case 0:case 11:case 15:Sa(y,b,o),bc(4,b);break;case 1:if(Sa(y,b,o),d=b,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ze){ci(d,d.return,ze)}if(d=b,y=d.updateQueue,y!==null){var z=d.stateNode;try{var be=y.shared.hiddenCallbacks;if(be!==null)for(y.shared.hiddenCallbacks=null,y=0;y<be.length;y++)vb(be[y],z)}catch(ze){ci(d,d.return,ze)}}o&&M&64&&Dv(b),vc(b,b.return);break;case 27:Ov(b);case 26:case 5:Sa(y,b,o),o&&d===null&&M&4&&Rv(b),vc(b,b.return);break;case 12:Sa(y,b,o);break;case 31:Sa(y,b,o),o&&M&4&&Fv(y,b);break;case 13:Sa(y,b,o),o&&M&4&&Uv(y,b);break;case 22:b.memoizedState===null&&Sa(y,b,o),vc(b,b.return);break;case 30:break;default:Sa(y,b,o)}s=s.sibling}}function Op(r,s){var o=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==o&&(r!=null&&r.refCount++,o!=null&&Ms(o))}function Lp(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ms(r))}function js(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)$v(r,s,o,d),s=s.sibling}function $v(r,s,o,d){var y=s.flags;switch(s.tag){case 0:case 11:case 15:js(r,s,o,d),y&2048&&bc(9,s);break;case 1:js(r,s,o,d);break;case 3:js(r,s,o,d),y&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&Ms(r)));break;case 12:if(y&2048){js(r,s,o,d),r=s.stateNode;try{var b=s.memoizedProps,M=b.id,z=b.onPostCommit;typeof z=="function"&&z(M,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(be){ci(s,s.return,be)}}else js(r,s,o,d);break;case 31:js(r,s,o,d);break;case 13:js(r,s,o,d);break;case 23:break;case 22:b=s.stateNode,M=s.alternate,s.memoizedState!==null?b._visibility&2?js(r,s,o,d):xc(r,s):b._visibility&2?js(r,s,o,d):(b._visibility|=2,Pl(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),y&2048&&Op(M,s);break;case 24:js(r,s,o,d),y&2048&&Lp(s.alternate,s);break;default:js(r,s,o,d)}}function Pl(r,s,o,d,y){for(y=y&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var b=r,M=s,z=o,be=d,ze=M.flags;switch(M.tag){case 0:case 11:case 15:Pl(b,M,z,be,y),bc(8,M);break;case 23:break;case 22:var rt=M.stateNode;M.memoizedState!==null?rt._visibility&2?Pl(b,M,z,be,y):xc(b,M):(rt._visibility|=2,Pl(b,M,z,be,y)),y&&ze&2048&&Op(M.alternate,M);break;case 24:Pl(b,M,z,be,y),y&&ze&2048&&Lp(M.alternate,M);break;default:Pl(b,M,z,be,y)}s=s.sibling}}function xc(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=r,d=s,y=d.flags;switch(d.tag){case 22:xc(o,d),y&2048&&Op(d.alternate,d);break;case 24:xc(o,d),y&2048&&Lp(d.alternate,d);break;default:xc(o,d)}s=s.sibling}}var _c=8192;function Fl(r,s,o){if(r.subtreeFlags&_c)for(r=r.child;r!==null;)qv(r,s,o),r=r.sibling}function qv(r,s,o){switch(r.tag){case 26:Fl(r,s,o),r.flags&_c&&r.memoizedState!==null&&UE(o,Rs,r.memoizedState,r.memoizedProps);break;case 5:Fl(r,s,o);break;case 3:case 4:var d=Rs;Rs=Rh(r.stateNode.containerInfo),Fl(r,s,o),Rs=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=_c,_c=16777216,Fl(r,s,o),_c=d):Fl(r,s,o));break;default:Fl(r,s,o)}}function Vv(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function wc(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];mr=d,Kv(d,r)}Vv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Gv(r),r=r.sibling}function Gv(r){switch(r.tag){case 0:case 11:case 15:wc(r),r.flags&2048&&io(9,r,r.return);break;case 3:wc(r);break;case 12:wc(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,vh(r)):wc(r);break;default:wc(r)}}function vh(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var d=s[o];mr=d,Kv(d,r)}Vv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:io(8,s,s.return),vh(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,vh(s));break;default:vh(s)}r=r.sibling}}function Kv(r,s){for(;mr!==null;){var o=mr;switch(o.tag){case 0:case 11:case 15:io(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Ms(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,mr=d;else e:for(o=r;mr!==null;){d=mr;var y=d.sibling,b=d.return;if(Bv(d),d===o){mr=null;break e}if(y!==null){y.return=b,mr=y;break e}mr=b}}}var tE={getCacheForType:function(r){var s=Vt(ki),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return Vt(ki).controller.signal}},nE=typeof WeakMap=="function"?WeakMap:Map,ri=0,xi=null,zn=null,qn=0,ui=0,rs=null,ro=!1,Ul=!1,Ip=!1,Ta=0,Vi=0,so=0,Zo=0,Bp=0,ss=0,zl=0,Sc=null,$r=null,Pp=!1,xh=0,Wv=0,_h=1/0,wh=null,ao=null,dr=0,oo=null,Hl=null,ka=0,Fp=0,Up=null,Xv=null,Tc=0,zp=null;function as(){return(ri&2)!==0&&qn!==0?qn&-qn:$.T!==null?Kp():Rn()}function Yv(){if(ss===0)if((qn&536870912)===0||Un){var r=Tn;Tn<<=1,(Tn&3932160)===0&&(Tn=262144),ss=r}else ss=536870912;return r=ns.current,r!==null&&(r.flags|=32),ss}function qr(r,s,o){(r===xi&&(ui===2||ui===9)||r.cancelPendingCommit!==null)&&($l(r,0),lo(r,qn,ss,!1)),tn(r,o),((ri&2)===0||r!==xi)&&(r===xi&&((ri&2)===0&&(Zo|=o),Vi===4&&lo(r,qn,ss,!1)),Qs(r))}function Qv(r,s,o){if((ri&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||ne(r,s),y=d?sE(r,s):$p(r,s,!0),b=d;do{if(y===0){Ul&&!d&&lo(r,s,0,!1);break}else{if(o=r.current.alternate,b&&!iE(o)){y=$p(r,s,!1),b=!1;continue}if(y===2){if(b=s,r.errorRecoveryDisabledLanes&b)var M=0;else M=r.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){s=M;e:{var z=r;y=Sc;var be=z.current.memoizedState.isDehydrated;if(be&&($l(z,M).flags|=256),M=$p(z,M,!1),M!==2){if(Ip&&!be){z.errorRecoveryDisabledLanes|=b,Zo|=b,y=4;break e}b=$r,$r=y,b!==null&&($r===null?$r=b:$r.push.apply($r,b))}y=M}if(b=!1,y!==2)continue}}if(y===1){$l(r,0),lo(r,s,0,!0);break}e:{switch(d=r,b=y,b){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:lo(d,s,ss,!ro);break e;case 2:$r=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(y=xh+300-fe(),10<y)){if(lo(d,s,ss,!ro),P(d,0,!0)!==0)break e;ka=s,d.timeoutHandle=Ax(Zv.bind(null,d,o,$r,wh,Pp,s,ss,Zo,zl,ro,b,"Throttled",-0,0),y);break e}Zv(d,o,$r,wh,Pp,s,ss,Zo,zl,ro,b,null,-0,0)}}break}while(!0);Qs(r)}function Zv(r,s,o,d,y,b,M,z,be,ze,rt,ct,Ke,Ye){if(r.timeoutHandle=-1,ct=s.subtreeFlags,ct&8192||(ct&16785408)===16785408){ct={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:hi},qv(s,b,ct);var nn=(b&62914560)===b?xh-fe():(b&4194048)===b?Wv-fe():0;if(nn=zE(ct,nn),nn!==null){ka=b,r.cancelPendingCommit=nn(ax.bind(null,r,s,b,o,d,y,M,z,be,rt,ct,null,Ke,Ye)),lo(r,b,M,!ze);return}}ax(r,s,b,o,d,y,M,z,be)}function iE(r){for(var s=r;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var y=o[d],b=y.getSnapshot;y=y.value;try{if(!Sr(b(),y))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function lo(r,s,o,d){s&=~Bp,s&=~Zo,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var y=s;0<y;){var b=31-Ot(y),M=1<<b;d[b]=-1,y&=~M}o!==0&&vn(r,o,s)}function Sh(){return(ri&6)===0?(kc(0),!1):!0}function Hp(){if(zn!==null){if(ui===0)var r=zn.return;else r=zn,K=N=null,rp(r),jl=null,oc=0,r=zn;for(;r!==null;)Nv(r.alternate,r),r=r.return;zn=null}}function $l(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,SE(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),ka=0,Hp(),xi=r,zn=o=Ds(r.current,null),qn=s,ui=0,rs=null,ro=!1,Ul=ne(r,s),Ip=!1,zl=ss=Bp=Zo=so=Vi=0,$r=Sc=null,Pp=!1,(s&8)!==0&&(s|=s&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=s;0<d;){var y=31-Ot(d),b=1<<y;s|=r[y],d&=~b}return Ta=s,Al(),o}function Jv(r,s){An=null,$.H=pc,s===Rl||s===Zd?(s=pb(),ui=3):s===Gm?(s=pb(),ui=4):ui=s===xp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,rs=s,zn===null&&(Vi=1,hh(r,Ir(s,r.current)))}function ex(){var r=ns.current;return r===null?!0:(qn&4194048)===qn?ps===null:(qn&62914560)===qn||(qn&536870912)!==0?r===ps:!1}function tx(){var r=$.H;return $.H=pc,r===null?pc:r}function nx(){var r=$.A;return $.A=tE,r}function Th(){Vi=4,ro||(qn&4194048)!==qn&&ns.current!==null||(Ul=!0),(so&134217727)===0&&(Zo&134217727)===0||xi===null||lo(xi,qn,ss,!1)}function $p(r,s,o){var d=ri;ri|=2;var y=tx(),b=nx();(xi!==r||qn!==s)&&(wh=null,$l(r,s)),s=!1;var M=Vi;e:do try{if(ui!==0&&zn!==null){var z=zn,be=rs;switch(ui){case 8:Hp(),M=6;break e;case 3:case 2:case 9:case 6:ns.current===null&&(s=!0);var ze=ui;if(ui=0,rs=null,ql(r,z,be,ze),o&&Ul){M=0;break e}break;default:ze=ui,ui=0,rs=null,ql(r,z,be,ze)}}rE(),M=Vi;break}catch(rt){Jv(r,rt)}while(!0);return s&&r.shellSuspendCounter++,K=N=null,ri=d,$.H=y,$.A=b,zn===null&&(xi=null,qn=0,Al()),M}function rE(){for(;zn!==null;)ix(zn)}function sE(r,s){var o=ri;ri|=2;var d=tx(),y=nx();xi!==r||qn!==s?(wh=null,_h=fe()+500,$l(r,s)):Ul=ne(r,s);e:do try{if(ui!==0&&zn!==null){s=zn;var b=rs;t:switch(ui){case 1:ui=0,rs=null,ql(r,s,b,1);break;case 2:case 9:if(fb(b)){ui=0,rs=null,rx(s);break}s=function(){ui!==2&&ui!==9||xi!==r||(ui=7),Qs(r)},b.then(s,s);break e;case 3:ui=7;break e;case 4:ui=5;break e;case 7:fb(b)?(ui=0,rs=null,rx(s)):(ui=0,rs=null,ql(r,s,b,7));break;case 5:var M=null;switch(zn.tag){case 26:M=zn.memoizedState;case 5:case 27:var z=zn;if(M?$x(M):z.stateNode.complete){ui=0,rs=null;var be=z.sibling;if(be!==null)zn=be;else{var ze=z.return;ze!==null?(zn=ze,kh(ze)):zn=null}break t}}ui=0,rs=null,ql(r,s,b,5);break;case 6:ui=0,rs=null,ql(r,s,b,6);break;case 8:Hp(),Vi=6;break e;default:throw Error(i(462))}}aE();break}catch(rt){Jv(r,rt)}while(!0);return K=N=null,$.H=d,$.A=y,ri=o,zn!==null?0:(xi=null,qn=0,Al(),Vi)}function aE(){for(;zn!==null&&!mt();)ix(zn)}function ix(r){var s=Cv(r.alternate,r,Ta);r.memoizedProps=r.pendingProps,s===null?kh(r):zn=s}function rx(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=_v(o,s,s.pendingProps,s.type,void 0,qn);break;case 11:s=_v(o,s,s.pendingProps,s.type.render,s.ref,qn);break;case 5:rp(s);default:Nv(o,s),s=zn=Wd(s,Ta),s=Cv(o,s,Ta)}r.memoizedProps=r.pendingProps,s===null?kh(r):zn=s}function ql(r,s,o,d){K=N=null,rp(s),jl=null,oc=0;var y=s.return;try{if(Wk(r,y,s,o,qn)){Vi=1,hh(r,Ir(o,r.current)),zn=null;return}}catch(b){if(y!==null)throw zn=y,b;Vi=1,hh(r,Ir(o,r.current)),zn=null;return}s.flags&32768?(Un||d===1?r=!0:Ul||(qn&536870912)!==0?r=!1:(ro=r=!0,(d===2||d===9||d===3||d===6)&&(d=ns.current,d!==null&&d.tag===13&&(d.flags|=16384))),sx(s,r)):kh(s)}function kh(r){var s=r;do{if((s.flags&32768)!==0){sx(s,ro);return}r=s.return;var o=Qk(s.alternate,s,Ta);if(o!==null){zn=o;return}if(s=s.sibling,s!==null){zn=s;return}zn=s=r}while(s!==null);Vi===0&&(Vi=5)}function sx(r,s){do{var o=Zk(r.alternate,r);if(o!==null){o.flags&=32767,zn=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){zn=r;return}zn=r=o}while(r!==null);Vi=6,zn=null}function ax(r,s,o,d,y,b,M,z,be){r.cancelPendingCommit=null;do Eh();while(dr!==0);if((ri&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(b=s.lanes|s.childLanes,b|=ec,un(r,o,b,M,z,be),r===xi&&(zn=xi=null,qn=0),Hl=s,oo=r,ka=o,Fp=b,Up=y,Xv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,cE(Pe,function(){return dx(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=$.T,$.T=null,y=F.p,F.p=2,M=ri,ri|=4;try{Jk(r,s,o)}finally{ri=M,F.p=y,$.T=d}}dr=1,ox(),lx(),ux()}}function ox(){if(dr===1){dr=0;var r=oo,s=Hl,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var d=F.p;F.p=2;var y=ri;ri|=4;try{zv(s,r);var b=t0,M=El(r.containerInfo),z=b.focusedElem,be=b.selectionRange;if(M!==z&&z&&z.ownerDocument&&ha(z.ownerDocument.documentElement,z)){if(be!==null&&Wu(z)){var ze=be.start,rt=be.end;if(rt===void 0&&(rt=ze),"selectionStart"in z)z.selectionStart=ze,z.selectionEnd=Math.min(rt,z.value.length);else{var ct=z.ownerDocument||document,Ke=ct&&ct.defaultView||window;if(Ke.getSelection){var Ye=Ke.getSelection(),nn=z.textContent.length,yn=Math.min(be.start,nn),gi=be.end===void 0?yn:Math.min(be.end,nn);!Ye.extend&&yn>gi&&(M=gi,gi=yn,yn=M);var je=Ri(z,yn),Ee=Ri(z,gi);if(je&&Ee&&(Ye.rangeCount!==1||Ye.anchorNode!==je.node||Ye.anchorOffset!==je.offset||Ye.focusNode!==Ee.node||Ye.focusOffset!==Ee.offset)){var Ue=ct.createRange();Ue.setStart(je.node,je.offset),Ye.removeAllRanges(),yn>gi?(Ye.addRange(Ue),Ye.extend(Ee.node,Ee.offset)):(Ue.setEnd(Ee.node,Ee.offset),Ye.addRange(Ue))}}}}for(ct=[],Ye=z;Ye=Ye.parentNode;)Ye.nodeType===1&&ct.push({element:Ye,left:Ye.scrollLeft,top:Ye.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<ct.length;z++){var ot=ct[z];ot.element.scrollLeft=ot.left,ot.element.scrollTop=ot.top}}Ph=!!e0,t0=e0=null}finally{ri=y,F.p=d,$.T=o}}r.current=s,dr=2}}function lx(){if(dr===2){dr=0;var r=oo,s=Hl,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var d=F.p;F.p=2;var y=ri;ri|=4;try{Iv(r,s.alternate,s)}finally{ri=y,F.p=d,$.T=o}}dr=3}}function ux(){if(dr===4||dr===3){dr=0,Mt();var r=oo,s=Hl,o=ka,d=Xv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?dr=5:(dr=0,Hl=oo=null,cx(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(ao=null),on(o),s=s.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(mn,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=$.T,y=F.p,F.p=2,$.T=null;try{for(var b=r.onRecoverableError,M=0;M<d.length;M++){var z=d[M];b(z.value,{componentStack:z.stack})}}finally{$.T=s,F.p=y}}(ka&3)!==0&&Eh(),Qs(r),y=r.pendingLanes,(o&261930)!==0&&(y&42)!==0?r===zp?Tc++:(Tc=0,zp=r):Tc=0,kc(0)}}function cx(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,Ms(s)))}function Eh(){return ox(),lx(),ux(),dx()}function dx(){if(dr!==5)return!1;var r=oo,s=Fp;Fp=0;var o=on(ka),d=$.T,y=F.p;try{F.p=32>o?32:o,$.T=null,o=Up,Up=null;var b=oo,M=ka;if(dr=0,Hl=oo=null,ka=0,(ri&6)!==0)throw Error(i(331));var z=ri;if(ri|=4,Gv(b.current),$v(b,b.current,M,o),ri=z,kc(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(mn,b)}catch{}return!0}finally{F.p=y,$.T=d,cx(r,s)}}function hx(r,s,o){s=Ir(o,s),s=vp(r.stateNode,s,2),r=eo(r,s,2),r!==null&&(tn(r,2),Qs(r))}function ci(r,s,o){if(r.tag===3)hx(r,r,o);else for(;s!==null;){if(s.tag===3){hx(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ao===null||!ao.has(d))){r=Ir(o,r),o=fv(2),d=eo(s,o,2),d!==null&&(mv(o,d,s,r),tn(d,2),Qs(d));break}}s=s.return}}function qp(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new nE;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)||(Ip=!0,y.add(o),r=oE.bind(null,r,s,o),s.then(r,r))}function oE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,xi===r&&(qn&o)===o&&(Vi===4||Vi===3&&(qn&62914560)===qn&&300>fe()-xh?(ri&2)===0&&$l(r,0):Bp|=o,zl===qn&&(zl=0)),Qs(r)}function fx(r,s){s===0&&(s=Ge()),r=ma(r,s),r!==null&&(tn(r,s),Qs(r))}function lE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),fx(r,o)}function uE(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),fx(r,o)}function cE(r,s){return Je(r,s)}var Ch=null,Vl=null,Vp=!1,Ah=!1,Gp=!1,uo=0;function Qs(r){r!==Vl&&r.next===null&&(Vl===null?Ch=Vl=r:Vl=Vl.next=r),Ah=!0,Vp||(Vp=!0,hE())}function kc(r,s){if(!Gp&&Ah){Gp=!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 M=d.suspendedLanes,z=d.pingedLanes;b=(1<<31-Ot(42|r)+1)-1,b&=y&~(M&~z),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,yx(d,b))}else b=qn,b=P(d,d===xi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ne(d,b)||(o=!0,yx(d,b));d=d.next}while(o);Gp=!1}}function dE(){mx()}function mx(){Ah=Vp=!1;var r=0;uo!==0&&wE()&&(r=uo);for(var s=fe(),o=null,d=Ch;d!==null;){var y=d.next,b=px(d,s);b===0?(d.next=null,o===null?Ch=y:o.next=y,y===null&&(Vl=o)):(o=d,(r!==0||(b&3)!==0)&&(Ah=!0)),d=y}dr!==0&&dr!==5||kc(r),uo!==0&&(uo=0)}function px(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var M=31-Ot(b),z=1<<M,be=y[M];be===-1?((z&o)===0||(z&d)!==0)&&(y[M]=Re(z,s)):be<=s&&(r.expiredLanes|=z),b&=~z}if(s=xi,o=qn,o=P(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(ui===2||ui===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&et(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||ne(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&et(d),on(o)){case 2:case 8:o=Ce;break;case 32:o=Pe;break;case 268435456:o=At;break;default:o=Pe}return d=gx.bind(null,r),o=Je(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&et(d),r.callbackPriority=2,r.callbackNode=null,2}function gx(r,s){if(dr!==0&&dr!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Eh()&&r.callbackNode!==o)return null;var d=qn;return d=P(r,r===xi?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Qv(r,d,s),px(r,fe()),r.callbackNode!=null&&r.callbackNode===o?gx.bind(null,r):null)}function yx(r,s){if(Eh())return null;Qv(r,s,!0)}function hE(){TE(function(){(ri&6)!==0?Je(Le,dE):mx()})}function Kp(){if(uo===0){var r=ms;r===0&&(r=St,St<<=1,(St&261888)===0&&(St=256)),uo=r}return uo}function bx(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ir(""+r)}function vx(r,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,r.id&&o.setAttribute("form",r.id),s.parentNode.insertBefore(o,s),r=new FormData(r),o.parentNode.removeChild(o),r}function fE(r,s,o,d,y){if(s==="submit"&&o&&o.stateNode===y){var b=bx((y[zt]||null).action),M=d.submitter;M&&(s=(s=M[zt]||null)?bx(s.formAction):M.getAttribute("formAction"),s!==null&&(b=s,M=null));var z=new Dt("action","action",null,d,y);r.push({event:z,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(uo!==0){var be=M?vx(y,M):new FormData(y);fp(o,{pending:!0,data:be,method:y.method,action:b},null,be)}}else typeof b=="function"&&(z.preventDefault(),be=M?vx(y,M):new FormData(y),fp(o,{pending:!0,data:be,method:y.method,action:b},b,be))},currentTarget:y}]})}}for(var Wp=0;Wp<Ju.length;Wp++){var Xp=Ju[Wp],mE=Xp.toLowerCase(),pE=Xp[0].toUpperCase()+Xp.slice(1);es(mE,"on"+pE)}es(Hd,"onAnimationEnd"),es(Va,"onAnimationIteration"),es($d,"onAnimationStart"),es("dblclick","onDoubleClick"),es("focusin","onFocus"),es("focusout","onBlur"),es(qd,"onTransitionRun"),es(Vd,"onTransitionStart"),es($m,"onTransitionCancel"),es(Gd,"onTransitionEnd"),di("onMouseEnter",["mouseout","mouseover"]),di("onMouseLeave",["mouseout","mouseover"]),di("onPointerEnter",["pointerout","pointerover"]),di("onPointerLeave",["pointerout","pointerover"]),ni("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ni("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ni("onBeforeInput",["compositionend","keypress","textInput","paste"]),ni("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ni("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ni("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ec="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),gE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ec));function xx(r,s){s=(s&4)!==0;for(var o=0;o<r.length;o++){var d=r[o],y=d.event;d=d.listeners;e:{var b=void 0;if(s)for(var M=d.length-1;0<=M;M--){var z=d[M],be=z.instance,ze=z.currentTarget;if(z=z.listener,be!==b&&y.isPropagationStopped())break e;b=z,y.currentTarget=ze;try{b(y)}catch(rt){Ga(rt)}y.currentTarget=null,b=be}else for(M=0;M<d.length;M++){if(z=d[M],be=z.instance,ze=z.currentTarget,z=z.listener,be!==b&&y.isPropagationStopped())break e;b=z,y.currentTarget=ze;try{b(y)}catch(rt){Ga(rt)}y.currentTarget=null,b=be}}}}function Hn(r,s){var o=s[Nn];o===void 0&&(o=s[Nn]=new Set);var d=r+"__bubble";o.has(d)||(_x(s,r,2,!1),o.add(d))}function Yp(r,s,o){var d=0;s&&(d|=4),_x(o,r,d,s)}var Nh="_reactListening"+Math.random().toString(36).slice(2);function Qp(r){if(!r[Nh]){r[Nh]=!0,Di.forEach(function(o){o!=="selectionchange"&&(gE.has(o)||Yp(o,!1,r),Yp(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Nh]||(s[Nh]=!0,Yp("selectionchange",!1,s))}}function _x(r,s,o,d){switch(Yx(s)){case 2:var y=qE;break;case 8:y=VE;break;default:y=h0}o=y.bind(null,s,o,r),y=void 0,!ce||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(s,o,{capture:!0,passive:y}):r.addEventListener(s,o,!0):y!==void 0?r.addEventListener(s,o,{passive:y}):r.addEventListener(s,o,!1)}function Zp(r,s,o,d,y){var b=d;if((s&1)===0&&(s&2)===0&&d!==null)e:for(;;){if(d===null)return;var M=d.tag;if(M===3||M===4){var z=d.stateNode.containerInfo;if(z===y)break;if(M===4)for(M=d.return;M!==null;){var be=M.tag;if((be===3||be===4)&&M.stateNode.containerInfo===y)return;M=M.return}for(;z!==null;){if(M=Zn(z),M===null)return;if(be=M.tag,be===5||be===6||be===26||be===27){d=b=M;continue e}z=z.parentNode}}d=d.return}Rt(function(){var ze=b,rt=Pi(o),ct=[];e:{var Ke=Zu.get(r);if(Ke!==void 0){var Ye=Dt,nn=r;switch(r){case"keypress":if(ye(o)===0)break e;case"keydown":case"keyup":Ye=Dd;break;case"focusin":nn="focus",Ye=Fi;break;case"focusout":nn="blur",Ye=Fi;break;case"beforeblur":case"afterblur":Ye=Fi;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ye=Qt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=fi;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=da;break;case Hd:case Va:case $d:Ye=jo;break;case Gd:Ye=Md;break;case"scroll":case"scrollend":Ye=Lt;break;case"wheel":Ye=jd;break;case"copy":case"cut":case"paste":Ye=Jr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=Pa;break;case"toggle":case"beforetoggle":Ye=Om}var yn=(s&4)!==0,gi=!yn&&(r==="scroll"||r==="scrollend"),je=yn?Ke!==null?Ke+"Capture":null:Ke;yn=[];for(var Ee=ze,Ue;Ee!==null;){var ot=Ee;if(Ue=ot.stateNode,ot=ot.tag,ot!==5&&ot!==26&&ot!==27||Ue===null||je===null||(ot=Et(Ee,je),ot!=null&&yn.push(Cc(Ee,ot,Ue))),gi)break;Ee=Ee.return}0<yn.length&&(Ke=new Ye(Ke,nn,null,o,rt),ct.push({event:Ke,listeners:yn}))}}if((s&7)===0){e:{if(Ke=r==="mouseover"||r==="pointerover",Ye=r==="mouseout"||r==="pointerout",Ke&&o!==Yi&&(nn=o.relatedTarget||o.fromElement)&&(Zn(nn)||nn[Pt]))break e;if((Ye||Ke)&&(Ke=rt.window===rt?rt:(Ke=rt.ownerDocument)?Ke.defaultView||Ke.parentWindow:window,Ye?(nn=o.relatedTarget||o.toElement,Ye=ze,nn=nn?Zn(nn):null,nn!==null&&(gi=l(nn),yn=nn.tag,nn!==gi||yn!==5&&yn!==27&&yn!==6)&&(nn=null)):(Ye=null,nn=ze),Ye!==nn)){if(yn=Qt,ot="onMouseLeave",je="onMouseEnter",Ee="mouse",(r==="pointerout"||r==="pointerover")&&(yn=Pa,ot="onPointerLeave",je="onPointerEnter",Ee="pointer"),gi=Ye==null?Ke:jn(Ye),Ue=nn==null?Ke:jn(nn),Ke=new yn(ot,Ee+"leave",Ye,o,rt),Ke.target=gi,Ke.relatedTarget=Ue,ot=null,Zn(rt)===ze&&(yn=new yn(je,Ee+"enter",nn,o,rt),yn.target=Ue,yn.relatedTarget=gi,ot=yn),gi=ot,Ye&&nn)t:{for(yn=yE,je=Ye,Ee=nn,Ue=0,ot=je;ot;ot=yn(ot))Ue++;ot=0;for(var dn=Ee;dn;dn=yn(dn))ot++;for(;0<Ue-ot;)je=yn(je),Ue--;for(;0<ot-Ue;)Ee=yn(Ee),ot--;for(;Ue--;){if(je===Ee||Ee!==null&&je===Ee.alternate){yn=je;break t}je=yn(je),Ee=yn(Ee)}yn=null}else yn=null;Ye!==null&&wx(ct,Ke,Ye,yn,!1),nn!==null&&gi!==null&&wx(ct,gi,nn,yn,!0)}}e:{if(Ke=ze?jn(ze):window,Ye=Ke.nodeName&&Ke.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&Ke.type==="file")var Jn=qu;else if($u(Ke))if(Vu)Jn=zm;else{Jn=Um;var an=Fm}else Ye=Ke.nodeName,!Ye||Ye.toLowerCase()!=="input"||Ke.type!=="checkbox"&&Ke.type!=="radio"?ze&&Mi(ze.elementType)&&(Jn=qu):Jn=zd;if(Jn&&(Jn=Jn(r,ze))){Pd(ct,Jn,o,rt);break e}an&&an(r,Ke,ze),r==="focusout"&&ze&&Ke.type==="number"&&ze.memoizedProps.value!=null&&nr(Ke,"number",Ke.value)}switch(an=ze?jn(ze):window,r){case"focusin":($u(an)||an.contentEditable==="true")&&($a=an,Xu=ze,qa=null);break;case"focusout":qa=Xu=$a=null;break;case"mousedown":Cl=!0;break;case"contextmenu":case"mouseup":case"dragend":Cl=!1,Yu(ct,o,rt);break;case"selectionchange":if(Hm)break;case"keydown":case"keyup":Yu(ct,o,rt)}var Dn;if(Fa)e:{switch(r){case"compositionstart":var Vn="onCompositionStart";break e;case"compositionend":Vn="onCompositionEnd";break e;case"compositionupdate":Vn="onCompositionUpdate";break e}Vn=void 0}else Ua?kl(r,o)&&(Vn="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(Vn="onCompositionStart");Vn&&(Ld&&o.locale!=="ko"&&(Ua||Vn!=="onCompositionStart"?Vn==="onCompositionEnd"&&Ua&&(Dn=te()):(Me=rt,I="value"in Me?Me.value:Me.textContent,Ua=!0)),an=Dh(ze,Vn),0<an.length&&(Vn=new Oo(Vn,r,null,o,rt),ct.push({event:Vn,listeners:an}),Dn?Vn.data=Dn:(Dn=Bd(o),Dn!==null&&(Vn.data=Dn)))),(Dn=Od?Im(r,o):Hu(r,o))&&(Vn=Dh(ze,"onBeforeInput"),0<Vn.length&&(an=new Oo("onBeforeInput","beforeinput",null,o,rt),ct.push({event:an,listeners:Vn}),an.data=Dn)),fE(ct,r,ze,o,rt)}xx(ct,s)})}function Cc(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Dh(r,s){for(var o=s+"Capture",d=[];r!==null;){var y=r,b=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||b===null||(y=Et(r,o),y!=null&&d.unshift(Cc(r,y,b)),y=Et(r,s),y!=null&&d.push(Cc(r,y,b))),r.tag===3)return d;r=r.return}return[]}function yE(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function wx(r,s,o,d,y){for(var b=s._reactName,M=[];o!==null&&o!==d;){var z=o,be=z.alternate,ze=z.stateNode;if(z=z.tag,be!==null&&be===d)break;z!==5&&z!==26&&z!==27||ze===null||(be=ze,y?(ze=Et(o,b),ze!=null&&M.unshift(Cc(o,ze,be))):y||(ze=Et(o,b),ze!=null&&M.push(Cc(o,ze,be)))),o=o.return}M.length!==0&&r.push({event:s,listeners:M})}var bE=/\r\n?/g,vE=/\u0000|\uFFFD/g;function Sx(r){return(typeof r=="string"?r:""+r).replace(bE,`
|
||
`).replace(vE,"")}function Tx(r,s){return s=Sx(s),Sx(r)===s}function pi(r,s,o,d,y,b){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||bi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&bi(r,""+d);break;case"className":nt(r,"class",d);break;case"tabIndex":nt(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":nt(r,o,d);break;case"style":ii(r,d,b);break;case"data":if(s!=="object"){nt(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||o!=="href")){r.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ir(""+d),r.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof b=="function"&&(o==="formAction"?(s!=="input"&&pi(r,s,"name",y.name,y,null),pi(r,s,"formEncType",y.formEncType,y,null),pi(r,s,"formMethod",y.formMethod,y,null),pi(r,s,"formTarget",y.formTarget,y,null)):(pi(r,s,"encType",y.encType,y,null),pi(r,s,"method",y.method,y,null),pi(r,s,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=ir(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=hi);break;case"onScroll":d!=null&&Hn("scroll",r);break;case"onScrollEnd":d!=null&&Hn("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(y.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}o=ir(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""+d):r.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,""):r.removeAttribute(o);break;case"capture":case"download":d===!0?r.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(o,d):r.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(o,d):r.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(o):r.setAttribute(o,d);break;case"popover":Hn("beforetoggle",r),Hn("toggle",r),_e(r,"popover",d);break;case"xlinkActuate":ht(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ht(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ht(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ht(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ht(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ht(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ht(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ht(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ht(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":_e(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Ti.get(o)||o,_e(r,o,d))}}function Jp(r,s,o,d,y,b){switch(o){case"style":ii(r,d,b);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(o=d.__html,o!=null){if(y.children!=null)throw Error(i(60));r.innerHTML=o}}break;case"children":typeof d=="string"?bi(r,d):(typeof d=="number"||typeof d=="bigint")&&bi(r,""+d);break;case"onScroll":d!=null&&Hn("scroll",r);break;case"onScrollEnd":d!=null&&Hn("scrollend",r);break;case"onClick":d!=null&&(r.onclick=hi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!oi.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(y=o.endsWith("Capture"),s=o.slice(2,y?o.length-7:void 0),b=r[zt]||null,b=b!=null?b[o]:null,typeof b=="function"&&r.removeEventListener(s,b,y),typeof d=="function")){typeof b!="function"&&b!==null&&(o in r?r[o]=null:r.hasAttribute(o)&&r.removeAttribute(o)),r.addEventListener(s,d,y);break e}o in r?r[o]=d:d===!0?r.setAttribute(o,""):_e(r,o,d)}}}function xr(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Hn("error",r),Hn("load",r);var d=!1,y=!1,b;for(b in o)if(o.hasOwnProperty(b)){var M=o[b];if(M!=null)switch(b){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:pi(r,s,b,M,o,null)}}y&&pi(r,s,"srcSet",o.srcSet,o,null),d&&pi(r,s,"src",o.src,o,null);return;case"input":Hn("invalid",r);var z=b=M=y=null,be=null,ze=null;for(d in o)if(o.hasOwnProperty(d)){var rt=o[d];if(rt!=null)switch(d){case"name":y=rt;break;case"type":M=rt;break;case"checked":be=rt;break;case"defaultChecked":ze=rt;break;case"value":b=rt;break;case"defaultValue":z=rt;break;case"children":case"dangerouslySetInnerHTML":if(rt!=null)throw Error(i(137,s));break;default:pi(r,s,d,rt,o,null)}}Yn(r,b,z,be,ze,M,y,!1);return;case"select":Hn("invalid",r),d=M=b=null;for(y in o)if(o.hasOwnProperty(y)&&(z=o[y],z!=null))switch(y){case"value":b=z;break;case"defaultValue":M=z;break;case"multiple":d=z;default:pi(r,s,y,z,o,null)}s=b,o=M,r.multiple=!!d,s!=null?Wn(r,!!d,s,!1):o!=null&&Wn(r,!!d,o,!0);return;case"textarea":Hn("invalid",r),b=y=d=null;for(M in o)if(o.hasOwnProperty(M)&&(z=o[M],z!=null))switch(M){case"value":d=z;break;case"defaultValue":y=z;break;case"children":b=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(i(91));break;default:pi(r,s,M,z,o,null)}Hi(r,d,y,b);return;case"option":for(be in o)o.hasOwnProperty(be)&&(d=o[be],d!=null)&&(be==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":pi(r,s,be,d,o,null));return;case"dialog":Hn("beforetoggle",r),Hn("toggle",r),Hn("cancel",r),Hn("close",r);break;case"iframe":case"object":Hn("load",r);break;case"video":case"audio":for(d=0;d<Ec.length;d++)Hn(Ec[d],r);break;case"image":Hn("error",r),Hn("load",r);break;case"details":Hn("toggle",r);break;case"embed":case"source":case"link":Hn("error",r),Hn("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ze in o)if(o.hasOwnProperty(ze)&&(d=o[ze],d!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:pi(r,s,ze,d,o,null)}return;default:if(Mi(s)){for(rt in o)o.hasOwnProperty(rt)&&(d=o[rt],d!==void 0&&Jp(r,s,rt,d,o,void 0));return}}for(z in o)o.hasOwnProperty(z)&&(d=o[z],d!=null&&pi(r,s,z,d,o,null))}function xE(r,s,o,d){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,b=null,M=null,z=null,be=null,ze=null,rt=null;for(Ye in o){var ct=o[Ye];if(o.hasOwnProperty(Ye)&&ct!=null)switch(Ye){case"checked":break;case"value":break;case"defaultValue":be=ct;default:d.hasOwnProperty(Ye)||pi(r,s,Ye,null,d,ct)}}for(var Ke in d){var Ye=d[Ke];if(ct=o[Ke],d.hasOwnProperty(Ke)&&(Ye!=null||ct!=null))switch(Ke){case"type":b=Ye;break;case"name":y=Ye;break;case"checked":ze=Ye;break;case"defaultChecked":rt=Ye;break;case"value":M=Ye;break;case"defaultValue":z=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(i(137,s));break;default:Ye!==ct&&pi(r,s,Ke,Ye,d,ct)}}Mn(r,M,z,be,ze,rt,b,y);return;case"select":Ye=M=z=Ke=null;for(b in o)if(be=o[b],o.hasOwnProperty(b)&&be!=null)switch(b){case"value":break;case"multiple":Ye=be;default:d.hasOwnProperty(b)||pi(r,s,b,null,d,be)}for(y in d)if(b=d[y],be=o[y],d.hasOwnProperty(y)&&(b!=null||be!=null))switch(y){case"value":Ke=b;break;case"defaultValue":z=b;break;case"multiple":M=b;default:b!==be&&pi(r,s,y,b,d,be)}s=z,o=M,d=Ye,Ke!=null?Wn(r,!!o,Ke,!1):!!d!=!!o&&(s!=null?Wn(r,!!o,s,!0):Wn(r,!!o,o?[]:"",!1));return;case"textarea":Ye=Ke=null;for(z in o)if(y=o[z],o.hasOwnProperty(z)&&y!=null&&!d.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:pi(r,s,z,null,d,y)}for(M in d)if(y=d[M],b=o[M],d.hasOwnProperty(M)&&(y!=null||b!=null))switch(M){case"value":Ke=y;break;case"defaultValue":Ye=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==b&&pi(r,s,M,y,d,b)}Wi(r,Ke,Ye);return;case"option":for(var nn in o)Ke=o[nn],o.hasOwnProperty(nn)&&Ke!=null&&!d.hasOwnProperty(nn)&&(nn==="selected"?r.selected=!1:pi(r,s,nn,null,d,Ke));for(be in d)Ke=d[be],Ye=o[be],d.hasOwnProperty(be)&&Ke!==Ye&&(Ke!=null||Ye!=null)&&(be==="selected"?r.selected=Ke&&typeof Ke!="function"&&typeof Ke!="symbol":pi(r,s,be,Ke,d,Ye));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var yn in o)Ke=o[yn],o.hasOwnProperty(yn)&&Ke!=null&&!d.hasOwnProperty(yn)&&pi(r,s,yn,null,d,Ke);for(ze in d)if(Ke=d[ze],Ye=o[ze],d.hasOwnProperty(ze)&&Ke!==Ye&&(Ke!=null||Ye!=null))switch(ze){case"children":case"dangerouslySetInnerHTML":if(Ke!=null)throw Error(i(137,s));break;default:pi(r,s,ze,Ke,d,Ye)}return;default:if(Mi(s)){for(var gi in o)Ke=o[gi],o.hasOwnProperty(gi)&&Ke!==void 0&&!d.hasOwnProperty(gi)&&Jp(r,s,gi,void 0,d,Ke);for(rt in d)Ke=d[rt],Ye=o[rt],!d.hasOwnProperty(rt)||Ke===Ye||Ke===void 0&&Ye===void 0||Jp(r,s,rt,Ke,d,Ye);return}}for(var je in o)Ke=o[je],o.hasOwnProperty(je)&&Ke!=null&&!d.hasOwnProperty(je)&&pi(r,s,je,null,d,Ke);for(ct in d)Ke=d[ct],Ye=o[ct],!d.hasOwnProperty(ct)||Ke===Ye||Ke==null&&Ye==null||pi(r,s,ct,Ke,d,Ye)}function kx(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _E(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var y=o[d],b=y.transferSize,M=y.initiatorType,z=y.duration;if(b&&z&&kx(M)){for(M=0,z=y.responseEnd,d+=1;d<o.length;d++){var be=o[d],ze=be.startTime;if(ze>z)break;var rt=be.transferSize,ct=be.initiatorType;rt&&kx(ct)&&(be=be.responseEnd,M+=rt*(be<z?1:(z-ze)/(be-ze)))}if(--d,s+=8*(b+M)/(y.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var e0=null,t0=null;function Mh(r){return r.nodeType===9?r:r.ownerDocument}function Ex(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Cx(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function n0(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var i0=null;function wE(){var r=window.event;return r&&r.type==="popstate"?r===i0?!1:(i0=r,!0):(i0=null,!1)}var Ax=typeof setTimeout=="function"?setTimeout:void 0,SE=typeof clearTimeout=="function"?clearTimeout:void 0,Nx=typeof Promise=="function"?Promise:void 0,TE=typeof queueMicrotask=="function"?queueMicrotask:typeof Nx<"u"?function(r){return Nx.resolve(null).then(r).catch(kE)}:Ax;function kE(r){setTimeout(function(){throw r})}function co(r){return r==="head"}function Dx(r,s){var o=s,d=0;do{var y=o.nextSibling;if(r.removeChild(o),y&&y.nodeType===8)if(o=y.data,o==="/$"||o==="/&"){if(d===0){r.removeChild(y),Xl(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Ac(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,Ac(o);for(var b=o.firstChild;b;){var M=b.nextSibling,z=b.nodeName;b[Gn]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=M}}else o==="body"&&Ac(r.ownerDocument.body);o=y}while(o);Xl(s)}function Mx(r,s){var o=r;r=0;do{var d=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(r===0)break;r--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||r++;o=d}while(o)}function r0(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":r0(o),ln(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function EE(r,s,o,d){for(;r.nodeType===1;){var y=o;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Gn])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(b=r.getAttribute("rel"),b==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(b!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(b=r.getAttribute("src"),(b!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&b&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var b=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===b)return r}else return r;if(r=gs(r.nextSibling),r===null)break}return null}function CE(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=gs(r.nextSibling),r===null))return null;return r}function Rx(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=gs(r.nextSibling),r===null))return null;return r}function s0(r){return r.data==="$?"||r.data==="$~"}function a0(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function AE(r,s){var o=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||o.readyState!=="loading")s();else{var d=function(){s(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function gs(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var o0=null;function jx(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return gs(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function Ox(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return r;s--}else o!=="/$"&&o!=="/&"||s++}r=r.previousSibling}return null}function Lx(r,s,o){switch(s=Mh(o),r){case"html":if(r=s.documentElement,!r)throw Error(i(452));return r;case"head":if(r=s.head,!r)throw Error(i(453));return r;case"body":if(r=s.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function Ac(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);ln(r)}var ys=new Map,Ix=new Set;function Rh(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ea=F.d;F.d={f:NE,r:DE,D:ME,C:RE,L:jE,m:OE,X:IE,S:LE,M:BE};function NE(){var r=Ea.f(),s=Sh();return r||s}function DE(r){var s=ti(r);s!==null&&s.tag===5&&s.type==="form"?Jb(s):Ea.r(r)}var Gl=typeof document>"u"?null:document;function Bx(r,s,o){var d=Gl;if(d&&typeof s=="string"&&s){var y=sn(s);y='link[rel="'+r+'"][href="'+y+'"]',typeof o=="string"&&(y+='[crossorigin="'+o+'"]'),Ix.has(y)||(Ix.add(y),r={rel:r,crossOrigin:o,href:s},d.querySelector(y)===null&&(s=d.createElement("link"),xr(s,"link",r),rn(s),d.head.appendChild(s)))}}function ME(r){Ea.D(r),Bx("dns-prefetch",r,null)}function RE(r,s){Ea.C(r,s),Bx("preconnect",r,s)}function jE(r,s,o){Ea.L(r,s,o);var d=Gl;if(d&&r&&s){var y='link[rel="preload"][as="'+sn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+sn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+sn(o.imageSizes)+'"]')):y+='[href="'+sn(r)+'"]';var b=y;switch(s){case"style":b=Kl(r);break;case"script":b=Wl(r)}ys.has(b)||(r=S({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),ys.set(b,r),d.querySelector(y)!==null||s==="style"&&d.querySelector(Nc(b))||s==="script"&&d.querySelector(Dc(b))||(s=d.createElement("link"),xr(s,"link",r),rn(s),d.head.appendChild(s)))}}function OE(r,s){Ea.m(r,s);var o=Gl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+sn(d)+'"][href="'+sn(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Wl(r)}if(!ys.has(b)&&(r=S({rel:"modulepreload",href:r},s),ys.set(b,r),o.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Dc(b)))return}d=o.createElement("link"),xr(d,"link",r),rn(d),o.head.appendChild(d)}}}function LE(r,s,o){Ea.S(r,s,o);var d=Gl;if(d&&r){var y=Kn(d).hoistableStyles,b=Kl(r);s=s||"default";var M=y.get(b);if(!M){var z={loading:0,preload:null};if(M=d.querySelector(Nc(b)))z.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ys.get(b))&&l0(r,o);var be=M=d.createElement("link");rn(be),xr(be,"link",r),be._p=new Promise(function(ze,rt){be.onload=ze,be.onerror=rt}),be.addEventListener("load",function(){z.loading|=1}),be.addEventListener("error",function(){z.loading|=2}),z.loading|=4,jh(M,s,d)}M={type:"stylesheet",instance:M,count:1,state:z},y.set(b,M)}}}function IE(r,s){Ea.X(r,s);var o=Gl;if(o&&r){var d=Kn(o).hoistableScripts,y=Wl(r),b=d.get(y);b||(b=o.querySelector(Dc(y)),b||(r=S({src:r,async:!0},s),(s=ys.get(y))&&u0(r,s),b=o.createElement("script"),rn(b),xr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function BE(r,s){Ea.M(r,s);var o=Gl;if(o&&r){var d=Kn(o).hoistableScripts,y=Wl(r),b=d.get(y);b||(b=o.querySelector(Dc(y)),b||(r=S({src:r,async:!0,type:"module"},s),(s=ys.get(y))&&u0(r,s),b=o.createElement("script"),rn(b),xr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function Px(r,s,o,d){var y=(y=Oe.current)?Rh(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=Kl(o.href),o=Kn(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=Kl(o.href);var b=Kn(y).hoistableStyles,M=b.get(r);if(M||(y=y.ownerDocument||y,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,M),(b=y.querySelector(Nc(r)))&&!b._p&&(M.instance=b,M.state.loading=5),ys.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},ys.set(r,o),b||PE(y,r,o,M.state))),s&&d===null)throw Error(i(528,""));return M}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=Wl(o),o=Kn(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 Kl(r){return'href="'+sn(r)+'"'}function Nc(r){return'link[rel="stylesheet"]['+r+"]"}function Fx(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function PE(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}),xr(s,"link",o),rn(s),r.head.appendChild(s))}function Wl(r){return'[src="'+sn(r)+'"]'}function Dc(r){return"script[async]"+r}function Ux(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+sn(o.href)+'"]');if(d)return s.instance=d,rn(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"),rn(d),xr(d,"style",y),jh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Kl(o.href);var b=r.querySelector(Nc(y));if(b)return s.state.loading|=4,s.instance=b,rn(b),b;d=Fx(o),(y=ys.get(y))&&l0(d,y),b=(r.ownerDocument||r).createElement("link"),rn(b);var M=b;return M._p=new Promise(function(z,be){M.onload=z,M.onerror=be}),xr(b,"link",d),s.state.loading|=4,jh(b,o.precedence,r),s.instance=b;case"script":return b=Wl(o.src),(y=r.querySelector(Dc(b)))?(s.instance=y,rn(y),y):(d=o,(y=ys.get(b))&&(d=S({},o),u0(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),rn(y),xr(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,jh(d,o.precedence,r));return s.instance}function jh(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,M=0;M<d.length;M++){var z=d[M];if(z.dataset.precedence===s)b=z;else if(b!==y)break}b?b.parentNode.insertBefore(r,b.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(r,s.firstChild))}function l0(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function u0(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Oh=null;function zx(r,s,o){if(Oh===null){var d=new Map,y=Oh=new Map;y.set(o,d)}else y=Oh,d=y.get(o),d||(d=new Map,y.set(o,d));if(d.has(r))return d;for(d.set(r,null),o=o.getElementsByTagName(r),y=0;y<o.length;y++){var b=o[y];if(!(b[Gn]||b[Zt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var M=b.getAttribute(s)||"";M=r+M;var z=d.get(M);z?z.push(b):d.set(M,[b])}}return d}function Hx(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function FE(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 $x(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function UE(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=Kl(d.href),b=s.querySelector(Nc(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,rn(b);return}b=s.ownerDocument||s,d=Fx(d),(y=ys.get(y))&&l0(d,y),b=b.createElement("link"),rn(b);var M=b;M._p=new Promise(function(z,be){M.onload=z,M.onerror=be}),xr(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 c0=0;function zE(r,s){return r.stylesheets&&r.count===0&&Bh(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Bh(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+s);0<r.imgBytes&&c0===0&&(c0=62500*_E());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Bh(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>c0?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(HE,r),Ih=null,Lh.call(r))}function HE(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<y.length;b++){var M=y[b];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(o.set(M.dataset.precedence,M),d=M)}d&&o.set(null,d)}y=s.instance,M=y.getAttribute("data-precedence"),b=o.get(M)||d,b===d&&o.set(null,y),o.set(M,y),this.count++,d=Lh.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),b?b.parentNode.insertBefore(y,b.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),s.state.loading|=4}}var Mc={$$typeof:H,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function $E(r,s,o,d,y,b,M,z,be){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.hiddenUpdates=yt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=be,this.incompleteTransitions=new Map}function qx(r,s,o,d,y,b,M,z,be,ze,rt,ct){return r=new $E(r,s,o,M,be,ze,rt,ct,z),s=1,b===!0&&(s|=24),b=$i(3,null,null,s),r.current=b,b.stateNode=r,s=pa(),s.refCount++,r.pooledCache=s,s.refCount++,b.memoizedState={element:d,isDehydrated:o,cache:s},Km(b),r}function Vx(r){return r?(r=Wa,r):Wa}function Gx(r,s,o,d,y,b){y=Vx(y),d.context===null?d.context=y:d.pendingContext=y,d=Ja(s),d.payload={element:o},b=b===void 0?null:b,b!==null&&(d.callback=b),o=eo(r,d,s),o!==null&&(qr(o,r,s),uc(o,r,s))}function Kx(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function d0(r,s){Kx(r,s),(r=r.alternate)&&Kx(r,s)}function Wx(r){if(r.tag===13||r.tag===31){var s=ma(r,67108864);s!==null&&qr(s,r,67108864),d0(r,67108864)}}function Xx(r){if(r.tag===13||r.tag===31){var s=as();s=xn(s);var o=ma(r,s);o!==null&&qr(o,r,s),d0(r,s)}}var Ph=!0;function qE(r,s,o,d){var y=$.T;$.T=null;var b=F.p;try{F.p=2,h0(r,s,o,d)}finally{F.p=b,$.T=y}}function VE(r,s,o,d){var y=$.T;$.T=null;var b=F.p;try{F.p=8,h0(r,s,o,d)}finally{F.p=b,$.T=y}}function h0(r,s,o,d){if(Ph){var y=f0(d);if(y===null)Zp(r,s,d,Fh,o),Qx(r,d);else if(KE(y,r,s,o,d))d.stopPropagation();else if(Qx(r,d),s&4&&-1<GE.indexOf(r)){for(;y!==null;){var b=ti(y);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var M=D(b.pendingLanes);if(M!==0){var z=b;for(z.pendingLanes|=2,z.entangledLanes|=2;M;){var be=1<<31-Ot(M);z.entanglements[1]|=be,M&=~be}Qs(b),(ri&6)===0&&(_h=fe()+500,kc(0))}}break;case 31:case 13:z=ma(b,2),z!==null&&qr(z,b,2),Sh(),d0(b,2)}if(b=f0(d),b===null&&Zp(r,s,d,Fh,o),b===y)break;y=b}y!==null&&d.stopPropagation()}else Zp(r,s,d,null,o)}}function f0(r){return r=Pi(r),m0(r)}var Fh=null;function m0(r){if(Fh=null,r=Zn(r),r!==null){var s=l(r);if(s===null)r=null;else{var o=s.tag;if(o===13){if(r=u(s),r!==null)return r;r=null}else if(o===31){if(r=h(s),r!==null)return r;r=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Fh=r,null}function Yx(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(qe()){case Le:return 2;case Ce:return 8;case Pe:case Qe:return 32;case At:return 268435456;default:return 32}default:return 32}}var p0=!1,ho=null,fo=null,mo=null,Rc=new Map,jc=new Map,po=[],GE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Qx(r,s){switch(r){case"focusin":case"focusout":ho=null;break;case"dragenter":case"dragleave":fo=null;break;case"mouseover":case"mouseout":mo=null;break;case"pointerover":case"pointerout":Rc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":jc.delete(s.pointerId)}}function Oc(r,s,o,d,y,b){return r===null||r.nativeEvent!==b?(r={blockedOn:s,domEventName:o,eventSystemFlags:d,nativeEvent:b,targetContainers:[y]},s!==null&&(s=ti(s),s!==null&&Wx(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,y!==null&&s.indexOf(y)===-1&&s.push(y),r)}function KE(r,s,o,d,y){switch(s){case"focusin":return ho=Oc(ho,r,s,o,d,y),!0;case"dragenter":return fo=Oc(fo,r,s,o,d,y),!0;case"mouseover":return mo=Oc(mo,r,s,o,d,y),!0;case"pointerover":var b=y.pointerId;return Rc.set(b,Oc(Rc.get(b)||null,r,s,o,d,y)),!0;case"gotpointercapture":return b=y.pointerId,jc.set(b,Oc(jc.get(b)||null,r,s,o,d,y)),!0}return!1}function Zx(r){var s=Zn(r.target);if(s!==null){var o=l(s);if(o!==null){if(s=o.tag,s===13){if(s=u(o),s!==null){r.blockedOn=s,qt(r.priority,function(){Xx(o)});return}}else if(s===31){if(s=h(o),s!==null){r.blockedOn=s,qt(r.priority,function(){Xx(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){r.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Uh(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=f0(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Yi=d,o.target.dispatchEvent(d),Yi=null}else return s=ti(o),s!==null&&Wx(s),r.blockedOn=o,!1;s.shift()}return!0}function Jx(r,s,o){Uh(r)&&o.delete(s)}function WE(){p0=!1,ho!==null&&Uh(ho)&&(ho=null),fo!==null&&Uh(fo)&&(fo=null),mo!==null&&Uh(mo)&&(mo=null),Rc.forEach(Jx),jc.forEach(Jx)}function zh(r,s){r.blockedOn===s&&(r.blockedOn=null,p0||(p0=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,WE)))}var Hh=null;function e1(r){Hh!==r&&(Hh=r,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Hh===r&&(Hh=null);for(var s=0;s<r.length;s+=3){var o=r[s],d=r[s+1],y=r[s+2];if(typeof d!="function"){if(m0(d||o)===null)continue;break}var b=ti(o);b!==null&&(r.splice(s,3),s-=3,fp(b,{pending:!0,data:y,method:o.method,action:d},d,y))}}))}function Xl(r){function s(be){return zh(be,r)}ho!==null&&zh(ho,r),fo!==null&&zh(fo,r),mo!==null&&zh(mo,r),Rc.forEach(s),jc.forEach(s);for(var o=0;o<po.length;o++){var d=po[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<po.length&&(o=po[0],o.blockedOn===null);)Zx(o),o.blockedOn===null&&po.shift();if(o=(r.ownerDocument||r).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var y=o[d],b=o[d+1],M=y[zt]||null;if(typeof b=="function")M||e1(o);else if(M){var z=null;if(b&&b.hasAttribute("formAction")){if(y=b,M=b[zt]||null)z=M.formAction;else if(m0(y)!==null)continue}else z=M.action;typeof z=="function"?o[d+1]=z:(o.splice(d,3),d-=3),e1(o)}}}function t1(){function r(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(M){return y=M})},focusReset:"manual",scroll:"manual"})}function s(){y!==null&&(y(),y=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),y!==null&&(y(),y=null)}}}function g0(r){this._internalRoot=r}$h.prototype.render=g0.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=as();Gx(o,d,r,s,null,null)},$h.prototype.unmount=g0.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Gx(r.current,2,null,r,null,null),Sh(),s[Pt]=null}};function $h(r){this._internalRoot=r}$h.prototype.unstable_scheduleHydration=function(r){if(r){var s=Rn();r={blockedOn:null,target:r,priority:s};for(var o=0;o<po.length&&s!==0&&s<po[o].priority;o++);po.splice(o,0,r),o===0&&Zx(r)}};var n1=e.version;if(n1!=="19.2.3")throw Error(i(527,n1,"19.2.3"));F.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=g(s),r=r!==null?w(r):null,r=r===null?null:r.stateNode,r};var XE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qh.isDisabled&&qh.supportsFiber)try{mn=qh.inject(XE),It=qh}catch{}}return Ic.createRoot=function(r,s){if(!a(r))throw Error(i(299));var o=!1,d="",y=uv,b=cv,M=dv;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(b=s.onCaughtError),s.onRecoverableError!==void 0&&(M=s.onRecoverableError)),s=qx(r,1,!1,null,null,o,d,null,y,b,M,t1),r[Pt]=s.current,Qp(r),new g0(s)},Ic.hydrateRoot=function(r,s,o){if(!a(r))throw Error(i(299));var d=!1,y="",b=uv,M=cv,z=dv,be=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onUncaughtError!==void 0&&(b=o.onUncaughtError),o.onCaughtError!==void 0&&(M=o.onCaughtError),o.onRecoverableError!==void 0&&(z=o.onRecoverableError),o.formState!==void 0&&(be=o.formState)),s=qx(r,1,!0,s,o??null,d,y,be,b,M,z,t1),s.context=Vx(null),o=s.current,d=as(),d=xn(d),y=Ja(d),y.callback=null,eo(o,y,d),o=d,s.current.lanes=o,tn(s,o),Qs(s),r[Pt]=s.current,Qp(r),new $h(s)},Ic.version="19.2.3",Ic}var f1;function aC(){if(f1)return v0.exports;f1=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),v0.exports=sC(),v0.exports}var J_=aC();function oC(...n){return n.filter(Boolean).join(" ")}const lC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",uC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},cC={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"},dC={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 hC(){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 hn({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:w="button",...S}){const A=l||u||h?"gap-x-1.5":"";return c.jsxs("button",{type:w,disabled:f||h,className:oC(lC,uC[a],cC[i],dC[t][e],A,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(hC,{})}):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 ew(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;e<a;e++)n[e]&&(t=ew(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function gn(){for(var n,e,t=0,i="",a=arguments.length;t<a;t++)(n=arguments[t])&&(e=ew(n))&&(i&&(i+=" "),i+=e);return i}var vu=Z_(),fC=Object.defineProperty,mC=(n,e,t)=>e in n?fC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,S0=(n,e,t)=>(mC(n,typeof e!="symbol"?e+"":e,t),t);let pC=class{constructor(){S0(this,"current",this.detect()),S0(this,"handoffState","pending"),S0(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"}},aa=new pC;function vd(n){var e;return aa.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function Ag(n){var e,t;return aa.isServer?null:n==null?document:(t=(e=n?.getRootNode)==null?void 0:e.call(n))!=null?t:document}function tw(n){var e,t;return(t=(e=Ag(n))==null?void 0:e.activeElement)!=null?t:null}function gC(n){return tw(n)===n}function Zf(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function Ba(){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 Zf(()=>{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=Ba();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 Jf(){let[n]=m.useState(Ba);return m.useEffect(()=>()=>n.dispose(),[n]),n}let Yr=(n,e)=>{aa.isServer?m.useEffect(n,e):m.useLayoutEffect(n,e)};function _l(n){let e=m.useRef(n);return Yr(()=>{e.current=n},[n]),e}let wi=function(n){let e=_l(n);return fn.useCallback((...t)=>e.current(...t),[e])};function xd(n){return m.useMemo(()=>n,Object.values(n))}let yC=m.createContext(void 0);function bC(){return m.useContext(yC)}function Ng(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function La(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,La),i}var vf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(vf||{}),Eo=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(Eo||{});function Es(){let n=xC();return m.useCallback(e=>vC({mergeRefs:n,...e}),[n])}function vC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??_C;let f=nw(e,n);if(l)return Vh(f,t,i,u,h);let g=a??0;if(g&2){let{static:w=!1,...S}=f;if(w)return Vh(S,t,i,u,h)}if(g&1){let{unmount:w=!0,...S}=f;return La(w?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}=T0(n,["unmount","static"]),g=n.ref!==void 0?{[h]:n.ref}:{},w=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 A=!1,C=[];for(let[j,k]of Object.entries(e))typeof k=="boolean"&&(A=!0),k===!0&&C.push(j.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(A){S["data-headlessui-state"]=C.join(" ");for(let j of C)S[`data-${j}`]=""}}if(Qc(l)&&(Object.keys(il(f)).length>0||Object.keys(il(S)).length>0))if(!m.isValidElement(w)||Array.isArray(w)&&w.length>1||SC(w)){if(Object.keys(il(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(il(f)).concat(Object.keys(il(S))).map(A=>` - ${A}`).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(A=>` - ${A}`).join(`
|
||
`)].join(`
|
||
`))}else{let A=w.props,C=A?.className,j=typeof C=="function"?(...V)=>Ng(C(...V),f.className):Ng(C,f.className),k=j?{className:j}:{},B=nw(w.props,il(T0(f,["ref"])));for(let V in S)V in B&&delete S[V];return m.cloneElement(w,Object.assign({},B,S,g,{ref:a(wC(w),g.ref)},k))}return m.createElement(l,Object.assign({},T0(f,["ref"]),!Qc(l)&&g,!Qc(l)&&S),w)}function xC(){let n=m.useRef([]),e=m.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 _C(...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 nw(...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 Zr(n){var e;return Object.assign(m.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function il(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function T0(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function wC(n){return fn.version.split(".")[0]>="19"?n.props.ref:n.ref}function Qc(n){return n===m.Fragment||n===Symbol.for("react.fragment")}function SC(n){return Qc(n.type)}let TC="span";var xf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(xf||{});function kC(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 Es()({ourProps:l,theirProps:a,slot:{},defaultTag:TC,name:"Hidden"})}let Dg=Zr(kC);function EC(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function Ao(n){return EC(n)&&"tagName"in n}function gl(n){return Ao(n)&&"accessKey"in n}function Co(n){return Ao(n)&&"tabIndex"in n}function CC(n){return Ao(n)&&"style"in n}function AC(n){return gl(n)&&n.nodeName==="IFRAME"}function NC(n){return gl(n)&&n.nodeName==="INPUT"}let iw=Symbol();function DC(n,e=!0){return Object.assign(n,{[iw]:e})}function ca(...n){let e=m.useRef(n);m.useEffect(()=>{e.current=n},[n]);let t=wi(i=>{for(let a of e.current)a!=null&&(typeof a=="function"?a(i):a.current=i)});return n.every(i=>i==null||i?.[iw])?void 0:t}let my=m.createContext(null);my.displayName="DescriptionContext";function rw(){let n=m.useContext(my);if(n===null){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,rw),e}return n}function MC(){let[n,e]=m.useState([]);return[n.length>0?n.join(" "):void 0,m.useMemo(()=>function(t){let i=wi(l=>(e(u=>[...u,l]),()=>e(u=>{let h=u.slice(),f=h.indexOf(l);return f!==-1&&h.splice(f,1),h}))),a=m.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 fn.createElement(my.Provider,{value:a},t.children)},[e])]}let RC="p";function jC(n,e){let t=m.useId(),i=bC(),{id:a=`headlessui-description-${t}`,...l}=n,u=rw(),h=ca(e);Yr(()=>u.register(a),[a,u.register]);let f=xd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return Es()({ourProps:g,theirProps:l,slot:f,defaultTag:RC,name:u.name||"Description"})}let OC=Zr(jC),LC=Object.assign(OC,{});var sw=(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))(sw||{});let IC=m.createContext(()=>{});function BC({value:n,children:e}){return fn.createElement(IC.Provider,{value:n},e)}let aw=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 PC=Object.defineProperty,FC=(n,e,t)=>e in n?PC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,UC=(n,e,t)=>(FC(n,e+"",t),t),ow=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},bs=(n,e,t)=>(ow(n,e,"read from private field"),t?t.call(n):e.get(n)),k0=(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)},m1=(n,e,t,i)=>(ow(n,e,"write to private field"),e.set(n,t),t),Js,Vc,Gc;let zC=class{constructor(e){k0(this,Js,{}),k0(this,Vc,new aw(()=>new Set)),k0(this,Gc,new Set),UC(this,"disposables",Ba()),m1(this,Js,e),aa.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return bs(this,Js)}subscribe(e,t){if(aa.isServer)return()=>{};let i={selector:e,callback:t,current:e(bs(this,Js))};return bs(this,Gc).add(i),this.disposables.add(()=>{bs(this,Gc).delete(i)})}on(e,t){return aa.isServer?()=>{}:(bs(this,Vc).get(e).add(t),this.disposables.add(()=>{bs(this,Vc).get(e).delete(t)}))}send(e){let t=this.reduce(bs(this,Js),e);if(t!==bs(this,Js)){m1(this,Js,t);for(let i of bs(this,Gc)){let a=i.selector(bs(this,Js));lw(i.current,a)||(i.current=a,i.callback(a))}for(let i of bs(this,Vc).get(e.type))i(bs(this,Js),e)}}};Js=new WeakMap,Vc=new WeakMap,Gc=new WeakMap;function lw(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:E0(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:E0(n.entries(),e.entries()):p1(n)&&p1(e)?E0(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function E0(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 p1(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}var HC=Object.defineProperty,$C=(n,e,t)=>e in n?HC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,g1=(n,e,t)=>($C(n,typeof e!="symbol"?e+"":e,t),t),qC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(qC||{});let VC={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}}},GC=class uw extends zC{constructor(){super(...arguments),g1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),g1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new uw({stack:[]})}reduce(e,t){return La(t.type,VC,e,t)}};const cw=new aw(()=>GC.new());var C0={exports:{}},A0={};var y1;function KC(){if(y1)return A0;y1=1;var n=Qf();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 A0.useSyncExternalStoreWithSelector=function(f,g,w,S,A){var C=a(null);if(C.current===null){var j={hasValue:!1,value:null};C.current=j}else j=C.current;C=u(function(){function B(Y){if(!V){if(V=!0,W=Y,Y=S(Y),A!==void 0&&j.hasValue){var G=j.value;if(A(G,Y))return H=G}return H=Y}if(G=H,t(W,Y))return G;var O=S(Y);return A!==void 0&&A(G,O)?(W=Y,G):(W=Y,H=O)}var V=!1,W,H,ie=w===void 0?null:w;return[function(){return B(g())},ie===null?void 0:function(){return B(ie())}]},[g,w,S,A]);var k=i(f,C[0],C[1]);return l(function(){j.hasValue=!0,j.value=k},[k]),h(k),k},A0}var b1;function WC(){return b1||(b1=1,C0.exports=KC()),C0.exports}var XC=WC();function dw(n,e,t=lw){return XC.useSyncExternalStoreWithSelector(wi(i=>n.subscribe(YC,i)),wi(()=>n.state),wi(()=>n.state),wi(e),t)}function YC(n){return n}function _d(n,e){let t=m.useId(),i=cw.get(e),[a,l]=dw(i,m.useCallback(u=>[i.selectors.isTop(u,t),i.selectors.inStack(u,t)],[i,t]));return Yr(()=>{if(n)return i.actions.push(t),()=>i.actions.pop(t)},[i,n,t]),n?l?a:!0:!1}let Mg=new Map,Zc=new Map;function v1(n){var e;let t=(e=Zc.get(n))!=null?e:0;return Zc.set(n,t+1),t!==0?()=>x1(n):(Mg.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>x1(n))}function x1(n){var e;let t=(e=Zc.get(n))!=null?e:1;if(t===1?Zc.delete(n):Zc.set(n,t-1),t!==1)return;let i=Mg.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,Mg.delete(n))}function QC(n,{allowed:e,disallowed:t}={}){let i=_d(n,"inert-others");Yr(()=>{var a,l;if(!i)return;let u=Ba();for(let f of(a=t?.())!=null?a:[])f&&u.add(v1(f));let h=(l=e?.())!=null?l:[];for(let f of h){if(!f)continue;let g=vd(f);if(!g)continue;let w=f.parentElement;for(;w&&w!==g.body;){for(let S of w.children)h.some(A=>S.contains(A))||u.add(v1(S));w=w.parentElement}}return u.dispose},[i,e,t])}function ZC(n,e,t){let i=_l(a=>{let l=a.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&t()});m.useEffect(()=>{if(!n)return;let a=e===null?null:gl(e)?e:e.current;if(!a)return;let l=Ba();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 _f=["[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(","),JC=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Da=(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))(Da||{}),Rg=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Rg||{}),e5=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(e5||{});function t5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(_f)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function n5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(JC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var hw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(hw||{});function i5(n,e=0){var t;return n===((t=vd(n))==null?void 0:t.body)?!1:La(e,{0(){return n.matches(_f)},1(){let i=n;for(;i!==null;){if(i.matches(_f))return!0;i=i.parentElement}return!1}})}var r5=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(r5||{});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 ja(n){n?.focus({preventScroll:!0})}let s5=["textarea","input"].join(",");function a5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,s5))!=null?t:!1}function o5(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 Jc(n,e,{sorted:t=!0,relativeTo:i=null,skipElements:a=[]}={}){let l=Array.isArray(n)?n.length>0?Ag(n[0]):document:Ag(n),u=Array.isArray(n)?t?o5(n):n:e&64?n5(n):t5(n);a.length>0&&u.length>1&&(u=u.filter(C=>!a.some(j=>j!=null&&"current"in j?j?.current===C:j===C))),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}:{},w=0,S=u.length,A;do{if(w>=S||w+S<=0)return 0;let C=f+w;if(e&16)C=(C+S)%S;else{if(C<0)return 3;if(C>=S)return 1}A=u[C],A?.focus(g),w+=h}while(A!==tw(A));return e&6&&a5(A)&&A.select(),2}function fw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function l5(){return/Android/gi.test(window.navigator.userAgent)}function _1(){return fw()||l5()}function Gh(n,e,t,i){let a=_l(t);m.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 mw(n,e,t,i){let a=_l(t);m.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 w1=30;function u5(n,e,t){let i=_l(t),a=m.useCallback(function(h,f){if(h.defaultPrevented)return;let g=f(h);if(g===null||!g.getRootNode().contains(g)||!g.isConnected)return;let w=(function S(A){return typeof A=="function"?S(A()):Array.isArray(A)||A instanceof Set?A:[A]})(e);for(let S of w)if(S!==null&&(S.contains(g)||h.composed&&h.composedPath().includes(S)))return;return!i5(g,hw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=m.useRef(null);Gh(n,"pointerdown",h=>{var f,g;_1()||(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(_1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=m.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)>=w1||Math.abs(f.y-u.current.y)>=w1))return a(h,()=>Co(h.target)?h.target:null)},!0),mw(n,"blur",h=>a(h,()=>AC(window.document.activeElement)?window.document.activeElement:null),!0)}function py(...n){return m.useMemo(()=>vd(...n),[...n])}function pw(n,e,t,i){let a=_l(t);m.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 c5(n){return m.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function d5(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 h5(){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 f5(){return fw()?{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=Ba();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(Co(h.target))try{let f=h.target.closest("a");if(!f)return;let{hash:g}=new URL(f.href),w=n.querySelector(g);Co(w)&&!i(w)&&(u=w)}catch{}},!0),e.group(h=>{e.addEventListener(n,"touchstart",f=>{if(h.dispose(),Co(f.target)&&CC(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(Co(h.target)){if(NC(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 m5(){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 ll=d5(()=>new Map,{PUSH(n,e){var t;let i=(t=this.get(n))!=null?t:{doc:n,count:0,d:Ba(),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=[f5(),h5(),m5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});ll.subscribe(()=>{let n=ll.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)&&ll.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&ll.dispatch("TEARDOWN",t)}});function p5(n,e,t=()=>({containers:[]})){let i=c5(ll),a=e?i.get(e):void 0,l=a?a.count>0:!1;return Yr(()=>{if(!(!e||!n))return ll.dispatch("PUSH",e,t),()=>ll.dispatch("POP",e,t)},[n,e]),l}function g5(n,e,t=()=>[document.body]){let i=_d(n,"scroll-lock");p5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function y5(n=0){let[e,t]=m.useState(n),i=m.useCallback(f=>t(f),[]),a=m.useCallback(f=>t(g=>g|f),[]),l=m.useCallback(f=>(e&f)===f,[e]),u=m.useCallback(f=>t(g=>g&~f),[]),h=m.useCallback(f=>t(g=>g^f),[]);return{flags:e,setFlag:i,addFlag:a,hasFlag:l,removeFlag:u,toggleFlag:h}}var b5={},T1,k1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((T1=process==null?void 0:b5)==null?void 0:T1.NODE_ENV)==="test"&&typeof((k1=Element?.prototype)==null?void 0:k1.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 v5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(v5||{});function x5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function _5(n,e,t,i){let[a,l]=m.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=y5(n&&a?3:0),g=m.useRef(!1),w=m.useRef(!1),S=Jf();return Yr(()=>{var A;if(n){if(t&&l(!0),!e){t&&h(3);return}return(A=i?.start)==null||A.call(i,t),w5(e,{inFlight:g,prepare(){w.current?w.current=!1:w.current=g.current,g.current=!0,!w.current&&(t?(h(3),f(4)):(h(4),f(2)))},run(){w.current?t?(f(3),h(4)):(f(4),h(3)):t?f(1):h(1)},done(){var C;w.current&&k5(e)||(g.current=!1,f(7),t||l(!1),(C=i?.end)==null||C.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 w5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ba();return T5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(S5(n,i))})}),l.dispose}function S5(n,e){var t,i;let a=Ba();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 k5(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 gy(n,e){let t=m.useRef([]),i=wi(n);m.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 em=m.createContext(null);em.displayName="OpenClosedContext";var Ls=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(Ls||{});function tm(){return m.useContext(em)}function E5({value:n,children:e}){return fn.createElement(em.Provider,{value:n},e)}function C5({children:n}){return fn.createElement(em.Provider,{value:null},n)}function A5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let ko=[];A5(()=>{function n(e){if(!Co(e.target)||e.target===document.body||ko[0]===e.target)return;let t=e.target;t=t.closest(_f),ko.unshift(t??e.target),ko=ko.filter(i=>i!=null&&i.isConnected),ko.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 gw(n){let e=wi(n),t=m.useRef(!1);m.useEffect(()=>(t.current=!1,()=>{t.current=!0,Zf(()=>{t.current&&e()})}),[e])}let yw=m.createContext(!1);function N5(){return m.useContext(yw)}function E1(n){return fn.createElement(yw.Provider,{value:n.force},n.children)}function D5(n){let e=N5(),t=m.useContext(vw),[i,a]=m.useState(()=>{var l;if(!e&&t!==null)return(l=t.current)!=null?l:null;if(aa.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 m.useEffect(()=>{i!==null&&(n!=null&&n.body.contains(i)||n==null||n.body.appendChild(i))},[i,n]),m.useEffect(()=>{e||t!==null&&a(t.current)},[t,a,e]),i}let bw=m.Fragment,M5=Zr(function(n,e){let{ownerDocument:t=null,...i}=n,a=m.useRef(null),l=ca(DC(A=>{a.current=A}),e),u=py(a.current),h=t??u,f=D5(h),g=m.useContext(jg),w=Jf(),S=Es();return gw(()=>{var A;f&&f.childNodes.length<=0&&((A=f.parentElement)==null||A.removeChild(f))}),f?vu.createPortal(fn.createElement("div",{"data-headlessui-portal":"",ref:A=>{w.dispose(),g&&A&&w.add(g.register(A))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:bw,name:"Portal"})),f):null});function R5(n,e){let t=ca(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=Es();return i?fn.createElement(M5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:bw,name:"Portal"})}let j5=m.Fragment,vw=m.createContext(null);function O5(n,e){let{target:t,...i}=n,a={ref:ca(e)},l=Es();return fn.createElement(vw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:j5,name:"Popover.Group"}))}let jg=m.createContext(null);function L5(){let n=m.useContext(jg),e=m.useRef([]),t=wi(l=>(e.current.push(l),n&&n.register(l),()=>i(l))),i=wi(l=>{let u=e.current.indexOf(l);u!==-1&&e.current.splice(u,1),n&&n.unregister(l)}),a=m.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,m.useMemo(()=>function({children:l}){return fn.createElement(jg.Provider,{value:a},l)},[a])]}let I5=Zr(R5),xw=Zr(O5),B5=Object.assign(I5,{Group:xw});function P5(n,e=typeof document<"u"?document.defaultView:null,t){let i=_d(n,"escape");pw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===sw.Escape&&t(a))})}function F5(){var n;let[e]=m.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=m.useState((n=e?.matches)!=null?n:!1);return Yr(()=>{if(!e)return;function a(l){i(l.matches)}return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function U5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=wi(()=>{var a,l;let u=vd(t),h=[];for(let f of n)f!==null&&(Ao(f)?h.push(f):"current"in f&&Ao(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&&Ao(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:wi(a=>i().some(l=>l.contains(a)))}}let _w=m.createContext(null);function C1({children:n,node:e}){let[t,i]=m.useState(null),a=ww(e??t);return fn.createElement(_w.Provider,{value:a},n,a===null&&fn.createElement(Dg,{features:xf.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&&Ao(f)&&f!=null&&f.contains(l)){i(f);break}}}}))}function ww(n=null){var e;return(e=m.useContext(_w))!=null?e:n}function z5(){let n=typeof document>"u";return"useSyncExternalStore"in o1?(e=>e.useSyncExternalStore)(o1)(()=>()=>{},()=>!1,()=>!n):!1}function nm(){let n=z5(),[e,t]=m.useState(aa.isHandoffComplete);return e&&aa.isHandoffComplete===!1&&t(!1),m.useEffect(()=>{e!==!0&&t(!0)},[e]),m.useEffect(()=>aa.handoff(),[]),n?!1:e}function yy(){let n=m.useRef(!1);return Yr(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var Kc=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(Kc||{});function H5(){let n=m.useRef(0);return mw(!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)Ao(t.current)&&e.add(t.current);return e}let $5="div";var al=(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))(al||{});function q5(n,e){let t=m.useRef(null),i=ca(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;nm()||(h=0);let g=py(t.current);W5(h,{ownerDocument:g});let w=X5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});Y5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:w});let S=H5(),A=wi(W=>{if(!gl(t.current))return;let H=t.current;(ie=>ie())(()=>{La(S.current,{[Kc.Forwards]:()=>{Jc(H,Da.First,{skipElements:[W.relatedTarget,l]})},[Kc.Backwards]:()=>{Jc(H,Da.Last,{skipElements:[W.relatedTarget,l]})}})})}),C=_d(!!(h&2),"focus-trap#tab-lock"),j=Jf(),k=m.useRef(!1),B={ref:i,onKeyDown(W){W.key=="Tab"&&(k.current=!0,j.requestAnimationFrame(()=>{k.current=!1}))},onBlur(W){if(!(h&4))return;let H=Sw(u);gl(t.current)&&H.add(t.current);let ie=W.relatedTarget;Co(ie)&&ie.dataset.headlessuiFocusGuard!=="true"&&(Tw(H,ie)||(k.current?Jc(t.current,La(S.current,{[Kc.Forwards]:()=>Da.Next,[Kc.Backwards]:()=>Da.Previous})|Da.WrapAround,{relativeTo:W.target}):Co(W.target)&&ja(W.target)))}},V=Es();return fn.createElement(fn.Fragment,null,C&&fn.createElement(Dg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:A,features:xf.Focusable}),V({ourProps:B,theirProps:f,defaultTag:$5,name:"FocusTrap"}),C&&fn.createElement(Dg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:A,features:xf.Focusable}))}let V5=Zr(q5),G5=Object.assign(V5,{features:al});function K5(n=!0){let e=m.useRef(ko.slice());return gy(([t],[i])=>{i===!0&&t===!1&&Zf(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=ko.slice())},[n,ko,e]),wi(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function W5(n,{ownerDocument:e}){let t=!!(n&8),i=K5(t);gy(()=>{t||gC(e?.body)&&ja(i())},[t]),gw(()=>{t&&ja(i())})}function X5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=m.useRef(null),u=_d(!!(n&1),"focus-trap#initial-focus"),h=yy();return gy(()=>{if(n===0)return;if(!u){a!=null&&a.current&&ja(a.current);return}let f=t.current;f&&Zf(()=>{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)ja(i.current);else{if(n&16){if(Jc(f,Da.First|Da.AutoFocus)!==Rg.Error)return}else if(Jc(f,Da.First)!==Rg.Error)return;if(a!=null&&a.current&&(ja(a.current),e?.activeElement===a.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}l.current=e?.activeElement})},[a,u,n]),l}function Y5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=yy(),u=!!(n&4);pw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=Sw(i);gl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let w=h.target;gl(w)?Tw(f,w)?(a.current=w,ja(w)):(h.preventDefault(),h.stopPropagation(),ja(g)):ja(a.current)},!0)}function Tw(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function kw(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Qc((e=n.as)!=null?e:Cw)||fn.Children.count(n.children)===1}let im=m.createContext(null);im.displayName="TransitionContext";var Q5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(Q5||{});function Z5(){let n=m.useContext(im);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function J5(){let n=m.useContext(rm);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}let rm=m.createContext(null);rm.displayName="NestingContext";function sm(n){return"children"in n?sm(n.children):n.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Ew(n,e){let t=_l(n),i=m.useRef([]),a=yy(),l=Jf(),u=wi((C,j=Eo.Hidden)=>{let k=i.current.findIndex(({el:B})=>B===C);k!==-1&&(La(j,{[Eo.Unmount](){i.current.splice(k,1)},[Eo.Hidden](){i.current[k].state="hidden"}}),l.microTask(()=>{var B;!sm(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=wi(C=>{let j=i.current.find(({el:k})=>k===C);return j?j.state!=="visible"&&(j.state="visible"):i.current.push({el:C,state:"visible"}),()=>u(C,Eo.Unmount)}),f=m.useRef([]),g=m.useRef(Promise.resolve()),w=m.useRef({enter:[],leave:[]}),S=wi((C,j,k)=>{f.current.splice(0),e&&(e.chains.current[j]=e.chains.current[j].filter(([B])=>B!==C)),e?.chains.current[j].push([C,new Promise(B=>{f.current.push(B)})]),e?.chains.current[j].push([C,new Promise(B=>{Promise.all(w.current[j].map(([V,W])=>W)).then(()=>B())})]),j==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>k(j)):k(j)}),A=wi((C,j,k)=>{Promise.all(w.current[j].splice(0).map(([B,V])=>V)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>k(j))});return m.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:A,wait:g,chains:w}),[h,u,i,S,A,w,g])}let Cw=m.Fragment,Aw=vf.RenderStrategy;function eA(n,e){var t,i;let{transition:a=!0,beforeEnter:l,afterEnter:u,beforeLeave:h,afterLeave:f,enter:g,enterFrom:w,enterTo:S,entered:A,leave:C,leaveFrom:j,leaveTo:k,...B}=n,[V,W]=m.useState(null),H=m.useRef(null),ie=kw(n),Y=ca(...ie?[H,e,W]:e===null?[]:[e]),G=(t=B.unmount)==null||t?Eo.Unmount:Eo.Hidden,{show:O,appear:re,initial:E}=Z5(),[R,ee]=m.useState(O?"visible":"hidden"),q=J5(),{register:Q,unregister:ue}=q;Yr(()=>Q(H),[Q,H]),Yr(()=>{if(G===Eo.Hidden&&H.current){if(O&&R!=="visible"){ee("visible");return}return La(R,{hidden:()=>ue(H),visible:()=>Q(H)})}},[R,H,Q,ue,O,G]);let se=nm();Yr(()=>{if(ie&&se&&R==="visible"&&H.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[H,R,se,ie]);let $=E&&!re,F=re&&O&&E,X=m.useRef(!1),le=Ew(()=>{X.current||(ee("hidden"),ue(H))},q),de=wi(Te=>{X.current=!0;let _t=Te?"enter":"leave";le.onStart(H,_t,dt=>{dt==="enter"?l?.():dt==="leave"&&h?.()})}),L=wi(Te=>{let _t=Te?"enter":"leave";X.current=!1,le.onStop(H,_t,dt=>{dt==="enter"?u?.():dt==="leave"&&f?.()}),_t==="leave"&&!sm(le)&&(ee("hidden"),ue(H))});m.useEffect(()=>{ie&&a||(de(O),L(O))},[O,ie,a]);let pe=!(!a||!ie||!se||$),[,we]=_5(pe,V,O,{start:de,end:L}),Be=il({ref:Y,className:((i=Ng(B.className,F&&g,F&&w,we.enter&&g,we.enter&&we.closed&&w,we.enter&&!we.closed&&S,we.leave&&C,we.leave&&!we.closed&&j,we.leave&&we.closed&&k,!we.transition&&O&&A))==null?void 0:i.trim())||void 0,...x5(we)}),Ve=0;R==="visible"&&(Ve|=Ls.Open),R==="hidden"&&(Ve|=Ls.Closed),O&&R==="hidden"&&(Ve|=Ls.Opening),!O&&R==="visible"&&(Ve|=Ls.Closing);let Oe=Es();return fn.createElement(rm.Provider,{value:le},fn.createElement(E5,{value:Ve},Oe({ourProps:Be,theirProps:B,defaultTag:Cw,features:Aw,visible:R==="visible",name:"Transition.Child"})))}function tA(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=m.useRef(null),h=kw(n),f=ca(...h?[u,e]:e===null?[]:[e]);nm();let g=tm();if(t===void 0&&g!==null&&(t=(g&Ls.Open)===Ls.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[w,S]=m.useState(t?"visible":"hidden"),A=Ew(()=>{t||S("hidden")}),[C,j]=m.useState(!0),k=m.useRef([t]);Yr(()=>{C!==!1&&k.current[k.current.length-1]!==t&&(k.current.push(t),j(!1))},[k,t]);let B=m.useMemo(()=>({show:t,appear:i,initial:C}),[t,i,C]);Yr(()=>{t?S("visible"):!sm(A)&&u.current!==null&&S("hidden")},[t,A]);let V={unmount:a},W=wi(()=>{var Y;C&&j(!1),(Y=n.beforeEnter)==null||Y.call(n)}),H=wi(()=>{var Y;C&&j(!1),(Y=n.beforeLeave)==null||Y.call(n)}),ie=Es();return fn.createElement(rm.Provider,{value:A},fn.createElement(im.Provider,{value:B},ie({ourProps:{...V,as:m.Fragment,children:fn.createElement(Nw,{ref:f,...V,...l,beforeEnter:W,beforeLeave:H})},theirProps:{},defaultTag:m.Fragment,features:Aw,visible:w==="visible",name:"Transition"})))}function nA(n,e){let t=m.useContext(im)!==null,i=tm()!==null;return fn.createElement(fn.Fragment,null,!t&&i?fn.createElement(Og,{ref:e,...n}):fn.createElement(Nw,{ref:e,...n}))}let Og=Zr(tA),Nw=Zr(eA),by=Zr(nA),ed=Object.assign(Og,{Child:by,Root:Og});var iA=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(iA||{}),rA=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(rA||{});let sA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},vy=m.createContext(null);vy.displayName="DialogContext";function am(n){let e=m.useContext(vy);if(e===null){let t=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,am),t}return e}function aA(n,e){return La(e.type,sA,n,e)}let A1=Zr(function(n,e){let t=m.useId(),{id:i=`headlessui-dialog-${t}`,open:a,onClose:l,initialFocus:u,role:h="dialog",autoFocus:f=!0,__demoMode:g=!1,unmount:w=!1,...S}=n,A=m.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(A.current||(A.current=!0,console.warn(`Invalid role [${h}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let C=tm();a===void 0&&C!==null&&(a=(C&Ls.Open)===Ls.Open);let j=m.useRef(null),k=ca(j,e),B=py(j.current),V=a?0:1,[W,H]=m.useReducer(aA,{titleId:null,descriptionId:null,panelRef:m.createRef()}),ie=wi(()=>l(!1)),Y=wi(we=>H({type:0,id:we})),G=nm()?V===0:!1,[O,re]=L5(),E={get current(){var we;return(we=W.panelRef.current)!=null?we:j.current}},R=ww(),{resolveContainers:ee}=U5({mainTreeNode:R,portals:O,defaultContainers:[E]}),q=C!==null?(C&Ls.Closing)===Ls.Closing:!1;QC(g||q?!1:G,{allowed:wi(()=>{var we,Be;return[(Be=(we=j.current)==null?void 0:we.closest("[data-headlessui-portal]"))!=null?Be:null]}),disallowed:wi(()=>{var we;return[(we=R?.closest("body > *:not(#headlessui-portal-root)"))!=null?we:null]})});let Q=cw.get(null);Yr(()=>{if(G)return Q.actions.push(i),()=>Q.actions.pop(i)},[Q,i,G]);let ue=dw(Q,m.useCallback(we=>Q.selectors.isTop(we,i),[Q,i]));u5(ue,ee,we=>{we.preventDefault(),ie()}),P5(ue,B?.defaultView,we=>{we.preventDefault(),we.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),ie()}),g5(g||q?!1:G,B,ee),ZC(G,j,ie);let[se,$]=MC(),F=m.useMemo(()=>[{dialogState:V,close:ie,setTitleId:Y,unmount:w},W],[V,ie,Y,w,W]),X=xd({open:V===0}),le={ref:k,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:V===0?!0:void 0,"aria-labelledby":W.titleId,"aria-describedby":se,unmount:w},de=!F5(),L=al.None;G&&!g&&(L|=al.RestoreFocus,L|=al.TabLock,f&&(L|=al.AutoFocus),de&&(L|=al.InitialFocus));let pe=Es();return fn.createElement(C5,null,fn.createElement(E1,{force:!0},fn.createElement(B5,null,fn.createElement(vy.Provider,{value:F},fn.createElement(xw,{target:j},fn.createElement(E1,{force:!1},fn.createElement($,{slot:X},fn.createElement(re,null,fn.createElement(G5,{initialFocus:u,initialFocusFallback:j,containers:ee,features:L},fn.createElement(BC,{value:ie},pe({ourProps:le,theirProps:S,slot:X,defaultTag:oA,features:lA,visible:V===0,name:"Dialog"})))))))))))}),oA="div",lA=vf.RenderStrategy|vf.Static;function uA(n,e){let{transition:t=!1,open:i,...a}=n,l=tm(),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?fn.createElement(C1,null,fn.createElement(ed,{show:i,transition:t,unmount:a.unmount},fn.createElement(A1,{ref:e,...a}))):fn.createElement(C1,null,fn.createElement(A1,{ref:e,open:i,...a}))}let cA="div";function dA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=am("Dialog.Panel"),g=ca(e,f.panelRef),w=xd({open:u===0}),S=wi(B=>{B.stopPropagation()}),A={ref:g,id:i,onClick:S},C=a?by:m.Fragment,j=a?{unmount:h}:{},k=Es();return fn.createElement(C,{...j},k({ourProps:A,theirProps:l,slot:w,defaultTag:cA,name:"Dialog.Panel"}))}let hA="div";function fA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=am("Dialog.Backdrop"),u=xd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?by:m.Fragment,g=t?{unmount:l}:{},w=Es();return fn.createElement(f,{...g},w({ourProps:h,theirProps:i,slot:u,defaultTag:hA,name:"Dialog.Backdrop"}))}let mA="h2";function pA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=am("Dialog.Title"),h=ca(e);m.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=xd({open:l===0}),g={ref:h,id:i};return Es()({ourProps:g,theirProps:a,slot:f,defaultTag:mA,name:"Dialog.Title"})}let gA=Zr(uA),yA=Zr(dA);Zr(fA);let bA=Zr(pA),lu=Object.assign(gA,{Panel:yA,Title:bA,Description:LC});function vA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=m.useState(""),[u,h]=m.useState(""),[f,g]=m.useState([]),w=m.useRef(!1);m.useEffect(()=>{n&&!w.current&&(l(""),h(""),g(i??[])),w.current=n},[n,i]);function S(){const j=a.trim(),k=u.trim();!j||!k||(g(B=>[...B.filter(W=>W.name!==j),{name:j,value:k}]),l(""),h(""))}function A(j){g(k=>k.filter(B=>B.name!==j))}function C(){t(f),e()}return c.jsxs(lu,{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(lu.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(lu.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:j=>l(j.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:j=>h(j.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(hn,{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(j=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:j.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:j.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>A(j.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},j.name))})]})}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx(hn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(hn,{variant:"primary",onClick:C,children:"Übernehmen"})]})]})})]})}function xA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 _A=m.forwardRef(xA);function Lg({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(A=>A.id===e)??n[0],f=gn("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=A=>gn(A?"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"),w=(A,C)=>C.count===void 0?null:c.jsx("span",{className:g(A),children:C.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(A=>{const C=A.id===h.id,j=!!A.disabled;return c.jsxs("button",{type:"button",onClick:()=>!j&&t(A.id),disabled:j,"aria-current":C?"page":void 0,className:gn(C?"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",j&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[l==="underlineIcons"&&A.icon?c.jsx(A.icon,{"aria-hidden":"true",className:gn(C?"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:A.label}),w(C,A)]},A.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const A=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",C=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(j=>{const k=j.id===h.id,B=!!j.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(j.id),disabled:B,"aria-current":k?"page":void 0,className:gn(k?A:C,"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:j.label}),j.count!==void 0?c.jsx("span",{className:gn(k?"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:j.count}):null]},j.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(A=>{const C=A.id===h.id,j=!!A.disabled;return c.jsx("button",{type:"button",onClick:()=>!j&&t(A.id),disabled:j,"aria-current":C?"page":void 0,className:gn(C?"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",j&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:A.label},A.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((A,C)=>{const j=A.id===h.id,k=!!A.disabled;return c.jsxs("button",{type:"button",onClick:()=>!k&&t(A.id),disabled:k,"aria-current":j?"page":void 0,className:gn(j?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",C===0?"rounded-l-lg":"",C===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",k&&"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:A.label,children:A.label}),A.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:A.count}):null]}),c.jsx("span",{"aria-hidden":"true",className:gn(j?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},A.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(A=>{const C=A.id===h.id,j=!!A.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!j&&t(A.id),disabled:j,"aria-current":C?"page":void 0,className:gn(C?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",j&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:A.label})},A.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:A=>t(A.target.value),"aria-label":a,className:f,children:n.map(A=>c.jsx("option",{value:A.id,children:A.label},A.id))}),c.jsx(_A,{"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 Is({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 w=l;return c.jsxs("div",{className:gn("overflow-hidden",a?"sm:rounded-lg":"rounded-lg",w?"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:gn("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:gn("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 Ig({checked:n,onChange:e,id:t,name:i,disabled:a,required:l,ariaLabel:u,ariaLabelledby:h,ariaDescribedby:f,size:g="default",variant:w="simple",className:S}){const A=j=>{a||e(j.target.checked)},C=gn("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:gn("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:gn("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:gn("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:A,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:C})]}):c.jsxs("div",{className:gn("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:[w==="icon"?c.jsxs("span",{className:gn("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:gn("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:gn("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:gn("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:A,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:C})]})}function Na({label:n,description:e,labelPosition:t="left",id:i,className:a,...l}){const u=m.useId(),h=i??`sw-${u}`,f=`${h}-label`,g=`${h}-desc`;return t==="right"?c.jsxs("div",{className:gn("flex items-center justify-between gap-3",a),children:[c.jsx(Ig,{...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:gn("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(Ig,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const xu=new Map;let N1=!1;function wA(){N1||(N1=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const n of xu.values())n.es&&(n.es.close(),n.es=null,n.dispatchers.clear());else for(const n of xu.values())n.refs>0&&!n.es&&Dw(n)}))}function Dw(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 SA(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function TA(n){let e=xu.get(n);return e||(e={url:n,es:null,refs:0,listeners:new Map,dispatchers:new Map},xu.set(n,e)),e}function Mw(n,e,t){wA();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 Dw(i);return()=>{const l=xu.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&&(SA(l),xu.delete(n))}}async function kA(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}function D1({startUrl:n,stopUrl:e,sseUrl:t,onTrigger:i,title:a="Task",description:l="Startet eine Hintergrundaufgabe. Fortschritt & Abbrechen oben in der Taskliste.",startLabel:u="Start",startingLabel:h="Starte…",disabled:f=!1,busy:g=!1,onFinished:w,onStart:S,onProgress:A,onDone:C,onCancelled:j,onError:k}){const[B,V]=m.useState(null),[W,H]=m.useState(!1),[ie,Y]=m.useState(null),G=m.useRef(null),O=m.useRef(!1),re=m.useRef(!1),E=m.useRef(!1),R=m.useRef(!1),ee=m.useRef(""),q=m.useRef(A),Q=m.useRef(k);m.useEffect(()=>{q.current=A},[A]),m.useEffect(()=>{Q.current=k},[k]);async function ue(){if(e&&!E.current){E.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{E.current=!1}}}function se(){if(G.current)return G.current;const le=new AbortController;G.current=le;const de=()=>{re.current=!0,ue()};return le.signal.addEventListener("abort",de,{once:!0}),le}function $(le){O.current||(O.current=!0,S?.(le))}m.useEffect(()=>{const le=R.current,de=!!B?.running;if(R.current=de,le&&!de){const L=String(B?.error??"").trim();G.current=null,O.current=!1,re.current||L==="abgebrochen"?(re.current=!1,j?.()):L||C?.(),w?.()}},[B?.running,B?.error,w,C,j]),m.useEffect(()=>{if(!t)return;const le=Mw(t,"state",de=>{if(V(de),de?.running){const pe=se();$(pe),q.current?.({done:de?.done??0,total:de?.total??0,currentFile:de?.currentFile??""})}const L=String(de?.error??"").trim();L&&L!=="abgebrochen"&&L!==ee.current&&(ee.current=L,Q.current?.(L))});return()=>le()},[t]);async function F(){if(g||B?.running)return;if(Y(null),H(!0),re.current=!1,ee.current="",i){try{await i()}catch(de){const L=de?.message??String(de);Y(L),k?.(L)}finally{H(!1)}return}if(!n){const de="Task ist nicht konfiguriert (startUrl fehlt).";Y(de),k?.(de),H(!1);return}const le=se();try{const de=await kA(n,{method:"POST"});V(de),$(le),de?.running&&A?.({done:de?.done??0,total:de?.total??0,currentFile:de?.currentFile??""})}catch(de){G.current=null,O.current=!1;const L=de?.message??String(de);Y(L),k?.(L)}finally{H(!1)}}const X=!!B?.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:a}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:l}),ie?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:ie}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(hn,{variant:"primary",onClick:F,disabled:f||g||W||X,children:W||g?h:u})})]})}function EA(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 CA({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=EA(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 AA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 NA=m.forwardRef(AA);function DA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 M1=m.forwardRef(DA);function MA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(MA);function jA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(jA);function OA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 LA=m.forwardRef(OA);function IA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 BA=m.forwardRef(IA);function PA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(PA);function FA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 N0=m.forwardRef(FA);function UA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 zA=m.forwardRef(UA);function HA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 $A=m.forwardRef(HA);function qA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 VA=m.forwardRef(qA);function GA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 KA=m.forwardRef(GA);function WA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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"}),m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const wf=m.forwardRef(WA);function XA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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"}),m.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 j1=m.forwardRef(XA);function YA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 td=m.forwardRef(YA);function QA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 ZA=m.forwardRef(QA);function JA({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 eN=m.forwardRef(JA);function tN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 nN=m.forwardRef(tN);function iN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 rN=m.forwardRef(iN);function sN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 O1=m.forwardRef(sN);function aN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),m.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 oN=m.forwardRef(aN);function lN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 uN=m.forwardRef(lN);function cN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 dN=m.forwardRef(cN);function hN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 D0=m.forwardRef(hN);function fN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 mN=m.forwardRef(fN);function pN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Sf=m.forwardRef(pN);function gN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 yN=m.forwardRef(gN);function bN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 L1=m.forwardRef(bN);function vN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 I1=m.forwardRef(vN);function xN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 _N=m.forwardRef(xN);function wN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Tf=m.forwardRef(wN);function _r(...n){return n.filter(Boolean).join(" ")}function kf({open:n,onClose:e,title:t,titleRight:i,children:a,footer:l,icon:u,width:h="max-w-lg",layout:f="single",left:g,leftWidthClass:w="lg:w-80",scroll:S,bodyClassName:A,leftClassName:C,rightClassName:j,rightHeader:k,rightBodyClassName:B,mobileCollapsedImageSrc:V,mobileCollapsedImageAlt:W}){const H=S??(f==="split"?"right":"body"),ie=m.useRef(null),[Y,G]=m.useState(!1);return m.useEffect(()=>{if(!n)return;const O=document.documentElement,re=document.body,E=O.style.overflow,R=re.style.overflow,ee=re.style.paddingRight,q=window.innerWidth-O.clientWidth;return O.style.overflow="hidden",re.style.overflow="hidden",q>0&&(re.style.paddingRight=`${q}px`),()=>{O.style.overflow=E,re.style.overflow=R,re.style.paddingRight=ee}},[n]),m.useEffect(()=>{n&&G(!1)},[n]),m.useEffect(()=>{if(!n)return;const O=ie.current;if(!O)return;const re=72,E=()=>{const R=O.scrollTop||0;G(ee=>{const q=R>re;return ee===q?ee:q})};return E(),O.addEventListener("scroll",E,{passive:!0}),()=>O.removeEventListener("scroll",E)},[n]),c.jsx(ed,{show:n,as:m.Fragment,children:c.jsxs(lu,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(ed.Child,{as:m.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(ed.Child,{as:m.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(lu.Panel,{className:_r("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",h),children:[u?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:u}):null,c.jsxs("div",{className:_r("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",f==="split"?"hidden lg:flex":"flex"),children:[c.jsx("div",{className:"min-w-0 flex-1",children:t?c.jsx(lu.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[i?c.jsx("div",{className:"hidden sm:block",children:i}):null,c.jsx("button",{type:"button",onClick:e,className:_r("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(Tf,{className:"size-5"})})]})]}),f==="single"?c.jsx("div",{className:_r("flex-1 min-h-0 h-full",H==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",j),children:a}):c.jsxs("div",{className:_r("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",A),children:[c.jsxs("div",{ref:ie,className:_r("lg:hidden flex-1 min-h-0 relative",H==="right"||H==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:_r("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:_r("flex items-center justify-between gap-3 px-3",Y?"py-2":"py-3"),children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1",children:[V?c.jsx("img",{src:V,alt:W||t||"",className:_r("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",Y?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0 flex-1",children:t?c.jsx("div",{className:_r("truncate font-semibold text-gray-900 dark:text-white",Y?"text-sm":"text-base"),children:t}):null})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[i?c.jsx("div",{children:i}):null,c.jsx("button",{type:"button",onClick:e,className:_r("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(Tf,{className:"size-5"})})]})]}),k?c.jsx("div",{children:k}):null]}),g?c.jsx("div",{className:_r("lg:hidden px-2 pb-2",C),children:g}):null,c.jsx("div",{className:_r("px-2 pt-0 min-h-0",j),children:c.jsx("div",{className:_r("min-h-0",B),children:a})})]}),c.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[c.jsx("div",{className:_r("min-h-0",w,"shrink-0","overflow-hidden",C),children:g}),c.jsxs("div",{className:_r("flex-1 min-h-0 flex flex-col",j),children:[k?c.jsx("div",{className:"shrink-0",children:k}):null,c.jsx("div",{className:_r("flex-1 min-h-0",H==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",B),children:a})]})]})]}),l?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:l}):null]})})})})]})})}function Rw(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=Rw(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 TN({open:n,onClose:e,initialUrl:t,initialHasPassword:i,onApply:a}){const[l,u]=m.useState("127.0.0.1"),[h,f]=m.useState(5432),[g,w]=m.useState("nsfwapp"),[S,A]=m.useState("postgres"),[C,j]=m.useState(""),[k,B]=m.useState("disable"),V=m.useMemo(()=>SN({user:S,host:l,port:h,db:g,sslmode:k}),[S,l,h,g,k]),W=c.jsxs(c.Fragment,{children:[c.jsx(hn,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(hn,{variant:"primary",onClick:()=>{a({databaseUrl:V,dbPassword:C}),e()},children:"Übernehmen"})]});return c.jsx(kf,{open:n,onClose:e,title:"Postgres URL erstellen",width:"max-w-2xl",footer:W,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:H=>u(H.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:H=>f(Rw(H.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:H=>w(H.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:H=>A(H.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:C,onChange:H=>j(H.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:k,onChange:H=>B(H.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:V})]})]})})}function kN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 jw=m.forwardRef(kN);function EN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),m.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 yl=m.forwardRef(EN);function CN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 Bg=m.forwardRef(CN);function AN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 NN=m.forwardRef(AN);function DN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 bl=m.forwardRef(DN);function MN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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=m.forwardRef(MN);function jN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 ON=m.forwardRef(jN);function LN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 IN=m.forwardRef(LN);function BN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 _u=m.forwardRef(BN);function PN({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 FN=m.forwardRef(PN),er={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 UN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function zN({onAssetsGenerated:n}){const[e,t]=m.useState(er),[i,a]=m.useState(!1),[l,u]=m.useState(0),h=m.useRef(null),[f,g]=m.useState(!1),[w,S]=m.useState(null),[A,C]=m.useState(null),[j,k]=m.useState(null),[B,V]=m.useState(null),W=m.useRef(null),[H,ie]=m.useState(!1),[Y,G]=m.useState(""),[O,re]=m.useState(""),E=Date.now(),R=l>E,q=i?"saving":R?"success":!!j&&!i&&!R?"error":"idle",Q=q==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:q==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(jw,{className:"size-4"}),isLoading:!1}:q==="error"?{text:"Fehler",color:"red",icon:c.jsx(FN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[ue,se]=m.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[$,F]=m.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),X=Number(e.lowDiskPauseBelowGB??er.lowDiskPauseBelowGB??5),le=B?.pauseGB??X,de=B?.resumeGB??X+3;m.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),m.useEffect(()=>{let Oe=!0;return fetch("/api/settings",{cache:"no-store"}).then(async Te=>{if(!Te.ok)throw new Error(await Te.text());return Te.json()}).then(Te=>{Oe&&(t({databaseUrl:String(Te.databaseUrl??""),hasDbPassword:!!(Te.hasDbPassword??!1),recordDir:(Te.recordDir||er.recordDir).toString(),doneDir:(Te.doneDir||er.doneDir).toString(),ffmpegPath:String(Te.ffmpegPath??er.ffmpegPath??""),autoAddToDownloadList:Te.autoAddToDownloadList??er.autoAddToDownloadList,autoStartAddedDownloads:Te.autoStartAddedDownloads??er.autoStartAddedDownloads,useChaturbateApi:Te.useChaturbateApi??er.useChaturbateApi,useMyFreeCamsWatcher:Te.useMyFreeCamsWatcher??er.useMyFreeCamsWatcher,autoDeleteSmallDownloads:Te.autoDeleteSmallDownloads??er.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:Te.autoDeleteSmallDownloadsBelowMB??er.autoDeleteSmallDownloadsBelowMB,blurPreviews:Te.blurPreviews??er.blurPreviews,teaserPlayback:Te.teaserPlayback??er.teaserPlayback,teaserAudio:Te.teaserAudio??er.teaserAudio,lowDiskPauseBelowGB:Te.lowDiskPauseBelowGB??er.lowDiskPauseBelowGB,enableNotifications:Te.enableNotifications??er.enableNotifications}),G(String(Te.databaseUrl??"").trim()))}).catch(()=>{}),()=>{Oe=!1}},[]),m.useEffect(()=>{let Oe=!0;const Te=async()=>{try{const dt=await fetch("/api/status/disk",{cache:"no-store"});if(!dt.ok)return;const xe=await dt.json();Oe&&V(xe)}catch{}};Te();const _t=window.setInterval(Te,5e3);return()=>{Oe=!1,window.clearInterval(_t)}},[]);async function L(Oe){k(null),C(null),S(Oe);try{window.focus();const Te=await fetch(`/api/settings/browse?target=${Oe}`,{cache:"no-store"});if(Te.status===204)return;if(!Te.ok){const xe=await Te.text().catch(()=>"");throw new Error(xe||`HTTP ${Te.status}`)}const dt=((await Te.json()).path??"").trim();if(!dt)return;t(xe=>Oe==="record"?{...xe,recordDir:dt}:Oe==="done"?{...xe,doneDir:dt}:{...xe,ffmpegPath:dt})}catch(Te){k(Te?.message??String(Te))}finally{S(null)}}async function pe(){k(null),C(null);const Oe=e.recordDir.trim(),Te=e.doneDir.trim(),_t=(e.ffmpegPath??"").trim(),dt=String(e.databaseUrl??"").trim(),xe=!!(O||"").trim();if(!Oe||!Te){k("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const Ne=!!e.autoAddToDownloadList,Se=Ne?!!e.autoStartAddedDownloads:!1,Ie=!!e.useChaturbateApi,$e=!!e.useMyFreeCamsWatcher,Ct=!!e.autoDeleteSmallDownloads,st=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??er.autoDeleteSmallDownloadsBelowMB)))),gt=!!e.blurPreviews,He=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:er.teaserPlayback,We=!!e.teaserAudio,Je=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??er.lowDiskPauseBelowGB))),et=!!e.enableNotifications;a(!0);try{const mt=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:dt,dbPassword:O||void 0,recordDir:Oe,doneDir:Te,ffmpegPath:_t,autoAddToDownloadList:Ne,autoStartAddedDownloads:Se,useChaturbateApi:Ie,useMyFreeCamsWatcher:$e,autoDeleteSmallDownloads:Ct,autoDeleteSmallDownloadsBelowMB:st,blurPreviews:gt,teaserPlayback:He,teaserAudio:We,lowDiskPauseBelowGB:Je,enableNotifications:et})});if(!mt.ok){const qe=await mt.text().catch(()=>"");throw new Error(qe||`HTTP ${mt.status}`)}C("✅ Gespeichert.");const Mt=Date.now()+2500;u(Mt),h.current!=null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{u(0),h.current=null},2500),window.dispatchEvent(new CustomEvent("recorder-settings-updated")),(dt!==Y||xe)&&(window.dispatchEvent(new CustomEvent("models-db-changed",{detail:{databaseUrl:dt}})),G(dt),re(""))}catch(mt){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),k(mt?.message??String(mt))}finally{a(!1)}}function we(Oe,Te=3500,_t=500){window.setTimeout(()=>{Oe(dt=>({...dt,fading:!0})),window.setTimeout(()=>{Oe(dt=>({...dt,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},_t)},Te)}async function Be(){k(null),C(null);const Oe=Number(e.autoDeleteSmallDownloadsBelowMB??er.autoDeleteSmallDownloadsBelowMB??0),Te=(e.doneDir||er.doneDir).trim();if(!Te){k("doneDir ist leer.");return}if(!Oe||Oe<=0){k("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen:
|
||
• Löscht Dateien in "${Te}" < ${Oe} MB (Ordner "keep" wird übersprungen)
|
||
• Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei
|
||
|
||
Fortfahren?`)){g(!0),F(dt=>({...dt,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const dt=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!dt.ok){const Ct=await dt.text().catch(()=>"");throw new Error(Ct||`HTTP ${dt.status}`)}const xe=await dt.json(),Ne=Number(xe.scannedFiles??0),Se=Number(xe.orphanIdsRemoved??0),Ie=Number(xe.generatedOrphansRemoved??0),$e=Se+Ie;F(Ct=>({...Ct,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Ne} · Orphans: ${$e}`})),we(F)}catch(dt){const xe=dt?.message??String(dt);k(xe),F(Ne=>({...Ne,status:"error",text:"Fehler beim Aufräumen.",err:xe})),we(F)}finally{g(!1)}}}async function Ve(){const Oe=W.current;if(W.current=null,se(Te=>({...Te,status:"cancelled",text:"Abgebrochen."})),Oe){Oe.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return c.jsx(Is,{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:[q!=="success"?c.jsx("div",{className:"hidden sm:flex min-w-0 max-w-[520px] items-stretch",children:j?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:j}):A?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:A}):null}):null,c.jsx(hn,{variant:"primary",color:Q.color,onClick:pe,disabled:i,className:"shrink-0",size:"md",isLoading:Q.isLoading,leadingIcon:Q.icon,children:Q.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(CA,{tasks:[ue,$],onCancel:Oe=>{Oe==="generate-assets"&&Ve()}}),q!=="success"?c.jsxs("div",{className:"sm:hidden",children:[j&&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:j}),A&&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:A})]}):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(D1,{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",sseUrl:"/api/events/stream",onFinished:n,onStart:Oe=>{W.current=Oe,se(Te=>({...Te,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:Oe=>{const Te=UN(Oe.currentFile);se(_t=>({..._t,status:"running",title:"Assets generieren",text:Te||"",done:Oe.done,total:Oe.total}))},onDone:()=>{W.current=null,se(Oe=>({...Oe,status:"done",title:"Assets generieren"})),we(se)},onCancelled:()=>{W.current=null,se(Oe=>({...Oe,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),we(se)},onError:Oe=>{W.current=null,se(Te=>({...Te,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:Oe})),we(se)}}),c.jsx(D1,{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:Be,busy:f,disabled:i||!e.autoDeleteSmallDownloads,onError:Oe=>{k(Oe)}})]})]}),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:Oe=>t(Te=>({...Te,databaseUrl:Oe.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(hn,{variant:"secondary",onClick:()=>ie(!0),disabled:i,children:"URL erstellen…"})]})]})})]}),c.jsx(TN,{open:H,onClose:()=>ie(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:Oe,dbPassword:Te})=>{t(_t=>({..._t,databaseUrl:Oe})),re(Te||"")}}),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:Oe=>t(Te=>({...Te,recordDir:Oe.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(hn,{variant:"secondary",onClick:()=>L("record"),disabled:i||w!==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:Oe=>t(Te=>({...Te,doneDir:Oe.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(hn,{variant:"secondary",onClick:()=>L("done"),disabled:i||w!==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:Oe=>t(Te=>({...Te,ffmpegPath:Oe.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(hn,{variant:"secondary",onClick:()=>L("ffmpeg"),disabled:i||w!==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(Na,{checked:!!e.autoAddToDownloadList,onChange:Oe=>t(Te=>({...Te,autoAddToDownloadList:Oe,autoStartAddedDownloads:Oe?Te.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),c.jsx(Na,{checked:!!e.autoStartAddedDownloads,onChange:Oe=>t(Te=>({...Te,autoStartAddedDownloads:Oe})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),c.jsx(Na,{checked:!!e.useChaturbateApi,onChange:Oe=>t(Te=>({...Te,useChaturbateApi:Oe})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),c.jsx(Na,{checked:!!e.useMyFreeCamsWatcher,onChange:Oe=>t(Te=>({...Te,useMyFreeCamsWatcher:Oe})),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(Na,{checked:!!e.autoDeleteSmallDownloads,onChange:Oe=>t(Te=>({...Te,autoDeleteSmallDownloads:Oe,autoDeleteSmallDownloadsBelowMB:Te.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:Oe=>t(Te=>({...Te,autoDeleteSmallDownloadsBelowMB:Number(Oe.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(Na,{checked:!!e.blurPreviews,onChange:Oe=>t(Te=>({...Te,blurPreviews:Oe})),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:Oe=>t(Te=>({...Te,teaserPlayback:Oe.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(Na,{checked:!!e.teaserAudio,onChange:Oe=>t(Te=>({...Te,teaserAudio:Oe})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(Na,{checked:!!e.enableNotifications,onChange:Oe=>t(Te=>({...Te,enableNotifications:Oe})),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:le})," GB"," · ","Resume ab"," ",c.jsx("span",{className:"tabular-nums",children:de})," ","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 M0(...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 Pg({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=HN[i];return c.jsx("span",{className:M0("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,w=f===0,S=f===n.length-1,A=!h.label&&!!h.icon;return c.jsxs("button",{type:"button",disabled:h.disabled,onClick:()=>t(h.id),"aria-pressed":g,className:M0("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!w&&"before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-gray-300 dark:before:bg-gray-700",w&&"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",A?`p-0 ${u.iconOnly}`:u.btn),title:typeof h.label=="string"?h.label:h.srLabel,children:[A&&h.srLabel?c.jsx("span",{className:"sr-only",children:h.srLabel}):null,h.icon?c.jsx("span",{className:M0("shrink-0",A?"":"-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 $N(...n){return n.filter(Boolean).join(" ")}function qN(){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 VN=m.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:w=72,ignoreSelector:S="[data-swipe-ignore]",snapMs:A=180,commitMs:C=180,tapIgnoreSelector:j="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:k,hotTargetSelector:B="[data-hot-target]",doubleTapMs:V=360,doubleTapMaxMovePx:W=48},H){const ie=m.useRef(null),Y=m.useRef(!1),G=m.useRef(0),O=m.useRef(null),re=m.useRef(0),E=m.useRef(null),R=m.useRef(null),ee=m.useRef(null),q=m.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[Q,ue]=m.useState(0),[se,$]=m.useState(null),[F,X]=m.useState(0),le=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),G.current=0,ie.current&&(ie.current.style.touchAction="pan-y"),X(A),ue(0),$(null),window.setTimeout(()=>X(0),A)},[A]),de=m.useCallback(async(Ne,Se)=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),ie.current&&(ie.current.style.touchAction="pan-y");const $e=ie.current?.offsetWidth||360;X(C),$(Ne==="right"?"right":"left");const Ct=Ne==="right"?$e+40:-($e+40);G.current=Ct,ue(Ct);let st;Se?st=Promise.resolve(Ne==="right"?u():l()).catch(()=>!1):st=Promise.resolve(!0);const gt=new Promise(We=>{window.setTimeout(We,C)}),[,He]=await Promise.all([gt,st]);return He===!1?(X(A),$(null),ue(0),window.setTimeout(()=>X(0),A),!1):!0},[C,l,u,A]),L=m.useCallback(()=>{R.current!=null&&(window.clearTimeout(R.current),R.current=null)},[]),pe=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),G.current=0,X(0),ue(0),$(null);try{const Ne=ie.current;Ne&&(Ne.style.touchAction="pan-y")}catch{}},[]),we=m.useCallback((Ne,Se)=>{const Ie=E.current,$e=ie.current;if(!Ie||!$e)return;const Ct=qN();if(!Ct)return;let st=typeof Ne=="number"?Ne:window.innerWidth/2,gt=typeof Se=="number"?Se:window.innerHeight/2;const He=B?E.current?.querySelector(B)??$e.querySelector(B):null;let We=st,Je=gt;if(He){const mn=He.getBoundingClientRect();We=mn.left+mn.width/2,Je=mn.top+mn.height/2}const et=We-st,mt=Je-gt,Mt=document.createElement("div");Mt.style.position="absolute",Mt.style.left=`${st}px`,Mt.style.top=`${gt}px`,Mt.style.transform="translate(-50%, -50%)",Mt.style.pointerEvents="none",Mt.style.willChange="transform, opacity",Mt.style.zIndex="2147483647",Mt.style.lineHeight="1",Mt.style.userSelect="none",Mt.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const fe=document.createElement("div");fe.style.width="30px",fe.style.height="30px",fe.style.color="#f59e0b",fe.style.display="block",Mt.appendChild(fe),Ct.appendChild(Mt);const qe=J_.createRoot(fe);qe.render(c.jsx(Bg,{className:"w-full h-full","aria-hidden":"true"})),Mt.getBoundingClientRect();const Le=200,Ce=500,Pe=400,Qe=Le+Ce+Pe,At=Le/Qe,Xt=(Le+Ce)/Qe,kt=Mt.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:At*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:At},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Xt},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${mt}px)) scale(0.85)`,opacity:.95,offset:Xt+(1-Xt)*.75},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${mt}px)) scale(0.55)`,opacity:0,offset:1}],{duration:Qe,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});He&&window.setTimeout(()=>{try{He.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+Ce+Math.round(Pe*.75)),kt.onfinish=()=>{try{qe.unmount()}catch{}Mt.remove()}},[B]);m.useEffect(()=>()=>{R.current!=null&&window.clearTimeout(R.current)},[]),m.useImperativeHandle(H,()=>({swipeLeft:Ne=>de("left",Ne?.runAction??!0),swipeRight:Ne=>de("right",Ne?.runAction??!0),reset:()=>le()}),[de,le]);const Be=Math.abs(Q),Ve=Q===0?null:Q>0?"right":"left",Oe=re.current||Math.min(f,(ie.current?.offsetWidth||360)*g),Te=Math.max(0,Math.min(1,Be/Math.max(1,Oe))),_t=Math.max(0,Math.min(1,Be/Math.max(1,Oe*1.35))),dt=Math.max(-6,Math.min(6,Q/28)),xe=Q===0?1:.995;return c.jsx("div",{ref:E,className:$N("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:ie,className:"relative",style:{transform:Q!==0?`translate3d(${Q}px,0,0) rotate(${dt}deg) scale(${xe})`:void 0,transition:F?`transform ${F}ms ease`:void 0,touchAction:"pan-y",willChange:Q!==0?"transform":void 0,borderRadius:Q!==0?"12px":void 0,filter:Q!==0?`saturate(${1+Te*.08}) brightness(${1+Te*.02})`:void 0},onPointerDown:Ne=>{if(!t||i)return;const Se=Ne.target;let Ie=!!(j&&Se?.closest?.(j));if(S&&Se?.closest?.(S))return;let $e=!1;const Ct=Ne.currentTarget,gt=Array.from(Ct.querySelectorAll("video")).find(mt=>mt.controls);if(gt){const mt=gt.getBoundingClientRect();if(Ne.clientX>=mt.left&&Ne.clientX<=mt.right&&Ne.clientY>=mt.top&&Ne.clientY<=mt.bottom)if(mt.bottom-Ne.clientY<=72)$e=!0,Ie=!0;else{const Ce=Ne.clientX-mt.left,Pe=mt.right-Ne.clientX;Ce<=64||Pe<=64||($e=!0,Ie=!0)}}const We=Ne.currentTarget.getBoundingClientRect().bottom-Ne.clientY;w&&We<=w&&($e=!0),q.current={id:Ne.pointerId,x:Ne.clientX,y:Ne.clientY,dragging:!1,captured:!1,tapIgnored:Ie,noSwipe:$e};const et=ie.current?.offsetWidth||360;re.current=Math.min(f,et*g),G.current=0},onPointerMove:Ne=>{if(!t||i||q.current.id!==Ne.pointerId||q.current.noSwipe)return;const Se=Ne.clientX-q.current.x,Ie=Ne.clientY-q.current.y;if(!q.current.dragging){if(Math.abs(Ie)>Math.abs(Se)&&Math.abs(Ie)>8){q.current.id=null;return}if(Math.abs(Se)<12)return;q.current.dragging=!0,Ne.currentTarget.style.touchAction="none",X(0);try{Ne.currentTarget.setPointerCapture(Ne.pointerId),q.current.captured=!0}catch{q.current.captured=!1}}const $e=(He,We)=>{const Je=We*.9,et=Math.abs(He);if(et<=Je)return He;const mt=et-Je,Mt=Je+mt*.25;return Math.sign(He)*Mt},Ct=ie.current?.offsetWidth||360;G.current=$e(Se,Ct),O.current==null&&(O.current=requestAnimationFrame(()=>{O.current=null,ue(G.current)}));const st=re.current,gt=Se>st?"right":Se<-st?"left":null;$(He=>{if(He===gt)return He;if(gt)try{navigator.vibrate?.(10)}catch{}return gt})},onPointerUp:Ne=>{if(!t||i||q.current.id!==Ne.pointerId)return;const Se=re.current||Math.min(f,(ie.current?.offsetWidth||360)*g),Ie=q.current.dragging,$e=q.current.captured,Ct=q.current.tapIgnored;if(q.current.id=null,q.current.dragging=!1,q.current.captured=!1,$e)try{Ne.currentTarget.releasePointerCapture(Ne.pointerId)}catch{}if(Ne.currentTarget.style.touchAction="pan-y",!Ie){const gt=Date.now(),He=ee.current,We=He&&Math.hypot(Ne.clientX-He.x,Ne.clientY-He.y)<=W;if(!!k&&He&>-He.t<=V&&We){if(ee.current=null,L(),Y.current)return;Y.current=!0;try{we(Ne.clientX,Ne.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await k?.()}finally{Y.current=!1}})()});return}if(Ct){ee.current={t:gt,x:Ne.clientX,y:Ne.clientY},L(),R.current=window.setTimeout(()=>{R.current=null,ee.current=null},k?V:0);return}pe(),ee.current={t:gt,x:Ne.clientX,y:Ne.clientY},L(),R.current=window.setTimeout(()=>{R.current=null,ee.current=null,a?.()},k?V:0);return}const st=G.current;O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),st>Se?de("right",!0):st<-Se?de("left",!0):le(),G.current=0},onPointerCancel:Ne=>{if(!(!t||i)){if(q.current.captured&&q.current.id!=null)try{Ne.currentTarget.releasePointerCapture(q.current.id)}catch{}q.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),G.current=0;try{Ne.currentTarget.style.touchAction="pan-y"}catch{}le()}},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:Q===0?0:.12+_t*.18,background:Ve==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":Ve==="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:se?1:0,boxShadow:se==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":se==="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=m.useRef(null),i=m.useRef(null),[a,l]=m.useState(!1),[u,h]=m.useState(null),f=m.useRef(null),g=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},w=()=>{g(),f.current=window.setTimeout(()=>{l(!1),f.current=null},150)},S=()=>{g(),l(!0)},A=()=>{w()},C=()=>{g(),l(!1)},j=()=>{const B=t.current,V=i.current;if(!B||!V)return;const W=8,H=8,ie=B.getBoundingClientRect(),Y=V.getBoundingClientRect();let G=ie.bottom+W;if(G+Y.height>window.innerHeight-H){const E=ie.top-Y.height-W;E>=H?G=E:G=Math.max(H,window.innerHeight-Y.height-H)}let re=ie.left;re+Y.width>window.innerWidth-H&&(re=window.innerWidth-Y.width-H),re=Math.max(H,re),h({left:re,top:G})};m.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>j());return()=>cancelAnimationFrame(B)},[a]),m.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>j());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),m.useEffect(()=>()=>g(),[]);const k=()=>typeof e=="function"?e(a,{close:C}):e;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:S,onMouseLeave:A,children:n}),a&&vu.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:A,children:c.jsx(Is,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:k()})}),document.body)]})}const Ef=!0,GN=!1;function cd(n,e){if(!n)return;const t=e?.muted??Ef;n.muted=t,n.defaultMuted=t,n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline","")}function B1(n){return(n||"").split(/[\\/]/).pop()||""}function wu({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:w,thumbSamples:S,clipSeconds:A=.75,clipCount:C=12,variant:j="thumb",className:k,showPopover:B=!0,blur:V=!1,inlineVideo:W=!1,inlineNonce:H=0,inlineControls:ie=!1,inlineLoop:Y=!0,assetNonce:G=0,muted:O=Ef,popoverMuted:re=Ef,noGenerateTeaser:E,alwaysLoadStill:R=!1,teaserPreloadEnabled:ee=!1,teaserPreloadRootMargin:q="700px 0px",scrubProgressRatio:Q,preferScrubProgress:ue=!1}){const se=B1(n.output||"")||e(n.output||""),$=V?"blur-md":"",F=m.useMemo(()=>{const De=n?.meta;if(!De)return null;if(typeof De=="string")try{return JSON.parse(De)}catch{return null}return De},[n]),[X,le]=m.useState(null),de=m.useRef(new Set),L=m.useMemo(()=>!F&&!X?null:F?X?{...F,...X}:F:X,[F,X]),pe=m.useMemo(()=>{let De=L?.previewClips;if(typeof De=="string"){const wt=De.trim();if(wt.length>0)try{const Nt=JSON.parse(wt);return Array.isArray(Nt)&&Nt.length>0,!0}catch{return!0}}if(Array.isArray(De)&&De.length>0)return!0;const vt=L?.preview?.clips;return!!(Array.isArray(vt)&&vt.length>0)},[L]),[we,Be]=m.useState(0),Ve=m.useMemo(()=>{let De=L?.previewClips;if(typeof De=="string")try{De=JSON.parse(De)}catch{De=null}!Array.isArray(De)&&Array.isArray(L?.preview?.clips)&&(De=L.preview.clips);const vt=De;if(!Array.isArray(vt)||vt.length===0)return null;let wt=0;const Nt=[];for(const Gt of vt){const Kt=Number(Gt?.startSeconds),sn=Number(Gt?.durationSeconds);if(!Number.isFinite(Kt)||Kt<0||!Number.isFinite(sn)||sn<=0)continue;const Mn=wt,Yn=wt+sn;Nt.push({start:Kt,dur:sn,cumStart:Mn,cumEnd:Yn}),wt=Yn}return Nt.length?Nt:null},[L]),Oe=m.useMemo(()=>Ve?Ve.map(De=>`${De.start.toFixed(3)}:${De.dur.toFixed(3)}`).join("|"):"",[Ve]),Te=(typeof F?.videoWidth=="number"&&Number.isFinite(F.videoWidth)&&F.videoWidth>0?F.videoWidth:void 0)??(typeof n.videoWidth=="number"&&Number.isFinite(n.videoWidth)&&n.videoWidth>0?n.videoWidth:void 0),_t=(typeof F?.videoHeight=="number"&&Number.isFinite(F.videoHeight)&&F.videoHeight>0?F.videoHeight:void 0)??(typeof n.videoHeight=="number"&&Number.isFinite(n.videoHeight)&&n.videoHeight>0?n.videoHeight:void 0),dt=(typeof F?.fileSize=="number"&&Number.isFinite(F.fileSize)&&F.fileSize>0?F.fileSize:void 0)??(typeof n.sizeBytes=="number"&&Number.isFinite(n.sizeBytes)&&n.sizeBytes>0?n.sizeBytes:void 0),xe=(typeof F?.fps=="number"&&Number.isFinite(F.fps)&&F.fps>0?F.fps:void 0)??(typeof n.fps=="number"&&Number.isFinite(n.fps)&&n.fps>0?n.fps:void 0),Ne=(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),Se=typeof Ne=="number"&&Number.isFinite(Ne)&&Ne>0?Ne>1440*60?Ne/1e3:Ne:void 0,Ie=typeof Se=="number"&&Number.isFinite(Se)&&Se>0,$e=typeof Te=="number"&&typeof _t=="number"&&Number.isFinite(Te)&&Number.isFinite(_t)&&Te>0&&_t>0,Ct={muted:O,playsInline:!0,preload:"metadata"},[st,gt]=m.useState(!0),[He,We]=m.useState(!0),[Je,et]=m.useState(!1),[mt,Mt]=m.useState(!1),[fe,qe]=m.useState(!0),Le=m.useRef(""),Ce=m.useRef(""),Pe=m.useRef(null),[Qe,At]=m.useState(!1),[Xt,kt]=m.useState(!1),[mn,It]=m.useState(!1),[$t,Ot]=m.useState(0),[en,Sn]=m.useState(!1),Pn=W===!0||W==="always"?"always":W==="hover"?"hover":"never",St=Pn==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",Tn=De=>De.startsWith("HOT ")?De.slice(4):De,tt=m.useMemo(()=>{const De=B1(n.output||"")||e(n.output||"");if(!De)return"";const vt=De.replace(/\.[^.]+$/,"");return Tn(vt).trim()},[n.output,e]),D=m.useMemo(()=>se?`/api/record/video?file=${encodeURIComponent(se)}`:"",[se]),P=j==="fill"?"w-full h-full":"w-20 h-16",ne=m.useRef(null),Re=m.useRef(null),Ge=m.useRef(null),yt=m.useRef({inline:null,teaser:null,clips:null}),tn=(De,vt)=>{vt&&yt.current[De]!==vt&&(yt.current[De]=vt,Be(wt=>wt+1))},[un,vn]=m.useState(0),[,cn]=m.useState(0),Cn=De=>De<0?0:De>1?1:De,xn=(De,vt,wt=A,Nt=!1)=>{if(!De)return{ratio:0,globalSec:0,vvDur:0};const Gt=Number(De.duration);if(!(Number.isFinite(Gt)&&Gt>0))return{ratio:0,globalSec:0,vvDur:0};const sn=Number(De.currentTime);if(!Number.isFinite(sn)||sn<0)return{ratio:0,globalSec:0,vvDur:Gt};const Mn=Ve;let Yn=0;if(Nt&&Array.isArray(Mn)&&Mn.length>0){const Wn=Mn[Mn.length-1];if(sn>=Wn.cumEnd)Yn=typeof vt=="number"&&Number.isFinite(vt)&&vt>0?vt:Wn.start+Wn.dur;else{let Wi=0,Hi=Mn.length-1,bi=0;for(;Wi<=Hi;){const ii=Wi+Hi>>1,Mi=Mn[ii];if(sn<Mi.cumStart)Hi=ii-1;else if(sn>=Mi.cumEnd)Wi=ii+1;else{bi=ii;break}}return Yn=Mn[bi].start,{ratio:Mn.length>0?Cn(bi/Mn.length):0,globalSec:Math.max(0,Yn),vvDur:Gt}}}return Number.isFinite(wt)&&wt>0?Yn=Math.floor(sn/wt)*wt:Yn=sn,{ratio:Cn(Math.min(Yn,Gt)/Gt),globalSec:Math.max(0,Yn),vvDur:Gt}},on=De=>{if(De){try{De.pause()}catch{}try{De.removeAttribute("src"),De.src="",De.load()}catch{}}};m.useEffect(()=>{Mt(!1),qe(!0),le(null),Le.current="",Ce.current="",et(!1)},[tt,G,E]),m.useEffect(()=>{const De=vt=>{const wt=String(vt?.detail?.file??"");!wt||wt!==se||(on(ne.current),on(Re.current),on(Ge.current))};return window.addEventListener("player:release",De),window.addEventListener("player:close",De),()=>{window.removeEventListener("player:release",De),window.removeEventListener("player:close",De)}},[se]),m.useEffect(()=>{const De=Pe.current;if(!De)return;const vt=new IntersectionObserver(wt=>{const Nt=!!wt[0]?.isIntersecting;At(Nt),Nt&&It(!0)},{threshold:.01,rootMargin:"0px"});return vt.observe(De),()=>vt.disconnect()},[]),m.useEffect(()=>{const De=Pe.current;if(!De)return;if(!ee){kt(Qe);return}let vt=!0;const wt=new IntersectionObserver(Nt=>{Nt[0]?.isIntersecting&&(kt(!0),vt&&(vt=!1,wt.disconnect()))},{threshold:0,rootMargin:q});return wt.observe(De),()=>wt.disconnect()},[ee,q,Qe]),m.useEffect(()=>{if(!l||u!=="frames"||!Qe||document.hidden)return;const De=window.setInterval(()=>Ot(vt=>vt+1),f);return()=>window.clearInterval(De)},[l,u,Qe,f]);const Rn=m.useMemo(()=>{if(!l||u!=="frames"||!Ie)return null;const De=Se,vt=Math.max(.25,g??3);if(w){const Gt=Math.max(4,Math.min(S??16,Math.floor(De))),Kt=$t%Gt,sn=Math.max(.1,De-vt),Mn=Math.min(.25,sn*.02),Yn=Kt/Gt*sn+Mn;return Math.min(De-.05,Math.max(.05,Yn))}const wt=Math.max(De-.1,vt),Nt=$t*vt%wt;return Math.min(De-.05,Math.max(.05,Nt))},[l,u,Ie,Se,$t,g,w,S]),qt=G??0,Bt=m.useMemo(()=>tt?Rn==null?`/api/preview?id=${encodeURIComponent(tt)}&v=${qt}`:`/api/preview?id=${encodeURIComponent(tt)}&t=${Rn}&v=${qt}`:"",[tt,Rn,qt]),Zt=m.useMemo(()=>{if(!tt)return"";const De=E?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(tt)}${De}&v=${qt}`},[tt,qt,E]),zt=Pn!=="never"&&Qe&&He&&(Pn==="always"||Pn==="hover"&&en),Pt=l&&Qe&&!document.hidden&&He&&!zt&&(h==="always"||en)&&(u==="teaser"&&fe&&!!Zt||u==="clips"&&Ie),Nn=Ie&&typeof Se=="number"?Se:void 0,Ft=R||Qe||mn||St&&en,Qn=Xt||Qe||mn||St&&en;m.useEffect(()=>{let De=!1;if(i&&Ie){const vt=Number(Se),wt=`${se}|dur|${vt}`;Le.current!==wt&&(Le.current=wt,i(n,vt),De=!0)}if(a&&$e){const vt=Number(Te),wt=Number(_t),Nt=`${se}|res|${vt}x${wt}`;Ce.current!==Nt&&(Ce.current=Nt,a(n,vt,wt),De=!0)}De&&et(!0)},[se,n,i,a,Ie,$e,Se,Te,_t]),m.useEffect(()=>{if(!tt||!se||!l||u!=="teaser"||!Qn||pe||de.current.has(se))return;let De=!1;const vt=new AbortController,wt=async Nt=>{try{const Gt=await fetch(Nt,{signal:vt.signal,cache:"no-store",credentials:"include"});return Gt.ok?await Gt.json():null}catch{return null}};return(async()=>{const Nt=await wt(`/api/record/done/meta?file=${encodeURIComponent(se)}`);De||(de.current.add(se),Nt&&le(Nt))})(),()=>{De=!0,vt.abort()}},[tt,se,l,u,Qn,pe]);const Xn=De=>{et(!0);const vt=De.currentTarget;if(i&&!Ie){const wt=Number(vt.duration);if(Number.isFinite(wt)&&wt>0){const Nt=`${se}|dur|${wt}`;Le.current!==Nt&&(Le.current=Nt,i(n,wt))}}if(a&&!$e){const wt=Number(vt.videoWidth),Nt=Number(vt.videoHeight);if(Number.isFinite(wt)&&Number.isFinite(Nt)&&wt>0&&Nt>0){const Gt=`${se}|res|${wt}x${Nt}`;Ce.current!==Gt&&(Ce.current=Gt,a(n,wt,Nt))}}};if(m.useEffect(()=>{gt(!0),We(!0),yt.current.inline=null,yt.current.teaser=null,yt.current.clips=null},[tt,G]),!D)return c.jsx("div",{className:[P,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Gn=Qn,ln=l&&u==="teaser"&&fe&&!!Zt&&!zt&&Qn,Zn=zt?ne:!zt&&Pt&&u==="teaser"?Re:!zt&&Pt&&u==="clips"?Ge:null,ti=!!Zn&&Qe,jn=zt?"inline":Pt&&u==="teaser"?"teaser":"clips",Kn=l&&u==="frames"&&Ie&&typeof Rn=="number"&&Number.isFinite(Rn)&&Rn>=0,rn=Kn?Cn(Rn/Se):0,Di=!zt&&ue&&typeof Q=="number"&&Number.isFinite(Q),oi=Di?Cn(Q):ti?un:Kn?rn:0,di=!zt&&(Di||(ti||Kn)),Ci=m.useMemo(()=>{if(!Ie)return null;const De=Se;if(!(De>0))return null;let wt=L?.previewClips;if(typeof wt=="string")try{wt=JSON.parse(wt)}catch{wt=null}if(!Array.isArray(wt)||wt.length===0)return null;const Nt=wt.map(Gt=>({start:Number(Gt?.startSeconds),dur:Number(Gt?.durationSeconds)})).filter(Gt=>Number.isFinite(Gt.start)&&Gt.start>=0&&Number.isFinite(Gt.dur)&&Gt.dur>0);return Nt.length?Nt.map(Gt=>{const Kt=Cn(Gt.start/De),sn=Cn(Gt.dur/De);return{left:Kt,width:sn,start:Gt.start,dur:Gt.dur}}):null},[L,Ie,Se]),Fn=m.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Ie)return[];const De=Se,vt=Math.max(.25,A),wt=Math.max(8,Math.min(C??S??12,Math.floor(De))),Nt=Math.max(.1,De-vt),Gt=Math.min(.25,Nt*.02),Kt=[];for(let sn=0;sn<wt;sn++){const Mn=sn/wt*Nt+Gt;Kt.push(Math.min(De-.05,Math.max(.05,Mn)))}return Kt},[l,u,Ie,Se,S,A,C]),On=m.useMemo(()=>Fn.map(De=>De.toFixed(2)).join(","),[Fn]),$n=m.useRef(0),_e=m.useRef(0);m.useEffect(()=>{const De=Re.current;if(!De)return;if(!(Pt&&u==="teaser")){try{De.pause()}catch{}return}cd(De,{muted:O});const wt=De.play?.();wt&&typeof wt.catch=="function"&&wt.catch(()=>{})},[Pt,u,Zt,O]),m.useEffect(()=>{if(!ti){vn(0),cn(0);return}const De=Zn?.current??null;if(!De){vn(0),cn(0);return}let vt=!1,wt=null;const Nt=()=>{if(vt||!De.isConnected)return;const sn=jn==="teaser"&&Array.isArray(Ve)&&Ve.length>0,Mn=xn(De,Nn,A,sn);vn(Mn.ratio),cn(Mn.globalSec)};Nt(),wt=window.setInterval(Nt,100);const Gt=()=>Nt(),Kt=()=>Nt();return De.addEventListener("loadedmetadata",Gt),De.addEventListener("durationchange",Gt),De.addEventListener("timeupdate",Kt),()=>{vt=!0,wt!=null&&window.clearInterval(wt),De.removeEventListener("loadedmetadata",Gt),De.removeEventListener("durationchange",Gt),De.removeEventListener("timeupdate",Kt)}},[ti,Zn,Nn,Oe,jn,Ve,we]),m.useEffect(()=>{zt&&cd(ne.current,{muted:O})},[zt,O]),m.useEffect(()=>{const De=Ge.current;if(!De)return;if(!(Pt&&u==="clips")){Pt||De.pause();return}if(!Fn.length)return;$n.current=$n.current%Fn.length,_e.current=Fn[$n.current];const vt=()=>{try{De.currentTime=_e.current}catch{}const Gt=De.play();Gt&&typeof Gt.catch=="function"&&Gt.catch(()=>{})},wt=()=>vt(),Nt=()=>{if(Fn.length&&De.currentTime-_e.current>=A){$n.current=($n.current+1)%Fn.length,_e.current=Fn[$n.current];try{De.currentTime=_e.current+.01}catch{}}};return De.addEventListener("loadedmetadata",wt),De.addEventListener("timeupdate",Nt),De.readyState>=1&&vt(),()=>{De.removeEventListener("loadedmetadata",wt),De.removeEventListener("timeupdate",Nt),De.pause()}},[Pt,u,On,A,Fn]);const nt=(Xt||Qe)&&(i||a)&&!Je&&!zt&&(i&&!Ie||a&&!$e),ht=!!Ci&&(jn==="teaser"||!zt&&Di&&u==="teaser"),Ht=c.jsxs("div",{ref:Pe,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",P,k??""].join(" "),onMouseEnter:St?()=>Sn(!0):void 0,onMouseLeave:St?()=>Sn(!1):void 0,onFocus:St?()=>Sn(!0):void 0,onBlur:St?()=>Sn(!1):void 0,"data-duration":Ie?String(Se):void 0,"data-res":$e?`${Te}x${_t}`:void 0,"data-size":typeof dt=="number"?String(dt):void 0,"data-fps":typeof xe=="number"?String(xe):void 0,children:[Ft&&Bt&&st?c.jsx("img",{src:Bt,loading:R?"eager":"lazy",decoding:"async",alt:se,className:["absolute inset-0 w-full h-full object-cover",$].filter(Boolean).join(" "),onError:()=>gt(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),zt?m.createElement("video",{...Ct,ref:De=>{ne.current=De,tn("inline",De)},key:`inline-${tt}-${H}`,src:D,className:["absolute inset-0 w-full h-full object-cover",$,ie?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:O,controls:ie,loop:Y,poster:Gn&&Bt||void 0,onLoadedMetadata:Xn,onError:()=>We(!1)}):null,!zt&&ln&&!(Pt&&u==="teaser")?c.jsx("video",{src:Zt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>Mt(!0),onCanPlay:()=>Mt(!0),onError:()=>{qe(!1),Mt(!1)}},`teaser-prewarm-${tt}`):null,!zt&&Pt&&u==="teaser"?c.jsx("video",{ref:De=>{Re.current=De,tn("teaser",De)},src:Zt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",$,mt?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:O,playsInline:!0,autoPlay:!0,loop:!0,preload:mt?"auto":"metadata",poster:Gn&&Bt||void 0,onLoadedData:()=>Mt(!0),onPlaying:()=>Mt(!0),onError:()=>{qe(!1),Mt(!1)}},`teaser-mp4-${tt}`):null,!zt&&Pt&&u==="clips"?c.jsx("video",{ref:De=>{Ge.current=De,tn("clips",De)},src:D,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",$].filter(Boolean).join(" "),muted:O,playsInline:!0,preload:"metadata",poster:Gn&&Bt||void 0,onError:()=>We(!1)},`clips-${tt}-${On}`):null,di?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:[ht?c.jsx("div",{className:"absolute inset-0",children:Ci.map((De,vt)=>c.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${De.left*100}%`,width:`${De.width*100}%`}},`seg-${vt}-${De.left.toFixed(6)}-${De.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(${Cn(oi)})`,background:"rgba(99,102,241,0.95)"}})]}):null,nt?c.jsx("video",{src:D,preload:"metadata",muted:O,playsInline:!0,className:"hidden",onLoadedMetadata:Xn}):null]});return B?c.jsx(Ow,{content:De=>De&&c.jsx("div",{className:"w-[420px]",children:c.jsx("div",{className:"aspect-video",children:c.jsx("video",{src:D,className:["w-full h-full bg-black",$].filter(Boolean).join(" "),muted:re,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:vt=>vt.stopPropagation(),onMouseDown:vt=>vt.stopPropagation()})})}),children:Ht}):Ht}function Bn(...n){return n.filter(Boolean).join(" ")}const KN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",WN=n=>n.startsWith("HOT ")?n.slice(4):n,XN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function YN(n){const t=WN(KN(n||"")).replace(/\.[^.]+$/,""),i=t.match(XN);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function Bs({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:w,onToggleLike:S,onToggleHot:A,onKeep:C,onDelete:j,onToggleWatch:k,onAddToDownloads:B,order:V,className:W}){const H=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",ie=l?"size-4":"size-5",Y="h-full w-full",G=e==="table"?`inline-flex items-center justify-center rounded-md ${H} 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 ${H} 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`,O=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"},re=V??["watch","favorite","like","hot","keep","delete","details"],E=tt=>re.includes(tt),R=String(n?.sourceUrl??"").trim(),ee=YN(n.output||""),q=ee?`Mehr zu ${ee} anzeigen`:"Mehr anzeigen",Q=E("favorite"),ue=E("like"),se=E("hot"),$=E("watch"),F=E("keep"),X=E("delete"),le=E("details")&&!!ee,de=E("add"),[L,pe]=m.useState("idle"),we=m.useRef(null);m.useEffect(()=>()=>{we.current&&window.clearTimeout(we.current)},[]);const Be=()=>{pe("ok"),we.current&&window.clearTimeout(we.current),we.current=window.setTimeout(()=>pe("idle"),800)},Ve=async()=>{if(a||L==="busy"||!B&&!!!R)return!1;pe("busy");try{let D=!0;return B?D=await B(n)!==!1:R?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:R}})),D=!0):D=!1,D?Be():pe("idle"),D}catch{return pe("idle"),!1}},[Oe,Te]=m.useState(0),[_t,dt]=m.useState(4),xe=tt=>D=>{D.preventDefault(),D.stopPropagation(),!(a||!tt)&&Promise.resolve(tt(n)).catch(()=>{})},Ne=le?c.jsxs("button",{type:"button",className:Bn(G),title:q,"aria-label":q,disabled:a,onClick:tt=>{tt.preventDefault(),tt.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:ee}}))},children:[c.jsx("span",{className:Bn("inline-flex items-center justify-center",ie),children:c.jsx(O1,{className:Bn(Y,O.off)})}),c.jsx("span",{className:"sr-only",children:q})]}):null,Se=de?c.jsxs("button",{type:"button",className:Bn(G),title:R?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||L==="busy"||!B&&!R,onClick:async tt=>{tt.preventDefault(),tt.stopPropagation(),await Ve()},children:[c.jsx("span",{className:Bn("inline-flex items-center justify-center",ie),children:L==="ok"?c.jsx(jw,{className:Bn(Y,"text-emerald-600 dark:text-emerald-300")}):c.jsx(M1,{className:Bn(Y,O.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Ie=Q?c.jsx("button",{type:"button",className:G,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!w,onClick:xe(w),children:c.jsxs("span",{className:Bn("relative inline-block",ie),children:[c.jsx(Sf,{className:Bn("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",Y,O.off)}),c.jsx(_u,{className:Bn("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",Y,O.favOn)})]})}):null,$e=ue?c.jsx("button",{type:"button",className:G,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:xe(S),children:c.jsxs("span",{className:Bn("relative inline-block",ie),children:[c.jsx(td,{className:Bn("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",Y,O.off)}),c.jsx(bl,{className:Bn("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",Y,O.likeOn)})]})}):null,Ct=se?c.jsx("button",{type:"button","data-hot-target":!0,className:G,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!A,onClick:xe(A),children:c.jsxs("span",{className:Bn("relative inline-block",ie),children:[c.jsx(j1,{className:Bn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Y,O.off)}),c.jsx(Bg,{className:Bn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Y,O.hotOn)})]})}):null,st=$?c.jsx("button",{type:"button",className:G,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!k,onClick:xe(k),children:c.jsxs("span",{className:Bn("relative inline-block",ie),children:[c.jsx(wf,{className:Bn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Y,O.off)}),c.jsx(yl,{className:Bn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Y,O.watchOn)})]})}):null,gt=F?c.jsx("button",{type:"button",className:G,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!C,onClick:xe(C),children:c.jsx("span",{className:Bn("inline-flex items-center justify-center",ie),children:c.jsx(R1,{className:Bn(Y,O.keep)})})}):null,He=X?c.jsx("button",{type:"button",className:G,title:"Löschen","aria-label":"Löschen",disabled:a||!j,onClick:xe(j),children:c.jsx("span",{className:Bn("inline-flex items-center justify-center",ie),children:c.jsx(L1,{className:Bn(Y,O.del)})})}):null,We={details:Ne,add:Se,favorite:Ie,like:$e,watch:st,hot:Ct,keep:gt,delete:He},Je=t,et=re.filter(tt=>!!We[tt]),mt=Je&&typeof i!="number",qe=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Le=l?2:3,Ce=m.useMemo(()=>{if(!mt)return i??Le;const tt=Oe||0;if(tt<=0)return Math.min(et.length,Le);for(let D=et.length;D>=0;D--)if(D*qe+qe+(D>0?D*_t:0)<=tt)return D;return 0},[mt,i,Le,Oe,et.length,qe,_t]),Pe=Je?et.slice(0,Ce):et,Qe=Je?et.slice(Ce):[],[At,Xt]=m.useState(!1),kt=m.useRef(null);m.useLayoutEffect(()=>{const tt=kt.current;if(!tt||typeof window>"u")return;const D=()=>{const ne=kt.current;if(!ne)return;const Re=Math.floor(ne.getBoundingClientRect().width||0);Re>0&&Te(Re);const Ge=window.getComputedStyle(ne),yt=Ge.columnGap||Ge.gap||"0",tn=parseFloat(yt);Number.isFinite(tn)&&tn>=0&&dt(tn)};D();const P=new ResizeObserver(()=>D());return P.observe(tt),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D),P.disconnect()}},[]);const mn=m.useRef(null),It=m.useRef(null),$t=208,Ot=4,en=8,[Sn,Pn]=m.useState(null);m.useEffect(()=>{if(!At)return;const tt=P=>{P.key==="Escape"&&Xt(!1)},D=P=>{const ne=kt.current,Re=It.current,Ge=P.target;ne&&ne.contains(Ge)||Re&&Re.contains(Ge)||Xt(!1)};return window.addEventListener("keydown",tt),window.addEventListener("mousedown",D),()=>{window.removeEventListener("keydown",tt),window.removeEventListener("mousedown",D)}},[At]),m.useLayoutEffect(()=>{if(!At){Pn(null);return}const tt=()=>{const D=mn.current;if(!D)return;const P=D.getBoundingClientRect(),ne=window.innerWidth,Re=window.innerHeight;let Ge=P.right-$t;Ge=Math.max(en,Math.min(Ge,ne-$t-en));let yt=P.bottom+Ot;yt=Math.max(en,Math.min(yt,Re-en));const tn=Math.max(120,Re-yt-en);Pn({top:yt,left:Ge,maxH:tn})};return tt(),window.addEventListener("resize",tt),window.addEventListener("scroll",tt,!0),()=>{window.removeEventListener("resize",tt),window.removeEventListener("scroll",tt,!0)}},[At]);const St=()=>{ee&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:ee}}))},Tn=tt=>tt==="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:D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),St()},children:[c.jsx(O1,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):tt==="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&&!R,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await Ve()},children:[c.jsx(M1,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):tt==="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||!w,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await w?.(n)},children:[h?c.jsx(_u,{className:Bn("size-4",O.favOn)}):c.jsx(Sf,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):tt==="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 D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await S?.(n)},children:[f?c.jsx(bl,{className:Bn("size-4",O.favOn)}):c.jsx(td,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):tt==="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||!k,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await k?.(n)},children:[g?c.jsx(yl,{className:Bn("size-4",O.favOn)}):c.jsx(wf,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):tt==="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||!A,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await A?.(n)},children:[u?c.jsx(Bg,{className:Bn("size-4",O.favOn)}):c.jsx(j1,{className:Bn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:u?"HOT entfernen":"Als HOT markieren"})]},"hot"):tt==="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||!C,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await C?.(n)},children:[c.jsx(R1,{className:Bn("size-4",O.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):tt==="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||!j,onClick:async D=>{D.preventDefault(),D.stopPropagation(),Xt(!1),await j?.(n)},children:[c.jsx(L1,{className:Bn("size-4",O.del)}),c.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return c.jsxs("div",{ref:kt,className:Bn("relative flex items-center flex-nowrap",W??"gap-2"),children:[Pe.map(tt=>{const D=We[tt];return D?c.jsx(m.Fragment,{children:D},tt):null}),Je&&Qe.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:mn,type:"button",className:G,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":At,disabled:a,onClick:tt=>{tt.preventDefault(),tt.stopPropagation(),!a&&Xt(D=>!D)},children:c.jsx("span",{className:Bn("inline-flex items-center justify-center",ie),children:c.jsx(VA,{className:Bn(Y,O.off)})})}),At&&Sn&&typeof document<"u"?vu.createPortal(c.jsx("div",{ref:It,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:Sn.top,left:Sn.left,width:$t,maxHeight:Sn.maxH},onClick:tt=>tt.stopPropagation(),children:Qe.map(Tn)}),document.body):null]}):null]})}function ws({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=gn("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"),A=gn(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),C=k=>k.stopPropagation(),j=h?{onPointerDown:C,onMouseDown:C}:{};return a?c.jsx("button",{type:"button",className:A,title:t??f,"aria-pressed":!!i,...j,onClick:k=>{h&&(k.preventDefault(),k.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:A,title:t??f,...j,onClick:h?C: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,w]=m.useState(!1),S=m.useRef(null),A=m.useRef(null),C=m.useRef(null);m.useEffect(()=>w(!1),[n]),m.useEffect(()=>{if(!g)return;const O=re=>{re.key==="Escape"&&w(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[g]);const j=m.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),k=m.useMemo(()=>[...e].sort((O,re)=>O.localeCompare(re,void 0,{sensitivity:"base"})),[e]),[B,V]=m.useState(()=>{const O=Math.min(k.length,j);return Math.min(O,6)}),W=m.useCallback(()=>{const O=S.current,re=A.current;if(!O||!re)return;const E=Math.floor(O.getBoundingClientRect().width);if(E<=0)return;const R=Math.min(k.length,j);if(R<=0){V(0);return}const q=Array.from(re.children).map(F=>F.offsetWidth).slice(0,R),Q=C.current?.offsetWidth??0,ue=2,se=F=>{let X=0,le=0;for(let de=0;de<q.length;de++){const L=q[de]+(le>0?h:0);if(X+L<=F-ue)X+=L,le++;else break}return le};let $=se(E);if($<R){const F=Q>0?Q+h:0,X=Math.max(0,E-F);$=se(X),$=Math.max(0,$)}V(Math.max(0,Math.min($,R)))},[k,j,h]);m.useLayoutEffect(()=>{W()},[W,k.join("\0"),u,j]),m.useEffect(()=>{const O=S.current;if(!O)return;const re=new ResizeObserver(()=>W());return re.observe(O),()=>re.disconnect()},[W]);const H=Math.min(k.length,j),ie=k.slice(0,Math.min(B,H)),Y=O=>O.stopPropagation(),G=k.length-ie.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:Y,onMouseDown:Y,onPointerDown:Y,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:ie.length>0?ie.map(O=>c.jsx(ws,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O)):c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"})})}),G>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:O=>{O.preventDefault(),O.stopPropagation(),w(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",G]}):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:Y,onMouseDown:Y,onPointerDown:Y,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:()=>w(!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:k.map(O=>c.jsx(ws,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))})})]}):null,c.jsxs("div",{className:"absolute -left-[9999px] -top-[9999px] opacity-0 pointer-events-none",children:[c.jsx("div",{ref:A,className:"flex flex-nowrap items-center gap-1.5",children:k.slice(0,H).map(O=>c.jsx(ws,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))}),c.jsx("button",{ref:C,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 P1(n,e,t){return Math.max(e,Math.min(t,n))}function QN(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 xy({imageCount:n,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:a,stepSeconds:l=0}){const u=m.useRef(null),h=m.useRef(null),f=m.useRef(void 0),g=m.useCallback(()=>{h.current=null,t(f.current)},[t]),w=m.useCallback(Y=>{f.current=Y,h.current==null&&(h.current=window.requestAnimationFrame(g))},[g]);m.useEffect(()=>()=>{h.current!=null&&(window.cancelAnimationFrame(h.current),h.current=null)},[]);const S=m.useCallback(Y=>{if(!u.current||n<1)return;const G=u.current.getBoundingClientRect();if(G.width<=0)return;const O=Y-G.left,re=P1(O/G.width,0,.999999);return P1(Math.floor(re*n),0,n-1)},[n]),A=m.useCallback(Y=>{const G=S(Y.clientX);w(G)},[S,w]),C=m.useCallback(Y=>{const G=S(Y.clientX);w(G)},[S,w]),j=m.useCallback(()=>{w(void 0)},[w]),k=m.useCallback(Y=>{Y.stopPropagation();const G=S(Y.clientX);w(G);try{Y.currentTarget.setPointerCapture?.(Y.pointerId)}catch{}},[S,w]),B=m.useCallback(Y=>{if(Y.stopPropagation(),!i)return;const G=S(Y.clientX);typeof G=="number"&&i(G)},[S,i]);if(!n||n<1)return null;const V=typeof e=="number"?(e+.5)/n*100:void 0,W=typeof e=="number"?l>0?QN(e*l):`${e+1}/${n}`:"",H=typeof e=="number",ie=typeof V=="number"?{left:`clamp(24px, ${V}%, 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:A,onPointerEnter:C,onPointerLeave:j,onPointerDown:k,onMouseDown:Y=>Y.stopPropagation(),onClick:B,title:H?W:`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 V=="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:`${V}%`,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",H?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:ie,children:W})]})}const Lw=/^HOT[ \u00A0]+/i,Iw=n=>String(n||"").replaceAll(" "," "),uu=n=>Lw.test(Iw(n)),Wr=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 ZN=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 JN(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function R0(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function F1(n,e,t){return Math.max(e,Math.min(t,n))}const e3=5;function t3(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,w=Math.abs(g-e);(f<a||f===a&&w<l||f===a&&w===l&&h<i)&&(a=f,l=w,t=u,i=h)}return[t,i]}function n3({blurred:n,animateUnblurOnMount:e,children:t}){const[i,a]=m.useState(!e);m.useEffect(()=>{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 i3({animateOnMount:n,children:e}){const[t,i]=m.useState(!n);return m.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 r3({rows:n,isSmall:e,isLoading:t,teaserPlayback:i,teaserAudio:a,hoverTeaserKey:l,blurPreviews:u,durations:h,teaserKey:f,inlinePlay:g,deletingKeys:w,keepingKeys:S,removingKeys:A,swipeRefs:C,assetNonce:j,handleScrubberClickIndex:k,keyFor:B,baseName:V,modelNameFromOutput:W,runtimeOf:H,sizeBytesOf:ie,formatBytes:Y,lower:G,onHoverPreviewKeyChange:O,onOpenPlayer:re,openPlayer:E,startInlineAt:R,startInline:ee,tryAutoplayInline:q,registerTeaserHost:Q,handleDuration:ue,deleteVideo:se,keepVideo:$,modelsByKey:F,activeTagSet:X,onToggleTagFilter:le,onToggleHot:de,onToggleFavorite:L,onToggleLike:pe,onToggleWatch:we,enqueueDeleteVideo:Be,enqueueKeepVideo:Ve,enqueueToggleHot:Oe}){const Te=m.useCallback(Le=>{const Ce=Le?.meta;if(!Ce)return null;if(typeof Ce=="string")try{return JSON.parse(Ce)}catch{return null}return Ce},[]),_t=m.useCallback(Le=>{const Ce=Te(Le),Pe=(typeof Ce?.videoWidth=="number"&&Number.isFinite(Ce.videoWidth)?Ce.videoWidth:0)||(typeof Le.videoWidth=="number"&&Number.isFinite(Le.videoWidth)?Le.videoWidth:0),Qe=(typeof Ce?.videoHeight=="number"&&Number.isFinite(Ce.videoHeight)?Ce.videoHeight:0)||(typeof Le.videoHeight=="number"&&Number.isFinite(Le.videoHeight)?Le.videoHeight:0);return Pe>0&&Qe>0?{w:Pe,h:Qe}:null},[Te]),dt=m.useCallback(Le=>{const Ce=Te(Le);let Pe=Ce?.previewSprite??Ce?.preview?.sprite??Ce?.sprite??Le?.previewSprite??Le?.preview?.sprite??null;if(typeof Pe=="string")try{Pe=JSON.parse(Pe)}catch{Pe=null}const Qe=Number(Pe?.count??Pe?.frames??Pe?.imageCount),At=Number(Pe?.stepSeconds??Pe?.step??Pe?.intervalSeconds);if(Number.isFinite(Qe)&&Qe>=2)return{count:Math.max(2,Math.floor(Qe)),stepSeconds:Number.isFinite(At)&&At>0?At:5};const Xt=B(Le),kt=h[Xt]??(typeof Le?.durationSeconds=="number"?Le.durationSeconds:void 0);return typeof kt=="number"&&Number.isFinite(kt)&&kt>1?{count:Math.max(2,Math.min(240,Math.floor(kt/5)+1)),stepSeconds:5}:null},[Te,B,h]),[xe,Ne]=m.useState({}),[Se,Ie]=m.useState({}),[$e,Ct]=m.useState(null),st=m.useCallback((Le,Ce)=>{Ne(Pe=>{if(Ce===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ce?Pe:{...Pe,[Le]:Ce}})},[]),gt=m.useCallback(Le=>{st(Le,void 0)},[st]),He=m.useCallback((Le,Ce)=>{Ie(Pe=>{if(Ce===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ce?Pe:{...Pe,[Le]:Ce}})},[]),We=(Le,Ce)=>{const Pe=B(Le),Qe=g?.key===Pe,At=Ce?.disableInline?!1:Qe,kt=!(!Ce?.forceStill&&!!a&&(At||l===Pe)),mn=At?g?.nonce??0:0,It=!!Ce?.forceLoadStill,$t=Ce?.forceStill?!1:Ce?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Pe:!1,Ot=w.has(Pe)||S.has(Pe)||A.has(Pe),en=W(Le.output),Sn=V(Le.output||""),Pn=Wr(Sn.replace(/\.[^.]+$/,"")).trim(),St=G(en),Tn=F[St],tt=Te(Le),D=dt(Le),P=xe[Pe],ne=Se[Pe]===!0,Re=JN(tt?.previewSprite?.path,tt?.previewSpritePath,Tn?.previewScrubberPath,Pn?`/api/preview-sprite/${encodeURIComponent(Pn)}`:void 0),Ge=Re?Re.replace(/\/+$/,""):void 0,yt=tt?.previewSprite?.stepSeconds??tt?.previewSpriteStepSeconds,tn=typeof yt=="number"&&Number.isFinite(yt)&&yt>0?yt:D?.stepSeconds&&D.stepSeconds>0?D.stepSeconds:e3,un=R0(tt?.durationSeconds)??R0(Le?.durationSeconds)??R0(h[Pe]),vn=typeof un=="number"&&un>0?Math.max(1,Math.min(200,Math.floor(un/tn)+1)):void 0,cn=tt?.previewSprite?.count??tt?.previewSpriteCount??Tn?.previewScrubberCount??vn,Cn=tt?.previewSprite?.cols??tt?.previewSpriteCols,xn=tt?.previewSprite?.rows??tt?.previewSpriteRows,on=typeof cn=="number"&&Number.isFinite(cn)?Math.max(0,Math.floor(cn)):0,[Rn,qt]=on>1?t3(on):[0,0],Bt=Number(Cn),Zt=Number(xn),zt=Number.isFinite(Bt)&&Number.isFinite(Zt)&&Bt>0&&Zt>0&&!(on>1&&Bt===1&&Zt===1)&&(on<=1||Bt*Zt>=on),Pt=zt?Math.floor(Bt):Rn,Nn=zt?Math.floor(Zt):qt,Ft=(typeof tt?.updatedAtUnix=="number"&&Number.isFinite(tt.updatedAtUnix)?tt.updatedAtUnix:void 0)??(typeof tt?.fileModUnix=="number"&&Number.isFinite(tt.fileModUnix)?tt.fileModUnix:void 0)??j??0,Qn=Ge&&Ft?`${Ge}?v=${encodeURIComponent(String(Ft))}`:Ge||void 0,Xn=!!Qn&&on>1,Gn=Xn&&Pt>0&&Nn>0,ln=Xn?on:0,Zn=Xn?tn:0,ti=typeof P=="number"&&ln>1?F1(P/(ln-1),0,1):void 0,jn=Gn&&typeof P=="number"?(()=>{const ht=F1(P,0,Math.max(0,on-1)),Ht=ht%Pt,De=Math.floor(ht/Pt),vt=Pt<=1?0:Ht/(Pt-1)*100,wt=Nn<=1?0:De/(Nn-1)*100;return{backgroundImage:`url("${Qn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Pt*100}% ${Nn*100}%`,backgroundPosition:`${vt}% ${wt}%`}})():void 0,Kn=uu(Sn),rn=!!Tn?.favorite,Di=Tn?.liked===!0,oi=!!Tn?.watching,ni=ZN(Tn?.tags),di=H(Le),Ci=Y(ie(Le)),Fn=_t(Le),On=hd(Fn),$n=`inline-prev-${encodeURIComponent(Pe)}`,_e=["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",Ot&&"pointer-events-none opacity-70",w.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",A.has(Pe)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),nt=c.jsx("div",{role:"button",tabIndex:0,className:_e,onClick:e?void 0:()=>E(Le),onKeyDown:ht=>{(ht.key==="Enter"||ht.key===" ")&&(ht.preventDefault(),re(Le))},children:c.jsx(n3,{blurred:Ce?.blur,animateUnblurOnMount:Ce?.animateUnblurOnMount,children:c.jsxs(Is,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:$n,ref:Ce?.disableInline||Ce?.isDecorative?void 0:Q(Pe),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||Ce?.disablePreviewHover?void 0:()=>{Ct(Pe),O?.(Pe)},onMouseLeave:()=>{!e&&!Ce?.disablePreviewHover&&O?.(null),Ct(ht=>ht===Pe?null:ht),gt(Pe),He(Pe,!1)},onClick:ht=>{ht.preventDefault(),ht.stopPropagation(),!(e||Ce?.disableInline)&&ee(Pe)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[At?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 "+(At?"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:[di,Fn?`${Fn.w}×${Fn.h}`:On||"",Ci].filter(Boolean).join(" • "),children:[c.jsx("span",{children:di}),On?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,On?c.jsx("span",{children:On}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Ci})]})}),c.jsx(wu,{job:Le,getFileName:ht=>Wr(V(ht)),className:"h-full w-full",variant:"fill",durationSeconds:h[Pe]??Le?.durationSeconds,onDuration:ue,showPopover:!1,blur:At?!1:!!u,animated:$t,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!Ce?.disableInline&&At?"always":!1,inlineNonce:mn,inlineControls:At,inlineLoop:!1,muted:kt,popoverMuted:kt,assetNonce:j??0,alwaysLoadStill:It,teaserPreloadEnabled:Ce?.mobileStackTopOnlyVideo||Ce?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:Ce?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:ti,preferScrubProgress:ne&&typeof P=="number"}),Gn&&Qn?c.jsx("img",{src:Qn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Gn&&jn&&!At?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,!Ce?.isDecorative&&!Ce?.disableScrubber&&!At&&ln>1&&$e===Pe?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:ht=>ht.stopPropagation(),onMouseDown:ht=>ht.stopPropagation(),onMouseEnter:()=>He(Pe,!0),onMouseLeave:()=>{He(Pe,!1),st(Pe,void 0)},children:c.jsx(xy,{className:"pointer-events-auto px-1",imageCount:ln,activeIndex:P,onActiveIndexChange:ht=>st(Pe,ht),onIndexClick:ht=>{if(e||Ce?.disableInline){k(Le,ht,ln);return}const Ht=Zn>0?ht*Zn:0;if(R){R(Pe,Ht,$n),requestAnimationFrame(()=>{q($n)||requestAnimationFrame(()=>q($n))});return}ee(Pe),requestAnimationFrame(()=>{q($n)||requestAnimationFrame(()=>q($n))})},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:en}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Kn?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:Wr(Sn)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[oi?c.jsx(yl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Di?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,rn?c.jsx(_u,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:ht=>ht.stopPropagation(),onMouseDown:ht=>ht.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(Bs,{job:Le,variant:"table",busy:Ot,collapseToMenu:!0,compact:!1,isHot:Kn,isFavorite:rn,isLiked:Di,isWatching:oi,onToggleWatch:we,onToggleFavorite:L,onToggleLike:pe,onToggleHot:de,onKeep:$,onDelete:se,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:ht=>ht.stopPropagation(),onMouseDown:ht=>ht.stopPropagation(),children:c.jsx(dd,{rowKey:Pe,tags:ni,activeTagSet:X,lower:G,onToggleTagFilter:le})})]})]})})});return{k:Pe,j:Le,busy:Ot,isHot:Kn,inlineDomId:$n,cardInner:nt}},Je=3,et=e?n.slice(0,Je):[],Mt=e?n.slice(Je,Je+4):[],fe=15,qe=Math.min(et.length,Je)-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:qe>0?`${qe}px`:void 0},children:(()=>{const Le=et,Ce=Le[0],Pe=Le.slice(1);return c.jsxs(c.Fragment,{children:[Pe.map((Qe,At)=>{const Xt=At+1,{k:kt,cardInner:mn}=We(Qe,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),It=Xt,$t=-(It*fe),Ot=1-It*.03,en=1-It*.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-It,transform:`translateY(${$t}px) scale(${Ot}) translateZ(0)`,opacity:en,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[mn,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},kt)}).reverse(),Ce?(()=>{const Qe=Ce,{k:At,busy:Xt,isHot:kt,cardInner:mn,inlineDomId:It}=We(Qe,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(i3,{animateOnMount:!0,children:c.jsx(VN,{ref:$t=>{$t?C.current.set(At,$t):C.current.delete(At)},enabled:!0,disabled:Xt,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!kt){if(Oe){Oe(Qe);return}await de?.(Qe)}},onTap:()=>{ee(At),requestAnimationFrame(()=>{q(It)||requestAnimationFrame(()=>q(It))})},onSwipeLeft:()=>Be?Be(Qe):se(Qe),onSwipeRight:()=>Ve?Ve(Qe):$(Qe),children:mn})})},At)})():null]})})()}),Mt.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:Mt.map(Le=>{const Ce=B(Le);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(wu,{job:Le,getFileName:V,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:j??0,alwaysLoadStill:!0})},`preload-still-${Ce}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Le=>{const{k:Ce,cardInner:Pe}=We(Le);return c.jsx(m.Fragment,{children:Pe},Ce)})}),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 s3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 a3=m.forwardRef(s3);function o3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 l3=m.forwardRef(o3);function u3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 c3=m.forwardRef(u3);function d3({title:n,titleId:e,...t},i){return m.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?m.createElement("title",{id:e},n):null,m.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 U1=m.forwardRef(d3);function Vr(...n){return n.filter(Boolean).join(" ")}function z1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function h3(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 $1(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 nd({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:w=!1,isLoading:S=!1,emptyLabel:A="Keine Daten vorhanden.",className:C,rowClassName:j,onRowClick:k,onRowContextMenu:B,sort:V,onSortChange:W,defaultSort:H=null}){const ie=w?"py-2":"py-4",Y=w?"py-3":"py-3.5",G=V!==void 0,[O,re]=m.useState(H),E=G?V:O,R=m.useCallback(q=>{G||re(q),W?.(q)},[G,W]),ee=m.useMemo(()=>{if(!E)return e;const q=n.find(se=>se.key===E.key);if(!q)return e;const Q=E.direction==="asc"?1:-1,ue=e.map((se,$)=>({r:se,i:$}));return ue.sort((se,$)=>{let F=0;if(q.sortFn)F=q.sortFn(se.r,$.r);else{const X=q.sortValue?q.sortValue(se.r):se.r?.[q.key],le=q.sortValue?q.sortValue($.r):$.r?.[q.key],de=$1(X),L=$1(le);de.isNull&&!L.isNull?F=1:!de.isNull&&L.isNull?F=-1:de.kind==="number"&&L.kind==="number"?F=de.value<L.value?-1:de.value>L.value?1:0:F=String(de.value).localeCompare(String(L.value),void 0,{numeric:!0})}return F===0?se.i-$.i:F*Q}),ue.map(se=>se.r)},[e,n,E]);return c.jsxs("div",{className:Vr(u?"":"px-4 sm:px-6 lg:px-8",C),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:Vr(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:Vr("inline-block min-w-full align-middle",u?"":"sm:px-6 lg:px-8"),children:c.jsx("div",{className:Vr(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:Vr(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((q,Q)=>{const ue=H1(Q,n.length),se=!!E&&E.key===q.key,$=se?E.direction:void 0,F=q.sortable&&!q.srOnlyHeader?se?$==="asc"?"ascending":"descending":"none":void 0,X=()=>{if(!(!q.sortable||q.srOnlyHeader))return R(se?$==="asc"?{key:q.key,direction:"desc"}:null:{key:q.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":F,className:Vr(Y,ue,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",z1(q.align),q.widthClassName,q.headerClassName),children:q.srOnlyHeader?c.jsx("span",{className:"sr-only",children:q.header}):q.sortable?c.jsxs("button",{type:"button",onClick:X,className:Vr("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",h3(q.align)),children:[c.jsx("span",{children:q.header}),c.jsx("span",{className:Vr("flex-none rounded-sm text-gray-400 dark:text-gray-500",se?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(a3,{"aria-hidden":"true",className:Vr("size-5 transition-transform",se&&$==="asc"&&"rotate-180")})})]}):q.header},q.key)})})}),c.jsx("tbody",{className:Vr("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:Vr(ie,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):ee.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Vr(ie,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:A})}):ee.map((q,Q)=>{const ue=t?t(q,Q):String(Q);return c.jsx("tr",{className:Vr(f&&"even:bg-gray-50 dark:even:bg-gray-800/50",k&&"cursor-pointer",k&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",j?.(q,Q)),onClick:()=>k?.(q),onContextMenu:B?se=>{se.preventDefault(),B(q,se)}:void 0,children:n.map((se,$)=>{const F=H1($,n.length),X=se.cell?.(q,Q)??se.accessor?.(q)??q?.[se.key];return c.jsx("td",{className:Vr(ie,F,"text-sm whitespace-nowrap",z1(se.align),se.className,se.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:X},se.key)})},ue)})})]})})})})})})]})}function f3({rows:n,isLoading:e,keyFor:t,baseName:i,lower:a,modelNameFromOutput:l,runtimeOf:u,sizeBytesOf:h,formatBytes:f,resolutions:g,durations:w,canHover:S,teaserAudio:A,hoverTeaserKey:C,setHoverTeaserKey:j,teaserPlayback:k="hover",teaserKey:B,registerTeaserHost:V,handleDuration:W,handleResolution:H,blurPreviews:ie,assetNonce:Y,deletingKeys:G,keepingKeys:O,removingKeys:re,modelsByKey:E,activeTagSet:R,onToggleTagFilter:ee,onOpenPlayer:q,onSortModeChange:Q,page:ue,onPageChange:se,onToggleHot:$,onToggleFavorite:F,onToggleLike:X,onToggleWatch:le,deleteVideo:de,keepVideo:L,enqueueDeleteVideo:pe,enqueueKeepVideo:we,enqueueToggleHot:Be}){const[Ve,Oe]=m.useState(null),Te=m.useCallback(He=>{const We=He?.durationSeconds;if(typeof We=="number"&&Number.isFinite(We)&&We>0)return We;const Je=Date.parse(String(He?.startedAt||"")),et=Date.parse(String(He?.endedAt||""));if(Number.isFinite(Je)&&Number.isFinite(et)&&et>Je){const mt=(et-Je)/1e3;if(mt>=1&&mt<=1440*60)return mt}return Number.POSITIVE_INFINITY},[]),_t=m.useCallback(He=>{const We=String(He??"").trim();if(!We)return[];const Je=We.split(/[\n,;|]+/g).map(Mt=>Mt.trim()).filter(Boolean),et=new Set,mt=[];for(const Mt of Je){const fe=Mt.toLowerCase();et.has(fe)||(et.add(fe),mt.push(Mt))}return mt.sort((Mt,fe)=>Mt.localeCompare(fe,void 0,{sensitivity:"base"})),mt},[]),dt=m.useCallback(He=>{const We=He?.meta;if(!We)return null;if(typeof We=="string")try{return JSON.parse(We)}catch{return null}return We},[]),xe=m.useCallback(He=>{const We=dt(He);let Je=We?.previewSprite??We?.preview?.sprite??null;if(typeof Je=="string")try{Je=JSON.parse(Je)}catch{Je=null}const et=Number(Je?.count),mt=Number(Je?.stepSeconds);return!Number.isFinite(et)||et<2?null:{count:Math.max(2,Math.floor(et)),stepSeconds:Number.isFinite(mt)&&mt>0?mt:5}},[dt]),[Ne,Se]=m.useState({}),Ie=m.useCallback((He,We)=>{Se(Je=>Je[He]===We?Je:{...Je,[He]:We})},[]),$e=m.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:He=>{const We=t(He),et=!(!!A&&C===We),mt=xe(He),Mt=Ne[We],fe=i(He.output||""),qe=Wr(fe.replace(/\.[^.]+$/,"")).trim(),Le=mt&&typeof Mt=="number"?Math.max(0,Mt*mt.stepSeconds):void 0,Ce=qe&&typeof Le=="number"?`/api/preview?id=${encodeURIComponent(qe)}&t=${Le.toFixed(3)}&v=${Y??0}`:"";return c.jsxs("div",{ref:V(We),className:"group relative py-1",onClick:Pe=>Pe.stopPropagation(),onMouseDown:Pe=>Pe.stopPropagation(),onMouseEnter:()=>{S&&j(We)},onMouseLeave:()=>{S&&j(null),Ie(We,void 0)},children:[c.jsx(wu,{job:He,getFileName:i,durationSeconds:w[We],muted:et,popoverMuted:et,onDuration:W,onResolution:H,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:ie,animated:k==="all"?!0:k==="hover"?B===We:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:Y}),mt&&typeof Mt=="number"&&Ce?c.jsx("img",{src:Ce,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:He=>{const We=i(He.output||""),Je=uu(We),et=l(He.output),mt=Wr(We);return`${et} ${Je?"HOT":""} ${mt}`.trim()},cell:He=>{const We=i(He.output||""),Je=uu(We),et=Wr(We),mt=l(He.output),Mt=a(l(He.output)),fe=_t(E[Mt]?.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:mt}),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:et,children:et||"—"}),(()=>{const qe=t(He),Le=g[qe]??null,Ce=hd(Le);return Ce?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:Ce}):null})(),Je?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]}),fe.length>0?c.jsx("div",{className:"mt-1",onClick:qe=>qe.stopPropagation(),onMouseDown:qe=>qe.stopPropagation(),children:c.jsx(dd,{rowKey:t(He),tags:fe,activeTagSet:R,lower:a,onToggleTagFilter:ee,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:He=>{const We=Date.parse(String(He.endedAt||""));return Number.isFinite(We)?We:Number.NEGATIVE_INFINITY},cell:He=>{const We=Date.parse(String(He.endedAt||""));if(!Number.isFinite(We))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const Je=new Date(We),et=Je.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),mt=Je.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:Je.toISOString(),title:`${et} ${mt}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[c.jsx("span",{className:"font-medium",children:et}),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:mt})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:He=>Te(He),cell:He=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(He)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:He=>{const We=h(He);return typeof We=="number"?We:Number.NEGATIVE_INFINITY},cell:He=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(He))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:He=>{const We=t(He),Je=G.has(We)||O.has(We)||re.has(We),et=i(He.output||""),mt=uu(et),Mt=a(l(He.output)),fe=E[Mt],qe=!!fe?.favorite,Le=fe?.liked===!0,Ce=!!fe?.watching;return c.jsx(Bs,{job:He,variant:"table",busy:Je,isHot:mt,isFavorite:qe,isLiked:Le,isWatching:Ce,onToggleWatch:le,onToggleFavorite:F,onToggleLike:X,onToggleHot:$?async Pe=>{if(!(Be&&Be(Pe)))return $(Pe)}:void 0,onKeep:async Pe=>we&&we(Pe)?!0:L(Pe),onDelete:async Pe=>pe&&pe(Pe)?!0:de(Pe),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,w,A,C,V,S,j,W,H,ie,k,B,Y,a,l,E,R,ee,g,G,O,re,xe,Ne,Ie,le,F,X,$,L,de,h,f,u,_t,Te]),Ct=m.useCallback(He=>{if(!He)return"completed_desc";const We=He,Je=String(We.key??We.columnKey??We.id??""),et=String(We.dir??We.direction??We.order??"").toLowerCase(),mt=et==="asc"||et==="1"||et==="true";return Je==="completedAt"?mt?"completed_asc":"completed_desc":Je==="runtime"?mt?"duration_asc":"duration_desc":Je==="size"?mt?"size_asc":"size_desc":Je==="Model"||Je==="video"?mt?"file_asc":"file_desc":mt?"completed_asc":"completed_desc"},[]),st=m.useCallback(He=>{Oe(He),Q(Ct(He)),ue!==1&&se(1)},[Q,Ct,ue,se]),gt=m.useCallback(He=>{const We=t(He);return["transition-all duration-300",(G.has(We)||re.has(We))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",G.has(We)&&"animate-pulse",(O.has(We)||re.has(We))&&"pointer-events-none",O.has(We)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",re.has(We)&&"opacity-0"].filter(Boolean).join(" ")},[t,G,O,re]);return c.jsxs("div",{className:"relative",children:[c.jsx(nd,{rows:n,columns:$e,getRowKey:He=>t(He),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:Ve,onSortChange:st,onRowClick:q,rowClassName:gt}),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 q1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function m3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function j0(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function V1(n,e,t){return Math.max(e,Math.min(t,n))}const p3=5;function g3(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,w=Math.abs(g-e);(f<a||f===a&&w<l||f===a&&w===l&&h<i)&&(a=f,l=w,t=u,i=h)}return[t,i]}function y3({rows:n,isLoading:e,blurPreviews:t,durations:i,teaserPlayback:a,teaserAudio:l,hoverTeaserKey:u,teaserKey:h,handleDuration:f,handleScrubberClickIndex:g,keyFor:w,baseName:S,modelNameFromOutput:A,runtimeOf:C,sizeBytesOf:j,formatBytes:k,deletingKeys:B,keepingKeys:V,removingKeys:W,deletedKeys:H,registerTeaserHost:ie,onHoverPreviewKeyChange:Y,onOpenPlayer:G,deleteVideo:O,keepVideo:re,onToggleHot:E,lower:R,modelsByKey:ee,activeTagSet:q,onToggleTagFilter:Q,onToggleFavorite:ue,onToggleLike:se,onToggleWatch:$,enqueueDeleteVideo:F,enqueueKeepVideo:X,enqueueToggleHot:le}){const de=a==="hover"||a==="all",L=m.useCallback(Se=>Ie=>{if(!de){ie(Se)(null);return}ie(Se)(Ie)},[ie,de]),pe=Se=>{const Ie=String(Se??"").trim();if(!Ie)return[];const $e=Ie.split(/[\n,;|]+/g).map(gt=>gt.trim()).filter(Boolean),Ct=new Set,st=[];for(const gt of $e){const He=gt.toLowerCase();Ct.has(He)||(Ct.add(He),st.push(gt))}return st},we=m.useCallback(Se=>{const Ie=(typeof Se?.meta?.videoWidth=="number"&&Number.isFinite(Se.meta.videoWidth)?Se.meta.videoWidth:0)||(typeof Se?.videoWidth=="number"&&Number.isFinite(Se.videoWidth)?Se.videoWidth:0),$e=(typeof Se?.meta?.videoHeight=="number"&&Number.isFinite(Se.meta.videoHeight)?Se.meta.videoHeight:0)||(typeof Se?.videoHeight=="number"&&Number.isFinite(Se.videoHeight)?Se.videoHeight:0);return Ie>0&&$e>0?{w:Ie,h:$e}:null},[]),[Be,Ve]=m.useState(null),[Oe,Te]=m.useState({}),[_t,dt]=m.useState(null),xe=m.useCallback((Se,Ie)=>{Te($e=>{if(Ie===void 0){if(!(Se in $e))return $e;const Ct={...$e};return delete Ct[Se],Ct}return $e[Se]===Ie?$e:{...$e,[Se]:Ie}})},[]),Ne=m.useCallback(Se=>{xe(Se,void 0)},[xe]);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(Se=>{const Ie=w(Se),Ct=!(!!l&&u===Ie),st=A(Se.output),gt=R(st),He=ee[gt],We=!!He?.favorite,Je=He?.liked===!0,et=!!He?.watching,mt=pe(He?.tags),Mt=S(Se.output||""),fe=uu(Mt),qe=Wr(Mt),Le=C(Se),Ce=k(j(Se)),Pe=we(Se),Qe=hd(Pe),At=B.has(Ie)||V.has(Ie)||W.has(Ie),Xt=H.has(Ie),kt=q1(He?.image,He?.imageUrl,Se?.meta?.modelImage,Se?.meta?.modelImageUrl),It=Wr(S(Se.output||"")).replace(/\.[^.]+$/,"").trim(),$t=m3(Se?.meta),Ot=q1($t?.previewSprite?.path,$t?.previewSpritePath,He?.previewScrubberPath,It?`/api/preview-sprite/${encodeURIComponent(It)}`:void 0),en=Ot?Ot.replace(/\/+$/,""):void 0,Sn=$t?.previewSprite?.stepSeconds??$t?.previewSpriteStepSeconds,Pn=typeof Sn=="number"&&Number.isFinite(Sn)&&Sn>0?Sn:p3,St=j0($t?.durationSeconds)??j0(Se?.durationSeconds)??j0(i[Ie]),Tn=typeof St=="number"&&St>0?Math.max(1,Math.min(200,Math.floor(St/Pn)+1)):void 0,tt=$t?.previewSprite?.count??$t?.previewSpriteCount??He?.previewScrubberCount??Tn,D=$t?.previewSprite?.cols??$t?.previewSpriteCols,P=$t?.previewSprite?.rows??$t?.previewSpriteRows,ne=typeof tt=="number"&&Number.isFinite(tt)?Math.max(0,Math.floor(tt)):0,[Re,Ge]=ne>1?g3(ne):[0,0],yt=typeof D=="number"&&Number.isFinite(D)?Math.max(0,Math.floor(D)):Re,tn=typeof P=="number"&&Number.isFinite(P)?Math.max(0,Math.floor(P)):Ge,un=(typeof $t?.updatedAtUnix=="number"&&Number.isFinite($t.updatedAtUnix)?$t.updatedAtUnix:void 0)??(typeof $t?.fileModUnix=="number"&&Number.isFinite($t.fileModUnix)?$t.fileModUnix:void 0)??0,vn=en&&un?`${en}?v=${encodeURIComponent(String(un))}`:en||void 0,cn=!!vn&&ne>1,Cn=cn&&yt>0&&tn>0,xn=cn?ne:0,on=cn?Pn:0,Rn=cn,qt=Oe[Ie],Bt=typeof qt=="number"&&xn>1?V1(qt/(xn-1),0,1):void 0,Zt=Cn&&typeof qt=="number"?(()=>{const Ft=V1(qt,0,Math.max(0,ne-1)),Qn=Ft%yt,Xn=Math.floor(Ft/yt),Gn=yt<=1?0:Qn/(yt-1)*100,ln=tn<=1?0:Xn/(tn-1)*100;return{backgroundImage:`url("${vn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${yt*100}% ${tn*100}%`,backgroundPosition:`${Gn}% ${ln}%`}})():void 0,zt=Be===Ie&&!!kt,Pt=!zt&&!!Zt,Nn=zt||Pt;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",At&&"pointer-events-none opacity-70",B.has(Ie)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",W.has(Ie)&&"opacity-0 translate-y-2 scale-[0.98]",Xt&&"hidden"].filter(Boolean).join(" "),onClick:()=>G(Se),onKeyDown:Ft=>{(Ft.key==="Enter"||Ft.key===" ")&&G(Se)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:L(Ie),onMouseEnter:()=>{dt(Ie),Y?.(Ie)},onMouseLeave:()=>{dt(Ft=>Ft===Ie?null:Ft),Y?.(null),Ne(Ie),Ve(Ft=>Ft===Ie?null:Ft)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(wu,{job:Se,getFileName:Ft=>Wr(S(Ft)),durationSeconds:i[Ie]??Se?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Nn?!1:a==="all"?!0:a==="hover"?h===Ie:!1,animatedMode:"teaser",animatedTrigger:"always",muted:Ct,popoverMuted:Ct,scrubProgressRatio:Bt,preferScrubProgress:typeof qt=="number"})}),Cn&&vn?c.jsx("img",{src:vn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Pt&&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,zt&&kt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:kt,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,Rn&&_t===Ie?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Ft=>Ft.stopPropagation(),onMouseDown:Ft=>Ft.stopPropagation(),children:c.jsx(xy,{className:"pointer-events-auto px-1",imageCount:xn,activeIndex:qt,onActiveIndexChange:Ft=>xe(Ie,Ft),onIndexClick:Ft=>{xe(Ie,Ft),g(Se,Ft,xn)},stepSeconds:on})}):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}`:Qe||"",Ce].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Le}),Qe?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,Qe?c.jsx("span",{children:Qe}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Ce})]})})]})}),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:[fe?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:Wr(qe)||"—",children:Wr(qe)||"—"})]})}),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",kt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:kt?`${st} (Hover: Model-Preview)`:st,onMouseEnter:Ft=>{Ft.stopPropagation(),kt&&Ve(Ie)},onMouseLeave:Ft=>{Ft.stopPropagation(),Ve(Qn=>Qn===Ie?null:Qn)},onMouseDown:Ft=>Ft.stopPropagation(),onClick:Ft=>Ft.stopPropagation(),children:st||"—"})}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[et?c.jsx(yl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Je?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,We?c.jsx(_u,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:Ft=>Ft.stopPropagation(),onMouseDown:Ft=>Ft.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(Bs,{job:Se,variant:"table",busy:At,collapseToMenu:!0,compact:!0,isHot:fe,isFavorite:We,isLiked:Je,isWatching:et,onToggleWatch:$,onToggleFavorite:ue,onToggleLike:se,onToggleHot:async Ft=>{if(!(le&&le(Ft)))return E(Ft)},onKeep:async Ft=>X&&X(Ft)?!0:re(Ft),onDelete:async Ft=>F&&F(Ft)?!0:O(Ft),order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:Ft=>Ft.stopPropagation(),onMouseDown:Ft=>Ft.stopPropagation(),children:c.jsx(dd,{rowKey:Ie,tags:mt,activeTagSet:q,lower:R,onToggleTagFilter:Q})})]})]},Ie)})}),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 G1(n,e,t){return Math.max(e,Math.min(t,n))}function O0(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function b3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=O0(a,Math.min(t,l)),h=O0(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),w=[];w.push(...u),f>t+1?w.push("ellipsis"):t+1<l-t&&w.push(t+1),w.push(...O0(f,g)),g<l-t?w.push("ellipsis"):l-t>t&&w.push(l-t),w.push(...h);const S=new Set;return w.filter(A=>{const C=String(A);return S.has(C)?!1:(S.add(C),!0)})}function v3({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:gn("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 Cf({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:w="Next"}){const S=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),A=G1(n||1,1,S);if(S<=1)return null;const C=t===0?0:(A-1)*e+1,j=Math.min(A*e,t),k=b3(S,A,l,a),B=V=>i(G1(V,1,S));return c.jsxs("div",{className:gn("flex items-center justify-between bg-transparent dark:border-white/10",h),children:[c.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[c.jsx("button",{type:"button",onClick:()=>B(A-1),disabled:A<=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(A+1),disabled:A>=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:w})]}),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:C})," to"," ",c.jsx("span",{className:"font-medium",children:j})," 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(A-1),disabled:A<=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(l3,{"aria-hidden":"true",className:"size-5"})]}),k.map((V,W)=>V==="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-${W}`):c.jsx(v3,{active:V===A,onClick:()=>B(V),rounded:"none",children:V},V)),c.jsxs("button",{type:"button",onClick:()=>B(A+1),disabled:A>=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:w}),c.jsx(c3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Bw=m.createContext(null),L0=220;function x3(n){switch(n){case"success":return{Icon:zA,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:_N,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:KA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:eN,cls:"text-sky-600 dark:text-sky-400"}}}function _3(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 w3(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 T3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function k3({children:n,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[a,l]=m.useState([]),[u,h]=m.useState(!0),f=m.useRef({}),g=m.useRef({}),w=m.useRef({}),S=m.useRef({}),A=m.useRef({}),C=m.useCallback(E=>{const R=f.current[E];R&&(window.clearTimeout(R),delete f.current[E]);const ee=g.current[E];ee&&(window.clearTimeout(ee),delete g.current[E]),delete w.current[E],delete S.current[E],delete A.current[E]},[]),j=m.useCallback(async()=>{try{const E=await fetch("/api/settings",{cache:"no-store"});if(!E.ok)return;const R=await E.json();h(!!(R?.enableNotifications??!0))}catch{}},[]);m.useEffect(()=>{j();const E=()=>j();return window.addEventListener("recorder-settings-updated",E),()=>window.removeEventListener("recorder-settings-updated",E)},[j]),m.useEffect(()=>{u||(l(R=>R.map(ee=>ee.type==="error"?ee:{...ee,open:!1})),a.filter(R=>R.type!=="error").map(R=>R.id).forEach(R=>{C(R),g.current[R]=window.setTimeout(()=>{l(ee=>ee.filter(q=>q.id!==R)),delete g.current[R]},L0)}))},[u]);const k=m.useCallback(E=>{l(R=>R.map(ee=>ee.id===E?{...ee,open:!1}:ee)),C(E),g.current[E]=window.setTimeout(()=>{l(R=>R.filter(ee=>ee.id!==E)),delete g.current[E]},L0)},[C]),B=m.useCallback(()=>{l(E=>E.map(R=>({...R,open:!1}))),Object.keys(f.current).forEach(E=>{window.clearTimeout(f.current[E]),delete f.current[E]}),Object.keys(g.current).forEach(E=>{window.clearTimeout(g.current[E]),delete g.current[E]}),window.setTimeout(()=>l([]),L0)},[]),V=m.useCallback((E,R)=>{if(!R||R<=0)return;const ee=f.current[E];ee&&(window.clearTimeout(ee),delete f.current[E]),w.current[E]=Date.now(),S.current[E]=R,A.current[E]=!1,f.current[E]=window.setTimeout(()=>{k(E),delete f.current[E],delete w.current[E],delete S.current[E],delete A.current[E]},R)},[k]),W=m.useCallback(E=>{if(!u&&E.type!=="error")return"";const R=T3(),ee=E.durationMs??t;return l(q=>{const Q=[{...E,id:R,durationMs:ee,open:!0},...q],ue=Math.max(1,e),se=Q.slice(0,ue);return Q.slice(ue).forEach(F=>C(F.id)),se}),ee&&ee>0&&V(R,ee),R},[t,e,u,C,V]),H=m.useCallback(E=>{if(A.current[E])return;const R=f.current[E];if(!R)return;window.clearTimeout(R),delete f.current[E];const ee=w.current[E]??Date.now(),q=S.current[E]??0,Q=Date.now()-ee,ue=Math.max(0,q-Q);S.current[E]=ue,A.current[E]=!0},[]),ie=m.useCallback(E=>{if(!A.current[E])return;const R=S.current[E]??0;if(R<=0){k(E);return}A.current[E]=!1,w.current[E]=Date.now(),f.current[E]=window.setTimeout(()=>{k(E),delete f.current[E],delete w.current[E],delete S.current[E],delete A.current[E]},R)},[k]);m.useEffect(()=>()=>{Object.values(f.current).forEach(E=>window.clearTimeout(E)),Object.values(g.current).forEach(E=>window.clearTimeout(E))},[]);const Y=m.useMemo(()=>({push:W,remove:k,clear:B}),[W,k,B]),G=i==="top-right"||i==="top-left"?"items-start sm:items-start sm:justify-start":"items-end sm:items-end sm:justify-end",O=i.endsWith("left")?"sm:items-start":"sm:items-end",re=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return c.jsxs(Bw.Provider,{value:Y,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",re].join(" "),children:c.jsx("div",{className:["flex w-full px-3 py-4 sm:px-6 sm:py-6",G].join(" "),children:c.jsx("div",{className:["flex w-full flex-col gap-2.5 sm:gap-3",O].join(" "),children:a.map(E=>{const{Icon:R,cls:ee}=x3(E.type),q=w3(E.type),Q=(E.title||"").trim()||S3(E.type),ue=(E.message||"").trim(),se=(E.imageUrl||"").trim(),$=(E.imageAlt||Q).trim(),F=typeof E.onClick=="function";return c.jsx(ed,{appear:!0,show:E.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:F?"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",F?"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]":"",_3(E.type)].join(" "),onMouseEnter:()=>H(E.id),onMouseLeave:()=>ie(E.id),onFocus:()=>H(E.id),onBlur:()=>ie(E.id),onClick:()=>{E.onClick&&(E.onClick(),E.closeOnClick!==!1&&k(E.id))},onKeyDown:X=>{E.onClick&&(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),E.onClick(),E.closeOnClick!==!1&&k(E.id))},tabIndex:F?0:void 0,"aria-label":F?`${Q} öffnen`:void 0,children:se?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:se,alt:$,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:Q}),ue?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:ue}):null]})]}),c.jsxs("button",{type:"button",onClick:X=>{X.stopPropagation(),k(E.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(U1,{"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",q.iconBg,"ring-1 ring-black/5 dark:ring-white/10"].join(" "),children:c.jsx(R,{className:["size-5.5 sm:size-6",ee].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:Q}),ue?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:ue}):null]})]}),c.jsxs("button",{type:"button",onClick:X=>{X.stopPropagation(),k(E.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(U1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]})})},E.id)})})})})]})}function E3(){const n=m.useContext(Bw);if(!n)throw new Error("useToast must be used within <ToastProvider>");return n}function Pw(){const{push:n,remove:e,clear:t}=E3(),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 C3(n){return typeof n=="number"?n:n==="xs"?12:n==="sm"?16:n==="lg"?28:20}function K1(...n){return n.filter(Boolean).join(" ")}function W1({size:n="md",className:e,label:t,srLabel:i="Lädt…",center:a=!1}){const l=C3(n);return c.jsxs("span",{className:K1("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:K1("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 _y=n=>(n||"").replaceAll("\\","/"),hr=n=>{const t=_y(n).split("/");return t[t.length-1]||""},_i=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):hr(n.output||"")||String(n?.output||"")},A3=n=>{const e=_y(String(n??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function X1(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 I0(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<e.length-1;)t/=1024,i++;const a=i===0||t>=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function Y1(n){const[e,t]=m.useState(!1);return m.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 Bc=n=>{const e=hr(n||""),t=Wr(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},os=n=>(n||"").trim().toLowerCase(),N3=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},B0=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 Q1(n){return new Promise(e=>window.setTimeout(e,n))}function D3(n){return n instanceof Error?n.message||String(n):String(n??"")}function Z1(n){const e=D3(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 P0(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 M3(){const n=m.useRef([]),e=m.useRef(!1),t=m.useRef(!1),i=m.useRef(new Set),a=m.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=m.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=m.useCallback((f,g)=>!f||i.current.has(f)?!1:(i.current.add(f),n.current.push({id:f,run:g}),a(),!0),[a]),h=m.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:w,onKeepJob:S,doneTotal:A,page:C,pageSize:j,onPageChange:k,assetNonce:B,sortMode:V,onSortModeChange:W,modelsByKey:H,loadMode:ie="paged"}){const Y=ie==="all",G=i??"hover",O=Y1("(hover: hover) and (pointer: fine)"),re=Pw(),E=M3(),R=m.useRef(new Map),[ee,q]=m.useState(null),[Q,ue]=m.useState(null),se=m.useRef(null),$=m.useRef(new WeakMap),[F,X]=m.useState(()=>new Set),[le,de]=m.useState(()=>new Set),[L,pe]=m.useState(!1),we=m.useRef(!1),Be=m.useRef(!1),Ve=m.useRef(0),Oe="finishedDownloads_lastUndo_v1",[Te,_t]=m.useState(()=>{if(typeof window>"u")return null;try{const Z=localStorage.getItem(Oe);if(!Z)return null;const ce=JSON.parse(Z);if(!ce||ce.v!==1||!ce.action)return null;const ve=Date.now()-Number(ce.ts||0);return!Number.isFinite(ve)||ve<0||ve>1800*1e3?(localStorage.removeItem(Oe),null):ce.action}catch{return null}}),[dt,xe]=m.useState(!1);m.useEffect(()=>{try{if(!Te){localStorage.removeItem(Oe);return}const Z={v:1,action:Te,ts:Date.now()};localStorage.setItem(Oe,JSON.stringify(Z))}catch{}},[Te]);const[Ne,Se]=m.useState({}),[Ie,$e]=m.useState(null),[Ct,st]=m.useState(null),[gt,He]=m.useState(0),We=m.useRef(null),Je=m.useRef({pending:0,t:0,timer:0}),et=m.useCallback(Z=>{!Z||!Number.isFinite(Z)||(Je.current.pending+=Z,!Je.current.timer&&(Je.current.timer=window.setTimeout(()=>{Je.current.timer=0;const ce=Je.current.pending;Je.current.pending=0,ce&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:ce}}))},120)))},[]),mt="finishedDownloads_view",Mt="finishedDownloads_includeKeep_v2",fe="finishedDownloads_mobileOptionsOpen_v1",[qe,Le]=m.useState("table"),[Ce,Pe]=m.useState(!1),[Qe,At]=m.useState(!1),Xt=m.useRef(new Map),[kt,mn]=m.useState([]),It=m.useMemo(()=>new Set(kt.map(os)),[kt]),$t=m.useMemo(()=>{const Z={},ce={};for(const[ve,Me]of Object.entries(H??{})){const I=os(ve),U=N3(Me?.tags);Z[I]=U,ce[I]=new Set(U.map(os))}return{tagsByModelKey:Z,tagSetByModelKey:ce}},[H]),[Ot,en]=m.useState(""),Sn=m.useDeferredValue(Ot),Pn=m.useMemo(()=>os(Sn).split(/\s+/g).map(Z=>Z.trim()).filter(Boolean),[Sn]),St=m.useCallback(()=>en(""),[]),Tn=m.useCallback(Z=>{const ce=os(Z);mn(ve=>ve.some(I=>os(I)===ce)?ve.filter(I=>os(I)!==ce):[...ve,Z])},[]),D=It.size>0||Pn.some(Z=>Z.length>=2),P=D||Y,ne=m.useCallback(async Z=>{const ce=Ie==null;ce&&pe(!0);try{const ve=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(V)}&withCount=1${Ce?"&includeKeep=1":""}`,{cache:"no-store",signal:Z});if(!ve.ok)return;const Me=await ve.json().catch(()=>null),I=Array.isArray(Me?.items)?Me.items:[],U=Number(Me?.count??Me?.totalCount??I.length);$e(I),st(Number.isFinite(U)?U:I.length)}finally{ce&&pe(!1)}},[V,Ce]),Re=m.useCallback(()=>mn([]),[]);m.useEffect(()=>{try{const Z=localStorage.getItem("finishedDownloads_pendingTags");if(!Z)return;const ce=JSON.parse(Z),ve=Array.isArray(ce)?ce.map(Me=>String(Me||"").trim()).filter(Boolean):[];if(ve.length===0)return;vu.flushSync(()=>mn(ve)),C!==1&&k(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const Ge=m.useCallback(()=>{We.current==null&&(We.current=window.setTimeout(()=>{We.current=null,He(Z=>Z+1)},80))},[C,j,V,Ce]);m.useEffect(()=>{if(!P)return;const Z=new AbortController,ce=window.setTimeout(()=>{ne(Z.signal).catch(()=>{})},250);return()=>{window.clearTimeout(ce),Z.abort()}},[P,ne]),m.useEffect(()=>{if(gt===0)return;const Z=new AbortController;let ce=!0,ve=!1;const Me=++Ve.current,I=()=>{ve||(ve=!0,Ve.current===Me&&(we.current=!1,Be.current&&(Be.current=!1,Ge())))};return Ve.current===Me&&(we.current=!0),P?((async()=>{try{await ne(Z.signal),ce&&(Rn.current=0)}catch{}finally{ce&&I()}})(),()=>{ce=!1,Z.abort(),I()}):(pe(!0),(async()=>{try{const U=await fetch(`/api/record/done?page=${C}&pageSize=${j}&sort=${encodeURIComponent(V)}&withCount=1${Ce?"&includeKeep=1":""}`,{cache:"no-store",signal:Z.signal});if(!ce||Z.signal.aborted)return;const te=U.ok;if(U.ok){const ye=await U.json().catch(()=>null);if(!ce||Z.signal.aborted)return;const ge=Array.isArray(ye?.items)?ye.items:Array.isArray(ye)?ye:[];$e(ge);const at=Number(ye?.count??ye?.totalCount??ge.length),lt=Number.isFinite(at)&&at>=0?at:0;st(lt);const ut=Math.max(1,Math.ceil(lt/j));if(C>ut){k(ut),$e(null);return}}if(te)Rn.current=0;else if(ce&&!Z.signal.aborted&&Rn.current<2){Rn.current+=1;const ye=Rn.current;window.setTimeout(()=>{Z.signal.aborted||He(ge=>ge+1)},400*ye)}}catch{}finally{ce&&(pe(!1),I())}})(),()=>{ce=!1,Z.abort(),I()})},[gt,P,ne,C,j,V,Ce,k]),m.useEffect(()=>{P||($e(null),st(null))},[C,j,V,Ce,P]),m.useEffect(()=>{if(!Ce){D||($e(null),st(null));return}if(D)return;const Z=new AbortController;return(async()=>{try{const ce=await fetch(`/api/record/done?page=${C}&pageSize=${j}&sort=${encodeURIComponent(V)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:Z.signal});if(!ce.ok)return;const ve=await ce.json().catch(()=>null),Me=Array.isArray(ve?.items)?ve.items:[],I=Number(ve?.count??ve?.totalCount??Me.length);$e(Me),st(Number.isFinite(I)?I:Me.length)}catch{}})(),()=>Z.abort()},[Ce,D,C,j,V]),m.useEffect(()=>{try{const Z=localStorage.getItem(mt);Le(Z==="table"||Z==="cards"||Z==="gallery"?Z:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Le("table")}},[]),m.useEffect(()=>{try{localStorage.setItem(mt,qe)}catch{}},[qe]),m.useEffect(()=>{try{const Z=localStorage.getItem(Mt);Pe(Z==="1"||Z==="true"||Z==="yes")}catch{Pe(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(Mt,Ce?"1":"0")}catch{}},[Ce]),m.useEffect(()=>{try{const Z=localStorage.getItem(fe);At(Z==="1"||Z==="true"||Z==="yes")}catch{At(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(fe,Qe?"1":"0")}catch{}},[Qe]);const[yt,tn]=m.useState({}),un=m.useRef({}),vn=m.useRef(null),[cn,Cn]=m.useState({}),xn=m.useRef({}),on=m.useRef(null),Rn=m.useRef(0);m.useEffect(()=>{xn.current=cn},[cn]);const qt=m.useCallback(()=>{on.current==null&&(on.current=window.setTimeout(()=>{on.current=null,Cn({...xn.current})},200))},[]);m.useEffect(()=>()=>{on.current!=null&&(window.clearTimeout(on.current),on.current=null)},[]),m.useEffect(()=>{un.current=yt},[yt]);const Bt=m.useCallback(()=>{vn.current==null&&(vn.current=window.setTimeout(()=>{vn.current=null,tn({...un.current})},200))},[]);m.useEffect(()=>()=>{vn.current!=null&&(window.clearTimeout(vn.current),vn.current=null)},[]);const[Zt,zt]=m.useState(null),Pt=!a,Nn=m.useCallback(Z=>{const ve=document.getElementById(Z)?.querySelector("video");if(!ve)return!1;cd(ve,{muted:Pt});const Me=ve.play?.();return Me&&typeof Me.catch=="function"&&Me.catch(()=>{}),!0},[Pt]),Ft=m.useCallback(Z=>{zt(ce=>ce?.key===Z?{key:Z,nonce:ce.nonce+1}:{key:Z,nonce:1})},[]),Qn=m.useCallback((Z,ce,ve)=>{const Me=Number.isFinite(ce)&&ce>0?ce:0;zt(U=>U?.key===Z?{key:Z,nonce:U.nonce+1}:{key:Z,nonce:1});const I=U=>{const ye=document.getElementById(ve)?.querySelector("video");if(!ye){U>0&&requestAnimationFrame(()=>I(U-1));return}cd(ye,{muted:Pt});const ge=()=>{try{const Dt=Number(ye.duration),Yt=Number.isFinite(Dt)&&Dt>0?Math.max(0,Dt-.05):Me;ye.currentTime=Math.max(0,Math.min(Me,Yt))}catch{}const ut=ye.play?.();ut&&typeof ut.catch=="function"&&ut.catch(()=>{})};if(ye.readyState>=1){ge();return}const at=()=>{ye.removeEventListener("loadedmetadata",at),ge()};ye.addEventListener("loadedmetadata",at,{once:!0});const lt=ye.play?.();lt&&typeof lt.catch=="function"&<.catch(()=>{})};requestAnimationFrame(()=>I(8))},[Pt]),Xn=m.useCallback(Z=>{zt(null),l(Z)},[l]),Gn=m.useCallback((Z,ce)=>{const ve=Number.isFinite(ce)&&ce>=0?ce:0;zt(null),l(Z,ve)},[l]),ln=m.useCallback((Z,ce,ve)=>{const Me=Number.isFinite(ce)?Math.floor(ce):0,I=Number.isFinite(ve)?Math.floor(ve):0;if(I<=0){Xn(Z);return}const U=_i(Z),te=yt[U]??Z?.durationSeconds??0;if(!Number.isFinite(te)||te<=0){Xn(Z);return}const ye=Math.max(0,Math.min(Me,I-1)),ge=te/I,at=ye*ge;Gn(Z,at)},[yt,_i,Xn,Gn]),Zn=m.useCallback((Z,ce)=>{de(ve=>{const Me=new Set(ve);return ce?Me.add(Z):Me.delete(Z),Me})},[]),ti=m.useCallback(Z=>{X(ce=>{const ve=new Set(ce);return ve.add(Z),ve})},[]),[jn,Kn]=m.useState(()=>new Set),rn=m.useCallback((Z,ce)=>{Kn(ve=>{const Me=new Set(ve);return ce?Me.add(Z):Me.delete(Z),Me})},[]),[Di,oi]=m.useState(()=>new Set),ni=m.useRef(new Map);m.useEffect(()=>()=>{for(const Z of ni.current.values())window.clearTimeout(Z);ni.current.clear()},[]);const di=m.useCallback((Z,ce)=>{oi(ve=>{const Me=new Set(ve);return ce?Me.add(Z):Me.delete(Z),Me})},[]),Ci=m.useCallback(Z=>{const ce=ni.current.get(Z);ce!=null&&(window.clearTimeout(ce),ni.current.delete(Z))},[]),Fn=m.useCallback(Z=>{Ci(Z),X(ce=>{const ve=new Set(ce);return ve.delete(Z),ve}),oi(ce=>{const ve=new Set(ce);return ve.delete(Z),ve}),de(ce=>{const ve=new Set(ce);return ve.delete(Z),ve}),Kn(ce=>{const ve=new Set(ce);return ve.delete(Z),ve})},[Ci]),On=m.useCallback(Z=>{di(Z,!0),Ci(Z);const ce=window.setTimeout(()=>{ni.current.delete(Z),ti(Z),di(Z,!1)},320);ni.current.set(Z,ce)},[ti,di,Ci]),$n=m.useCallback(async(Z,ce)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:Z}})),ce?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:Z}})),await new Promise(ve=>requestAnimationFrame(()=>ve())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:Z}})),await new Promise(ve=>window.setTimeout(ve,260))},[]),_e=m.useCallback(async(Z,ce,ve)=>{const Me=Math.max(1,ve?.attempts??4),I=Math.max(50,ve?.baseDelayMs??220);let U;for(let te=1;te<=Me;te++)try{return await $n(Z,{close:ve?.close??!0}),te>1?await Q1(I*te):await Q1(80),await ce()}catch(ye){if(U=ye,!Z1(ye)||te>=Me)throw ye;continue}throw U instanceof Error?U:new Error(String(U??"Unbekannter Fehler"))},[$n]),nt=m.useCallback(async Z=>{const{file:ce,rowKey:ve,setBusy:Me,isBusyNow:I,optimisticRemove:U,alreadyRemoved:te,run:ye,onSuccess:ge,onError:at,labels:lt}=Z;if(!ce)return re.error(lt.invalidTitle,lt.invalidBody),{ok:!1};if(I?.())return{ok:!1};Me?.(!0);try{U&&!te&&On(ve);const ut=await ye();return await ge?.(ut),{ok:!0,result:ut}}catch(ut){if(U&&Fn(ve),await at?.(ut),Z1(ut))re.error(lt.inUseTitle,`${ce} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const Dt=ut?.message?` — ${String(ut.message)}`:"";re.error(lt.failTitle,`${lt.failPrefix??ce}${Dt}`)}return{ok:!1}}finally{Me?.(!1)}},[re,On,Fn]),ht=m.useCallback(async(Z,ce)=>{const ve=hr(Z.output||""),Me=_i(Z);return(await nt({kind:"delete",job:Z,file:ve,rowKey:Me,setBusy:U=>Zn(Me,U),isBusyNow:()=>le.has(Me),optimisticRemove:!0,alreadyRemoved:ce?.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:ve},run:async()=>u?await _e(ve,async()=>await u(Z),{close:!0,attempts:4,baseDelayMs:220}):await(await _e(ve,async()=>await P0(`/api/record/delete?file=${encodeURIComponent(ve)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async U=>{if(u){const ge=typeof U?.undoToken=="string"?U.undoToken:"";_t(ge?{kind:"delete",undoToken:ge,originalFile:ve,rowKey:Me}:null);return}const te=U?.from==="keep"?"keep":"done",ye=typeof U?.undoToken=="string"?U.undoToken:"";_t(ye?{kind:"delete",undoToken:ye,originalFile:ve,rowKey:Me,from:te}:null),Ge(),et(-1)}})).ok},[hr,_i,le,Zn,u,_e,nt,Ge,et]),Ht=m.useCallback(async(Z,ce)=>{const ve=hr(Z.output||""),Me=_i(Z);return(await nt({kind:"keep",job:Z,file:ve,rowKey:Me,setBusy:U=>rn(Me,U),isBusyNow:()=>jn.has(Me)||le.has(Me),optimisticRemove:!0,alreadyRemoved:ce?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:ve},run:async()=>S?await _e(ve,async()=>await S(Z),{close:!0,attempts:4,baseDelayMs:220}):await(await _e(ve,async()=>await P0(`/api/record/keep?file=${encodeURIComponent(ve)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async U=>{const te=typeof U?.newFile=="string"&&U.newFile?U.newFile:ve;_t({kind:"keep",keptFile:te,originalFile:ve,rowKey:Me}),Ge(),et(Ce?0:-1)}})).ok},[hr,_i,rn,jn,le,_e,nt,Ge,et,Ce]),De=m.useCallback((Z,ce)=>{!Z||!ce||Z===ce||Se(ve=>{const Me={...ve};for(const[I,U]of Object.entries(Me))(I===Z||I===ce||U===Z||U===ce)&&delete Me[I];return Me[Z]=ce,Me})},[]),vt=m.useCallback((Z,ce)=>{!Z&&!ce||Se(ve=>{const Me={...ve};for(const[I,U]of Object.entries(Me))(I===Z||I===ce||U===Z||U===ce)&&delete Me[I];return Me})},[]),wt=m.useCallback(async()=>{if(!Te||dt)return;xe(!0);const Z=ce=>{X(ve=>{const Me=new Set(ve);return Me.delete(ce),Me}),de(ve=>{const Me=new Set(ve);return Me.delete(ce),Me}),Kn(ve=>{const Me=new Set(ve);return Me.delete(ce),Me}),oi(ve=>{const Me=new Set(ve);return Me.delete(ce),Me})};try{if(Te.kind==="delete"){const ce=await fetch(`/api/record/restore?token=${encodeURIComponent(Te.undoToken)}`,{method:"POST"});if(!ce.ok){const U=await ce.text().catch(()=>"");throw new Error(U||`HTTP ${ce.status}`)}const ve=await ce.json().catch(()=>null),Me=String(ve?.restoredFile||Te.originalFile);Te.rowKey&&Z(Te.rowKey),Z(Te.originalFile),Z(Me);const I=Te.from==="keep"&&!Ce?0:1;et(I),Ge(),_t(null);return}if(Te.kind==="keep"){const ce=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Te.keptFile)}`,{method:"POST"});if(!ce.ok){const I=await ce.text().catch(()=>"");throw new Error(I||`HTTP ${ce.status}`)}const ve=await ce.json().catch(()=>null),Me=String(ve?.newFile||Te.originalFile);Te.rowKey&&Z(Te.rowKey),Z(Te.originalFile),Z(Me),et(1),Ge(),_t(null);return}if(Te.kind==="hot"){const ce=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Te.currentFile)}`,{method:"POST"});if(!ce.ok){const U=await ce.text().catch(()=>"");throw new Error(U||`HTTP ${ce.status}`)}const ve=await ce.json().catch(()=>null),Me=String(ve?.oldFile||Te.currentFile),I=String(ve?.newFile||"");I&&De(Me,I),Ge(),_t(null);return}}catch(ce){re.error("Undo fehlgeschlagen",String(ce?.message||ce))}finally{xe(!1)}},[Te,dt,re,Ge,Ce,et,De]),[Nt,Gt]=m.useState(()=>new Set),Kt=m.useCallback((Z,ce)=>{Gt(ve=>{const Me=new Set(ve);return ce?Me.add(Z):Me.delete(Z),Me})},[]),sn=m.useCallback(async Z=>{const ce=hr(Z.output||""),ve=_i(Z),Me=te=>uu(te)?Wr(te):`HOT ${te}`,I=ce,U=Me(I);await nt({kind:"rename",job:Z,file:ce,rowKey:ve,setBusy:te=>Kt(ve,te),isBusyNow:()=>Nt.has(ve),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:I},run:async()=>(De(I,U),h?await h(Z):await(await _e(I,async()=>await P0(`/api/record/toggle-hot?file=${encodeURIComponent(I)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async te=>{const ye=typeof te?.oldFile=="string"&&te.oldFile?te.oldFile:I,ge=typeof te?.newFile=="string"&&te.newFile?te.newFile:U;ye&&ge&&ye!==ge&&De(ye,ge),_t({kind:"hot",currentFile:ge}),(!h||V==="file_asc"||V==="file_desc")&&Ge()},onError:async()=>{vt(I,U),_t(null)}})},[hr,_i,Nt,Kt,nt,De,vt,h,_e,Ge,V]),Mn=m.useCallback(Z=>{const ce=_i(Z),ve=hr(Z.output||"");if(!ce||!ve||le.has(ce)||jn.has(ce))return!1;Zn(ce,!0),On(ce);const Me=`delete:${ce}`,I=E.enqueue(Me,async()=>{await ht(Z,{alreadyRemoved:!0})});return I||Fn(ce),I},[E,_i,hr,le,jn,Zn,ht]),Yn=m.useCallback(Z=>{const ce=_i(Z),ve=hr(Z.output||"");if(!ce||!ve||jn.has(ce)||le.has(ce))return!1;rn(ce,!0),On(ce);const Me=`keep:${ce}`,I=E.enqueue(Me,async()=>{await Ht(Z,{alreadyRemoved:!0})});return I||Fn(ce),I},[E,_i,hr,jn,le,rn,Ht]),nr=m.useCallback(Z=>{const ce=_i(Z);if(!ce||Nt.has(ce))return!1;const ve=`hot:${ce}`;return E.enqueue(ve,async()=>{await sn(Z)})},[E,_i,sn,Nt]),Wn=m.useCallback(Z=>{const ce=_y(Z.output||""),ve=hr(ce),Me=Ne[ve];if(!Me)return Z;const I=ce.lastIndexOf("/"),U=I>=0?ce.slice(0,I+1):"";return{...Z,output:U+Me}},[Ne]),Wi=Ie??e,Hi=Ct??A,Si=m.useMemo(()=>{const Z=new Map;for(const ve of Wi){const Me=Wn(ve);Z.set(_i(Me),Me)}for(const ve of n){const Me=Wn(ve),I=_i(Me);Z.has(I)&&Z.set(I,{...Z.get(I),...Me})}return Array.from(Z.values()).filter(ve=>F.has(_i(ve))||A3(ve.output)?!1:ve.status==="finished"||ve.status==="failed"||ve.status==="stopped")},[n,Wi,F,Wn]),Xi=m.useRef(new Map);m.useEffect(()=>{const Z=new Map;for(const ce of Si){const ve=hr(ce.output||"");ve&&Z.set(ve,_i(ce))}Xi.current=Z},[Si]),m.useEffect(()=>{const Z=ce=>{const ve=ce.detail;if(!ve?.file)return;const Me=Xi.current.get(ve.file)||ve.file;if(ve.phase==="start"){Zn(Me,!0),On(Me);return}if(ve.phase==="error"){Fn(Me),Xt.current.get(Me)?.reset();return}if(ve.phase==="success"){Zn(Me,!1);return}};return window.addEventListener("finished-downloads:delete",Z),()=>window.removeEventListener("finished-downloads:delete",Z)},[On,Zn,Ge,Fn]),m.useEffect(()=>{const Z=()=>{if(we.current){Be.current||(Be.current=!0);return}We.current==null&&Ge()};return window.addEventListener("finished-downloads:reload",Z),()=>window.removeEventListener("finished-downloads:reload",Z)},[Ge]),m.useEffect(()=>{const Z=ce=>{const ve=ce.detail,Me=String(ve?.oldFile??"").trim(),I=String(ve?.newFile??"").trim();!Me||!I||Me===I||De(Me,I)};return window.addEventListener("finished-downloads:rename",Z),()=>window.removeEventListener("finished-downloads:rename",Z)},[De]);const ii=m.useMemo(()=>{const Z=Si.filter(ve=>!F.has(_i(ve))),ce=Pn.length?Z.filter(ve=>{const Me=hr(ve.output||""),I=Bc(ve.output),U=os(I),te=$t.tagsByModelKey[U]??[],ye=os([Me,Wr(Me),I,ve.id,te.join(" ")].join(" "));for(const ge of Pn)if(!ye.includes(ge))return!1;return!0}):Z;return It.size===0?ce:ce.filter(ve=>{const Me=os(Bc(ve.output)),I=$t.tagSetByModelKey[Me];if(!I||I.size===0)return!1;for(const U of It)if(!I.has(U))return!1;return!0})},[Si,F,It,$t,Pn]),Mi=P?ii.length:Hi,Ti=m.useMemo(()=>{if(!P)return ii;const Z=(C-1)*j,ce=Z+j;return ii.slice(Math.max(0,Z),Math.max(0,ce))},[P,ii,C,j]),Bi=!P&&Mi===0,ir=D&&ii.length===0,hi=Y&&ii.length===0,Yi=L&&(Bi||hi||ir);m.useEffect(()=>{if(!D)return;const Z=Math.max(1,Math.ceil(ii.length/j));C>Z&&k(Z)},[D,ii.length,C,j,k]),m.useEffect(()=>{if(!(G==="hover"&&!O&&(qe==="cards"||qe==="gallery"||qe==="table"))){q(null),se.current?.disconnect(),se.current=null;return}if(qe==="cards"&&Zt?.key){q(Zt.key);return}se.current?.disconnect();const ce=new IntersectionObserver(ve=>{let Me=null,I=0;for(const U of ve){if(!U.isIntersecting)continue;const te=$.current.get(U.target);te&&U.intersectionRatio>I&&(I=U.intersectionRatio,Me=te)}Me&&q(U=>U===Me?U:Me)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});se.current=ce;for(const[ve,Me]of R.current)$.current.set(Me,ve),ce.observe(Me);return()=>{ce.disconnect(),se.current===ce&&(se.current=null)}},[qe,G,O,Zt?.key]);const Pi=Z=>{const ce=_i(Z),ve=yt[ce]??Z?.durationSeconds;if(typeof ve=="number"&&Number.isFinite(ve)&&ve>0)return X1(ve*1e3);const Me=Date.parse(String(Z.startedAt||"")),I=Date.parse(String(Z.endedAt||""));return Number.isFinite(Me)&&Number.isFinite(I)&&I>Me?X1(I-Me):"—"},ae=m.useCallback(Z=>ce=>{const ve=R.current.get(Z);ve&&se.current&&se.current.unobserve(ve),ce?(R.current.set(Z,ce),$.current.set(ce,Z),se.current?.observe(ce)):R.current.delete(Z)},[]),ke=m.useCallback((Z,ce)=>{if(!Number.isFinite(ce)||ce<=0)return;const ve=_i(Z),Me=un.current[ve];typeof Me=="number"&&Math.abs(Me-ce)<.5||(un.current={...un.current,[ve]:ce},Bt())},[Bt]),pt=m.useCallback((Z,ce,ve)=>{if(!Number.isFinite(ce)||!Number.isFinite(ve)||ce<=0||ve<=0)return;const Me=_i(Z),I=xn.current[Me];I&&I.w===ce&&I.h===ve||(xn.current={...xn.current,[Me]:{w:ce,h:ve}},qt())},[qt]),xt=Y1("(max-width: 639px)"),Rt="mt-10",Et="mb-2";return m.useEffect(()=>{if(!xt||qe!=="cards")return;const Z=Ti[0];if(!Z){q(null);return}const ce=_i(Z);q(Me=>Me===ce?Me:null);const ve=window.setTimeout(()=>{q(Me=>Me===ce?Me:ce)},140);return()=>window.clearTimeout(ve)},[xt,qe,Ti,_i]),m.useEffect(()=>{xt||(Xt.current=new Map)},[xt]),m.useEffect(()=>{Bi&&C!==1&&k(1)},[Bi,C,k]),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:Mi})]}),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:Mi})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[L?c.jsx(W1,{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:Ot,onChange:Z=>en(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
|
||
`}),(Ot||"").trim()!==""?c.jsx(hn,{size:"sm",variant:"soft",onClick:St,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(Na,{label:"Behaltene Downloads anzeigen",checked:Ce,onChange:Z=>{C!==1&&k(1),Pe(Z)}})}),qe!=="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:V,onChange:Z=>{const ce=Z.target.value;W(ce),C!==1&&k(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(hn,{size:"md",variant:"soft",disabled:!Te||dt,onClick:wt,title:Te?`Letzte Aktion rückgängig machen (${Te.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Pg,{value:qe,onChange:Z=>Le(Z),size:xt?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(yN,{className:xt?"size-4":"size-5"}),label:xt?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(dN,{className:xt?"size-4":"size-5"}),label:xt?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(mN,{className:xt?"size-4":"size-5"}),label:xt?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:()=>At(Z=>!Z),"aria-expanded":Qe,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(NA,{className:"size-5"}),D||Ce?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]})]})]}),kt.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:[kt.map(Z=>c.jsx(ws,{tag:Z,active:!0,onClick:Tn},Z)),c.jsx(hn,{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:Re,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",Qe?"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:Ot,onChange:Z=>en(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
|
||
`}),(Ot||"").trim()!==""?c.jsx(hn,{size:"sm",variant:"soft",onClick:St,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(Ig,{checked:Ce,onChange:Z=>{C!==1&&k(1),Pe(Z)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),qe!=="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:V,onChange:Z=>{const ce=Z.target.value;W(ce),C!==1&&k(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]})}),kt.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:[kt.map(Z=>c.jsx(ws,{tag:Z,active:!0,onClick:Tn},Z)),c.jsx(hn,{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:Re,children:"Zurücksetzen"})]})]})}):null]})]})}),Yi?c.jsx(Is,{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(W1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):Bi||hi?c.jsx(Is,{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."})]})]})}):ir?c.jsxs(Is,{grayBody:!0,children:[c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),kt.length>0||(Ot||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[kt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:Re,children:"Tag-Filter zurücksetzen"}):null,(Ot||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:St,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[qe==="cards"&&c.jsx("div",{className:xt?`${Rt} ${Et}`:"",children:c.jsx(r3,{rows:Ti,isSmall:xt,isLoading:L,blurPreviews:t,durations:yt,teaserKey:ee,teaserPlayback:G,teaserAudio:a,hoverTeaserKey:Q,inlinePlay:Zt,deletingKeys:le,keepingKeys:jn,removingKeys:Di,swipeRefs:Xt,keyFor:_i,baseName:hr,modelNameFromOutput:Bc,runtimeOf:Pi,sizeBytesOf:B0,formatBytes:I0,lower:os,onOpenPlayer:l,openPlayer:Xn,onOpenPlayerAt:Gn,handleScrubberClickIndex:ln,startInlineAt:Qn,startInline:Ft,tryAutoplayInline:Nn,registerTeaserHost:ae,handleDuration:ke,deleteVideo:ht,keepVideo:Ht,releasePlayingFile:$n,modelsByKey:H,onToggleHot:sn,onToggleFavorite:f,onToggleLike:g,onToggleWatch:w,activeTagSet:It,onToggleTagFilter:Tn,onHoverPreviewKeyChange:ue,assetNonce:B??0,enqueueDeleteVideo:Mn,enqueueKeepVideo:Yn,enqueueToggleHot:nr})}),qe==="table"&&c.jsx(f3,{rows:Ti,isLoading:L,keyFor:_i,baseName:hr,lower:os,modelNameFromOutput:Bc,runtimeOf:Pi,sizeBytesOf:B0,formatBytes:I0,resolutions:cn,durations:yt,canHover:O,teaserAudio:a,hoverTeaserKey:Q,setHoverTeaserKey:ue,teaserPlayback:G,teaserKey:ee,registerTeaserHost:ae,handleDuration:ke,handleResolution:pt,blurPreviews:t,assetNonce:B,deletingKeys:le,keepingKeys:jn,removingKeys:Di,modelsByKey:H,activeTagSet:It,onToggleTagFilter:Tn,onOpenPlayer:l,handleScrubberClickIndex:ln,onSortModeChange:W,page:C,onPageChange:k,onToggleHot:sn,onToggleFavorite:f,onToggleLike:g,onToggleWatch:w,deleteVideo:ht,keepVideo:Ht,enqueueDeleteVideo:Mn,enqueueKeepVideo:Yn,enqueueToggleHot:nr}),qe==="gallery"&&c.jsx(y3,{rows:Ti,isLoading:L,blurPreviews:t,durations:yt,handleDuration:ke,teaserKey:ee,teaserPlayback:G,teaserAudio:a,hoverTeaserKey:Q,keyFor:_i,baseName:hr,modelNameFromOutput:Bc,runtimeOf:Pi,sizeBytesOf:B0,formatBytes:I0,deletingKeys:le,keepingKeys:jn,removingKeys:Di,deletedKeys:F,registerTeaserHost:ae,onOpenPlayer:l,handleScrubberClickIndex:ln,deleteVideo:ht,keepVideo:Ht,onToggleHot:sn,lower:os,modelsByKey:H,onToggleFavorite:f,onToggleLike:g,onToggleWatch:w,activeTagSet:It,onToggleTagFilter:Tn,onHoverPreviewKeyChange:ue,enqueueDeleteVideo:Mn,enqueueKeepVideo:Yn,enqueueToggleHot:nr}),c.jsx(Cf,{page:C,pageSize:j,totalItems:Mi,onPageChange:Z=>{vu.flushSync(()=>{zt(null),q(null),ue(null)});for(const ce of Ti){const ve=hr(ce.output||"");ve&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:ve}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:ve}})))}window.scrollTo({top:0,behavior:"auto"}),k(Z)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var F0,J1;function om(){if(J1)return F0;J1=1;var n;return typeof window<"u"?n=window:typeof bf<"u"?n=bf:typeof self<"u"?n=self:n={},F0=n,F0}var j3=om();const he=Ru(j3),O3={},L3=Object.freeze(Object.defineProperty({__proto__:null,default:O3},Symbol.toStringTag,{value:"Module"})),I3=ZE(L3);var U0,e2;function Fw(){if(e2)return U0;e2=1;var n=typeof bf<"u"?bf:typeof window<"u"?window:{},e=I3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),U0=t,U0}var B3=Fw();const Tt=Ru(B3);var Wh={exports:{}},z0={exports:{}},t2;function P3(){return t2||(t2=1,(function(n){function e(){return n.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var a=arguments[i];for(var l in a)({}).hasOwnProperty.call(a,l)&&(t[l]=a[l])}return t},n.exports.__esModule=!0,n.exports.default=n.exports,e.apply(null,arguments)}n.exports=e,n.exports.__esModule=!0,n.exports.default=n.exports})(z0)),z0.exports}var H0,n2;function F3(){if(n2)return H0;n2=1,H0=e;var n=Object.prototype.toString;function e(t){if(!t)return!1;var i=n.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return H0}var $0,i2;function U3(){if(i2)return $0;i2=1;function n(a,l){var u=typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(u)return(u=u.call(a)).next.bind(u);if(Array.isArray(a)||(u=e(a))||l){u&&(a=u);var h=0;return function(){return h>=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<l;u++)h[u]=a[u];return h}var i=(function(){function a(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var l=a.prototype;return l.getIsEnabled=function(){return this.enabled_},l.enable=function(){this.enabled_=!0},l.disable=function(){this.enabled_=!1},l.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},l.addInterceptor=function(h,f){this.typeToInterceptorsMap_.has(h)||this.typeToInterceptorsMap_.set(h,new Set);var g=this.typeToInterceptorsMap_.get(h);return g.has(f)?!1:(g.add(f),!0)},l.removeInterceptor=function(h,f){var g=this.typeToInterceptorsMap_.get(h);return g&&g.has(f)?(g.delete(f),!0):!1},l.clearInterceptorsByType=function(h){var f=this.typeToInterceptorsMap_.get(h);return f?(this.typeToInterceptorsMap_.delete(h),this.typeToInterceptorsMap_.set(h,new Set),!0):!1},l.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},l.getForType=function(h){return this.typeToInterceptorsMap_.get(h)||new Set},l.execute=function(h,f){for(var g=this.getForType(h),w=n(g),S;!(S=w()).done;){var A=S.value;try{f=A(f)}catch{}}return f},a})();return $0=i,$0}var q0,r2;function z3(){if(r2)return q0;r2=1;var n=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(l){this.maxAttempts_=l},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(l){this.delayFactor_=l},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(l){this.fuzzFactor_=l},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(l){this.initialDelay_=l},i.createRetry=function(l){var u=l===void 0?{}:l,h=u.maxAttempts,f=u.delayFactor,g=u.fuzzFactor,w=u.initialDelay;return new e({maxAttempts:h||this.maxAttempts_,delayFactor:f||this.delayFactor_,fuzzFactor:g||this.fuzzFactor_,initialDelay:w||this.initialDelay_})},t})(),e=(function(){function t(a){this.maxAttempts_=a.maxAttempts,this.delayFactor_=a.delayFactor,this.fuzzFactor_=a.fuzzFactor,this.currentDelay_=a.initialDelay,this.currentAttempt_=1}var i=t.prototype;return i.moveToNextAttempt=function(){this.currentAttempt_++;var l=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+l},i.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},i.getCurrentDelay=function(){return this.currentDelay_},i.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},i.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},i.getCurrentFuzzedDelay=function(){var l=this.getCurrentMinPossibleDelay(),u=this.getCurrentMaxPossibleDelay();return l+Math.random()*(u-l)},t})();return q0=n,q0}var V0,s2;function H3(){if(s2)return V0;s2=1;var n=om(),e=function(a,l){return l===void 0&&(l=!1),function(u,h,f){if(u){a(u);return}if(h.statusCode>=400&&h.statusCode<=599){var g=f;if(l)if(n.TextDecoder){var w=t(h.headers&&h.headers["content-type"]);try{g=new TextDecoder(w).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 V0=e,V0}var a2;function $3(){if(a2)return Wh.exports;a2=1;var n=om(),e=P3(),t=F3(),i=U3(),a=z3();g.httpHandler=H3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(j){var k={};return j&&j.trim().split(`
|
||
`).forEach(function(B){var V=B.indexOf(":"),W=B.slice(0,V).trim().toLowerCase(),H=B.slice(V+1).trim();typeof k[W]>"u"?k[W]=H:Array.isArray(k[W])?k[W].push(H):k[W]=[k[W],H]}),k};Wh.exports=g,Wh.exports.default=g,g.XMLHttpRequest=n.XMLHttpRequest||A,g.XDomainRequest="withCredentials"in new g.XMLHttpRequest?g.XMLHttpRequest:n.XDomainRequest,u(["get","put","post","patch","head","delete"],function(C){g[C==="delete"?"del":C]=function(j,k,B){return k=f(j,k,B),k.method=C.toUpperCase(),w(k)}});function u(C,j){for(var k=0;k<C.length;k++)j(C[k])}function h(C){for(var j in C)if(C.hasOwnProperty(j))return!1;return!0}function f(C,j,k){var B=C;return t(j)?(k=j,typeof C=="string"&&(B={uri:C})):B=e({},j,{uri:C}),B.callback=k,B}function g(C,j,k){return j=f(C,j,k),w(j)}function w(C){if(typeof C.callback>"u")throw new Error("callback argument missing");if(C.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var j={uri:C.uri||C.url,headers:C.headers||{},body:C.body,metadata:C.metadata||{},retry:C.retry,timeout:C.timeout},k=g.requestInterceptorsStorage.execute(C.requestType,j);C.uri=k.uri,C.headers=k.headers,C.body=k.body,C.metadata=k.metadata,C.retry=k.retry,C.timeout=k.timeout}var B=!1,V=function(X,le,de){B||(B=!0,C.callback(X,le,de))};function W(){G.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(Y,0)}function H(){var F=void 0;if(G.response?F=G.response:F=G.responseText||S(G),ue)try{F=JSON.parse(F)}catch{}return F}function ie(F){if(clearTimeout(se),clearTimeout(C.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!re&&g.retryManager.getIsEnabled()&&C.retry&&C.retry.shouldRetry()){C.retryTimeout=setTimeout(function(){C.retry.moveToNextAttempt(),C.xhr=G,w(C)},C.retry.getCurrentFuzzedDelay());return}if(C.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var X={headers:$.headers||{},body:$.body,responseUrl:G.responseURL,responseType:G.responseType},le=g.responseInterceptorsStorage.execute(C.requestType,X);$.body=le.body,$.headers=le.headers}return V(F,$)}function Y(){if(!re){var F;clearTimeout(se),clearTimeout(C.retryTimeout),C.useXDR&&G.status===void 0?F=200:F=G.status===1223?204:G.status;var X=$,le=null;if(F!==0?(X={body:H(),statusCode:F,method:R,headers:{},url:E,rawRequest:G},G.getAllResponseHeaders&&(X.headers=l(G.getAllResponseHeaders()))):le=new Error("Internal XMLHttpRequest Error"),C.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var de={headers:X.headers||{},body:X.body,responseUrl:G.responseURL,responseType:G.responseType},L=g.responseInterceptorsStorage.execute(C.requestType,de);X.body=L.body,X.headers=L.headers}return V(le,X,X.body)}}var G=C.xhr||null;G||(C.cors||C.useXDR?G=new g.XDomainRequest:G=new g.XMLHttpRequest);var O,re,E=G.url=C.uri||C.url,R=G.method=C.method||"GET",ee=C.body||C.data,q=G.headers=C.headers||{},Q=!!C.sync,ue=!1,se,$={body:void 0,headers:{},statusCode:0,method:R,url:E,rawRequest:G};if("json"in C&&C.json!==!1&&(ue=!0,q.accept||q.Accept||(q.Accept="application/json"),R!=="GET"&&R!=="HEAD"&&(q["content-type"]||q["Content-Type"]||(q["Content-Type"]="application/json"),ee=JSON.stringify(C.json===!0?ee:C.json))),G.onreadystatechange=W,G.onload=Y,G.onerror=ie,G.onprogress=function(){},G.onabort=function(){re=!0,clearTimeout(C.retryTimeout)},G.ontimeout=ie,G.open(R,E,!Q,C.username,C.password),Q||(G.withCredentials=!!C.withCredentials),!Q&&C.timeout>0&&(se=setTimeout(function(){if(!re){re=!0,G.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",ie(F)}},C.timeout)),G.setRequestHeader)for(O in q)q.hasOwnProperty(O)&&G.setRequestHeader(O,q[O]);else if(C.headers&&!h(C.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in C&&(G.responseType=C.responseType),"beforeSend"in C&&typeof C.beforeSend=="function"&&C.beforeSend(G),G.send(ee||null),G}function S(C){try{if(C.responseType==="document")return C.responseXML;var j=C.responseXML&&C.responseXML.documentElement.nodeName==="parsererror";if(C.responseType===""&&!j)return C.responseXML}catch{}return null}function A(){}return Wh.exports}var q3=$3();const Uw=Ru(q3);var G0={exports:{}},K0,o2;function V3(){if(o2)return K0;o2=1;var n=Fw(),e=Object.create||(function(){function E(){}return function(R){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return E.prototype=R,new E}})();function t(E,R){this.name="ParsingError",this.code=E.code,this.message=R||E.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(E){function R(q,Q,ue,se){return(q|0)*3600+(Q|0)*60+(ue|0)+(se|0)/1e3}var ee=E.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return ee?ee[3]?R(ee[1],ee[2],ee[3].replace(":",""),ee[4]):ee[1]>59?R(ee[1],ee[2],0,ee[4]):R(0,ee[1],ee[2],ee[4]):null}function a(){this.values=e(null)}a.prototype={set:function(E,R){!this.get(E)&&R!==""&&(this.values[E]=R)},get:function(E,R,ee){return ee?this.has(E)?this.values[E]:R[ee]:this.has(E)?this.values[E]:R},has:function(E){return E in this.values},alt:function(E,R,ee){for(var q=0;q<ee.length;++q)if(R===ee[q]){this.set(E,R);break}},integer:function(E,R){/^-?\d+$/.test(R)&&this.set(E,parseInt(R,10))},percent:function(E,R){return R.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(R=parseFloat(R),R>=0&&R<=100)?(this.set(E,R),!0):!1}};function l(E,R,ee,q){var Q=q?E.split(q):[E];for(var ue in Q)if(typeof Q[ue]=="string"){var se=Q[ue].split(ee);if(se.length===2){var $=se[0].trim(),F=se[1].trim();R($,F)}}}function u(E,R,ee){var q=E;function Q(){var $=i(E);if($===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+q);return E=E.replace(/^[^\sa-zA-Z-]+/,""),$}function ue($,F){var X=new a;l($,function(le,de){switch(le){case"region":for(var L=ee.length-1;L>=0;L--)if(ee[L].id===de){X.set(le,ee[L].region);break}break;case"vertical":X.alt(le,de,["rl","lr"]);break;case"line":var pe=de.split(","),we=pe[0];X.integer(le,we),X.percent(le,we)&&X.set("snapToLines",!1),X.alt(le,we,["auto"]),pe.length===2&&X.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=de.split(","),X.percent(le,pe[0]),pe.length===2&&X.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":X.percent(le,de);break;case"align":X.alt(le,de,["start","center","end","left","right"]);break}},/:/,/\s/),F.region=X.get("region",null),F.vertical=X.get("vertical","");try{F.line=X.get("line","auto")}catch{}F.lineAlign=X.get("lineAlign","start"),F.snapToLines=X.get("snapToLines",!0),F.size=X.get("size",100);try{F.align=X.get("align","center")}catch{F.align=X.get("align","middle")}try{F.position=X.get("position","auto")}catch{F.position=X.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},F.align)}F.positionAlign=X.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},F.align)}function se(){E=E.replace(/^\s+/,"")}if(se(),R.startTime=Q(),se(),E.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+q);E=E.substr(3),se(),R.endTime=Q(),se(),ue(E,R)}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)"},w={v:"title",lang:"lang"},S={rt:"ruby"};function A(E,R){function ee(){if(!R)return null;function we(Ve){return R=R.substr(Ve.length),Ve}var Be=R.match(/^([^<]*)(<[^>]*>?)?/);return we(Be[1]?Be[1]:Be[2])}function q(we){return h.innerHTML=we,we=h.textContent,h.textContent="",we}function Q(we,Be){return!S[Be.localName]||S[Be.localName]===we.localName}function ue(we,Be){var Ve=f[we];if(!Ve)return null;var Oe=E.document.createElement(Ve),Te=w[we];return Te&&Be&&(Oe[Te]=Be.trim()),Oe}for(var se=E.document.createElement("div"),$=se,F,X=[];(F=ee())!==null;){if(F[0]==="<"){if(F[1]==="/"){X.length&&X[X.length-1]===F.substr(2).replace(">","")&&(X.pop(),$=$.parentNode);continue}var le=i(F.substr(1,F.length-2)),de;if(le){de=E.document.createProcessingInstruction("timestamp",le),$.appendChild(de);continue}var L=F.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!L||(de=ue(L[1],L[3]),!de)||!Q($,de))continue;if(L[2]){var pe=L[2].split(".");pe.forEach(function(we){var Be=/^bg_/.test(we),Ve=Be?we.slice(3):we;if(g.hasOwnProperty(Ve)){var Oe=Be?"background-color":"color",Te=g[Ve];de.style[Oe]=Te}}),de.className=pe.join(" ")}X.push(L[1]),$.appendChild(de),$=de;continue}$.appendChild(E.document.createTextNode(q(F)))}return se}var C=[[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 j(E){for(var R=0;R<C.length;R++){var ee=C[R];if(E>=ee[0]&&E<=ee[1])return!0}return!1}function k(E){var R=[],ee="",q;if(!E||!E.childNodes)return"ltr";function Q($,F){for(var X=F.childNodes.length-1;X>=0;X--)$.push(F.childNodes[X])}function ue($){if(!$||!$.length)return null;var F=$.pop(),X=F.textContent||F.innerText;if(X){var le=X.match(/^.*(\n|\r)/);return le?($.length=0,le[0]):X}if(F.tagName==="ruby")return ue($);if(F.childNodes)return Q($,F),ue($)}for(Q(R,E);ee=ue(R);)for(var se=0;se<ee.length;se++)if(q=ee.charCodeAt(se),j(q))return"rtl";return"ltr"}function B(E){if(typeof E.line=="number"&&(E.snapToLines||E.line>=0&&E.line<=100))return E.line;if(!E.track||!E.track.textTrackList||!E.track.textTrackList.mediaElement)return-1;for(var R=E.track,ee=R.textTrackList,q=0,Q=0;Q<ee.length&&ee[Q]!==R;Q++)ee[Q].mode==="showing"&&q++;return++q*-1}function V(){}V.prototype.applyStyles=function(E,R){R=R||this.div;for(var ee in E)E.hasOwnProperty(ee)&&(R.style[ee]=E[ee])},V.prototype.formatStyle=function(E,R){return E===0?0:E+R};function W(E,R,ee){V.call(this),this.cue=R,this.cueDiv=A(E,R.text);var q={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:R.vertical===""?"horizontal-tb":R.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(q,this.cueDiv),this.div=E.document.createElement("div"),q={direction:k(this.cueDiv),writingMode:R.vertical===""?"horizontal-tb":R.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:R.align==="middle"?"center":R.align,font:ee.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(q),this.div.appendChild(this.cueDiv);var Q=0;switch(R.positionAlign){case"start":case"line-left":Q=R.position;break;case"center":Q=R.position-R.size/2;break;case"end":case"line-right":Q=R.position-R.size;break}R.vertical===""?this.applyStyles({left:this.formatStyle(Q,"%"),width:this.formatStyle(R.size,"%")}):this.applyStyles({top:this.formatStyle(Q,"%"),height:this.formatStyle(R.size,"%")}),this.move=function(ue){this.applyStyles({top:this.formatStyle(ue.top,"px"),bottom:this.formatStyle(ue.bottom,"px"),left:this.formatStyle(ue.left,"px"),right:this.formatStyle(ue.right,"px"),height:this.formatStyle(ue.height,"px"),width:this.formatStyle(ue.width,"px")})}}W.prototype=e(V.prototype),W.prototype.constructor=W;function H(E){var R,ee,q,Q;if(E.div){ee=E.div.offsetHeight,q=E.div.offsetWidth,Q=E.div.offsetTop;var ue=(ue=E.div.childNodes)&&(ue=ue[0])&&ue.getClientRects&&ue.getClientRects();E=E.div.getBoundingClientRect(),R=ue?Math.max(ue[0]&&ue[0].height||0,E.height/ue.length):0}this.left=E.left,this.right=E.right,this.top=E.top||Q,this.height=E.height||ee,this.bottom=E.bottom||Q+(E.height||ee),this.width=E.width||q,this.lineHeight=R!==void 0?R:E.lineHeight}H.prototype.move=function(E,R){switch(R=R!==void 0?R:this.lineHeight,E){case"+x":this.left+=R,this.right+=R;break;case"-x":this.left-=R,this.right-=R;break;case"+y":this.top+=R,this.bottom+=R;break;case"-y":this.top-=R,this.bottom-=R;break}},H.prototype.overlaps=function(E){return this.left<E.right&&this.right>E.left&&this.top<E.bottom&&this.bottom>E.top},H.prototype.overlapsAny=function(E){for(var R=0;R<E.length;R++)if(this.overlaps(E[R]))return!0;return!1},H.prototype.within=function(E){return this.top>=E.top&&this.bottom<=E.bottom&&this.left>=E.left&&this.right<=E.right},H.prototype.overlapsOppositeAxis=function(E,R){switch(R){case"+x":return this.left<E.left;case"-x":return this.right>E.right;case"+y":return this.top<E.top;case"-y":return this.bottom>E.bottom}},H.prototype.intersectPercentage=function(E){var R=Math.max(0,Math.min(this.right,E.right)-Math.max(this.left,E.left)),ee=Math.max(0,Math.min(this.bottom,E.bottom)-Math.max(this.top,E.top)),q=R*ee;return q/(this.height*this.width)},H.prototype.toCSSCompatValues=function(E){return{top:this.top-E.top,bottom:E.bottom-this.bottom,left:this.left-E.left,right:E.right-this.right,height:this.height,width:this.width}},H.getSimpleBoxPosition=function(E){var R=E.div?E.div.offsetHeight:E.tagName?E.offsetHeight:0,ee=E.div?E.div.offsetWidth:E.tagName?E.offsetWidth:0,q=E.div?E.div.offsetTop:E.tagName?E.offsetTop:0;E=E.div?E.div.getBoundingClientRect():E.tagName?E.getBoundingClientRect():E;var Q={left:E.left,right:E.right,top:E.top||q,height:E.height||R,bottom:E.bottom||q+(E.height||R),width:E.width||ee};return Q};function ie(E,R,ee,q){function Q(Ve,Oe){for(var Te,_t=new H(Ve),dt=1,xe=0;xe<Oe.length;xe++){for(;Ve.overlapsOppositeAxis(ee,Oe[xe])||Ve.within(ee)&&Ve.overlapsAny(q);)Ve.move(Oe[xe]);if(Ve.within(ee))return Ve;var Ne=Ve.intersectPercentage(ee);dt>Ne&&(Te=new H(Ve),dt=Ne),Ve=new H(_t)}return Te||_t}var ue=new H(R),se=R.cue,$=B(se),F=[];if(se.snapToLines){var X;switch(se.vertical){case"":F=["+y","-y"],X="height";break;case"rl":F=["+x","-x"],X="width";break;case"lr":F=["-x","+x"],X="width";break}var le=ue.lineHeight,de=le*Math.round($),L=ee[X]+le,pe=F[0];Math.abs(de)>L&&(de=de<0?-1:1,de*=Math.ceil(L/le)*le),$<0&&(de+=se.vertical===""?ee.height:ee.width,F=F.reverse()),ue.move(pe,de)}else{var we=ue.lineHeight/ee.height*100;switch(se.lineAlign){case"center":$-=we/2;break;case"end":$-=we;break}switch(se.vertical){case"":R.applyStyles({top:R.formatStyle($,"%")});break;case"rl":R.applyStyles({left:R.formatStyle($,"%")});break;case"lr":R.applyStyles({right:R.formatStyle($,"%")});break}F=["+y","-x","+x","-y"],ue=new H(R)}var Be=Q(ue,F);R.move(Be.toCSSCompatValues(ee))}function Y(){}Y.StringDecoder=function(){return{decode:function(E){if(!E)return"";if(typeof E!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(E))}}},Y.convertCueToDOMTree=function(E,R){return!E||!R?null:A(E,R)};var G=.05,O="sans-serif",re="1.5%";return Y.processCues=function(E,R,ee){if(!E||!R||!ee)return null;for(;ee.firstChild;)ee.removeChild(ee.firstChild);var q=E.document.createElement("div");q.style.position="absolute",q.style.left="0",q.style.right="0",q.style.top="0",q.style.bottom="0",q.style.margin=re,ee.appendChild(q);function Q(le){for(var de=0;de<le.length;de++)if(le[de].hasBeenReset||!le[de].displayState)return!0;return!1}if(!Q(R)){for(var ue=0;ue<R.length;ue++)q.appendChild(R[ue].displayState);return}var se=[],$=H.getSimpleBoxPosition(q),F=Math.round($.height*G*100)/100,X={font:F+"px "+O};(function(){for(var le,de,L=0;L<R.length;L++)de=R[L],le=new W(E,de,X),q.appendChild(le.div),ie(E,le,$,se),de.displayState=le.div,se.push(H.getSimpleBoxPosition(le))})()},Y.Parser=function(E,R,ee){ee||(ee=R,R={}),R||(R={}),this.window=E,this.vttjs=R,this.state="INITIAL",this.buffer="",this.decoder=ee||new TextDecoder("utf8"),this.regionList=[]},Y.Parser.prototype={reportOrThrowError:function(E){if(E instanceof t)this.onparsingerror&&this.onparsingerror(E);else throw E},parse:function(E){var R=this;E&&(R.buffer+=R.decoder.decode(E,{stream:!0}));function ee(){for(var le=R.buffer,de=0;de<le.length&&le[de]!=="\r"&&le[de]!==`
|
||
`;)++de;var L=le.substr(0,de);return le[de]==="\r"&&++de,le[de]===`
|
||
`&&++de,R.buffer=le.substr(de),L}function q(le){var de=new a;if(l(le,function(pe,we){switch(pe){case"id":de.set(pe,we);break;case"width":de.percent(pe,we);break;case"lines":de.integer(pe,we);break;case"regionanchor":case"viewportanchor":var Be=we.split(",");if(Be.length!==2)break;var Ve=new a;if(Ve.percent("x",Be[0]),Ve.percent("y",Be[1]),!Ve.has("x")||!Ve.has("y"))break;de.set(pe+"X",Ve.get("x")),de.set(pe+"Y",Ve.get("y"));break;case"scroll":de.alt(pe,we,["up"]);break}},/=/,/\s/),de.has("id")){var L=new(R.vttjs.VTTRegion||R.window.VTTRegion);L.width=de.get("width",100),L.lines=de.get("lines",3),L.regionAnchorX=de.get("regionanchorX",0),L.regionAnchorY=de.get("regionanchorY",100),L.viewportAnchorX=de.get("viewportanchorX",0),L.viewportAnchorY=de.get("viewportanchorY",100),L.scroll=de.get("scroll",""),R.onregion&&R.onregion(L),R.regionList.push({id:de.get("id"),region:L})}}function Q(le){var de=new a;l(le,function(L,pe){switch(L){case"MPEGT":de.integer(L+"S",pe);break;case"LOCA":de.set(L+"L",i(pe));break}},/[^\d]:/,/,/),R.ontimestampmap&&R.ontimestampmap({MPEGTS:de.get("MPEGTS"),LOCAL:de.get("LOCAL")})}function ue(le){le.match(/X-TIMESTAMP-MAP/)?l(le,function(de,L){de==="X-TIMESTAMP-MAP"&&Q(L)},/=/):l(le,function(de,L){de==="Region"&&q(L)},/:/)}try{var se;if(R.state==="INITIAL"){if(!/\r\n|\n/.test(R.buffer))return this;se=ee();var $=se.match(/^WEBVTT([ \t].*)?$/);if(!$||!$[0])throw new t(t.Errors.BadSignature);R.state="HEADER"}for(var F=!1;R.buffer;){if(!/\r\n|\n/.test(R.buffer))return this;switch(F?F=!1:se=ee(),R.state){case"HEADER":/:/.test(se)?ue(se):se||(R.state="ID");continue;case"NOTE":se||(R.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(se)){R.state="NOTE";break}if(!se)continue;R.cue=new(R.vttjs.VTTCue||R.window.VTTCue)(0,0,"");try{R.cue.align="center"}catch{R.cue.align="middle"}if(R.state="CUE",se.indexOf("-->")===-1){R.cue.id=se;continue}case"CUE":try{u(se,R.cue,R.regionList)}catch(le){R.reportOrThrowError(le),R.cue=null,R.state="BADCUE";continue}R.state="CUETEXT";continue;case"CUETEXT":var X=se.indexOf("-->")!==-1;if(!se||X&&(F=!0)){R.oncue&&R.oncue(R.cue),R.cue=null,R.state="ID";continue}R.cue.text&&(R.cue.text+=`
|
||
`),R.cue.text+=se.replace(/\u2028/g,`
|
||
`).replace(/u2029/g,`
|
||
`);continue;case"BADCUE":se||(R.state="ID");continue}}}catch(le){R.reportOrThrowError(le),R.state==="CUETEXT"&&R.cue&&R.oncue&&R.oncue(R.cue),R.cue=null,R.state=R.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var E=this;try{if(E.buffer+=E.decoder.decode(),(E.cue||E.state==="HEADER")&&(E.buffer+=`
|
||
|
||
`,E.parse()),E.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(R){E.reportOrThrowError(R)}return E.onflush&&E.onflush(),this}},K0=Y,K0}var W0,l2;function G3(){if(l2)return W0;l2=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="",w=!1,S=u,A=h,C=f,j=null,k="",B=!0,V="auto",W="start",H="auto",ie="auto",Y=100,G="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(O){g=""+O}},pauseOnExit:{enumerable:!0,get:function(){return w},set:function(O){w=!!O}},startTime:{enumerable:!0,get:function(){return S},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");S=O,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return A},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");A=O,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return C},set:function(O){C=""+O,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return j},set:function(O){j=O,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return k},set:function(O){var re=i(O);if(re===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");k=re,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return B},set:function(O){B=!!O,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return V},set:function(O){if(typeof O!="number"&&O!==n)throw new SyntaxError("Line: an invalid number or illegal string was specified.");V=O,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return W},set:function(O){var re=a(O);re?(W=re,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return H},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");H=O,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return ie},set:function(O){var re=a(O);re?(ie=re,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return Y},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");Y=O,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return G},set:function(O){var re=a(O);if(!re)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");G=re,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},W0=l,W0}var X0,u2;function K3(){if(u2)return X0;u2=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,w="";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 w},set:function(S){var A=e(S);A===!1?console.warn("Scroll: an invalid or illegal string was specified."):w=A}}})}return X0=i,X0}var c2;function W3(){if(c2)return G0.exports;c2=1;var n=om(),e=G0.exports={WebVTT:V3(),VTTCue:G3(),VTTRegion:K3()};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(),G0.exports}var X3=W3();const d2=Ru(X3);function tr(){return tr=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},tr.apply(null,arguments)}var h2="https://example.com",lm=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=he.location&&he.location.href||"");var i=/^\/\//.test(e),a=!he.location&&!/\/\//i.test(e);e=new he.URL(e,he.location||h2);var l=new URL(t,e);return a?l.href.slice(h2.length):i?l.href.slice(l.protocol.length):l.href},wy=(function(){function n(){this.listeners={}}var e=n.prototype;return e.on=function(i,a){this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(a)},e.off=function(i,a){if(!this.listeners[i])return!1;var l=this.listeners[i].indexOf(a);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(l,1),l>-1},e.trigger=function(i){var a=this.listeners[i];if(a)if(arguments.length===2)for(var l=a.length,u=0;u<l;++u)a[u].call(this,arguments[1]);else for(var h=Array.prototype.slice.call(arguments,1),f=a.length,g=0;g<f;++g)a[g].apply(this,h)},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(a){i.push(a)})},n})(),Y3=function(e){return he.atob?he.atob(e):Buffer.from(e,"base64").toString("binary")};function zw(n){for(var e=Y3(n),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Q3 extends wy{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
||
`);t>-1;t=this.buffer.indexOf(`
|
||
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Z3=" ",Y0=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},J3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Mr=function(n){const e={};if(!n)return e;const t=n.split(J3());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},f2=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 eD extends wy{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;u<this.customParsers.length;u++)if(this.customParsers[u].call(this,l))return;if(l.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:l.slice(1)});return}if(l=l.replace("\r",""),t=/^#EXTM3U/.exec(l),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(l),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(l),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(l),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(l),t){i=tr(Y0(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(l),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(l),t){if(i={type:"tag",tagType:"map"},t[1]){const u=Mr(t[1]);u.URI&&(i.uri=u.URI),u.BYTERANGE&&(i.byterange=Y0(u.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(l),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=Mr(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=f2(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(l),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Mr(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(l),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(l),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(l),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(l),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Mr(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(l),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Mr(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(l),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=Mr(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(Z3)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=Mr(t[1]),["DURATION"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["INDEPENDENT","GAP"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/.test(i.attributes[u]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Y0(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=Mr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/.test(i.attributes[u]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=Mr(t[1]),["PART-TARGET"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=Mr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(u){if(i.attributes.hasOwnProperty(u)){i.attributes[u]=parseInt(i.attributes[u],10);const h=u==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[h]=i.attributes[u],delete i.attributes[u]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=Mr(t[1]),["LAST-MSN","LAST-PART"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseInt(i.attributes[u],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=Mr(t[1]),["ID","CLASS"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=String(i.attributes[h]))}),["START-DATE","END-DATE"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=new Date(i.attributes[h]))}),["DURATION","PLANNED-DURATION"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=parseFloat(i.attributes[h]))}),["END-ON-NEXT"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=/YES/i.test(i.attributes[h]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(h){i.attributes.hasOwnProperty(h)&&(i.attributes[h]=i.attributes[h].toString(16))});const u=/^X-([A-Z]+-)+[A-Z]+$/;for(const h in i.attributes){if(!u.test(h))continue;const f=/[0-9A-Fa-f]{6}/g.test(i.attributes[h]),g=/^\d+(\.\d+)?$/.test(i.attributes[h]);i.attributes[h]=f?i.attributes[h].toString(16):g?parseFloat(i.attributes[h]):String(i.attributes[h])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(l),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(l),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(l),t){i={type:"tag",tagType:"content-steering"},i.attributes=Mr(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(l),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=Mr(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=f2(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(l),t){i={type:"tag",tagType:"define"},i.attributes=Mr(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:l.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:a}){typeof i!="function"&&(i=l=>l),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 tD=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),yo=function(n){const e={};return Object.keys(n).forEach(function(t){e[tD(t)]=n[t]}),e},Q0=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]<h&&(this.trigger("warn",{message:`${a} clamping HOLD-BACK (${e[l]}) to targetDuration * 3 (${h})`}),e[l]=h),i&&!e.hasOwnProperty(u)&&(e[u]=i*3,this.trigger("info",{message:`${a} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[u]}).`})),i&&e[u]<f&&(this.trigger("warn",{message:`${a} clamping PART-HOLD-BACK (${e[u]}) to partTargetDuration * 2 (${f}).`}),e[u]=f)};class nD extends wy{constructor(e={}){super(),this.lineStream=new Q3,this.parseStream=new eD,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let a={},l,u,h=!1;const f=function(){},g={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},w="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let S=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let A=0,C=0;const j={};this.on("end",()=>{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(k){let B,V;if(t.manifest.definitions){for(const W in t.manifest.definitions)if(k.uri&&(k.uri=k.uri.replace(`{$${W}}`,t.manifest.definitions[W])),k.attributes)for(const H in k.attributes)typeof k.attributes[H]=="string"&&(k.attributes[H]=k.attributes[H].replace(`{$${W}}`,t.manifest.definitions[W]))}({tag(){({version(){k.version&&(this.manifest.version=k.version)},"allow-cache"(){this.manifest.allowCache=k.allowed,"allowed"in k||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const W={};"length"in k&&(a.byterange=W,W.length=k.length,"offset"in k||(k.offset=A)),"offset"in k&&(a.byterange=W,W.offset=k.offset),A=W.offset+W.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"})),k.title&&(a.title=k.title),k.duration>0&&(a.duration=k.duration),k.duration===0&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!k.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(k.attributes.METHOD==="NONE"){u=null;return}if(!k.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(k.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:k.attributes};return}if(k.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:k.attributes.URI};return}if(k.attributes.KEYFORMAT===w){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(k.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(k.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),k.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(k.attributes.KEYID&&k.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:k.attributes.KEYFORMAT,keyId:k.attributes.KEYID.substring(2)},pssh:zw(k.attributes.URI.split(",")[1])};return}k.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:k.attributes.METHOD||"AES-128",uri:k.attributes.URI},typeof k.attributes.IV<"u"&&(u.iv=k.attributes.IV)},"media-sequence"(){if(!isFinite(k.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+k.number});return}this.manifest.mediaSequence=k.number},"discontinuity-sequence"(){if(!isFinite(k.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+k.number});return}this.manifest.discontinuitySequence=k.number,S=k.number},"playlist-type"(){if(!/VOD|EVENT/.test(k.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+k.playlist});return}this.manifest.playlistType=k.playlistType},map(){l={},k.uri&&(l.uri=k.uri),k.byterange&&(l.byterange=k.byterange),u&&(l.key=u)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||g,!k.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}a.attributes||(a.attributes={}),tr(a.attributes,k.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||g,!(k.attributes&&k.attributes.TYPE&&k.attributes["GROUP-ID"]&&k.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const W=this.manifest.mediaGroups[k.attributes.TYPE];W[k.attributes["GROUP-ID"]]=W[k.attributes["GROUP-ID"]]||{},B=W[k.attributes["GROUP-ID"]],V={default:/yes/i.test(k.attributes.DEFAULT)},V.default?V.autoselect=!0:V.autoselect=/yes/i.test(k.attributes.AUTOSELECT),k.attributes.LANGUAGE&&(V.language=k.attributes.LANGUAGE),k.attributes.URI&&(V.uri=k.attributes.URI),k.attributes["INSTREAM-ID"]&&(V.instreamId=k.attributes["INSTREAM-ID"]),k.attributes.CHARACTERISTICS&&(V.characteristics=k.attributes.CHARACTERISTICS),k.attributes.FORCED&&(V.forced=/yes/i.test(k.attributes.FORCED)),B[k.attributes.NAME]=V},discontinuity(){S+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=k.dateTimeString,this.manifest.dateTimeObject=k.dateTimeObject),a.dateTimeString=k.dateTimeString,a.dateTimeObject=k.dateTimeObject;const{lastProgramDateTime:W}=this;this.lastProgramDateTime=new Date(k.dateTimeString).getTime(),W===null&&this.manifest.segments.reduceRight((H,ie)=>(ie.programDateTime=H-ie.duration*1e3,ie.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(k.duration)||k.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+k.duration});return}this.manifest.targetDuration=k.duration,Q0.call(this,this.manifest)},start(){if(!k.attributes||isNaN(k.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:k.attributes["TIME-OFFSET"],precise:k.attributes.PRECISE}},"cue-out"(){a.cueOut=k.data},"cue-out-cont"(){a.cueOutCont=k.data},"cue-in"(){a.cueIn=k.data},skip(){this.manifest.skip=yo(k.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",k.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const W=this.manifest.segments.length,H=yo(k.attributes);a.parts=a.parts||[],a.parts.push(H),H.byterange&&(H.byterange.hasOwnProperty("offset")||(H.byterange.offset=C),C=H.byterange.offset+H.byterange.length);const ie=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${ie} for segment #${W}`,k.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Y,G)=>{Y.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${G} lacks required attribute(s): LAST-PART`})})},"server-control"(){const W=this.manifest.serverControl=yo(k.attributes);W.hasOwnProperty("canBlockReload")||(W.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Q0.call(this,this.manifest),W.canSkipDateranges&&!W.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 W=this.manifest.segments.length,H=yo(k.attributes),ie=H.type&&H.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(H),H.byterange&&(H.byterange.hasOwnProperty("offset")||(H.byterange.offset=ie?C:0,ie&&(C=H.byterange.offset+H.byterange.length)));const Y=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Y} for segment #${W}`,k.attributes,["TYPE","URI"]),!!H.type)for(let G=0;G<a.preloadHints.length-1;G++){const O=a.preloadHints[G];O.type&&O.type===H.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${Y} for segment #${W} has the same TYPE ${H.type} as preload hint #${G}`})}},"rendition-report"(){const W=yo(k.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(W);const H=this.manifest.renditionReports.length-1,ie=["LAST-MSN","URI"];h&&ie.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${H}`,k.attributes,ie)},"part-inf"(){this.manifest.partInf=yo(k.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",k.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Q0.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(yo(k.attributes));const W=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${W}`,k.attributes,["ID","START-DATE"]);const H=this.manifest.dateRanges[W];H.endDate&&H.startDate&&new Date(H.endDate)<new Date(H.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),H.duration&&H.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),H.plannedDuration&&H.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const ie=!!H.endOnNext;if(ie&&!H.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),ie&&(H.duration||H.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),H.duration&&H.endDate){const G=H.startDate.getTime()+H.duration*1e3;this.manifest.dateRanges[W].endDate=new Date(G)}if(!j[H.id])j[H.id]=H;else{for(const G in j[H.id])if(H[G]&&JSON.stringify(j[H.id][G])!==JSON.stringify(H[G])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const Y=this.manifest.dateRanges.findIndex(G=>G.id===H.id);this.manifest.dateRanges[Y]=tr(this.manifest.dateRanges[Y],H),j[H.id]=tr(j[H.id],H),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=yo(k.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",k.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const W=(H,ie)=>{if(H in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${H}`});return}this.manifest.definitions[H]=ie};if("QUERYPARAM"in k.attributes){if("NAME"in k.attributes||"IMPORT"in k.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const H=this.params.get(k.attributes.QUERYPARAM);if(!H){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${k.attributes.QUERYPARAM}`});return}W(k.attributes.QUERYPARAM,decodeURIComponent(H));return}if("NAME"in k.attributes){if("IMPORT"in k.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in k.attributes)||typeof k.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${k.attributes.NAME}`});return}W(k.attributes.NAME,k.attributes.VALUE);return}if("IMPORT"in k.attributes){if(!this.mainDefinitions[k.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${k.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}W(k.attributes.IMPORT,this.mainDefinitions[k.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:k.attributes,uri:k.uri,timeline:S}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",k.attributes,["BANDWIDTH","URI"])}}[k.tagType]||f).call(t)},uri(){a.uri=k.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),C=0,this.lastProgramDateTime!==null&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=a.duration*1e3),a={}},comment(){},custom(){k.segment?(a.custom=a.custom||{},a.custom[k.customType]=k.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[k.customType]=k.data)}})[k.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const a=[];i.forEach(function(l){t.hasOwnProperty(l)||a.push(l)}),a.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${a.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
||
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var dl={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},iD=["video","audio","text"],m2=["Video","Audio","Text"],Hw=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,a){var l=("00"+Number(i).toString(16)).slice(-2),u=("00"+Number(a).toString(16)).slice(-2);return"avc1."+l+"00"+u})},ea=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(a){a=a.trim();var l;iD.forEach(function(u){var h=dl[u].exec(a.toLowerCase());if(!(!h||h.length<=1)){l=u;var f=a.substring(0,h[1].length),g=a.replace(f,"");i.push({type:f,details:g,mediaType:u})}}),l||i.push({type:a,details:"",mediaType:"unknown"})}),i},rD=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var a in i){var l=i[a];if(l.default&&l.playlists)return ea(l.playlists[0].attributes.CODECS)}return null},$w=function(e){return e===void 0&&(e=""),dl.audio.test(e.trim().toLowerCase())},sD=function(e){return e===void 0&&(e=""),dl.text.test(e.trim().toLowerCase())},Su=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(l){return Hw(l.trim())}),i="video";t.length===1&&$w(t[0])?i="audio":t.length===1&&sD(t[0])&&(i="application");var a="mp4";return t.every(function(l){return dl.mp4.test(l)})?a="mp4":t.every(function(l){return dl.webm.test(l)})?a="webm":t.every(function(l){return dl.ogg.test(l)})&&(a="ogg"),i+"/"+a+';codecs="'+e+'"'}},id=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),he.MediaSource&&he.MediaSource.isTypeSupported&&he.MediaSource.isTypeSupported(Su(e))||t&&he.ManagedMediaSource&&he.ManagedMediaSource.isTypeSupported&&he.ManagedMediaSource.isTypeSupported(Su(e))||!1},Z0=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<m2.length;i++){var a=m2[i];if(dl["muxer"+a].test(t))return!0}return!1})},p2="mp4a.40.2",aD="avc1.4d400d",oD=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,lD=/^application\/dash\+xml/i,qw=function(e){return oD.test(e)?"hls":lD.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},uD=function(e){return e.toString(2).length},cD=function(e){return Math.ceil(uD(e)/8)},Vw=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},dD=function(e){return Vw(e)},pn=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!dD(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},wr=he.BigInt||Number,Fg=[wr("0x1"),wr("0x100"),wr("0x10000"),wr("0x1000000"),wr("0x100000000"),wr("0x10000000000"),wr("0x1000000000000"),wr("0x100000000000000"),wr("0x10000000000000000")];(function(){var n=new Uint16Array([65484]),e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var hD=function(e,t){var i=t===void 0?{}:t,a=i.signed,l=a===void 0?!1:a,u=i.le,h=u===void 0?!1:u;e=pn(e);var f=h?"reduce":"reduceRight",g=e[f]?e[f]:Array.prototype[f],w=g.call(e,function(A,C,j){var k=h?j:Math.abs(j+1-e.length);return A+wr(C)*Fg[k]},wr(0));if(l){var S=Fg[e.length]/wr(2)-wr(1);w=wr(w),w>S&&(w-=S,w-=S,w-=wr(2))}return Number(w)},fD=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=wr(e);for(var u=cD(e),h=new Uint8Array(new ArrayBuffer(u)),f=0;f<u;f++){var g=l?f:Math.abs(f+1-h.length);h[g]=Number(e/Fg[f]&wr(255)),e<0&&(h[g]=Math.abs(~h[g]),h[g]-=f===0?1:2)}return h},Gw=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),a=0;a<e.length;a++)i[a]=e.charCodeAt(a);return i},mD=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(h){return h&&(h.byteLength||h.length)&&typeof h!="string"}),t.length<=1)return pn(t[0]);var a=t.reduce(function(h,f,g){return h+(f.byteLength||f.length)},0),l=new Uint8Array(a),u=0;return t.forEach(function(h){h=pn(h),l.set(h,u),u+=h.byteLength}),l},Oi=function(e,t,i){var a=i===void 0?{}:i,l=a.offset,u=l===void 0?0:l,h=a.mask,f=h===void 0?[]:h;e=pn(e),t=pn(t);var g=t.every?t.every:Array.prototype.every;return t.length&&e.length-u>=t.length&&g.call(t,function(w,S){var A=f[S]?f[S]&e[u+S]:e[u+S];return w===A})},pD=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)}})},Pc={},Ca={},Jo={},g2;function um(){if(g2)return Jo;g2=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<l.length;f++)if(Object.prototype.hasOwnProperty.call(l,f)){var g=l[f];if(u.call(void 0,g,f,l))return g}}function e(l,u){return u===void 0&&(u=Object),u&&typeof u.freeze=="function"?u.freeze(l):l}function t(l,u){if(l===null||typeof l!="object")throw new TypeError("target is not an object");for(var h in u)Object.prototype.hasOwnProperty.call(u,h)&&(l[h]=u[h]);return l}var i=e({HTML:"text/html",isHTML:function(l){return l===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),a=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(l){return l===a.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Jo.assign=t,Jo.find=n,Jo.freeze=e,Jo.MIME_TYPE=i,Jo.NAMESPACE=a,Jo}var y2;function Kw(){if(y2)return Ca;y2=1;var n=um(),e=n.find,t=n.NAMESPACE;function i(D){return D!==""}function a(D){return D?D.split(/[\t\n\f\r ]+/).filter(i):[]}function l(D,P){return D.hasOwnProperty(P)||(D[P]=!0),D}function u(D){if(!D)return[];var P=a(D);return Object.keys(P.reduce(l,{}))}function h(D){return function(P){return D&&D.indexOf(P)!==-1}}function f(D,P){for(var ne in D)Object.prototype.hasOwnProperty.call(D,ne)&&(P[ne]=D[ne])}function g(D,P){var ne=D.prototype;if(!(ne instanceof P)){let Ge=function(){};var Re=Ge;Ge.prototype=P.prototype,Ge=new Ge,f(ne,Ge),D.prototype=ne=Ge}ne.constructor!=D&&(typeof D!="function"&&console.error("unknown Class:"+D),ne.constructor=D)}var w={},S=w.ELEMENT_NODE=1,A=w.ATTRIBUTE_NODE=2,C=w.TEXT_NODE=3,j=w.CDATA_SECTION_NODE=4,k=w.ENTITY_REFERENCE_NODE=5,B=w.ENTITY_NODE=6,V=w.PROCESSING_INSTRUCTION_NODE=7,W=w.COMMENT_NODE=8,H=w.DOCUMENT_NODE=9,ie=w.DOCUMENT_TYPE_NODE=10,Y=w.DOCUMENT_FRAGMENT_NODE=11,G=w.NOTATION_NODE=12,O={},re={};O.INDEX_SIZE_ERR=(re[1]="Index size error",1),O.DOMSTRING_SIZE_ERR=(re[2]="DOMString size error",2);var E=O.HIERARCHY_REQUEST_ERR=(re[3]="Hierarchy request error",3);O.WRONG_DOCUMENT_ERR=(re[4]="Wrong document",4),O.INVALID_CHARACTER_ERR=(re[5]="Invalid character",5),O.NO_DATA_ALLOWED_ERR=(re[6]="No data allowed",6),O.NO_MODIFICATION_ALLOWED_ERR=(re[7]="No modification allowed",7);var R=O.NOT_FOUND_ERR=(re[8]="Not found",8);O.NOT_SUPPORTED_ERR=(re[9]="Not supported",9);var ee=O.INUSE_ATTRIBUTE_ERR=(re[10]="Attribute in use",10);O.INVALID_STATE_ERR=(re[11]="Invalid state",11),O.SYNTAX_ERR=(re[12]="Syntax error",12),O.INVALID_MODIFICATION_ERR=(re[13]="Invalid modification",13),O.NAMESPACE_ERR=(re[14]="Invalid namespace",14),O.INVALID_ACCESS_ERR=(re[15]="Invalid access",15);function q(D,P){if(P instanceof Error)var ne=P;else ne=this,Error.call(this,re[D]),this.message=re[D],Error.captureStackTrace&&Error.captureStackTrace(this,q);return ne.code=D,P&&(this.message=this.message+": "+P),ne}q.prototype=Error.prototype,f(O,q);function Q(){}Q.prototype={length:0,item:function(D){return D>=0&&D<this.length?this[D]:null},toString:function(D,P){for(var ne=[],Re=0;Re<this.length;Re++)Sn(this[Re],ne,D,P);return ne.join("")},filter:function(D){return Array.prototype.filter.call(this,D)},indexOf:function(D){return Array.prototype.indexOf.call(this,D)}};function ue(D,P){this._node=D,this._refresh=P,se(this)}function se(D){var P=D._node._inc||D._node.ownerDocument._inc;if(D._inc!==P){var ne=D._refresh(D._node);if(Tn(D,"length",ne.length),!D.$$length||ne.length<D.$$length)for(var Re=ne.length;Re in D;Re++)Object.prototype.hasOwnProperty.call(D,Re)&&delete D[Re];f(ne,D),D._inc=P}}ue.prototype.item=function(D){return se(this),this[D]||null},g(ue,Q);function $(){}function F(D,P){for(var ne=D.length;ne--;)if(D[ne]===P)return ne}function X(D,P,ne,Re){if(Re?P[F(P,Re)]=ne:P[P.length++]=ne,D){ne.ownerElement=D;var Ge=D.ownerDocument;Ge&&(Re&&Oe(Ge,D,Re),Ve(Ge,D,ne))}}function le(D,P,ne){var Re=F(P,ne);if(Re>=0){for(var Ge=P.length-1;Re<Ge;)P[Re]=P[++Re];if(P.length=Ge,D){var yt=D.ownerDocument;yt&&(Oe(yt,D,ne),ne.ownerElement=null)}}else throw new q(R,new Error(D.tagName+"@"+ne))}$.prototype={length:0,item:Q.prototype.item,getNamedItem:function(D){for(var P=this.length;P--;){var ne=this[P];if(ne.nodeName==D)return ne}},setNamedItem:function(D){var P=D.ownerElement;if(P&&P!=this._ownerElement)throw new q(ee);var ne=this.getNamedItem(D.nodeName);return X(this._ownerElement,this,D,ne),ne},setNamedItemNS:function(D){var P=D.ownerElement,ne;if(P&&P!=this._ownerElement)throw new q(ee);return ne=this.getNamedItemNS(D.namespaceURI,D.localName),X(this._ownerElement,this,D,ne),ne},removeNamedItem:function(D){var P=this.getNamedItem(D);return le(this._ownerElement,this,P),P},removeNamedItemNS:function(D,P){var ne=this.getNamedItemNS(D,P);return le(this._ownerElement,this,ne),ne},getNamedItemNS:function(D,P){for(var ne=this.length;ne--;){var Re=this[ne];if(Re.localName==P&&Re.namespaceURI==D)return Re}return null}};function de(){}de.prototype={hasFeature:function(D,P){return!0},createDocument:function(D,P,ne){var Re=new Be;if(Re.implementation=this,Re.childNodes=new Q,Re.doctype=ne||null,ne&&Re.appendChild(ne),P){var Ge=Re.createElementNS(D,P);Re.appendChild(Ge)}return Re},createDocumentType:function(D,P,ne){var Re=new Pe;return Re.name=D,Re.nodeName=D,Re.publicId=P||"",Re.systemId=ne||"",Re}};function L(){}L.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(D,P){return We(this,D,P)},replaceChild:function(D,P){We(this,D,P,He),P&&this.removeChild(P)},removeChild:function(D){return _t(this,D)},appendChild:function(D){return this.insertBefore(D,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(D){return St(this.ownerDocument||this,this,D)},normalize:function(){for(var D=this.firstChild;D;){var P=D.nextSibling;P&&P.nodeType==C&&D.nodeType==C?(this.removeChild(P),D.appendData(P.data)):(D.normalize(),D=P)}},isSupported:function(D,P){return this.ownerDocument.implementation.hasFeature(D,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(D){for(var P=this;P;){var ne=P._nsMap;if(ne){for(var Re in ne)if(Object.prototype.hasOwnProperty.call(ne,Re)&&ne[Re]===D)return Re}P=P.nodeType==A?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(D){for(var P=this;P;){var ne=P._nsMap;if(ne&&Object.prototype.hasOwnProperty.call(ne,D))return ne[D];P=P.nodeType==A?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(D){var P=this.lookupPrefix(D);return P==null}};function pe(D){return D=="<"&&"<"||D==">"&&">"||D=="&"&&"&"||D=='"'&&"""||"&#"+D.charCodeAt()+";"}f(w,L),f(w,L.prototype);function we(D,P){if(P(D))return!0;if(D=D.firstChild)do if(we(D,P))return!0;while(D=D.nextSibling)}function Be(){this.ownerDocument=this}function Ve(D,P,ne){D&&D._inc++;var Re=ne.namespaceURI;Re===t.XMLNS&&(P._nsMap[ne.prefix?ne.localName:""]=ne.value)}function Oe(D,P,ne,Re){D&&D._inc++;var Ge=ne.namespaceURI;Ge===t.XMLNS&&delete P._nsMap[ne.prefix?ne.localName:""]}function Te(D,P,ne){if(D&&D._inc){D._inc++;var Re=P.childNodes;if(ne)Re[Re.length++]=ne;else{for(var Ge=P.firstChild,yt=0;Ge;)Re[yt++]=Ge,Ge=Ge.nextSibling;Re.length=yt,delete Re[Re.length]}}}function _t(D,P){var ne=P.previousSibling,Re=P.nextSibling;return ne?ne.nextSibling=Re:D.firstChild=Re,Re?Re.previousSibling=ne:D.lastChild=ne,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,Te(D.ownerDocument,D),P}function dt(D){return D&&(D.nodeType===L.DOCUMENT_NODE||D.nodeType===L.DOCUMENT_FRAGMENT_NODE||D.nodeType===L.ELEMENT_NODE)}function xe(D){return D&&(Se(D)||Ie(D)||Ne(D)||D.nodeType===L.DOCUMENT_FRAGMENT_NODE||D.nodeType===L.COMMENT_NODE||D.nodeType===L.PROCESSING_INSTRUCTION_NODE)}function Ne(D){return D&&D.nodeType===L.DOCUMENT_TYPE_NODE}function Se(D){return D&&D.nodeType===L.ELEMENT_NODE}function Ie(D){return D&&D.nodeType===L.TEXT_NODE}function $e(D,P){var ne=D.childNodes||[];if(e(ne,Se)||Ne(P))return!1;var Re=e(ne,Ne);return!(P&&Re&&ne.indexOf(Re)>ne.indexOf(P))}function Ct(D,P){var ne=D.childNodes||[];function Re(yt){return Se(yt)&&yt!==P}if(e(ne,Re))return!1;var Ge=e(ne,Ne);return!(P&&Ge&&ne.indexOf(Ge)>ne.indexOf(P))}function st(D,P,ne){if(!dt(D))throw new q(E,"Unexpected parent node type "+D.nodeType);if(ne&&ne.parentNode!==D)throw new q(R,"child not in parent");if(!xe(P)||Ne(P)&&D.nodeType!==L.DOCUMENT_NODE)throw new q(E,"Unexpected node type "+P.nodeType+" for parent node type "+D.nodeType)}function gt(D,P,ne){var Re=D.childNodes||[],Ge=P.childNodes||[];if(P.nodeType===L.DOCUMENT_FRAGMENT_NODE){var yt=Ge.filter(Se);if(yt.length>1||e(Ge,Ie))throw new q(E,"More than one element or text in fragment");if(yt.length===1&&!$e(D,ne))throw new q(E,"Element in fragment can not be inserted before doctype")}if(Se(P)&&!$e(D,ne))throw new q(E,"Only one element can be added and only after doctype");if(Ne(P)){if(e(Re,Ne))throw new q(E,"Only one doctype is allowed");var tn=e(Re,Se);if(ne&&Re.indexOf(tn)<Re.indexOf(ne))throw new q(E,"Doctype can only be inserted before an element");if(!ne&&tn)throw new q(E,"Doctype can not be appended since element is present")}}function He(D,P,ne){var Re=D.childNodes||[],Ge=P.childNodes||[];if(P.nodeType===L.DOCUMENT_FRAGMENT_NODE){var yt=Ge.filter(Se);if(yt.length>1||e(Ge,Ie))throw new q(E,"More than one element or text in fragment");if(yt.length===1&&!Ct(D,ne))throw new q(E,"Element in fragment can not be inserted before doctype")}if(Se(P)&&!Ct(D,ne))throw new q(E,"Only one element can be added and only after doctype");if(Ne(P)){let vn=function(cn){return Ne(cn)&&cn!==ne};var un=vn;if(e(Re,vn))throw new q(E,"Only one doctype is allowed");var tn=e(Re,Se);if(ne&&Re.indexOf(tn)<Re.indexOf(ne))throw new q(E,"Doctype can only be inserted before an element")}}function We(D,P,ne,Re){st(D,P,ne),D.nodeType===L.DOCUMENT_NODE&&(Re||gt)(D,P,ne);var Ge=P.parentNode;if(Ge&&Ge.removeChild(P),P.nodeType===Y){var yt=P.firstChild;if(yt==null)return P;var tn=P.lastChild}else yt=tn=P;var un=ne?ne.previousSibling:D.lastChild;yt.previousSibling=un,tn.nextSibling=ne,un?un.nextSibling=yt:D.firstChild=yt,ne==null?D.lastChild=tn:ne.previousSibling=tn;do{yt.parentNode=D;var vn=D.ownerDocument||D;Je(yt,vn)}while(yt!==tn&&(yt=yt.nextSibling));return Te(D.ownerDocument||D,D),P.nodeType==Y&&(P.firstChild=P.lastChild=null),P}function Je(D,P){if(D.ownerDocument!==P){if(D.ownerDocument=P,D.nodeType===S&&D.attributes)for(var ne=0;ne<D.attributes.length;ne++){var Re=D.attributes.item(ne);Re&&(Re.ownerDocument=P)}for(var Ge=D.firstChild;Ge;)Je(Ge,P),Ge=Ge.nextSibling}}function et(D,P){P.parentNode&&P.parentNode.removeChild(P),P.parentNode=D,P.previousSibling=D.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:D.firstChild=P,D.lastChild=P,Te(D.ownerDocument,D,P);var ne=D.ownerDocument||D;return Je(P,ne),P}Be.prototype={nodeName:"#document",nodeType:H,doctype:null,documentElement:null,_inc:1,insertBefore:function(D,P){if(D.nodeType==Y){for(var ne=D.firstChild;ne;){var Re=ne.nextSibling;this.insertBefore(ne,P),ne=Re}return D}return We(this,D,P),Je(D,this),this.documentElement===null&&D.nodeType===S&&(this.documentElement=D),D},removeChild:function(D){return this.documentElement==D&&(this.documentElement=null),_t(this,D)},replaceChild:function(D,P){We(this,D,P,He),Je(D,this),P&&this.removeChild(P),Se(D)&&(this.documentElement=D)},importNode:function(D,P){return Pn(this,D,P)},getElementById:function(D){var P=null;return we(this.documentElement,function(ne){if(ne.nodeType==S&&ne.getAttribute("id")==D)return P=ne,!0}),P},getElementsByClassName:function(D){var P=u(D);return new ue(this,function(ne){var Re=[];return P.length>0&&we(ne.documentElement,function(Ge){if(Ge!==ne&&Ge.nodeType===S){var yt=Ge.getAttribute("class");if(yt){var tn=D===yt;if(!tn){var un=u(yt);tn=P.every(h(un))}tn&&Re.push(Ge)}}}),Re})},createElement:function(D){var P=new mt;P.ownerDocument=this,P.nodeName=D,P.tagName=D,P.localName=D,P.childNodes=new Q;var ne=P.attributes=new $;return ne._ownerElement=P,P},createDocumentFragment:function(){var D=new kt;return D.ownerDocument=this,D.childNodes=new Q,D},createTextNode:function(D){var P=new qe;return P.ownerDocument=this,P.appendData(D),P},createComment:function(D){var P=new Le;return P.ownerDocument=this,P.appendData(D),P},createCDATASection:function(D){var P=new Ce;return P.ownerDocument=this,P.appendData(D),P},createProcessingInstruction:function(D,P){var ne=new mn;return ne.ownerDocument=this,ne.tagName=ne.nodeName=ne.target=D,ne.nodeValue=ne.data=P,ne},createAttribute:function(D){var P=new Mt;return P.ownerDocument=this,P.name=D,P.nodeName=D,P.localName=D,P.specified=!0,P},createEntityReference:function(D){var P=new Xt;return P.ownerDocument=this,P.nodeName=D,P},createElementNS:function(D,P){var ne=new mt,Re=P.split(":"),Ge=ne.attributes=new $;return ne.childNodes=new Q,ne.ownerDocument=this,ne.nodeName=P,ne.tagName=P,ne.namespaceURI=D,Re.length==2?(ne.prefix=Re[0],ne.localName=Re[1]):ne.localName=P,Ge._ownerElement=ne,ne},createAttributeNS:function(D,P){var ne=new Mt,Re=P.split(":");return ne.ownerDocument=this,ne.nodeName=P,ne.name=P,ne.namespaceURI=D,ne.specified=!0,Re.length==2?(ne.prefix=Re[0],ne.localName=Re[1]):ne.localName=P,ne}},g(Be,L);function mt(){this._nsMap={}}mt.prototype={nodeType:S,hasAttribute:function(D){return this.getAttributeNode(D)!=null},getAttribute:function(D){var P=this.getAttributeNode(D);return P&&P.value||""},getAttributeNode:function(D){return this.attributes.getNamedItem(D)},setAttribute:function(D,P){var ne=this.ownerDocument.createAttribute(D);ne.value=ne.nodeValue=""+P,this.setAttributeNode(ne)},removeAttribute:function(D){var P=this.getAttributeNode(D);P&&this.removeAttributeNode(P)},appendChild:function(D){return D.nodeType===Y?this.insertBefore(D,null):et(this,D)},setAttributeNode:function(D){return this.attributes.setNamedItem(D)},setAttributeNodeNS:function(D){return this.attributes.setNamedItemNS(D)},removeAttributeNode:function(D){return this.attributes.removeNamedItem(D.nodeName)},removeAttributeNS:function(D,P){var ne=this.getAttributeNodeNS(D,P);ne&&this.removeAttributeNode(ne)},hasAttributeNS:function(D,P){return this.getAttributeNodeNS(D,P)!=null},getAttributeNS:function(D,P){var ne=this.getAttributeNodeNS(D,P);return ne&&ne.value||""},setAttributeNS:function(D,P,ne){var Re=this.ownerDocument.createAttributeNS(D,P);Re.value=Re.nodeValue=""+ne,this.setAttributeNode(Re)},getAttributeNodeNS:function(D,P){return this.attributes.getNamedItemNS(D,P)},getElementsByTagName:function(D){return new ue(this,function(P){var ne=[];return we(P,function(Re){Re!==P&&Re.nodeType==S&&(D==="*"||Re.tagName==D)&&ne.push(Re)}),ne})},getElementsByTagNameNS:function(D,P){return new ue(this,function(ne){var Re=[];return we(ne,function(Ge){Ge!==ne&&Ge.nodeType===S&&(D==="*"||Ge.namespaceURI===D)&&(P==="*"||Ge.localName==P)&&Re.push(Ge)}),Re})}},Be.prototype.getElementsByTagName=mt.prototype.getElementsByTagName,Be.prototype.getElementsByTagNameNS=mt.prototype.getElementsByTagNameNS,g(mt,L);function Mt(){}Mt.prototype.nodeType=A,g(Mt,L);function fe(){}fe.prototype={data:"",substringData:function(D,P){return this.data.substring(D,D+P)},appendData:function(D){D=this.data+D,this.nodeValue=this.data=D,this.length=D.length},insertData:function(D,P){this.replaceData(D,0,P)},appendChild:function(D){throw new Error(re[E])},deleteData:function(D,P){this.replaceData(D,P,"")},replaceData:function(D,P,ne){var Re=this.data.substring(0,D),Ge=this.data.substring(D+P);ne=Re+ne+Ge,this.nodeValue=this.data=ne,this.length=ne.length}},g(fe,L);function qe(){}qe.prototype={nodeName:"#text",nodeType:C,splitText:function(D){var P=this.data,ne=P.substring(D);P=P.substring(0,D),this.data=this.nodeValue=P,this.length=P.length;var Re=this.ownerDocument.createTextNode(ne);return this.parentNode&&this.parentNode.insertBefore(Re,this.nextSibling),Re}},g(qe,fe);function Le(){}Le.prototype={nodeName:"#comment",nodeType:W},g(Le,fe);function Ce(){}Ce.prototype={nodeName:"#cdata-section",nodeType:j},g(Ce,fe);function Pe(){}Pe.prototype.nodeType=ie,g(Pe,L);function Qe(){}Qe.prototype.nodeType=G,g(Qe,L);function At(){}At.prototype.nodeType=B,g(At,L);function Xt(){}Xt.prototype.nodeType=k,g(Xt,L);function kt(){}kt.prototype.nodeName="#document-fragment",kt.prototype.nodeType=Y,g(kt,L);function mn(){}mn.prototype.nodeType=V,g(mn,L);function It(){}It.prototype.serializeToString=function(D,P,ne){return $t.call(D,P,ne)},L.prototype.toString=$t;function $t(D,P){var ne=[],Re=this.nodeType==9&&this.documentElement||this,Ge=Re.prefix,yt=Re.namespaceURI;if(yt&&Ge==null){var Ge=Re.lookupPrefix(yt);if(Ge==null)var tn=[{namespace:yt,prefix:null}]}return Sn(this,ne,D,P,tn),ne.join("")}function Ot(D,P,ne){var Re=D.prefix||"",Ge=D.namespaceURI;if(!Ge||Re==="xml"&&Ge===t.XML||Ge===t.XMLNS)return!1;for(var yt=ne.length;yt--;){var tn=ne[yt];if(tn.prefix===Re)return tn.namespace!==Ge}return!0}function en(D,P,ne){D.push(" ",P,'="',ne.replace(/[<>&"\t\n\r]/g,pe),'"')}function Sn(D,P,ne,Re,Ge){if(Ge||(Ge=[]),Re)if(D=Re(D),D){if(typeof D=="string"){P.push(D);return}}else return;switch(D.nodeType){case S:var yt=D.attributes,tn=yt.length,zt=D.firstChild,un=D.tagName;ne=t.isHTML(D.namespaceURI)||ne;var vn=un;if(!ne&&!D.prefix&&D.namespaceURI){for(var cn,Cn=0;Cn<yt.length;Cn++)if(yt.item(Cn).name==="xmlns"){cn=yt.item(Cn).value;break}if(!cn)for(var xn=Ge.length-1;xn>=0;xn--){var on=Ge[xn];if(on.prefix===""&&on.namespace===D.namespaceURI){cn=on.namespace;break}}if(cn!==D.namespaceURI)for(var xn=Ge.length-1;xn>=0;xn--){var on=Ge[xn];if(on.namespace===D.namespaceURI){on.prefix&&(vn=on.prefix+":"+un);break}}}P.push("<",vn);for(var Rn=0;Rn<tn;Rn++){var qt=yt.item(Rn);qt.prefix=="xmlns"?Ge.push({prefix:qt.localName,namespace:qt.value}):qt.nodeName=="xmlns"&&Ge.push({prefix:"",namespace:qt.value})}for(var Rn=0;Rn<tn;Rn++){var qt=yt.item(Rn);if(Ot(qt,ne,Ge)){var Bt=qt.prefix||"",Zt=qt.namespaceURI;en(P,Bt?"xmlns:"+Bt:"xmlns",Zt),Ge.push({prefix:Bt,namespace:Zt})}Sn(qt,P,ne,Re,Ge)}if(un===vn&&Ot(D,ne,Ge)){var Bt=D.prefix||"",Zt=D.namespaceURI;en(P,Bt?"xmlns:"+Bt:"xmlns",Zt),Ge.push({prefix:Bt,namespace:Zt})}if(zt||ne&&!/^(?:meta|link|img|br|hr|input)$/i.test(un)){if(P.push(">"),ne&&/^script$/i.test(un))for(;zt;)zt.data?P.push(zt.data):Sn(zt,P,ne,Re,Ge.slice()),zt=zt.nextSibling;else for(;zt;)Sn(zt,P,ne,Re,Ge.slice()),zt=zt.nextSibling;P.push("</",vn,">")}else P.push("/>");return;case H:case Y:for(var zt=D.firstChild;zt;)Sn(zt,P,ne,Re,Ge.slice()),zt=zt.nextSibling;return;case A:return en(P,D.name,D.value);case C:return P.push(D.data.replace(/[<&>]/g,pe));case j:return P.push("<![CDATA[",D.data,"]]>");case W:return P.push("<!--",D.data,"-->");case ie:var Pt=D.publicId,Nn=D.systemId;if(P.push("<!DOCTYPE ",D.name),Pt)P.push(" PUBLIC ",Pt),Nn&&Nn!="."&&P.push(" ",Nn),P.push(">");else if(Nn&&Nn!=".")P.push(" SYSTEM ",Nn,">");else{var Ft=D.internalSubset;Ft&&P.push(" [",Ft,"]"),P.push(">")}return;case V:return P.push("<?",D.target," ",D.data,"?>");case k:return P.push("&",D.nodeName,";");default:P.push("??",D.nodeName)}}function Pn(D,P,ne){var Re;switch(P.nodeType){case S:Re=P.cloneNode(!1),Re.ownerDocument=D;case Y:break;case A:ne=!0;break}if(Re||(Re=P.cloneNode(!1)),Re.ownerDocument=D,Re.parentNode=null,ne)for(var Ge=P.firstChild;Ge;)Re.appendChild(Pn(D,Ge,ne)),Ge=Ge.nextSibling;return Re}function St(D,P,ne){var Re=new P.constructor;for(var Ge in P)if(Object.prototype.hasOwnProperty.call(P,Ge)){var yt=P[Ge];typeof yt!="object"&&yt!=Re[Ge]&&(Re[Ge]=yt)}switch(P.childNodes&&(Re.childNodes=new Q),Re.ownerDocument=D,Re.nodeType){case S:var tn=P.attributes,un=Re.attributes=new $,vn=tn.length;un._ownerElement=Re;for(var cn=0;cn<vn;cn++)Re.setAttributeNode(St(D,tn.item(cn),!0));break;case A:ne=!0}if(ne)for(var Cn=P.firstChild;Cn;)Re.appendChild(St(D,Cn,ne)),Cn=Cn.nextSibling;return Re}function Tn(D,P,ne){D[P]=ne}try{if(Object.defineProperty){let D=function(P){switch(P.nodeType){case S:case Y:var ne=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&ne.push(D(P)),P=P.nextSibling;return ne.join("");default:return P.nodeValue}};var tt=D;Object.defineProperty(ue.prototype,"length",{get:function(){return se(this),this.$$length}}),Object.defineProperty(L.prototype,"textContent",{get:function(){return D(this)},set:function(P){switch(this.nodeType){case S:case Y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Tn=function(P,ne,Re){P["$$"+ne]=Re}}}catch{}return Ca.DocumentType=Pe,Ca.DOMException=q,Ca.DOMImplementation=de,Ca.Element=mt,Ca.Node=L,Ca.NodeList=Q,Ca.XMLSerializer=It,Ca}var Fc={},J0={},b2;function gD(){return b2||(b2=1,(function(n){var e=um().freeze;n.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",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})(J0)),J0}var Xh={},v2;function yD(){if(v2)return Xh;v2=1;var n=um().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,w=6,S=7;function A(E,R){this.message=E,this.locator=R,Error.captureStackTrace&&Error.captureStackTrace(this,A)}A.prototype=new Error,A.prototype.name=A.name;function C(){}C.prototype={parse:function(E,R,ee){var q=this.domBuilder;q.startDocument(),ie(R,R={}),j(E,R,ee,q,this.errorHandler),q.endDocument()}};function j(E,R,ee,q,Q){function ue(et){if(et>65535){et-=65536;var mt=55296+(et>>10),Mt=56320+(et&1023);return String.fromCharCode(mt,Mt)}else return String.fromCharCode(et)}function se(et){var mt=et.slice(1,-1);return Object.hasOwnProperty.call(ee,mt)?ee[mt]:mt.charAt(0)==="#"?ue(parseInt(mt.substr(1).replace("x","0x"))):(Q.error("entity not found:"+et),et)}function $(et){if(et>Be){var mt=E.substring(Be,et).replace(/&#?\w+;/g,se);L&&F(Be),q.characters(mt,0,et-Be),Be=et}}function F(et,mt){for(;et>=le&&(mt=de.exec(E));)X=mt.index,le=X+mt[0].length,L.lineNumber++;L.columnNumber=et-X+1}for(var X=0,le=0,de=/.*(?:\r\n?|\n)|.*$/g,L=q.locator,pe=[{currentNSMap:R}],we={},Be=0;;){try{var Ve=E.indexOf("<",Be);if(Ve<0){if(!E.substr(Be).match(/^\s*$/)){var Oe=q.doc,Te=Oe.createTextNode(E.substr(Be));Oe.appendChild(Te),q.currentElement=Te}return}switch(Ve>Be&&$(Ve),E.charAt(Ve+1)){case"/":var st=E.indexOf(">",Ve+3),_t=E.substring(Ve+2,st).replace(/[ \t\n\r]+$/g,""),dt=pe.pop();st<0?(_t=E.substring(Ve+2).replace(/[\s<].*/,""),Q.error("end tag name: "+_t+" is not complete:"+dt.tagName),st=Ve+1+_t.length):_t.match(/\s</)&&(_t=_t.replace(/[\s<].*/,""),Q.error("end tag name: "+_t+" maybe not complete"),st=Ve+1+_t.length);var xe=dt.localNSMap,Ne=dt.tagName==_t,Se=Ne||dt.tagName&&dt.tagName.toLowerCase()==_t.toLowerCase();if(Se){if(q.endElement(dt.uri,dt.localName,_t),xe)for(var Ie in xe)Object.prototype.hasOwnProperty.call(xe,Ie)&&q.endPrefixMapping(Ie);Ne||Q.fatalError("end tag name: "+_t+" is not match the current start tagName:"+dt.tagName)}else pe.push(dt);st++;break;case"?":L&&F(Ve),st=G(E,Ve,q);break;case"!":L&&F(Ve),st=Y(E,Ve,q,Q);break;default:L&&F(Ve);var $e=new O,Ct=pe[pe.length-1].currentNSMap,st=B(E,Ve,$e,Ct,se,Q),gt=$e.length;if(!$e.closed&&H(E,st,$e.tagName,we)&&($e.closed=!0,ee.nbsp||Q.warning("unclosed xml attribute")),L&>){for(var He=k(L,{}),We=0;We<gt;We++){var Je=$e[We];F(Je.offset),Je.locator=k(L,{})}q.locator=He,V($e,q,Ct)&&pe.push($e),q.locator=L}else V($e,q,Ct)&&pe.push($e);n.isHTML($e.uri)&&!$e.closed?st=W(E,st,$e.tagName,se,q):st++}}catch(et){if(et instanceof A)throw et;Q.error("element parse error: "+et),st=-1}st>Be?Be=st:$(Math.max(Ve,Be)+1)}}function k(E,R){return R.lineNumber=E.lineNumber,R.columnNumber=E.columnNumber,R}function B(E,R,ee,q,Q,ue){function se(L,pe,we){ee.attributeNames.hasOwnProperty(L)&&ue.fatalError("Attribute "+L+" redefined"),ee.addValue(L,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,Q),we)}for(var $,F,X=++R,le=a;;){var de=E.charAt(X);switch(de){case"=":if(le===l)$=E.slice(R,X),le=h;else if(le===u)le=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(le===h||le===l)if(le===l&&(ue.warning('attribute value must after "="'),$=E.slice(R,X)),R=X+1,X=E.indexOf(de,R),X>0)F=E.slice(R,X),se($,F,R-1),le=g;else throw new Error("attribute value no end '"+de+"' match");else if(le==f)F=E.slice(R,X),se($,F,R),ue.warning('attribute "'+$+'" missed start quot('+de+")!!"),R=X+1,le=g;else throw new Error('attribute value must after "="');break;case"/":switch(le){case a:ee.setTagName(E.slice(R,X));case g:case w:case S:le=S,ee.closed=!0;case f:case l:break;case u:ee.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ue.error("unexpected end of input"),le==a&&ee.setTagName(E.slice(R,X)),X;case">":switch(le){case a:ee.setTagName(E.slice(R,X));case g:case w:case S:break;case f:case l:F=E.slice(R,X),F.slice(-1)==="/"&&(ee.closed=!0,F=F.slice(0,-1));case u:le===u&&(F=$),le==f?(ue.warning('attribute "'+F+'" missed quot(")!'),se($,F,R)):((!n.isHTML(q[""])||!F.match(/^(?:disabled|checked|selected)$/i))&&ue.warning('attribute "'+F+'" missed value!! "'+F+'" instead!!'),se(F,F,R));break;case h:throw new Error("attribute value missed!!")}return X;case"":de=" ";default:if(de<=" ")switch(le){case a:ee.setTagName(E.slice(R,X)),le=w;break;case l:$=E.slice(R,X),le=u;break;case f:var F=E.slice(R,X);ue.warning('attribute "'+F+'" missed quot(")!!'),se($,F,R);case g:le=w;break}else switch(le){case u:ee.tagName,(!n.isHTML(q[""])||!$.match(/^(?:disabled|checked|selected)$/i))&&ue.warning('attribute "'+$+'" missed value!! "'+$+'" instead2!!'),se($,$,R),R=X,le=l;break;case g:ue.warning('attribute space is required"'+$+'"!!');case w:le=l,R=X;break;case h:le=f,R=X;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}X++}}function V(E,R,ee){for(var q=E.tagName,Q=null,de=E.length;de--;){var ue=E[de],se=ue.qName,$=ue.value,L=se.indexOf(":");if(L>0)var F=ue.prefix=se.slice(0,L),X=se.slice(L+1),le=F==="xmlns"&&X;else X=se,F=null,le=se==="xmlns"&&"";ue.localName=X,le!==!1&&(Q==null&&(Q={},ie(ee,ee={})),ee[le]=Q[le]=$,ue.uri=n.XMLNS,R.startPrefixMapping(le,$))}for(var de=E.length;de--;){ue=E[de];var F=ue.prefix;F&&(F==="xml"&&(ue.uri=n.XML),F!=="xmlns"&&(ue.uri=ee[F||""]))}var L=q.indexOf(":");L>0?(F=E.prefix=q.slice(0,L),X=E.localName=q.slice(L+1)):(F=null,X=E.localName=q);var pe=E.uri=ee[F||""];if(R.startElement(pe,X,q,E),E.closed){if(R.endElement(pe,X,q),Q)for(F in Q)Object.prototype.hasOwnProperty.call(Q,F)&&R.endPrefixMapping(F)}else return E.currentNSMap=ee,E.localNSMap=Q,!0}function W(E,R,ee,q,Q){if(/^(?:script|textarea)$/i.test(ee)){var ue=E.indexOf("</"+ee+">",R),se=E.substring(R+1,ue);if(/[&<]/.test(se))return/^script$/i.test(ee)?(Q.characters(se,0,se.length),ue):(se=se.replace(/&#?\w+;/g,q),Q.characters(se,0,se.length),ue)}return R+1}function H(E,R,ee,q){var Q=q[ee];return Q==null&&(Q=E.lastIndexOf("</"+ee+">"),Q<R&&(Q=E.lastIndexOf("</"+ee)),q[ee]=Q),Q<R}function ie(E,R){for(var ee in E)Object.prototype.hasOwnProperty.call(E,ee)&&(R[ee]=E[ee])}function Y(E,R,ee,q){var Q=E.charAt(R+2);switch(Q){case"-":if(E.charAt(R+3)==="-"){var ue=E.indexOf("-->",R+4);return ue>R?(ee.comment(E,R+4,ue-R-4),ue+3):(q.error("Unclosed comment"),-1)}else return-1;default:if(E.substr(R+3,6)=="CDATA["){var ue=E.indexOf("]]>",R+9);return ee.startCDATA(),ee.characters(E,R+9,ue-R-9),ee.endCDATA(),ue+3}var se=re(E,R),$=se.length;if($>1&&/!doctype/i.test(se[0][0])){var F=se[1][0],X=!1,le=!1;$>3&&(/^public$/i.test(se[2][0])?(X=se[3][0],le=$>4&&se[4][0]):/^system$/i.test(se[2][0])&&(le=se[3][0]));var de=se[$-1];return ee.startDTD(F,X,le),ee.endDTD(),de.index+de[0].length}}return-1}function G(E,R,ee){var q=E.indexOf("?>",R);if(q){var Q=E.substring(R,q).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return Q?(Q[0].length,ee.processingInstruction(Q[1],Q[2]),q+2):-1}return-1}function O(){this.attributeNames={}}O.prototype={setTagName:function(E){if(!i.test(E))throw new Error("invalid tagName:"+E);this.tagName=E},addValue:function(E,R,ee){if(!i.test(E))throw new Error("invalid attribute:"+E);this.attributeNames[E]=this.length,this[this.length++]={qName:E,value:R,offset:ee}},length:0,getLocalName:function(E){return this[E].localName},getLocator:function(E){return this[E].locator},getQName:function(E){return this[E].qName},getURI:function(E){return this[E].uri},getValue:function(E){return this[E].value}};function re(E,R){var ee,q=[],Q=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(Q.lastIndex=R,Q.exec(E);ee=Q.exec(E);)if(q.push(ee),ee[1])return q}return Xh.XMLReader=C,Xh.ParseError=A,Xh}var x2;function bD(){if(x2)return Fc;x2=1;var n=um(),e=Kw(),t=gD(),i=yD(),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,V){var W=this.options,H=new h,ie=W.domBuilder||new S,Y=W.errorHandler,G=W.locator,O=W.xmlns||{},re=/\/x?html?$/.test(V),E=re?t.HTML_ENTITIES:t.XML_ENTITIES;G&&ie.setDocumentLocator(G),H.errorHandler=w(Y,ie,G),H.domBuilder=W.domBuilder||ie,re&&(O[""]=l.HTML),O.xml=O.xml||l.XML;var R=W.normalizeLineEndings||f;return B&&typeof B=="string"?H.parse(R(B),O,E):H.errorHandler.error("invalid doc source"),ie.doc};function w(B,V,W){if(!B){if(V instanceof S)return V;B=V}var H={},ie=B instanceof Function;W=W||{};function Y(G){var O=B[G];!O&&ie&&(O=B.length==2?function(re){B(G,re)}:B),H[G]=O&&function(re){O("[xmldom "+G+"] "+re+C(W))}||function(){}}return Y("warning"),Y("error"),Y("fatalError"),H}function S(){this.cdata=!1}function A(B,V){V.lineNumber=B.lineNumber,V.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,V,W,H){var ie=this.doc,Y=ie.createElementNS(B,W||V),G=H.length;k(this,Y),this.currentElement=Y,this.locator&&A(this.locator,Y);for(var O=0;O<G;O++){var B=H.getURI(O),re=H.getValue(O),W=H.getQName(O),E=ie.createAttributeNS(B,W);this.locator&&A(H.getLocator(O),E),E.value=E.nodeValue=re,Y.setAttributeNode(E)}},endElement:function(B,V,W){var H=this.currentElement;H.tagName,this.currentElement=H.parentNode},startPrefixMapping:function(B,V){},endPrefixMapping:function(B){},processingInstruction:function(B,V){var W=this.doc.createProcessingInstruction(B,V);this.locator&&A(this.locator,W),k(this,W)},ignorableWhitespace:function(B,V,W){},characters:function(B,V,W){if(B=j.apply(this,arguments),B){if(this.cdata)var H=this.doc.createCDATASection(B);else var H=this.doc.createTextNode(B);this.currentElement?this.currentElement.appendChild(H):/^\s*$/.test(B)&&this.doc.appendChild(H),this.locator&&A(this.locator,H)}},skippedEntity:function(B){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(B){(this.locator=B)&&(B.lineNumber=0)},comment:function(B,V,W){B=j.apply(this,arguments);var H=this.doc.createComment(B);this.locator&&A(this.locator,H),k(this,H)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(B,V,W){var H=this.doc.implementation;if(H&&H.createDocumentType){var ie=H.createDocumentType(B,V,W);this.locator&&A(this.locator,ie),k(this,ie),this.doc.doctype=ie}},warning:function(B){console.warn("[xmldom warning] "+B,C(this.locator))},error:function(B){console.error("[xmldom error] "+B,C(this.locator))},fatalError:function(B){throw new u(B,this.locator)}};function C(B){if(B)return`
|
||
@`+(B.systemId||"")+"#[line:"+B.lineNumber+",col:"+B.columnNumber+"]"}function j(B,V,W){return typeof B=="string"?B.substr(V,W):B.length>=V+W||V?new java.lang.String(B,V,W)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){S.prototype[B]=function(){return null}});function k(B,V){B.currentElement?B.currentElement.appendChild(V):B.doc.appendChild(V)}return Fc.__DOMHandler=S,Fc.normalizeLineEndings=f,Fc.DOMParser=g,Fc}var _2;function vD(){if(_2)return Pc;_2=1;var n=Kw();return Pc.DOMImplementation=n.DOMImplementation,Pc.XMLSerializer=n.XMLSerializer,Pc.DOMParser=bD().DOMParser,Pc}var xD=vD();const w2=n=>!!n&&typeof n=="object",gr=(...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]):w2(e[i])&&w2(t[i])?e[i]=gr(e[i],t[i]):e[i]=t[i]}),e),{}),Ww=n=>Object.keys(n).map(e=>n[e]),_D=(n,e)=>{const t=[];for(let i=n;i<e;i++)t.push(i);return t},Tu=n=>n.reduce((e,t)=>e.concat(t),[]),Xw=n=>{if(!n.length)return[];const e=[];for(let t=0;t<n.length;t++)e.push(n[t]);return e},wD=(n,e)=>n.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 ku={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:lm(n||"",e)};if(t||i){const u=(t||i).split("-");let h=he.BigInt?he.BigInt(u[0]):parseInt(u[0],10),f=he.BigInt?he.BigInt(u[1]):parseInt(u[1],10);h<Number.MAX_SAFE_INTEGER&&typeof h=="bigint"&&(h=Number(h)),f<Number.MAX_SAFE_INTEGER&&typeof f=="bigint"&&(f=Number(f));let g;typeof f=="bigint"||typeof h=="bigint"?g=he.BigInt(f)-he.BigInt(h)+he.BigInt(1):g=f-h+1,typeof g=="bigint"&&g<Number.MAX_SAFE_INTEGER&&(g=Number(g)),a.byterange={length:g,offset:h}}return a},TD=n=>{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=he.BigInt(n.offset)+he.BigInt(n.length)-he.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),kD={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),w=(e+t)/1e3,S=i+u,C=w+h-S,j=Math.ceil(C*a/l),k=Math.floor((w-S-f)*a/l),B=Math.floor((w-S)*a/l);return{start:Math.max(0,k),end:typeof g=="number"?g:Math.min(j,B)}}},ED=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}=kD[e](n),f=_D(u,h).map(ED(n));if(e==="static"){const g=f.length-1,w=typeof a=="number"?a:l;f[g].duration=w-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(ku.NO_BASE_URL);const g=fd({baseUrl:e,source:t.sourceURL,range:t.range}),w=fd({baseUrl:e,source:e,indexRange:a});if(w.map=g,f){const S=Sy(n);S.length&&(w.duration=S[0].duration,w.timeline=S[0].timeline)}else i&&(w.duration=i,w.timeline=l);return w.presentationTime=u||l,w.number=h,[w]},Ty=(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),w=[],S=n.endList?"static":"dynamic",A=n.sidx.timeline;let C=A,j=n.mediaSequence||0,k;typeof e.firstOffset=="bigint"?k=he.BigInt(h)+e.firstOffset:k=h+e.firstOffset;for(let B=0;B<g.length;B++){const V=e.references[B],W=V.referencedSize,H=V.subsegmentDuration;let ie;typeof k=="bigint"?ie=k+he.BigInt(W)-he.BigInt(1):ie=k+W-1;const Y=`${k}-${ie}`,O=Yw({baseUrl:t,timescale:f,timeline:l,periodStart:A,presentationTime:C,number:j,duration:H,sourceDuration:a,indexRange:Y,type:S})[0];i&&(O.map=i),w.push(O),typeof k=="bigint"?k+=he.BigInt(W):k+=W,C+=H/f,j++}return n.segments=w,n},CD=["AUDIO","SUBTITLES"],AD=1/60,Qw=n=>SD(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),ND=(n,e)=>{for(let t=0;t<n.length;t++)if(n[t].attributes.NAME===e)return n[t];return null},T2=n=>{let e=[];return pD(n,CD,(t,i,a,l)=>{e=e.concat(t.playlists||[])}),e},k2=({playlist:n,mediaSequence:e})=>{n.mediaSequence=e,n.segments.forEach((t,i)=>{t.number=n.mediaSequence+i})},DD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=ND(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)<AD});if(u===-1){k2({playlist:i,mediaSequence:a.mediaSequence+a.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!a.segments.length&&i.timeline>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--),k2({playlist:i,mediaSequence:a.segments[u].number})})},MD=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(T2(n)),i=e.playlists.concat(T2(e));return e.timelineStarts=Qw([n.timelineStarts,e.timelineStarts]),DD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},cm=n=>n&&n.uri+"-"+TD(n.byterange),eg=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=wD(i.segments||[],"discontinuity"),i))},ky=(n,e)=>{const t=cm(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&Ty(n,i,n.sidx.resolvedUri),n},RD=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=ky(n[t],e);return n},jD=({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},OD=({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},LD=(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 w=ky(jD(u,t),e);return l[g].playlists.push(w),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},ID=(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(ky(OD(i),e)),t},{}),BD=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),{}),PD=({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},FD=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",UD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",zD=({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})})},E2=n=>n?Object.keys(n).reduce((e,t)=>{const i=n[t];return e.concat(i.playlists)},[]):[],$D=({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,w=eg(n.filter(FD)).map(PD),S=eg(n.filter(UD)),A=eg(n.filter(zD)),C=n.map(ie=>ie.attributes.captionServices).filter(Boolean),j={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:RD(w,i)};g>=0&&(j.minimumUpdatePeriod=g*1e3),e&&(j.locations=e),t&&(j.contentSteering=t),h==="dynamic"&&(j.suggestedPresentationDelay=f),l&&l.length>0&&(j.eventStream=l);const k=j.playlists.length===0,B=S.length?LD(S,i,k):null,V=A.length?ID(A,i):null,W=w.concat(E2(B),E2(V)),H=W.map(({timelineStarts:ie})=>ie);return j.timelineStarts=Qw(H),HD(W,j.timelineStarts),B&&(j.mediaGroups.AUDIO.audio=B),V&&(j.mediaGroups.SUBTITLES.subs=V),C.length&&(j.mediaGroups["CLOSED-CAPTIONS"].cc=BD(C)),a?MD({oldManifest:a,newManifest:j}):j},qD=(n,e,t)=>{const{NOW:i,clientOffset:a,availabilityStartTime:l,timescale:u=1,periodStart:h=0,minimumUpdatePeriod:f=0}=n,g=(i+a)/1e3,w=l+h,A=g+f-w;return Math.ceil((A*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 w=-1;for(let S=0;S<e.length;S++){const A=e[S],C=A.d,j=A.r||0,k=A.t||0;w<0&&(w=k),k&&k>w&&(w=k);let B;if(j<0){const H=S+1;H===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=qD(n,w,C):B=(l*u-w)/C:B=(e[H].t-w)/C}else B=j+1;const V=h+g.length+B;let W=h+g.length;for(;W<V;)g.push({number:W,duration:C/u,time:w,timeline:f}),w+=C,W++}return g},VD=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,GD=n=>(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}`},C2=(n,e)=>n.replace(VD,GD(e)),KD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?Sy(n):Zw(n,e),WD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=fd({baseUrl:n.baseUrl,source:C2(i.sourceURL,t),range:i.range});return KD(n,e).map(u=>{t.Number=u.number,t.Time=u.time;const h=C2(n.media||"",t),f=n.timescale||1,g=n.presentationTimeOffset||0,w=n.periodStart+(u.time-g)/f;return{uri:h,timeline:u.timeline,duration:u.duration,resolvedUri:lm(n.baseUrl||"",h),map:a,number:u.number,presentationTime:w}})},XD=(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},YD=(n,e)=>{const{duration:t,segmentUrls:i=[],periodStart:a}=n;if(!t&&!e||t&&e)throw new Error(ku.SEGMENT_TIME_UNSPECIFIED);const l=i.map(f=>XD(n,f));let u;return t&&(u=Sy(n)),e&&(u=Zw(n,e)),u.map((f,g)=>{if(l[g]){const w=l[g],S=n.timescale||1,A=n.presentationTimeOffset||0;return w.timeline=f.timeline,w.duration=f.duration,w.number=f.number,w.presentationTime=a+(f.time-A)/S,w}}).filter(f=>f)},QD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=WD,t=gr(n,e.template)):e.base?(i=Yw,t=gr(n,e.base)):e.list&&(i=YD,t=gr(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},ZD=n=>n.map(QD),Li=(n,e)=>Xw(n.childNodes).filter(({tagName:t})=>t===e),wd=n=>n.textContent.trim(),JD=n=>parseFloat(n.split("/").reduce((e,t)=>e/t)),Yl=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,w,S,A,C]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(w||0)*86400+parseFloat(S||0)*3600+parseFloat(A||0)*60+parseFloat(C||0)},e4=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),A2={mediaPresentationDuration(n){return Yl(n)},availabilityStartTime(n){return e4(n)/1e3},minimumUpdatePeriod(n){return Yl(n)},suggestedPresentationDelay(n){return Yl(n)},type(n){return n},timeShiftBufferDepth(n){return Yl(n)},start(n){return Yl(n)},width(n){return parseInt(n,10)},height(n){return parseInt(n,10)},bandwidth(n){return parseInt(n,10)},frameRate(n){return JD(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)?Yl(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}},ur=n=>n&&n.attributes?Xw(n.attributes).reduce((e,t)=>{const i=A2[t.name]||A2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},t4={"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"},dm=(n,e)=>e.length?Tu(n.map(function(t){return e.map(function(i){const a=wd(i),l=lm(t.baseUrl,a),u=gr(ur(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Ey=n=>{const e=Li(n,"SegmentTemplate")[0],t=Li(n,"SegmentList")[0],i=t&&Li(t,"SegmentURL").map(S=>gr({tag:"SegmentURL"},ur(S))),a=Li(n,"SegmentBase")[0],l=t||e,u=l&&Li(l,"SegmentTimeline")[0],h=t||a||e,f=h&&Li(h,"Initialization")[0],g=e&&ur(e);g&&f?g.initialization=f&&ur(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const w={template:g,segmentTimeline:u&&Li(u,"S").map(S=>ur(S)),list:t&&gr(ur(t),{segmentUrls:i,initialization:ur(f)}),base:a&&gr(ur(a),{initialization:ur(f)})};return Object.keys(w).forEach(S=>{w[S]||delete w[S]}),w},n4=(n,e,t)=>i=>{const a=Li(i,"BaseURL"),l=dm(e,a),u=gr(n,ur(i)),h=Ey(i);return l.map(f=>({segmentInfo:gr(t,h),attributes:gr(u,f)}))},i4=n=>n.reduce((e,t)=>{const i=ur(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=t4[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Li(t,"cenc:pssh")[0];if(l){const u=wd(l);e[a].pssh=u&&zw(u)}}return e},{}),r4=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})},s4=n=>Tu(Li(n.node,"EventStream").map(e=>{const t=ur(e),i=t.schemeIdUri;return Li(e,"Event").map(a=>{const l=ur(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}})})),a4=(n,e,t)=>i=>{const a=ur(i),l=dm(e,Li(i,"BaseURL")),u=Li(i,"Role")[0],h={role:ur(u)};let f=gr(n,a,h);const g=Li(i,"Accessibility")[0],w=r4(ur(g));w&&(f=gr(f,{captionServices:w}));const S=Li(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=gr(f,{label:B})}const A=i4(Li(i,"ContentProtection"));Object.keys(A).length&&(f=gr(f,{contentProtection:A}));const C=Ey(i),j=Li(i,"Representation"),k=gr(t,C);return Tu(j.map(n4(f,l,k)))},o4=(n,e)=>(t,i)=>{const a=dm(e,Li(t.node,"BaseURL")),l=gr(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Li(t.node,"AdaptationSet"),h=Ey(t.node);return Tu(u.map(a4(l,a,h)))},l4=(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=gr({serverURL:wd(n[0])},ur(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},u4=({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,c4=(n,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:a=0,eventHandler:l=function(){}}=e,u=Li(n,"Period");if(!u.length)throw new Error(ku.INVALID_NUMBER_OF_PERIOD);const h=Li(n,"Location"),f=ur(n),g=dm([{baseUrl:t}],Li(n,"BaseURL")),w=Li(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((A,C)=>{const j=ur(A),k=S[C-1];j.start=u4({attributes:j,priorPeriodAttributes:k?k.attributes:null,mpdType:f.type}),S.push({node:A,attributes:j})}),{locations:f.locations,contentSteeringInfo:l4(w,l),representationInfo:Tu(S.map(o4(f,g))),eventStream:Tu(S.map(s4))}},Jw=n=>{if(n==="")throw new Error(ku.DASH_EMPTY_MANIFEST);const e=new xD.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(ku.DASH_INVALID_XML);return i},d4=n=>{const e=Li(n,"UTCTiming")[0];if(!e)return null;const t=ur(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(ku.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},h4=(n,e={})=>{const t=c4(Jw(n),e),i=ZD(t.representationInfo);return $D({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},f4=n=>d4(Jw(n));var tg,N2;function m4(){if(N2)return tg;N2=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),a<Number.MAX_SAFE_INTEGER?Number(a):a):i.getUint32(0)*n+i.getUint32(4)};return tg={getUint64:e,MAX_UINT32:n},tg}var ng,D2;function p4(){if(D2)return ng;D2=1;var n=m4().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),a={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},l=12;a.version===0?(a.earliestPresentationTime=i.getUint32(l),a.firstOffset=i.getUint32(l+4),l+=8):(a.earliestPresentationTime=n(t.subarray(l)),a.firstOffset=n(t.subarray(l+8)),l+=16),l+=2;var u=i.getUint16(l);for(l+=2;u>0;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 ng=e,ng}var g4=p4();const y4=Ru(g4);var b4=pn([73,68,51]),v4=function(e,t){t===void 0&&(t=0),e=pn(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},Wc=function n(e,t){return t===void 0&&(t=0),e=pn(e),e.length-t<10||!Oi(e,b4,{offset:t})?t:(t+=v4(e,t),n(e,t))},M2=function(e){return typeof e=="string"?Gw(e):e},x4=function(e){return Array.isArray(e)?e.map(function(t){return M2(t)}):[M2(e)]},_4=function n(e,t,i){i===void 0&&(i=!1),t=x4(t),e=pn(e);var a=[];if(!t.length)return a;for(var l=0;l<e.length;){var u=(e[l]<<24|e[l+1]<<16|e[l+2]<<8|e[l+3])>>>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);Oi(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:pn([26,69,223,163]),DocType:pn([66,130]),Segment:pn([24,83,128,103]),SegmentInfo:pn([21,73,169,102]),Tracks:pn([22,84,174,107]),Track:pn([174]),TrackNumber:pn([215]),DefaultDuration:pn([35,227,131]),TrackEntry:pn([174]),TrackType:pn([131]),FlagDefault:pn([136]),CodecID:pn([134]),CodecPrivate:pn([99,162]),VideoTrack:pn([224]),AudioTrack:pn([225]),Cluster:pn([31,67,182,117]),Timestamp:pn([231]),TimestampScale:pn([42,215,177]),BlockGroup:pn([160]),BlockDuration:pn([155]),Block:pn([161]),SimpleBlock:pn([163])},Ug=[128,64,32,16,8,4,2,1],w4=function(e){for(var t=1,i=0;i<Ug.length&&!(e&Ug[i]);i++)t++;return t},Af=function(e,t,i,a){i===void 0&&(i=!0),a===void 0&&(a=!1);var l=w4(e[t]),u=e.subarray(t,t+l);return i&&(u=Array.prototype.slice.call(e,t,t+l),u[0]^=Ug[l-1]),{length:l,value:hD(u,{signed:a}),bytes:u}},R2=function n(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return n(t)}):typeof e=="number"?fD(e):e},S4=function(e){return Array.isArray(e)?e.map(function(t){return R2(t)}):[R2(e)]},T4=function n(e,t,i){if(i>=t.length)return t.length;var a=Af(t,i,!1);if(Oi(e.bytes,a.bytes))return i;var l=Af(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},j2=function n(e,t){t=S4(t),e=pn(e);var i=[];if(!t.length)return i;for(var a=0;a<e.length;){var l=Af(e,a,!1),u=Af(e,a+l.length),h=a+l.length+u.length;u.value===127&&(u.value=T4(l,e,h),u.value!==e.length&&(u.value-=h));var f=h+u.value>e.length?e.length:h+u.value,g=e.subarray(h,f);Oi(t[0],l.bytes)&&(t.length===1?i.push(g):i=i.concat(n(g,t.slice(1))));var w=l.length+u.length+g.length;a+=w}return i},k4=pn([0,0,0,1]),E4=pn([0,0,1]),C4=pn([0,0,3]),A4=function(e){for(var t=[],i=1;i<e.length-2;)Oi(e.subarray(i,i+3),C4)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var a=e.length-t.length,l=new Uint8Array(a),u=0;for(i=0;i<a;u++,i++)u===t[0]&&(u++,t.shift()),l[i]=e[u];return l},eS=function(e,t,i,a){e=pn(e),i=[].concat(i);for(var l=0,u,h=0;l<e.length&&(h<a||u);){var f=void 0;if(Oi(e.subarray(l),k4)?f=4:Oi(e.subarray(l),E4)&&(f=3),!f){l++;continue}if(h++,u)return A4(e.subarray(u,l));var g=void 0;t==="h264"?g=e[l+f]&31:t==="h265"&&(g=e[l+f]>>1&63),i.indexOf(g)!==-1&&(u=l+f),l+=f+(t==="h264"?1:2)}return e.subarray(0,0)},N4=function(e,t,i){return eS(e,"h264",t,i)},D4=function(e,t,i){return eS(e,"h265",t,i)},Rr={webm:pn([119,101,98,109]),matroska:pn([109,97,116,114,111,115,107,97]),flac:pn([102,76,97,67]),ogg:pn([79,103,103,83]),ac3:pn([11,119]),riff:pn([82,73,70,70]),avi:pn([65,86,73]),wav:pn([87,65,86,69]),"3gp":pn([102,116,121,112,51,103]),mp4:pn([102,116,121,112]),fmp4:pn([115,116,121,112]),mov:pn([102,116,121,112,113,116]),moov:pn([109,111,111,118]),moof:pn([109,111,111,102])},Eu={aac:function(e){var t=Wc(e);return Oi(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Wc(e);return Oi(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=j2(e,[Yh.EBML,Yh.DocType])[0];return Oi(t,Rr.webm)},mkv:function(e){var t=j2(e,[Yh.EBML,Yh.DocType])[0];return Oi(t,Rr.matroska)},mp4:function(e){if(Eu["3gp"](e)||Eu.mov(e))return!1;if(Oi(e,Rr.mp4,{offset:4})||Oi(e,Rr.fmp4,{offset:4})||Oi(e,Rr.moof,{offset:4})||Oi(e,Rr.moov,{offset:4}))return!0},mov:function(e){return Oi(e,Rr.mov,{offset:4})},"3gp":function(e){return Oi(e,Rr["3gp"],{offset:4})},ac3:function(e){var t=Wc(e);return Oi(e,Rr.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=Wc(e);return Oi(e,Rr.flac,{offset:t})},ogg:function(e){return Oi(e,Rr.ogg)},avi:function(e){return Oi(e,Rr.riff)&&Oi(e,Rr.avi,{offset:8})},wav:function(e){return Oi(e,Rr.riff)&&Oi(e,Rr.wav,{offset:8})},h264:function(e){return N4(e,7,3).length},h265:function(e){return D4(e,[32,33],3).length}},zg=Object.keys(Eu).filter(function(n){return n!=="ts"&&n!=="h264"&&n!=="h265"}).concat(["ts","h264","h265"]);zg.forEach(function(n){var e=Eu[n];Eu[n]=function(t){return e(pn(t))}});var M4=Eu,Cy=function(e){e=pn(e);for(var t=0;t<zg.length;t++){var i=zg[t];if(M4[i](e))return i}return""},R4=function(e){return _4(e,["moof"]).length>0},ig,O2;function j4(){if(O2)return ig;O2=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,w){return i(w?f:f-g)},ig={ONE_SECOND_IN_TS:n,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:a,audioTsToVideoTs:l,videoTsToAudioTs:u,metadataTsToSeconds:h},ig}var ul=j4();var Hg="8.23.4";const Ma={},No=function(n,e){return Ma[n]=Ma[n]||[],e&&(Ma[n]=Ma[n].concat(e)),Ma[n]},O4=function(n,e){No(n,e)},tS=function(n,e){const t=No(n).indexOf(e);return t<=-1?!1:(Ma[n]=Ma[n].slice(),Ma[n].splice(t,1),!0)},L4=function(n,e){No(n,[].concat(e).map(t=>{const i=(...a)=>(tS(n,i),t(...a));return i}))},Nf={prefixed:!0},ff=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],L2=ff[0];let Xc;for(let n=0;n<ff.length;n++)if(ff[n][1]in Tt){Xc=ff[n];break}if(Xc){for(let n=0;n<Xc.length;n++)Nf[L2[n]]=Xc[n];Nf.prefixed=Xc[0]!==L2[0]}let Gr=[];const I4=(n,e,t)=>(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+":"),Gr){Gr.push([].concat(l));const w=Gr.length-1e3;Gr.splice(0,w>0?w:0)}if(!he.console)return;let g=he.console[i];!g&&i==="debug"&&(g=he.console.info||he.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](he.console,l)};function $g(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=I4(n,l,t),l.createLogger=(u,h,f)=>{const g=h!==void 0?h:e,w=f!==void 0?f:t,S=`${n} ${g} ${u}`;return $g(S,g,w)},l.createNewLogger=(u,h,f)=>$g(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=()=>Gr?[].concat(Gr):[],l.history.filter=u=>(Gr||[]).filter(h=>new RegExp(`.*${u}.*`).test(h[0])),l.history.clear=()=>{Gr&&(Gr.length=0)},l.history.disable=()=>{Gr!==null&&(Gr.length=0,Gr=null)},l.history.enable=()=>{Gr===null&&(Gr=[])},l.error=(...u)=>a("error",i,u),l.warn=(...u)=>a("warn",i,u),l.debug=(...u)=>a("debug",i,u),l}const In=$g("VIDEOJS"),nS=In.createLogger,B4=Object.prototype.toString,iS=function(n){return oa(n)?Object.keys(n):[]};function cu(n,e){iS(n).forEach(t=>e(n[t],t))}function rS(n,e,t=0){return iS(n).reduce((i,a)=>e(i,n[a],a),t)}function oa(n){return!!n&&typeof n=="object"}function Cu(n){return oa(n)&&B4.call(n)==="[object Object]"&&n.constructor===Object}function yi(...n){const e={};return n.forEach(t=>{t&&cu(t,(i,a)=>{if(!Cu(i)){e[a]=i;return}Cu(e[a])||(e[a]={}),e[a]=yi(e[a],i)})}),e}function sS(n={}){const e=[];for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];e.push(i)}return e}function hm(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 P4=Object.freeze({__proto__:null,each:cu,reduce:rS,isObject:oa,isPlain:Cu,merge:yi,values:sS,defineLazyProperty:hm});let Ay=!1,aS=null,Fs=!1,oS,lS=!1,du=!1,hu=!1,la=!1,Ny=null,fm=null;const F4=!!(he.cast&&he.cast.framework&&he.cast.framework.CastReceiverContext);let uS=null,Df=!1,mm=!1,Mf=!1,pm=!1,Rf=!1,jf=!1,Of=!1;const md=!!(ju()&&("ontouchstart"in he||he.navigator.maxTouchPoints||he.DocumentTouch&&he.document instanceof he.DocumentTouch)),bo=he.navigator&&he.navigator.userAgentData;bo&&bo.platform&&bo.brands&&(Fs=bo.platform==="Android",du=!!bo.brands.find(n=>n.brand==="Microsoft Edge"),hu=!!bo.brands.find(n=>n.brand==="Chromium"),la=!du&&hu,Ny=fm=(bo.brands.find(n=>n.brand==="Chromium")||{}).version||null,mm=bo.platform==="Windows");if(!hu){const n=he.navigator&&he.navigator.userAgent||"";Ay=/iPod/i.test(n),aS=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),Fs=/Android/i.test(n),oS=(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})(),lS=/Firefox/i.test(n),du=/Edg/i.test(n),hu=/Chrome/i.test(n)||/CriOS/i.test(n),la=!du&&hu,Ny=fm=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),uS=(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})(),Rf=/Tizen/i.test(n),jf=/Web0S/i.test(n),Of=Rf||jf,Df=/Safari/i.test(n)&&!la&&!Fs&&!du&&!Of,mm=/Windows/i.test(n),Mf=/iPad/i.test(n)||Df&&md&&!/iPhone/i.test(n),pm=/iPhone/i.test(n)&&!Mf}const Er=pm||Mf||Ay,gm=(Df||Er)&&!la;var cS=Object.freeze({__proto__:null,get IS_IPOD(){return Ay},get IOS_VERSION(){return aS},get IS_ANDROID(){return Fs},get ANDROID_VERSION(){return oS},get IS_FIREFOX(){return lS},get IS_EDGE(){return du},get IS_CHROMIUM(){return hu},get IS_CHROME(){return la},get CHROMIUM_VERSION(){return Ny},get CHROME_VERSION(){return fm},IS_CHROMECAST_RECEIVER:F4,get IE_VERSION(){return uS},get IS_SAFARI(){return Df},get IS_WINDOWS(){return mm},get IS_IPAD(){return Mf},get IS_IPHONE(){return pm},get IS_TIZEN(){return Rf},get IS_WEBOS(){return jf},get IS_SMART_TV(){return Of},TOUCH_ENABLED:md,IS_IOS:Er,IS_ANY_SAFARI:gm});function I2(n){return typeof n=="string"&&!!n.trim()}function U4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ju(){return Tt===he.document}function Ou(n){return oa(n)&&n.nodeType===1}function dS(){try{return he.parent!==he.self}catch{return!0}}function hS(n){return function(e,t){if(!I2(e))return Tt[n](null);I2(t)&&(t=Tt.querySelector(t));const i=Ou(t)?t:Tt;return i[n]&&i[n](e)}}function bn(n="div",e={},t={},i){const a=Tt.createElement(n);return Object.getOwnPropertyNames(e).forEach(function(l){const u=e[l];l==="textContent"?Mo(a,u):(a[l]!==u||l==="tabIndex")&&(a[l]=u)}),Object.getOwnPropertyNames(t).forEach(function(l){a.setAttribute(l,t[l])}),i&&Dy(a,i),a}function Mo(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function qg(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function rd(n,e){return U4(e),n.classList.contains(e)}function hl(n,...e){return n.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n}function ym(n,...e){return n?(n.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n):(In.warn("removeClass was called with an element that doesn't exist"),null)}function fS(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 mS(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 wo(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 pS(n,e){return n.getAttribute(e)}function Au(n,e,t){n.setAttribute(e,t)}function bm(n,e){n.removeAttribute(e)}function gS(){Tt.body.focus(),Tt.onselectstart=function(){return!1}}function yS(){Tt.onselectstart=function(){return!0}}function Nu(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(Du(n,"height"))),t.width||(t.width=parseFloat(Du(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!==Tt[Nf.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function vm(n,e){const t={x:0,y:0};if(Er){let w=n;for(;w&&w.nodeName.toLowerCase()!=="html";){const S=Du(w,"transform");if(/^matrix/.test(S)){const A=S.slice(7,-1).split(/,\s/).map(Number);t.x+=A[4],t.y+=A[5]}else if(/^matrix3d/.test(S)){const A=S.slice(9,-1).split(/,\s/).map(Number);t.x+=A[12],t.y+=A[13]}if(w.assignedSlot&&w.assignedSlot.parentElement&&he.WebKitCSSMatrix){const A=he.getComputedStyle(w.assignedSlot.parentElement).transform,C=new he.WebKitCSSMatrix(A);t.x+=C.m41,t.y+=C.m42}w=w.parentNode||w.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,Er&&(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 bS(n){return oa(n)&&n.nodeType===3}function xm(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function vS(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),Ou(e)||bS(e))return e;if(typeof e=="string"&&/\S/.test(e))return Tt.createTextNode(e)}).filter(e=>e)}function Dy(n,e){return vS(e).forEach(t=>n.appendChild(t)),n}function xS(n,e){return Dy(xm(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 Do=hS("querySelector"),_S=hS("querySelectorAll");function Du(n,e){if(!n||!e)return"";if(typeof he.getComputedStyle=="function"){let t;try{t=he.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function wS(n){[...Tt.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(a=>a.cssText).join(""),i=Tt.createElement("style");i.textContent=t,n.document.head.appendChild(i)}catch{const i=Tt.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,n.document.head.appendChild(i)}})}var SS=Object.freeze({__proto__:null,isReal:ju,isEl:Ou,isInFrame:dS,createEl:bn,textContent:Mo,prependTo:qg,hasClass:rd,addClass:hl,removeClass:ym,toggleClass:fS,setAttributes:mS,getAttributes:wo,getAttribute:pS,setAttribute:Au,removeAttribute:bm,blockTextSelection:gS,unblockTextSelection:yS,getBoundingClientRect:Nu,findPosition:pd,getPointerPosition:vm,isTextNode:bS,emptyEl:xm,normalizeContent:vS,appendContent:Dy,insertContent:xS,isSingleLeftClick:gd,$:Do,$$:_S,computedStyle:Du,copyStyleSheetsToWindow:wS});let TS=!1,Vg;const z4=function(){if(Vg.options.autoSetup===!1)return;const n=Array.prototype.slice.call(Tt.getElementsByTagName("video")),e=Array.prototype.slice.call(Tt.getElementsByTagName("audio")),t=Array.prototype.slice.call(Tt.getElementsByTagName("video-js")),i=n.concat(e,t);if(i&&i.length>0)for(let a=0,l=i.length;a<l;a++){const u=i[a];if(u&&u.getAttribute)u.player===void 0&&u.getAttribute("data-setup")!==null&&Vg(u);else{Gg(1);break}}else TS||Gg(1)};function Gg(n,e){ju()&&(e&&(Vg=e),he.setTimeout(z4,n))}function Kg(){TS=!0,he.removeEventListener("load",Kg)}ju()&&(Tt.readyState==="complete"?Kg():he.addEventListener("load",Kg));const kS=function(n){const e=Tt.createElement("style");return e.className=n,e},ES=function(n,e){n.styleSheet?n.styleSheet.cssText=e:n.textContent=e};var Or=new WeakMap;const H4=3;let $4=H4;function Ts(){return $4++}function B2(n,e){if(!Or.has(n))return;const t=Or.get(n);t.handlers[e].length===0&&(delete t.handlers[e],n.removeEventListener?n.removeEventListener(e,t.dispatcher,!1):n.detachEvent&&n.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&Or.delete(n)}function My(n,e,t,i){t.forEach(function(a){n(e,a,i)})}function _m(n){if(n.fixed_)return n;function e(){return!0}function t(){return!1}if(!n||!n.isPropagationStopped||!n.isImmediatePropagationStopped){const i=n||he.event;n={};const a=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const l in i)a.includes(l)||l==="returnValue"&&i.preventDefault||(n[l]=i[l]);if(n.target||(n.target=n.srcElement||Tt),n.relatedTarget||(n.relatedTarget=n.fromElement===n.target?n.toElement:n.fromElement),n.preventDefault=function(){i.preventDefault&&i.preventDefault(),n.returnValue=!1,i.returnValue=!1,n.defaultPrevented=!0},n.defaultPrevented=!1,n.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),n.cancelBubble=!0,i.cancelBubble=!0,n.isPropagationStopped=e},n.isPropagationStopped=t,n.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),n.isImmediatePropagationStopped=e,n.stopPropagation()},n.isImmediatePropagationStopped=t,n.clientX!==null&&n.clientX!==void 0){const l=Tt.documentElement,u=Tt.body;n.pageX=n.clientX+(l&&l.scrollLeft||u&&u.scrollLeft||0)-(l&&l.clientLeft||u&&u.clientLeft||0),n.pageY=n.clientY+(l&&l.scrollTop||u&&u.scrollTop||0)-(l&&l.clientTop||u&&u.clientTop||0)}n.which=n.charCode||n.keyCode,n.button!==null&&n.button!==void 0&&(n.button=n.button&1?0:n.button&4?1:n.button&2?2:0)}return n.fixed_=!0,n}let Qh;const q4=function(){if(typeof Qh!="boolean"){Qh=!1;try{const n=Object.defineProperty({},"passive",{get(){Qh=!0}});he.addEventListener("test",null,n),he.removeEventListener("test",null,n)}catch{}}return Qh},V4=["touchstart","touchmove"];function ds(n,e,t){if(Array.isArray(e))return My(ds,n,e,t);Or.has(n)||Or.set(n,{});const i=Or.get(n);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=Ts()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(a,l){if(i.disabled)return;a=_m(a);const u=i.handlers[a.type];if(u){const h=u.slice(0);for(let f=0,g=h.length;f<g&&!a.isImmediatePropagationStopped();f++)try{h[f].call(n,a,l)}catch(w){In.error(w)}}}),i.handlers[e].length===1)if(n.addEventListener){let a=!1;q4()&&V4.indexOf(e)>-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function Cr(n,e,t){if(!Or.has(n))return;const i=Or.get(n);if(!i.handlers)return;if(Array.isArray(e))return My(Cr,n,e,t);const a=function(u,h){i.handlers[h]=[],B2(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<l.length;u++)l[u].guid===t.guid&&l.splice(u--,1);B2(n,e)}}function Lu(n,e,t){const i=Or.has(n)?Or.get(n):{},a=n.parentNode||n.ownerDocument;if(typeof e=="string"?e={type:e,target:n}:e.target||(e.target=n),e=_m(e),i.dispatcher&&i.dispatcher.call(n,e,t),a&&!e.isPropagationStopped()&&e.bubbles===!0)Lu.call(null,a,e,t);else if(!a&&!e.defaultPrevented&&e.target&&e.target[e.type]){Or.has(e.target)||Or.set(e.target,{});const l=Or.get(e.target);e.target[e.type]&&(l.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),l.disabled=!1)}return!e.defaultPrevented}function wm(n,e,t){if(Array.isArray(e))return My(wm,n,e,t);const i=function(){Cr(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Ts(),ds(n,e,i)}function Ry(n,e,t){const i=function(){Cr(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Ts(),ds(n,e,i)}var G4=Object.freeze({__proto__:null,fixEvent:_m,on:ds,off:Cr,trigger:Lu,one:wm,any:Ry});const ks=30,Ei=function(n,e,t){e.guid||(e.guid=Ts());const i=e.bind(n);return i.guid=t?t+"_"+e.guid:e.guid,i},ua=function(n,e){let t=he.performance.now();return function(...a){const l=he.performance.now();l-t>=e&&(n(...a),t=l)}},CS=function(n,e,t,i=he){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 K4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:ks,bind_:Ei,throttle:ua,debounce:CS});let Uc;class hs{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},ds(this,e,t),this.addEventListener=i}off(e,t){Cr(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},wm(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=_m(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Lu(this,e)}queueTrigger(e){Uc||(Uc=new Map);const t=e.type||e;let i=Uc.get(this);i||(i=new Map,Uc.set(this,i));const a=i.get(t);i.delete(t),he.clearTimeout(a);const l=he.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Uc.delete(this)),this.trigger(e)},0);i.set(t,l)}}hs.prototype.allowedEvents_={};hs.prototype.addEventListener=hs.prototype.on;hs.prototype.removeEventListener=hs.prototype.off;hs.prototype.dispatchEvent=hs.prototype.trigger;const Sm=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,Oa=n=>n instanceof hs||!!n.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof n[e]=="function"),W4=(n,e)=>{Oa(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Wg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,Lf=(n,e,t)=>{if(!n||!n.nodeName&&!Oa(n))throw new Error(`Invalid target for ${Sm(e)}#${t}; must be a DOM node or evented object.`)},AS=(n,e,t)=>{if(!Wg(n))throw new Error(`Invalid event type for ${Sm(e)}#${t}; must be a non-empty string or array.`)},NS=(n,e,t)=>{if(typeof n!="function")throw new Error(`Invalid listener for ${Sm(e)}#${t}; must be a function.`)},rg=(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]),Lf(a,n,t),AS(l,n,t),NS(u,n,t),u=Ei(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},el=(n,e,t,i)=>{Lf(n,n,e),n.nodeName?G4[e](n,t,i):n[e](t,i)},X4={on(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=rg(this,n,"on");if(el(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,el(this,"on","dispose",l),el(t,"on","dispose",u)}},one(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=rg(this,n,"one");if(e)el(t,"one",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,el(t,"one",i,l)}},any(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=rg(this,n,"any");if(e)el(t,"any",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,el(t,"any",i,l)}},off(n,e,t){if(!n||Wg(n))Cr(this.eventBusEl_,n,e);else{const i=n,a=e;Lf(i,this,"off"),AS(a,this,"off"),NS(t,this,"off"),t=Ei(this,t),this.off("dispose",t),i.nodeName?(Cr(i,a,t),Cr(i,"dispose",t)):Oa(i)&&(i.off(a,t),i.off("dispose",t))}},trigger(n,e){Lf(this.eventBusEl_,this,"trigger");const t=n&&typeof n!="string"?n.type:n;if(!Wg(t))throw new Error(`Invalid event type for ${Sm(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Lu(this.eventBusEl_,n,e)}};function jy(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_=bn("span",{className:"vjs-event-bus"});return Object.assign(n,X4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Or.has(i)&&Or.delete(i)}),he.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const Y4={state:{},setState(n){typeof n=="function"&&(n=n());let e;return cu(n,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Oa(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function DS(n,e){return Object.assign(n,Y4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Oa(n)&&n.on("statechanged",n.handleStateChanged),n}const sd=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toLowerCase())},Ki=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},MS=function(n,e){return Ki(n)===Ki(e)};var Q4=Object.freeze({__proto__:null,toLowerCase:sd,toTitleCase:Ki,titleCaseEquals:MS});class Ze{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=yi({},this.options_),t=this.options_=yi(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_${Ts()}`}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&&(jy(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),DS(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_=yi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return bn(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(w,S){const A=t[S-1];let C=A;return typeof A>"u"&&(C=w),C})),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<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",a=bn("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),l=Tt.createElementNS(i,"svg");l.setAttributeNS(null,"viewBox","0 0 512 512");const u=Tt.createElementNS(i,"use");return l.appendChild(u),u.setAttributeNS(null,"href",`#vjs-icon-${e}`),a.appendChild(l),this.iconIsSet_?t.replaceChild(a,t.querySelector(".vjs-icon-placeholder")):t.appendChild(a),this.iconIsSet_=!0,a}addChild(e,t={},i=this.children_.length){let a,l;if(typeof e=="string"){l=Ki(e);const u=t.componentClass||l;t.name=l;const h=Ze.getComponent(u);if(!h)throw new Error(`Component ${u} does not exist`);if(typeof h!="function")return null;a=new h(this.player_||this,t)}else a=e;if(a.parentComponent_&&a.parentComponent_.removeChild(a),this.children_.splice(i,0,a),a.parentComponent_=this,typeof a.id=="function"&&(this.childIndex_[a.id()]=a),l=l||a.name&&Ki(a.name()),l&&(this.childNameIndex_[l]=a,this.childNameIndex_[sd(l)]=a),typeof a.el=="function"&&a.el()){let u=null;this.children_[i+1]&&(this.children_[i+1].el_?u=this.children_[i+1].el_:Ou(this.children_[i+1])&&(u=this.children_[i+1])),this.contentEl().insertBefore(a.el(),u)}return a}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let a=this.children_.length-1;a>=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_[Ki(e.name())]=null,this.childNameIndex_[sd(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=Ze.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=Ze.getComponent(u.opts.componentClass||Ki(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 Do(e,t||this.contentEl())}$$(e,t){return _S(e,t||this.contentEl())}hasClass(e){return rd(this.el_,e)}addClass(...e){hl(this.el_,...e)}removeClass(...e){ym(this.el_,...e)}toggleClass(e,t){fS(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 pS(this.el_,e)}setAttribute(e,t){Au(this.el_,e,t)}removeAttribute(e){bm(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"+Ki(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Du(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${Ki(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=he.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&&he.performance.now()-e<a&&(h.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ei(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(a){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Ei(this,e),this.clearTimersOnDispose_(),i=he.setTimeout(()=>{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),he.clearTimeout(e)),e}setInterval(e,t){e=Ei(this,e),this.clearTimersOnDispose_();const i=he.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),he.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ei(this,e),t=he.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=Ei(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),he.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=he.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"||he.getComputedStyle(l).height==="0px"||he.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>(Tt.documentElement.clientWidth||he.innerWidth)||u.y<0||u.y>(Tt.documentElement.clientHeight||he.innerHeight))return!1;let h=Tt.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=Ze.getComponent("Tech"),a=i&&i.isTech(t),l=Ze===t||Ze.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=Ki(e),Ze.components_||(Ze.components_={});const u=Ze.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;g<f.length;g++)if(h[f[g]]!==null)throw new Error("Can not register Player component after player has been created.")}}return Ze.components_[e]=t,Ze.components_[sd(e)]=t,t}static getComponent(e){if(!(!e||!Ze.components_))return Ze.components_[e]}}Ze.registerComponent("Component",Ze);function Z4(n,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${n}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function P2(n,e,t,i){return Z4(n,i,t.length-1),t[i][e]}function sg(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:P2.bind(null,"start",0,n),end:P2.bind(null,"end",1,n)},he.Symbol&&he.Symbol.iterator&&(e[he.Symbol.iterator]=()=>(n||[]).values()),e}function Ps(n,e){return Array.isArray(n)?sg(n):n===void 0||e===void 0?sg():sg([[n,e]])}const RS=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 Oy=RS;function jS(n){Oy=n}function OS(){Oy=RS}function vl(n,e=n){return Oy(n,e)}var J4=Object.freeze({__proto__:null,createTimeRanges:Ps,createTimeRange:Ps,setFormatTime:jS,resetFormatTime:OS,formatTime:vl});function LS(n,e){let t=0,i,a;if(!e)return 0;(!n||!n.length)&&(n=Ps(0,0));for(let l=0;l<n.length;l++)i=n.start(l),a=n.end(l),a>e&&(a=e),t+=a-i;return t/e}function zi(n){if(n instanceof zi)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:oa(n)&&(typeof n.code=="number"&&(this.code=n.code),Object.assign(this,n)),this.message||(this.message=zi.defaultMessages[this.code]||"")}zi.prototype.code=0;zi.prototype.message="";zi.prototype.status=null;zi.prototype.metadata=null;zi.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];zi.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."};zi.MEDIA_ERR_CUSTOM=0;zi.prototype.MEDIA_ERR_CUSTOM=0;zi.MEDIA_ERR_ABORTED=1;zi.prototype.MEDIA_ERR_ABORTED=1;zi.MEDIA_ERR_NETWORK=2;zi.prototype.MEDIA_ERR_NETWORK=2;zi.MEDIA_ERR_DECODE=3;zi.prototype.MEDIA_ERR_DECODE=3;zi.MEDIA_ERR_SRC_NOT_SUPPORTED=4;zi.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;zi.MEDIA_ERR_ENCRYPTED=5;zi.prototype.MEDIA_ERR_ENCRYPTED=5;function ad(n){return n!=null&&typeof n.then=="function"}function na(n){ad(n)&&n.then(null,e=>{})}const Xg=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}})})},eM=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=Xg(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(Xg))},tM=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 Yg={textTracksToJson:eM,jsonToTextTracks:tM,trackToJson:Xg};const ag="vjs-modal-dialog";class Iu extends Ze{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_=bn("div",{className:`${ag}-content`},{role:"document"}),this.descEl_=bn("p",{className:`${ag}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Mo(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`${ag} 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(),xS(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"),xm(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=Tt.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.length;l++)if(i===t[l]){a=l;break}Tt.activeElement===this.el_&&(a=0),e.shiftKey&&a===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&a===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof he.HTMLAnchorElement||t instanceof he.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof he.HTMLInputElement||t instanceof he.HTMLSelectElement||t instanceof he.HTMLTextAreaElement||t instanceof he.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof he.HTMLIFrameElement||t instanceof he.HTMLObjectElement||t instanceof he.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Iu.prototype.options_={pauseOnOpen:!0,temporary:!0};Ze.registerComponent("ModalDialog",Iu);class xl extends hs{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Oa(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,a=this.length;i<a;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,a=this.length;i<a;i++){const l=this[i];if(l.id===e){t=l;break}}return t}}xl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const n in xl.prototype.allowedEvents_)xl.prototype["on"+n]=null;const og=function(n,e){for(let t=0;t<n.length;t++)!Object.keys(n[t]).length||e.id===n[t].id||(n[t].enabled=!1)};class IS extends xl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){og(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&og(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,og(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 lg=function(n,e){for(let t=0;t<n.length;t++)!Object.keys(n[t]).length||e.id===n[t].id||(n[t].selected=!1)};class BS extends xl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){lg(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&lg(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,lg(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 Ly extends xl{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 nM{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,a=this.trackElements_.length;i<a;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class If{constructor(e){If.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const a=e.length;this.cues_=e,this.length_=e.length;const l=function(u){""+u in this||Object.defineProperty(this,""+u,{get(){return this.cues_[u]}})};if(t<a)for(i=t;i<a;i++)l.call(this,i)}getCueById(e){let t=null;for(let i=0,a=this.length;i<a;i++){const l=this[i];if(l.id===e){t=l;break}}return t}}const iM={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},rM={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},sM={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},F2={disabled:"disabled",hidden:"hidden",showing:"showing"};class Iy extends hs{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Ts(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const a in t)Object.defineProperty(this,a,{get(){return t[a]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(a){a!==i&&(i=a,this.trigger("labelchange"))}})}}const By=function(n){return new URL(n,Tt.baseURI)},PS=function(n){return new URL(n,Tt.baseURI).href},Py=function(n){if(typeof n=="string"){const t=n.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},Tm=function(n,e=he.location){return By(n).origin!==e.origin};var aM=Object.freeze({__proto__:null,parseUrl:By,getAbsoluteURL:PS,getFileExtension:Py,isCrossOrigin:Tm});const U2=function(n,e){const t=new he.WebVTT.Parser(he,he.vttjs,he.WebVTT.StringDecoder()),i=[];t.oncue=function(a){e.addCue(a)},t.onparsingerror=function(a){i.push(a)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(n),i.length>0&&(he.console&&he.console.groupCollapsed&&he.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>In.error(a)),he.console&&he.console.groupEnd&&he.console.groupEnd()),t.flush()},z2=function(n,e){const t={uri:n},i=Tm(n);i&&(t.cors=i);const a=e.tech_.crossOrigin()==="use-credentials";a&&(t.withCredentials=a),Uw(t,Ei(this,function(l,u,h){if(l)return In.error(l,u);e.loaded_=!0,typeof he.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],f=>{if(f.type==="vttjserror"){In.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return U2(h,e)}):U2(h,e)}))};class Sd extends Iy{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=yi(e,{kind:sM[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=F2[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 If(this.cues_),u=new If(this.activeCues_);let h=!1;this.timeupdateHandler=Ei(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){F2[g]&&i!==g&&(i=g,!this.preload_&&i!=="disabled"&&this.cues.length===0&&z2(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(),w=[];for(let S=0,A=this.cues.length;S<A;S++){const C=this.cues[S];C.startTime<=g&&C.endTime>=g&&w.push(C)}if(h=!1,w.length!==this.activeCues_.length)h=!0;else for(let S=0;S<w.length;S++)this.activeCues_.indexOf(w[S])===-1&&(h=!0);return this.activeCues_=w,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")&&z2(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 he.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<i.length;a++)i[a]!==this&&i[a].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return Yg.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Sd.prototype.allowedEvents_={cuechange:"cuechange"};class FS extends Iy{constructor(e={}){const t=yi(e,{kind:rM[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(a){typeof a!="boolean"||a===i||(i=a,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class US extends Iy{constructor(e={}){const t=yi(e,{kind:iM[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(a){typeof a!="boolean"||a===i||(i=a,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Ia extends hs{constructor(e={}){super();let t;const i=new Sd(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=Ia.NONE,i.addEventListener("loadeddata",()=>{t=Ia.LOADED,this.trigger({type:"load",target:this})})}}Ia.prototype.allowedEvents_={load:"load"};Ia.NONE=0;Ia.LOADING=1;Ia.LOADED=2;Ia.ERROR=3;const Ss={audio:{ListClass:IS,TrackClass:FS,capitalName:"Audio"},video:{ListClass:BS,TrackClass:US,capitalName:"Video"},text:{ListClass:Ly,TrackClass:Sd,capitalName:"Text"}};Object.keys(Ss).forEach(function(n){Ss[n].getterName=`${n}Tracks`,Ss[n].privateName=`${n}Tracks_`});const Mu={remoteText:{ListClass:Ly,TrackClass:Sd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:nM,TrackClass:Ia,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},jr=Object.assign({},Ss,Mu);Mu.names=Object.keys(Mu);Ss.names=Object.keys(Ss);jr.names=[].concat(Mu.names).concat(Ss.names);function oM(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 jr.text.TrackClass(a);return l.addTrack(u),u}class En extends Ze{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}),jr.names.forEach(i=>{const a=jr[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 jr.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(Ei(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 Ps(0,0)}bufferedPercent(){return LS(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(Ss.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 zi(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ps(0,0):Ps()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ss.names.forEach(e=>{const t=Ss[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(!he.WebVTT)if(Tt.body.contains(this.el())){if(!this.options_["vtt.js"]&&Cu(d2)&&Object.keys(d2).length>0){this.trigger("vttjsloaded");return}const e=Tt.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}),he.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;h<e.length;h++){const f=e[h];f.removeEventListener("cuechange",l),f.mode==="showing"&&f.addEventListener("cuechange",l)}};u(),e.addEventListener("change",u),e.addEventListener("addtrack",u),e.addEventListener("removetrack",u),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",a),e.removeEventListener("change",u),e.removeEventListener("addtrack",u),e.removeEventListener("removetrack",u);for(let h=0;h<e.length;h++)e[h].removeEventListener("cuechange",l)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return oM(this,e,t,i)}createRemoteTextTrack(e){const t=yi(e,{tech:this});return new Mu.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.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=Ts();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 En.canPlayType(e.type)}static isTech(e){return e.prototype instanceof En||e instanceof En||e===En}static registerTech(e,t){if(En.techs_||(En.techs_={}),!En.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!En.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!En.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ki(e),En.techs_[e]=t,En.techs_[sd(e)]=t,e!=="Tech"&&En.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(En.techs_&&En.techs_[e])return En.techs_[e];if(e=Ki(e),he&&he.videojs&&he.videojs[e])return In.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),he.videojs[e]}}}jr.names.forEach(function(n){const e=jr[n];En.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});En.prototype.featuresVolumeControl=!0;En.prototype.featuresMuteControl=!0;En.prototype.featuresFullscreenResize=!1;En.prototype.featuresPlaybackRate=!1;En.prototype.featuresProgressEvents=!1;En.prototype.featuresSourceset=!1;En.prototype.featuresTimeupdateEvents=!1;En.prototype.featuresNativeTextTracks=!1;En.prototype.featuresVideoFrameCallback=!1;En.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;l<i.length;l++)if(a=i[l].canPlayType(t),a)return a;return""},n.selectSourceHandler=function(t,i){const a=n.sourceHandlers||[];let l;for(let u=0;u<a.length;u++)if(l=a[u].canHandleSource(t,i),l)return a[u];return null},n.canPlaySource=function(t,i){const a=n.selectSourceHandler(t,i);return a?a.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},n.prototype),n.prototype.setSource=function(t){let i=n.selectSourceHandler(t,this.options_);i||(n.nativeSourceHandler?i=n.nativeSourceHandler:In.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==n.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},n.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};Ze.registerComponent("Tech",En);En.registerTech("Tech",En);En.defaultTechOrder_=[];const fl={},Bf={},Pf={};function lM(n,e){fl[n]=fl[n]||[],fl[n].push(e)}function uM(n,e,t){n.setTimeout(()=>rl(e,fl[e.type],t,n),1)}function cM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function dM(n,e,t){return n.reduceRight(Fy(t),e[t]())}function hM(n,e,t,i){return e[t](n.reduce(Fy(t),i))}function H2(n,e,t,i=null){const a="call"+Ki(t),l=n.reduce(Fy(a),i),u=l===Pf,h=u?null:e[t](l);return pM(n,t,h,u),h}const fM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},mM={setCurrentTime:1,setMuted:1,setVolume:1},$2={play:1,pause:1};function Fy(n){return(e,t)=>e===Pf?Pf:t[n]?t[n](e):e}function pM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function gM(n){Bf.hasOwnProperty(n.id())&&delete Bf[n.id()]}function yM(n,e){const t=Bf[n.id()];let i=null;if(t==null)return i=e(n),Bf[n.id()]=[[e,i]],i;for(let a=0;a<t.length;a++){const[l,u]=t[a];l===e&&(i=u)}return i===null&&(i=e(n),t.push([e,i])),i}function rl(n={},e=[],t,i,a=[],l=!1){const[u,...h]=e;if(typeof u=="string")rl(n,fl[u],t,i,a,l);else if(u){const f=yM(i,u);if(!f.setSource)return a.push(f),rl(n,h,t,i,a,l);f.setSource(Object.assign({},n),function(g,w){if(g)return rl(n,h,t,i,a,l);a.push(f),rl(w,n.type===w.type?h:fl[w.type],t,i,a,l)})}else h.length?rl(n,h,t,i,a,l):l?t(n,a):rl(n,fl["*"],t,i,a,!0)}const bM={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Ff=function(n=""){const e=Py(n);return bM[e.toLowerCase()]||""},vM=(n,e)=>{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<i.length;a++){const l=i[a];if(l.type&&l.src&&l.src===e)return l.type}return Ff(e)},zS=function(n){if(Array.isArray(n)){let e=[];n.forEach(function(t){t=zS(t),Array.isArray(t)?e=e.concat(t):oa(t)&&e.push(t)}),n=e}else typeof n=="string"&&n.trim()?n=[q2({src:n})]:oa(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?n=[q2(n)]:n=[];return n};function q2(n){if(!n.type){const e=Ff(n.src);e&&(n.type=e)}return n}var xM=`<svg xmlns="http://www.w3.org/2000/svg">
|
||
<defs>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
||
<path d="M16 10v28l22-14z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-pause">
|
||
<path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-audio">
|
||
<path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-captions">
|
||
<path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
|
||
<path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
|
||
<path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
|
||
<path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
|
||
<path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
|
||
<path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
|
||
<path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
|
||
<path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
|
||
<path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
|
||
<path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 24 24" id="vjs-icon-hd">
|
||
<path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
|
||
<path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
|
||
<path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
|
||
<path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
|
||
<path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
|
||
<path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-share">
|
||
<path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-cog">
|
||
<path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-square">
|
||
<path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-circle">
|
||
<circle cx="24" cy="24" r="20"></circle>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
|
||
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
|
||
<path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
|
||
<path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-replay">
|
||
<path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
|
||
<path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
|
||
<path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
|
||
<path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
|
||
<path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
|
||
<path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
|
||
<path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
|
||
<path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
|
||
<g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
|
||
<path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
|
||
<path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
|
||
<path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-cast">
|
||
<path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
|
||
<path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
|
||
<path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
|
||
<path fill="none" d="M-1-3h24v24H-1z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
|
||
<path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
|
||
<path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
|
||
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
|
||
</symbol>
|
||
<symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
|
||
<path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
|
||
</symbol>
|
||
<symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
|
||
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
||
</symbol>
|
||
</defs>
|
||
</svg>`;const V2=Rf?10009:jf?461:8,Ql={codes:{play:415,pause:19,ff:417,rw:412,back:V2},names:{415:"play",19:"pause",417:"ff",412:"rw",[V2]:"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}},G2=5;class _M extends hs{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(Ql.isEventKey(t,"play")||Ql.isEventKey(t,"pause")||Ql.isEventKey(t,"ff")||Ql.isEventKey(t,"rw")){t.preventDefault();const i=Ql.getEventName(t);this.performMediaAction_(i)}else Ql.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()+G2);break;case"rw":this.userSeek_(this.player_.currentTime()-G2);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(),w={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:w,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;a<i.children.length;a++){const l=i.children[a],u=t(l);if(u)return u}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(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<a&&(a=f,l=u)}return l}isInDirection_(e,t,i){switch(i){case"right":return t.left>=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;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const a=Math.abs(e.x-t.x),l=Math.abs(e.y-t.y);let u;switch(i){case"right":case"left":u=a+l*100;break;case"up":u=l*2+a*.5;break;case"down":u=l*5+a;break;default:u=a+l}return u}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class wM extends Ze{constructor(e,t,i){const a=yi({createEl:!1},t);if(super(e,a,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let l=0,u=t.playerOptions.techOrder;l<u.length;l++){const h=Ki(u[l]);let f=En.getTech(h);if(h||(f=Ze.getComponent(h)),f&&f.isSupported()){e.loadTech_(h);break}}else e.src(t.playerOptions.sources)}}Ze.registerComponent("MediaLoader",wM);class km extends Ze{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.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"&&In.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=bn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(bn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=bn("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,Mo(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)}}Ze.registerComponent("ClickableComponent",km);class Qg extends km{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 bn("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(bn("picture",{className:"vjs-poster",tabIndex:-1},{},bn("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()?na(this.player_.play()):this.player_.pause())}}Qg.prototype.crossorigin=Qg.prototype.crossOrigin;Ze.registerComponent("PosterImage",Qg);const vs="#222",K2="#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 ug(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 Zs(n,e,t){try{n.style[e]=t}catch{return}}function W2(n){return n?`${n}px`:""}class TM extends Ze{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(Ei(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=he.screen.orientation||he,h=he.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;g<f.length;g++)this.player_.addRemoteTextTrack(f[g],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let a,l,u;for(let h=0;h<t.length;h++){const f=t[h];i&&i.enabled&&i.language&&i.language===f.language&&f.kind in e?f.kind===i.kind?u=f:u||(u=f):i&&!i.enabled?(u=null,a=null,l=null):f.default&&(f.kind==="descriptions"&&!a?a=f:f.kind in e&&!l&&(l=f))}u?u.mode="showing":l?l.mode="showing":a&&(a.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof he.WebVTT=="function"&&he.WebVTT.processCues(he,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const u=[];for(let h=0;h<e.length;++h){const f=e[h];f.mode==="showing"&&u.push(f)}this.updateForTrack(u);return}let i=null,a=null,l=e.length;for(;l--;){const u=e[l];u.mode==="showing"&&(u.kind==="descriptions"?i=u:a=u)}if(a?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(a)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!he.CSS.supports("inset","10px")){const u=this.el_,h=u.querySelectorAll(".vjs-text-track-cue"),f=this.player_.controlBar.el_.getBoundingClientRect().height,g=this.player_.el_.getBoundingClientRect().height;u.style="",Zs(u,"position","relative"),Zs(u,"height",g-f+"px"),Zs(u,"top","unset"),Of?Zs(u,"bottom",g+"px"):Zs(u,"bottom","0px"),h.length>0&&h.forEach(w=>{if(w.style.inset){const S=w.style.inset.split(" ");S.length===3&&Object.assign(w.style,{top:S[0],right:S[1],bottom:S[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!he.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)),Zs(this.el_,"insetInline",W2(l)),Zs(this.el_,"insetBlock",W2(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&&Zs(u.firstChild,"color",ug(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(u.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Zs(u.firstChild,"backgroundColor",ug(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Zs(u,"backgroundColor",ug(t.windowColor,t.windowOpacity)):u.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?u.firstChild.style.textShadow=`2px 2px 3px ${vs}, 2px 2px 4px ${vs}, 2px 2px 5px ${vs}`:t.edgeStyle==="raised"?u.firstChild.style.textShadow=`1px 1px ${vs}, 2px 2px ${vs}, 3px 3px ${vs}`:t.edgeStyle==="depressed"?u.firstChild.style.textShadow=`1px 1px ${K2}, 0 1px ${K2}, -1px -1px ${vs}, 0 -1px ${vs}`:t.edgeStyle==="uniform"&&(u.firstChild.style.textShadow=`0 0 4px ${vs}, 0 0 4px ${vs}, 0 0 4px ${vs}, 0 0 4px ${vs}`)),t.fontPercent&&t.fontPercent!==1){const h=he.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 he.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const a=e[i];for(let l=0;l<a.activeCues.length;++l)t.push(a.activeCues[l])}he.WebVTT.processCues(he,t,this.el_);for(let i=0;i<e.length;++i){const a=e[i];for(let l=0;l<a.activeCues.length;++l){const u=a.activeCues[l].displayState;hl(u,"vjs-text-track-cue","vjs-text-track-cue-"+(a.language?a.language:i)),a.language&&Au(u,"lang",a.language)}this.player_.textTrackSettings&&this.updateDisplayState(a)}}}Ze.registerComponent("TextTrackDisplay",TM);class kM extends Ze{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=bn("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),a=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return a.appendChild(i),a}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}Ze.registerComponent("LoadingSpinner",kM);class Ar extends km{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const a=bn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(bn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}addChild(e,t={}){const i=this.constructor.name;return In.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),Ze.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}Ze.registerComponent("Button",Ar);class HS extends Ar{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.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){na(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();ad(t)?t.then(l,()=>{}):this.setTimeout(l,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}HS.prototype.controlText_="Play Video";Ze.registerComponent("BigPlayButton",HS);class EM extends Ar{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)}}Ze.registerComponent("CloseButton",EM);class $S extends Ar{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()?na(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))}}$S.prototype.controlText_="Play";Ze.registerComponent("PlayToggle",$S);class Bu extends Ze{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=bn("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=bn("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=vl(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,In.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_=Tt.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Bu.prototype.labelText_="Time";Bu.prototype.controlText_="Time";Ze.registerComponent("TimeDisplay",Bu);class Uy extends Bu{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)}}Uy.prototype.labelText_="Current Time";Uy.prototype.controlText_="Current Time";Ze.registerComponent("CurrentTimeDisplay",Uy);class zy extends Bu{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)}}zy.prototype.labelText_="Duration";zy.prototype.controlText_="Duration";Ze.registerComponent("DurationDisplay",zy);class CM extends Ze{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}}Ze.registerComponent("TimeDivider",CM);class Hy extends Bu{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(bn("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";Ze.registerComponent("RemainingTimeDisplay",Hy);class AM extends Ze{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_=bn("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(bn("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(Tt.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()}}Ze.registerComponent("LiveDisplay",AM);class qS extends Ar{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_=bn("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()}}qS.prototype.controlText_="Seek to live, currently playing live";Ze.registerComponent("SeekToLive",qS);function Td(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var NM=Object.freeze({__proto__:null,clamp:Td});class $y extends Ze{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"&&!la&&e.preventDefault(),gS(),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;yS(),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(Td(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=vm(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")}}Ze.registerComponent("Slider",$y);const cg=(n,e)=>Td(n/e*100,0,100).toFixed(2)+"%";class DM extends Ze{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=bn("span",{className:"vjs-control-text"}),i=bn("span",{textContent:this.localize("Loaded")}),a=Tt.createTextNode(": ");return this.percentageEl_=bn("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=cg(l,a);this.percent_!==h&&(this.el_.style.width=h,Mo(this.percentageEl_,h),this.percent_=h);for(let f=0;f<i.length;f++){const g=i.start(f),w=i.end(f);let S=u[f];S||(S=this.el_.appendChild(bn()),u[f]=S),!(S.dataset.start===g&&S.dataset.end===w)&&(S.dataset.start=g,S.dataset.end=w,S.style.left=cg(g,l),S.style.width=cg(w-g,l))}for(let f=u.length;f>i.length;f--)this.el_.removeChild(u[f-1]);u.length=i.length})}}Ze.registerComponent("LoadProgressBar",DM);class MM extends Ze{constructor(e,t){super(e,t),this.update=ua(Ei(this,this.update),ks)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const a=pd(this.el_),l=Nu(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;h<g?g+=g-h:f<g&&(g=f),g<0?g=0:g>a.width&&(g=a.width),g=Math.round(g),this.el_.style.right=`-${g}px`,this.write(i)}write(e){Mo(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?"":"-")+vl(f,h)}else l=vl(i,u);this.update(e,t,l),a&&a()})}}Ze.registerComponent("TimeTooltip",MM);class qy extends Ze{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ua(Ei(this,this.update),ks)}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)}}qy.prototype.options_={children:[]};!Er&&!Fs&&qy.prototype.options_.children.push("timeTooltip");Ze.registerComponent("PlayProgressBar",qy);class VS extends Ze{constructor(e,t){super(e,t),this.update=ua(Ei(this,this.update),ks)}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`})}}VS.prototype.options_={children:["timeTooltip"]};Ze.registerComponent("MouseTimeDisplay",VS);class Em extends $y{constructor(e,t){t=yi(Em.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(Er||Fs)||e.options_.disableSeekWhileScrubbingOnSTV;(!Er&&!Fs||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ei(this,this.update),this.update=ua(this.update_,ks),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 Tt&&"visibilityState"in Tt&&this.on(Tt,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){Tt.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,ks))}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(Tt.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}",[vl(i,l),vl(l,l)],"{1} of {2}")),this.currentTime_=i,this.duration_=l),this.bar&&this.bar.update(Nu(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?na(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 Tt&&"visibilityState"in Tt&&this.off(Tt,"visibilitychange",this.toggleVisibility_),super.dispose()}}Em.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};Ze.registerComponent("SeekBar",Em);class GS extends Ze{constructor(e,t){super(e,t),this.handleMouseMove=ua(Ei(this,this.handleMouseMove),ks),this.throttledHandleMouseSeek=ua(Ei(this,this.handleMouseSeek),ks),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=vm(l,e).x;h=Td(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&&na(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()}}GS.prototype.options_={children:["seekBar"]};Ze.registerComponent("ProgressControl",GS);class KS extends Ar{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(){Tt.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in he?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 Tt.exitPictureInPicture=="function"&&super.show()}}KS.prototype.controlText_="Picture-in-Picture";Ze.registerComponent("PictureInPictureToggle",KS);class WS extends Ar{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),Tt[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()}}WS.prototype.controlText_="Fullscreen";Ze.registerComponent("FullscreenToggle",WS);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 jM extends Ze{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}}Ze.registerComponent("VolumeLevel",jM);class OM extends Ze{constructor(e,t){super(e,t),this.update=ua(Ei(this,this.update),ks)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,a){if(!i){const l=Nu(this.el_),u=Nu(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 w=l.width/2;f<w?w+=w-f:g<w&&(w=g),w<0?w=0:w>l.width&&(w=l.width),this.el_.style.right=`-${w}px`}this.write(`${a}%`)}write(e){Mo(this.el_,e)}updateVolume(e,t,i,a,l){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,a.toFixed(0)),l&&l()})}}Ze.registerComponent("VolumeLevelTooltip",OM);class XS extends Ze{constructor(e,t){super(e,t),this.update=ua(Ei(this,this.update),ks)}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`})}}XS.prototype.options_={children:["volumeLevelTooltip"]};Ze.registerComponent("MouseVolumeLevelDisplay",XS);class Cm extends $y{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=Nu(i),l=this.vertical();let u=vm(i,e);u=l?u.y:u.x,u=Td(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)})}}Cm.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Er&&!Fs&&Cm.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Cm.prototype.playerEvent="volumechange";Ze.registerComponent("VolumeBar",Cm);class YS extends Ze{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Cu(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),RM(this,e),this.throttledHandleMouseMove=ua(Ei(this,this.handleMouseMove),ks),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)}}YS.prototype.options_={children:["volumeBar"]};Ze.registerComponent("VolumeControl",YS);const LM=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 QS extends Ar{constructor(e,t){super(e,t),LM(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"),Er&&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),ym(this.el_,[0,1,2,3].reduce((i,a)=>i+`${a?" ":""}vjs-vol-${a}`,"")),hl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}QS.prototype.controlText_="Mute";Ze.registerComponent("MuteToggle",QS);class ZS extends Ze{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Cu(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"),ds(Tt,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Cr(Tt,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}ZS.prototype.options_={children:["muteToggle","volumeControl"]};Ze.registerComponent("VolumePanel",ZS);class JS extends Ar{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]))}}JS.prototype.controlText_="Skip Forward";Ze.registerComponent("SkipForward",JS);class eT extends Ar{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]))}}eT.prototype.controlText_="Skip Backward";Ze.registerComponent("SkipBackward",eT);class tT extends Ze{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 Ze&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Ze&&(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_=bn(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_),ds(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||Tt.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())}}Ze.registerComponent("Menu",tT);class Vy extends Ze{constructor(e,t={}){super(e,t),this.menuButton_=new Ar(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Ar.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(),ds(Tt,"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 tT(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=bn("li",{className:"vjs-menu-title",textContent:Ki(this.options_.title),tabIndex:-1}),i=new Ze(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=Ar.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),Cr(Tt,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Er&&dS())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}Ze.registerComponent("MenuButton",Vy);class Gy extends Vy{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const a=Ei(this,this.update);i.addEventListener("removetrack",a),i.addEventListener("addtrack",a),i.addEventListener("labelchange",a),this.player_.on("ready",a),this.player_.on("dispose",function(){i.removeEventListener("removetrack",a),i.removeEventListener("addtrack",a),i.removeEventListener("labelchange",a)})}}Ze.registerComponent("TrackButton",Gy);class kd extends km{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const a=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),l=bn("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?a.appendChild(l):a.replaceChild(l,a.querySelector(".vjs-icon-placeholder")),a}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}Ze.registerComponent("MenuItem",kd);class Ed extends kd{constructor(e,t){const i=t.track,a=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const l=(...h)=>{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 he.Event!="object")try{h=new he.Event("change")}catch{}h||(h=Tt.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<i.length;a++){const l=i[a];this.kinds.indexOf(l.kind)!==-1&&(l===t?l.mode!=="showing"&&(l.mode="showing"):l.mode!=="disabled"&&(l.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}Ze.registerComponent("TextTrackMenuItem",Ed);class nT extends Ed{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let a=0,l=t.length;a<l;a++){const u=t[a];if(this.options_.kinds.indexOf(u.kind)>-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<l;a++){const u=t[a];if(["captions","descriptions","subtitles"].indexOf(u.kind)>-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()}}Ze.registerComponent("OffTextTrackMenuItem",nT);class Pu extends Gy{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 nT(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<a.length;l++){const u=a[l];if(this.kinds_.indexOf(u.kind)>-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}}Ze.registerComponent("TextTrackButton",Pu);class iT 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<a.endTime,super(e,t),this.track=i,this.cue=a}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}Ze.registerComponent("ChaptersTrackMenuItem",iT);class Ky extends Pu{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{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(Ki(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<a;i++){const l=t[i],u=new iT(this.player_,{track:this.track_,cue:l});e.push(u)}return e}}Ky.prototype.kind_="chapters";Ky.prototype.controlText_="Chapters";Ze.registerComponent("ChaptersButton",Ky);class Wy extends Pu{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const a=e.textTracks(),l=Ei(this,this.handleTracksChange);a.addEventListener("change",l),this.on("dispose",function(){a.removeEventListener("change",l)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let a=0,l=t.length;a<l;a++){const u=t[a];if(u.kind!==this.kind_&&u.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Wy.prototype.kind_="descriptions";Wy.prototype.controlText_="Descriptions";Ze.registerComponent("DescriptionsButton",Wy);class Xy extends Pu{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Xy.prototype.kind_="subtitles";Xy.prototype.controlText_="Subtitles";Ze.registerComponent("SubtitlesButton",Xy);class Yy extends Ed{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}Ze.registerComponent("CaptionSettingsMenuItem",Yy);class Qy extends Pu{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Yy(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Qy.prototype.kind_="captions";Qy.prototype.controlText_="Captions";Ze.registerComponent("CaptionsButton",Qy);class rT extends Ed{createEl(e,t,i){const a=super.createEl(e,t,i),l=a.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",a):l.appendChild(bn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(bn("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),a}}Ze.registerComponent("SubsCapsMenuItem",rT);class Zy extends Pu{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Ki(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 Yy(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,rT),e}}Zy.prototype.kinds_=["captions","subtitles"];Zy.prototype.controlText_="Subtitles";Ze.registerComponent("SubsCapsButton",Zy);class sT 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(bn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(bn("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;i<t.length;i++){const a=t[i];a!==this.track&&(a.enabled=a===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}Ze.registerComponent("AudioTrackMenuItem",sT);class aT extends Gy{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const a=t[i];e.push(new sT(this.player_,{track:a,selectable:!0,multiSelectable:!1}))}return e}}aT.prototype.controlText_="Audio Track";Ze.registerComponent("AudioTrackButton",aT);class Jy extends kd{constructor(e,t){const i=t.rate,a=parseFloat(i,10);t.label=i,t.selected=a===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=a,this.on(e,"ratechange",l=>this.update(l))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Jy.prototype.contentElType="button";Ze.registerComponent("PlaybackRateMenuItem",Jy);class oT extends Vy{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_=bn("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 Jy(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")}}oT.prototype.controlText_="Playback Rate";Ze.registerComponent("PlaybackRateMenuButton",oT);class lT extends Ze{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Ze.registerComponent("Spacer",lT);class IM extends lT{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Ze.registerComponent("CustomControlSpacer",IM);class uT extends Ze{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}uT.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};Ze.registerComponent("ControlBar",uT);class cT extends Iu{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):""}}cT.prototype.options_=Object.assign({},Iu.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Ze.registerComponent("ErrorDisplay",cT);class dT extends Ze{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(),bn("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Ts()}`)+"-"+t[1].replace(/\W+/g,""),a=bn("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return a.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),a}))}}Ze.registerComponent("TextTrackSelect",dT);class ml extends Ze{constructor(e,t={}){super(e,t);const i=bn("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 w=`vjs_select_${Ts()}`;if(this.options_.type==="colors"){g=bn("span",{className:h});const A=bn("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});A.setAttribute("for",w),g.appendChild(A)}const S=new dT(e,{SelectOptions:u.options,legendId:this.options_.legendId,id:w,labelId:f});this.addChild(S),this.options_.type==="colors"&&(g.appendChild(S.el()),this.el().appendChild(g))}}createEl(){return bn("fieldset",{className:this.options_.className})}}Ze.registerComponent("TextTrackFieldset",ml);class hT extends Ze{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new ml(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 ml(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 ml(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 bn("div",{className:"vjs-track-settings-colors"})}}Ze.registerComponent("TextTrackSettingsColors",hT);class fT extends Ze{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new ml(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 ml(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 ml(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 bn("div",{className:"vjs-track-settings-font"})}}Ze.registerComponent("TextTrackSettingsFont",fT);class mT extends Ze{constructor(e,t={}){super(e,t);const i=new Ar(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 Ar(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return bn("div",{className:"vjs-track-settings-controls"})}}Ze.registerComponent("TrackSettingsControls",mT);const dg="vjs-text-track-settings",X2=["#000","Black"],Y2=["#00F","Blue"],Q2=["#0FF","Cyan"],Z2=["#0F0","Green"],J2=["#F0F","Magenta"],e_=["#F00","Red"],t_=["#FFF","White"],n_=["#FF0","Yellow"],hg=["1","Opaque"],fg=["0.5","Semi-Transparent"],i_=["0","Transparent"],So={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[X2,t_,e_,Z2,Y2,n_,J2,Q2],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[hg,fg,i_],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[t_,X2,e_,Z2,Y2,n_,J2,Q2],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:[hg,fg],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:[i_,fg,hg],className:"vjs-window-opacity vjs-opacity"}};So.windowColor.options=So.backgroundColor.options;function pT(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function BM(n,e){const t=n.options[n.options.selectedIndex].value;return pT(t,e)}function PM(n,e,t){if(e){for(let i=0;i<n.options.length;i++)if(pT(n.options[i].value,t)===e){n.selectedIndex=i;break}}}class FM extends Iu{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=bn("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new hT(e,{textTrackComponentid:this.id_,selectConfigs:So,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new fT(e,{textTrackComponentid:this.id_,selectConfigs:So,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const a=new mT(e);this.addChild(a)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),cu(So,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 rS(So,(e,t,i)=>{const a=BM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){cu(So,(t,i)=>{PM(this.$(t.selector),e[i],t.parser)})}setDefaults(){cu(So,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(he.localStorage.getItem(dg))}catch(t){In.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?he.localStorage.setItem(dg,JSON.stringify(e)):he.localStorage.removeItem(dg)}catch(t){In.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}Ze.registerComponent("TextTrackSettings",FM);class UM extends Ze{constructor(e,t){let i=t.ResizeObserver||he.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=yi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||he.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=CS(()=>{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(){Cr(this,"resize",l),Cr(this,"unload",u),u=null};ds(this.el_.contentWindow,"unload",u),ds(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()}}Ze.registerComponent("ResizeManager",UM);const zM={trackingThreshold:20,liveTolerance:15};class HM extends Ze{constructor(e,t){const i=yi(zM,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(he.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_,ks),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()}}Ze.registerComponent("LiveTracker",HM);class $M extends Ze{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:bn("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Ts()}`}),description:bn("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Ts()}`})},bn("div",{className:"vjs-title-bar"},{},sS(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];xm(u),l&&Mo(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}}Ze.registerComponent("TitleBar",$M);const qM={initialDisplay:4e3,position:[],takeFocus:!1};class VM extends Ar{constructor(e,t){t=yi(qM,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=bn("button",{},{type:"button",class:this.buildCSSClass()},bn("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()}}Ze.registerComponent("TransientButton",VM);const Zg=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<t.length;l++){const u=t[l].src;u&&i.indexOf(u)===-1&&i.push(u)}return i.length?(i.length===1&&(a=i[0]),n.triggerSourceset(a),!0):!1},GM=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(n){const e=Tt.createElement(this.nodeName.toLowerCase());e.innerHTML=n;const t=Tt.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",he.Element.prototype.appendChild.call(this,t),this.innerHTML}}),gT=(n,e)=>{let t={};for(let i=0;i<n.length&&(t=Object.getOwnPropertyDescriptor(n[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},KM=n=>gT([n.el(),he.HTMLMediaElement.prototype,he.Element.prototype,GM],"innerHTML"),r_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=KM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Zg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",yi(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_)},WM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?PS(he.Element.prototype.getAttribute.call(this,"src")):""},set(n){return he.Element.prototype.setAttribute.call(this,"src",n),n}}),XM=n=>gT([n.el(),he.HTMLMediaElement.prototype,WM],"src"),YM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=XM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",yi(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 Zg(n)||(n.triggerSourceset(""),r_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Zg(n)||r_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Wt extends En{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")&&Tm(f.src)&&(a=!0)):h.push(f))}for(let f=0;f<h.length;f++)this.el_.removeChild(h[f])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&a&&In.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
||
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(md||pm)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Wt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){YM(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let l=0;l<e.length;l++){const u=e[l];u.kind==="metadata"&&t.push({track:u,storedMode:u.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const a=()=>{for(let l=0;l<t.length;l++){const u=t[l];u.track.mode==="disabled"&&u.track.mode!==u.storedMode&&(u.track.mode=u.storedMode)}e.removeEventListener("change",a)};this.on("webkitbeginfullscreen",()=>{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=Ss[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[Mu.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<a.length;f++){let g=!1;for(let w=0;w<i.length;w++)if(i[w]===a[f]){g=!0;break}g||h.push(a[f])}for(;h.length;)a.removeTrack(h.shift())};this[t.getterName+"Listeners_"]=l,Object.keys(l).forEach(h=>{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_(){Ss.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),Wt.disposeMediaElement(e),e=i}else{e=Tt.createElement("video");const i=this.options_.tag&&wo(this.options_.tag),a=yi({},i);(!md||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,mS(e,Object.assign(a,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Au(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<t.length;i++){const a=t[i],l=this.options_[a];typeof l<"u"&&(l?Au(e,a,a):bm(e,a),e[a]=l)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const a=function(){i=!0};this.on("loadstart",a);const l=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",l),this.ready(function(){this.off("loadstart",a),this.off("loadedmetadata",l),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=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&&gm?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){In(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Fs&&la&&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)na(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 In.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const a=bn("source",{},i);return this.el_.appendChild(a),!0}removeSourceElement(e){if(!e)return In.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 In.warn(`No matching source element found with src: ${e}`),!1}reset(){Wt.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=Tt.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),he.performance&&(e.creationTime=he.performance.now()),e}}hm(Wt,"TEST_VID",function(){if(!ju())return;const n=Tt.createElement("video"),e=Tt.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Wt.isSupported=function(){try{Wt.TEST_VID.volume=.5}catch{return!1}return!!(Wt.TEST_VID&&Wt.TEST_VID.canPlayType)};Wt.canPlayType=function(n){return Wt.TEST_VID.canPlayType(n)};Wt.canPlaySource=function(n,e){return Wt.canPlayType(n.type)};Wt.canControlVolume=function(){try{const n=Wt.TEST_VID.volume;Wt.TEST_VID.volume=n/2+.1;const e=n!==Wt.TEST_VID.volume;return e&&Er?(he.setTimeout(()=>{Wt&&Wt.prototype&&(Wt.prototype.featuresVolumeControl=n!==Wt.TEST_VID.volume)}),!1):e}catch{return!1}};Wt.canMuteVolume=function(){try{const n=Wt.TEST_VID.muted;return Wt.TEST_VID.muted=!n,Wt.TEST_VID.muted?Au(Wt.TEST_VID,"muted","muted"):bm(Wt.TEST_VID,"muted","muted"),n!==Wt.TEST_VID.muted}catch{return!1}};Wt.canControlPlaybackRate=function(){if(Fs&&la&&fm<58)return!1;try{const n=Wt.TEST_VID.playbackRate;return Wt.TEST_VID.playbackRate=n/2+.1,n!==Wt.TEST_VID.playbackRate}catch{return!1}};Wt.canOverrideAttributes=function(){try{const n=()=>{};Object.defineProperty(Tt.createElement("video"),"src",{get:n,set:n}),Object.defineProperty(Tt.createElement("audio"),"src",{get:n,set:n}),Object.defineProperty(Tt.createElement("video"),"innerHTML",{get:n,set:n}),Object.defineProperty(Tt.createElement("audio"),"innerHTML",{get:n,set:n})}catch{return!1}return!0};Wt.supportsNativeTextTracks=function(){return gm||Er&&la};Wt.supportsNativeVideoTracks=function(){return!!(Wt.TEST_VID&&Wt.TEST_VID.videoTracks)};Wt.supportsNativeAudioTracks=function(){return!!(Wt.TEST_VID&&Wt.TEST_VID.audioTracks)};Wt.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]){hm(Wt.prototype,n,()=>Wt[e](),!0)});Wt.prototype.featuresVolumeControl=Wt.canControlVolume();Wt.prototype.movingMediaElementInDOM=!Er;Wt.prototype.featuresFullscreenResize=!0;Wt.prototype.featuresProgressEvents=!0;Wt.prototype.featuresTimeupdateEvents=!0;Wt.prototype.featuresVideoFrameCallback=!!(Wt.TEST_VID&&Wt.TEST_VID.requestVideoFrameCallback);Wt.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{}})()}};Wt.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){Wt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Wt.prototype["set"+Ki(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){Wt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Wt.prototype["set"+Ki(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Wt.prototype[n]=function(){return this.el_[n]()}});En.withSourceHandlers(Wt);Wt.nativeSourceHandler={};Wt.nativeSourceHandler.canPlayType=function(n){try{return Wt.TEST_VID.canPlayType(n)}catch{return""}};Wt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Wt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Py(n.src);return Wt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Wt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Wt.nativeSourceHandler.dispose=function(){};Wt.registerSourceHandler(Wt.nativeSourceHandler);En.registerTech("Html5",Wt);const yT=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],mg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Jg=["tiny","xsmall","small","medium","large","xlarge","huge"],mf={};Jg.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;mf[n]=`vjs-layout-${e}`});const QM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let Ii=class iu extends Ze{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Ts()}`,t=Object.assign(iu.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=nS(this.id_),this.fsApi_=Nf,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&&wo(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_=iu.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(),jy(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(ds(Tt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const a=yi(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 he.DOMParser().parseFromString(xM,"image/svg+xml");if(h.querySelector("parsererror"))In.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 _M(this),this.addClass("vjs-spatial-navigation-enabled")),md&&this.addClass("vjs-touch-enabled"),Er||this.addClass("vjs-workinghover"),iu.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"),Cr(Tt,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Cr(Tt,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),iu.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),gM(this),jr.names.forEach(e=>{const t=jr[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=wo(e);if(a){for(t=this.el_=e,e=this.tag=Tt.createElement("video");t.children.length;)e.appendChild(t.firstChild);rd(t,"video-js")||hl(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",la&&mm&&(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=>cS[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),he.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=kS("vjs-styles-dimensions");const f=Do(".vjs-styles-defaults"),g=Do("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<h.length;f++){const g=h.item(f);hl(g,"vjs-hidden"),g.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),qg(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){In.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)){In.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,Oa(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),W4(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(he.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),ES(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=Ki(e),a=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(En.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};jr.names.forEach(f=>{const g=jr[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=En.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(Ei(this,this.handleTechReady_),!0),Yg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),yT.forEach(f=>{this.on(this.tech_,f,g=>this[`handleTech${Ki(f)}_`](g))}),Object.keys(mg).forEach(f=>{this.on(this.tech_,f,g=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${mg[f]}_`].bind(this),event:g});return}this[`handleTech${mg[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)&&qg(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){jr.names.forEach(e=>{const t=jr[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Yg.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&&In.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(ad(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(),ad(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!ad(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=vM(this,t)),this.cache_.source=yi({},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;f<u.length;f++){const g=wo(u[f]);l.push(g),g.src&&g.src===t&&h.push(g.src)}h.length&&!a.length?this.cache_.sources=l:a.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=l=>this.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()?na(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()&&!Tt.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=Tt[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 mM)return hM(this.middleware_,this.tech_,e,t);if(e in $2)return H2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw In(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in fM)return dM(this.middleware_,this.tech_,e);if(e in $2)return H2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(In(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(In(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(In(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=na){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(gm||Er);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")||Ps(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=Ps(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ps(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 LS(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,w){l(),a(w)}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=Tt[this.fsApi_.exitFullscreen]();return e&&na(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=Tt.documentElement.style.overflow,ds(Tt,"keydown",this.boundFullWindowOnEscKey_),Tt.documentElement.style.overflow="hidden",hl(Tt.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,Cr(Tt,"keydown",this.boundFullWindowOnEscKey_),Tt.documentElement.style.overflow=this.docOrigOverflow,ym(Tt.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&&he.documentPictureInPicture){const e=Tt.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(bn("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),he.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(wS(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 Tt&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(he.documentPictureInPicture&&he.documentPictureInPicture.window)return he.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in Tt)return Tt.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=Ze.getComponent("FullscreenToggle");Tt[this.fsApi_.fullscreenEnabled]!==!1&&u.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),Ze.getComponent("MuteToggle").prototype.handleClick.call(this,e)):l.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Ze.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,a=this.options_.techOrder;i<a.length;i++){const l=a[i];let u=En.getTech(l);if(u||(u=Ze.getComponent(l)),!u){In.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`);continue}if(u.isSupported()&&(t=u.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(h=>[h,En.getTech(h)]).filter(([h,f])=>f?f.isSupported():(In.error(`The "${h}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(h,f,g){let w;return h.some(S=>f.some(A=>{if(w=g(S,A),w)return!0})),w};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=zS(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]),uM(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}cM(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?MS(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();na(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}),Oa(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(No("beforeerror").forEach(t=>{const i=t(this,e);if(!(oa(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 zi(e),this.addClass("vjs-error"),In.error(`(CODE:${this.error_.code} ${zi.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),No("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=Ei(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&&!Er&&!Fs&&(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 w=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(w,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(),Oa(this)&&this.trigger("languagechange"))}languages(){return yi(iu.prototype.options_.languages,this.languages_)}toJSON(){const e=yi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let a=t[i];a=yi(a),a.player=void 0,e.tracks[i]=a}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Iu(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<Jg.length;i++){const a=Jg[i],l=this.breakpoints_[a];if(t<=l){if(e===a)return;e&&this.removeClass(mf[e]),this.addClass(mf[a]),this.breakpoint_=a;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},QM,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return mf[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=yi(e);const{artist:a,artwork:l,description:u,poster:h,src:f,textTracks:g,title:w}=this.cache_.media;!l&&h&&(this.cache_.media.artwork=[{src:h,type:Ff(h)}]),i&&this.crossOrigin(i),f&&this.src(f),h&&this.poster(h),Array.isArray(g)&&g.forEach(S=>this.addRemoteTextTrack(S,!1)),this.titleBar&&this.titleBar.update({title:w,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:Ff(a.poster)}]),a}return yi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=wo(e),a=i["data-setup"];if(rd(e,"vjs-fill")&&(i.fill=!0),rd(e,"vjs-fluid")&&(i.fluid=!0),a!==null)try{Object.assign(i,JSON.parse(a||"{}"))}catch(l){In.error("data-setup",l)}if(Object.assign(t,i),e.hasChildNodes()){const l=e.childNodes;for(let u=0,h=l.length;u<h;u++){const f=l[u],g=f.nodeName.toLowerCase();g==="source"?t.sources.push(wo(f)):g==="track"&&t.tracks.push(wo(f))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}};Ii.prototype.videoTracks=()=>{};Ii.prototype.audioTracks=()=>{};Ii.prototype.textTracks=()=>{};Ii.prototype.remoteTextTracks=()=>{};Ii.prototype.remoteTextTrackEls=()=>{};jr.names.forEach(function(n){const e=jr[n];Ii.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ii.prototype.crossorigin=Ii.prototype.crossOrigin;Ii.players={};const zc=he.navigator;Ii.prototype.options_={techOrder:En.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:zc&&(zc.languages&&zc.languages[0]||zc.userLanguage||zc.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};yT.forEach(function(n){Ii.prototype[`handleTech${Ki(n)}_`]=function(){return this.trigger(n)}});Ze.registerComponent("Player",Ii);const Uf="plugin",fu="activePlugins_",su={},zf=n=>su.hasOwnProperty(n),pf=n=>zf(n)?su[n]:void 0,bT=(n,e)=>{n[fu]=n[fu]||{},n[fu][e]=!0},Hf=(n,e,t)=>{const i=(t?"before":"")+"pluginsetup";n.trigger(i,e),n.trigger(i+":"+e.name,e)},ZM=function(n,e){const t=function(){Hf(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return bT(this,n),Hf(this,{name:n,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},s_=(n,e)=>(e.prototype.name=n,function(...t){Hf(this,{name:n,plugin:e,instance:null},!0);const i=new e(this,...t);return this[n]=()=>i,Hf(this,i.getEventHash()),i});class Qr{constructor(e){if(this.constructor===Qr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),jy(this),delete this.trigger,DS(this,this.constructor.defaultState),bT(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 Lu(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[fu][e]=!1,this.player=this.state=null,t[e]=s_(e,su[e])}static isBasic(e){const t=typeof e=="string"?pf(e):e;return typeof t=="function"&&!Qr.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(zf(e))In.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ii.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 su[e]=t,e!==Uf&&(Qr.isBasic(t)?Ii.prototype[e]=ZM(e,t):Ii.prototype[e]=s_(e,t)),t}static deregisterPlugin(e){if(e===Uf)throw new Error("Cannot de-register base plugin.");zf(e)&&(delete su[e],delete Ii.prototype[e])}static getPlugins(e=Object.keys(su)){let t;return e.forEach(i=>{const a=pf(i);a&&(t=t||{},t[i]=a)}),t}static getPluginVersion(e){const t=pf(e);return t&&t.VERSION||""}}Qr.getPlugin=pf;Qr.BASE_PLUGIN_NAME=Uf;Qr.registerPlugin(Uf,Qr);Ii.prototype.usingPlugin=function(n){return!!this[fu]&&this[fu][n]===!0};Ii.prototype.hasPlugin=function(n){return!!zf(n)};function JM(n,e){let t=!1;return function(...i){return t||In.warn(n),t=!0,e.apply(this,i)}}function Us(n,e,t,i){return JM(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var eR={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 vT=n=>n.indexOf("#")===0?n.slice(1):n;function Fe(n,e,t){let i=Fe.getPlayer(n);if(i)return e&&In.warn(`Player "${n}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const a=typeof n=="string"?Do("#"+vT(n)):n;if(!Ou(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");const u=("getRootNode"in a?a.getRootNode()instanceof he.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;(!a.ownerDocument.defaultView||!u.contains(a))&&In.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)),No("beforesetup").forEach(f=>{const g=f(a,yi(e));if(!oa(g)||Array.isArray(g)){In.error("please return an object in beforesetup hooks");return}e=yi(e,g)});const h=Ze.getComponent("Player");return i=new h(a,e,t),No("setup").forEach(f=>f(i)),i}Fe.hooks_=Ma;Fe.hooks=No;Fe.hook=O4;Fe.hookOnce=L4;Fe.removeHook=tS;if(he.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&ju()){let n=Do(".vjs-styles-defaults");if(!n){n=kS("vjs-styles-defaults");const e=Do("head");e&&e.insertBefore(n,e.firstChild),ES(n,`
|
||
.video-js {
|
||
width: 300px;
|
||
height: 150px;
|
||
}
|
||
|
||
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
padding-top: 56.25%
|
||
}
|
||
`)}}Gg(1,Fe);Fe.VERSION=Hg;Fe.options=Ii.prototype.options_;Fe.getPlayers=()=>Ii.players;Fe.getPlayer=n=>{const e=Ii.players;let t;if(typeof n=="string"){const i=vT(n),a=e[i];if(a)return a;t=Do("#"+i)}else t=n;if(Ou(t)){const{player:i,playerId:a}=t;if(i||e[a])return i||e[a]}};Fe.getAllPlayers=()=>Object.keys(Ii.players).map(n=>Ii.players[n]).filter(Boolean);Fe.players=Ii.players;Fe.getComponent=Ze.getComponent;Fe.registerComponent=(n,e)=>(En.isTech(e)&&In.warn(`The ${n} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Ze.registerComponent.call(Ze,n,e));Fe.getTech=En.getTech;Fe.registerTech=En.registerTech;Fe.use=lM;Object.defineProperty(Fe,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Fe.middleware,"TERMINATOR",{value:Pf,writeable:!1,enumerable:!0});Fe.browser=cS;Fe.obj=P4;Fe.mergeOptions=Us(9,"videojs.mergeOptions","videojs.obj.merge",yi);Fe.defineLazyProperty=Us(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",hm);Fe.bind=Us(9,"videojs.bind","native Function.prototype.bind",Ei);Fe.registerPlugin=Qr.registerPlugin;Fe.deregisterPlugin=Qr.deregisterPlugin;Fe.plugin=(n,e)=>(In.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Qr.registerPlugin(n,e));Fe.getPlugins=Qr.getPlugins;Fe.getPlugin=Qr.getPlugin;Fe.getPluginVersion=Qr.getPluginVersion;Fe.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Fe.options.languages=yi(Fe.options.languages,{[n]:e}),Fe.options.languages[n]};Fe.log=In;Fe.createLogger=nS;Fe.time=J4;Fe.createTimeRange=Us(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ps);Fe.createTimeRanges=Us(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ps);Fe.formatTime=Us(9,"videojs.formatTime","videojs.time.formatTime",vl);Fe.setFormatTime=Us(9,"videojs.setFormatTime","videojs.time.setFormatTime",jS);Fe.resetFormatTime=Us(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",OS);Fe.parseUrl=Us(9,"videojs.parseUrl","videojs.url.parseUrl",By);Fe.isCrossOrigin=Us(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Tm);Fe.EventTarget=hs;Fe.any=Ry;Fe.on=ds;Fe.one=wm;Fe.off=Cr;Fe.trigger=Lu;Fe.xhr=Uw;Fe.TrackList=xl;Fe.TextTrack=Sd;Fe.TextTrackList=Ly;Fe.AudioTrack=FS;Fe.AudioTrackList=IS;Fe.VideoTrack=US;Fe.VideoTrackList=BS;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(n=>{Fe[n]=function(){return In.warn(`videojs.${n}() is deprecated; use videojs.dom.${n}() instead`),SS[n].apply(null,arguments)}});Fe.computedStyle=Us(9,"videojs.computedStyle","videojs.dom.computedStyle",Du);Fe.dom=SS;Fe.fn=K4;Fe.num=NM;Fe.str=Q4;Fe.url=aM;Fe.Error=eR;class tR{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 $f 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 tR(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;i<a;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const a=this[t];if(a.id===e)return a}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}$f.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const n in $f.prototype.allowedEvents_)$f.prototype["on"+n]=null;var xT="4.1.0";const nR=function(n,e){const t=n.qualityLevels,i=new $f,a=function(){i.dispose(),n.qualityLevels=t,n.off("dispose",a)};return n.on("dispose",a),n.qualityLevels=()=>i,n.qualityLevels.VERSION=xT,i},_T=function(n){return nR(this,Fe.obj.merge({},n))};Fe.registerPlugin("qualityLevels",_T);_T.VERSION=xT;const Kr=lm,qf=(n,e)=>e&&e.responseURL&&n!==e.responseURL?e.responseURL:n,Cs=n=>Fe.log.debug?Fe.log.debug.bind(Fe,"VHS:",`${n} >`):function(){};function ai(...n){const e=Fe.obj||Fe;return(e.merge||e.mergeOptions).apply(e,n)}function yr(...n){const e=Fe.time||Fe;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function iR(n){if(n.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
||
`;for(let t=0;t<n.length;t++){const i=n.start(t),a=n.end(t);e+=`${i} --> ${a}. Duration (${a-i})
|
||
`}return e}const ia=1/30,ra=ia*3,wT=function(n,e){const t=[];let i;if(n&&n.length)for(i=0;i<n.length;i++)e(n.start(i),n.end(i))&&t.push([n.start(i),n.end(i)]);return yr(t)},au=function(n,e){return wT(n,function(t,i){return t-ra<=e&&i+ra>=e})},Zh=function(n,e){return wT(n,function(t){return t-ia>=e})},rR=function(n){if(n.length<2)return yr();const e=[];for(let t=1;t<n.length;t++){const i=n.end(t-1),a=n.start(t);e.push([i,a])}return yr(e)},sR=function(n,e){let t=null,i=null,a=0;const l=[],u=[];if(!n||!n.length||!e||!e.length)return yr();let h=n.length;for(;h--;)l.push({time:n.start(h),type:"start"}),l.push({time:n.end(h),type:"end"});for(h=e.length;h--;)l.push({time:e.start(h),type:"start"}),l.push({time:e.end(h),type:"end"});for(l.sort(function(f,g){return f.time-g.time}),h=0;h<l.length;h++)l[h].type==="start"?(a++,a===2&&(t=l[h].time)):l[h].type==="end"&&(a--,a===1&&(i=l[h].time)),t!==null&&i!==null&&(u.push([t,i]),t=null,i=null);return yr(u)},ST=n=>{const e=[];if(!n||!n.length)return"";for(let t=0;t<n.length;t++)e.push(n.start(t)+" => "+n.end(t));return e.join(", ")},aR=function(n,e,t=1){return((n.length?n.end(n.length-1):0)-e)/t},cl=n=>{const e=[];for(let t=0;t<n.length;t++)e.push({start:n.start(t),end:n.end(t)});return e},oR=function(n,e){if(n===e)return!1;if(!n&&e||!e&&n||n.length!==e.length)return!0;for(let t=0;t<n.length;t++)if(n.start(t)!==e.start(t)||n.end(t)!==e.end(t))return!0;return!1},pg=function(n){if(!(!n||!n.length||!n.end))return n.end(n.length-1)},eb=function(n,e){let t=0;if(!n||!n.length)return t;for(let i=0;i<n.length;i++){const a=n.start(i),l=n.end(i);if(!(e>l)){if(e>a&&e<=l){t+=l-e;continue}t+=l-a}}return t},tb=(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},ey=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),[]),TT=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},kT=({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},ET=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=TT(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},lR=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+=tb(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},uR=function(n,e){let t=0,i,a=e-n.mediaSequence;for(;a<n.segments.length;a++){if(i=n.segments[a],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=tb(n,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},CT=function(n,e,t){if(typeof e>"u"&&(e=n.mediaSequence+n.segments.length),e<n.mediaSequence)return 0;const i=lR(n,e);if(i.precise)return i.result;const a=uR(n,e);return a.precise?a.result:i.result+t},AT=function(n,e,t){if(!n)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(n.totalDuration)return n.totalDuration;if(!n.endList)return he.Infinity}return CT(n,e,t)},od=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;l<Math.min(0,i);l++)a+=n;t=0}for(let l=t;l<i;l++)a+=e[l].duration;return a},NT=function(n,e,t,i){if(!n||!n.segments)return null;if(n.endList)return AT(n);if(e===null)return null;e=e||0;let a=CT(n,n.mediaSequence+n.segments.length,e);return t&&(i=typeof i=="number"?i:ET(null,n),a-=i),Math.max(0,a)},cR=function(n,e,t){const a=e||0;let l=NT(n,e,!0,t);return l===null?yr():(l<a&&(l=a),yr(a,l))},dR=function({playlist:n,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:a,exactManifestTimings:l}){let u=e-a;const h=ey(n);let f=0;for(let g=0;g<h.length;g++){const w=h[g];if(t===w.segmentIndex&&!(typeof i=="number"&&typeof w.partIndex=="number"&&i!==w.partIndex)){f=g;break}}if(u<0){if(f>0)for(let g=f-1;g>=0;g--){const w=h[g];if(u+=w.duration,l){if(u<0)continue}else if(u+ia<=0)continue;return{partIndex:w.partIndex,segmentIndex:w.segmentIndex,startTime:a-od({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;g<h.length;g++){const w=h[g];u-=w.duration;const S=w.duration>ia,A=u===0,C=S&&u+ia>=0;if(!((A||C)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-ia>=0)continue;return{partIndex:w.partIndex,segmentIndex:w.segmentIndex,startTime:a+od({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:e}},DT=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},nb=function(n){return n.excludeUntil&&n.excludeUntil===1/0},Am=function(n){const e=DT(n);return!n.disabled&&!e},hR=function(n){return n.disabled},fR=function(n){for(let e=0;e<n.segments.length;e++)if(n.segments[e].key)return!0;return!1},MT=function(n,e){return e.attributes&&e.attributes[n]},mR=function(n,e,t,i=0){return MT("BANDWIDTH",t)?(n*t.attributes.BANDWIDTH-i*8)/e:NaN},ty=(n,e)=>{if(n.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(i=>Am(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},ib=(n,e)=>!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),a_=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 a_(n,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<n.playlists.length;e++){const t=n.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(l=>$w(l))||a_(n,l=>ib(t,l))))return!1}return!0};var Xr={liveEdgeDelay:ET,duration:AT,seekable:cR,getMediaInfoForTime:dR,isEnabled:Am,isDisabled:hR,isExcluded:DT,isIncompatible:nb,playlistEnd:NT,isAes:fR,hasAttribute:MT,estimateSegmentRequestTime:mR,isLowestEnabledRendition:ty,isAudioOnly:Cd,playlistMatch:ib,segmentDurationWithParts:tb};const{log:RT}=Fe,mu=(n,e)=>`${n}-${e}`,jT=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,pR=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new nD;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(w){g.hasOwnProperty(w)&&delete g[w]})})),!h.targetDuration){let g=10;h.segments&&h.segments.length&&(g=h.segments.reduce((w,S)=>Math.max(w,S.duration),0)),n&&n({message:`manifest has no targetDuration defaulting to ${g}`}),h.targetDuration=g}const f=TT(h);if(f.length&&!h.partTargetDuration){const g=f.reduce((w,S)=>Math.max(w,S.duration),0);n&&(n({message:`manifest has no partTargetDuration defaulting to ${g}`}),RT.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},Fu=(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)}})},OT=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},gR=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];OT({playlist:t,id:mu(e,t.uri)}),t.resolvedUri=Kr(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||RT.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},yR=n=>{Fu(n,e=>{e.uri&&(e.resolvedUri=Kr(n.uri,e.uri))})},bR=(n,e)=>{const t=mu(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:he.location.href,resolvedUri:he.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},LT=(n,e,t=jT)=>{n.uri=e;for(let a=0;a<n.playlists.length;a++)if(!n.playlists[a].uri){const l=`placeholder-uri-${a}`;n.playlists[a].uri=l}const i=Cd(n);Fu(n,(a,l,u,h)=>{if(!a.playlists||!a.playlists.length){if(i&&l==="AUDIO"&&!a.uri)for(let f=0;f<n.playlists.length;f++){const g=n.playlists[f];if(g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===u)return}a.playlists=[tr({},a)]}a.playlists.forEach(function(f,g){const w=t(l,u,h,f),S=mu(g,w);f.uri?f.resolvedUri=f.resolvedUri||Kr(n.uri,f.uri):(f.uri=g===0?w:S,f.resolvedUri=f.uri),f.id=f.id||S,f.attributes=f.attributes||{},n.playlists[f.id]=f,n.playlists[f.uri]=f})}),gR(n),yR(n)};class o_{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((a,l)=>(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()<e&&this.processedDateRanges_.delete(a)})}}const IT=22,pl=({requestType:n,request:e,error:t,parseFailure:i})=>{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=tr({},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},vR=Cs("CodecUtils"),BT=function(n){const e=n.attributes||{};if(e.CODECS)return ea(e.CODECS)},PT=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},xR=(n,e)=>{if(!PT(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(Hw(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){vR(`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},l_=function(n){let e=0;return n.audio&&e++,n.video&&e++,e},ld=function(n,e){const t=e.attributes||{},i=yd(BT(e)||[]);if(PT(n,e)&&!i.audio&&!xR(n,e)){const a=yd(rD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:_R}=Fe,wR=(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=kT(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 he.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},SR=(n,e)=>{if(!n)return e;const t=ai(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<e.parts.length;i++)n.parts&&n.parts[i]&&(t.parts[i]=ai(n.parts[i],e.parts[i]));return!n.skipped&&e.skipped&&(t.skipped=!1),n.preload&&!e.preload&&(t.preload=!1),t},TR=(n,e,t)=>{const i=n.slice(),a=e.slice();t=t||0;const l=[];let u;for(let h=0;h<a.length;h++){const f=i[h+t],g=a[h];f?(u=f.map||u,l.push(SR(f,g))):(u&&!g.map&&(g.map=u),l.push(g))}return l},FT=(n,e)=>{!n.resolvedUri&&n.uri&&(n.resolvedUri=Kr(e,n.uri)),n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=Kr(e,n.key.uri)),n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=Kr(e,n.map.uri)),n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=Kr(e,n.map.key.uri)),n.parts&&n.parts.length&&n.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Kr(e,t.uri))}),n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Kr(e,t.uri))})},UT=function(n){const e=n.segments||[],t=n.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=n.targetDuration,t.preload=!0,e.push(t)}return e},zT=(n,e)=>n===e||n.segments&&e.segments&&n.segments.length===e.segments.length&&n.endList===e.endList&&n.mediaSequence===e.mediaSequence&&n.preloadSegment===e.preloadSegment,ny=(n,e,t=zT)=>{const i=ai(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=UT(e);const l=ai(a,e);if(l.preloadSegment&&!e.preloadSegment&&delete l.preloadSegment,a.segments){if(e.skip){e.segments=e.segments||[];for(let u=0;u<e.skip.skippedSegments;u++)e.segments.unshift({skipped:!0})}l.segments=TR(a.segments,e.segments,e.mediaSequence-a.mediaSequence)}l.segments.forEach(u=>{FT(u,l.resolvedUri)});for(let u=0;u<i.playlists.length;u++)i.playlists[u].id===e.id&&(i.playlists[u]=l);return i.playlists[e.id]=l,i.playlists[e.uri]=l,Fu(n,(u,h,f,g)=>{if(u.playlists)for(let w=0;w<u.playlists.length;w++)e.id===u.playlists[w].id&&(u.playlists[w]=l)}),i},iy=(n,e)=>{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},u_=(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 ou extends _R{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Cs("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 o_,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=Kr(this.main.uri,e.uri);this.llhls&&(t=wR(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:pl({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=pR({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=BT(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(),OT({playlist:u,uri:i,id:a});const h=ny(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_(iy(this.media(),!!h)),l.parsedPlaylist=u_(this.main.playlists,l.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:l}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),he.clearTimeout(this.mediaUpdateTimeout),he.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new o_,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(he.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=he.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_(iy(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=qf(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&&(he.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&&(he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=he.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&&(he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=he.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=he.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:pl({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=qf(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const a=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=u_(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,LT(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=UT(i),i.segments.forEach(a=>{FT(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||he.location.href;this.main=bR(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),w=mu(a,g),S=this.createCloneAttributes_(a,u.attributes),A=this.createClonePlaylist_(u,w,e,S);i.playlists[l]=A,i.playlists[w]=A,i.playlists[g]=A}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,w)=>{const S=i.playlists[g.id],A=S.id,C=S.resolvedUri;delete i.playlists[A],delete i.playlists[C]});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=mu(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]=tr({},f);const g=a.mediaGroups[l][t][h],w=this.createCloneURI_(f.resolvedUri,e);g.resolvedUri=w,g.uri=w,g.playlists=[],f.playlists.forEach((S,A)=>{const C=a.playlists[S.id],j=jT(l,t,h),k=mu(t,j);if(C&&!a.playlists[k]){const B=this.createClonePlaylist_(C,k,e),V=B.resolvedUri;a.playlists[k]=B,a.playlists[V]=B}g.playlists[A]=this.createClonePlaylist_(S,k,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),ai(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 ry=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)},kR=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},ER=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},HT=function(){const n=function e(t,i){t=ai({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=kR(l,t);l.delete(a);const g=h(f||t,function(S,A){return ER(u,g,S,A),ry(g,S,A,i)}),w=g.abort;return g.abort=function(){return g.aborted=!0,w.apply(g,arguments)},g.uri=t.uri,g.requestType=t.requestType,g.requestTime=Date.now(),g};return n.original=!0,n},CR=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=he.BigInt(n.offset)+he.BigInt(n.length)-he.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},sy=function(n){const e={};return n.byterange&&(e.Range=CR(n.byterange)),e},AR=function(n,e){return n.start(e)+"-"+n.end(e)},NR=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},DR=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},$T=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},Vf=function(n){const e=n.byterange||{length:1/0,offset:0};return[e.length,e.offset,n.resolvedUri].join(",")},qT=function(n){return n.resolvedUri},VT=n=>{const e=Array.prototype.slice.call(n),t=16;let i="",a,l;for(let u=0;u<e.length/t;u++)a=e.slice(u*t,u*t+t).map(NR).join(""),l=e.slice(u*t,u*t+t).map(DR).join(""),i+=a+" "+l+`
|
||
`;return i},MR=({bytes:n})=>VT(n),RR=n=>{let e="",t;for(t=0;t<n.length;t++)e+=AR(n,t)+" ";return e};var jR=Object.freeze({__proto__:null,createTransferableMessage:$T,initSegmentId:Vf,segmentKeyId:qT,hexDump:VT,tagDump:MR,textRanges:RR});const GT=.25,OR=(n,e)=>{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)},LR=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,IR=(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(t<new Date(i.dateTimeObject))return null;for(let f=0;f<e.segments.length-1;f++){i=e.segments[f];const g=new Date(e.segments[f+1].dateTimeObject);if(t<g)break}const a=e.segments[e.segments.length-1],l=a.dateTimeObject,u=a.videoTimingInfo?LR(a.videoTimingInfo):a.duration+a.duration*GT,h=new Date(l.getTime()+u*1e3);return t>h?null:(t>new Date(l)&&(i=a),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Xr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},BR=(n,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let l=0;l<e.segments.length&&(i=e.segments[l],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(n<=t));l++);const a=e.segments[e.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<n)return null;if(n>t){if(n>t+a.duration*GT)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},PR=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},FR=n=>{if(!n.segments||n.segments.length===0)return!1;for(let e=0;e<n.segments.length;e++)if(!n.segments[e].dateTimeObject)return!1;return!0},UR=({playlist:n,time:e=void 0,callback:t})=>{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=BR(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=OR(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},KT=({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(!FR(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=IR(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=PR(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",()=>{KT({programTime:n,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:a,tech:l,callback:u})});return}const w=f.start+g,S=()=>u(null,l.currentTime());l.one("seeked",S),a&&l.pause(),i(w)},gg=(n,e)=>{if(n.readyState===4)return e()},zR=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,A,C,j){return A.abort(),u=!0,t(S,A,C,j)},f=function(S,A){if(u)return;if(S)return S.metadata=pl({requestType:i,request:A,error:S}),h(S,A,"",a);const C=A.responseText.substring(a&&a.byteLength||0,A.responseText.length);if(a=mD(a,Gw(C,!0)),l=l||Wc(a),a.length<10||l&&a.length<l+2)return gg(A,()=>h(S,A,"",a));const j=Cy(a);return j==="ts"&&a.length<188?gg(A,()=>h(S,A,"",a)):!j&&a.length<376?gg(A,()=>h(S,A,"",a)):h(null,A,j,a)},w=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:A,loaded:C}){return ry(S,null,{statusCode:S.status},f)})}},function(S,A){return ry(w,S,A,f)});return w},{EventTarget:HR}=Fe,c_=function(n,e){if(!zT(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<n.segments.length;t++){const i=n.segments[t],a=e.segments[t];if(i.uri!==a.uri)return!1;if(!i.byterange&&!a.byterange)continue;const l=i.byterange,u=a.byterange;if(l&&!u||!l&&u||l.offset!==u.offset||l.length!==u.length)return!1}return!0},$R=(n,e,t,i)=>{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},qR=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=h4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return LT(l,e,$R),l},VR=(n,e)=>{Fu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},GR=(n,e,t)=>{let i=!0,a=ai(n,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let l=0;l<e.playlists.length;l++){const u=e.playlists[l];if(u.sidx){const f=cm(u.sidx);t&&t[f]&&t[f].sidx&&Ty(u,t[f].sidx,u.sidx.resolvedUri)}const h=ny(a,u,c_);h&&(a=h,i=!1)}return Fu(e,(l,u,h,f)=>{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,w=ny(a,l.playlists[0],c_);w&&(a=w,f in a.mediaGroups[u][h]||(a.mediaGroups[u][h][f]=l),a.mediaGroups[u][h][f].playlists[0]=a.playlists[g],i=!1)}}),VR(a,e),e.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(i=!1),i?null:a},KR=(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,d_=(n,e)=>{const t={};for(const i in n){const l=n[i].sidx;if(l){const u=cm(l);if(!e[u])break;const h=e[u].sidxInfo;KR(h,l)&&(t[u]=e[u])}}return t},WR=(n,e)=>{let i=d_(n.playlists,e);return Fu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ai(i,d_(f,e))}}),i};class ay extends HR{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_=Cs("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&&cm(e.sidx);if(!e.sidx||!a||this.mainPlaylistLoader_.sidxMapping_[a]){he.clearTimeout(this.mediaRequest_),this.mediaRequest_=he.setTimeout(()=>i(!1),0);return}const l=qf(e.sidx.resolvedUri),u=(f,g)=>{if(this.requestErrored_(f,g,t))return;const w=this.mainPlaylistLoader_.sidxMapping_,{requestType:S}=g;let A;try{A=y4(pn(g.response).subarray(8))}catch(C){C.metadata=pl({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(C,g,t);return}return w[a]={sidxInfo:e.sidx,sidx:A},Ty(e,A,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=zR(l,this.vhs_.xhr,(f,g,w,S)=>{if(f)return u(f,g);if(!w||w!=="mp4"){const j=w||"unknown";return u({status:g.status,message:`Unsupported ${j} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:A,length:C}=e.sidx.byterange;if(S.length>=C+A)return u(f,{response:S.subarray(A,A+C),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:sy({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},he.clearTimeout(this.minimumUpdatePeriodTimeout_),he.clearTimeout(this.mediaRequest_),he.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,he.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(),he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(he.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,he.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=he.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_){he.clearTimeout(this.mediaRequest_),this.mediaRequest_=he.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=pl({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=qf(this.mainPlaylistLoader_.srcUrl,a),l){this.handleMain_(),this.syncClientServerClock_(()=>e(a,l));return}return e(a,l)})}syncClientServerClock_(e){const t=f4(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:Kr(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=pl({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_(){he.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=qR({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=GR(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_&&(he.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_=he.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_=WR(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=he.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},iy(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 pr={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 XR=n=>{const e=new Uint8Array(new ArrayBuffer(n.length));for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e.buffer},WT=function(n){return n.on=n.addEventListener,n.off=n.removeEventListener,n},YR=function(n){try{return URL.createObjectURL(new Blob([n],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(n),URL.createObjectURL(t.getBlob())}},XT=function(n){return function(){const e=YR(n),t=WT(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},YT=function(n){return`var browserWorkerPolyFill = ${WT.toString()};
|
||
browserWorkerPolyFill(self);
|
||
`+n},QT=function(n){return n.toString().replace(/^function.+?{/,"").slice(0,-1)},QR=YT(QT(function(){var n=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var p={};this.on=function(v,_){p[v]||(p[v]=[]),p[v]=p[v].concat(_)},this.off=function(v,_){var x;return p[v]?(x=p[v].indexOf(_),p[v]=p[v].slice(),p[v].splice(x,1),x>-1):!1},this.trigger=function(v){var _,x,T,N;if(_=p[v],!!_)if(arguments.length===2)for(T=_.length,x=0;x<T;++x)_[x].call(this,arguments[1]);else{for(N=[],x=arguments.length,x=1;x<arguments.length;++x)N.push(arguments[x]);for(T=_.length,x=0;x<T;++x)_[x].apply(this,N)}},this.dispose=function(){p={}}}};e.prototype.pipe=function(p){return this.on("data",function(v){p.push(v)}),this.on("done",function(v){p.flush(v)}),this.on("partialdone",function(v){p.partialFlush(v)}),this.on("endedtimeline",function(v){p.endTimeline(v)}),this.on("reset",function(v){p.reset(v)}),p},e.prototype.push=function(p){this.trigger("data",p)},e.prototype.flush=function(p){this.trigger("done",p)},e.prototype.partialFlush=function(p){this.trigger("partialdone",p)},e.prototype.endTimeline=function(p){this.trigger("endedtimeline",p)},e.prototype.reset=function(p){this.trigger("reset",p)};var t=e,i=Math.pow(2,32),a=function(p){var v=new DataView(p.buffer,p.byteOffset,p.byteLength),_;return v.getBigUint64?(_=v.getBigUint64(0),_<Number.MAX_SAFE_INTEGER?Number(_):_):v.getUint32(0)*i+v.getUint32(4)},l={getUint64:a,MAX_UINT32:i},u=l.MAX_UINT32,h,f,g,w,S,A,C,j,k,B,V,W,H,ie,Y,G,O,re,E,R,ee,q,Q,ue,se,$,F,X,le,de,L,pe,we,Be,Ve,Oe;(function(){var p;if(Q={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(p in Q)Q.hasOwnProperty(p)&&(Q[p]=[p.charCodeAt(0),p.charCodeAt(1),p.charCodeAt(2),p.charCodeAt(3)]);ue=new Uint8Array([105,115,111,109]),$=new Uint8Array([97,118,99,49]),se=new Uint8Array([0,0,0,1]),F=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]),X=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]),le={video:F,audio:X},pe=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]),we=new Uint8Array([0,0,0,0,0,0,0,0]),Be=we,Ve=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Oe=we,de=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(p){var v=[],_=0,x,T,N;for(x=1;x<arguments.length;x++)v.push(arguments[x]);for(x=v.length;x--;)_+=v[x].byteLength;for(T=new Uint8Array(_+8),N=new DataView(T.buffer,T.byteOffset,T.byteLength),N.setUint32(0,T.byteLength),T.set(p,4),x=0,_=8;x<v.length;x++)T.set(v[x],_),_+=v[x].byteLength;return T},f=function(){return h(Q.dinf,h(Q.dref,pe))},g=function(p){return h(Q.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,p.audioobjecttype<<3|p.samplingfrequencyindex>>>1,p.samplingfrequencyindex<<7|p.channelcount<<3,6,1,2]))},w=function(){return h(Q.ftyp,ue,se,ue,$)},G=function(p){return h(Q.hdlr,le[p])},S=function(p){return h(Q.mdat,p)},Y=function(p){var v=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,p.duration>>>24&255,p.duration>>>16&255,p.duration>>>8&255,p.duration&255,85,196,0,0]);return p.samplerate&&(v[12]=p.samplerate>>>24&255,v[13]=p.samplerate>>>16&255,v[14]=p.samplerate>>>8&255,v[15]=p.samplerate&255),h(Q.mdhd,v)},ie=function(p){return h(Q.mdia,Y(p),G(p.type),C(p))},A=function(p){return h(Q.mfhd,new Uint8Array([0,0,0,0,(p&4278190080)>>24,(p&16711680)>>16,(p&65280)>>8,p&255]))},C=function(p){return h(Q.minf,p.type==="video"?h(Q.vmhd,de):h(Q.smhd,L),f(),re(p))},j=function(p,v){for(var _=[],x=v.length;x--;)_[x]=R(v[x]);return h.apply(null,[Q.moof,A(p)].concat(_))},k=function(p){for(var v=p.length,_=[];v--;)_[v]=W(p[v]);return h.apply(null,[Q.moov,V(4294967295)].concat(_).concat(B(p)))},B=function(p){for(var v=p.length,_=[];v--;)_[v]=ee(p[v]);return h.apply(null,[Q.mvex].concat(_))},V=function(p){var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(p&4278190080)>>24,(p&16711680)>>16,(p&65280)>>8,p&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(Q.mvhd,v)},O=function(p){var v=p.samples||[],_=new Uint8Array(4+v.length),x,T;for(T=0;T<v.length;T++)x=v[T].flags,_[T+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return h(Q.sdtp,_)},re=function(p){return h(Q.stbl,E(p),h(Q.stts,Oe),h(Q.stsc,Be),h(Q.stsz,Ve),h(Q.stco,we))},(function(){var p,v;E=function(_){return h(Q.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),_.type==="video"?p(_):v(_))},p=function(_){var x=_.sps||[],T=_.pps||[],N=[],K=[],J,oe;for(J=0;J<x.length;J++)N.push((x[J].byteLength&65280)>>>8),N.push(x[J].byteLength&255),N=N.concat(Array.prototype.slice.call(x[J]));for(J=0;J<T.length;J++)K.push((T[J].byteLength&65280)>>>8),K.push(T[J].byteLength&255),K=K.concat(Array.prototype.slice.call(T[J]));if(oe=[Q.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,(_.width&65280)>>8,_.width&255,(_.height&65280)>>8,_.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(Q.avcC,new Uint8Array([1,_.profileIdc,_.profileCompatibility,_.levelIdc,255].concat([x.length],N,[T.length],K))),h(Q.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],_.sarRatio){var me=_.sarRatio[0],Ae=_.sarRatio[1];oe.push(h(Q.pasp,new Uint8Array([(me&4278190080)>>24,(me&16711680)>>16,(me&65280)>>8,me&255,(Ae&4278190080)>>24,(Ae&16711680)>>16,(Ae&65280)>>8,Ae&255])))}return h.apply(null,oe)},v=function(_){return h(Q.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(_.channelcount&65280)>>8,_.channelcount&255,(_.samplesize&65280)>>8,_.samplesize&255,0,0,0,0,(_.samplerate&65280)>>8,_.samplerate&255,0,0]),g(_))}})(),H=function(p){var v=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,0,(p.duration&4278190080)>>24,(p.duration&16711680)>>16,(p.duration&65280)>>8,p.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,(p.width&65280)>>8,p.width&255,0,0,(p.height&65280)>>8,p.height&255,0,0]);return h(Q.tkhd,v)},R=function(p){var v,_,x,T,N,K,J;return v=h(Q.tfhd,new Uint8Array([0,0,0,58,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),K=Math.floor(p.baseMediaDecodeTime/u),J=Math.floor(p.baseMediaDecodeTime%u),_=h(Q.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])),N=92,p.type==="audio"?(x=q(p,N),h(Q.traf,v,_,x)):(T=O(p),x=q(p,T.length+N),h(Q.traf,v,_,x,T))},W=function(p){return p.duration=p.duration||4294967295,h(Q.trak,H(p),ie(p))},ee=function(p){var v=new Uint8Array([0,0,0,0,(p.id&4278190080)>>24,(p.id&16711680)>>16,(p.id&65280)>>8,p.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return p.type!=="video"&&(v[v.length-1]=0),h(Q.trex,v)},(function(){var p,v,_;_=function(x,T){var N=0,K=0,J=0,oe=0;return x.length&&(x[0].duration!==void 0&&(N=1),x[0].size!==void 0&&(K=2),x[0].flags!==void 0&&(J=4),x[0].compositionTimeOffset!==void 0&&(oe=8)),[0,0,N|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 N,K,J,oe,me,Ae;for(oe=x.samples||[],T+=20+16*oe.length,J=_(oe,T),K=new Uint8Array(J.length+oe.length*16),K.set(J),N=J.length,Ae=0;Ae<oe.length;Ae++)me=oe[Ae],K[N++]=(me.duration&4278190080)>>>24,K[N++]=(me.duration&16711680)>>>16,K[N++]=(me.duration&65280)>>>8,K[N++]=me.duration&255,K[N++]=(me.size&4278190080)>>>24,K[N++]=(me.size&16711680)>>>16,K[N++]=(me.size&65280)>>>8,K[N++]=me.size&255,K[N++]=me.flags.isLeading<<2|me.flags.dependsOn,K[N++]=me.flags.isDependedOn<<6|me.flags.hasRedundancy<<4|me.flags.paddingValue<<1|me.flags.isNonSyncSample,K[N++]=me.flags.degradationPriority&61440,K[N++]=me.flags.degradationPriority&15,K[N++]=(me.compositionTimeOffset&4278190080)>>>24,K[N++]=(me.compositionTimeOffset&16711680)>>>16,K[N++]=(me.compositionTimeOffset&65280)>>>8,K[N++]=me.compositionTimeOffset&255;return h(Q.trun,K)},p=function(x,T){var N,K,J,oe,me,Ae;for(oe=x.samples||[],T+=20+8*oe.length,J=_(oe,T),N=new Uint8Array(J.length+oe.length*8),N.set(J),K=J.length,Ae=0;Ae<oe.length;Ae++)me=oe[Ae],N[K++]=(me.duration&4278190080)>>>24,N[K++]=(me.duration&16711680)>>>16,N[K++]=(me.duration&65280)>>>8,N[K++]=me.duration&255,N[K++]=(me.size&4278190080)>>>24,N[K++]=(me.size&16711680)>>>16,N[K++]=(me.size&65280)>>>8,N[K++]=me.size&255;return h(Q.trun,N)},q=function(x,T){return x.type==="audio"?p(x,T):v(x,T)}})();var Te={ftyp:w,mdat:S,moof:j,moov:k,initSegment:function(p){var v=w(),_=k(p),x;return x=new Uint8Array(v.byteLength+_.byteLength),x.set(v),x.set(_,v.byteLength),x}},_t=function(p){var v,_,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v<p.length;v++)_=p[v],_.nalUnitType==="access_unit_delimiter_rbsp"?(x.length&&(x.duration=_.dts-x.dts,T.byteLength+=x.byteLength,T.nalCount+=x.length,T.duration+=x.duration,T.push(x)),x=[_],x.byteLength=_.data.byteLength,x.pts=_.pts,x.dts=_.dts):(_.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(x.keyFrame=!0),x.duration=_.dts-x.dts,x.byteLength+=_.data.byteLength,x.push(_));return T.length&&(!x.duration||x.duration<=0)&&(x.duration=T[T.length-1].duration),T.byteLength+=x.byteLength,T.nalCount+=x.length,T.duration+=x.duration,T.push(x),T},dt=function(p){var v,_,x=[],T=[];for(x.byteLength=0,x.nalCount=0,x.duration=0,x.pts=p[0].pts,x.dts=p[0].dts,T.byteLength=0,T.nalCount=0,T.duration=0,T.pts=p[0].pts,T.dts=p[0].dts,v=0;v<p.length;v++)_=p[v],_.keyFrame?(x.length&&(T.push(x),T.byteLength+=x.byteLength,T.nalCount+=x.nalCount,T.duration+=x.duration),x=[_],x.nalCount=_.length,x.byteLength=_.byteLength,x.pts=_.pts,x.dts=_.dts,x.duration=_.duration):(x.duration+=_.duration,x.nalCount+=_.length,x.byteLength+=_.byteLength,x.push(_));return T.length&&x.duration<=0&&(x.duration=T[T.length-1].duration),T.byteLength+=x.byteLength,T.nalCount+=x.nalCount,T.duration+=x.duration,T.push(x),T},xe=function(p){var v;return!p[0][0].keyFrame&&p.length>1&&(v=p.shift(),p.byteLength-=v.byteLength,p.nalCount-=v.nalCount,p[0][0].dts=v.dts,p[0][0].pts=v.pts,p[0][0].duration+=v.duration),p},Ne=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Se=function(p,v){var _=Ne();return _.dataOffset=v,_.compositionTimeOffset=p.pts-p.dts,_.duration=p.duration,_.size=4*p.length,_.size+=p.byteLength,p.keyFrame&&(_.flags.dependsOn=2,_.flags.isNonSyncSample=0),_},Ie=function(p,v){var _,x,T,N,K,J=v||0,oe=[];for(_=0;_<p.length;_++)for(N=p[_],x=0;x<N.length;x++)K=N[x],T=Se(K,J),J+=T.size,oe.push(T);return oe},$e=function(p){var v,_,x,T,N,K,J=0,oe=p.byteLength,me=p.nalCount,Ae=oe+4*me,Xe=new Uint8Array(Ae),jt=new DataView(Xe.buffer);for(v=0;v<p.length;v++)for(T=p[v],_=0;_<T.length;_++)for(N=T[_],x=0;x<N.length;x++)K=N[x],jt.setUint32(J,K.data.byteLength),J+=4,Xe.set(K.data,J),J+=K.data.byteLength;return Xe},Ct=function(p,v){var _,x=v||0,T=[];return _=Se(p,x),T.push(_),T},st=function(p){var v,_,x=0,T=p.byteLength,N=p.length,K=T+4*N,J=new Uint8Array(K),oe=new DataView(J.buffer);for(v=0;v<p.length;v++)_=p[v],oe.setUint32(x,_.data.byteLength),x+=4,J.set(_.data,x),x+=_.data.byteLength;return J},gt={groupNalsIntoFrames:_t,groupFramesIntoGops:dt,extendFirstKeyFrame:xe,generateSampleTable:Ie,concatenateNalData:$e,generateSampleTableForFrame:Ct,concatenateNalDataForFrame:st},He=[33,16,5,32,164,27],We=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Je=function(p){for(var v=[];p--;)v.push(0);return v},et=function(p){return Object.keys(p).reduce(function(v,_){return v[_]=new Uint8Array(p[_].reduce(function(x,T){return x.concat(T)},[])),v},{})},mt,Mt=function(){if(!mt){var p={96e3:[He,[227,64],Je(154),[56]],88200:[He,[231],Je(170),[56]],64e3:[He,[248,192],Je(240),[56]],48e3:[He,[255,192],Je(268),[55,148,128],Je(54),[112]],44100:[He,[255,192],Je(268),[55,163,128],Je(84),[112]],32e3:[He,[255,192],Je(268),[55,234],Je(226),[112]],24e3:[He,[255,192],Je(268),[55,255,128],Je(268),[111,112],Je(126),[224]],16e3:[He,[255,192],Je(268),[55,255,128],Je(268),[111,255],Je(269),[223,108],Je(195),[1,192]],12e3:[We,Je(268),[3,127,248],Je(268),[6,255,240],Je(268),[13,255,224],Je(268),[27,253,128],Je(259),[56]],11025:[We,Je(268),[3,127,248],Je(268),[6,255,240],Je(268),[13,255,224],Je(268),[27,255,192],Je(268),[55,175,128],Je(108),[112]],8e3:[We,Je(268),[3,121,16],Je(47),[7]]};mt=et(p)}return mt},fe=9e4,qe,Le,Ce,Pe,Qe,At,Xt;qe=function(p){return p*fe},Le=function(p,v){return p*v},Ce=function(p){return p/fe},Pe=function(p,v){return p/v},Qe=function(p,v){return qe(Pe(p,v))},At=function(p,v){return Le(Ce(p),v)},Xt=function(p,v,_){return Ce(_?p:p-v)};var kt={ONE_SECOND_IN_TS:fe,secondsToVideoTs:qe,secondsToAudioTs:Le,videoTsToSeconds:Ce,audioTsToSeconds:Pe,audioTsToVideoTs:Qe,videoTsToAudioTs:At,metadataTsToSeconds:Xt},mn=Mt,It=kt,$t=function(p){var v,_,x=0;for(v=0;v<p.length;v++)_=p[v],x+=_.data.byteLength;return x},Ot=function(p,v,_,x){var T,N=0,K=0,J=0,oe=0,me,Ae,Xe;if(v.length&&(T=It.audioTsToVideoTs(p.baseMediaDecodeTime,p.samplerate),N=Math.ceil(It.ONE_SECOND_IN_TS/(p.samplerate/1024)),_&&x&&(K=T-Math.max(_,x),J=Math.floor(K/N),oe=J*N),!(J<1||oe>It.ONE_SECOND_IN_TS/2))){for(me=mn()[p.samplerate],me||(me=v[0].data),Ae=0;Ae<J;Ae++)Xe=v[0],v.splice(0,0,{data:me,dts:Xe.dts-N,pts:Xe.pts-N});return p.baseMediaDecodeTime-=Math.floor(It.videoTsToAudioTs(oe,p.samplerate)),oe}},en=function(p,v,_){return v.minSegmentDts>=_?p:(v.minSegmentDts=1/0,p.filter(function(x){return x.dts>=_?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},Sn=function(p){var v,_,x=[];for(v=0;v<p.length;v++)_=p[v],x.push({size:_.data.byteLength,duration:1024});return x},Pn=function(p){var v,_,x=0,T=new Uint8Array($t(p));for(v=0;v<p.length;v++)_=p[v],T.set(_.data,x),x+=_.data.byteLength;return T},St={prefixWithSilence:Ot,trimAdtsFramesByEarliestDts:en,generateSampleTable:Sn,concatenateFrameData:Pn},Tn=kt.ONE_SECOND_IN_TS,tt=function(p,v){typeof v.pts=="number"&&(p.timelineStartInfo.pts===void 0&&(p.timelineStartInfo.pts=v.pts),p.minSegmentPts===void 0?p.minSegmentPts=v.pts:p.minSegmentPts=Math.min(p.minSegmentPts,v.pts),p.maxSegmentPts===void 0?p.maxSegmentPts=v.pts:p.maxSegmentPts=Math.max(p.maxSegmentPts,v.pts)),typeof v.dts=="number"&&(p.timelineStartInfo.dts===void 0&&(p.timelineStartInfo.dts=v.dts),p.minSegmentDts===void 0?p.minSegmentDts=v.dts:p.minSegmentDts=Math.min(p.minSegmentDts,v.dts),p.maxSegmentDts===void 0?p.maxSegmentDts=v.dts:p.maxSegmentDts=Math.max(p.maxSegmentDts,v.dts))},D=function(p){delete p.minSegmentDts,delete p.maxSegmentDts,delete p.minSegmentPts,delete p.maxSegmentPts},P=function(p,v){var _,x,T=p.minSegmentDts;return v||(T-=p.timelineStartInfo.dts),_=p.timelineStartInfo.baseMediaDecodeTime,_+=T,_=Math.max(0,_),p.type==="audio"&&(x=p.samplerate/Tn,_*=x,_=Math.floor(_)),_},ne={clearDtsInfo:D,calculateTrackBaseMediaDecodeTime:P,collectDtsInfo:tt},Re=4,Ge=128,yt=function(p){for(var v=0,_={payloadType:-1,payloadSize:0},x=0,T=0;v<p.byteLength&&p[v]!==Ge;){for(;p[v]===255;)x+=255,v++;for(x+=p[v++];p[v]===255;)T+=255,v++;if(T+=p[v++],!_.payload&&x===Re){var N=String.fromCharCode(p[v+3],p[v+4],p[v+5],p[v+6]);if(N==="GA94"){_.payloadType=x,_.payloadSize=T,_.payload=p.subarray(v,v+T);break}else _.payload=void 0}v+=T,x=0,T=0}return _},tn=function(p){return p.payload[0]!==181||(p.payload[1]<<8|p.payload[2])!==49||String.fromCharCode(p.payload[3],p.payload[4],p.payload[5],p.payload[6])!=="GA94"||p.payload[7]!==3?null:p.payload.subarray(8,p.payload.length-1)},un=function(p,v){var _=[],x,T,N,K;if(!(v[0]&64))return _;for(T=v[0]&31,x=0;x<T;x++)N=x*3,K={type:v[N+2]&3,pts:p},v[N+2]&4&&(K.ccData=v[N+3]<<8|v[N+4],_.push(K));return _},vn=function(p){for(var v=p.byteLength,_=[],x=1,T,N;x<v-2;)p[x]===0&&p[x+1]===0&&p[x+2]===3?(_.push(x+2),x+=2):x++;if(_.length===0)return p;T=v-_.length,N=new Uint8Array(T);var K=0;for(x=0;x<T;K++,x++)K===_[0]&&(K++,_.shift()),N[x]=p[K];return N},cn={parseSei:yt,parseUserData:tn,parseCaptionPackets:un,discardEmulationPreventionBytes:vn,USER_DATA_REGISTERED_ITU_T_T35:Re},Cn=t,xn=cn,on=function(p){p=p||{},on.prototype.init.call(this),this.parse708captions_=typeof p.parse708captions=="boolean"?p.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new ln(0,0),new ln(0,1),new ln(1,0),new ln(1,1)],this.parse708captions_&&(this.cc708Stream_=new Pt({captionServices:p.captionServices})),this.reset(),this.ccStreams_.forEach(function(v){v.on("data",this.trigger.bind(this,"data")),v.on("partialdone",this.trigger.bind(this,"partialdone")),v.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};on.prototype=new Cn,on.prototype.push=function(p){var v,_,x;if(p.nalUnitType==="sei_rbsp"&&(v=xn.parseSei(p.escapedRBSP),!!v.payload&&v.payloadType===xn.USER_DATA_REGISTERED_ITU_T_T35&&(_=xn.parseUserData(v),!!_))){if(p.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(p.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}x=xn.parseCaptionPackets(p.pts,_),this.captionPackets_=this.captionPackets_.concat(x),this.latestDts_!==p.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=p.dts}},on.prototype.flushCCStreams=function(p){this.ccStreams_.forEach(function(v){return p==="flush"?v.flush():v.partialFlush()},this)},on.prototype.flushStream=function(p){if(!this.captionPackets_.length){this.flushCCStreams(p);return}this.captionPackets_.forEach(function(v,_){v.presortIndex=_}),this.captionPackets_.sort(function(v,_){return v.pts===_.pts?v.presortIndex-_.presortIndex:v.pts-_.pts}),this.captionPackets_.forEach(function(v){v.type<2?this.dispatchCea608Packet(v):this.dispatchCea708Packet(v)},this),this.captionPackets_.length=0,this.flushCCStreams(p)},on.prototype.flush=function(){return this.flushStream("flush")},on.prototype.partialFlush=function(){return this.flushStream("partialFlush")},on.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(p){p.reset()})},on.prototype.dispatchCea608Packet=function(p){this.setsTextOrXDSActive(p)?this.activeCea608Channel_[p.type]=null:this.setsChannel1Active(p)?this.activeCea608Channel_[p.type]=0:this.setsChannel2Active(p)&&(this.activeCea608Channel_[p.type]=1),this.activeCea608Channel_[p.type]!==null&&this.ccStreams_[(p.type<<1)+this.activeCea608Channel_[p.type]].push(p)},on.prototype.setsChannel1Active=function(p){return(p.ccData&30720)===4096},on.prototype.setsChannel2Active=function(p){return(p.ccData&30720)===6144},on.prototype.setsTextOrXDSActive=function(p){return(p.ccData&28928)===256||(p.ccData&30974)===4138||(p.ccData&30974)===6186},on.prototype.dispatchCea708Packet=function(p){this.parse708captions_&&this.cc708Stream_.push(p)};var Rn={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},qt=function(p){var v=Rn[p]||p;return p&4096&&p===v?"":String.fromCharCode(v)},Bt=function(p){return 32<=p&&p<=127||160<=p&&p<=255},Zt=function(p){this.windowNum=p,this.reset()};Zt.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Zt.prototype.getText=function(){return this.rows.join(`
|
||
`)},Zt.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Zt.prototype.newLine=function(p){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(p),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(p){this.rows[this.rowIdx]+=p},Zt.prototype.backspace=function(){if(!this.isEmpty()){var p=this.rows[this.rowIdx];this.rows[this.rowIdx]=p.substr(0,p.length-1)}};var zt=function(p,v,_){this.serviceNum=p,this.text="",this.currentWindow=new Zt(-1),this.windows=[],this.stream=_,typeof v=="string"&&this.createTextDecoder(v)};zt.prototype.init=function(p,v){this.startPts=p;for(var _=0;_<8;_++)this.windows[_]=new Zt(_),typeof v=="function"&&(this.windows[_].beforeRowOverflow=v)},zt.prototype.setCurrentWindow=function(p){this.currentWindow=this.windows[p]},zt.prototype.createTextDecoder=function(p){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(p)}catch(v){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+p+" encoding. "+v})}};var Pt=function(p){p=p||{},Pt.prototype.init.call(this);var v=this,_=p.captionServices||{},x={},T;Object.keys(_).forEach(N=>{T=_[N],/^SERVICE/.test(N)&&(x[N]=T.encoding)}),this.serviceEncodings=x,this.current708Packet=null,this.services={},this.push=function(N){N.type===3?(v.new708Packet(),v.add708Bytes(N)):(v.current708Packet===null&&v.new708Packet(),v.add708Bytes(N))}};Pt.prototype=new Cn,Pt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Pt.prototype.add708Bytes=function(p){var v=p.ccData,_=v>>>8,x=v&255;this.current708Packet.ptsVals.push(p.pts),this.current708Packet.data.push(_),this.current708Packet.data.push(x)},Pt.prototype.push708Packet=function(){var p=this.current708Packet,v=p.data,_=null,x=null,T=0,N=v[T++];for(p.seq=N>>6,p.sizeCode=N&63;T<v.length;T++)N=v[T++],_=N>>5,x=N&31,_===7&&x>0&&(N=v[T++],_=N),this.pushServiceBlock(_,T,x),x>0&&(T+=x-1)},Pt.prototype.pushServiceBlock=function(p,v,_){var x,T=v,N=this.current708Packet.data,K=this.services[p];for(K||(K=this.initService(p,T));T<v+_&&T<N.length;T++)x=N[T],Bt(x)?T=this.handleText(T,K):x===24?T=this.multiByteCharacter(T,K):x===16?T=this.extendedCommands(T,K):128<=x&&x<=135?T=this.setCurrentWindow(T,K):152<=x&&x<=159?T=this.defineWindow(T,K):x===136?T=this.clearWindows(T,K):x===140?T=this.deleteWindows(T,K):x===137?T=this.displayWindows(T,K):x===138?T=this.hideWindows(T,K):x===139?T=this.toggleWindows(T,K):x===151?T=this.setWindowAttributes(T,K):x===144?T=this.setPenAttributes(T,K):x===145?T=this.setPenColor(T,K):x===146?T=this.setPenLocation(T,K):x===143?K=this.reset(T,K):x===8?K.currentWindow.backspace():x===12?K.currentWindow.clearText():x===13?K.currentWindow.pendingNewLine=!0:x===14?K.currentWindow.clearText():x===141&&T++},Pt.prototype.extendedCommands=function(p,v){var _=this.current708Packet.data,x=_[++p];return Bt(x)&&(p=this.handleText(p,v,{isExtended:!0})),p},Pt.prototype.getPts=function(p){return this.current708Packet.ptsVals[Math.floor(p/2)]},Pt.prototype.initService=function(p,v){var x="SERVICE"+p,_=this,x,T;return x in this.serviceEncodings&&(T=this.serviceEncodings[x]),this.services[p]=new zt(p,T,_),this.services[p].init(this.getPts(v),function(N){_.flushDisplayed(N,_.services[p])}),this.services[p]},Pt.prototype.handleText=function(p,v,_){var x=_&&_.isExtended,T=_&&_.isMultiByte,N=this.current708Packet.data,K=x?4096:0,J=N[p],oe=N[p+1],me=v.currentWindow,Ae,Xe;function jt(it){return it.map(Vt=>("0"+(Vt&255).toString(16)).slice(-2)).join("")}if(T?(Xe=[J,oe],p++):Xe=[J],v.textDecoder_&&!x)Ae=v.textDecoder_.decode(new Uint8Array(Xe));else if(T){const it=jt(Xe);Ae=String.fromCharCode(parseInt(it,16))}else Ae=qt(K|J);return me.pendingNewLine&&!me.isEmpty()&&me.newLine(this.getPts(p)),me.pendingNewLine=!1,me.addText(Ae),p},Pt.prototype.multiByteCharacter=function(p,v){var _=this.current708Packet.data,x=_[p+1],T=_[p+2];return Bt(x)&&Bt(T)&&(p=this.handleText(++p,v,{isMultiByte:!0})),p},Pt.prototype.setCurrentWindow=function(p,v){var _=this.current708Packet.data,x=_[p],T=x&7;return v.setCurrentWindow(T),p},Pt.prototype.defineWindow=function(p,v){var _=this.current708Packet.data,x=_[p],T=x&7;v.setCurrentWindow(T);var N=v.currentWindow;return x=_[++p],N.visible=(x&32)>>5,N.rowLock=(x&16)>>4,N.columnLock=(x&8)>>3,N.priority=x&7,x=_[++p],N.relativePositioning=(x&128)>>7,N.anchorVertical=x&127,x=_[++p],N.anchorHorizontal=x,x=_[++p],N.anchorPoint=(x&240)>>4,N.rowCount=x&15,x=_[++p],N.columnCount=x&63,x=_[++p],N.windowStyle=(x&56)>>3,N.penStyle=x&7,N.virtualRowCount=N.rowCount+1,p},Pt.prototype.setWindowAttributes=function(p,v){var _=this.current708Packet.data,x=_[p],T=v.currentWindow.winAttr;return x=_[++p],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=_[++p],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=_[++p],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=_[++p],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,p},Pt.prototype.flushDisplayed=function(p,v){for(var _=[],x=0;x<8;x++)v.windows[x].visible&&!v.windows[x].isEmpty()&&_.push(v.windows[x].getText());v.endPts=p,v.text=_.join(`
|
||
|
||
`),this.pushCaption(v),v.startPts=p},Pt.prototype.pushCaption=function(p){p.text!==""&&(this.trigger("data",{startPts:p.startPts,endPts:p.endPts,text:p.text,stream:"cc708_"+p.serviceNum}),p.text="",p.startPts=p.endPts)},Pt.prototype.displayWindows=function(p,v){var _=this.current708Packet.data,x=_[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var N=0;N<8;N++)x&1<<N&&(v.windows[N].visible=1);return p},Pt.prototype.hideWindows=function(p,v){var _=this.current708Packet.data,x=_[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var N=0;N<8;N++)x&1<<N&&(v.windows[N].visible=0);return p},Pt.prototype.toggleWindows=function(p,v){var _=this.current708Packet.data,x=_[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var N=0;N<8;N++)x&1<<N&&(v.windows[N].visible^=1);return p},Pt.prototype.clearWindows=function(p,v){var _=this.current708Packet.data,x=_[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var N=0;N<8;N++)x&1<<N&&v.windows[N].clearText();return p},Pt.prototype.deleteWindows=function(p,v){var _=this.current708Packet.data,x=_[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var N=0;N<8;N++)x&1<<N&&v.windows[N].reset();return p},Pt.prototype.setPenAttributes=function(p,v){var _=this.current708Packet.data,x=_[p],T=v.currentWindow.penAttr;return x=_[++p],T.textTag=(x&240)>>4,T.offset=(x&12)>>2,T.penSize=x&3,x=_[++p],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,p},Pt.prototype.setPenColor=function(p,v){var _=this.current708Packet.data,x=_[p],T=v.currentWindow.penColor;return x=_[++p],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=_[++p],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=_[++p],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,p},Pt.prototype.setPenLocation=function(p,v){var _=this.current708Packet.data,x=_[p],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=_[++p],T.row=x&15,x=_[++p],T.column=x&63,p},Pt.prototype.reset=function(p,v){var _=this.getPts(p);return this.flushDisplayed(_,v),this.initService(v.serviceNum,p)};var Nn={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},Ft=function(p){return p===null?"":(p=Nn[p]||p,String.fromCharCode(p))},Qn=14,Xn=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Gn=function(){for(var p=[],v=Qn+1;v--;)p.push({text:"",indent:0,offset:0});return p},ln=function(p,v){ln.prototype.init.call(this),this.field_=p||0,this.dataChannel_=v||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(_){var x,T,N,K,J;if(x=_.ccData&32639,x===this.lastControlCode_){this.lastControlCode_=null;return}if((x&61440)===4096?this.lastControlCode_=x:x!==this.PADDING_&&(this.lastControlCode_=null),N=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(_.pts),this.flushDisplayed(_.pts),T=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=T,this.startPts_=_.pts;else if(x===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(_.pts);else if(x===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(_.pts);else if(x===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(_.pts);else if(x===this.CARRIAGE_RETURN_)this.clearFormatting(_.pts),this.flushDisplayed(_.pts),this.shiftRowsUp_(),this.startPts_=_.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(_.pts),this.displayed_=Gn();else if(x===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Gn();else if(x===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(_.pts),this.displayed_=Gn()),this.mode_="paintOn",this.startPts_=_.pts;else if(this.isSpecialCharacter(N,K))N=(N&3)<<8,J=Ft(N|K),this[this.mode_](_.pts,J),this.column_++;else if(this.isExtCharacter(N,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),N=(N&3)<<8,J=Ft(N|K),this[this.mode_](_.pts,J),this.column_++;else if(this.isMidRowCode(N,K))this.clearFormatting(_.pts),this[this.mode_](_.pts," "),this.column_++,(K&14)===14&&this.addFormatting(_.pts,["i"]),(K&1)===1&&this.addFormatting(_.pts,["u"]);else if(this.isOffsetControlCode(N,K)){const me=K&3;this.nonDisplayed_[this.row_].offset=me,this.column_+=me}else if(this.isPAC(N,K)){var oe=Xn.indexOf(x&7968);if(this.mode_==="rollUp"&&(oe-this.rollUpRows_+1<0&&(oe=this.rollUpRows_-1),this.setRollUp(_.pts,oe)),oe!==this.row_&&oe>=0&&oe<=14&&(this.clearFormatting(_.pts),this.row_=oe),K&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(_.pts,["u"]),(x&16)===16){const me=(x&14)>>1;this.column_=me*4,this.nonDisplayed_[this.row_].indent+=me}this.isColorPAC(K)&&(K&14)===14&&this.addFormatting(_.pts,["i"])}else this.isNormalChar(N)&&(K===0&&(K=null),J=Ft(N),J+=Ft(K),this[this.mode_](_.pts,J),this.column_+=J.length)}};ln.prototype=new Cn,ln.prototype.flushDisplayed=function(p){const v=x=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+x+"."})},_=[];this.displayed_.forEach((x,T)=>{if(x&&x.text&&x.text.length){try{x.text=x.text.trim()}catch{v(T)}x.text.length&&_.push({text:x.text,line:T+1,position:10+Math.min(70,x.indent*10)+x.offset*2.5})}else x==null&&v(T)}),_.length&&this.trigger("data",{startPts:this.startPts_,endPts:p,content:_,stream:this.name_})},ln.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Gn(),this.nonDisplayed_=Gn(),this.lastControlCode_=null,this.column_=0,this.row_=Qn,this.rollUpRows_=2,this.formatting_=[]},ln.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},ln.prototype.isSpecialCharacter=function(p,v){return p===this.EXT_&&v>=48&&v<=63},ln.prototype.isExtCharacter=function(p,v){return(p===this.EXT_+1||p===this.EXT_+2)&&v>=32&&v<=63},ln.prototype.isMidRowCode=function(p,v){return p===this.EXT_&&v>=32&&v<=47},ln.prototype.isOffsetControlCode=function(p,v){return p===this.OFFSET_&&v>=33&&v<=35},ln.prototype.isPAC=function(p,v){return p>=this.BASE_&&p<this.BASE_+8&&v>=64&&v<=127},ln.prototype.isColorPAC=function(p){return p>=64&&p<=79||p>=96&&p<=127},ln.prototype.isNormalChar=function(p){return p>=32&&p<=127},ln.prototype.setRollUp=function(p,v){if(this.mode_!=="rollUp"&&(this.row_=Qn,this.mode_="rollUp",this.flushDisplayed(p),this.nonDisplayed_=Gn(),this.displayed_=Gn()),v!==void 0&&v!==this.row_)for(var _=0;_<this.rollUpRows_;_++)this.displayed_[v-_]=this.displayed_[this.row_-_],this.displayed_[this.row_-_]={text:"",indent:0,offset:0};v===void 0&&(v=this.row_),this.topRow_=v-this.rollUpRows_+1},ln.prototype.addFormatting=function(p,v){this.formatting_=this.formatting_.concat(v);var _=v.reduce(function(x,T){return x+"<"+T+">"},"");this[this.mode_](p,_)},ln.prototype.clearFormatting=function(p){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(_,x){return _+"</"+x+">"},"");this.formatting_=[],this[this.mode_](p,v)}},ln.prototype.popOn=function(p,v){var _=this.nonDisplayed_[this.row_].text;_+=v,this.nonDisplayed_[this.row_].text=_},ln.prototype.rollUp=function(p,v){var _=this.displayed_[this.row_].text;_+=v,this.displayed_[this.row_].text=_},ln.prototype.shiftRowsUp_=function(){var p;for(p=0;p<this.topRow_;p++)this.displayed_[p]={text:"",indent:0,offset:0};for(p=this.row_+1;p<Qn+1;p++)this.displayed_[p]={text:"",indent:0,offset:0};for(p=this.topRow_;p<this.row_;p++)this.displayed_[p]=this.displayed_[p+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},ln.prototype.paintOn=function(p,v){var _=this.displayed_[this.row_].text;_+=v,this.displayed_[this.row_].text=_};var Zn={CaptionStream:on,Cea608Stream:ln,Cea708Stream:Pt},ti={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},jn=t,Kn=8589934592,rn=4294967296,Di="shared",oi=function(p,v){var _=1;for(p>v&&(_=-1);Math.abs(v-p)>rn;)p+=_*Kn;return p},ni=function(p){var v,_;ni.prototype.init.call(this),this.type_=p||Di,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==Di&&x.type!==this.type_||(_===void 0&&(_=x.dts),x.dts=oi(x.dts,_),x.pts=oi(x.pts,_),v=x.dts,this.trigger("data",x))},this.flush=function(){_=v,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){_=void 0,v=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ni.prototype=new jn;var di={TimestampRolloverStream:ni,handleRollover:oi},Ci=(p,v,_)=>{if(!p)return-1;for(var x=_;x<p.length;x++)if(p[x]===v)return x;return-1},Fn={typedArrayIndexOf:Ci},On=Fn.typedArrayIndexOf,$n={Utf8:3},_e=function(p,v,_){var x,T="";for(x=v;x<_;x++)T+="%"+("00"+p[x].toString(16)).slice(-2);return T},nt=function(p,v,_){return decodeURIComponent(_e(p,v,_))},ht=function(p,v,_){return unescape(_e(p,v,_))},Ht=function(p){return p[0]<<21|p[1]<<14|p[2]<<7|p[3]},De={APIC:function(p){var v=1,_,x,T="-->";p.data[0]===$n.Utf8&&(_=On(p.data,0,v),!(_<0)&&(p.mimeType=ht(p.data,v,_),v=_+1,p.pictureType=p.data[v],v++,x=On(p.data,0,v),!(x<0)&&(p.description=nt(p.data,v,x),v=x+1,p.mimeType===T?p.url=ht(p.data,v,p.data.length):p.pictureData=p.data.subarray(v,p.data.length))))},"T*":function(p){p.data[0]===$n.Utf8&&(p.value=nt(p.data,1,p.data.length).replace(/\0*$/,""),p.values=p.value.split("\0"))},TXXX:function(p){var v;p.data[0]===$n.Utf8&&(v=On(p.data,0,1),v!==-1&&(p.description=nt(p.data,1,v),p.value=nt(p.data,v+1,p.data.length).replace(/\0*$/,""),p.data=p.value))},"W*":function(p){p.url=ht(p.data,0,p.data.length).replace(/\0.*$/,"")},WXXX:function(p){var v;p.data[0]===$n.Utf8&&(v=On(p.data,0,1),v!==-1&&(p.description=nt(p.data,1,v),p.url=ht(p.data,v+1,p.data.length).replace(/\0.*$/,"")))},PRIV:function(p){var v;for(v=0;v<p.data.length;v++)if(p.data[v]===0){p.owner=ht(p.data,0,v);break}p.privateData=p.data.subarray(v+1),p.data=p.privateData}},vt=function(p){var v,_,x=10,T=0,N=[];if(!(p.length<10||p[0]!==73||p[1]!==68||p[2]!==51)){T=Ht(p.subarray(6,10)),T+=10;var K=p[5]&64;K&&(x+=4,x+=Ht(p.subarray(10,14)),T-=Ht(p.subarray(16,20)));do{if(v=Ht(p.subarray(x+4,x+8)),v<1)break;_=String.fromCharCode(p[x],p[x+1],p[x+2],p[x+3]);var J={id:_,data:p.subarray(x+10,x+v+10)};J.key=J.id,De[J.id]?De[J.id](J):J.id[0]==="T"?De["T*"](J):J.id[0]==="W"&&De["W*"](J),N.push(J),x+=10,x+=v}while(x<T);return N}},wt={parseId3Frames:vt,parseSyncSafeInteger:Ht,frameParsers:De},Nt=t,Gt=ti,Kt=wt,sn;sn=function(p){var v={descriptor:p&&p.descriptor},_=0,x=[],T=0,N;if(sn.prototype.init.call(this),this.dispatchType=Gt.METADATA_STREAM_TYPE.toString(16),v.descriptor)for(N=0;N<v.descriptor.length;N++)this.dispatchType+=("00"+v.descriptor[N].toString(16)).slice(-2);this.push=function(K){var J,oe,me,Ae,Xe,jt;if(K.type==="timed-metadata"){if(K.dataAlignmentIndicator&&(T=0,x.length=0),x.length===0&&(K.data.length<10||K.data[0]!==73||K.data[1]!==68||K.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(x.push(K),T+=K.data.byteLength,x.length===1&&(_=Kt.parseSyncSafeInteger(K.data.subarray(6,10)),_+=10),!(T<_)){for(J={data:new Uint8Array(_),frames:[],pts:x[0].pts,dts:x[0].dts},Xe=0;Xe<_;)J.data.set(x[0].data.subarray(0,_-Xe),Xe),Xe+=x[0].data.byteLength,T-=x[0].data.byteLength,x.shift();oe=10,J.data[5]&64&&(oe+=4,oe+=Kt.parseSyncSafeInteger(J.data.subarray(10,14)),_-=Kt.parseSyncSafeInteger(J.data.subarray(16,20)));do{if(me=Kt.parseSyncSafeInteger(J.data.subarray(oe+4,oe+8)),me<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(jt=String.fromCharCode(J.data[oe],J.data[oe+1],J.data[oe+2],J.data[oe+3]),Ae={id:jt,data:J.data.subarray(oe+10,oe+me+10)},Ae.key=Ae.id,Kt.frameParsers[Ae.id]?Kt.frameParsers[Ae.id](Ae):Ae.id[0]==="T"?Kt.frameParsers["T*"](Ae):Ae.id[0]==="W"&&Kt.frameParsers["W*"](Ae),Ae.owner==="com.apple.streaming.transportStreamTimestamp"){var it=Ae.data,Vt=(it[3]&1)<<30|it[4]<<22|it[5]<<14|it[6]<<6|it[7]>>>2;Vt*=4,Vt+=it[7]&3,Ae.timeStamp=Vt,J.pts===void 0&&J.dts===void 0&&(J.pts=Ae.timeStamp,J.dts=Ae.timeStamp),this.trigger("timestamp",Ae)}J.frames.push(Ae),oe+=10,oe+=me}while(oe<_);this.trigger("data",J)}}}},sn.prototype=new Nt;var Mn=sn,Yn=t,nr=Zn,Wn=ti,Wi=di.TimestampRolloverStream,Hi,bi,Si,Xi=188,ii=71;Hi=function(){var p=new Uint8Array(Xi),v=0;Hi.prototype.init.call(this),this.push=function(_){var x=0,T=Xi,N;for(v?(N=new Uint8Array(_.byteLength+v),N.set(p.subarray(0,v)),N.set(_,v),v=0):N=_;T<N.byteLength;){if(N[x]===ii&&N[T]===ii){this.trigger("data",N.subarray(x,T)),x+=Xi,T+=Xi;continue}x++,T++}x<N.byteLength&&(p.set(N.subarray(x),0),v=N.byteLength-x)},this.flush=function(){v===Xi&&p[0]===ii&&(this.trigger("data",p),v=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){v=0,this.trigger("reset")}},Hi.prototype=new Yn,bi=function(){var p,v,_,x;bi.prototype.init.call(this),x=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,p=function(T,N){var K=0;N.payloadUnitStartIndicator&&(K+=T[K]+1),N.type==="pat"?v(T.subarray(K),N):_(T.subarray(K),N)},v=function(T,N){N.section_number=T[7],N.last_section_number=T[8],x.pmtPid=(T[10]&31)<<8|T[11],N.pmtPid=x.pmtPid},_=function(T,N){var K,J,oe,me;if(T[5]&1){for(x.programMapTable={video:null,audio:null,"timed-metadata":{}},K=(T[1]&15)<<8|T[2],J=3+K-4,oe=(T[10]&15)<<8|T[11],me=12+oe;me<J;){var Ae=T[me],Xe=(T[me+1]&31)<<8|T[me+2];Ae===Wn.H264_STREAM_TYPE&&x.programMapTable.video===null?x.programMapTable.video=Xe:Ae===Wn.ADTS_STREAM_TYPE&&x.programMapTable.audio===null?x.programMapTable.audio=Xe:Ae===Wn.METADATA_STREAM_TYPE&&(x.programMapTable["timed-metadata"][Xe]=Ae),me+=((T[me+3]&15)<<8|T[me+4])+5}N.programMapTable=x.programMapTable}},this.push=function(T){var N={},K=4;if(N.payloadUnitStartIndicator=!!(T[1]&64),N.pid=T[1]&31,N.pid<<=8,N.pid|=T[2],(T[3]&48)>>>4>1&&(K+=T[K]+1),N.pid===0)N.type="pat",p(T.subarray(K),N),this.trigger("data",N);else if(N.pid===this.pmtPid)for(N.type="pmt",p(T.subarray(K),N),this.trigger("data",N);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,K,N]):this.processPes_(T,K,N)},this.processPes_=function(T,N,K){K.pid===this.programMapTable.video?K.streamType=Wn.H264_STREAM_TYPE:K.pid===this.programMapTable.audio?K.streamType=Wn.ADTS_STREAM_TYPE:K.streamType=this.programMapTable["timed-metadata"][K.pid],K.type="pes",K.data=T.subarray(N),this.trigger("data",K)}},bi.prototype=new Yn,bi.STREAM_TYPES={h264:27,adts:15},Si=function(){var p=this,v=!1,_={data:[],size:0},x={data:[],size:0},T={data:[],size:0},N,K=function(oe,me){var Ae;const Xe=oe[0]<<16|oe[1]<<8|oe[2];me.data=new Uint8Array,Xe===1&&(me.packetLength=6+(oe[4]<<8|oe[5]),me.dataAlignmentIndicator=(oe[6]&4)!==0,Ae=oe[7],Ae&192&&(me.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,me.pts*=4,me.pts+=(oe[13]&6)>>>1,me.dts=me.pts,Ae&64&&(me.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,me.dts*=4,me.dts+=(oe[18]&6)>>>1)),me.data=oe.subarray(9+oe[8]))},J=function(oe,me,Ae){var Xe=new Uint8Array(oe.size),jt={type:me},it=0,Vt=0,_n=!1,Qi;if(!(!oe.data.length||oe.size<9)){for(jt.trackId=oe.data[0].pid,it=0;it<oe.data.length;it++)Qi=oe.data[it],Xe.set(Qi.data,Vt),Vt+=Qi.data.byteLength;K(Xe,jt),_n=me==="video"||jt.packetLength<=oe.size,(Ae||_n)&&(oe.size=0,oe.data.length=0),_n&&p.trigger("data",jt)}};Si.prototype.init.call(this),this.push=function(oe){({pat:function(){},pes:function(){var me,Ae;switch(oe.streamType){case Wn.H264_STREAM_TYPE:me=_,Ae="video";break;case Wn.ADTS_STREAM_TYPE:me=x,Ae="audio";break;case Wn.METADATA_STREAM_TYPE:me=T,Ae="timed-metadata";break;default:return}oe.payloadUnitStartIndicator&&J(me,Ae,!0),me.data.push(oe),me.size+=oe.data.byteLength},pmt:function(){var me={type:"metadata",tracks:[]};N=oe.programMapTable,N.video!==null&&me.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+N.video,codec:"avc",type:"video"}),N.audio!==null&&me.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+N.audio,codec:"adts",type:"audio"}),v=!0,p.trigger("data",me)}})[oe.type]()},this.reset=function(){_.size=0,_.data.length=0,x.size=0,x.data.length=0,this.trigger("reset")},this.flushStreams_=function(){J(_,"video"),J(x,"audio"),J(T,"timed-metadata")},this.flush=function(){if(!v&&N){var oe={type:"metadata",tracks:[]};N.video!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+N.video,codec:"avc",type:"video"}),N.audio!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+N.audio,codec:"adts",type:"audio"}),p.trigger("data",oe)}v=!1,this.flushStreams_(),this.trigger("done")}},Si.prototype=new Yn;var Mi={PAT_PID:0,MP2T_PACKET_LENGTH:Xi,TransportPacketStream:Hi,TransportParseStream:bi,ElementaryStream:Si,TimestampRolloverStream:Wi,CaptionStream:nr.CaptionStream,Cea608Stream:nr.Cea608Stream,Cea708Stream:nr.Cea708Stream,MetadataStream:Mn};for(var Ti in Wn)Wn.hasOwnProperty(Ti)&&(Mi[Ti]=Wn[Ti]);var Bi=Mi,ir=t,hi=kt.ONE_SECOND_IN_TS,Yi,Pi=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Yi=function(p){var v,_=0;Yi.prototype.init.call(this),this.skipWarn_=function(x,T){this.trigger("log",{level:"warn",message:`adts skiping bytes ${x} to ${T} in frame ${_} outside syncword`})},this.push=function(x){var T=0,N,K,J,oe,me;if(p||(_=0),x.type==="audio"){v&&v.length?(J=v,v=new Uint8Array(J.byteLength+x.data.byteLength),v.set(J),v.set(x.data,J.byteLength)):v=x.data;for(var Ae;T+7<v.length;){if(v[T]!==255||(v[T+1]&246)!==240){typeof Ae!="number"&&(Ae=T),T++;continue}if(typeof Ae=="number"&&(this.skipWarn_(Ae,T),Ae=null),K=(~v[T+1]&1)*2,N=(v[T+3]&3)<<11|v[T+4]<<3|(v[T+5]&224)>>5,oe=((v[T+6]&3)+1)*1024,me=oe*hi/Pi[(v[T+2]&60)>>>2],v.byteLength-T<N)break;this.trigger("data",{pts:x.pts+_*me,dts:x.dts+_*me,sampleCount:oe,audioobjecttype:(v[T+2]>>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:Pi[(v[T+2]&60)>>>2],samplingfrequencyindex:(v[T+2]&60)>>>2,samplesize:16,data:v.subarray(T+7+K,T+N)}),_++,T+=N}typeof Ae=="number"&&(this.skipWarn_(Ae,T),Ae=null),v=v.subarray(T)}},this.flush=function(){_=0,this.trigger("done")},this.reset=function(){v=void 0,this.trigger("reset")},this.endTimeline=function(){v=void 0,this.trigger("endedtimeline")}},Yi.prototype=new ir;var ae=Yi,ke;ke=function(p){var v=p.byteLength,_=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=p.byteLength-v,N=new Uint8Array(4),K=Math.min(4,v);if(K===0)throw new Error("no bytes available");N.set(p.subarray(T,T+K)),_=new DataView(N.buffer).getUint32(0),x=K*8,v-=K},this.skipBits=function(T){var N;x>T?(_<<=T,x-=T):(T-=x,N=Math.floor(T/8),T-=N*8,v-=N,this.loadWord(),_<<=T,x-=T)},this.readBits=function(T){var N=Math.min(x,T),K=_>>>32-N;return x-=N,x>0?_<<=N:v>0&&this.loadWord(),N=T-N,N>0?K<<N|this.readBits(N):K},this.skipLeadingZeros=function(){var T;for(T=0;T<x;++T)if((_&2147483648>>>T)!==0)return _<<=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 pt=ke,xt=t,Rt=pt,Et,Z,ce;Z=function(){var p=0,v,_;Z.prototype.init.call(this),this.push=function(x){var T;_?(T=new Uint8Array(_.byteLength+x.data.byteLength),T.set(_),T.set(x.data,_.byteLength),_=T):_=x.data;for(var N=_.byteLength;p<N-3;p++)if(_[p+2]===1){v=p+5;break}for(;v<N;)switch(_[v]){case 0:if(_[v-1]!==0){v+=2;break}else if(_[v-2]!==0){v++;break}p+3!==v-2&&this.trigger("data",_.subarray(p+3,v-2));do v++;while(_[v]!==1&&v<N);p=v-2,v+=3;break;case 1:if(_[v-1]!==0||_[v-2]!==0){v+=3;break}this.trigger("data",_.subarray(p+3,v-2)),p=v-2,v+=3;break;default:v+=3;break}_=_.subarray(p),v-=p,p=0},this.reset=function(){_=null,p=0,this.trigger("reset")},this.flush=function(){_&&_.byteLength>3&&this.trigger("data",_.subarray(p+3)),_=null,p=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Z.prototype=new xt,ce={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Et=function(){var p=new Z,v,_,x,T,N,K,J;Et.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(_=oe.trackId,x=oe.pts,T=oe.dts,p.push(oe))},p.on("data",function(oe){var me={trackId:_,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(me.nalUnitTypeCode){case 5:me.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:me.nalUnitType="sei_rbsp",me.escapedRBSP=N(oe.subarray(1));break;case 7:me.nalUnitType="seq_parameter_set_rbsp",me.escapedRBSP=N(oe.subarray(1)),me.config=K(me.escapedRBSP);break;case 8:me.nalUnitType="pic_parameter_set_rbsp";break;case 9:me.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",me)}),p.on("done",function(){v.trigger("done")}),p.on("partialdone",function(){v.trigger("partialdone")}),p.on("reset",function(){v.trigger("reset")}),p.on("endedtimeline",function(){v.trigger("endedtimeline")}),this.flush=function(){p.flush()},this.partialFlush=function(){p.partialFlush()},this.reset=function(){p.reset()},this.endTimeline=function(){p.endTimeline()},J=function(oe,me){var Ae=8,Xe=8,jt,it;for(jt=0;jt<oe;jt++)Xe!==0&&(it=me.readExpGolomb(),Xe=(Ae+it+256)%256),Ae=Xe===0?Ae:Xe},N=function(oe){for(var me=oe.byteLength,Ae=[],Xe=1,jt,it;Xe<me-2;)oe[Xe]===0&&oe[Xe+1]===0&&oe[Xe+2]===3?(Ae.push(Xe+2),Xe+=2):Xe++;if(Ae.length===0)return oe;jt=me-Ae.length,it=new Uint8Array(jt);var Vt=0;for(Xe=0;Xe<jt;Vt++,Xe++)Vt===Ae[0]&&(Vt++,Ae.shift()),it[Xe]=oe[Vt];return it},K=function(oe){var me=0,Ae=0,Xe=0,jt=0,it,Vt,_n,Qi,Nr,Ws,qo,ki,pa,Ms,Xs,li=[1,1],ms,fr;if(it=new Rt(oe),Vt=it.readUnsignedByte(),Qi=it.readUnsignedByte(),_n=it.readUnsignedByte(),it.skipUnsignedExpGolomb(),ce[Vt]&&(Nr=it.readUnsignedExpGolomb(),Nr===3&&it.skipBits(1),it.skipUnsignedExpGolomb(),it.skipUnsignedExpGolomb(),it.skipBits(1),it.readBoolean()))for(Xs=Nr!==3?8:12,fr=0;fr<Xs;fr++)it.readBoolean()&&(fr<6?J(16,it):J(64,it));if(it.skipUnsignedExpGolomb(),Ws=it.readUnsignedExpGolomb(),Ws===0)it.readUnsignedExpGolomb();else if(Ws===1)for(it.skipBits(1),it.skipExpGolomb(),it.skipExpGolomb(),qo=it.readUnsignedExpGolomb(),fr=0;fr<qo;fr++)it.skipExpGolomb();if(it.skipUnsignedExpGolomb(),it.skipBits(1),ki=it.readUnsignedExpGolomb(),pa=it.readUnsignedExpGolomb(),Ms=it.readBits(1),Ms===0&&it.skipBits(1),it.skipBits(1),it.readBoolean()&&(me=it.readUnsignedExpGolomb(),Ae=it.readUnsignedExpGolomb(),Xe=it.readUnsignedExpGolomb(),jt=it.readUnsignedExpGolomb()),it.readBoolean()&&it.readBoolean()){switch(ms=it.readUnsignedByte(),ms){case 1:li=[1,1];break;case 2:li=[12,11];break;case 3:li=[10,11];break;case 4:li=[16,11];break;case 5:li=[40,33];break;case 6:li=[24,11];break;case 7:li=[20,11];break;case 8:li=[32,11];break;case 9:li=[80,33];break;case 10:li=[18,11];break;case 11:li=[15,11];break;case 12:li=[64,33];break;case 13:li=[160,99];break;case 14:li=[4,3];break;case 15:li=[3,2];break;case 16:li=[2,1];break;case 255:{li=[it.readUnsignedByte()<<8|it.readUnsignedByte(),it.readUnsignedByte()<<8|it.readUnsignedByte()];break}}li&&li[0]/li[1]}return{profileIdc:Vt,levelIdc:_n,profileCompatibility:Qi,width:(ki+1)*16-me*2-Ae*2,height:(2-Ms)*(pa+1)*16-Xe*2-jt*2,sarRatio:li}}},Et.prototype=new xt;var ve={H264Stream:Et},Me=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],I=function(p,v){var _=p[v+6]<<21|p[v+7]<<14|p[v+8]<<7|p[v+9],x=p[v+5],T=(x&16)>>4;return _=_>=0?_:0,T?_+20:_+10},U=function(p,v){return p.length-v<10||p[v]!==73||p[v+1]!==68||p[v+2]!==51?v:(v+=I(p,v),U(p,v))},te=function(p){var v=U(p,0);return p.length>=v+2&&(p[v]&255)===255&&(p[v+1]&240)===240&&(p[v+1]&22)===16},ye=function(p){return p[0]<<21|p[1]<<14|p[2]<<7|p[3]},ge=function(p,v,_){var x,T="";for(x=v;x<_;x++)T+="%"+("00"+p[x].toString(16)).slice(-2);return T},at=function(p,v,_){return unescape(ge(p,v,_))},lt=function(p,v){var _=(p[v+5]&224)>>5,x=p[v+4]<<3,T=p[v+3]&6144;return T|x|_},ut=function(p,v){return p[v]===73&&p[v+1]===68&&p[v+2]===51?"timed-metadata":p[v]&!0&&(p[v+1]&240)===240?"audio":null},Dt=function(p){for(var v=0;v+5<p.length;){if(p[v]!==255||(p[v+1]&246)!==240){v++;continue}return Me[(p[v+2]&60)>>>2]}return null},Yt=function(p){var v,_,x,T;v=10,p[5]&64&&(v+=4,v+=ye(p.subarray(10,14)));do{if(_=ye(p.subarray(v+4,v+8)),_<1)return null;if(T=String.fromCharCode(p[v],p[v+1],p[v+2],p[v+3]),T==="PRIV"){x=p.subarray(v+10,v+_+10);for(var N=0;N<x.byteLength;N++)if(x[N]===0){var K=at(x,0,N);if(K==="com.apple.streaming.transportStreamTimestamp"){var J=x.subarray(N+1),oe=(J[3]&1)<<30|J[4]<<22|J[5]<<14|J[6]<<6|J[7]>>>2;return oe*=4,oe+=J[7]&3,oe}break}}v+=10,v+=_}while(v<p.byteLength);return null},Lt={isLikelyAacData:te,parseId3TagSize:I,parseAdtsSize:lt,parseType:ut,parseSampleRate:Dt,parseAacTimestamp:Yt},ft=t,bt=Lt,Ut;Ut=function(){var p=new Uint8Array,v=0;Ut.prototype.init.call(this),this.setTimestamp=function(_){v=_},this.push=function(_){var x=0,T=0,N,K,J,oe;for(p.length?(oe=p.length,p=new Uint8Array(_.byteLength+oe),p.set(p.subarray(0,oe)),p.set(_,oe)):p=_;p.length-T>=3;){if(p[T]===73&&p[T+1]===68&&p[T+2]===51){if(p.length-T<10||(x=bt.parseId3TagSize(p,T),T+x>p.length))break;K={type:"timed-metadata",data:p.subarray(T,T+x)},this.trigger("data",K),T+=x;continue}else if((p[T]&255)===255&&(p[T+1]&240)===240){if(p.length-T<7||(x=bt.parseAdtsSize(p,T),T+x>p.length))break;J={type:"audio",data:p.subarray(T,T+x),pts:v,dts:v},this.trigger("data",J),T+=x;continue}T++}N=p.length-T,N>0?p=p.subarray(T):p=new Uint8Array},this.reset=function(){p=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){p=new Uint8Array,this.trigger("endedtimeline")}},Ut.prototype=new ft;var Jt=Ut,Qt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],wn=Qt,fi=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],fs=fi,Fi=t,Ro=Te,jo=gt,wl=St,Jr=ne,As=Bi,Oo=kt,Ad=ae,Nm=ve.H264Stream,Dm=Jt,Mm=Lt.isLikelyAacData,Uu=kt.ONE_SECOND_IN_TS,Nd=wn,Dd=fs,Sl,Pa,Tl,da,Rm=function(p,v){v.stream=p,this.trigger("log",v)},Md=function(p,v){for(var _=Object.keys(v),x=0;x<_.length;x++){var T=_[x];T==="headOfPipeline"||!v[T].on||v[T].on("log",Rm.bind(p,T))}},Rd=function(p,v){var _;if(p.length!==v.length)return!1;for(_=0;_<p.length;_++)if(p[_]!==v[_])return!1;return!0},jd=function(p,v,_,x,T,N){var K=_-v,J=x-v,oe=T-_;return{start:{dts:p,pts:p+K},end:{dts:p+J,pts:p+oe},prependedContentDuration:N,baseMediaDecodeTime:p}};Pa=function(p,v){var _=[],x,T=0,N=0,K=1/0;v=v||{},x=v.firstSequenceNumber||0,Pa.prototype.init.call(this),this.push=function(J){Jr.collectDtsInfo(p,J),p&&Nd.forEach(function(oe){p[oe]=J[oe]}),_.push(J)},this.setEarliestDts=function(J){T=J},this.setVideoBaseMediaDecodeTime=function(J){K=J},this.setAudioAppendStart=function(J){N=J},this.flush=function(){var J,oe,me,Ae,Xe,jt,it;if(_.length===0){this.trigger("done","AudioSegmentStream");return}J=wl.trimAdtsFramesByEarliestDts(_,p,T),p.baseMediaDecodeTime=Jr.calculateTrackBaseMediaDecodeTime(p,v.keepOriginalTimestamps),it=wl.prefixWithSilence(p,J,N,K),p.samples=wl.generateSampleTable(J),me=Ro.mdat(wl.concatenateFrameData(J)),_=[],oe=Ro.moof(x,[p]),Ae=new Uint8Array(oe.byteLength+me.byteLength),x++,Ae.set(oe),Ae.set(me,oe.byteLength),Jr.clearDtsInfo(p),Xe=Math.ceil(Uu*1024/p.samplerate),J.length&&(jt=J.length*Xe,this.trigger("segmentTimingInfo",jd(Oo.audioTsToVideoTs(p.baseMediaDecodeTime,p.samplerate),J[0].dts,J[0].pts,J[0].dts+jt,J[0].pts+jt,it||0)),this.trigger("timingInfo",{start:J[0].pts,end:J[0].pts+jt})),this.trigger("data",{track:p,boxes:Ae}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Jr.clearDtsInfo(p),_=[],this.trigger("reset")}},Pa.prototype=new Fi,Sl=function(p,v){var _,x=[],T=[],N,K;v=v||{},_=v.firstSequenceNumber||0,Sl.prototype.init.call(this),delete p.minPTS,this.gopCache_=[],this.push=function(J){Jr.collectDtsInfo(p,J),J.nalUnitType==="seq_parameter_set_rbsp"&&!N&&(N=J.config,p.sps=[J.data],Dd.forEach(function(oe){p[oe]=N[oe]},this)),J.nalUnitType==="pic_parameter_set_rbsp"&&!K&&(K=J.data,p.pps=[J.data]),x.push(J)},this.flush=function(){for(var J,oe,me,Ae,Xe,jt,it=0,Vt,_n;x.length&&x[0].nalUnitType!=="access_unit_delimiter_rbsp";)x.shift();if(x.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(J=jo.groupNalsIntoFrames(x),me=jo.groupFramesIntoGops(J),me[0][0].keyFrame||(oe=this.getGopForFusion_(x[0],p),oe?(it=oe.duration,me.unshift(oe),me.byteLength+=oe.byteLength,me.nalCount+=oe.nalCount,me.pts=oe.pts,me.dts=oe.dts,me.duration+=oe.duration):me=jo.extendFirstKeyFrame(me)),T.length){var Qi;if(v.alignGopsAtEnd?Qi=this.alignGopsAtEnd_(me):Qi=this.alignGopsAtStart_(me),!Qi){this.gopCache_.unshift({gop:me.pop(),pps:p.pps,sps:p.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Jr.clearDtsInfo(p),me=Qi}Jr.collectDtsInfo(p,me),p.samples=jo.generateSampleTable(me),Xe=Ro.mdat(jo.concatenateNalData(me)),p.baseMediaDecodeTime=Jr.calculateTrackBaseMediaDecodeTime(p,v.keepOriginalTimestamps),this.trigger("processedGopsInfo",me.map(function(Nr){return{pts:Nr.pts,dts:Nr.dts,byteLength:Nr.byteLength}})),Vt=me[0],_n=me[me.length-1],this.trigger("segmentTimingInfo",jd(p.baseMediaDecodeTime,Vt.dts,Vt.pts,_n.dts+_n.duration,_n.pts+_n.duration,it)),this.trigger("timingInfo",{start:me[0].pts,end:me[me.length-1].pts+me[me.length-1].duration}),this.gopCache_.unshift({gop:me.pop(),pps:p.pps,sps:p.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.trigger("baseMediaDecodeTime",p.baseMediaDecodeTime),this.trigger("timelineStartInfo",p.timelineStartInfo),Ae=Ro.moof(_,[p]),jt=new Uint8Array(Ae.byteLength+Xe.byteLength),_++,jt.set(Ae),jt.set(Xe,Ae.byteLength),this.trigger("data",{track:p,boxes:jt}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),x=[],this.gopCache_.length=0,T.length=0,this.trigger("reset")},this.resetStream_=function(){Jr.clearDtsInfo(p),N=void 0,K=void 0},this.getGopForFusion_=function(J){var oe=45e3,me=1/0,Ae,Xe,jt,it,Vt;for(Vt=0;Vt<this.gopCache_.length;Vt++)it=this.gopCache_[Vt],jt=it.gop,!(!(p.pps&&Rd(p.pps[0],it.pps[0]))||!(p.sps&&Rd(p.sps[0],it.sps[0])))&&(jt.dts<p.timelineStartInfo.dts||(Ae=J.dts-jt.dts-jt.duration,Ae>=-1e4&&Ae<=oe&&(!Xe||me>Ae)&&(Xe=it,me=Ae)));return Xe?Xe.gop:null},this.alignGopsAtStart_=function(J){var oe,me,Ae,Xe,jt,it,Vt,_n;for(jt=J.byteLength,it=J.nalCount,Vt=J.duration,oe=me=0;oe<T.length&&me<J.length&&(Ae=T[oe],Xe=J[me],Ae.pts!==Xe.pts);){if(Xe.pts>Ae.pts){oe++;continue}me++,jt-=Xe.byteLength,it-=Xe.nalCount,Vt-=Xe.duration}return me===0?J:me===J.length?null:(_n=J.slice(me),_n.byteLength=jt,_n.duration=Vt,_n.nalCount=it,_n.pts=_n[0].pts,_n.dts=_n[0].dts,_n)},this.alignGopsAtEnd_=function(J){var oe,me,Ae,Xe,jt,it;for(oe=T.length-1,me=J.length-1,jt=null,it=!1;oe>=0&&me>=0;){if(Ae=T[oe],Xe=J[me],Ae.pts===Xe.pts){it=!0;break}if(Ae.pts>Xe.pts){oe--;continue}oe===T.length-1&&(jt=me),me--}if(!it&&jt===null)return null;var Vt;if(it?Vt=me:Vt=jt,Vt===0)return J;var _n=J.slice(Vt),Qi=_n.reduce(function(Nr,Ws){return Nr.byteLength+=Ws.byteLength,Nr.duration+=Ws.duration,Nr.nalCount+=Ws.nalCount,Nr},{byteLength:0,duration:0,nalCount:0});return _n.byteLength=Qi.byteLength,_n.duration=Qi.duration,_n.nalCount=Qi.nalCount,_n.pts=_n[0].pts,_n.dts=_n[0].dts,_n},this.alignGopsWith=function(J){T=J}},Sl.prototype=new Fi,da=function(p,v){this.numberOfTracks=0,this.metadataStream=v,p=p||{},typeof p.remux<"u"?this.remuxTracks=!!p.remux:this.remuxTracks=!0,typeof p.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=p.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,da.prototype.init.call(this),this.push=function(_){if(_.content||_.text)return this.pendingCaptions.push(_);if(_.frames)return this.pendingMetadata.push(_);this.pendingTracks.push(_.track),this.pendingBytes+=_.boxes.byteLength,_.track.type==="video"&&(this.videoTrack=_.track,this.pendingBoxes.push(_.boxes)),_.track.type==="audio"&&(this.audioTrack=_.track,this.pendingBoxes.unshift(_.boxes))}},da.prototype=new Fi,da.prototype.flush=function(p){var v=0,_={captions:[],captionStreams:{},metadata:[],info:{}},x,T,N,K=0,J;if(this.pendingTracks.length<this.numberOfTracks){if(p!=="VideoSegmentStream"&&p!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(K=this.videoTrack.timelineStartInfo.pts,Dd.forEach(function(oe){_.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(K=this.audioTrack.timelineStartInfo.pts,Nd.forEach(function(oe){_.info[oe]=this.audioTrack[oe]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?_.type=this.pendingTracks[0].type:_.type="combined",this.emittedTracks+=this.pendingTracks.length,N=Ro.initSegment(this.pendingTracks),_.initSegment=new Uint8Array(N.byteLength),_.initSegment.set(N),_.data=new Uint8Array(this.pendingBytes),J=0;J<this.pendingBoxes.length;J++)_.data.set(this.pendingBoxes[J],v),v+=this.pendingBoxes[J].byteLength;for(J=0;J<this.pendingCaptions.length;J++)x=this.pendingCaptions[J],x.startTime=Oo.metadataTsToSeconds(x.startPts,K,this.keepOriginalTimestamps),x.endTime=Oo.metadataTsToSeconds(x.endPts,K,this.keepOriginalTimestamps),_.captionStreams[x.stream]=!0,_.captions.push(x);for(J=0;J<this.pendingMetadata.length;J++)T=this.pendingMetadata[J],T.cueTime=Oo.metadataTsToSeconds(T.pts,K,this.keepOriginalTimestamps),_.metadata.push(T);for(_.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",_),J=0;J<_.captions.length;J++)x=_.captions[J],this.trigger("caption",x);for(J=0;J<_.metadata.length;J++)T=_.metadata[J],this.trigger("id3Frame",T)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},da.prototype.setRemux=function(p){this.remuxTracks=p},Tl=function(p){var v=this,_=!0,x,T;Tl.prototype.init.call(this),p=p||{},this.baseMediaDecodeTime=p.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var N={};this.transmuxPipeline_=N,N.type="aac",N.metadataStream=new As.MetadataStream,N.aacStream=new Dm,N.audioTimestampRolloverStream=new As.TimestampRolloverStream("audio"),N.timedMetadataTimestampRolloverStream=new As.TimestampRolloverStream("timed-metadata"),N.adtsStream=new Ad,N.coalesceStream=new da(p,N.metadataStream),N.headOfPipeline=N.aacStream,N.aacStream.pipe(N.audioTimestampRolloverStream).pipe(N.adtsStream),N.aacStream.pipe(N.timedMetadataTimestampRolloverStream).pipe(N.metadataStream).pipe(N.coalesceStream),N.metadataStream.on("timestamp",function(K){N.aacStream.setTimestamp(K.timeStamp)}),N.aacStream.on("data",function(K){K.type!=="timed-metadata"&&K.type!=="audio"||N.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:v.baseMediaDecodeTime},codec:"adts",type:"audio"},N.coalesceStream.numberOfTracks++,N.audioSegmentStream=new Pa(T,p),N.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),N.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),N.adtsStream.pipe(N.audioSegmentStream).pipe(N.coalesceStream),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x}))}),N.coalesceStream.on("data",this.trigger.bind(this,"data")),N.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,N)},this.setupTsPipeline=function(){var N={};this.transmuxPipeline_=N,N.type="ts",N.metadataStream=new As.MetadataStream,N.packetStream=new As.TransportPacketStream,N.parseStream=new As.TransportParseStream,N.elementaryStream=new As.ElementaryStream,N.timestampRolloverStream=new As.TimestampRolloverStream,N.adtsStream=new Ad,N.h264Stream=new Nm,N.captionStream=new As.CaptionStream(p),N.coalesceStream=new da(p,N.metadataStream),N.headOfPipeline=N.packetStream,N.packetStream.pipe(N.parseStream).pipe(N.elementaryStream).pipe(N.timestampRolloverStream),N.timestampRolloverStream.pipe(N.h264Stream),N.timestampRolloverStream.pipe(N.adtsStream),N.timestampRolloverStream.pipe(N.metadataStream).pipe(N.coalesceStream),N.h264Stream.pipe(N.captionStream).pipe(N.coalesceStream),N.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&&!N.videoSegmentStream&&(N.coalesceStream.numberOfTracks++,N.videoSegmentStream=new Sl(x,p),N.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),N.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!p.keepOriginalTimestamps&&(T.timelineStartInfo=oe,N.audioSegmentStream.setEarliestDts(oe.dts-v.baseMediaDecodeTime))}),N.videoSegmentStream.on("processedGopsInfo",v.trigger.bind(v,"gopInfo")),N.videoSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"videoSegmentTimingInfo")),N.videoSegmentStream.on("baseMediaDecodeTime",function(oe){T&&N.audioSegmentStream.setVideoBaseMediaDecodeTime(oe)}),N.videoSegmentStream.on("timingInfo",v.trigger.bind(v,"videoTimingInfo")),N.h264Stream.pipe(N.videoSegmentStream).pipe(N.coalesceStream)),T&&!N.audioSegmentStream&&(N.coalesceStream.numberOfTracks++,N.audioSegmentStream=new Pa(T,p),N.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),N.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),N.audioSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"audioSegmentTimingInfo")),N.adtsStream.pipe(N.audioSegmentStream).pipe(N.coalesceStream)),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x})}}),N.coalesceStream.on("data",this.trigger.bind(this,"data")),N.coalesceStream.on("id3Frame",function(K){K.dispatchType=N.metadataStream.dispatchType,v.trigger("id3Frame",K)}),N.coalesceStream.on("caption",this.trigger.bind(this,"caption")),N.coalesceStream.on("done",this.trigger.bind(this,"done")),Md(this,N)},this.setBaseMediaDecodeTime=function(N){var K=this.transmuxPipeline_;p.keepOriginalTimestamps||(this.baseMediaDecodeTime=N),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Jr.clearDtsInfo(T),K.audioTimestampRolloverStream&&K.audioTimestampRolloverStream.discontinuity()),x&&(K.videoSegmentStream&&(K.videoSegmentStream.gopCache_=[]),x.timelineStartInfo.dts=void 0,x.timelineStartInfo.pts=void 0,Jr.clearDtsInfo(x),K.captionStream.reset()),K.timestampRolloverStream&&K.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(N){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(N)},this.setRemux=function(N){var K=this.transmuxPipeline_;p.remux=N,K&&K.coalesceStream&&K.coalesceStream.setRemux(N)},this.alignGopsWith=function(N){x&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(N)},this.getLogTrigger_=function(N){var K=this;return function(J){J.stream=N,K.trigger("log",J)}},this.push=function(N){if(_){var K=Mm(N);K&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!K&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),_=!1}this.transmuxPipeline_.headOfPipeline.push(N)},this.flush=function(){_=!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 Fi;var jm={Transmuxer:Tl},Om=function(p){return p>>>0},Lm=function(p){return("00"+p.toString(16)).slice(-2)},Fa={toUnsigned:Om,toHexString:Lm},Lo=function(p){var v="";return v+=String.fromCharCode(p[0]),v+=String.fromCharCode(p[1]),v+=String.fromCharCode(p[2]),v+=String.fromCharCode(p[3]),v},Od=Lo,Ld=Fa.toUnsigned,Id=Od,zu=function(p,v){var _=[],x,T,N,K,J;if(!v.length)return null;for(x=0;x<p.byteLength;)T=Ld(p[x]<<24|p[x+1]<<16|p[x+2]<<8|p[x+3]),N=Id(p.subarray(x+4,x+8)),K=T>1?x+T:p.byteLength,N===v[0]&&(v.length===1?_.push(p.subarray(x+8,K)):(J=zu(p.subarray(x+8,K),v.slice(1)),J.length&&(_=_.concat(J)))),x=K;return _},kl=zu,Bd=Fa.toUnsigned,Ua=l.getUint64,Im=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ua(p.subarray(4)):v.baseMediaDecodeTime=Bd(p[4]<<24|p[5]<<16|p[6]<<8|p[7]),v},Hu=Im,Bm=function(p){var v=new DataView(p.buffer,p.byteOffset,p.byteLength),_={version:p[0],flags:new Uint8Array(p.subarray(1,4)),trackId:v.getUint32(4)},x=_.flags[2]&1,T=_.flags[2]&2,N=_.flags[2]&8,K=_.flags[2]&16,J=_.flags[2]&32,oe=_.flags[0]&65536,me=_.flags[0]&131072,Ae;return Ae=8,x&&(Ae+=4,_.baseDataOffset=v.getUint32(12),Ae+=4),T&&(_.sampleDescriptionIndex=v.getUint32(Ae),Ae+=4),N&&(_.defaultSampleDuration=v.getUint32(Ae),Ae+=4),K&&(_.defaultSampleSize=v.getUint32(Ae),Ae+=4),J&&(_.defaultSampleFlags=v.getUint32(Ae)),oe&&(_.durationIsEmpty=!0),!x&&me&&(_.baseDataOffsetIsMoof=!0),_},$u=Bm,Pd=function(p){return{isLeading:(p[0]&12)>>>2,dependsOn:p[0]&3,isDependedOn:(p[1]&192)>>>6,hasRedundancy:(p[1]&48)>>>4,paddingValue:(p[1]&14)>>>1,isNonSyncSample:p[1]&1,degradationPriority:p[2]<<8|p[3]}},Io=Pd,za=Io,Pm=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4)),samples:[]},_=new DataView(p.buffer,p.byteOffset,p.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,N=v.flags[1]&1,K=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,me=_.getUint32(4),Ae=8,Xe;for(x&&(v.dataOffset=_.getInt32(Ae),Ae+=4),T&&me&&(Xe={flags:za(p.subarray(Ae,Ae+4))},Ae+=4,N&&(Xe.duration=_.getUint32(Ae),Ae+=4),K&&(Xe.size=_.getUint32(Ae),Ae+=4),oe&&(v.version===1?Xe.compositionTimeOffset=_.getInt32(Ae):Xe.compositionTimeOffset=_.getUint32(Ae),Ae+=4),v.samples.push(Xe),me--);me--;)Xe={},N&&(Xe.duration=_.getUint32(Ae),Ae+=4),K&&(Xe.size=_.getUint32(Ae),Ae+=4),J&&(Xe.flags=za(p.subarray(Ae,Ae+4)),Ae+=4),oe&&(v.version===1?Xe.compositionTimeOffset=_.getInt32(Ae):Xe.compositionTimeOffset=_.getUint32(Ae),Ae+=4),v.samples.push(Xe);return v},Bo=Pm,qu={tfdt:Hu,trun:Bo},Vu={parseTfdt:qu.tfdt,parseTrun:qu.trun},Gu=function(p){for(var v=0,_=String.fromCharCode(p[v]),x="";_!=="\0";)x+=_,v++,_=String.fromCharCode(p[v]);return x+=_,x},Ku={uint8ToCString:Gu},Po=Ku.uint8ToCString,Fd=l.getUint64,Ud=function(p){var v=4,_=p[0],x,T,N,K,J,oe,me,Ae;if(_===0){x=Po(p.subarray(v)),v+=x.length,T=Po(p.subarray(v)),v+=T.length;var Xe=new DataView(p.buffer);N=Xe.getUint32(v),v+=4,J=Xe.getUint32(v),v+=4,oe=Xe.getUint32(v),v+=4,me=Xe.getUint32(v),v+=4}else if(_===1){var Xe=new DataView(p.buffer);N=Xe.getUint32(v),v+=4,K=Fd(p.subarray(v)),v+=8,oe=Xe.getUint32(v),v+=4,me=Xe.getUint32(v),v+=4,x=Po(p.subarray(v)),v+=x.length,T=Po(p.subarray(v)),v+=T.length}Ae=new Uint8Array(p.subarray(v,p.byteLength));var jt={scheme_id_uri:x,value:T,timescale:N||1,presentation_time:K,presentation_time_delta:J,event_duration:oe,id:me,message_data:Ae};return Um(_,jt)?jt:void 0},Fm=function(p,v,_,x){return p||p===0?p/v:x+_/v},Um=function(p,v){var _=v.scheme_id_uri!=="\0",x=p===0&&zd(v.presentation_time_delta)&&_,T=p===1&&zd(v.presentation_time)&&_;return!(p>1)&&x||T},zd=function(p){return p!==void 0||p!==null},zm={parseEmsgBox:Ud,scaleTime:Fm},Fo;typeof window<"u"?Fo=window:typeof n<"u"?Fo=n:typeof self<"u"?Fo=self:Fo={};var Sr=Fo,zs=Fa.toUnsigned,Ha=Fa.toHexString,Ri=kl,ha=Od,El=zm,Wu=$u,Hm=Bo,$a=Hu,Xu=l.getUint64,qa,Cl,Yu,Hs,fa,Uo,Qu,Ns=Sr,Hd=wt.parseId3Frames;qa=function(p){var v={},_=Ri(p,["moov","trak"]);return _.reduce(function(x,T){var N,K,J,oe,me;return N=Ri(T,["tkhd"])[0],!N||(K=N[0],J=K===0?12:20,oe=zs(N[J]<<24|N[J+1]<<16|N[J+2]<<8|N[J+3]),me=Ri(T,["mdia","mdhd"])[0],!me)?null:(K=me[0],J=K===0?12:20,x[oe]=zs(me[J]<<24|me[J+1]<<16|me[J+2]<<8|me[J+3]),x)},v)},Cl=function(p,v){var _;_=Ri(v,["moof","traf"]);var x=_.reduce(function(T,N){var K=Ri(N,["tfhd"])[0],J=zs(K[4]<<24|K[5]<<16|K[6]<<8|K[7]),oe=p[J]||9e4,me=Ri(N,["tfdt"])[0],Ae=new DataView(me.buffer,me.byteOffset,me.byteLength),Xe;me[0]===1?Xe=Xu(me.subarray(4,12)):Xe=Ae.getUint32(4);let jt;return typeof Xe=="bigint"?jt=Xe/Ns.BigInt(oe):typeof Xe=="number"&&!isNaN(Xe)&&(jt=Xe/oe),jt<Number.MAX_SAFE_INTEGER&&(jt=Number(jt)),jt<T&&(T=jt),T},1/0);return typeof x=="bigint"||isFinite(x)?x:0},Yu=function(p,v){var _=Ri(v,["moof","traf"]),x=0,T=0,N;if(_&&_.length){var K=Ri(_[0],["tfhd"])[0],J=Ri(_[0],["trun"])[0],oe=Ri(_[0],["tfdt"])[0];if(K){var me=Wu(K);N=me.trackId}if(oe){var Ae=$a(oe);x=Ae.baseMediaDecodeTime}if(J){var Xe=Hm(J);Xe.samples&&Xe.samples.length&&(T=Xe.samples[0].compositionTimeOffset||0)}}var jt=p[N]||9e4;typeof x=="bigint"&&(T=Ns.BigInt(T),jt=Ns.BigInt(jt));var it=(x+T)/jt;return typeof it=="bigint"&&it<Number.MAX_SAFE_INTEGER&&(it=Number(it)),it},Hs=function(p){var v=Ri(p,["moov","trak"]),_=[];return v.forEach(function(x){var T=Ri(x,["mdia","hdlr"]),N=Ri(x,["tkhd"]);T.forEach(function(K,J){var oe=ha(K.subarray(8,12)),me=N[J],Ae,Xe,jt;oe==="vide"&&(Ae=new DataView(me.buffer,me.byteOffset,me.byteLength),Xe=Ae.getUint8(0),jt=Xe===0?Ae.getUint32(12):Ae.getUint32(20),_.push(jt))})}),_},Uo=function(p){var v=p[0],_=v===0?12:20;return zs(p[_]<<24|p[_+1]<<16|p[_+2]<<8|p[_+3])},fa=function(p){var v=Ri(p,["moov","trak"]),_=[];return v.forEach(function(x){var T={},N=Ri(x,["tkhd"])[0],K,J;N&&(K=new DataView(N.buffer,N.byteOffset,N.byteLength),J=K.getUint8(0),T.id=J===0?K.getUint32(12):K.getUint32(20));var oe=Ri(x,["mdia","hdlr"])[0];if(oe){var me=ha(oe.subarray(8,12));me==="vide"?T.type="video":me==="soun"?T.type="audio":T.type=me}var Ae=Ri(x,["mdia","minf","stbl","stsd"])[0];if(Ae){var Xe=Ae.subarray(8);T.codec=ha(Xe.subarray(4,8));var jt=Ri(Xe,[T.codec])[0],it,Vt;jt&&(/^[asm]vc[1-9]$/i.test(T.codec)?(it=jt.subarray(78),Vt=ha(it.subarray(4,8)),Vt==="avcC"&&it.length>11?(T.codec+=".",T.codec+=Ha(it[9]),T.codec+=Ha(it[10]),T.codec+=Ha(it[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(it=jt.subarray(28),Vt=ha(it.subarray(4,8)),Vt==="esds"&&it.length>20&&it[19]!==0?(T.codec+="."+Ha(it[19]),T.codec+="."+Ha(it[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var _n=Ri(x,["mdia","mdhd"])[0];_n&&(T.timescale=Uo(_n)),_.push(T)}),_},Qu=function(p,v=0){var _=Ri(p,["emsg"]);return _.map(x=>{var T=El.parseEmsgBox(new Uint8Array(x)),N=Hd(T.message_data);return{cueTime:El.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,v),duration:El.scaleTime(T.event_duration,T.timescale),frames:N}})};var Va={findBox:Ri,parseType:ha,timescale:qa,startTime:Cl,compositionStartTime:Yu,videoTrackIds:Hs,tracks:fa,getTimescaleFromMediaHeader:Uo,getEmsgID3:Qu};const{parseTrun:$d}=Vu,{findBox:qd}=Va;var Vd=Sr,$m=function(p){var v=qd(p,["moof","traf"]),_=qd(p,["mdat"]),x=[];return _.forEach(function(T,N){var K=v[N];x.push({mdat:T,traf:K})}),x},Gd=function(p,v,_){var x=v,T=_.defaultSampleDuration||0,N=_.defaultSampleSize||0,K=_.trackId,J=[];return p.forEach(function(oe){var me=$d(oe),Ae=me.samples;Ae.forEach(function(Xe){Xe.duration===void 0&&(Xe.duration=T),Xe.size===void 0&&(Xe.size=N),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(Ae)}),J},Zu={getMdatTrafPairs:$m,parseSamples:Gd},Ju=cn.discardEmulationPreventionBytes,es=Zn.CaptionStream,Ga=kl,Lr=Hu,Ka=$u,{getMdatTrafPairs:ec,parseSamples:Al}=Zu,Nl=function(p,v){for(var _=p,x=0;x<v.length;x++){var T=v[x];if(_<T.size)return T;_-=T.size}return null},tc=function(p,v,_){var x=new DataView(p.buffer,p.byteOffset,p.byteLength),T={logs:[],seiNals:[]},N,K,J,oe;for(K=0;K+4<p.length;K+=J)if(J=x.getUint32(K),K+=4,!(J<=0))switch(p[K]&31){case 6:var me=p.subarray(K+1,K+1+J),Ae=Nl(K,v);if(N={nalUnitType:"sei_rbsp",size:J,data:me,escapedRBSP:Ju(me),trackId:_},Ae)N.pts=Ae.pts,N.dts=Ae.dts,oe=Ae;else if(oe)N.pts=oe.pts,N.dts=oe.dts;else{T.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+K+" for trackId "+_+". See mux.js#223."});break}T.seiNals.push(N);break}return T},ma=function(p,v){var _={},x=ec(p);return x.forEach(function(T){var N=T.mdat,K=T.traf,J=Ga(K,["tfhd"]),oe=Ka(J[0]),me=oe.trackId,Ae=Ga(K,["tfdt"]),Xe=Ae.length>0?Lr(Ae[0]).baseMediaDecodeTime:0,jt=Ga(K,["trun"]),it,Vt;v===me&&jt.length>0&&(it=Al(jt,Xe,oe),Vt=tc(N,it,me),_[me]||(_[me]={seiNals:[],logs:[]}),_[me].seiNals=_[me].seiNals.concat(Vt.seiNals),_[me].logs=_[me].logs.concat(Vt.logs))}),_},Kd=function(p,v,_){var x;if(v===null)return null;x=ma(p,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:_}},Dl=function(){var p=!1,v,_,x,T,N,K;this.isInitialized=function(){return p},this.init=function(J){v=new es,p=!0,K=J?J.isPartial:!1,v.on("data",function(oe){oe.startTime=oe.startPts/T,oe.endTime=oe.endPts/T,N.captions.push(oe),N.captionStreams[oe.stream]=!0}),v.on("log",function(oe){N.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,me){var Ae;if(this.isInitialized()){if(!oe||!me)return null;if(this.isNewInit(oe,me))x=oe[0],T=me[x];else if(x===null||!T)return _.push(J),null}else return null;for(;_.length>0;){var Xe=_.shift();this.parse(Xe,oe,me)}return Ae=Kd(J,x,T),Ae&&Ae.logs&&(N.logs=N.logs.concat(Ae.logs)),Ae===null||!Ae.seiNals?N.logs.length?{logs:N.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ae.seiNals),this.flushStream(),N)},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(){N.captions=[],N.captionStreams={},N.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;v.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){_=[],x=null,T=null,N?this.clearParsedCaptions():N={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Wa=Dl;const{parseTfdt:qm}=Vu,$i=kl,{getTimescaleFromMediaHeader:nc}=Va,{parseSamples:Ds,getMdatTrafPairs:Wd}=Zu;var $s=function(){let p=9e4;this.init=function(v){const _=$i(v,["moov","trak","mdia","mdhd"])[0];_&&(p=nc(_))},this.parseSegment=function(v){const _=[],x=Wd(v);let T=0;return x.forEach(function(N){const K=N.mdat,J=N.traf,oe=$i(J,["tfdt"])[0],me=$i(J,["tfhd"])[0],Ae=$i(J,["trun"]);if(oe&&(T=qm(oe).baseMediaDecodeTime),Ae.length&&me){const Xe=Ds(Ae,T,me);let jt=0;Xe.forEach(function(it){const Vt="utf-8",_n=new TextDecoder(Vt),Qi=K.slice(jt,jt+it.size);if($i(Qi,["vtte"])[0]){jt+=it.size;return}$i(Qi,["vttc"]).forEach(function(qo){const ki=$i(qo,["payl"])[0],pa=$i(qo,["sttg"])[0],Ms=it.pts/p,Xs=(it.pts+it.duration)/p;let li,ms;if(ki)try{li=_n.decode(ki)}catch(fr){console.error(fr)}if(pa)try{ms=_n.decode(pa)}catch(fr){console.error(fr)}it.duration&&li&&_.push({cueText:li,start:Ms,end:Xs,settings:ms})}),jt+=it.size})}}),_}},zo=ti,rc=function(p){var v=p[1]&31;return v<<=8,v|=p[2],v},Xa=function(p){return!!(p[1]&64)},Ho=function(p){var v=0;return(p[3]&48)>>>4>1&&(v+=p[4]+1),v},Ir=function(p,v){var _=rc(p);return _===0?"pat":_===v?"pmt":v?"pes":null},Ya=function(p){var v=Xa(p),_=4+Ho(p);return v&&(_+=p[_]+1),(p[_+10]&31)<<8|p[_+11]},Qa=function(p){var v={},_=Xa(p),x=4+Ho(p);if(_&&(x+=p[x]+1),!!(p[x+5]&1)){var T,N,K;T=(p[x+1]&15)<<8|p[x+2],N=3+T-4,K=(p[x+10]&15)<<8|p[x+11];for(var J=12+K;J<N;){var oe=x+J;v[(p[oe+1]&31)<<8|p[oe+2]]=p[oe],J+=((p[oe+3]&15)<<8|p[oe+4])+5}return v}},Ml=function(p,v){var _=rc(p),x=v[_];switch(x){case zo.H264_STREAM_TYPE:return"video";case zo.ADTS_STREAM_TYPE:return"audio";case zo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},$o=function(p){var v=Xa(p);if(!v)return null;var _=4+Ho(p);if(_>=p.byteLength)return null;var x=null,T;return T=p[_+7],T&192&&(x={},x.pts=(p[_+9]&14)<<27|(p[_+10]&255)<<20|(p[_+11]&254)<<12|(p[_+12]&255)<<5|(p[_+13]&254)>>>3,x.pts*=4,x.pts+=(p[_+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(p[_+14]&14)<<27|(p[_+15]&255)<<20|(p[_+16]&254)<<12|(p[_+17]&255)<<5|(p[_+18]&254)>>>3,x.dts*=4,x.dts+=(p[_+18]&6)>>>1)),x},Tr=function(p){switch(p){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}},Br=function(p){for(var v=4+Ho(p),_=p.subarray(v),x=0,T=0,N=!1,K;T<_.byteLength-3;T++)if(_[T+2]===1){x=T+5;break}for(;x<_.byteLength;)switch(_[x]){case 0:if(_[x-1]!==0){x+=2;break}else if(_[x-2]!==0){x++;break}T+3!==x-2&&(K=Tr(_[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(N=!0));do x++;while(_[x]!==1&&x<_.length);T=x-2,x+=3;break;case 1:if(_[x-1]!==0||_[x-2]!==0){x+=3;break}K=Tr(_[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(N=!0),T=x-2,x+=3;break;default:x+=3;break}return _=_.subarray(T),x-=T,T=0,_&&_.byteLength>3&&(K=Tr(_[T+3]&31),K==="slice_layer_without_partitioning_rbsp_idr"&&(N=!0)),N},qs={parseType:Ir,parsePat:Ya,parsePmt:Qa,parsePayloadUnitStartIndicator:Xa,parsePesType:Ml,parsePesTime:$o,videoPacketContainsKeyFrame:Br},ts=ti,br=di.handleRollover,Ln={};Ln.ts=qs,Ln.aac=Lt;var Vs=kt.ONE_SECOND_IN_TS,cr=188,Pr=71,Xd=function(p,v){for(var _=0,x=cr,T,N;x<p.byteLength;){if(p[_]===Pr&&p[x]===Pr){switch(T=p.subarray(_,x),N=Ln.ts.parseType(T,v.pid),N){case"pat":v.pid=Ln.ts.parsePat(T);break;case"pmt":var K=Ln.ts.parsePmt(T);v.table=v.table||{},Object.keys(K).forEach(function(J){v.table[J]=K[J]});break}_+=cr,x+=cr;continue}_++,x++}},rr=function(p,v,_){for(var x=0,T=cr,N,K,J,oe,me,Ae=!1;T<=p.byteLength;){if(p[x]===Pr&&(p[T]===Pr||T===p.byteLength)){if(N=p.subarray(x,T),K=Ln.ts.parseType(N,v.pid),K==="pes"&&(J=Ln.ts.parsePesType(N,v.table),oe=Ln.ts.parsePayloadUnitStartIndicator(N),J==="audio"&&oe&&(me=Ln.ts.parsePesTime(N),me&&(me.type="audio",_.audio.push(me),Ae=!0))),Ae)break;x+=cr,T+=cr;continue}x++,T++}for(T=p.byteLength,x=T-cr,Ae=!1;x>=0;){if(p[x]===Pr&&(p[T]===Pr||T===p.byteLength)){if(N=p.subarray(x,T),K=Ln.ts.parseType(N,v.pid),K==="pes"&&(J=Ln.ts.parsePesType(N,v.table),oe=Ln.ts.parsePayloadUnitStartIndicator(N),J==="audio"&&oe&&(me=Ln.ts.parsePesTime(N),me&&(me.type="audio",_.audio.push(me),Ae=!0))),Ae)break;x-=cr,T-=cr;continue}x--,T--}},vi=function(p,v,_){for(var x=0,T=cr,N,K,J,oe,me,Ae,Xe,jt,it=!1,Vt={data:[],size:0};T<p.byteLength;){if(p[x]===Pr&&p[T]===Pr){switch(N=p.subarray(x,T),K=Ln.ts.parseType(N,v.pid),K){case"pes":if(J=Ln.ts.parsePesType(N,v.table),oe=Ln.ts.parsePayloadUnitStartIndicator(N),J==="video"&&(oe&&!it&&(me=Ln.ts.parsePesTime(N),me&&(me.type="video",_.video.push(me),it=!0)),!_.firstKeyFrame)){if(oe&&Vt.size!==0){for(Ae=new Uint8Array(Vt.size),Xe=0;Vt.data.length;)jt=Vt.data.shift(),Ae.set(jt,Xe),Xe+=jt.byteLength;if(Ln.ts.videoPacketContainsKeyFrame(Ae)){var _n=Ln.ts.parsePesTime(Ae);_n?(_.firstKeyFrame=_n,_.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}Vt.size=0}Vt.data.push(N),Vt.size+=N.byteLength}break}if(it&&_.firstKeyFrame)break;x+=cr,T+=cr;continue}x++,T++}for(T=p.byteLength,x=T-cr,it=!1;x>=0;){if(p[x]===Pr&&p[T]===Pr){if(N=p.subarray(x,T),K=Ln.ts.parseType(N,v.pid),K==="pes"&&(J=Ln.ts.parsePesType(N,v.table),oe=Ln.ts.parsePayloadUnitStartIndicator(N),J==="video"&&oe&&(me=Ln.ts.parsePesTime(N),me&&(me.type="video",_.video.push(me),it=!0))),it)break;x-=cr,T-=cr;continue}x--,T--}},Un=function(p,v){if(p.audio&&p.audio.length){var _=v;(typeof _>"u"||isNaN(_))&&(_=p.audio[0].dts),p.audio.forEach(function(N){N.dts=br(N.dts,_),N.pts=br(N.pts,_),N.dtsTime=N.dts/Vs,N.ptsTime=N.pts/Vs})}if(p.video&&p.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=p.video[0].dts),p.video.forEach(function(N){N.dts=br(N.dts,x),N.pts=br(N.pts,x),N.dtsTime=N.dts/Vs,N.ptsTime=N.pts/Vs}),p.firstKeyFrame){var T=p.firstKeyFrame;T.dts=br(T.dts,x),T.pts=br(T.pts,x),T.dtsTime=T.dts/Vs,T.ptsTime=T.pts/Vs}}},Gs=function(p){for(var v=!1,_=0,x=null,T=null,N=0,K=0,J;p.length-K>=3;){var oe=Ln.aac.parseType(p,K);switch(oe){case"timed-metadata":if(p.length-K<10){v=!0;break}if(N=Ln.aac.parseId3TagSize(p,K),N>p.length){v=!0;break}T===null&&(J=p.subarray(K,K+N),T=Ln.aac.parseAacTimestamp(J)),K+=N;break;case"audio":if(p.length-K<7){v=!0;break}if(N=Ln.aac.parseAdtsSize(p,K),N>p.length){v=!0;break}x===null&&(J=p.subarray(K,K+N),x=Ln.aac.parseSampleRate(J)),_++,K+=N;break;default:K++;break}if(v)return null}if(x===null||T===null)return null;var me=Vs/x,Ae={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+_*1024*me,pts:T+_*1024*me}]};return Ae},Fr=function(p){var v={pid:null,table:null},_={};Xd(p,v);for(var x in v.table)if(v.table.hasOwnProperty(x)){var T=v.table[x];switch(T){case ts.H264_STREAM_TYPE:_.video=[],vi(p,v,_),_.video.length===0&&delete _.video;break;case ts.ADTS_STREAM_TYPE:_.audio=[],rr(p,v,_),_.audio.length===0&&delete _.audio;break}}return _},sc=function(p,v){var _=Ln.aac.isLikelyAacData(p),x;return _?x=Gs(p):x=Fr(p),!x||!x.audio&&!x.video?null:(Un(x,v),x)},Ks={inspect:sc,parseAudioPes_:rr};const Yd=function(p,v){v.on("data",function(_){const x=_.initSegment;_.initSegment={data:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength};const T=_.data;_.data=T.buffer,p.postMessage({action:"data",segment:_,byteOffset:T.byteOffset,byteLength:T.byteLength},[_.data])}),v.on("done",function(_){p.postMessage({action:"done"})}),v.on("gopInfo",function(_){p.postMessage({action:"gopInfo",gopInfo:_})}),v.on("videoSegmentTimingInfo",function(_){const x={start:{decode:kt.videoTsToSeconds(_.start.dts),presentation:kt.videoTsToSeconds(_.start.pts)},end:{decode:kt.videoTsToSeconds(_.end.dts),presentation:kt.videoTsToSeconds(_.end.pts)},baseMediaDecodeTime:kt.videoTsToSeconds(_.baseMediaDecodeTime)};_.prependedContentDuration&&(x.prependedContentDuration=kt.videoTsToSeconds(_.prependedContentDuration)),p.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(_){const x={start:{decode:kt.videoTsToSeconds(_.start.dts),presentation:kt.videoTsToSeconds(_.start.pts)},end:{decode:kt.videoTsToSeconds(_.end.dts),presentation:kt.videoTsToSeconds(_.end.pts)},baseMediaDecodeTime:kt.videoTsToSeconds(_.baseMediaDecodeTime)};_.prependedContentDuration&&(x.prependedContentDuration=kt.videoTsToSeconds(_.prependedContentDuration)),p.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(_){p.postMessage({action:"id3Frame",id3Frame:_})}),v.on("caption",function(_){p.postMessage({action:"caption",caption:_})}),v.on("trackinfo",function(_){p.postMessage({action:"trackinfo",trackInfo:_})}),v.on("audioTimingInfo",function(_){p.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:kt.videoTsToSeconds(_.start),end:kt.videoTsToSeconds(_.end)}})}),v.on("videoTimingInfo",function(_){p.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:kt.videoTsToSeconds(_.start),end:kt.videoTsToSeconds(_.end)}})}),v.on("log",function(_){p.postMessage({action:"log",log:_})})};class ac{constructor(v,_){this.options=_||{},this.self=v,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new jm.Transmuxer(this.options),Yd(this.self,this.transmuxer)}pushMp4Captions(v){this.captionParser||(this.captionParser=new Wa,this.captionParser.init());const _=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.captionParser.parse(_,v.trackIds,v.timescales);this.self.postMessage({action:"mp4Captions",captions:x&&x.captions||[],logs:x&&x.logs||[],data:_.buffer},[_.buffer])}initMp4WebVttParser(v){this.webVttParser||(this.webVttParser=new $s);const _=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.webVttParser.init(_)}getMp4WebVttText(v){this.webVttParser||(this.webVttParser=new $s);const _=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.webVttParser.parseSegment(_);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:x||[],data:_.buffer},[_.buffer])}probeMp4StartTime({timescales:v,data:_}){const x=Va.startTime(v,_);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:_},[_.buffer])}probeMp4Tracks({data:v}){const _=Va.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:_,data:v},[v.buffer])}probeEmsgID3({data:v,offset:_}){const x=Va.getEmsgID3(v,_);this.self.postMessage({action:"probeEmsgID3",id3Frames:x,emsgData:v},[v.buffer])}probeTs({data:v,baseStartTime:_}){const x=typeof _=="number"&&!isNaN(_)?_*kt.ONE_SECOND_IN_TS:void 0,T=Ks.inspect(v,x);let N=null;T&&(N={hasVideo:T.video&&T.video.length===2||!1,hasAudio:T.audio&&T.audio.length===2||!1},N.hasVideo&&(N.videoStart=T.video[0].ptsTime),N.hasAudio&&(N.audioStart=T.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:N,data:v},[v.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(v){const _=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.transmuxer.push(_)}reset(){this.transmuxer.reset()}setTimestampOffset(v){const _=v.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(kt.secondsToVideoTs(_)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(kt.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(p){if(p.data.action==="init"&&p.data.options){this.messageHandlers=new ac(self,p.data.options);return}this.messageHandlers||(this.messageHandlers=new ac(self)),p.data&&p.data.action&&p.data.action!=="init"&&this.messageHandlers[p.data.action]&&this.messageHandlers[p.data.action](p.data)}}));var ZR=XT(QR);const JR=(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 w=n.data.segment.boxes||{data:n.data.segment.data},S={type:i,data:new Uint8Array(w.data,w.data.byteOffset,w.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)},ej=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},tj=(n,e)=>{e.gopInfo=n.data.gopInfo},ZT=n=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:a,remux:l,onData:u,onTrackInfo:h,onAudioTimingInfo:f,onVideoTimingInfo:g,onVideoSegmentTimingInfo:w,onAudioSegmentTimingInfo:S,onId3:A,onCaptions:C,onDone:j,onEndedTimeline:k,onTransmuxerLog:B,isEndOfTimeline:V,segment:W,triggerSegmentEventFn:H}=n,ie={buffer:[]};let Y=V;const G=re=>{e.currentTransmux===n&&(re.data.action==="data"&&JR(re,ie,u),re.data.action==="trackinfo"&&h(re.data.trackInfo),re.data.action==="gopInfo"&&tj(re,ie),re.data.action==="audioTimingInfo"&&f(re.data.audioTimingInfo),re.data.action==="videoTimingInfo"&&g(re.data.videoTimingInfo),re.data.action==="videoSegmentTimingInfo"&&w(re.data.videoSegmentTimingInfo),re.data.action==="audioSegmentTimingInfo"&&S(re.data.audioSegmentTimingInfo),re.data.action==="id3Frame"&&A([re.data.id3Frame],re.data.id3Frame.dispatchType),re.data.action==="caption"&&C(re.data.caption),re.data.action==="endedtimeline"&&(Y=!1,k()),re.data.action==="log"&&B(re.data.log),re.data.type==="transmuxed"&&(Y||(e.onmessage=null,ej({transmuxedData:ie,callback:j}),JT(e))))},O=()=>{const re={message:"Received an error message from the transmuxer worker",metadata:{errorType:Fe.Error.StreamingFailedToTransmuxSegment,segmentInfo:ol({segment:W})}};j(null,re)};if(e.onmessage=G,e.onerror=O,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 re=t instanceof ArrayBuffer?t:t.buffer,E=t instanceof ArrayBuffer?0:t.byteOffset;H({type:"segmenttransmuxingstart",segment:W}),e.postMessage({action:"push",data:re,byteOffset:E,byteLength:t.byteLength},[re])}V&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},JT=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():ZT(n.currentTransmux))},h_=(n,e)=>{n.postMessage({action:e}),JT(n)},ek=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,h_(e,n);return}e.transmuxQueue.push(h_.bind(null,e,n))},nj=n=>{ek("reset",n)},ij=n=>{ek("endTimeline",n)},tk=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,ZT(n);return}n.transmuxer.transmuxQueue.push(n)},rj=n=>{const e=new ZR;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 yg={reset:nj,endTimeline:ij,transmux:tk,createTransmuxer:rj};const pu=function(n){const e=n.transmuxer,t=n.endAction||n.action,i=n.callback,a=tr({},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)},sa={FAILURE:2,TIMEOUT:-101,ABORTED:-102},nk="wvtt",oy=n=>{n.forEach(e=>{e.abort()})},sj=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),aj=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},rb=(n,e)=>{const{requestType:t}=e,i=pl({requestType:t,request:e,error:n});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:sa.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:sa.ABORTED,xhr:e,metadata:i}:n?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:sa.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:sa.FAILURE,xhr:e,metadata:i}:null},f_=(n,e,t,i)=>(a,l)=>{const u=l.response,h=rb(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:sa.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.length;S++)e[S].bytes=g;const w={uri:l.uri};return i({type:"segmentkeyloadcomplete",segment:n,keyInfo:w}),t(null,n)},oj=(n,e)=>{e===nk&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},lj=(n,e,t)=>{e===nk&&pu({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=Cy(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:sa.FAILURE,metadata:{mediaType:a}})}pu({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"&&oj(n,l.codec))}),e(null))})},uj=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=rb(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)})},cj=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=rb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:XR(l.responseText.substring(n.lastReachedChar||0));return n.stats=sj(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},dj=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})=>{const j=n.map&&n.map.tracks||{},k=!!(j.audio&&j.video);let B=i.bind(null,n,"audio","start");const V=i.bind(null,n,"audio","end");let W=i.bind(null,n,"video","start");const H=i.bind(null,n,"video","end"),ie=()=>tk({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:k,onData:Y=>{Y.type=Y.type==="combined"?"video":Y.type,w(n,Y)},onTrackInfo:Y=>{t&&(k&&(Y.isMuxed=!0),t(n,Y))},onAudioTimingInfo:Y=>{B&&typeof Y.start<"u"&&(B(Y.start),B=null),V&&typeof Y.end<"u"&&V(Y.end)},onVideoTimingInfo:Y=>{W&&typeof Y.start<"u"&&(W(Y.start),W=null),H&&typeof Y.end<"u"&&H(Y.end)},onVideoSegmentTimingInfo:Y=>{const G={pts:{start:Y.start.presentation,end:Y.end.presentation},dts:{start:Y.start.decode,end:Y.end.decode}};C({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:G}),a(Y)},onAudioSegmentTimingInfo:Y=>{const G={pts:{start:Y.start.pts,end:Y.end.pts},dts:{start:Y.start.dts,end:Y.end.dts}};C({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:G}),l(Y)},onId3:(Y,G)=>{u(n,Y,G)},onCaptions:Y=>{h(n,[Y])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:A,onDone:(Y,G)=>{S&&(Y.type=Y.type==="combined"?"video":Y.type,C({type:"segmenttransmuxingcomplete",segment:n}),S(G,n,Y))},segment:n,triggerSegmentEventFn:C});pu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:Y=>{n.bytes=e=Y.data;const G=Y.result;G&&(t(n,{hasAudio:G.hasAudio,hasVideo:G.hasVideo,isMuxed:k}),t=null),ie()}})},rk=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})=>{let j=new Uint8Array(e);if(R4(j)){n.isFmp4=!0;const{tracks:k}=n.map;if(k.text&&(!k.audio||!k.video)){w(n,{data:j,type:"text"}),lj(n,k.text.codec,S);return}const V={isFmp4:!0,hasVideo:!!k.video,hasAudio:!!k.audio};k.audio&&k.audio.codec&&k.audio.codec!=="enca"&&(V.audioCodec=k.audio.codec),k.video&&k.video.codec&&k.video.codec!=="encv"&&(V.videoCodec=k.video.codec),k.video&&k.audio&&(V.isMuxed=!0),t(n,V);const W=(H,ie)=>{w(n,{data:j,type:V.hasAudio&&!V.isMuxed?"audio":"video"}),ie&&ie.length&&u(n,ie),H&&H.length&&h(n,H),S(null,n,{})};pu({action:"probeMp4StartTime",timescales:n.map.timescales,data:j,transmuxer:n.transmuxer,callback:({data:H,startTime:ie})=>{e=H.buffer,n.bytes=j=H,V.hasAudio&&!V.isMuxed&&i(n,"audio","start",ie),V.hasVideo&&i(n,"video","start",ie),pu({action:"probeEmsgID3",data:j,transmuxer:n.transmuxer,offset:ie,callback:({emsgData:Y,id3Frames:G})=>{if(e=Y.buffer,n.bytes=j=Y,!k.video||!Y.byteLength||!n.transmuxer){W(void 0,G);return}pu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:j,timescales:n.map.timescales,trackIds:[k.video.id],callback:O=>{e=O.data.buffer,n.bytes=j=O.data,O.logs.forEach(function(re){A(ai(re,{stream:"mp4CaptionParser"}))}),W(O.captions,G)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=Cy(j)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}dj({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})},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 w=g.data.decrypted;u(new Uint8Array(w.bytes,w.byteOffset,w.byteLength))}};i.onerror=()=>{const g="An error occurred in the decryption worker",w=ol({segment:a}),S={message:g,metadata:{error:new Error(g),errorType:Fe.Error.StreamingFailedToDecryptSegment,segmentInfo:w,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($T({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},hj=({decryptionWorker:n,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})=>{C({type:"segmentdecryptionstart"}),sk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},j=>{e.bytes=j,C({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:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})})},fj=({activeXhrs:n,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})=>{let j=0,k=!1;return(B,V)=>{if(!k){if(B)return k=!0,oy(n),S(B,V);if(j+=1,j===n.length){const W=function(){if(V.encryptedBytes)return hj({decryptionWorker:e,segment:V,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C});rk({segment:V,bytes:V.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w,doneFn:S,onTransmuxerLog:A,triggerSegmentEventFn:C})};if(V.endOfAllRequests=Date.now(),V.map&&V.map.encryptedBytes&&!V.map.bytes)return C({type:"segmentdecryptionstart",segment:V}),sk({decryptionWorker:e,id:V.requestId+"-init",encryptedBytes:V.map.encryptedBytes,key:V.map.key,segment:V,doneFn:S},H=>{V.map.bytes=H,C({type:"segmentdecryptioncomplete",segment:V}),ik(V,ie=>{if(ie)return oy(n),S(ie,V);W()})});W()}}}},mj=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},pj=({segment:n,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:w})=>S=>{if(!S.target.aborted)return n.stats=ai(n.stats,aj(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},gj=({xhr:n,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:a,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:w,captionsFn:S,isEndOfTimeline:A,endedTimelineFn:C,dataFn:j,doneFn:k,onTransmuxerLog:B,triggerSegmentEventFn:V})=>{const W=[],H=fj({activeXhrs:W,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:w,captionsFn:S,isEndOfTimeline:A,endedTimelineFn:C,dataFn:j,doneFn:k,onTransmuxerLog:B,triggerSegmentEventFn:V});if(i.key&&!i.key.bytes){const re=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&re.push(i.map.key);const E=ai(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),R=f_(i,re,H,V),ee={uri:i.key.resolvedUri};V({type:"segmentkeyloadstart",segment:i,keyInfo:ee});const q=n(E,R);W.push(q)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const q=ai(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Q=f_(i,[i.map.key],H,V),ue={uri:i.map.key.resolvedUri};V({type:"segmentkeyloadstart",segment:i,keyInfo:ue});const se=n(q,Q);W.push(se)}const E=ai(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:sy(i.map),requestType:"segment-media-initialization"}),R=uj({segment:i,finishProcessingFn:H,triggerSegmentEventFn:V});V({type:"segmentloadstart",segment:i});const ee=n(E,R);W.push(ee)}const ie=ai(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:sy(i),requestType:"segment"}),Y=cj({segment:i,finishProcessingFn:H,responseType:ie.responseType,triggerSegmentEventFn:V});V({type:"segmentloadstart",segment:i});const G=n(ie,Y);G.addEventListener("progress",pj({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:w,captionsFn:S,isEndOfTimeline:A,endedTimelineFn:C,dataFn:j})),W.push(G);const O={};return W.forEach(re=>{re.addEventListener("loadend",mj({loadendState:O,abortFn:a}))}),()=>oy(W)},Jh=Cs("PlaylistSelector"),m_=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||""})},gu=function(n,e){if(!n)return"";const t=he.getComputedStyle(n);return t?t[e]:""},yu=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})},sb=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||he.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||he.Number.MAX_VALUE,t-i},yj=function(n,e){let t,i;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(t=n.attributes.RESOLUTION.width),t=t||he.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||he.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;Xr.isAudioOnly(e)&&(g=h.getAudioTrackPlaylists_(),f.audioOnly=!0);let w=g.map(O=>{let re;const E=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,R=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return re=O.attributes&&O.attributes.BANDWIDTH,re=re||he.Number.MAX_VALUE,{bandwidth:re,width:E,height:R,playlist:O}});yu(w,(O,re)=>O.bandwidth-re.bandwidth),w=w.filter(O=>!Xr.isIncompatible(O.playlist));let S=w.filter(O=>Xr.isEnabled(O.playlist));S.length||(S=w.filter(O=>!Xr.isDisabled(O.playlist)));const A=S.filter(O=>O.bandwidth*pr.BANDWIDTH_VARIANCE<t);let C=A[A.length-1];const j=A.filter(O=>O.bandwidth===C.bandwidth)[0];if(u===!1){const O=j||S[0]||w[0];if(O&&O.playlist){let re="sortedPlaylistReps";return j&&(re="bandwidthBestRep"),S[0]&&(re="enabledPlaylistReps"),Jh(`choosing ${m_(O)} using ${re} with options`,f),O.playlist}return Jh("could not choose a playlist with options",f),null}const k=A.filter(O=>O.width&&O.height);yu(k,(O,re)=>O.width-re.width);const B=k.filter(O=>O.width===i&&O.height===a);C=B[B.length-1];const V=B.filter(O=>O.bandwidth===C.bandwidth)[0];let W,H,ie;V||(W=k.filter(O=>l==="cover"?O.width>i&&O.height>a:O.width>i||O.height>a),H=W.filter(O=>O.width===W[0].width&&O.height===W[0].height),C=H[H.length-1],ie=H.filter(O=>O.bandwidth===C.bandwidth)[0]);let Y;if(h.leastPixelDiffSelector){const O=k.map(re=>(re.pixelDiff=Math.abs(re.width-i)+Math.abs(re.height-a),re));yu(O,(re,E)=>re.pixelDiff===E.pixelDiff?E.bandwidth-re.bandwidth:re.pixelDiff-E.pixelDiff),Y=O[0]}const G=Y||ie||V||j||S[0]||w[0];if(G&&G.playlist){let O="sortedPlaylistReps";return Y?O="leastPixelDiffRep":ie?O="resolutionPlusOneRep":V?O="resolutionBestRep":j?O="bandwidthBestRep":S[0]&&(O="enabledPlaylistReps"),Jh(`choosing ${m_(G)} using ${O} with options`,f),G.playlist}return Jh("could not choose a playlist with options",f),null};const p_=function(){let n=this.useDevicePixelRatio&&he.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),ak({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(gu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(gu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?gu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},bj=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&&he.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(gu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(gu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?gu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},vj=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(j=>!Xr.isIncompatible(j));let w=g.filter(Xr.isEnabled);w.length||(w=g.filter(j=>!Xr.isDisabled(j)));const A=w.filter(Xr.hasAttribute.bind(null,"BANDWIDTH")).map(j=>{const B=f.getSyncPoint(j,a,h,t)?1:2,W=Xr.estimateSegmentRequestTime(l,i,j)*B-u;return{playlist:j,rebufferingImpact:W}}),C=A.filter(j=>j.rebufferingImpact<=0);return yu(C,(j,k)=>sb(k.playlist,j.playlist)),C.length?C[0]:(yu(A,(j,k)=>j.rebufferingImpact-k.rebufferingImpact),A[0]||null)},xj=function(){const n=this.playlists.main.playlists.filter(Xr.isEnabled);return yu(n,(t,i)=>sb(t,i)),n.filter(t=>!!ld(this.playlists.main,t).video)[0]||null},_j=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 wj=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}}},Sj=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=he.WebKitDataCue||he.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))})},Tj=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}}})},kj=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=he.WebKitDataCue||he.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(w=>{const S=w.cueTime+t;typeof S!="number"||he.isNaN(S)||S<0||!(S<1/0)||!w.frames||!w.frames.length||w.frames.forEach(A=>{const C=new a(S,S,A.value||A.url||A.data||"");C.frame=A,C.value=A,Tj(C),l.addCue(C)})}),!l.cues||!l.cues.length))return;const u=l.cues,h=[];for(let w=0;w<u.length;w++)u[w]&&h.push(u[w]);const f=h.reduce((w,S)=>{const A=w[S.startTime]||[];return A.push(S),w[S.startTime]=A,w},{}),g=Object.keys(f).sort((w,S)=>Number(w)-Number(S));g.forEach((w,S)=>{const A=f[w],C=isFinite(i)?i:w,j=Number(g[S+1])||C;A.forEach(k=>{k.endTime=j})})},Ej={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"},Cj=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Aj=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=he.WebKitDataCue||he.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(Cj.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:Ej[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()})},g_=(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))},Yc=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)},Nj=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}},Dj=(n,e,t)=>{if(typeof e>"u"||e===null||!n.length)return[];const i=Math.ceil((e-t+3)*ul.ONE_SECOND_IN_TS);let a;for(a=0;a<n.length&&!(n[a].pts>i);a++);return n.slice(a)},Mj=(n,e,t)=>{if(!e.length)return n;if(t)return e.slice();const i=e[0].pts;let a=0;for(a;a<n.length&&!(n[a].pts>=i);a++);return n.slice(0,a).concat(e)},Rj=(n,e,t,i)=>{const a=Math.ceil((e-i)*ul.ONE_SECOND_IN_TS),l=Math.ceil((t-i)*ul.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},jj=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;a<t.length;a++){const l=t[a];if(l!==i[a]||n[l]!==e[l])return!1}return!0},Oj=function(n,e,t){e=e||[];const i=[];let a=0;for(let l=0;l<e.length;l++){const u=e[l];if(n===u.timeline&&(i.push(l),a+=u.duration,a>t))return l}return i.length===0?0:i[i.length-1]},Hc=1,Lj=500,y_=n=>typeof n=="number"&&isFinite(n),ef=1/60,Ij=(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,Bj=(n,e,t)=>{let i=e-pr.BACK_BUFFER_LENGTH;n.length&&(i=Math.max(i,n.start(0)));const a=e-t;return Math.min(a,i)},Zl=n=>{const{startOfSegment:e,duration:t,segment:i,part:a,playlist:{mediaSequence:l,id:u,segments:h=[]},mediaIndex:f,partIndex:g,timeline:w}=n,S=h.length-1;let A="mediaIndex/partIndex increment";n.getMediaInfoForTime?A=`getMediaInfoForTime (${n.getMediaInfoForTime})`:n.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),n.independent&&(A+=` with independent ${n.independent}`);const C=typeof g=="number",j=n.segment.uri?"segment":"pre-segment",k=C?kT({preloadSegment:i})-1:0;return`${j} [${l+f}/${l+S}]`+(C?` part [${g}/${k}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(C?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${w}] selected by [${A}] playlist [${u}]`},b_=n=>`${n}TimingInfo`,Pj=({segmentTimeline:n,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:a})=>!a&&n===e?null:n<e?t:i.length?i.end(i.length-1):t,ly=({timelineChangeController:n,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:a})=>{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},Fj=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)},Uj=n=>{const e=n.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=n.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},vo=n=>{const e=n.pendingSegment_;if(!e)return;if(ly({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&Fj(n.timelineChangeController_)){if(Uj(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},zj=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=he.BigInt(l)-he.BigInt(a):typeof a=="number"&&typeof l=="number"&&(u=l-a),typeof u<"u"&&u>e&&(e=u)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},v_=({segmentDuration:n,maxDuration:e})=>n?Math.round(n)>e+ia:!1,Hj=(n,e)=>{if(e!=="hls")return null;const t=zj({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo});if(!t)return null;const i=n.playlist.targetDuration,a=v_({segmentDuration:t,maxDuration:i*2}),l=v_({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},ol=({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 uy 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_=Cs(`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_():vo(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(tr({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():vo(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(tr({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():vo(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vo(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return yg.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_&&he.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,he.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_&&yg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return yr();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=Vf(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=qT(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: ${pg(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_&&(he.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_&&yg.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_=Rj(this.gopBuffer_,e,t,this.timeMapping_),l++,this.sourceUpdater_.removeVideo(e,t,u));for(const h in this.inbandTextTracks_)Yc(e,t,this.inbandTextTracks_[h]);Yc(e,t,this.segmentMetadataTrack_),u()}monitorBuffer_(){this.checkBufferTimeout_&&he.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=he.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&he.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=he.setTimeout(this.monitorBufferTick_.bind(this),Lj)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:ol({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=pg(e)||0,i=eb(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=Oj(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 A=u[this.mediaIndex],C=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=A.end?A.end:t,A.parts&&A.parts[C+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=C+1):h.mediaIndex=this.mediaIndex+1}else{let A,C,j;const k=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
||
For TargetTime: ${k}.
|
||
CurrentTime: ${this.currentTime_()}
|
||
BufferedEnd: ${t}
|
||
Fetch At Buffer: ${this.fetchAtBuffer_}
|
||
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const B=this.getSyncInfoFromMediaSequenceSync_(k);if(!B){const V="No sync info found while using media sequence sync";return this.error({message:V,metadata:{errorType:Fe.Error.StreamingFailedToSelectNextSegment,error:new Error(V)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${B.start} --> ${B.end})`),A=B.segmentIndex,C=B.partIndex,j=B.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const B=Xr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:k,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=B.segmentIndex,C=B.partIndex,j=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${k}`:`currentTime ${k}`,h.mediaIndex=A,h.startOfSegment=j,h.partIndex=C,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 w=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&g&&!w&&!g.independent)if(h.partIndex===0){const A=u[h.mediaIndex-1],C=A.parts&&A.parts.length&&A.parts[A.parts.length-1];C&&C.independent&&(h.mediaIndex-=1,h.partIndex=A.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,w=i.segments[a],S=typeof h=="number"&&w.parts[h],A={requestId:"segment-loader-"+Math.random(),uri:S&&S.resolvedUri||w.resolvedUri,mediaIndex:a,partIndex:S?h:null,isSyncRequest:u,startOfSegment:l,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:w.timeline,duration:S&&S.duration||w.duration,segment:w,part:S,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:g,independent:t},C=typeof f<"u"?f:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:w.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:C});const j=pg(this.sourceUpdater_.audioBuffered());return typeof j=="number"&&(A.audioAppendStart=j-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=Dj(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return Pj(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=Xr.estimateSegmentRequestTime(a,i,this.playlist_,e.bytesReceived),u=aR(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=vj({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 w=.5;u<=ia&&(w=1),!(!h.playlist||h.playlist.uri===this.playlist_.uri||g<w)&&(this.bandwidth=h.playlist.attributes.BANDWIDTH*pr.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Zl(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:ol({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||{},jj(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_():vo(this))))}handleTimingInfo_(e,t,i,a){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const l=this.pendingSegment_,u=b_(t);l[u]=l[u]||{},l[u][i]=a,this.logger_(`timinginfo: ${t} - ${i} - ${a}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vo(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],w=this.inbandTextTracks_;this.logger_(`adding cues from ${h} -> ${f} for ${u}`),wj(w,this.vhs_.tech_,u),Yc(h,f,w[u]),Sj({captionArray:g,inbandTextTracks:w,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_()?!ly({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||ly({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_()){vo(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[b_(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=Vf(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: "+cl(l).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+cl(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,w=u.length?u.end(u.length-1):0;if(f-h<=Hc&&w-g<=Hc){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${cl(l).join(", ")}, video buffer: ${cl(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 A=this.currentTime_()-Hc;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Hc}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=he.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Hc*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},a){if(a){if(a.code===IT){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=_j({bytes:f,segments:h})}const u={segmentInfo:ol({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_()){vo(this),this.loadQueue_.push(()=>{const t=tr({},e,{forceTimestampOffset:!0});tr(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)}
|
||
${Zl(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=gj({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_(`${Zl(e)} logged from transmuxer stream ${g} as a ${f}: ${h}`)},triggerSegmentEventFn:({type:h,segment:f,keyInfo:g,trackInfo:w,timingInfo:S})=>{const C={segmentInfo:ol({segment:f})};g&&(C.keyInfo=g),w&&(C.trackInfo=w),S&&(C.timingInfo=S),this.trigger({type:h,metadata:C})}})}trimBackBuffer_(e){const t=Bj(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<ef){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${ef}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===sa.ABORTED)return;if(this.pause(),e.code===sa.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const a=this.pendingSegment_;this.saveBandwidthRelatedStats_(a.duration,t.stats),a.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=Mj(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(a)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:a,currentVideoTimestampOffset:l,useVideoTimingInfo:u,videoTimingInfo:h,audioTimingInfo:f}){if(typeof e<"u")return e;if(!u)return f.start;const g=t.segments[i-1];return i===0||!g||typeof g.start>"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=Ij(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:ol({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=Hj(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 ${Zl(e)}`);return}this.logger_(`Appended ${Zl(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"} ${Zl(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.duration<ef){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${ef}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,a=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(a-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,a=t.end;if(!y_(i)||!y_(a))return;Yc(i,a,this.segmentMetadataTrack_);const l=he.WebKitDataCue||he.VTTCue,u={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:a},h=JSON.stringify(u),f=new l(i,a,h);f.value=u,this.segmentMetadataTrack_.addCue(f)}}function Ra(){}const lk=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},$j=["video","audio"],cy=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},qj=(n,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===n)return t}return null},bu=(n,e)=>{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(),bu("audio",e),bu("video",e));return}if(n!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||cy(n,e))){if(i.type!==n){if(t=qj(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,bu(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)},ta=(n,e)=>n&&e&&Array.prototype.indexOf.call(n.sourceBuffers,e)!==-1,ls={appendBuffer:(n,e,t)=>(i,a)=>{const l=a[`${i}Buffer`];if(ta(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===IT?"(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(ta(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`];ta(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(ta(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=Su(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),!!ta(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=Su(n);if(!ta(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)}}},us=({type:n,sourceUpdater:e,action:t,doneFn:i,name:a})=>{e.queue.push({type:n,action:t,doneFn:i,name:a}),bu(n,e)},x_=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=iR(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_`])}bu(n,e)};class ck extends Fe.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>bu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Cs("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=x_("video",this),this.onAudioUpdateEnd_=x_("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){us({type:"mediaSource",sourceUpdater:this,action:ls.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){us({type:e,sourceUpdater:this,action:ls.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Fe.log.error("removeSourceBuffer is not supported!");return}us({type:"mediaSource",sourceUpdater:this,action:ls.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Fe.browser.IS_FIREFOX&&he.MediaSource&&he.MediaSource.prototype&&typeof he.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return he.SourceBuffer&&he.SourceBuffer.prototype&&typeof he.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Fe.log.error("changeType is not supported!");return}us({type:e,sourceUpdater:this,action:ls.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(us({type:a,sourceUpdater:this,action:ls.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 ta(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:yr()}videoBuffered(){return ta(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:yr()}buffered(){const e=ta(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ta(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():sR(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ra){us({type:"mediaSource",sourceUpdater:this,action:ls.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ra){typeof e!="string"&&(e=void 0),us({type:"mediaSource",sourceUpdater:this,action:ls.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Ra){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}us({type:"audio",sourceUpdater:this,action:ls.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Ra){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}us({type:"video",sourceUpdater:this,action:ls.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(cy("audio",this)||cy("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(us({type:"audio",sourceUpdater:this,action:ls.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(us({type:"video",sourceUpdater:this,action:ls.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&us({type:"audio",sourceUpdater:this,action:ls.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&us({type:"video",sourceUpdater:this,action:ls.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),$j.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 __=n=>decodeURIComponent(escape(String.fromCharCode.apply(null,n))),Vj=n=>{const e=new Uint8Array(n);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},w_=new Uint8Array(`
|
||
|
||
`.split("").map(n=>n.charCodeAt(0)));class Gj extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Kj extends uy{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 yr();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return yr([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Vf(e);let a=this.initSegments_[i];if(t&&!a&&e.bytes){const l=w_.byteLength+e.bytes.byteLength,u=new Uint8Array(l);u.set(e.bytes),u.set(w_,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){Yc(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===sa.TIMEOUT&&this.handleTimeout_(),e.code===sa.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 he.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 he.VTTCue(h.startTime,h.endTime,h.text):h)}),Nj(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 he.VTTCue(a,l,i.cueText);i.settings&&i.settings.split(" ").forEach(h=>{const f=h.split(":"),g=f[0],w=f[1];u[g]=isNaN(w)?w:Number(w)}),e.cues.push(u)})}parseVTTCues_(e){let t,i=!1;if(typeof he.WebVTT!="function")throw new Gj;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof he.TextDecoder=="function"?t=new he.TextDecoder("utf8"):(t=he.WebVTT.StringDecoder(),i=!0);const a=new he.WebVTT.Parser(he,he.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=__(u)),a.parse(u)}let l=e.bytes;i&&(l=__(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/ul.ONE_SECOND_IN_TS-u+t.mapping;if(e.cues.forEach(g=>{const w=g.endTime-g.startTime,S=this.handleRollover_(g.startTime+f,t.time);g.startTime=Math.max(S,0),g.endTime=Math.max(S+w,0)}),!i.syncInfo){const g=e.cues[0].startTime,w=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(g,w-a.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*ul.ONE_SECOND_IN_TS;const a=t*ul.ONE_SECOND_IN_TS;let l;for(a<i?l=-8589934592:l=8589934592;Math.abs(i-a)>4294967296;)i+=l;return i/ul.ONE_SECOND_IN_TS}}const Wj=function(n,e){const t=n.cues;for(let i=0;i<t.length;i++){const a=t[i];if(e>=a.adStartTime&&e<=a.adEndTime)return a}return null},Xj=function(n,e,t=0){if(!n.segments)return;let i=t,a;for(let l=0;l<n.segments.length;l++){const u=n.segments[l];if(a||(a=Wj(e,i+u.duration/2)),a){if("cueIn"in u){a.endTime=i,a.adEndTime=i,i+=u.duration,a=null;continue}if(i<a.endTime){i+=u.duration;continue}a.endTime+=u.duration}else if("cueOut"in u&&(a=new he.VTTCue(i,i+u.duration,u.cueOut),a.adStartTime=i,a.adEndTime=i+parseFloat(u.cueOut),e.addCue(a)),"cueOutCont"in u){const[h,f]=u.cueOutCont.split("/").map(parseFloat);a=new he.VTTCue(i,i+u.duration,""),a.adStartTime=i-h,a.adEndTime=a.adStartTime+f,e.addCue(a)}i+=u.duration}};class S_{constructor({start:e,end:t,segmentIndex:i,partIndex:a=null,appended:l=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=a,this.appended_=l}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class Yj{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}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 w=this.storage_.get(h),S=u,A=S+f.duration,C=!!(w&&w.segmentSyncInfo&&w.segmentSyncInfo.isAppended),j=new S_({start:S,end:A,appended:C,segmentIndex:g});f.syncInfo=j;let k=u;const B=(f.parts||[]).map((V,W)=>{const H=k,ie=k+V.duration,Y=!!(w&&w.partsSyncInfo&&w.partsSyncInfo[W]&&w.partsSyncInfo[W].isAppended),G=new S_({start:H,end:ie,appended:Y,segmentIndex:g,partIndex:W});return k=ie,l+=`Media Sequence: ${h}.${W} | Range: ${H} --> ${ie} | Appended: ${Y}
|
||
`,V.syncInfo=G,G});a.set(h,new Yj(j,B)),l+=`${ok(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${A} | Appended: ${C}
|
||
`,h++,u=A}),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(e<a){const l=a-e;let u=this.storage_.get(a).segmentSyncInfo.start;for(let h=0;h<l;h++){const f=t[h];u-=f.duration}return u}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class T_ extends dk{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const a=this.parent_.getSyncInfoForMediaSequence(e);return a?a.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const Qj=86400,bg=[{name:"VOD",run:(n,e,t,i,a)=>t!==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=ey(e);a=a||0;for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),w=h[g],S=w.segment,A=n.timelineToDatetimeMappings[S.timeline];if(!A||!S.dateTimeObject)continue;let j=S.dateTimeObject.getTime()/1e3+A;if(S.parts&&typeof w.partIndex=="number")for(let B=0;B<w.partIndex;B++)j+=S.parts[B].duration;const k=Math.abs(a-j);if(u!==null&&(k===0||u<k))break;u=k,l={time:j,segmentIndex:w.segmentIndex,partIndex:w.partIndex}}return l}},{name:"Segment",run:(n,e,t,i,a)=>{let l=null,u=null;a=a||0;const h=ey(e);for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),w=h[g],S=w.segment,A=w.part&&w.part.start||S&&S.start;if(S.timeline===i&&typeof A<"u"){const C=Math.abs(a-A);if(u!==null&&u<C)break;(!l||u===null||u>=C)&&(u=C,l={time:A,segmentIndex:w.segmentIndex,partIndex:w.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<e.discontinuityStarts.length;h++){const f=e.discontinuityStarts[h],g=e.discontinuitySequence+h+1,w=n.discontinuities[g];if(w){const S=Math.abs(a-w.time);if(u!==null&&u<S)break;(!l||u===null||u>=S)&&(u=S,l={time:w.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 Zj extends Fe.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new dk,i=new T_(t),a=new T_(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:a},this.logger_=Cs("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,a,l){if(t!==1/0)return bg.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:w,time:S}=f;if(w<0)continue;const A=e.segments[w],C=S,j=C+A.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${w}. Time: [${C} -> ${j}]}`),a>=C&&a<j)return this.logger_("Found sync point with exact match: ",f),f}return this.selectSyncPoint_(u,{key:"time",value:a})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const a=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return a.segmentIndex>0&&(a.time*=-1),Math.abs(a.time+od({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:a.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,a,l){const u=[];for(let h=0;h<bg.length;h++){const f=bg[h],g=f.run(this,e,t,i,a,l);g&&(g.strategy=f.name,u.push({strategy:f.name,syncPoint:g}))}return u}selectSyncPoint_(e,t){let i=e[0].syncPoint,a=Math.abs(e[0].syncPoint[t.key]-t.value),l=e[0].strategy;for(let u=1;u<e.length;u++){const h=Math.abs(e[u].syncPoint[t.key]-t.value);h<a&&(a=h,i=e[u].syncPoint,l=e[u].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${l}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>Qj){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||h<a.start)&&(a.start=h),a.end=f,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let a=0;a<t.discontinuityStarts.length;a++){const l=t.discontinuityStarts[a],u=t.discontinuitySequence+a+1,h=l-e.mediaIndex,f=Math.abs(h);if(!this.discontinuities[u]||this.discontinuities[u].accuracy>f){let g;h<0?g=i.start-od({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:l}):g=i.end+od({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 Jj 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 e8=YT(QT(function(){var n=(function(){function k(){this.listeners={}}var B=k.prototype;return B.on=function(W,H){this.listeners[W]||(this.listeners[W]=[]),this.listeners[W].push(H)},B.off=function(W,H){if(!this.listeners[W])return!1;var ie=this.listeners[W].indexOf(H);return this.listeners[W]=this.listeners[W].slice(0),this.listeners[W].splice(ie,1),ie>-1},B.trigger=function(W){var H=this.listeners[W];if(H)if(arguments.length===2)for(var ie=H.length,Y=0;Y<ie;++Y)H[Y].call(this,arguments[1]);else for(var G=Array.prototype.slice.call(arguments,1),O=H.length,re=0;re<O;++re)H[re].apply(this,G)},B.dispose=function(){this.listeners={}},B.pipe=function(W){this.on("data",function(H){W.push(H)})},k})();function e(k){return k.subarray(0,k.byteLength-k[k.byteLength-1])}const t=function(){const k=[[[],[],[],[],[]],[[],[],[],[],[]]],B=k[0],V=k[1],W=B[4],H=V[4];let ie,Y,G;const O=[],re=[];let E,R,ee,q,Q,ue;for(ie=0;ie<256;ie++)re[(O[ie]=ie<<1^(ie>>7)*283)^ie]=ie;for(Y=G=0;!W[Y];Y^=E||1,G=re[G]||1)for(q=G^G<<1^G<<2^G<<3^G<<4,q=q>>8^q&255^99,W[Y]=q,H[q]=Y,ee=O[R=O[E=O[Y]]],ue=ee*16843009^R*65537^E*257^Y*16843008,Q=O[q]*257^q*16843008,ie=0;ie<4;ie++)B[ie][Y]=Q=Q<<24^Q>>>8,V[ie][q]=ue=ue<<24^ue>>>8;for(ie=0;ie<5;ie++)B[ie]=B[ie].slice(0),V[ie]=V[ie].slice(0);return k};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 V,W,H;const ie=this._tables[0][4],Y=this._tables[1],G=B.length;let O=1;if(G!==4&&G!==6&&G!==8)throw new Error("Invalid aes key size");const re=B.slice(0),E=[];for(this._key=[re,E],V=G;V<4*G+28;V++)H=re[V-1],(V%G===0||G===8&&V%G===4)&&(H=ie[H>>>24]<<24^ie[H>>16&255]<<16^ie[H>>8&255]<<8^ie[H&255],V%G===0&&(H=H<<8^H>>>24^O<<24,O=O<<1^(O>>7)*283)),re[V]=re[V-G]^H;for(W=0;V;W++,V--)H=re[W&3?V:V-4],V<=4||W<4?E[W]=H:E[W]=Y[0][ie[H>>>24]]^Y[1][ie[H>>16&255]]^Y[2][ie[H>>8&255]]^Y[3][ie[H&255]]}decrypt(B,V,W,H,ie,Y){const G=this._key[1];let O=B^G[0],re=H^G[1],E=W^G[2],R=V^G[3],ee,q,Q;const ue=G.length/4-2;let se,$=4;const F=this._tables[1],X=F[0],le=F[1],de=F[2],L=F[3],pe=F[4];for(se=0;se<ue;se++)ee=X[O>>>24]^le[re>>16&255]^de[E>>8&255]^L[R&255]^G[$],q=X[re>>>24]^le[E>>16&255]^de[R>>8&255]^L[O&255]^G[$+1],Q=X[E>>>24]^le[R>>16&255]^de[O>>8&255]^L[re&255]^G[$+2],R=X[R>>>24]^le[O>>16&255]^de[re>>8&255]^L[E&255]^G[$+3],$+=4,O=ee,re=q,E=Q;for(se=0;se<4;se++)ie[(3&-se)+Y]=pe[O>>>24]<<24^pe[re>>16&255]<<16^pe[E>>8&255]<<8^pe[R&255]^G[$++],ee=O,O=re,re=E,E=R,R=ee}}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(k){return k<<24|(k&65280)<<8|(k&16711680)>>8|k>>>24},h=function(k,B,V){const W=new Int32Array(k.buffer,k.byteOffset,k.byteLength>>2),H=new a(Array.prototype.slice.call(B)),ie=new Uint8Array(k.byteLength),Y=new Int32Array(ie.buffer);let G,O,re,E,R,ee,q,Q,ue;for(G=V[0],O=V[1],re=V[2],E=V[3],ue=0;ue<W.length;ue+=4)R=u(W[ue]),ee=u(W[ue+1]),q=u(W[ue+2]),Q=u(W[ue+3]),H.decrypt(R,ee,q,Q,Y,ue),Y[ue]=u(Y[ue]^G),Y[ue+1]=u(Y[ue+1]^O),Y[ue+2]=u(Y[ue+2]^re),Y[ue+3]=u(Y[ue+3]^E),G=R,O=ee,re=q,E=Q;return ie};class f{constructor(B,V,W,H){const ie=f.STEP,Y=new Int32Array(B.buffer),G=new Uint8Array(B.byteLength);let O=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(Y.subarray(O,O+ie),V,W,G)),O=ie;O<Y.length;O+=ie)W=new Uint32Array([u(Y[O-4]),u(Y[O-3]),u(Y[O-2]),u(Y[O-1])]),this.asyncStream_.push(this.decryptChunk_(Y.subarray(O,O+ie),V,W,G));this.asyncStream_.push(function(){H(null,e(G))})}static get STEP(){return 32e3}decryptChunk_(B,V,W,H){return function(){const ie=h(B,V,W);H.set(ie,B.byteOffset)}}}var g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},w;typeof window<"u"?w=window:typeof g<"u"?w=g:typeof self<"u"?w=self:w={};var S=w,A=function(B){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(B):B&&B.buffer instanceof ArrayBuffer},C=S.BigInt||Number;C("0x1"),C("0x100"),C("0x10000"),C("0x1000000"),C("0x100000000"),C("0x10000000000"),C("0x1000000000000"),C("0x100000000000000"),C("0x10000000000000000"),(function(){var k=new Uint16Array([65484]),B=new Uint8Array(k.buffer,k.byteOffset,k.byteLength);return B[0]===255?"big":B[0]===204?"little":"unknown"})();const j=function(k){const B={};return Object.keys(k).forEach(V=>{const W=k[V];A(W)?B[V]={bytes:W.buffer,byteOffset:W.byteOffset,byteLength:W.byteLength}:B[V]=W}),B};self.onmessage=function(k){const B=k.data,V=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),W=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),H=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(V,W,H,function(ie,Y){self.postMessage(j({source:B.source,decrypted:Y}),[Y.buffer])})}}));var t8=XT(e8);const n8=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)},dy=(n,e)=>{e.activePlaylistLoader=n,n.load()},i8=(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(),dy(u.playlistLoader,a)}},r8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},s8=(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 w=e.vhs.playlistController_,S=w.selectPlaylist();if(w.media()===S)return;l.logger_(`track change. Switching main audio from ${g.id} to ${u.id}`),t.pause(),a.resetEverything(),w.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){dy(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),dy(h.playlistLoader,l)}},Gf={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()}},k_={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",Gf[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",Gf[n](n,t))}},a8={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:w}=e,S=Cd(w.main);(!u[n]||Object.keys(u[n]).length===0)&&(u[n]={main:{default:{default:!0}}},S&&(u[n].main.default.playlists=w.main.playlists));for(const A in u[n]){h[A]||(h[A]=[]);for(const C in u[n][A]){let j=u[n][A][C],k;if(S?(g(`AUDIO group '${A}' label '${C}' is a main playlist`),j.isMainPlaylist=!0,k=null):i==="vhs-json"&&j.playlists?k=new ou(j.playlists[0],t,l):j.resolvedUri?k=new ou(j.resolvedUri,t,l):j.playlists&&i==="dash"?k=new ay(j.playlists[0],t,l,w):k=null,j=ai({id:C,playlistLoader:k},j),k_[n](n,j.playlistLoader,e),h[A].push(j),typeof f[C]>"u"){const B=new Fe.AudioTrack({id:C,kind:n8(j),enabled:!1,language:j.language,default:j.default,label:C});f[C]=B}}}a.on("error",Gf[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:w}=e;for(const S in h[n]){f[S]||(f[S]=[]);for(const A in h[n][S]){if(!i.options_.useForcedSubtitles&&h[n][S][A].forced)continue;let C=h[n][S][A],j;if(a==="hls")j=new ou(C.resolvedUri,i,u);else if(a==="dash"){if(!C.playlists.filter(B=>B.excludeUntil!==1/0).length)return;j=new ay(C.playlists[0],i,u,w)}else a==="vhs-json"&&(j=new ou(C.playlists?C.playlists[0]:C.resolvedUri,i,u));if(C=ai({id:A,playlistLoader:j},C),k_[n](n,C.playlistLoader,e),f[S].push(C),typeof g[A]>"u"){const k=t.addRemoteTextTrack({id:A,kind:"subtitles",default:C.default&&C.autoselect,language:C.language,label:A},!1).track;g[A]=k}}}l.on("error",Gf[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 w={label:h,language:f.language,instreamId:f.instreamId,default:f.default&&f.autoselect};if(g[w.instreamId]&&(w=ai(w,g[w.instreamId])),w.default===void 0&&delete w.default,a[u].push(ai({id:h},f)),typeof l[h]>"u"){const S=t.addRemoteTextTrack({id:w.instreamId,kind:"captions",default:w.default,language:w.language,label:w.label},!1).track;l[h]=S}}}}},fk=(n,e)=>{for(let t=0;t<n.length;t++)if(ib(e,n[t])||n[t].playlists&&fk(n[t].playlists,e))return!0;return!1},o8=(n,e)=>t=>{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<h.length;f++){const g=a[h[f]];if(fk(g,l)){u=g;break}}else a.main?u=a.main:h.length===1&&(u=a[h[0]]);return typeof t>"u"?u:t===null||!u?null:u.filter(f=>f.id===t.id)[0]||null},l8={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}},u8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},c8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{a8[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=o8(g,n),e[g].activeTrack=l8[g](g,n),e[g].onGroupChanged=i8(g,n),e[g].onGroupChanging=r8(g,n),e[g].onTrackChanged=s8(g,n),e[g].getActiveGroup=u8(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])},d8=()=>{const n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{n[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ra,activeTrack:Ra,getActiveGroup:Ra,onGroupChanged:Ra,onTrackChanged:Ra,lastTrack_:null,logger_:Cs(`MediaGroups[${e}]`)}}),n};class E_{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_=Kr(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 h8 extends Fe.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new E_,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_=Cs("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=Kr(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 w={errorType:Fe.Error.StreamingContentSteeringParserError,error:g};this.trigger({type:"error",metadata:w})}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 he.URL(e),i=new he.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(he.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new he.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_=he.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){he.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 E_}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&&(Kr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const f8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},m8=10;let xo;const p8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],g8=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},y8=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 w=!!au(e,t).length;if(!n.endList)return!w&&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=eb(e,t),A=h?pr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:pr.MAX_BUFFER_LOW_WATER_LINE;if(u<A)return f(`${g} as duration < max low water line (${u} < ${A})`),!0;const C=i.attributes.BANDWIDTH,j=n.attributes.BANDWIDTH;if(C<j&&(!h||S<l)){let k=`${g} as next bandwidth < current bandwidth (${C} < ${j})`;return h&&(k+=` and forwardBuffer < bufferHighWaterLine (${S} < ${l})`),f(k),!0}if((!h||C>j)&&S>=a){let k=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(k+=` and next bandwidth > current bandwidth (${C} > ${j})`),f(k),!0}return f(`not ${g} as no switching criteria met`),!1};class b8 extends Fe.EventTarget{constructor(e){super(),this.fastQualityChange_=f8(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:a,bandwidth:l,externVhs:u,useCueTags:h,playlistExclusionDuration:f,enableLowInitialPlaylist:g,sourceType:w,cacheEncryptionKeys:S,bufferBasedABR:A,leastPixelDiffSelector:C,captionServices:j,experimentalUseMMS:k}=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),xo=u,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!C,this.withCredentials=i,this.tech_=a,this.vhs_=a.vhs,this.player_=e.player_,this.sourceType_=w,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_=d8(),k&&he.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new he.ManagedMediaSource,this.usingManagedMediaSource_=!0,Fe.log("Using ManagedMediaSource")):he.MediaSource&&(this.mediaSource=new he.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_=yr(),this.hasPlayed_=!1,this.syncController_=new Zj(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new t8,this.sourceUpdater_=new ck(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Jj,this.keyStatusMap_=new Map;const V={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:j,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 ay(t,this.vhs_,ai(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ou(t,this.vhs_,ai(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new uy(ai(V,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new uy(ai(V,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Kj(ai(V,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((ie,Y)=>{function G(){a.off("vttjserror",O),ie()}function O(){a.off("vttjsloaded",G),Y()}a.one("vttjsloaded",G),a.one("vttjserror",O),a.addWebVttScript_()})}),e);const W=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new h8(this.vhs_.xhr,W),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),p8.forEach(ie=>{this[ie+"_"]=g8.bind(this,ie)}),this.logger_=Cs("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 H=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(H,()=>{const ie=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-ie,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_=he.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(he.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<e.playlists.length;g++){const w=e.playlists[g];w.attributes&&w.attributes.AUDIO&&w.attributes.AUDIO===h&&u.push(w)}}return u.length?u:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;ty(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()),c8({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;ty(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(tr({},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"}),xo.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 y8({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:m8}))});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(tr({},a))}),this.audioSegmentLoader_.on(i,a=>{this.player_.trigger(tr({},a))}),this.subtitleSegmentLoader_.on(i,a=>{this.player_.trigger(tr({},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()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let a=i;if(e.start){const l=e.start.timeOffset;l<0?a=Math.max(i+l,t.start(0)):a=Math.min(i,l)}this.trigger("firstplay"),this.tech_.setCurrentTime(a)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}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=xo.Playlist.playlistEnd(e,i),l=this.tech_.currentTime(),u=this.tech_.buffered();if(!u.length)return a-l<=ra;const h=u.end(u.length-1);return h-l<=ra&&a-h<=ra}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(Am),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 j=this.pathwayAttribute_(e),k=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(j),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(j)},k);return}let C=!1;a.forEach(j=>{if(j===e)return;const k=j.excludeUntil;typeof k<"u"&&k!==1/0&&(C=!0,delete j.excludeUntil)}),C&&(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,w=t.message?" "+t.message:"";g(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${w} 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,A=typeof f.lastRequest=="number"&&Date.now()-f.lastRequest<=S;return this.switchMedia_(f,"exclude",u||A)}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=au(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:xo.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=xo.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),w=Math.max(h,f-g);return yr([[h,w]])}const l=this.syncController_.getExpiredTime(i,this.duration());if(l===null)return null;const u=xo.Playlist.seekable(i,l,xo.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:yr([[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 [${ST(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.duration<a.end(a.length-1))&&this.sourceUpdater_.setDuration(a.end(a.length-1));return}const t=this.tech_.buffered();let i=xo.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(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=ld(this.main(),t),a={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(a.video=i.video||e.main.videoCodec||aD),e.main.isMuxed&&(a.video+=`,${i.audio||e.main.audioCodec||p2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||l)&&(a.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||p2,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,w)=>g?id(w,this.usingManagedMediaSource_):Z0(w),h={};let f;if(["video","audio"].forEach(function(g){if(a.hasOwnProperty(g)&&!u(e[g].isFmp4,a[g])){const w=e[g].isFmp4?"browser":"muxer";h[w]=h[w]||[],h[w].push(a[g]),g==="audio"&&(f=w)}}),l&&f&&t.attributes.AUDIO){const g=t.attributes.AUDIO;this.main().playlists.forEach(w=>{(w.attributes&&w.attributes.AUDIO)===g&&w!==t&&(w.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((w,S)=>(w&&(w+=", "),w+=`${S} does not support codec(s): "${h[S].join(",")}"`,w),"")+".";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(w=>{const S=(ea(this.sourceUpdater_.codecs[w]||"")[0]||{}).type,A=(ea(a[w]||"")[0]||{}).type;S&&A&&S.toLowerCase()!==A.toLowerCase()&&g.push(`"${this.sourceUpdater_.codecs[w]}" -> "${a[w]}"`)}),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=ld(this.main,a),u=[];l.audio&&!Z0(l.audio)&&!id(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!Z0(l.video)&&!id(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(ea(e)),l=l_(a),u=a.video&&ea(a.video)[0]||null,h=a.audio&&ea(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 w=[],S=ld(this.mainPlaylistLoader_.main,g),A=l_(S);if(!(!S.audio&&!S.video)){if(A!==l&&w.push(`codec count "${A}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const C=S.video&&ea(S.video)[0]||null,j=S.audio&&ea(S.audio)[0]||null;C&&u&&C.type.toLowerCase()!==u.type.toLowerCase()&&w.push(`video codec "${C.type}" !== "${u.type}"`),j&&h&&j.type.toLowerCase()!==h.type.toLowerCase()&&w.push(`audio codec "${j.type}" !== "${h.type}"`)}w.length&&(g.excludeUntil=1/0,this.logger_(`excluding ${g.id}: ${w.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),Xj(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=pr.GOAL_BUFFER_LENGTH,i=pr.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,pr.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=pr.BUFFER_LOW_WATER_LINE,i=pr.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,pr.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,pr.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return pr.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){g_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Aj({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();g_(this.inbandTextTracks_,e,this.tech_),kj({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(tr({},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(w=>w.attributes["PATHWAY-ID"]===h["BASE-ID"]).forEach(w=>{this.mainPlaylistLoader_.addClonePathway(h,w)}),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:Vj(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 v8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=nb(a),u=Am(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 x8{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=ld(a.main(),t),this.playlist=t,this.id=i,this.enabled=v8(e.playlists,t.id,l)}}const _8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=Cd(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!nb(i)).map((i,a)=>new x8(n,i,i.id)):[]}},C_=["seeking","seeked","pause","playing","error"];class w8 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_=Cs("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(w=>{f[w]={reset:()=>this.resetSegmentDownloads_(w),updateend:()=>this.checkSegmentDownloads_(w)},u[`${w}SegmentLoader_`].on("appendsdone",f[w].updateend),u[`${w}SegmentLoader_`].on("playlistupdate",f[w].reset),this.tech_.on(["seeked","seeking"],f[w].reset)});const g=w=>{["main","audio"].forEach(S=>{u[`${S}SegmentLoader_`][w]("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(C_,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(C_,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(w=>{u[`${w}SegmentLoader_`].off("appendsdone",f[w].updateend),u[`${w}SegmentLoader_`].off("playlistupdate",f[w].reset),this.tech_.off(["seeked","seeking"],f[w].reset)}),this.checkCurrentTimeTimeout_&&he.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&he.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=he.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=oR(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:cl(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+ra>=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(yr([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 j=t.start(0);l=j+(j===t.end(0)?0:ra)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${ST(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,w=this.media(),S=w.partTargetDuration?w.partTargetDuration:(w.targetDuration-ia)*2,A=[f,g];for(let j=0;j<A.length;j++){if(!A[j])continue;if(eb(A[j],i)<S)return!1}const C=Zh(h,i);return C.length===0?!1:(l=C.start(0)+ra,this.logger_(`Buffered region starts (${C.start(0)}) just beyond seek point (${i}). Seeking to ${l}.`),this.tech_.setCurrentTime(l),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=au(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${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)+ra;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&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let a;if(e.length&&t.length){const l=au(e,i-3),u=au(e,i),h=au(t,i);h.length&&!u.length&&l.length&&(a={start:l.end(0),end:h.end(0)})}else Zh(e,i).length||(a=this.gapFromVideoUnderflow_(e,i));return a?(this.logger_(`Encountered a gap in video from ${a.start} to ${a.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),a=Zh(t,i);if(this.resetTimeUpdate_(),a.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",a.start(0)),this.tech_.setCurrentTime(a.start(0)+ia);const l={gapInfo:{from:i,to:a.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:l}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=rR(e);for(let a=0;a<i.length;a++){const l=i.start(a),u=i.end(a);if(t-l<4&&t-l>2)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=ai(S8,e);n.ready(()=>{n.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const l=function(){i&&n.currentTime(i)},u=function(w){w!=null&&(i=n.duration()!==1/0&&n.currentTime()||0,n.one("loadedmetadata",l),n.src(w),n.trigger({type:"usage",name:"vhs-error-reload"}),n.play())},h=function(){if(Date.now()-t<a.errorInterval*1e3){n.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!a.getSource||typeof a.getSource!="function"){Fe.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),a.getSource.call(n,u)},f=function(){n.off("loadedmetadata",l),n.off("error",h),n.off("dispose",f)},g=function(w){f(),mk(n,w)};n.on("error",h),n.on("dispose",f),n.reloadSourceOnError=g},T8=function(n){mk(this,n)};var pk="3.17.2",k8="7.1.0",E8="1.3.1",C8="7.2.0",A8="4.0.2";const Ui={PlaylistLoader:ou,Playlist:Xr,utils:jR,STANDARD_PLAYLIST_SELECTOR:p_,INITIAL_PLAYLIST_SELECTOR:xj,lastBandwidthSelector:p_,movingAverageBandwidthSelector:bj,comparePlaylistBandwidth:sb,comparePlaylistResolution:yj,xhr:HT()};Object.keys(pr).forEach(n=>{Object.defineProperty(Ui,n,{get(){return Fe.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),pr[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}pr[n]=e}})});const gk="videojs-vhs",yk=function(n,e){const t=e.media();let i=-1;for(let a=0;a<n.length;a++)if(n[a].id===t.id){i=a;break}n.selectedIndex_=i,n.trigger({selectedIndex:i,type:"change"})},N8=function(n,e){e.representations().forEach(t=>{n.addQualityLevel(t)}),yk(n,e.playlists)};Ui.canPlaySource=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const D8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=yd(ea(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const a=Su(i.video),l=Su(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 ai(n,u)},M8=(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=M8(a,Object.keys(e)),u=[],h=[];return l.forEach(f=>{h.push(new Promise((g,w)=>{n.tech_.one("keysessioncreated",g)})),u.push(new Promise((g,w)=>{n.eme.initializeMediaKeys({keySystems:f},S=>{if(S){w(S);return}g()})}))}),Promise.race([Promise.all(u),Promise.race(h)])},j8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=D8(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(!he.localStorage)return null;const n=he.localStorage.getItem(gk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},O8=n=>{if(!he.localStorage)return!1;let e=bk();e=e?ai(e,n):n;try{he.localStorage.setItem(gk,JSON.stringify(e))}catch{return!1}return e},L8=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)};Ui.supportsNativeHls=(function(){if(!Tt||!Tt.createElement)return!1;const n=Tt.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})();Ui.supportsNativeDash=(function(){return!Tt||!Tt.createElement||!Fe.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(Tt.createElement("video").canPlayType("application/dash+xml"))})();Ui.supportsTypeNatively=n=>n==="hls"?Ui.supportsNativeHls:n==="dash"?Ui.supportsNativeDash:!1;Ui.isSupported=function(){return Fe.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ui.xhr.onRequest=function(n){vk(Ui.xhr,n)};Ui.xhr.onResponse=function(n){xk(Ui.xhr,n)};Ui.xhr.offRequest=function(n){_k(Ui.xhr,n)};Ui.xhr.offResponse=function(n){wk(Ui.xhr,n)};const I8=Fe.getComponent("Component");class Sk extends I8{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Cs("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(Tt,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],a=>{const l=Tt.fullscreenElement||Tt.webkitFullscreenElement||Tt.mozFullScreenElement||Tt.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_=ai(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=pr.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===pr.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=L8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ui,this.options_.sourceType=qw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new b8(this.options_);const i=ai({liveRangeSafeTimeDelta:ra},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new w8(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?Ui.movingAverageBandwidthSelector(.55):Ui.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Ui.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=he.navigator.connection||he.navigator.mozConnection||he.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:()=>cl(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:()=>cl(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&&O8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{_8(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_=he.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=j8({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",()=>{N8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{yk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":pk,"mux.js":k8,"mpd-parser":E8,"m3u8-parser":C8,"aes-decrypter":A8}}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_&&he.URL.revokeObjectURL&&(he.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return UR({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return KT({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(tr({},a))})}),t.forEach(i=>{this.playbackWatcher_.on(i,a=>{this.player_.trigger(tr({},a))})})}}const Kf={name:"videojs-http-streaming",VERSION:pk,canHandleSource(n,e={}){const t=ai(Fe.options,e);return!t.vhs.experimentalUseMMS&&!id("avc1.4d400d,mp4a.40.2",!1)?!1:Kf.canPlayType(n.type,t)},handleSource(n,e,t={}){const i=ai(Fe.options,t);return e.vhs=new Sk(n,e,i),e.vhs.xhr=HT(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=qw(n);if(!t)return"";const i=Kf.getOverrideNative(e);return!Ui.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}},B8=()=>id("avc1.4d400d,mp4a.40.2",!0);B8()&&Fe.getTech("Html5").registerSourceHandler(Kf,0);Fe.VhsHandler=Sk;Fe.VhsSourceHandler=Kf;Fe.Vhs=Ui;Fe.use||Fe.registerComponent("Vhs",Ui);Fe.options.vhs=Fe.options.vhs||{};(!Fe.getPlugin||!Fe.getPlugin("reloadSourceOnError"))&&Fe.registerPlugin("reloadSourceOnError",T8);const P8="",sl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${P8}${e}`};async function vg(n,e){const t=await fetch(sl(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 ab({src:n,muted:e=Ef,className:t,roomStatus:i}){const a=m.useRef(null),[l,u]=m.useState(!1),[h,f]=m.useState(null),g=S=>{const A=String(S??"").trim().toLowerCase();return A==="private"?"private":A==="hidden"?"hidden":A==="away"?"away":"offline"},w=S=>{switch(S){case"hidden":return"Cam is hidden";case"away":return"Model is away";case"private":return"Private show in progress.";case"offline":return"Model is offline";default:return"Live video unavailable"}};return m.useEffect(()=>{let S=!1,A=null;const C=a.current;if(!C)return;u(!1),f(null),cd(C,{muted:e});const j=()=>{try{C.pause(),C.removeAttribute("src"),C.load()}catch{}};j(),C.src=n,C.load(),C.play().catch(()=>{});let k=Date.now();const B=()=>{k=Date.now()};C.addEventListener("timeupdate",B);let V=0;A=window.setInterval(()=>{if(!S&&!C.paused&&Date.now()-k>12e3){if(V<1){V+=1,j(),C.src=n,C.load(),C.play().catch(()=>{}),k=Date.now();return}u(!0),f(g(i))}},4e3);const W=()=>{u(!0),f(g(i))};return C.addEventListener("error",W),()=>{S=!0,A&&window.clearInterval(A),A=null,C.removeEventListener("timeupdate",B),C.removeEventListener("error",W),j()}},[n,e,i]),l?c.jsx("div",{className:"grid h-full w-full place-items-center bg-black/80 px-4 text-center",children:c.jsx("div",{className:"text-sm font-medium text-white",children:w(h)})}):c.jsx("video",{ref:a,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const S=a.current;S&&(S.muted=!1,S.play().catch(()=>{}))}})}const xs=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",ob=n=>n.startsWith("HOT ")?n.slice(4):n,F8=n=>(n||"").trim().toLowerCase(),U8=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 z8(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<e.length-1;)t/=1024,i++;const a=i===0||t>=100?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function A_(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 $8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function q8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function V8(n){const e=xs(n||""),t=ob(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]),w=Number(a[6]);return[l,u,h,f,g,w].every(S=>Number.isFinite(S))?new Date(h,l-1,u,f,g,w):null}const G8=n=>{const e=xs(n||""),t=ob(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},K8=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 Aa(...n){return n.filter(Boolean).join(" ")}function W8(n){const[e,t]=m.useState(!1);return m.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 X8(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 Y8({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:w,onDelete:S,onToggleHot:A,onToggleFavorite:C,onToggleLike:j,onToggleWatch:k,onStopJob:B,startMuted:V=GN,startAtSec:W=0}){const H=m.useMemo(()=>xs(n.output?.trim()||"")||n.id,[n.output,n.id]),ie=m.useMemo(()=>xs(n.output?.trim()||""),[n.output]),Y=m.useMemo(()=>xs(n.output?.trim()||""),[n.output]),G=m.useMemo(()=>H8(K8(n)),[n]),O=n,[re,E]=m.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[R,ee]=m.useState(()=>n.status==="running"),[q,Q]=m.useState(()=>({h:0,fps:null})),ue=n.status==="running",[se,$]=m.useState(!1),F=ue&&se,X=m.useMemo(()=>(Y||"").replace(/\.[^.]+$/,""),[Y]),le=m.useMemo(()=>ue?n.id:X||n.id,[ue,n.id,X]);m.useEffect(()=>{if(ue||re>0)return;const ae=xs(n.output?.trim()||"");if(!ae)return;let ke=!0;const pt=new AbortController;return(async()=>{try{const xt=sl(`/api/record/done/meta?file=${encodeURIComponent(ae)}`),Rt=await vg(xt,{signal:pt.signal,cache:"no-store"});if(!Rt.ok)return;const Et=await Rt.json(),Z=Number(Et?.durationSeconds||Et?.meta?.durationSeconds||0)||0;if(!ke||Z<=0)return;E(Z);const ce=et.current;if(ce&&!ce.isDisposed?.())try{ce.__fullDurationSec=Z,ce.trigger?.("durationchange"),ce.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{ke=!1,pt.abort()}},[ue,re,n.output]);const de=ie.startsWith("HOT "),L=m.useMemo(()=>{const ae=(a||"").trim();return ae||G8(n.output)},[a,n.output]),pe=m.useMemo(()=>ob(ie),[ie]),we=m.useMemo(()=>{const ae=Number(re||0)||0;return ae>0?z8(ae*1e3):"—"},[re]),Be=m.useMemo(()=>{const ae=V8(n.output);if(ae)return A_(ae);const ke=O.startedAt??O.endedAt??O.createdAt??O.fileCreatedAt??O.ctime??null,pt=ke?new Date(ke):null;return A_(pt&&Number.isFinite(pt.getTime())?pt:null)},[n.output,O.startedAt,O.endedAt,O.createdAt,O.fileCreatedAt,O.ctime]),Ve=m.useMemo(()=>F8((a||L||"").trim()),[a,L]),Oe=m.useMemo(()=>{const ae=l?.[Ve];return U8(ae?.tags)},[l,Ve]),Te=m.useMemo(()=>sl(`/api/preview?id=${encodeURIComponent(le)}&file=preview.webp`),[le]),_t=m.useMemo(()=>sl(`/api/preview/live?id=${encodeURIComponent(le)}&play=1`),[le]),[dt,xe]=m.useState(Te);m.useEffect(()=>{xe(Te)},[Te]);const Ne=m.useMemo(()=>tf(q.h,O.videoHeight,O.height,O.meta?.height),[q.h,O.videoHeight,O.height,O.meta?.height]),Se=m.useMemo(()=>tf(q.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate),[q.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate]),[Ie,$e]=m.useState(null),Ct=m.useMemo(()=>q8(Ie??Ne),[Ie,Ne]),st=m.useMemo(()=>$8(Se),[Se]);m.useEffect(()=>{const ae=ke=>ke.key==="Escape"&&t();return window.addEventListener("keydown",ae),()=>window.removeEventListener("keydown",ae)},[t]);const gt=m.useMemo(()=>{const ae=`/api/preview?id=${encodeURIComponent(le)}&file=index_hq.m3u8&play=1`;return sl(ue?`${ae}&t=${Date.now()}`:ae)},[le,ue]);m.useEffect(()=>{if(!ue){$(!1);return}let ae=!0;const ke=new AbortController;return $(!1),(async()=>{for(let xt=0;xt<120&&ae&&!ke.signal.aborted;xt++){try{const Rt=await vg(gt,{method:"GET",cache:"no-store",signal:ke.signal,headers:{"cache-control":"no-cache"}});if(Rt.ok){const Et=await Rt.text(),Z=Et.includes("#EXTM3U"),ce=/#EXTINF:/i.test(Et)||/\.ts(\?|$)/i.test(Et)||/\.m4s(\?|$)/i.test(Et);if(Z&&ce){ae&&$(!0);return}}}catch{}await new Promise(Rt=>setTimeout(Rt,500))}})(),()=>{ae=!1,ke.abort()}},[ue,gt]);const He=m.useCallback(ae=>{const ke=new URLSearchParams;return ae.file&&ke.set("file",ae.file),ae.id&&ke.set("id",ae.id),sl(`/api/record/video?${ke.toString()}`)},[]),We=m.useMemo(()=>{if(ue)return{src:"",type:""};if(!R)return{src:"",type:""};const ae=xs(n.output?.trim()||"");if(ae){const ke=ae.toLowerCase().split(".").pop(),pt=ke==="mp4"?"video/mp4":ke==="ts"?"video/mp2t":"application/octet-stream";return{src:He({file:ae}),type:pt}}return{src:He({id:n.id}),type:"video/mp4"}},[ue,R,n.output,n.id,He]),Je=m.useRef(null),et=m.useRef(null),mt=m.useRef(null),[Mt,fe]=m.useState(!1),qe=m.useCallback(()=>{const ae=et.current;if(!ae||ae.isDisposed?.())return;const ke=typeof ae.videoHeight=="function"?ae.videoHeight():0;typeof ke=="number"&&ke>0&&Number.isFinite(ke)&&$e(ke)},[]),Le=m.useCallback(()=>{try{const ae=et.current?.tech?.(!0)?.el?.()||et.current?.el?.()?.querySelector?.("video.vjs-tech")||mt.current;if(!ae||!(ae instanceof HTMLVideoElement))return null;const ke=Number(ae.videoWidth||0),pt=Number(ae.videoHeight||0);if(!Number.isFinite(ke)||!Number.isFinite(pt)||ke<=0||pt<=0)return null;let xt=Gn.current;xt||(xt=document.createElement("canvas"),Gn.current=xt);const Et=Math.min(1,640/ke),Z=Math.max(1,Math.round(ke*Et)),ce=Math.max(1,Math.round(pt*Et));xt.width!==Z&&(xt.width=Z),xt.height!==ce&&(xt.height=ce);const ve=xt.getContext("2d",{alpha:!1});return ve?(ve.drawImage(ae,0,0,Z,ce),xt.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),Ce=m.useMemo(()=>xs(n.output?.trim()||"")||n.id,[n.output,n.id]),Pe=m.useMemo(()=>{const ae=Number(W);return Number.isFinite(ae)&&ae>=0?ae:0},[W]),Qe=m.useRef("");m.useEffect(()=>{if(ue){ee(!0);return}const ae=xs(n.output?.trim()||"");if(!ae){ee(!0);return}let ke=!0;const pt=new AbortController;return ee(!1),(async()=>{for(let xt=0;xt<80&&ke&&!pt.signal.aborted;xt++){try{const Rt=sl(`/api/record/done/meta?file=${encodeURIComponent(ae)}`),Et=await vg(Rt,{signal:pt.signal,cache:"no-store"});if(Et.ok){const Z=await Et.json(),ce=!!Z?.metaExists,ve=Number(Z?.durationSeconds||0)||0,Me=Number(Z?.height||0)||0,I=Number(Z?.fps||0)||0;if(ve>0){E(ve);const U=et.current;if(U&&!U.isDisposed?.())try{U.__fullDurationSec=ve,U.trigger?.("durationchange"),U.trigger?.("timeupdate")}catch{}}if(Me>0&&Q({h:Me,fps:I>0?I:null}),ce){ee(!0);return}}}catch{}await new Promise(Rt=>setTimeout(Rt,250))}ke&&ee(!0)})(),()=>{ke=!1,pt.abort()}},[ue,Ce,n.output]);const[,At]=m.useState(0);m.useEffect(()=>{if(typeof window>"u")return;const ae=window.visualViewport;if(!ae)return;const ke=()=>At(pt=>pt+1);return ke(),ae.addEventListener("resize",ke),ae.addEventListener("scroll",ke),window.addEventListener("resize",ke),window.addEventListener("orientationchange",ke),()=>{ae.removeEventListener("resize",ke),ae.removeEventListener("scroll",ke),window.removeEventListener("resize",ke),window.removeEventListener("orientationchange",ke)}},[]);const[Xt,kt]=m.useState(30),[mn,It]=m.useState(null),$t=!e,Ot=W8("(min-width: 640px)"),en=$t&&Ot,Sn=e||en,Pn="player_window_v1",St=420,Tn=280,tt=12,D=320,P=200;m.useEffect(()=>{if(!Mt)return;const ae=et.current;if(!ae||ae.isDisposed?.())return;const ke=ae.el();if(!ke)return;const pt=ke.querySelector(".vjs-control-bar");if(!pt)return;const xt=()=>{const Et=Math.round(pt.getBoundingClientRect().height||0);Et>0&&kt(Et)};xt();let Rt=null;return typeof ResizeObserver<"u"&&(Rt=new ResizeObserver(xt),Rt.observe(pt)),window.addEventListener("resize",xt),()=>{window.removeEventListener("resize",xt),Rt?.disconnect()}},[Mt,e]),m.useEffect(()=>fe(!0),[]),m.useEffect(()=>{if(!Sn){It(null);return}let ae=document.getElementById("player-root");ae||(ae=document.createElement("div"),ae.id="player-root");let ke=null;if(Ot){const pt=Array.from(document.querySelectorAll("dialog[open]"));ke=pt.length?pt[pt.length-1]:null}ke=ke??document.body,ke.appendChild(ae),ae.style.position="relative",ae.style.zIndex="2147483647",It(ae)},[Ot,Sn]),m.useEffect(()=>{const ae=et.current;if(!ae||ae.isDisposed?.()||ue||(X8(ae),!xs(n.output?.trim()||"")))return;const pt=Number(re||0)||0;return pt>0&&(ae.__fullDurationSec=pt),ae.__serverSeekAbs=xt=>{const Rt=Math.max(0,Number(xt)||0);try{ae.__origCurrentTime?.(Rt);try{ae.trigger?.("timeupdate")}catch{}}catch{try{ae.currentTime?.(Rt)}catch{}}},()=>{try{delete ae.__serverSeekAbs}catch{}}},[n.output,ue]),m.useLayoutEffect(()=>{if(!Mt||!Je.current||et.current||ue||!R)return;const ae=document.createElement("video");ae.className="video-js vjs-big-play-centered w-full h-full",ae.setAttribute("playsinline","true"),Je.current.appendChild(ae),mt.current=ae;const ke=Fe(ae,{autoplay:!0,muted:V,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 et.current=ke,ke.one("loadedmetadata",()=>{qe()}),ke.userActive(!0),ke.on("userinactive",()=>ke.userActive(!0)),()=>{try{et.current&&(et.current.dispose(),et.current=null)}finally{mt.current&&(mt.current.remove(),mt.current=null)}}},[Mt,V,ue,R,Ne,qe]),m.useEffect(()=>{const ae=et.current;if(!ae||ae.isDisposed?.())return;const ke=ae.el();ke&&ke.classList.toggle("is-live-download",!!F)},[F]);const ne=m.useCallback(()=>{const ae=et.current;if(!(!ae||ae.isDisposed?.())){try{ae.pause(),ae.reset?.()}catch{}try{ae.src({src:"",type:"video/mp4"}),ae.load?.()}catch{}}},[]),Re=m.useCallback(ae=>{const ke=et.current;if(!ke||ke.isDisposed?.())return;const pt=Math.max(0,Number(ae)||0);try{const xt=Number(ke.duration?.()??0),Rt=Number.isFinite(xt)&&xt>0?Math.max(0,xt-.05):pt;ke.currentTime(Math.min(pt,Rt)),ke.trigger?.("timeupdate")}catch{try{ke.currentTime(pt)}catch{}}},[]);m.useEffect(()=>{if(!Mt)return;if(!ue&&!R){ne();return}const ae=et.current;if(!ae||ae.isDisposed?.())return;const ke=ae.currentTime()||0;if(ae.muted(V),!We.src){try{ae.pause(),ae.reset?.(),ae.error(null)}catch{}return}ae.__timeOffsetSec=0;const pt=Number(re||0)||0;ae.__fullDurationSec=pt;const xt=String(ae.currentSrc?.()||"");if(Qe.current="",xt&&xt===We.src){const Et=ae.play?.();Et&&typeof Et.catch=="function"&&Et.catch(()=>{});return}ae.src({src:We.src,type:We.type});const Rt=()=>{const Et=ae.play?.();Et&&typeof Et.catch=="function"&&Et.catch(()=>{})};ae.one("loadedmetadata",()=>{if(ae.isDisposed?.())return;qe();try{const Z=Number(re||0)||0;Z>0&&(ae.__fullDurationSec=Z)}catch{}try{ae.playbackRate(1)}catch{}const Et=/mpegurl/i.test(We.type);if(ke>0&&!Et)try{const Z=Number(ae.__timeOffsetSec??0)||0,ce=Math.max(0,ke-Z);ae.__setRelativeTime?.(ce)}catch{}try{ae.trigger?.("timeupdate")}catch{}Rt()}),Rt()},[Mt,ue,R,We.src,We.type,V,qe,re,ne]),m.useEffect(()=>{if(!Mt||ue||!R||!We.src)return;const ae=et.current;if(!ae||ae.isDisposed?.())return;if(!(Pe>0)){Qe.current="";return}const ke=`${Ce}|${We.src}|${Pe.toFixed(3)}`;if(Qe.current===ke)return;let pt=!1;const xt=()=>{if(pt)return;const ce=et.current;if(!ce||ce.isDisposed?.())return;const ve=String(ce.currentSrc?.()||"");if(!ve||ve!==We.src)return;const Me=ce.tech?.(!0)?.el?.()||ce.el?.()?.querySelector?.("video.vjs-tech");if(!((Me instanceof HTMLVideoElement?Number(Me.readyState||0):0)<1)){Re(Pe),Qe.current=ke;try{const U=ce.play?.();U&&typeof U.catch=="function"&&U.catch(()=>{})}catch{}}};if(xt(),Qe.current===ke)return;const Rt=()=>xt();ae.one?.("loadedmetadata",Rt),ae.one?.("canplay",Rt),ae.one?.("durationchange",Rt);const Et=window.setTimeout(xt,0),Z=window.setTimeout(xt,120);return()=>{pt=!0,window.clearTimeout(Et),window.clearTimeout(Z);try{ae.off?.("loadedmetadata",Rt)}catch{}try{ae.off?.("canplay",Rt)}catch{}try{ae.off?.("durationchange",Rt)}catch{}}},[Mt,ue,R,We.src,Ce,Pe,Re]),m.useEffect(()=>{if(!Mt)return;const ae=et.current;if(!ae||ae.isDisposed?.())return;const ke=()=>{n.status==="running"&&$(!1)};return ae.on("error",ke),()=>{try{ae.off("error",ke)}catch{}}},[Mt,n.status]),m.useEffect(()=>{const ae=et.current;!ae||ae.isDisposed?.()||queueMicrotask(()=>ae.trigger("resize"))},[e]),m.useEffect(()=>{const ae=ke=>{const xt=(ke.detail?.file??"").trim();if(!xt)return;const Rt=xs(n.output?.trim()||"");Rt&&Rt===xt&&ne()};return window.addEventListener("player:release",ae),()=>window.removeEventListener("player:release",ae)},[n.output,ne]),m.useEffect(()=>{const ae=ke=>{const xt=(ke.detail?.file??"").trim();if(!xt)return;const Rt=xs(n.output?.trim()||"");Rt&&Rt===xt&&(ne(),t())};return window.addEventListener("player:close",ae),()=>window.removeEventListener("player:close",ae)},[n.output,ne,t]);const Ge=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const ae=window.visualViewport;if(ae&&Number.isFinite(ae.width)&&Number.isFinite(ae.height)){const Rt=Math.floor(ae.width),Et=Math.floor(ae.height),Z=Math.floor(ae.offsetLeft||0),ce=Math.floor(ae.offsetTop||0),ve=Math.max(0,Math.floor(window.innerHeight-(ae.height+ae.offsetTop)));return{w:Rt,h:Et,ox:Z,oy:ce,bottomInset:ve}}const ke=document.documentElement,pt=ke?.clientWidth||window.innerWidth,xt=ke?.clientHeight||window.innerHeight;return{w:pt,h:xt,ox:0,oy:0,bottomInset:0}},yt=m.useRef(null);m.useEffect(()=>{if(typeof window>"u")return;const{w:ae,h:ke}=Ge();yt.current={w:ae,h:ke}},[]);const tn=m.useCallback(()=>{const ae=n,ke=tf(et.current?.videoWidth?.(),ae.videoWidth,ae.width,ae.meta?.width)??0,pt=tf(Ie,et.current?.videoHeight?.(),ae.videoHeight,ae.height,ae.meta?.height)??0;return ke>0&&pt>0?ke/pt:16/9},[n,Ie]),un=m.useCallback(ae=>{if(typeof window>"u")return ae;const ke=tn(),pt=ue?0:30,{w:xt,h:Rt}=Ge(),Et=xt-tt*2,Z=Math.max(1,Rt-tt*2-pt),ce=Math.max(1,P-pt);let ve=Math.max(D,Math.min(ae.w,Et)),Me=ve/ke;Me<ce&&(Me=ce,ve=Me*ke),Me>Z&&(Me=Z,ve=Me*ke),ve>Et&&(ve=Et,Me=ve/ke);const I=Math.round(Me+pt),U=Math.max(tt,Math.min(ae.x,xt-ve-tt)),te=Math.max(tt,Math.min(ae.y,Rt-I-tt));return{x:U,y:te,w:Math.round(ve),h:I}},[tn,ue]),vn=m.useCallback(()=>{if(typeof window>"u")return{x:tt,y:tt,w:St,h:Tn};try{const Z=window.localStorage.getItem(Pn);if(Z){const ce=JSON.parse(Z);if(typeof ce.x=="number"&&typeof ce.y=="number"&&typeof ce.w=="number"&&typeof ce.h=="number")return un({x:ce.x,y:ce.y,w:ce.w,h:ce.h})}}catch{}const{w:ae,h:ke}=Ge(),pt=St,xt=Tn,Rt=Math.max(tt,ae-pt-tt),Et=Math.max(tt,ke-xt-tt);return un({x:Rt,y:Et,w:pt,h:xt})},[un]),[cn,Cn]=m.useState(()=>vn()),xn=en&&cn.w<380,on=m.useCallback(ae=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Pn,JSON.stringify(ae))}catch{}},[]),Rn=m.useRef(cn);m.useEffect(()=>{Rn.current=cn},[cn]),m.useEffect(()=>{en&&Cn(vn())},[en,vn]),m.useEffect(()=>{if(!en)return;const ae=()=>{const ke=yt.current,{w:pt,h:xt}=Ge();Cn(Rt=>{if(!ke)return un(Rt);const Et=24,Z=Rt.x-tt,ce=ke.w-tt-(Rt.x+Rt.w),ve=ke.h-tt-(Rt.y+Rt.h),Me=Math.abs(Z)<=Et,I=Math.abs(ce)<=Et,U=Math.abs(ve)<=Et;let te=un(Rt);return U&&(te={...te,y:Math.max(tt,xt-te.h-tt)}),I?te={...te,x:Math.max(tt,pt-te.w-tt)}:Me&&(te={...te,x:tt}),un(te)}),yt.current={w:pt,h:xt}};return yt.current=(()=>{const{w:ke,h:pt}=Ge();return{w:ke,h:pt}})(),window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[en,un]);const qt=m.useRef(null);m.useEffect(()=>{const ae=et.current;if(!(!ae||ae.isDisposed?.()))return qt.current!=null&&cancelAnimationFrame(qt.current),qt.current=requestAnimationFrame(()=>{qt.current=null;try{ae.trigger("resize")}catch{}}),()=>{qt.current!=null&&(cancelAnimationFrame(qt.current),qt.current=null)}},[en,cn.w,cn.h]);const[Bt,Zt]=m.useState(!1),[zt,Pt]=m.useState(!1),[Nn,Ft]=m.useState(null),[Qn,Xn]=m.useState(null),Gn=m.useRef(null),ln=m.useRef(null),Zn=m.useRef(null),ti=m.useRef(null),jn=m.useCallback(ae=>{const{w:ke,h:pt}=Ge(),xt=tt,Rt=ke-ae.w-tt,Et=pt-ae.h-tt,ce=ae.x+ae.w/2<ke/2;return{...ae,x:ce?xt:Rt,y:Et}},[]),Kn=m.useCallback(ae=>{const ke=ti.current;if(!ke)return;const pt=ae.clientX-ke.sx,xt=ae.clientY-ke.sy,Rt=ke.start,Et=un({x:Rt.x+pt,y:Rt.y+xt,w:Rt.w,h:Rt.h});Zn.current={x:Et.x,y:Et.y},Ft(jn(Et)),ln.current==null&&(ln.current=requestAnimationFrame(()=>{ln.current=null;const Z=Zn.current;Z&&Cn(ce=>({...ce,x:Z.x,y:Z.y}))}))},[un,jn]),rn=m.useCallback(()=>{ti.current&&(Pt(!1),Ft(null),ln.current!=null&&(cancelAnimationFrame(ln.current),ln.current=null),ti.current=null,window.removeEventListener("pointermove",Kn),window.removeEventListener("pointerup",rn),Cn(ae=>{const ke=jn(un(ae));return queueMicrotask(()=>on(ke)),ke}))},[Kn,jn,un,on]),Di=m.useCallback(ae=>{if(!en||Bt||ae.button!==0)return;ae.preventDefault(),ae.stopPropagation();const ke=Rn.current;ti.current={sx:ae.clientX,sy:ae.clientY,start:ke},Pt(!0);const pt=Le();Xn(pt),Ft(jn(ke)),window.addEventListener("pointermove",Kn),window.addEventListener("pointerup",rn)},[en,Bt,Kn,rn,jn,Le]),oi=m.useRef(null),ni=m.useRef(null),di=m.useRef(null),Ci=m.useCallback(ae=>{const ke=di.current;if(!ke)return;const pt=ae.clientX-ke.sx,xt=ae.clientY-ke.sy,Rt=ke.ratio,Et=ke.dir.includes("w"),Z=ke.dir.includes("e"),ce=ke.dir.includes("n"),ve=ke.dir.includes("s");let Me=ke.start.w,I=ke.start.h,U=ke.start.x,te=ke.start.y;const{w:ye,h:ge}=Ge(),at=24,lt=ke.start.x+ke.start.w,ut=ke.start.y+ke.start.h,Dt=Math.abs(ye-tt-lt)<=at,Yt=Math.abs(ge-tt-ut)<=at,Lt=Jt=>{Jt=Math.max(D,Jt);let Qt=Jt/Rt;return Qt<P&&(Qt=P,Jt=Qt*Rt),{newW:Jt,newH:Qt}},ft=Jt=>{Jt=Math.max(P,Jt);let Qt=Jt*Rt;return Qt<D&&(Qt=D,Jt=Qt/Rt),{newW:Qt,newH:Jt}};if((Z||Et)&&(ce||ve)){if(Math.abs(pt)>=Math.abs(xt)){const Qt=Z?ke.start.w+pt:ke.start.w-pt,{newW:wn,newH:fi}=Lt(Qt);Me=wn,I=fi}else{const Qt=ve?ke.start.h+xt:ke.start.h-xt,{newW:wn,newH:fi}=ft(Qt);Me=wn,I=fi}Et&&(U=ke.start.x+(ke.start.w-Me)),ce&&(te=ke.start.y+(ke.start.h-I))}else if(Z||Et){const Jt=Z?ke.start.w+pt:ke.start.w-pt,{newW:Qt,newH:wn}=Lt(Jt);Me=Qt,I=wn,Et&&(U=ke.start.x+(ke.start.w-Me)),te=Yt?ke.start.y+(ke.start.h-I):ke.start.y}else if(ce||ve){const Jt=ve?ke.start.h+xt:ke.start.h-xt,{newW:Qt,newH:wn}=ft(Jt);Me=Qt,I=wn,ce&&(te=ke.start.y+(ke.start.h-I)),Dt?U=ke.start.x+(ke.start.w-Me):U=ke.start.x}const Ut=un({x:U,y:te,w:Me,h:I});ni.current=Ut,oi.current==null&&(oi.current=requestAnimationFrame(()=>{oi.current=null;const Jt=ni.current;Jt&&Cn(Jt)}))},[un]),Fn=m.useCallback(()=>{di.current&&(Zt(!1),Ft(null),Xn(null),oi.current!=null&&(cancelAnimationFrame(oi.current),oi.current=null),di.current=null,window.removeEventListener("pointermove",Ci),window.removeEventListener("pointerup",Fn),on(Rn.current))},[Ci,on]),On=m.useCallback(ae=>ke=>{if(!en||ke.button!==0)return;ke.preventDefault(),ke.stopPropagation();const pt=Rn.current;di.current={dir:ae,sx:ke.clientX,sy:ke.clientY,start:pt,ratio:pt.w/pt.h},Zt(!0),window.addEventListener("pointermove",Ci),window.addEventListener("pointerup",Fn)},[en,Ci,Fn]),[$n,_e]=m.useState(!1),[nt,ht]=m.useState(!1);m.useEffect(()=>{const ae=window.matchMedia?.("(hover: hover) and (pointer: fine)"),ke=()=>_e(!!ae?.matches);return ke(),ae?.addEventListener?.("change",ke),()=>ae?.removeEventListener?.("change",ke)},[]);const Ht=en&&(nt||zt||Bt),[De,vt]=m.useState(!1);if(m.useEffect(()=>{n.status!=="running"&&vt(!1)},[n.id,n.status]),!Mt||Sn&&!mn)return null;const wt="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",Gt=String(n.phase??"").toLowerCase(),Kt=Gt==="stopping"||Gt==="remuxing"||Gt==="moving",sn=!B||!ue||Kt||De,Mn=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:ue?c.jsxs(c.Fragment,{children:[c.jsx(hn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:sn,title:Kt||De?"Stoppe…":"Stop","aria-label":Kt||De?"Stoppe…":"Stop",onClick:async ae=>{if(ae.preventDefault(),ae.stopPropagation(),!sn)try{vt(!0),await B?.(n.id)}finally{vt(!1)}},className:Aa("shadow-none shrink-0",en&&xn&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:Kt||De?"Stoppe…":en&&xn?"Stop":"Stoppen"})}),c.jsx(Bs,{job:n,variant:"overlay",collapseToMenu:!0,busy:Kt||De,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:k?ae=>k(ae):void 0,onToggleFavorite:C?ae=>C(ae):void 0,onToggleLike:j?ae=>j(ae):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):c.jsx(Bs,{job:n,variant:"overlay",collapseToMenu:!0,isHot:u||de,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:k?ae=>k(ae):void 0,onToggleFavorite:C?ae=>C(ae):void 0,onToggleLike:j?ae=>j(ae):void 0,onToggleHot:A?async ae=>{ne(),await new Promise(pt=>setTimeout(pt,150)),await A(ae),await new Promise(pt=>setTimeout(pt,0));const ke=et.current;if(ke&&!ke.isDisposed?.()){const pt=ke.play?.();pt&&typeof pt.catch=="function"&&pt.catch(()=>{})}}:void 0,onKeep:w?async ae=>{ne(),t(),await new Promise(ke=>setTimeout(ke,150)),await w(ae)}:void 0,onDelete:S?async ae=>{ne(),t(),await new Promise(ke=>setTimeout(ke,150)),await S(ae)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),Yn=e||en,nr=ue?"calc(4px + env(safe-area-inset-bottom))":`calc(${Xt+2}px + env(safe-area-inset-bottom))`,Wn="top-2",Wi=e&&Ot,Hi=c.jsx("div",{className:Aa("relative overflow-visible flex-1 min-h-0"),onMouseEnter:()=>{!en||!$n||ht(!0)},onMouseLeave:()=>{!en||!$n||ht(!1)},children:c.jsxs("div",{className:Aa("relative w-full h-full",en&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Xt}px`},children:[ue?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(ab,{src:_t,muted:V,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:Je,className:"absolute inset-0"}),c.jsxs("div",{className:Aa("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:Aa("absolute inset-x-2",Wn),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:Wi?null:Mn}),en?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:Di,onClick:ae=>{ae.preventDefault(),ae.stopPropagation()},className:Aa(wt,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",Ht?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",zt&&"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:wt,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(LA,{className:"h-5 w-5"}):c.jsx(BA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:wt,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(Tf,{className:"h-5 w-5"})})]})]})})]}),c.jsxs("div",{className:Aa("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:nr},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:pe||H}),u||de?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:[Ct!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:Ct}):null,ue?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:we}),G!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:G}):null]})]})]})}),bi=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:dt,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:pe||H})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[ue?c.jsx(hn,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:sn,title:Kt||De?"Stoppe…":"Stop","aria-label":Kt||De?"Stoppe…":"Stop",onClick:async ae=>{if(ae.preventDefault(),ae.stopPropagation(),!sn)try{vt(!0),await B?.(n.id)}finally{vt(!1)}},className:"shadow-none",children:Kt||De?"Stoppe…":"Stoppen"}):null,c.jsx(Bs,{job:n,variant:"table",collapseToMenu:!1,busy:Kt||De,isHot:u||de,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:k?ae=>k(ae):void 0,onToggleFavorite:C?ae=>C(ae):void 0,onToggleLike:j?ae=>j(ae):void 0,onToggleHot:A?async ae=>{ne(),await new Promise(pt=>setTimeout(pt,150)),await A(ae),await new Promise(pt=>setTimeout(pt,0));const ke=et.current;if(ke&&!ke.isDisposed?.()){const pt=ke.play?.();pt&&typeof pt.catch=="function"&&pt.catch(()=>{})}}:void 0,onKeep:w?async ae=>{ne(),t(),await new Promise(ke=>setTimeout(ke,150)),await w(ae)}:void 0,onDelete:S?async ae=>{ne(),t(),await new Promise(ke=>setTimeout(ke,150)),await S(ae)}:void 0,order:ue?["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:Ct}),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:we}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:G}),c.jsx("div",{className:"text-white/60",children:"Datum"}),c.jsx("div",{className:"font-medium",children:Be}),c.jsx("div",{className:"col-span-2",children:Oe.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:Oe.map(ae=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:ae},ae))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),Si=en&&zt&&Nn?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:Nn.x-cn.x,top:Nn.y-cn.y,width:Nn.w,height:Nn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:Qn||dt,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:[pe||H,u||de?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:[Ct!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:Ct}):null,!ue&&we!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:we}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,Xi=c.jsx(Is,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:Aa("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",Yn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":en?"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:[Wi?bi:null,Hi]})}),{w:ii,h:Mi,ox:Ti,oy:Bi,bottomInset:ir}=Ge(),hi={left:Ti+16,top:Bi+16,width:Math.max(0,ii-32),height:Math.max(0,Mi-32)},Yi=e?hi:en?{left:cn.x,top:cn.y,width:cn.w,height:cn.h}:void 0,Pi=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 (<video class="vjs-tech">) */
|
||
.vjs-mini .video-js .vjs-tech {
|
||
top: 0 !important;
|
||
left: 0 !important;
|
||
right: 0 !important;
|
||
bottom: 0 !important;
|
||
|
||
width: 100% !important;
|
||
height: 100% !important;
|
||
|
||
/* Seitenverhältnis beibehalten + unten an die Controlbar "anlehnen" */
|
||
object-fit: contain !important;
|
||
object-position: center top !important;
|
||
}
|
||
|
||
/* Poster genauso behandeln (falls sichtbar) */
|
||
.vjs-mini .video-js .vjs-poster {
|
||
top: 0 !important;
|
||
left: 0 !important;
|
||
right: 0 !important;
|
||
bottom: 0 !important;
|
||
|
||
width: 100% !important;
|
||
height: 100% !important;
|
||
|
||
background-position: center bottom !important;
|
||
background-size: contain !important;
|
||
background-repeat: no-repeat !important;
|
||
}
|
||
|
||
/* Untertitel-/Texttrack-Layer darf ebenfalls nicht in die Controlbar laufen */
|
||
.vjs-mini .video-js .vjs-text-track-display {
|
||
top: 0 !important;
|
||
left: 0 !important;
|
||
right: 0 !important;
|
||
bottom: var(--vjs-controlbar-h, 30px) !important;
|
||
inset: 0 0 var(--vjs-controlbar-h, 30px) 0 !important;
|
||
}
|
||
|
||
/* Sicherheitsnetz: Controlbar immer wirklich unten */
|
||
.vjs-mini .video-js .vjs-control-bar {
|
||
bottom: 0 !important;
|
||
}
|
||
|
||
.player-snap-ghost {
|
||
backdrop-filter: blur(2px);
|
||
-webkit-backdrop-filter: blur(2px);
|
||
}
|
||
|
||
.player-snap-ghost::after {
|
||
content: '';
|
||
position: absolute;
|
||
inset: 0;
|
||
border-radius: inherit;
|
||
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
|
||
pointer-events: none;
|
||
}
|
||
`}),e||en?c.jsxs("div",{className:Aa("fixed z-[2147483647]",!Bt&&!zt&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...Yi,willChange:Bt?"left, top, width, height":void 0},children:[Si,Xi,en?c.jsxs("div",{className:"pointer-events-none absolute inset-0",children:[c.jsx("div",{className:"pointer-events-auto absolute -left-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:On("w")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:On("e")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:On("n")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:On("s")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:On("nw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:On("ne")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:On("sw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:On("se")})]}):null]}):c.jsx("div",{className:`\r
|
||
fixed z-[2147483647] inset-x-0 w-full\r
|
||
shadow-2xl\r
|
||
md:bottom-4 md:left-1/2 md:right-auto md:inset-x-auto md:w-[min(760px,calc(100vw-32px))] md:-translate-x-1/2\r
|
||
`,style:{bottom:`calc(${ir}px + env(safe-area-inset-bottom))`},children:Xi})]});return Sn?vu.createPortal(Pi,mn):Pi}function Tk({jobId:n,thumbTick:e,autoTickMs:t=1e4,blur:i=!1,className:a,roomStatus:l,alignStartAt:u,alignEndAt:h=null,alignEveryMs:f,fastRetryMs:g,fastRetryMax:w,fastRetryWindowMs:S,thumbsWebpUrl:A,thumbsCandidates:C}){const j=i?"blur-md":"",k=0,B=m.useRef(null),V=m.useRef(!0),[W,H]=m.useState(!1),ie=m.useRef(!1),[Y,G]=m.useState(0),[O,re]=m.useState(!1),[E,R]=m.useState(!1),ee=m.useRef(null),q=m.useRef(0),Q=m.useRef(!1),ue=m.useRef(!1),[se,$]=m.useState(!0),F=xe=>{if(typeof xe=="number"&&Number.isFinite(xe))return xe;if(xe instanceof Date)return xe.getTime();const Ne=Date.parse(String(xe??""));return Number.isFinite(Ne)?Ne:NaN},X=xe=>{const Ne=String(xe??"").trim();return Ne?/^https?:\/\//i.test(Ne)||Ne.startsWith("/")?Ne:`/${Ne}`:""},le=m.useMemo(()=>{const xe=[A,...Array.isArray(C)?C:[]].map(X).filter(Boolean);return Array.from(new Set(xe)).join("|")},[A,C]);m.useEffect(()=>{const xe=()=>{const Se=!document.hidden;V.current=Se,$(Se)},Ne=!document.hidden;return V.current=Ne,$(Ne),document.addEventListener("visibilitychange",xe),()=>document.removeEventListener("visibilitychange",xe)},[]),m.useEffect(()=>()=>{ee.current&&window.clearTimeout(ee.current)},[]),m.useEffect(()=>{const xe=B.current;if(!xe)return;const Ne=new IntersectionObserver(Se=>{const Ie=Se[0],$e=!!(Ie&&(Ie.isIntersecting||Ie.intersectionRatio>0));$e!==ie.current&&(ie.current=$e,H($e))},{root:null,threshold:0,rootMargin:"300px 0px"});return Ne.observe(xe),()=>Ne.disconnect()},[]),m.useEffect(()=>{typeof e!="number"&&W&&V.current&&(ue.current||(ue.current=!0,G(xe=>xe+1)))},[W,e]),m.useEffect(()=>{if(typeof e=="number"||!W||!V.current)return;const xe=Number(f??t??1e4);if(!Number.isFinite(xe)||xe<=0)return;const Ne=u?F(u):NaN,Se=h?F(h):NaN;if(Number.isFinite(Ne)){let $e;const Ct=()=>{if(!V.current)return;const st=Date.now();if(Number.isFinite(Se)&&st>=Se)return;const He=Math.max(0,st-Ne)%xe,We=He===0?xe:xe-He;$e=window.setTimeout(()=>{ie.current&&V.current&&(G(Je=>Je+1),Ct())},We)};return Ct(),()=>{$e&&window.clearTimeout($e)}}const Ie=window.setInterval(()=>{ie.current&&V.current&&G($e=>$e+1)},xe);return()=>window.clearInterval(Ie)},[e,t,W,se,u,h,f]);const de=typeof e=="number"?e:Y,L=m.useRef(0),[pe,we]=m.useState(0);m.useEffect(()=>{W&&V.current&&(L.current=de,we(de))},[de,W]),m.useEffect(()=>{re(!1),R(!1)},[pe]),m.useEffect(()=>{Q.current=!1,q.current=0,ue.current=!1,re(!1),R(!1),ie.current&&V.current&&G(xe=>xe+1)},[n,le]);const Be=m.useMemo(()=>`/api/preview?id=${encodeURIComponent(n)}&v=${pe}`,[n,pe]),Ve=m.useMemo(()=>`/api/preview/live?id=${encodeURIComponent(n)}&hover=1`,[n]),Te=m.useMemo(()=>le?le.split("|"):[],[le])[0]||"",_t=!!Te&&!O,dt=m.useMemo(()=>{if(_t){const xe=Te.includes("?")?"&":"?";return`${Te}${xe}v=${encodeURIComponent(String(pe))}`}return Be},[_t,Te,pe,Be]);return c.jsx(Ow,{content:(xe,{close:Ne})=>xe&&c.jsx("div",{className:"w-[420px] max-w-[calc(100vw-1.5rem)]",children:c.jsx("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{paddingBottom:`calc(56.25% + ${k}px)`},children:c.jsxs("div",{className:"absolute inset-0",children:[c.jsx(ab,{src:Ve,muted:!0,roomStatus:l,className:"w-full h-full object-contain object-bottom relative z-0"}),c.jsxs("div",{className:"absolute left-2 top-2 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("button",{type:"button",className:"absolute right-2 top-2 z-20 inline-flex items-center justify-center rounded-md p-1.5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/70 bg-white/75 text-gray-900 ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/55","aria-label":"Live-Vorschau schließen",title:"Vorschau schließen",onClick:Se=>{Se.preventDefault(),Se.stopPropagation(),Ne()},children:c.jsx(Tf,{className:"h-4 w-4"})})]})})}),children:c.jsx("div",{ref:B,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",a||"w-full h-full"].join(" "),children:E?c.jsx("div",{className:"absolute inset-0 grid place-items-center px-1 text-center text-[10px] text-gray-500 dark:text-gray-400",children:"keine Vorschau"}):c.jsx("img",{src:dt,loading:W?"eager":"lazy",fetchPriority:W?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",j].filter(Boolean).join(" "),onLoad:()=>{Q.current=!0,q.current=0,ee.current&&window.clearTimeout(ee.current),_t?re(!1):R(!1)},onError:()=>{if(_t){re(!0);return}if(R(!0),!g||!ie.current||!V.current||Q.current)return;const xe=u?F(u):NaN,Ne=Number(S??6e4);if(!(!Number.isFinite(xe)||Date.now()-xe<Ne))return;const Ie=Number(w??25);q.current>=Ie||(ee.current&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{q.current+=1,R(!1),G($e=>$e+1)},g))}})})})}function bd({label:n,value:e=0,indeterminate:t=!1,showPercent:i=!1,rightLabel:a,steps:l,currentStep:u,size:h="md",className:f}){const g=Math.max(0,Math.min(100,Number(e)||0)),w=h==="sm"?"h-1.5":"h-2",S=Array.isArray(l)&&l.length>0,A=S?l.length:0,C=B=>B===0?"text-left":B===A-1?"text-right":"text-center",j=B=>typeof u!="number"||!Number.isFinite(u)?!1:B<=u,k=i&&!t;return c.jsxs("div",{className:f,children:[n||k?c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n?c.jsx("p",{className:"flex-1 min-w-0 truncate text-xs font-medium text-gray-900 dark:text-white",children:n}):c.jsx("span",{className:"flex-1"}),k?c.jsxs("span",{className:"shrink-0 text-xs font-medium text-gray-700 dark:text-gray-300",children:[Math.round(g),"%"]}):null]}):null,c.jsxs("div",{"aria-hidden":"true",className:n||k?"mt-2":"",children:[c.jsx("div",{className:"overflow-hidden rounded-full bg-gray-200 dark:bg-white/10",children:t?c.jsx("div",{className:`${w} w-full rounded-full bg-indigo-600/70 dark:bg-indigo-500/70 animate-pulse`}):c.jsx("div",{className:`${w} rounded-full bg-indigo-600 dark:bg-indigo-500 transition-[width] duration-200`,style:{width:`${g}%`}})}),a?c.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-400",children:a}):null,S?c.jsx("div",{className:"mt-3 hidden text-sm font-medium text-gray-600 sm:grid dark:text-gray-400",style:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`},children:l.map((B,V)=>c.jsx("div",{className:[C(V),j(V)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:B},`${V}-${B}`))}):null]})]})}function Q8(n,e=!1){const[t,i]=m.useState(e);return m.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const a=window.matchMedia(n),l=()=>{i(a.matches)};return l(),typeof a.addEventListener=="function"?(a.addEventListener("change",l),()=>a.removeEventListener("change",l)):(a.addListener(l),()=>a.removeListener(l))},[n]),t}const Wf=n=>{const e=n;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},kk=n=>{const e=n;return e.sourceUrl??e.url??e.roomUrl??""},Ek=n=>{const e=n;return String(e.imageUrl??e.image_url??"").trim()},Jl=n=>{const e=n;return String(e.key??e.id??Wf(n))},Xf=n=>{switch(String(n??"").trim().toLowerCase()){case"public":return"Public";case"private":return"Private";case"hidden":return"Hidden";case"away":return"Away";case"offline":return"Offline";default:return"Unknown"}},Z8=n=>{const e=n,t=String(e.sourceUrl??"").trim();if(t){const i=t.match(/chaturbate\.com\/([^/?#]+)/i);if(i?.[1])try{return decodeURIComponent(i[1]).trim().toLowerCase()}catch{return String(i[1]).trim().toLowerCase()}}return String(Yf(e.output||"")).trim().toLowerCase()},hy=(n,e)=>{const t=n,i=t.currentShow??t.roomStatus??t.modelStatus??t.show??t.statusText??t.model?.currentShow??t.model?.roomStatus??t.model?.status??t.room?.currentShow??t.room?.status;if(i!=null&&String(i).trim()!=="")return Xf(i);const a=Z8(n);return a&&e?.[a]?Xf(e[a]):"Unknown"},Ck=n=>{switch(n){case"Public":return"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25";case"Private":return"bg-fuchsia-500/15 text-fuchsia-900 ring-fuchsia-500/30 dark:bg-fuchsia-400/10 dark:text-fuchsia-200 dark:ring-fuchsia-400/25";case"Hidden":return"bg-slate-500/15 text-slate-900 ring-slate-500/30 dark:bg-slate-400/10 dark:text-slate-200 dark:ring-slate-400/25";case"Away":return"bg-amber-500/15 text-amber-900 ring-amber-500/30 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25";case"Offline":return"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10";default:return"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"}},Gi=n=>{if(typeof n=="number"&&Number.isFinite(n))return n<1e12?n*1e3:n;if(typeof n=="string"){const e=Date.parse(n);return Number.isFinite(e)?e:0}return n instanceof Date?n.getTime():0},J8=n=>{const e=String(n??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},Ak=n=>{const e=n,t=[e.thumbsWebpUrl,e.thumbsUrl,e.previewThumbsUrl,e.thumbnailSheetUrl],i=[e.previewBaseUrl?`${String(e.previewBaseUrl).replace(/\/+$/,"")}/preview.webp`:"",e.assetBaseUrl?`${String(e.assetBaseUrl).replace(/\/+$/,"")}/preview.webp`:"",e.thumbsBaseUrl?`${String(e.thumbsBaseUrl).replace(/\/+$/,"")}/preview.webp`:""];return[...t,...i].map(a=>J8(String(a??""))).filter(Boolean)},eu=n=>{if(n.kind==="job"){const t=n.job;return Gi(t.addedAt)||Gi(t.createdAt)||Gi(t.enqueuedAt)||Gi(t.queuedAt)||Gi(t.requestedAt)||Gi(t.startedAt)||0}const e=n.pending;return Gi(e.addedAt)||Gi(e.createdAt)||Gi(e.enqueuedAt)||Gi(e.queuedAt)||Gi(e.requestedAt)||0},Nk=n=>{switch((n??"").toLowerCase()){case"stopping":return"Stop wird angefordert…";case"probe":return"Analysiere Datei (Dauer/Streams)…";case"remuxing":return"Konvertiere Container zu MP4…";case"moving":return"Verschiebe nach Done…";case"assets":return"Erstelle Vorschau/Thumbnails…";case"postwork":return"Nacharbeiten laufen…";default:return""}};function Dk(n,e){const t=n.postWork;if(!t)return"Warte auf Nacharbeiten…";if(t.state==="running"){const i=typeof t.running=="number"?t.running:0,a=typeof t.maxParallel=="number"?t.maxParallel:0;return a>0?`Nacharbeiten laufen… (${i}/${a} parallel)`:"Nacharbeiten laufen…"}if(t.state==="queued"){const i=typeof t.position=="number"?t.position:0,a=typeof t.waiting=="number"?t.waiting:0,l=typeof t.running=="number"?t.running:0,u=Math.max(a+l,i),h=typeof e?.pos=="number"&&Number.isFinite(e.pos)&&e.pos>0?e.pos:i,f=typeof e?.total=="number"&&Number.isFinite(e.total)&&e.total>0?e.total:u;return h>0&&f>0?`Warte auf Nacharbeiten… ${h} / ${f}`:"Warte auf Nacharbeiten…"}return"Warte auf Nacharbeiten…"}function e6({job:n,postworkInfo:e}){const t=String(n?.phase??"").trim(),i=Number(n?.progress??0),a=t.toLowerCase(),l=a==="recording";let u=t?Nk(t)||t:"";a==="postwork"&&(u=Dk(n,e)),l&&(u="Recording läuft…");const h=u||String(n?.status??"").trim().toLowerCase(),f=!l&&Number.isFinite(i)&&i>0&&i<100,g=!l&&!f&&!!t&&(!Number.isFinite(i)||i<=0||i>=100);return c.jsx("div",{className:"min-w-0",children:f?c.jsx(bd,{label:h,value:Math.max(0,Math.min(100,i)),showPercent:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):g?c.jsx(bd,{label:h,indeterminate:!0,size:"sm",className:"w-full min-w-0 sm:min-w-[220px]"}):c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:h})})})}function xg({r:n,nowMs:e,blurPreviews:t,modelsByKey:i,roomStatusByModelKey:a,stopRequestedIds:l,postworkInfoOf:u,markStopRequested:h,onOpenPlayer:f,onStopJob:g,onToggleFavorite:w,onToggleLike:S,onToggleWatch:A}){if(n.kind==="pending"){const X=n.pending,le=Wf(X),de=kk(X),L=Xf(X.currentShow);return c.jsxs("div",{className:`\r
|
||
relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm\r
|
||
backdrop-blur-xl supports-[backdrop-filter]:bg-white/25\r
|
||
ring-1 ring-black/5\r
|
||
transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0\r
|
||
dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25\r
|
||
`,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),c.jsxs("div",{className:"relative p-3",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",title:le,children:le}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-gray-600 dark:text-gray-300",children:[c.jsx("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-900/5 px-2 py-0.5 font-medium dark:bg-white/10",children:"Wartend"}),c.jsx("span",{className:"inline-flex items-center rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium uppercase tracking-wide text-gray-700 dark:bg-white/10 dark:text-gray-200",children:L})]})]}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-900/5 px-2.5 py-1 text-xs font-medium text-gray-800 dark:bg-white/10 dark:text-gray-200",children:"⏳"})]}),c.jsx("div",{className:"mt-3",children:(()=>{const pe=Ek(X);return c.jsx("div",{className:"relative aspect-[16/9] w-full overflow-hidden rounded-xl bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:pe?c.jsx("img",{src:pe,alt:le,className:["h-full w-full object-cover",t?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:we=>{we.currentTarget.style.display="none"}}):c.jsx("div",{className:"grid h-full w-full place-items-center",children:c.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-300",children:"Waiting…"})})})})()}),de?c.jsx("a",{href:de,target:"_blank",rel:"noreferrer",className:"mt-3 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:pe=>pe.stopPropagation(),title:de,children:de}):null]})]})}const C=n.job,j=Yf(C.output),k=lb(C.output||""),B=String(C.phase??"").trim(),V=B.toLowerCase(),W=V==="recording",H=!!l[C.id],ie=String(C.status??"").toLowerCase(),G=V!==""&&V!=="recording"||ie!=="running"||H,O=hy(C,a);let re=B?Nk(B)||B:"";V==="recording"?re="Recording läuft…":V==="postwork"&&(re=Dk(C,u(C)));const E=re||O,R=Number(C.progress??0),ee=!W&&Number.isFinite(R)&&R>0&&R<100,q=!W&&!ee&&!!B&&(!Number.isFinite(R)||R<=0||R>=100),Q=j&&j!=="—"?j.toLowerCase():"",ue=Q?i[Q]:void 0,se=!!ue?.favorite,$=ue?.liked===!0,F=!!ue?.watching;return c.jsxs("div",{className:`\r
|
||
group relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm\r
|
||
backdrop-blur-xl supports-[backdrop-filter]:bg-white/25\r
|
||
ring-1 ring-black/5\r
|
||
transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0\r
|
||
dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25\r
|
||
`,onClick:()=>f(C),role:"button",tabIndex:0,onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&f(C)},children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),c.jsx("div",{className:"pointer-events-none absolute -inset-10 opacity-0 blur-2xl transition-opacity duration-300 group-hover:opacity-100 bg-white/40 dark:bg-white/10"}),c.jsxs("div",{className:"relative p-3",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:`\r
|
||
relative\r
|
||
shrink-0 overflow-hidden rounded-lg\r
|
||
w-[112px] h-[64px]\r
|
||
bg-gray-100 ring-1 ring-black/5\r
|
||
dark:bg-white/10 dark:ring-white/10\r
|
||
`,children:c.jsx(Tk,{jobId:C.id,blur:t,roomStatus:O,alignStartAt:C.startedAt,alignEndAt:C.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ak(C),className:"w-full h-full"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"truncate text-base font-semibold text-gray-900 dark:text-white",title:j,children:j}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",Ck(O)].join(" "),title:O,children:O})]}),c.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-600 dark:text-gray-300",title:C.output,children:k||"—"})]}),c.jsxs("div",{className:"shrink-0 flex flex-col items-end gap-1",children:[c.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Mk(C,e)}),c.jsx("span",{className:"rounded-full bg-gray-900/5 px-2 py-0.5 text-[11px] font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:jk(Rk(C))})]})]}),C.sourceUrl?c.jsx("a",{href:C.sourceUrl,target:"_blank",rel:"noreferrer",className:"mt-1 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:X=>X.stopPropagation(),title:C.sourceUrl,children:C.sourceUrl}):null]})]}),ee||q?c.jsx("div",{className:"mt-3",children:ee?c.jsx(bd,{label:E,value:Math.max(0,Math.min(100,R)),showPercent:!0,size:"sm",className:"w-full"}):c.jsx(bd,{label:E,indeterminate:!0,size:"sm",className:"w-full"})}):null,c.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/30 pt-3 dark:border-white/10",children:[c.jsx("div",{className:"flex items-center gap-1",onClick:X=>X.stopPropagation(),onMouseDown:X=>X.stopPropagation(),children:c.jsx(Bs,{job:C,variant:"table",busy:G,isFavorite:se,isLiked:$,isWatching:F,onToggleFavorite:w,onToggleLike:S,onToggleWatch:A,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),c.jsx(hn,{size:"sm",variant:"primary",disabled:G,className:"shrink-0",onClick:X=>{X.stopPropagation(),!G&&(h(C.id),g(C.id))},children:G?"Stoppe…":"Stop"})]})]})]})}const lb=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",Yf=n=>{const e=lb(n||"");if(!e)return"—";const t=e.replace(/\.[^.]+$/,""),i=t.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(i?.[1])return i[1];const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t},t6=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`},Mk=(n,e)=>{const t=n,i=Gi(t.startedAtMs)||Gi(n.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const a=n.endedAt?Gi(t.endedAtMs)||Gi(n.endedAt):e;return!Number.isFinite(a)||a<=0?"—":t6(a-i)},Rk=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},jk=n=>{if(!n||!Number.isFinite(n)||n<=0)return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0?0:t>=10?1:2;return`${t.toFixed(a).replace(/\.0+$/,"")} ${e[i]}`},_g=n=>{const e=n,t=String(e.phase??"").trim(),i=e.postWork;return!!(String(e.postWorkKey??"").trim()||i&&(i.state==="queued"||i.state==="running")||n.endedAt&&t||t==="postwork")},N_=n=>{const e=String(n??"").trim().toLowerCase();return e==="stopped"||e==="finished"||e==="failed"||e==="done"||e==="completed"||e==="canceled"||e==="cancelled"};function D_(){return c.jsx("span",{className:`\r
|
||
inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold\r
|
||
bg-red-100 text-red-800 ring-1 ring-red-200\r
|
||
dark:bg-red-500/15 dark:text-red-200 dark:ring-red-400/25\r
|
||
`,title:"Speicherplatz-Notbremse aktiv: Autostart gesperrt und Downloads wurden gestoppt",children:"Speicherplatz-Notbremse aktiv"})}function n6({jobs:n,pending:e=[],autostartState:t,onRefreshAutostartState:i,onOpenPlayer:a,onStopJob:l,onToggleFavorite:u,onToggleLike:h,onToggleWatch:f,onAddToDownloads:g,modelsByKey:w={},roomStatusByModelKey:S={},blurPreviews:A}){const C=Q8("(min-width: 640px)",!0),[j,k]=m.useState(!1),[B,V]=m.useState(!1),[,W]=m.useState(!1),[H,ie]=m.useState(!1),Y=m.useRef(null),G=m.useRef(null),O=m.useRef(null),[re,E]=m.useState(!1),R=m.useCallback(async()=>{try{await i?.()}catch{}},[i]);m.useEffect(()=>{const xe=!!t?.paused,Ne=!!t?.pausedByUser,Se=!!t?.pausedByDisk;Y.current===xe&&G.current===Ne&&O.current===Se||(Y.current=xe,G.current=Ne,O.current=Se,V(xe),W(Ne),ie(Se))},[t]);const ee=m.useCallback(async()=>{if(!(re||B)){E(!0);try{const xe=await fetch("/api/autostart/pause",{method:"POST"});if(!xe.ok)throw new Error(`HTTP ${xe.status}`);await R()}catch{}finally{E(!1)}}},[re,B,R]),q=m.useCallback(async()=>{if(!(re||!B||H)){E(!0);try{const xe=await fetch("/api/autostart/resume",{method:"POST"});if(!xe.ok)throw new Error(`HTTP ${xe.status}`);await R()}catch{}finally{E(!1)}}},[re,B,H,R]),[Q,ue]=m.useState({}),[se,$]=m.useState({}),F=m.useCallback(xe=>{const Ne=Array.isArray(xe)?xe:[xe];ue(Se=>{const Ie={...Se};for(const $e of Ne)$e&&(Ie[$e]=!0);return Ie}),$(Se=>{const Ie={...Se};for(const $e of Ne)$e&&(Ie[$e]=!0);return Ie})},[]);m.useEffect(()=>{ue(xe=>{const Ne=Object.keys(xe);if(Ne.length===0)return xe;const Se={};for(const Ie of Ne){const $e=n.find(He=>He.id===Ie);if(!$e)continue;const Ct=String($e.phase??"").trim().toLowerCase();Ct!==""&&Ct!=="recording"||$e.status!=="running"||(Se[Ie]=!0)}return Se})},[n]);const[X,le]=m.useState(()=>Date.now()),de=m.useMemo(()=>n.some(xe=>!xe.endedAt&&xe.status==="running"),[n]),L=m.useMemo(()=>{const xe=new Map,Ne=st=>{const gt=st,He=gt.postWork;return Gi(He?.enqueuedAt)||Gi(gt.enqueuedAt)||Gi(gt.queuedAt)||Gi(gt.createdAt)||Gi(gt.addedAt)||Gi(st.endedAt)||Gi(st.startedAt)||0},Se=[],Ie=[];for(const st of n){const gt=st?.postWork;if(!gt)continue;const He=String(gt.state??"").toLowerCase();He==="running"?Se.push(st):He==="queued"&&Ie.push(st)}Se.sort((st,gt)=>Ne(st)-Ne(gt)),Ie.sort((st,gt)=>Ne(st)-Ne(gt));const $e=Se.length,Ct=$e+Ie.length;for(let st=0;st<Ie.length;st++){const gt=String(Ie[st]?.id??"");gt&&xe.set(gt,{pos:$e+st+1,total:Ct})}return xe},[n]),pe=m.useCallback(xe=>{const Ne=String(xe?.id??"");return Ne?L.get(Ne):void 0},[L]);m.useEffect(()=>{if(!de)return;const xe=window.setInterval(()=>le(Date.now()),1e3);return()=>window.clearInterval(xe)},[de]);const we=m.useMemo(()=>n.filter(xe=>{if(_g(xe)||xe.endedAt)return!1;const Ne=String(xe.phase??"").trim(),Se=!!Q[xe.id],Ie=Ne.trim().toLowerCase();return!(Ie!==""&&Ie!=="recording"||xe.status!=="running"||Se)}).map(xe=>xe.id),[n,Q]),Be=m.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:xe=>{if(xe.kind==="job"){const $e=xe.job;return c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:c.jsx(Tk,{jobId:$e.id,blur:A,roomStatus:hy($e,S),alignStartAt:$e.startedAt,alignEndAt:$e.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ak($e),className:"w-full h-full"})})}const Ne=xe.pending,Se=Wf(Ne),Ie=Ek(Ne);return Ie?c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md bg-gray-100 ring-1 ring-black/5 dark:bg-white/10 dark:ring-white/10",children:c.jsx("img",{src:Ie,alt:Se,className:["h-full w-full object-cover",A?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:$e=>{$e.currentTarget.style.display="none"}})}):c.jsx("div",{className:"h-[60px] w-[96px] rounded-md bg-gray-100 dark:bg-white/10 grid place-items-center text-sm text-gray-500",children:"⏳"})}},{key:"model",header:"Modelname",widthClassName:"w-[170px]",cell:xe=>{if(xe.kind==="job"){const $e=xe.job,Ct=lb($e.output||""),st=Yf($e.output),gt=hy($e,S);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("span",{className:"min-w-0 block max-w-[170px] truncate font-medium",title:st,children:st}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",Ck(gt)].join(" "),title:gt,children:gt})]}),c.jsx("span",{className:"block max-w-[220px] truncate",title:$e.output,children:Ct}),$e.sourceUrl?c.jsx("a",{href:$e.sourceUrl,target:"_blank",rel:"noreferrer",title:$e.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:He=>He.stopPropagation(),children:$e.sourceUrl}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const Ne=xe.pending,Se=Wf(Ne),Ie=kk(Ne);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:Se,children:Se}),Ie?c.jsx("a",{href:Ie,target:"_blank",rel:"noreferrer",title:Ie,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:$e=>$e.stopPropagation(),children:Ie}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}},{key:"status",header:"Status",widthClassName:"w-[260px] min-w-[240px]",cell:xe=>{if(xe.kind==="job"){const Ie=xe.job;return c.jsx(e6,{job:Ie,postworkInfo:pe(Ie)})}const Ne=xe.pending,Se=Xf(Ne.currentShow);return c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:Se})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:xe=>xe.kind==="job"?Mk(xe.job,X):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:xe=>xe.kind==="job"?c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:jk(Rk(xe.job))}):c.jsx("span",{className:"tabular-nums text-sm text-gray-500 dark:text-gray-400",children:"—"})},{key:"actions",header:"Aktion",srOnlyHeader:!0,align:"right",widthClassName:"w-[320px] min-w-[300px]",cell:xe=>{if(xe.kind!=="job")return c.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const Ne=xe.job,Se=String(Ne.phase??"").trim(),Ie=!!Q[Ne.id],$e=Se.trim().toLowerCase(),st=$e!==""&&$e!=="recording"||Ne.status!=="running"||Ie,gt=Yf(Ne.output||""),He=gt&>!=="—"?w[gt.toLowerCase()]:void 0,We=!!He?.favorite,Je=He?.liked===!0,et=!!He?.watching;return c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[c.jsx(Bs,{job:Ne,variant:"table",busy:st,isFavorite:We,isLiked:Je,isWatching:et,onToggleFavorite:u,onToggleLike:h,onToggleWatch:f,onAddToDownloads:g,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const mt=String(Ne.phase??"").trim(),Mt=!!Q[Ne.id],fe=mt.trim().toLowerCase(),Le=fe!==""&&fe!=="recording"||Ne.status!=="running"||Mt;return c.jsx(hn,{size:"sm",variant:"primary",disabled:Le,className:"shrink-0",onClick:Ce=>{Ce.stopPropagation(),!Le&&(F(Ne.id),l(Ne.id))},children:Le?"Stoppe…":"Stop"})})()]})}}],[A,F,w,S,X,l,u,h,f,Q,se,pe]),Ve=m.useMemo(()=>{const xe=n.filter(Ne=>!(_g(Ne)||N_(Ne?.status)||Ne?.endedAt)).map(Ne=>({kind:"job",job:Ne}));return xe.sort((Ne,Se)=>eu(Se)-eu(Ne)),xe},[n]),Oe=m.useMemo(()=>{const xe=n.filter(Ie=>!(!_g(Ie)||N_(Ie?.status))).map(Ie=>({kind:"job",job:Ie})),Ne=Ie=>{const $e=Ie?.postWork,Ct=String($e?.state??"").toLowerCase();return Ct==="running"?0:Ct==="queued"?1:2},Se=Ie=>{const $e=String(Ie?.id??""),Ct=$e?L.get($e):void 0;return typeof Ct?.pos=="number"&&Number.isFinite(Ct.pos)?Ct.pos:Number.MAX_SAFE_INTEGER};return xe.sort((Ie,$e)=>{const Ct=Ie.job,st=$e.job,gt=Ne(Ct)-Ne(st);if(gt!==0)return gt;const He=Se(Ct),We=Se(st);return He!==We?He-We:eu(Ie)-eu($e)}),xe},[n,L]),Te=m.useMemo(()=>{const xe=e.map(Ne=>({kind:"pending",pending:Ne}));return xe.sort((Ne,Se)=>eu(Se)-eu(Ne)),xe},[e]),_t=Ve.length+Oe.length+Te.length,dt=m.useCallback(async()=>{if(!j&&we.length!==0){k(!0);try{F(we),await Promise.allSettled(we.map(xe=>Promise.resolve(l(xe))))}finally{k(!1)}}},[j,we,F,l]);return c.jsxs("div",{className:"grid gap-3",children:[c.jsx("div",{className:"sticky top-[56px] z-20",children:c.jsx("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 justify-between gap-2 p-3",children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"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:_t})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[c.jsx(hn,{size:"sm",variant:B?"secondary":"primary",disabled:re||H,onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),!H&&(B?q():ee())},className:"hidden sm:inline-flex",title:H?"Autostart durch Speicherplatz-Notbremse gesperrt":B?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:B?c.jsx(RN,{className:"size-4 shrink-0"}):c.jsx(ON,{className:"size-4 shrink-0"}),children:"Autostart"}),c.jsx(hn,{size:"sm",variant:"primary",disabled:j||we.length===0,onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),dt()},className:"hidden sm:inline-flex",title:we.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:j?"Stoppe alle…":`Alle stoppen (${we.length})`})]})]})})}),Ve.length>0||Oe.length>0||Te.length>0?c.jsx(c.Fragment,{children:C?c.jsxs("div",{className:"mt-3 space-y-4",children:[Ve.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-sm font-semibold text-gray-900 dark:text-white",children:[c.jsxs("span",{children:["Downloads (",Ve.length,")"]}),H?c.jsx(D_,{}):null]}),c.jsx(nd,{rows:Ve,columns:Be,getRowKey:xe=>xe.kind==="job"?`dl:job:${xe.job.id}`:`dl:pending:${Jl(xe.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:xe=>{xe.kind==="job"&&a(xe.job)}})]}):null,Oe.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Nacharbeiten (",Oe.length,")"]}),c.jsx(nd,{rows:Oe,columns:Be,getRowKey:xe=>xe.kind==="job"?`pw:job:${xe.job.id}`:`pw:pending:${Jl(xe.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:xe=>{xe.kind==="job"&&a(xe.job)}})]}):null,Te.length>0?c.jsxs("div",{className:"overflow-x-auto",children:[c.jsxs("div",{className:"mb-2 text-sm font-semibold text-gray-900 dark:text-white",children:["Wartend (",Te.length,")"]}),c.jsx(nd,{rows:Te,columns:Be,getRowKey:xe=>xe.kind==="job"?`wa:job:${xe.job.id}`:`wa:pending:${Jl(xe.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):c.jsxs("div",{className:"mt-3 grid gap-4",children:[Ve.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:[c.jsxs("span",{children:["Downloads (",Ve.length,")"]}),H?c.jsx(D_,{}):null]}),Ve.map(xe=>c.jsx(xg,{r:xe,nowMs:X,blurPreviews:A,modelsByKey:w,roomStatusByModelKey:S,postworkInfoOf:pe,stopRequestedIds:Q,markStopRequested:F,onOpenPlayer:a,onStopJob:l,onToggleFavorite:u,onToggleLike:h,onToggleWatch:f},`dl:${xe.kind==="job"?xe.job.id:Jl(xe.pending)}`))]}):null,Oe.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Nacharbeiten (",Oe.length,")"]}),Oe.map(xe=>c.jsx(xg,{r:xe,nowMs:X,blurPreviews:A,modelsByKey:w,roomStatusByModelKey:S,postworkInfoOf:pe,stopRequestedIds:Q,markStopRequested:F,onOpenPlayer:a,onStopJob:l,onToggleFavorite:u,onToggleLike:h,onToggleWatch:f},`dl:${xe.kind==="job"?xe.job.id:Jl(xe.pending)}`))]}):null,Te.length>0?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"mt-2 text-xs font-semibold text-gray-700 dark:text-gray-200",children:["Wartend (",Te.length,")"]}),Te.map(xe=>c.jsx(xg,{r:xe,nowMs:X,blurPreviews:A,modelsByKey:w,roomStatusByModelKey:S,postworkInfoOf:pe,stopRequestedIds:Q,markStopRequested:F,onOpenPlayer:a,onStopJob:l,onToggleFavorite:u,onToggleLike:h,onToggleWatch:f},`dl:${xe.kind==="job"?xe.job.id:Jl(xe.pending)}`))]}):null]})}):c.jsx(Is,{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 laufenden Downloads"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Starte oben eine URL – hier siehst du Live-Status und kannst Jobs stoppen."})]})]})})]})}async function M_(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const R_=(n,e)=>c.jsx("span",{className:gn("inline-flex items-center rounded-md px-2 py-0.5 text-xs","bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-200"),children:e});function i6(n){let e=(n??"").trim();if(!e)return null;/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function nf(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(i=>i.trim()).filter(Boolean),t=Array.from(new Set(e));return t.sort((i,a)=>i.localeCompare(a,void 0,{sensitivity:"base"})),t}function r6(n){return String(n??"").trim().toLowerCase().replace(/^www\./,"")}function s6(n){const t=String(n||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function a6(n){const e=String(n||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function o6(n){const e=s6(n||""),t=a6(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}function rf(n){if(n.isUrl&&/^https?:\/\//i.test(String(n.input??"")))return String(n.input);const e=r6(n.host),t=String(n.modelKey??"").trim();return!e||!t?null:e.includes("chaturbate.com")||e.includes("chaturbate")?`https://chaturbate.com/${encodeURIComponent(t)}/`:e.includes("myfreecams.com")||e.includes("myfreecams")?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:null}function j_(n){const e=String(n.profileImageCached??"").trim();if(e)return e;const t=String(n.profileImageUrl??"").trim();return/^https?:\/\//i.test(t)?t:null}function O_({title:n,active:e,hiddenUntilHover:t,onClick:i,icon:a}){return c.jsx("span",{className:gn(t&&!e?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(hn,{variant:e?"soft":"secondary",size:"xs",className:gn("px-2 py-1 leading-none",e?"":"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:n,onClick:i,children:c.jsx("span",{className:"text-base leading-none",children:a})})})}function L_(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 I_(n){return n?n.key==="createdAt"?n.direction==="asc"?"created_asc":"created_desc":n.key==="model"?n.direction==="asc"?"model_asc":"model_desc":n.key==="videos"?n.direction==="asc"?"videos_asc":"videos_desc":n.key==="tags"?n.direction==="asc"?"tags_asc":"tags_desc":"created_desc":"created_desc"}function B_(n){switch(n){case"created_asc":return{key:"createdAt",direction:"asc"};case"created_desc":return{key:"createdAt",direction:"desc"};case"model_asc":return{key:"model",direction:"asc"};case"model_desc":return{key:"model",direction:"desc"};case"videos_asc":return{key:"videos",direction:"asc"};case"videos_desc":return{key:"videos",direction:"desc"};case"tags_asc":return{key:"tags",direction:"asc"};case"tags_desc":return{key:"tags",direction:"desc"};default:return{key:"createdAt",direction:"desc"}}}function P_(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),c.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]})}function F_(){return c.jsxs("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),c.jsx("path",{d:"M3 10h18"}),c.jsx("path",{d:"M9 10v10"}),c.jsx("path",{d:"M15 10v10"})]})}function l6(){const[n,e]=m.useState([]),t=m.useRef({}),[i,a]=m.useState(!1),[l,u]=m.useState(null),[h,f]=m.useState(""),[g,w]=m.useState(1),S=10,[A,C]=m.useState("gallery"),[j,k]=m.useState([]),[B,V]=m.useState({}),[W,H]=m.useState(!1),[ie,Y]=m.useState({key:"createdAt",direction:"desc"}),G=m.useCallback(async()=>{H(!0);try{const fe=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!fe.ok)return;const qe=await fe.json().catch(()=>null),Le=Array.isArray(qe?.items)?qe.items:Array.isArray(qe)?qe:[],Ce={};for(const Pe of Le){const Qe=o6(Pe.output);if(!Qe||Qe==="—")continue;const At=Qe.trim().toLowerCase();At&&(Ce[At]=(Ce[At]??0)+1)}V(Ce)}finally{H(!1)}},[]),O=m.useMemo(()=>new Set(j.map(fe=>fe.toLowerCase())),[j]),re=m.useCallback(fe=>{const qe=fe.toLowerCase();k(Le=>Le.some(Pe=>Pe.toLowerCase()===qe)?Le.filter(Pe=>Pe.toLowerCase()!==qe):[...Le,fe])},[]),E=m.useCallback(()=>k([]),[]);m.useEffect(()=>{const fe=qe=>{const Le=qe,Ce=Array.isArray(Le.detail?.tags)?Le.detail.tags:[];k(Ce)};return window.addEventListener("models:set-tag-filter",fe),()=>window.removeEventListener("models:set-tag-filter",fe)},[]),m.useEffect(()=>{try{const fe=localStorage.getItem("models_pendingTags");if(!fe)return;const qe=JSON.parse(fe);Array.isArray(qe)&&k(qe),localStorage.removeItem("models_pendingTags")}catch{}},[]),m.useEffect(()=>{try{const fe=localStorage.getItem("models_viewMode");(fe==="table"||fe==="gallery")&&C(fe)}catch{}},[]),m.useEffect(()=>{try{localStorage.setItem("models_viewMode",A)}catch{}},[A]);const[R,ee]=m.useState(""),[q,Q]=m.useState(null),[ue,se]=m.useState(null),[$,F]=m.useState(!1),[X,le]=m.useState(!1),[de,L]=m.useState(null),[pe,we]=m.useState(null),[Be,Ve]=m.useState("favorite"),[Oe,Te]=m.useState(!1),[_t,dt]=m.useState(null);async function xe(){if(de){Te(!0),we(null),u(null);try{const fe=new FormData;fe.append("file",de),fe.append("kind",Be);const qe=await fetch("/api/models/import",{method:"POST",body:fe});if(!qe.ok)throw new Error(await qe.text());const Le=await qe.json();we(`✅ Import: ${Le.inserted} neu, ${Le.updated} aktualisiert, ${Le.skipped} übersprungen`),le(!1),L(null),await Ie(),window.dispatchEvent(new Event("models-changed"))}catch(fe){dt(fe?.message??String(fe))}finally{Te(!1)}}}function Ne(fe){const qe=rf(fe)??void 0;return{output:`${fe.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:qe}}const Se=()=>{dt(null),we(null),L(null),Ve("favorite"),le(!0)},Ie=m.useCallback(async()=>{a(!0),u(null);try{const fe=await fetch("/api/models",{cache:"no-store"});if(!fe.ok)throw new Error(await fe.text().catch(()=>`HTTP ${fe.status}`));const qe=await fe.json().catch(()=>null),Le=Array.isArray(qe?.items)?qe.items:Array.isArray(qe)?qe:[];e(Le),G()}catch(fe){u(fe?.message??String(fe))}finally{a(!1)}},[G]);m.useEffect(()=>{G()},[G]),m.useEffect(()=>{Ie()},[Ie]),m.useEffect(()=>{const fe=qe=>{const Ce=qe?.detail??{};if(Ce?.model){const Pe=Ce.model;e(Qe=>{const At=Qe.findIndex(kt=>kt.id===Pe.id);if(At===-1)return[Pe,...Qe];const Xt=Qe.slice();return Xt[At]=Pe,Xt});return}if(Ce?.removed&&Ce?.id){const Pe=String(Ce.id);e(Qe=>Qe.filter(At=>At.id!==Pe));return}Ie()};return window.addEventListener("models-changed",fe),()=>window.removeEventListener("models-changed",fe)},[Ie]),m.useEffect(()=>{const fe=()=>{w(1),e([]),Ie()};return window.addEventListener("models-db-changed",fe),()=>window.removeEventListener("models-db-changed",fe)},[Ie]),m.useEffect(()=>{const fe=R.trim();if(!fe){Q(null),se(null);return}const qe=i6(fe);if(!qe){Q(null),se("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const Le=window.setTimeout(async()=>{try{const Ce=await M_("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:qe})});if(!Ce?.isUrl){Q(null),se("Bitte nur URLs einfügen (keine Modelnamen).");return}Q(Ce),se(null)}catch(Ce){Q(null),se(Ce?.message??String(Ce))}},300);return()=>window.clearTimeout(Le)},[R]);const $e=m.useMemo(()=>n.map(fe=>({m:fe,hay:`${fe.modelKey} ${fe.host??""} ${fe.input??""} ${fe.tags??""}`.toLowerCase()})),[n]),Ct=m.useDeferredValue(h);async function st(fe,qe){if(u(null),t.current[fe])return;t.current[fe]=!0;const Le=n.find(Ce=>Ce.id===fe)??null;if(Le){const Ce={...Le,...qe};typeof qe?.watched=="boolean"&&(Ce.watching=qe.watched),qe?.favorite===!0&&(Ce.liked=!1),qe?.liked===!0&&(Ce.favorite=!1),e(Pe=>Pe.map(Qe=>Qe.id===fe?Ce:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ce}}))}try{const Ce=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:fe,...qe})});if(Ce.status===204){e(Qe=>Qe.filter(At=>At.id!==fe)),Le?window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Le.id,modelKey:Le.modelKey}})):window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:fe}}));return}if(!Ce.ok){const Qe=await Ce.text().catch(()=>"");throw new Error(Qe||`HTTP ${Ce.status}`)}const Pe=await Ce.json();e(Qe=>{const At=Qe.findIndex(kt=>kt.id===Pe.id);if(At===-1)return Qe;const Xt=Qe.slice();return Xt[At]=Pe,Xt}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Pe}}))}catch(Ce){Le&&(e(Pe=>Pe.map(Qe=>Qe.id===fe?Le:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Le}}))),u(Ce?.message??String(Ce))}finally{delete t.current[fe]}}const gt=m.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:fe=>{const qe=fe.liked===!0,Le=fe.favorite===!0,Ce=fe.watching===!0,Pe=!Ce&&!Le&&!qe;return c.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[c.jsx("span",{className:gn(Pe&&!Ce?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(hn,{variant:Ce?"soft":"secondary",size:"xs",className:gn("px-2 py-1 leading-none",!Ce&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:Ce?"Nicht mehr beobachten":"Beobachten",onClick:Qe=>{Qe.stopPropagation(),st(fe.id,{watched:!Ce})},children:c.jsx("span",{className:gn("text-base leading-none",Ce?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),c.jsx(O_,{title:Le?"Favorit entfernen":"Als Favorit markieren",active:Le,hiddenUntilHover:Pe,onClick:Qe=>{Qe.stopPropagation(),Le?st(fe.id,{favorite:!1}):st(fe.id,{favorite:!0,liked:!1})},icon:c.jsx("span",{className:Le?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),c.jsx(O_,{title:qe?"Gefällt mir entfernen":"Gefällt mir",active:qe,hiddenUntilHover:Pe,onClick:Qe=>{Qe.stopPropagation(),qe?st(fe.id,{liked:!1}):st(fe.id,{liked:!0,favorite:!1})},icon:c.jsx("span",{className:qe?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:fe=>(fe.modelKey||"").toLowerCase(),cell:fe=>{const qe=rf(fe),Le=j_(fe);return c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[c.jsx("div",{className:"shrink-0 mt-0.5",children:Le?c.jsx("img",{src:Le,alt:fe.modelKey,loading:"lazy",className:"w-10 h-10 rounded-full object-cover bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10",onClick:Ce=>{Ce.stopPropagation(),qe&&window.open(qe,"_blank","noreferrer")},onError:Ce=>{Ce.currentTarget.style.display="none"}}):c.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10 flex items-center justify-center text-xs text-gray-500 dark:text-gray-400",children:String(fe.modelKey||"?").slice(0,1).toUpperCase()})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:fe.modelKey}),qe?c.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:qe,onClick:Ce=>{Ce.stopPropagation(),window.open(qe,"_blank","noreferrer")},children:"↗"}):null]}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:fe.host??"—"}),qe?c.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:qe}):null]})]})})}},{key:"videos",header:"Videos",sortable:!0,sortValue:fe=>{const qe=String(fe.modelKey||"").trim().toLowerCase(),Le=B[qe];return typeof Le=="number"?Le:0},align:"right",cell:fe=>{const qe=String(fe.modelKey||"").trim().toLowerCase(),Le=B[qe];return c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white w-[64px] inline-block text-right",children:typeof Le=="number"?Le:W?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:fe=>nf(fe.tags).length,cell:fe=>{const qe=nf(fe.tags),Le=qe.slice(0,6),Ce=qe.length-Le.length,Pe=qe.join(", ");return c.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:Pe||void 0,children:[fe.hot?R_(!0,"🔥 HOT"):null,fe.keep?R_(!0,"📌 Behalten"):null,Le.map(Qe=>c.jsx(ws,{tag:Qe,title:Qe,active:O.has(Qe.toLowerCase()),onClick:re},Qe)),Ce>0?c.jsxs(ws,{title:Pe,children:["+",Ce]}):null,!fe.hot&&!fe.keep&&qe.length===0?c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"}):null]})}},{key:"createdAt",header:"Hinzugefügt",sortable:!0,sortValue:fe=>{const qe=Date.parse(String(fe.createdAt??""));return Number.isFinite(qe)?qe:0},widthClassName:"w-[160px]",cell:fe=>{const qe=Date.parse(String(fe.createdAt??""));if(!Number.isFinite(qe)||qe<=0)return c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"});const Le=new Date(qe);return c.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300 leading-tight",children:[c.jsx("div",{className:"tabular-nums",children:Le.toLocaleDateString("de-DE")}),c.jsx("div",{className:"tabular-nums text-gray-500 dark:text-gray-400",children:Le.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})})]})}},{key:"actions",header:"",align:"right",cell:fe=>c.jsx("div",{className:"flex justify-end w-[92px]",children:c.jsx(Bs,{job:Ne(fe),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[O,re,B,W]),He=m.useMemo(()=>{const fe=Ct.trim().toLowerCase(),qe=fe?$e.filter(Le=>Le.hay.includes(fe)).map(Le=>Le.m):n;return O.size===0?qe:qe.filter(Le=>{const Ce=nf(Le.tags);if(Ce.length===0)return!1;const Pe=new Set(Ce.map(Qe=>Qe.toLowerCase()));for(const Qe of O)if(!Pe.has(Qe))return!1;return!0})},[n,$e,Ct,O]),We=m.useMemo(()=>{if(!ie)return He;const fe=gt.find(Ce=>Ce.key===ie.key);if(!fe)return He;const qe=ie.direction==="asc"?1:-1,Le=He.map((Ce,Pe)=>({r:Ce,i:Pe}));return Le.sort((Ce,Pe)=>{let Qe=0;if(fe.sortFn)Qe=fe.sortFn(Ce.r,Pe.r);else{const At=fe.sortValue?fe.sortValue(Ce.r):Ce.r?.[fe.key],Xt=fe.sortValue?fe.sortValue(Pe.r):Pe.r?.[fe.key],kt=L_(At),mn=L_(Xt);kt.isNull&&!mn.isNull?Qe=1:!kt.isNull&&mn.isNull?Qe=-1:kt.kind==="number"&&mn.kind==="number"?Qe=kt.value<mn.value?-1:kt.value>mn.value?1:0:Qe=String(kt.value).localeCompare(String(mn.value),void 0,{numeric:!0})}return Qe===0?Ce.i-Pe.i:Qe*qe}),Le.map(Ce=>Ce.r)},[He,ie,gt]);m.useEffect(()=>{w(1)},[h,j,A,ie]);const Je=We.length,et=m.useMemo(()=>Math.max(1,Math.ceil(Je/S)),[Je,S]);m.useEffect(()=>{g>et&&w(et)},[g,et]);const mt=m.useMemo(()=>{const fe=(g-1)*S;return We.slice(fe,fe+S)},[We,g,S]),Mt=async()=>{if(q){if(!q.isUrl){se("Bitte nur URLs einfügen (keine Modelnamen).");return}F(!0),u(null);try{const fe=await M_("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)});e(qe=>{const Le=qe.filter(Ce=>Ce.id!==fe.id);return[fe,...Le]}),ee(""),Q(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:fe}}))}catch(fe){u(fe?.message??String(fe))}finally{F(!1)}}};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(Is,{header:c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Model hinzufügen"}),grayBody:!0,children:c.jsxs("div",{className:"grid gap-2",children:[c.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[c.jsx("input",{value:R,onChange:fe=>ee(fe.target.value),placeholder:"https://…",className:"flex-1 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),c.jsx(hn,{className:"px-3 py-2 text-sm",onClick:Mt,disabled:!q||$,title:q?"In Models speichern":"Bitte gültige URL einfügen",children:"Hinzufügen"}),c.jsx(hn,{className:"px-3 py-2 text-sm",onClick:Ie,disabled:i,children:"Aktualisieren"})]}),ue?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:ue}):q?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Gefunden: ",c.jsx("span",{className:"font-medium",children:q.modelKey}),q.host?c.jsxs("span",{className:"opacity-70",children:[" • ",q.host]}):null]}):null,l?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:l}):null]})}),c.jsx(Is,{header:c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"grid gap-2 sm:flex sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white whitespace-nowrap",children:["Models ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",He.length,")"]})]}),c.jsx("div",{className:"sm:hidden shrink-0",children:c.jsx(hn,{variant:"secondary",size:"md",onClick:Se,children:"Import"})}),c.jsx("div",{className:"hidden sm:block shrink-0",children:c.jsx(hn,{variant:"secondary",size:"md",onClick:Se,children:"Importieren"})})]}),c.jsxs("div",{className:"w-full sm:w-auto min-w-0",children:[c.jsxs("div",{className:"sm:hidden grid gap-2",children:[c.jsxs("div",{className:"grid grid-cols-[auto,minmax(0,1fr)] gap-2 items-center min-w-0",children:[c.jsx("div",{className:"shrink-0",children:c.jsx(Pg,{ariaLabel:"Ansicht umschalten",size:"lg",className:"flex w-full [&>button]:flex-1 [&>button]:min-w-0",value:A,onChange:fe=>{(fe==="table"||fe==="gallery")&&C(fe)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(P_,{})},{id:"table",label:"Tabelle",icon:c.jsx(F_,{})}]})}),c.jsx("div",{className:"min-w-0",children:A==="gallery"?c.jsxs(c.Fragment,{children:[c.jsx("label",{className:"sr-only",htmlFor:"models-gallery-sort-mobile",children:"Sortierung"}),c.jsxs("select",{id:"models-gallery-sort-mobile",value:I_(ie),onChange:fe=>{const qe=B_(fe.target.value);Y(qe)},className:`\r
|
||
h-9 w-full min-w-0\r
|
||
rounded-md px-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm 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 dark:[color-scheme:dark]\r
|
||
`,children:[c.jsx("option",{value:"created_desc",children:"Hinzugefügt ↓"}),c.jsx("option",{value:"created_asc",children:"Hinzugefügt ↑"}),c.jsx("option",{value:"model_asc",children:"Model A→Z"}),c.jsx("option",{value:"model_desc",children:"Model Z→A"}),c.jsx("option",{value:"videos_desc",children:"Videos ↓"}),c.jsx("option",{value:"videos_asc",children:"Videos ↑"}),c.jsx("option",{value:"tags_desc",children:"Tags ↓"}),c.jsx("option",{value:"tags_asc",children:"Tags ↑"})]})]}):c.jsx("div",{"aria-hidden":"true",className:`\r
|
||
h-9 w-full min-w-0\r
|
||
rounded-md px-3 text-sm\r
|
||
inline-flex items-center\r
|
||
bg-gray-50 text-gray-400 ring-1 ring-gray-200\r
|
||
dark:bg-white/5 dark:text-white/30 dark:ring-white/10\r
|
||
select-none\r
|
||
`,title:"Sortierung in der Tabellenansicht über Spaltenkopf",children:"Sortierung"})})]}),c.jsx("input",{value:h,onChange:fe=>f(fe.target.value),placeholder:"Suchen…",className:`\r
|
||
w-full min-w-0\r
|
||
rounded-md px-3 py-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm 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\r
|
||
`})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 sm:justify-end",children:[A==="gallery"?c.jsxs("div",{className:"shrink-0",children:[c.jsx("label",{className:"sr-only",htmlFor:"models-gallery-sort",children:"Sortierung"}),c.jsxs("select",{id:"models-gallery-sort",value:I_(ie),onChange:fe=>{const qe=B_(fe.target.value);Y(qe)},className:`\r
|
||
h-9 w-auto\r
|
||
rounded-md px-3 text-sm\r
|
||
bg-white text-gray-900 shadow-sm 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 dark:[color-scheme:dark]\r
|
||
`,children:[c.jsx("option",{value:"created_desc",children:"Hinzugefügt ↓"}),c.jsx("option",{value:"created_asc",children:"Hinzugefügt ↑"}),c.jsx("option",{value:"model_asc",children:"Model A→Z"}),c.jsx("option",{value:"model_desc",children:"Model Z→A"}),c.jsx("option",{value:"videos_desc",children:"Videos ↓"}),c.jsx("option",{value:"videos_asc",children:"Videos ↑"}),c.jsx("option",{value:"tags_desc",children:"Tags ↓"}),c.jsx("option",{value:"tags_asc",children:"Tags ↑"})]})]}):null,c.jsx("div",{className:"shrink-0",children:c.jsx(Pg,{ariaLabel:"Ansicht umschalten",size:"lg",value:A,onChange:fe=>{(fe==="table"||fe==="gallery")&&C(fe)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(P_,{})},{id:"table",label:"Tabelle",icon:c.jsx(F_,{})}]})}),c.jsx("input",{value:h,onChange:fe=>f(fe.target.value),placeholder:"Suchen…",className:`\r
|
||
w-full sm:w-[260px]\r
|
||
rounded-md px-3 py-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm 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\r
|
||
`})]})]})]}),j.length>0?c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Tag-Filter:"}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j.map(fe=>c.jsx(ws,{tag:fe,active:!0,onClick:re,title:fe},fe)),c.jsx(hn,{size:"sm",variant:"soft",className:"text-xs font-medium text-gray-600 hover:underline dark:text-gray-300",onClick:E,children:"Zurücksetzen"})]})]}):null]}),noBodyPadding:!0,children:A==="table"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:"min-w-[980px]",children:c.jsx(nd,{rows:mt,columns:gt,getRowKey:fe=>fe.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:ie,onSortChange:fe=>Y(fe),onRowClick:fe=>{const qe=rf(fe);qe&&window.open(qe,"_blank","noreferrer")}})})}),c.jsx(Cf,{page:g,pageSize:S,totalItems:Je,onPageChange:w})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"p-2 sm:p-3",children:mt.length===0?c.jsx("div",{className:"rounded-lg border border-dashed border-gray-200 p-8 text-center text-sm text-gray-500 dark:border-white/10 dark:text-gray-400",children:"Keine Models gefunden."}):c.jsx("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-5",children:mt.map(fe=>{const qe=rf(fe),Le=j_(fe),Ce=nf(fe.tags),Pe=Ce.slice(0,3),Qe=fe.liked===!0,At=fe.favorite===!0,Xt=fe.watching===!0,kt=!Xt&&!At&&!Qe,mn=B[String(fe.modelKey||"").trim().toLowerCase()]??0,It=String(fe.modelKey||"?"),$t=It.length;return c.jsxs("div",{className:"group h-full overflow-hidden rounded-md border border-gray-200 bg-slate-900/80 shadow-sm transition hover:shadow-md dark:border-white/10 flex flex-col",children:[c.jsx("div",{className:"relative cursor-pointer bg-slate-950",onClick:()=>{qe&&window.open(qe,"_blank","noreferrer")},children:c.jsxs("div",{className:"relative aspect-[3/4] w-full overflow-hidden bg-[#12202c]",children:[Le?c.jsx("img",{src:Le,alt:fe.modelKey,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]",onError:Ot=>{Ot.currentTarget.style.display="none";const en=Ot.currentTarget.nextElementSibling;en&&(en.style.display="flex")}}):null,c.jsx("div",{className:gn("absolute inset-0 items-center justify-center px-3 text-center font-semibold text-slate-500 leading-tight",Le?"hidden":"flex"),style:{display:Le?"none":"flex",fontSize:$t<=10?"clamp(1rem, 1.4vw + 0.4rem, 2.1rem)":$t<=18?"clamp(0.95rem, 1.15vw + 0.3rem, 1.7rem)":"clamp(0.8rem, 0.9vw + 0.25rem, 1.25rem)",lineHeight:1.1,overflowWrap:"anywhere",wordBreak:"break-word"},title:It,children:It}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-black/70 via-black/20 to-transparent"}),c.jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 p-2.5 pr-18 sm:pr-2.5",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:fe.modelKey,children:fe.modelKey}),fe.host?c.jsx("div",{className:"truncate text-[11px] text-white/70 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:fe.host}):null]}),c.jsxs("div",{className:"pointer-events-none absolute bottom-2 right-2 z-10 flex flex-col items-end gap-1",children:[c.jsxs("span",{className:"inline-flex items-center gap-1 px-0.5 py-0 text-[10px] font-semibold text-white/95 tabular-nums",title:"Videos","aria-hidden":"true",children:[c.jsx("span",{className:"text-[11px] leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"🎬"}),c.jsx("span",{className:"drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:W?"…":mn})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 px-0.5 py-0 text-[10px] font-semibold text-white/95 tabular-nums",title:"Tags","aria-hidden":"true",children:[c.jsx("span",{className:"text-[11px] leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"🏷️"}),c.jsx("span",{className:"drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:Ce.length})]})]}),c.jsx("div",{className:gn("absolute left-2 z-10 flex items-center gap-1",fe.hot||fe.keep?"top-12":"top-2"),onClick:Ot=>Ot.stopPropagation(),children:c.jsx(Bs,{job:Ne(fe),variant:"table",order:["add","details"],className:`\r
|
||
flex items-center gap-1\r
|
||
[&_button]:h-7 [&_button]:w-7 [&_button]:min-w-0 [&_button]:p-0\r
|
||
[&_button]:bg-transparent [&_button]:shadow-none\r
|
||
[&_button:hover]:bg-white/10\r
|
||
[&_button]:border-0\r
|
||
[&_button_svg]:drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]\r
|
||
`})}),c.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5 pointer-events-none select-none",children:[Xt?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-indigo-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Beobachtet","aria-hidden":"true",children:"👁"}):null,At?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-amber-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Favorit","aria-hidden":"true",children:"★"}):null,Qe?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-rose-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Gefällt mir","aria-hidden":"true",children:"♥"}):null]}),(fe.hot||fe.keep)&&c.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-1",children:[fe.hot?c.jsx("span",{className:"rounded bg-amber-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"HOT"}):null,fe.keep?c.jsx("span",{className:"rounded bg-indigo-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"KEEP"}):null]})]})}),c.jsxs("div",{className:"border-t border-white/5 bg-slate-800/70 px-2.5 py-2 rounded-b-md flex-1",children:[c.jsxs("div",{className:"sm:hidden",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-1.5",onClick:Ot=>Ot.stopPropagation(),children:[c.jsx(hn,{variant:Xt?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",Xt?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Xt?"Nicht mehr beobachten":"Beobachten",onClick:Ot=>{Ot.stopPropagation(),st(fe.id,{watched:!Xt})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",Xt?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(hn,{variant:At?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",At?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:At?"Favorit entfernen":"Als Favorit markieren",onClick:Ot=>{Ot.stopPropagation(),At?st(fe.id,{favorite:!1}):st(fe.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",At?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(hn,{variant:Qe?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",Qe?"bg-rose-500/20 text-rose-200 hover:bg-rose-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Qe?"Gefällt mir entfernen":"Gefällt mir",onClick:Ot=>{Ot.stopPropagation(),Qe?st(fe.id,{liked:!1}):st(fe.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",Qe?"text-rose-300":"text-slate-300"),children:"♥"})})})]}),c.jsx("div",{className:"mt-2 min-h-[24px] flex flex-wrap items-start gap-1.5",children:Pe.length>0?Pe.map(Ot=>c.jsx(ws,{tag:Ot,title:Ot,active:O.has(Ot.toLowerCase()),onClick:re},`${fe.id}:${Ot}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]}),c.jsxs("div",{className:"hidden sm:block",children:[c.jsx("div",{onClick:Ot=>Ot.stopPropagation(),children:c.jsxs("div",{className:"grid grid-cols-3 gap-1.5 w-full",children:[c.jsx(hn,{variant:Xt?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",kt&&!Xt?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",Xt?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Xt?"Nicht mehr beobachten":"Beobachten",onClick:Ot=>{Ot.stopPropagation(),st(fe.id,{watched:!Xt})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",Xt?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(hn,{variant:At?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",kt&&!At?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",At?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:At?"Favorit entfernen":"Als Favorit markieren",onClick:Ot=>{Ot.stopPropagation(),At?st(fe.id,{favorite:!1}):st(fe.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",At?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(hn,{variant:Qe?"soft":"secondary",size:"xs",className:gn("h-8 min-w-0 px-0 shadow-none",kt&&!Qe?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",Qe?"bg-rose-500/20 text-rose-200 hover:bg-rose-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Qe?"Gefällt mir entfernen":"Gefällt mir",onClick:Ot=>{Ot.stopPropagation(),Qe?st(fe.id,{liked:!1}):st(fe.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:gn("text-xl leading-none",Qe?"text-rose-300":"text-slate-300"),children:"♥"})})})]})}),c.jsx("div",{className:"mt-2 min-h-[24px] flex flex-wrap items-start gap-1.5",children:Pe.length>0?Pe.map(Ot=>c.jsx(ws,{tag:Ot,title:Ot,active:O.has(Ot.toLowerCase()),onClick:re},`${fe.id}:${Ot}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]})]})]},fe.id)})})}),c.jsx(Cf,{page:g,pageSize:S,totalItems:Je,onPageChange:w})]})}),c.jsx(kf,{open:X,onClose:()=>!Oe&&le(!1),title:"Models importieren",footer:c.jsxs(c.Fragment,{children:[c.jsx(hn,{variant:"secondary",onClick:()=>le(!1),disabled:Oe,children:"Abbrechen"}),c.jsx(hn,{variant:"primary",onClick:xe,isLoading:Oe,disabled:!de||Oe,children:"Import starten"})]}),children:c.jsxs("div",{className:"space-y-3",children:[c.jsx("div",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Wähle eine CSV-Datei zum Import aus."}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Import-Typ"}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[c.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[c.jsx("input",{type:"radio",name:"import-kind",value:"favorite",checked:Be==="favorite",onChange:()=>Ve("favorite"),disabled:Oe}),"Favoriten (★)"]}),c.jsxs("label",{className:"inline-flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[c.jsx("input",{type:"radio",name:"import-kind",value:"liked",checked:Be==="liked",onChange:()=>Ve("liked"),disabled:Oe}),"Gefällt mir (♥)"]})]})]}),c.jsx("input",{type:"file",accept:".csv,text/csv",onChange:fe=>{const qe=fe.target.files?.[0]??null;dt(null),L(qe)},className:"block w-full text-sm text-gray-700 file:mr-4 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-gray-900 hover:file:bg-gray-200 dark:text-gray-200 dark:file:bg-white/10 dark:file:text-white dark:hover:file:bg-white/20"}),de?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",c.jsx("span",{className:"font-medium",children:de.name})]}):null,_t?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:_t}):null,pe?c.jsx("div",{className:"rounded-md bg-green-50 px-3 py-2 text-xs text-green-700 dark:bg-green-500/10 dark:text-green-200",children:pe}):null]})})]})}function si(...n){return n.filter(Boolean).join(" ")}function wg(n){const e=String(n?.status??"").toLowerCase();return!!!(n?.endedAt??n?.completedAt)&&(e==="running"||e==="postwork")}const u6=600*1e3,c6=new Map,U_=new Map;function sf(n){return Number.isFinite(n)&&Date.now()-n<=u6}function z_(n){try{if(typeof window>"u")return null;const e=window.sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}function d6(n,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function h6(n){return`md:cb:online:${n}`}function H_(n){return`md:cb:bio:${n}`}const f6=new Intl.NumberFormat("de-DE");function tl(n){return n==null||!Number.isFinite(n)?"—":f6.format(n)}function m6(n){if(n==null||!Number.isFinite(n))return"—";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0||i===1?0:1;return`${t.toFixed(a)} ${e[i]}`}function Sg(n){if(n==null||!Number.isFinite(n)||n<0)return"—";const e=Math.floor(n),t=Math.floor(e/3600),i=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${String(i).padStart(2,"0")}:${String(a).padStart(2,"0")}`:`${i}:${String(a).padStart(2,"0")}`}function $c(n){if(!n)return"—";const e=typeof n=="string"?new Date(n):n;return Number.isNaN(e.getTime())?String(n):e.toLocaleString("de-DE",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function p6(n){return n?n.split(",").map(e=>e.trim()).filter(Boolean):[]}function _o(n){return(n||"").split(/[\\/]/).pop()||""}function g6(n){if(!n)return"—";const e=typeof n=="string"?new Date(n):n;return Number.isNaN(e.getTime())?String(n):e.toLocaleDateString("de-DE",{year:"2-digit",month:"2-digit",day:"2-digit"})}function To(n){return n.startsWith("HOT ")?n.slice(4):n}function fy(n){return String(n||"").startsWith("HOT ")}function y6(n,e){const t=String(n||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function b6(n){return fy(n)?To(n):`HOT ${n}`}function v6(n){const e=_o(n||""),t=To(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}function gf(n){return n?String(n).replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?>[\s\S]*?<\/style>/gi,"").replace(/<\/?[^>]+>/g," ").replace(/\s+/g," ").trim():""}function $_(n){const e=String(n??"").trim();if(!e)return"";const t=e.match(/HTTP\s+(\d{3})/i);if(t?.[1])return`HTTP ${t[1]}`;const i=e.toLowerCase();if(i.includes("<!doctype")||i.includes("<html")||i.includes("text/html"))return"HTTP Error (HTML response)";const a=e.replace(/\s+/g," ");return a.length>80?a.slice(0,77)+"…":a}function q_(n){const e=String(n??"").trim();if(!e)return"";const t=gf(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function x6(n){if(!n)return"";const e=String(n).trim();return e?e.startsWith("http://")||e.startsWith("https://")?e:e.startsWith("/")?`https://chaturbate.com${e}`:`https://chaturbate.com/${e}`:""}function cs(n){return si("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",n)}const af=n=>n?"blur-md scale-[1.03] brightness-90":"";function of(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function V_(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function tu(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function lf(n,e,t){return Math.max(e,Math.min(t,n))}const G_=5;function K_(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,w=Math.abs(g-e);(f<a||f===a&&w<l||f===a&&w===l&&h<i)&&(a=f,l=w,t=u,i=h)}return[t,i]}function _6(n){let e=String(n??"").trim();if(!e)return"";if(e=e.replace(/^https?:\/\//i,""),e.includes("/")){const t=e.split("/").filter(Boolean);e=t[t.length-1]||e}return e.includes(":")&&(e=e.split(":").pop()||e),e.trim().toLowerCase()}function w6(n){const e=n??{},t=e.cf_clearance||e["cf-clearance"]||e.cfclearance||"",i=e.sessionId||e.sessionid||e.session_id||e["session-id"]||"",a=[];return t&&a.push(`cf_clearance=${t}`),i&&a.push(`sessionid=${i}`),a.join("; ")}function S6({open:n,modelKey:e,onClose:t,onOpenPlayer:i,cookies:a,runningJobs:l,blurPreviews:u,teaserPlayback:h="hover",teaserAudio:f=!1,onToggleWatch:g,onToggleFavorite:w,onToggleLike:S,onToggleHot:A,onDelete:C,onKeep:j,onStopJob:k}){const[B,V]=m.useState([]),[W,H]=m.useState(null),[ie,Y]=m.useState(null),[G,O]=m.useState(null),[re,E]=m.useState(null),[R,ee]=m.useState(!1),[q,Q]=m.useState([]),[ue,se]=m.useState(!1),[$,F]=m.useState([]),[X,le]=m.useState(!1),de=m.useRef(0),[,L]=m.useState(0),[pe,we]=m.useState(null),[,Be]=m.useState(!1),[Ve,Oe]=m.useState(!1),[Te,_t]=m.useState(0),[dt,xe]=m.useState(1),Ne=4,Se=_6(e),[Ie,$e]=m.useState("info"),Ct=m.useRef(null),[st,gt]=m.useState({}),[He,We]=m.useState(null),[Je,et]=m.useState(null),[mt,Mt]=m.useState(null),[fe,qe]=m.useState({}),[Le,Ce]=m.useState(null),Pe=m.useCallback(_e=>String(_e??"").toLowerCase(),[]),Qe=m.useMemo(()=>new Set,[]),At=m.useMemo(()=>new Set,[]),Xt=m.useMemo(()=>new Set,[]),kt=m.useMemo(()=>new Set,[]);m.useEffect(()=>{if(!n||!Se)return;const _e=c6.get(Se),nt=z_(h6(Se)),ht=(_e&&sf(_e.at)?_e:null)||(nt&&sf(nt.at)?nt:null);ht&&(H(ht.room??null),Y(ht.meta??null));const Ht=U_.get(Se),De=z_(H_(Se)),vt=(Ht&&sf(Ht.at)?Ht:null)||(De&&sf(De.at)?De:null);vt&&(O(vt.bio??null),E(vt.meta??null))},[n,Se]),m.useEffect(()=>{n&&Oe(!1)},[n,Se]);const mn=m.useCallback(async()=>{if(!Se)return;Ct.current?.abort();const _e=new AbortController;Ct.current=_e,ee(!0);try{const nt=w6(a),ht=`/api/chaturbate/biocontext?model=${encodeURIComponent(Se)}&refresh=1`,Ht=await fetch(ht,{cache:"no-store",signal:_e.signal,headers:nt?{"X-Chaturbate-Cookie":nt}:void 0});if(!Ht.ok){const Gt=await Ht.text().catch(()=>"");throw new Error(Gt||`HTTP ${Ht.status}`)}const De=await Ht.json().catch(()=>null),vt={enabled:De?.enabled,fetchedAt:De?.fetchedAt,lastError:De?.lastError},wt=De?.bio??null;E(vt),O(wt);const Nt={at:Date.now(),bio:wt,meta:vt};U_.set(Se,Nt),d6(H_(Se),Nt)}catch(nt){if(nt?.name==="AbortError")return;E({enabled:void 0,fetchedAt:void 0,lastError:nt?.message||"Fetch fehlgeschlagen"})}finally{ee(!1)}},[Se,a]);m.useEffect(()=>{n||(Ct.current?.abort(),Ct.current=null)},[n]);const It=m.useCallback(async()=>{try{const nt=await(await fetch("/api/models",{cache:"no-store"})).json().catch(()=>null);V(Array.isArray(nt)?nt:[])}catch{}},[]),$t=m.useCallback(async()=>{if(Se){se(!0);try{const _e=`/api/record/done?model=${encodeURIComponent(Se)}&page=${dt}&pageSize=${Ne}&sort=completed_desc&includeKeep=1&withCount=1`,ht=await(await fetch(_e,{cache:"no-store"})).json().catch(()=>null),Ht=Array.isArray(ht?.items)?ht.items:[],De=Number(ht?.count??Ht.length);Q(Ht),_t(Number.isFinite(De)?De:Ht.length)}catch{}finally{se(!1)}}},[Se,dt]),Ot=m.useRef($t);m.useEffect(()=>{Ot.current=$t},[$t]),m.useEffect(()=>{if(!n)return;const _e=new EventSource("/api/stream"),nt=()=>{},ht=()=>{Ot.current()};return _e.addEventListener("jobs",nt),_e.addEventListener("doneChanged",ht),()=>{_e.removeEventListener("jobs",nt),_e.removeEventListener("doneChanged",ht),_e.close()}},[n]);function en(_e){return{id:`model:${_e}`,output:`${_e}_01_01_2000__00-00-00.mp4`,status:"finished"}}const Sn=m.useCallback((_e,nt)=>{const ht=String(_e??"").trim();ht&&we({src:ht,alt:nt})},[]);m.useEffect(()=>{n||L(0)},[n]);const Pn=m.useMemo(()=>Array.isArray(l)?l:$,[l,$]);m.useEffect(()=>{n&&xe(1)},[n,e]),m.useEffect(()=>{n&&It()},[n,It]),m.useEffect(()=>{!n||!Se||$t()},[n,Se,$t]),m.useEffect(()=>{if(!n||Array.isArray(l))return;const _e=new AbortController,nt=++de.current;return le(!0),fetch("/api/record/jobs",{cache:"no-store",signal:_e.signal}).then(ht=>ht.json()).then(ht=>{_e.signal.aborted||de.current===nt&&F(Array.isArray(ht)?ht:[])}).catch(()=>{_e.signal.aborted||de.current===nt&&F([])}).finally(()=>{_e.signal.aborted||de.current===nt&&le(!1)}),()=>{_e.abort()}},[n,l]);const St=m.useMemo(()=>Se?B.find(_e=>(_e.modelKey||"").toLowerCase()===Se)??null:null,[B,Se]),Tn=m.useMemo(()=>{const _e=St?.cbOnlineJson;if(!_e||typeof _e!="string")return null;try{return JSON.parse(_e)}catch{return null}},[St]),tt=m.useMemo(()=>{const _e=St?.cbOnlineFetchedAt,nt=St?.cbOnlineLastError;return!_e&&!nt?null:{enabled:!0,fetchedAt:_e,lastError:nt}},[St]),D=W??Tn,P=ie??tt,ne=q,Re=m.useMemo(()=>Se?Pn.filter(_e=>{const nt=v6(_e.output);return nt!=="—"&&nt.trim().toLowerCase()===Se}):[],[Pn,Se]),Ge=D?.display_name||St?.modelKey||Se||"Model",yt=D?.image_url_360x270||D?.image_url||"",tn=D?.image_url||yt,un=D?.chat_room_url_revshare||D?.chat_room_url||"",vn=(D?.current_show||"").trim().toLowerCase(),cn=vn?vn==="public"?"Public":vn==="private"?"Private":vn:"",Cn=(G?.location||"").trim(),xn=G?.follower_count,on=G?.display_age,Rn=(G?.room_status||"").trim(),qt=G?.last_broadcast?$c(G.last_broadcast):"—",Bt=gf(G?.about_me),Zt=gf(G?.wish_list),zt=St?.lastSeenOnline==null?"":St.lastSeenOnline?"online":"offline",Pt=(Rn||vn||zt||"").trim(),Nn=Array.isArray(G?.social_medias)?G.social_medias:[],Ft=Array.isArray(G?.photo_sets)?G.photo_sets:[],Qn=Array.isArray(G?.interested_in)?G.interested_in:[],Xn=m.useMemo(()=>{const _e=p6(St?.tags),nt=Array.isArray(D?.tags)?D.tags:[],ht=new Map;for(const Ht of[..._e,...nt]){const De=String(Ht).trim().toLowerCase();De&&(ht.has(De)||ht.set(De,String(Ht).trim()))}return Array.from(ht.values()).sort((Ht,De)=>Ht.localeCompare(De,"de"))},[St?.tags,D?.tags]),Gn=({icon:_e,label:nt,value:ht})=>c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-2.5 py-2 sm:px-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] sm:text-xs text-gray-600 dark:text-gray-300",children:[_e,nt]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:ht})]}),ln=m.useCallback(_e=>{const nt=String(_e?.id??""),ht=String(_e.output??"");return nt?`${nt}::${ht}`:ht},[]),Zn=m.useCallback(async _e=>{const nt=_e.output||"",ht=_o(nt);if(!ht){await A?.(_e);return}const Ht=b6(ht);Q(De=>De.map(vt=>vt.id&&_e.id&&vt.id===_e.id||vt.output&&_e.output&&vt.output===_e.output?{...vt,output:y6(vt.output||"",Ht)}:vt)),await A?.(_e),$t()},[A,$t]),ti=m.useCallback((_e,nt,ht)=>{const Ht=_e?.meta,De=typeof Ht=="string"?(()=>{try{return JSON.parse(Ht)}catch{return null}})():Ht,vt=typeof De?.previewSprite?.stepSeconds=="number"&&Number.isFinite(De.previewSprite.stepSeconds)&&De.previewSprite.stepSeconds>0?De.previewSprite.stepSeconds:5,wt=Math.max(0,Math.floor(nt)*vt);i?.(_e,wt)},[i]),jn=m.useCallback(async()=>{Se&&(V(_e=>_e.map(nt=>(nt.modelKey||"").toLowerCase()===Se?{...nt,favorite:!nt.favorite}:nt)),await w?.(en(Se)),It())},[Se,w,It]),Kn=m.useCallback(async()=>{Se&&(V(_e=>_e.map(nt=>(nt.modelKey||"").toLowerCase()===Se?{...nt,liked:nt.liked!==!0}:nt)),await S?.(en(Se)),It())},[Se,S,It]),rn=m.useCallback(async()=>{Se&&(V(_e=>_e.map(nt=>(nt.modelKey||"").toLowerCase()===Se?{...nt,watching:!nt.watching}:nt)),await g?.(en(Se)),It())},[Se,g,It]);m.useEffect(()=>{n||(We(null),et(null),Mt(null),Ce(null),qe({}),gt({}))},[n,Se]);const Di=m.useCallback((_e,nt)=>{const ht=ln(_e);gt(Ht=>Ht[ht]===nt?Ht:{...Ht,[ht]:nt})},[ln]),oi=m.useCallback(_e=>{We(_e),h==="hover"&&et(_e)},[h]),ni=m.useCallback(_e=>{const nt=ln(_e),ht=_e?.durationSeconds??_e?.meta?.durationSeconds??st[nt],Ht=typeof ht=="number"&&Number.isFinite(ht)?ht>1440*60?ht/1e3:ht:null;return Sg(Ht)},[st,ln]),di=m.useCallback(_e=>{const nt=_e?.sizeBytes??_e?.size??_e?.meta?.sizeBytes??_e?.meta?.size;return typeof nt=="number"&&Number.isFinite(nt)?nt:null},[]),Ci=m.useCallback(_e=>m6(_e??null),[]),Fn=m.useCallback((_e,nt)=>{qe(ht=>{if(nt===void 0){if(!(_e in ht))return ht;const Ht={...ht};return delete Ht[_e],Ht}return ht[_e]===nt?ht:{...ht,[_e]:nt}})},[]),On=m.useCallback(_e=>Fn(_e,void 0),[Fn]);m.useEffect(()=>{n&&$e("info")},[n,Se]);const $n=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:Te?tl(Te):void 0,disabled:ue},{id:"running",label:"Running",count:Re.length?tl(Re.length):void 0,disabled:X}];return c.jsxs(kf,{open:n,onClose:t,title:Ge,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:yt||void 0,mobileCollapsedImageAlt:Ge,rightBodyClassName:"pt-0 sm:pt-2",titleRight:Ie==="info"?c.jsx(hn,{variant:"secondary",className:si("h-8 px-2 sm:h-9 sm:px-3","whitespace-nowrap"),disabled:R||!e,onClick:()=>{mn()},title:"BioContext neu abrufen",children:c.jsxs("span",{className:"inline-flex items-center gap-2",children:[c.jsx(RA,{className:si("size-4",R?"animate-spin":"")}),c.jsx("span",{className:"hidden sm:inline",children:"Bio aktualisieren"})]})}):null,left:c.jsx("div",{className:"space-y-3 sm:space-y-4",children:c.jsxs("div",{className:"hidden sm:block space-y-2",children:[c.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/70 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"relative",children:[yt?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Sn(tn,Ge),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:yt,alt:Ge,className:si("h-24 sm:h-52 w-full object-cover transition",af(u))})}):c.jsx("div",{className:"h-24 sm:h-52 w-full bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),c.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/40 via-black/0 to-black/0"}),c.jsxs("div",{className:"absolute left-3 top-3 flex flex-wrap items-center gap-2",children:[cn?c.jsx("span",{className:cs("bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20"),children:cn}):null,Pt?c.jsx("span",{className:cs(Pt.toLowerCase()==="online"?"bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20":"bg-gray-500/10 text-gray-900 ring-gray-200 backdrop-blur dark:text-gray-200 dark:ring-white/15"),children:Pt}):null,D?.is_hd?c.jsx("span",{className:cs("bg-indigo-500/10 text-indigo-900 ring-indigo-200 backdrop-blur dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,D?.is_new?c.jsx("span",{className:cs("bg-amber-500/10 text-amber-900 ring-amber-200 backdrop-blur dark:text-amber-200 dark:ring-amber-400/20"),children:"NEW"}):null]}),c.jsxs("div",{className:"absolute bottom-3 left-3 right-3",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow",children:D?.display_name||D?.username||St?.modelKey||Se||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:D?.username?`@${D.username}`:St?.modelKey?`@${St.modelKey}`:""})]}),c.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),rn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",St?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:St?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!St?.watching,"aria-label":St?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(wf,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(yl,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),jn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",St?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:St?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!St?.favorite,"aria-label":St?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(Sf,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(_u,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Kn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","cursor-pointer hover:scale-[1.03] active:scale-[0.98] transition",St?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:St?.liked?"Like entfernen":"Liken","aria-pressed":St?.liked===!0,"aria-label":St?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(td,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(bl,{className:si("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",St?.liked?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-rose-200")})]})})]})]}),c.jsxs("div",{className:"p-3 sm:p-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[c.jsx(Gn,{icon:c.jsx(I1,{className:"size-4"}),label:"Viewer",value:tl(D?.num_users)}),c.jsx(Gn,{icon:c.jsx(D0,{className:"size-4"}),label:"Follower",value:tl(D?.num_followers??xn)})]}),c.jsxs("dl",{className:"mt-2 grid grid-cols-2 gap-2 text-xs",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(oN,{className:"size-4"}),"Location"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:D?.location||Cn||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(nN,{className:"size-4"}),"Sprache"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:D?.spoken_languages||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(N0,{className:"size-4"}),"Online"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:Sg(D?.seconds_online)})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(td,{className:"size-4"}),"Alter"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:on!=null?String(on):D?.age!=null?String(D.age):"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/60 bg-white/50 px-2.5 py-2 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("dt",{className:"flex items-center gap-1 text-gray-600 dark:text-gray-300",children:[c.jsx(N0,{className:"size-4"}),"Last broadcast"]}),c.jsx("dd",{className:"mt-1 text-[13px] font-semibold leading-snug text-gray-900 dark:text-white break-words",children:qt})]})]}),P?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):P?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[c.jsxs("div",{className:"font-medium",children:["Online-Info: ",$_(P.lastError)]}),c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),c.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:q_(P.lastError)})]})]}):null,re?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):re?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["BioContext: ",re.lastError]}):null]})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Tags"}),Xn.length?c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Xn.map(_e=>c.jsx(ws,{tag:_e},_e))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:c.jsxs("div",{className:si("border-b border-gray-200/70 dark:border-white/10","bg-white/95 backdrop-blur dark:bg-gray-800/95"),children:[c.jsxs("div",{className:"sm:hidden px-2 pb-2 space-y-1.5",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5 overflow-hidden",children:[c.jsxs("div",{className:"relative h-40",children:[yt?c.jsx("button",{type:"button",className:"absolute inset-0 block w-full",onClick:()=>tn?Sn(tn,Ge):void 0,"aria-label":"Bild vergrößern",children:c.jsx("img",{src:tn||yt,alt:Ge,className:si("h-full w-full object-cover",af(u))})}):c.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-indigo-500/10 via-transparent to-sky-500/10"}),c.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-black/0"}),c.jsxs("div",{className:"absolute left-3 right-3 top-3 flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-base font-semibold text-white drop-shadow",children:D?.display_name||D?.username||St?.modelKey||Se||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:D?.username?`@${D.username}`:St?.modelKey?`@${St.modelKey}`:""})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),rn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",St?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/30 ring-white/20"),title:St?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!St?.watching,"aria-label":St?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(wf,{className:si("absolute inset-0 size-4","text-white/70")}),c.jsx(yl,{className:si("absolute inset-0 size-4",St?.watching?"opacity-100":"opacity-0","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),jn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",St?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/30 ring-white/20"),title:St?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!St?.favorite,"aria-label":St?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(Sf,{className:si("absolute inset-0 size-4","text-white/70")}),c.jsx(_u,{className:si("absolute inset-0 size-4",St?.favorite?"opacity-100":"opacity-0","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),Kn()},className:si("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",St?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/30 ring-white/20"),title:St?.liked?"Like entfernen":"Liken","aria-pressed":St?.liked===!0,"aria-label":St?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(td,{className:si("absolute inset-0 size-4","text-white/70")}),c.jsx(bl,{className:si("absolute inset-0 size-4",St?.liked?"opacity-100":"opacity-0","text-rose-200")})]})})]})]}),c.jsxs("div",{className:"absolute left-3 bottom-3 flex flex-wrap items-center gap-1.5",children:[cn?c.jsx("span",{className:cs("bg-white/15 text-white ring-white/20"),children:cn}):null,Pt?c.jsx("span",{className:cs((Pt||"").toLowerCase()==="online"?"bg-emerald-500/25 text-white ring-emerald-200/30":"bg-white/15 text-white ring-white/20"),children:Pt}):null,D?.is_hd?c.jsx("span",{className:cs("bg-white/15 text-white ring-white/20"),children:"HD"}):null,D?.is_new?c.jsx("span",{className:cs("bg-white/15 text-white ring-white/20"),children:"NEW"}):null]}),un?c.jsx("div",{className:"absolute right-3 bottom-3",children:c.jsxs("a",{href:un,target:"_blank",rel:"noreferrer",className:"inline-flex h-8 items-center justify-center gap-1 rounded-lg px-3 text-sm font-medium bg-white/15 text-white ring-1 ring-white/20 backdrop-blur hover:bg-white/20",title:"Room öffnen",children:[c.jsx(Kh,{className:"size-4"}),c.jsx("span",{children:"Room"})]})}):null]}),c.jsxs("div",{className:"px-3 py-2 text-[12px] text-gray-700 dark:text-gray-200",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(I1,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:tl(D?.num_users)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(D0,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:tl(D?.num_followers??xn)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx($A,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:Sg(D?.seconds_online)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(N0,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:G?.last_broadcast?g6(G.last_broadcast):"—"})]})]}),P?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):P?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["Online-Info: ",P.lastError]}):null,re?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"BioContext ist aktuell deaktiviert."}):re?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[c.jsx("div",{className:"flex items-start justify-between gap-2",children:c.jsxs("div",{className:"font-medium",children:["BioContext: ",$_(re.lastError)]})}),c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),c.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:q_(re.lastError)})]})]}):null]})]}),Xn.length?c.jsx("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 px-2 py-1.5 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("div",{className:"shrink-0 text-xs font-semibold text-gray-900 dark:text-white",children:["Tags ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",Xn.length,")"]})]}),c.jsx("div",{className:"-mx-1 flex-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:c.jsxs("div",{className:"flex min-w-max items-center gap-1.5",children:[Xn.slice(0,20).map(_e=>c.jsx(ws,{tag:_e},_e)),Xn.length>20?c.jsxs("span",{className:cs("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:["+",Xn.length-20]}):null]})})]})}):null]}),c.jsxs("div",{className:"hidden sm:flex items-start justify-between gap-2 px-2 py-2 sm:px-4",children:[c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"text-[11px] leading-snug text-gray-600 dark:text-gray-300",children:Se?c.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[P?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",$c(P.fetchedAt)]}):null,re?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",$c(re.fetchedAt)]}):null,St?.lastSeenOnlineAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",c.jsx("span",{className:"font-medium",children:St.lastSeenOnline==null?"—":St.lastSeenOnline?"online":"offline"})," ","(",$c(St.lastSeenOnlineAt),")"]}):null]}):"—"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-2",children:un?c.jsxs("a",{href:un,target:"_blank",rel:"noreferrer",className:si("inline-flex h-8 items-center justify-center gap-1 rounded-lg","border border-gray-200/70 bg-white/70 px-3 text-sm font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white","dark:border-white/10 dark:bg-white/5 dark:text-white","whitespace-nowrap"),title:"Room öffnen",children:[c.jsx(Kh,{className:"size-4"}),c.jsx("span",{className:"hidden sm:inline",children:"Room öffnen"})]}):null})]}),c.jsx("div",{className:"px-2 pb-2",children:c.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:c.jsx("div",{className:"min-w-max",children:c.jsx(Lg,{tabs:$n,value:Ie,onChange:_e=>$e(_e),variant:"pillsBrand",ariaLabel:"Bereich auswählen"})})})})]}),footer:c.jsx("div",{className:"w-full",children:c.jsx(hn,{variant:"secondary",className:"w-full sm:w-auto",onClick:t,children:"Schließen"})}),children:[c.jsxs("div",{className:"min-h-0",children:[Ie==="info"?c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-3 sm:p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"flex items-center justify-between gap-3",children:c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Room Subject"})}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:D?.room_subject?c.jsx("p",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:D.room_subject}):c.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:"Keine Subject-Info vorhanden."})})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Bio"}),R?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsxs("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[c.jsx(ZA,{className:"size-4"}),"Über mich"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:Bt?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:Bt}):c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-gray-700 dark:text-gray-200",children:[c.jsx(D0,{className:"size-4"}),"Wishlist"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:Zt?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:Zt}):c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]})]}),c.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Real name:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:G?.real_name?gf(G.real_name):"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Body type:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:G?.body_type||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Smoke/Drink:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:G?.smoke_drink||"—"})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-xs dark:border-white/10 dark:bg-white/5",children:[c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"Sex:"})," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:G?.sex||"—"})]})]}),Qn.length?c.jsxs("div",{className:"mt-2",children:[c.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Interested in"}),c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Qn.map(_e=>c.jsx("span",{className:cs("bg-sky-500/10 text-sky-900 ring-sky-200 dark:text-sky-200 dark:ring-sky-400/20"),children:_e},_e))})]}):null]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Socials"}),Nn.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Nn.length," Links"]}):null]}),Nn.length?c.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:Nn.map(_e=>{const nt=x6(_e.link);return c.jsxs("a",{href:nt,target:"_blank",rel:"noreferrer",className:si("group flex min-w-0 w-full items-center gap-3 overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 px-3 py-2 text-gray-900","transition hover:border-indigo-200 hover:bg-gray-50/80 hover:text-gray-900 dark:border-white/10 dark:bg-white/5 dark:text-white dark:hover:border-indigo-400/30 dark:hover:bg-white/10 dark:hover:text-white"),title:_e.title_name,children:[c.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:_e.image_url?c.jsx("img",{src:_e.image_url,alt:"",className:"size-5"}):c.jsx(rN,{className:"size-5"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:_e.title_name}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:_e.label_text?_e.label_text:_e.tokens!=null?`${_e.tokens} token(s)`:"Link"})]}),c.jsx(Kh,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},_e.id)})}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Social-Medias vorhanden."})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Photo sets"}),Ft.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Ft.length," Sets"]}):null]}),Ft.length?c.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:Ft.slice(0,6).map(_e=>c.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-200/70 bg-white/60 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"relative",children:[_e.cover_url?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>Sn(_e.cover_url,_e.name),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:_e.cover_url,alt:_e.name,className:si("h-28 w-full object-cover transition",af(u))})}):c.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:c.jsx(uN,{className:"size-6 text-gray-500"})}),c.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[_e.is_video?c.jsx("span",{className:cs("bg-indigo-500/10 text-indigo-900 ring-indigo-200 dark:text-indigo-200 dark:ring-indigo-400/20"),children:"Video"}):c.jsx("span",{className:cs("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:"Photos"}),_e.fan_club_only?c.jsx("span",{className:cs("bg-amber-500/10 text-amber-900 ring-amber-200 dark:text-amber-200 dark:ring-amber-400/20"),children:"FanClub"}):null]})]}),c.jsxs("div",{className:"p-3",children:[c.jsx("div",{className:"truncate text-sm font-medium text-gray-900 dark:text-white",children:_e.name}),c.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Tokens: ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:tl(_e.tokens)}),_e.user_can_access===!0?c.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},_e.id))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,Ie==="downloads"?c.jsx("div",{className:"min-h-0",children:c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"shrink-0 flex flex-wrap items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Inkl. Dateien aus ",c.jsx("span",{className:"font-medium",children:"/done/keep/"})]})]}),c.jsx("div",{className:"w-full sm:w-auto",children:c.jsx(Cf,{page:dt,pageSize:Ne,totalItems:Te,onPageChange:_e=>xe(_e),siblingCount:1,boundaryCount:1,showSummary:!0,prevLabel:"Zurück",nextLabel:"Weiter",ariaLabel:"Downloads Seiten",className:"border-0 bg-transparent px-0 py-0 dark:bg-transparent"})})]}),c.jsx("div",{className:"mt-2",children:ue?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):ne.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine abgeschlossenen Downloads für dieses Model gefunden."}):c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:ne.map(_e=>{const nt=ln(_e),Ht=!(!!f&&He===nt),De=_o(_e.output||""),vt=fy(De),wt=To(De),Nt=ni(_e),Gt=Ci(di(_e)),Kt=V_(_e?.meta),sn=typeof Kt?.videoWidth=="number"&&typeof Kt?.videoHeight=="number"&&Kt.videoWidth>0&&Kt.videoHeight>0?{w:Kt.videoWidth,h:Kt.videoHeight}:typeof _e?.videoWidth=="number"&&typeof _e?.videoHeight=="number"&&_e.videoWidth>0&&_e.videoHeight>0?{w:_e.videoWidth,h:_e.videoHeight}:null,Mn=hd(sn),Yn=Qe.has(nt)||At.has(nt)||Xt.has(nt),nr=kt.has(nt),Wn=!!St?.favorite,Wi=St?.liked===!0,Hi=!!St?.watching,bi=Xn,Si=of(tn,yt),ii=To(_o(_e.output||"")).replace(/\.[^.]+$/,"").trim(),Mi=of(Kt?.previewSprite?.path,Kt?.previewSpritePath,ii?`/api/preview-sprite/${encodeURIComponent(ii)}`:void 0),Ti=Mi?Mi.replace(/\/+$/,""):void 0,Bi=Kt?.previewSprite?.stepSeconds??Kt?.previewSpriteStepSeconds,ir=typeof Bi=="number"&&Number.isFinite(Bi)&&Bi>0?Bi:G_,hi=tu(Kt?.durationSeconds)??tu(_e?.durationSeconds)??tu(st[nt]),Yi=typeof hi=="number"&&hi>0?Math.max(1,Math.min(200,Math.floor(hi/ir)+1)):void 0,Pi=Kt?.previewSprite?.count??Kt?.previewSpriteCount??Yi,ae=Kt?.previewSprite?.cols??Kt?.previewSpriteCols,ke=Kt?.previewSprite?.rows??Kt?.previewSpriteRows,pt=typeof Pi=="number"&&Number.isFinite(Pi)?Math.max(0,Math.floor(Pi)):0,[xt,Rt]=pt>1?K_(pt):[0,0],Et=typeof ae=="number"&&Number.isFinite(ae)?Math.max(0,Math.floor(ae)):xt,Z=typeof ke=="number"&&Number.isFinite(ke)?Math.max(0,Math.floor(ke)):Rt,ce=(typeof Kt?.updatedAtUnix=="number"&&Number.isFinite(Kt.updatedAtUnix)?Kt.updatedAtUnix:void 0)??(typeof Kt?.fileModUnix=="number"&&Number.isFinite(Kt.fileModUnix)?Kt.fileModUnix:void 0)??0,ve=Ti&&ce?`${Ti}?v=${encodeURIComponent(String(ce))}`:Ti||void 0,Me=!!ve&&pt>1,I=Me&&Et>0&&Z>0,U=Me?pt:0,te=Me?ir:0,ye=Me,ge=fe[nt],at=typeof ge=="number"&&U>1?lf(ge/(U-1),0,1):void 0,lt=I&&typeof ge=="number"?(()=>{const Lt=lf(ge,0,Math.max(0,pt-1)),ft=Lt%Et,bt=Math.floor(Lt/Et),Ut=Et<=1?0:ft/(Et-1)*100,Jt=Z<=1?0:bt/(Z-1)*100;return{backgroundImage:`url("${ve}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Et*100}% ${Z*100}%`,backgroundPosition:`${Ut}% ${Jt}%`}})():void 0,ut=mt===nt&&!!Si,Dt=!ut&&!!lt,Yt=ut||Dt;return nr?null: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",Yn&&"pointer-events-none opacity-70",Xt.has(nt)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),onClick:()=>i?.(_e),onKeyDown:Lt=>{(Lt.key==="Enter"||Lt.key===" ")&&i?.(_e)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:()=>{Ce(nt),oi(nt)},onMouseLeave:()=>{Ce(null),oi(null),On(nt),Mt(Lt=>Lt===nt?null:Lt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(wu,{job:_e,getFileName:Lt=>To(_o(Lt)),durationSeconds:st[nt]??_e?.durationSeconds,onDuration:Di,variant:"fill",showPopover:!1,blur:u,animated:Yt?!1:h==="all"?!0:h==="hover"?Je===nt:!1,animatedMode:"teaser",animatedTrigger:"always",muted:Ht,popoverMuted:Ht,scrubProgressRatio:at,preferScrubProgress:typeof ge=="number"})}),I&&ve?c.jsx("img",{src:ve,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Dt&<?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:lt})}):null,ut&&Si?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:Si,alt:"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,ye&&Le===nt?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Lt=>Lt.stopPropagation(),onMouseDown:Lt=>Lt.stopPropagation(),children:c.jsx(xy,{className:"pointer-events-auto px-1",imageCount:U,activeIndex:ge,onActiveIndexChange:Lt=>Fn(nt,Lt),onIndexClick:Lt=>{Fn(nt,Lt),ti(_e,Lt,U)},stepSeconds:te})}):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:[Nt,sn?`${sn.w}×${sn.h}`:Mn||"",Gt].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Nt}),Mn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,Mn?c.jsx("span",{children:Mn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Gt})]})})]})}),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:[vt?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:wt||"—",children:wt||"—"})]})}),c.jsx("div",{className:"mt-2",onClick:Lt=>Lt.stopPropagation(),onMouseDown:Lt=>Lt.stopPropagation(),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(Bs,{job:_e,variant:"table",busy:Yn,collapseToMenu:!0,compact:!0,isHot:vt,isFavorite:Wn,isLiked:Wi,isWatching:Hi,onToggleWatch:g,onToggleFavorite:w,onToggleLike:S,onToggleHot:async Lt=>(await Zn(Lt),!0),onKeep:async Lt=>{try{return await j?.(Lt),!0}catch{return!1}},onDelete:async Lt=>{try{return await C?.(Lt),!0}catch{return!1}},order:["hot","keep","delete"],className:"w-full gap-1.5"})})}),c.jsx("div",{className:"mt-2",onClick:Lt=>Lt.stopPropagation(),onMouseDown:Lt=>Lt.stopPropagation(),children:c.jsx(dd,{rowKey:nt,tags:bi,activeTagSet:new Set,lower:Pe,onToggleTagFilter:()=>{}})})]})]},nt)})})})]})}):null,Ie==="running"?c.jsx("div",{className:"min-h-0",children:c.jsxs("div",{className:"rounded-lg border border-gray-200/70 bg-white/70 p-4 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Laufender Download"}),X?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsx("div",{className:"mt-3",children:X?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):Re.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Kein laufender Job."}):(()=>{const _e=Re[0],nt=ln(_e),Ht=!(!!f&&He===nt),De=_o(_e.output||""),vt=fy(De),wt=To(De)||"—",Nt=V_(_e?.meta),Gt=typeof Nt?.videoWidth=="number"&&typeof Nt?.videoHeight=="number"&&Nt.videoWidth>0&&Nt.videoHeight>0?{w:Nt.videoWidth,h:Nt.videoHeight}:typeof _e?.videoWidth=="number"&&typeof _e?.videoHeight=="number"&&_e.videoWidth>0&&_e.videoHeight>0?{w:_e.videoWidth,h:_e.videoHeight}:null,Kt=hd(Gt),sn=ni(_e),Mn=Ci(di(_e)),Yn=Xn,nr=of(tn,yt),Wi=To(_o(_e.output||"")).replace(/\.[^.]+$/,"").trim(),Hi=of(Nt?.previewSprite?.path,Nt?.previewSpritePath,Wi?`/api/preview-sprite/${encodeURIComponent(Wi)}`:void 0),bi=Hi?Hi.replace(/\/+$/,""):void 0,Si=Nt?.previewSprite?.stepSeconds??Nt?.previewSpriteStepSeconds,Xi=typeof Si=="number"&&Number.isFinite(Si)&&Si>0?Si:G_,ii=tu(Nt?.durationSeconds)??tu(_e?.durationSeconds)??tu(st[nt]),Mi=typeof ii=="number"&&ii>0?Math.max(1,Math.min(200,Math.floor(ii/Xi)+1)):void 0,Ti=Nt?.previewSprite?.count??Nt?.previewSpriteCount??Mi,Bi=Nt?.previewSprite?.cols??Nt?.previewSpriteCols,ir=Nt?.previewSprite?.rows??Nt?.previewSpriteRows,hi=typeof Ti=="number"&&Number.isFinite(Ti)?Math.max(0,Math.floor(Ti)):0,[Yi,Pi]=hi>1?K_(hi):[0,0],ae=typeof Bi=="number"&&Number.isFinite(Bi)?Math.max(0,Math.floor(Bi)):Yi,ke=typeof ir=="number"&&Number.isFinite(ir)?Math.max(0,Math.floor(ir)):Pi,pt=(typeof Nt?.updatedAtUnix=="number"&&Number.isFinite(Nt.updatedAtUnix)?Nt.updatedAtUnix:void 0)??(typeof Nt?.fileModUnix=="number"&&Number.isFinite(Nt.fileModUnix)?Nt.fileModUnix:void 0)??0,xt=bi&&pt?`${bi}?v=${encodeURIComponent(String(pt))}`:bi||void 0,Rt=!!xt&&hi>1,Et=Rt&&ae>0&&ke>0,Z=Rt?hi:0,ce=fe[nt],ve=typeof ce=="number"&&Z>1?lf(ce/(Z-1),0,1):void 0,Me=Et&&typeof ce=="number"?(()=>{const ge=lf(ce,0,Math.max(0,hi-1)),at=ge%ae,lt=Math.floor(ge/ae),ut=ae<=1?0:at/(ae-1)*100,Dt=ke<=1?0:lt/(ke-1)*100;return{backgroundImage:`url("${xt}")`,backgroundRepeat:"no-repeat",backgroundSize:`${ae*100}% ${ke*100}%`,backgroundPosition:`${ut}% ${Dt}%`}})():void 0,I=mt===nt&&!!nr,te=I||!I&&!!Me,ye=wg(_e);return c.jsx("div",{className:"w-full",children:c.jsxs("div",{className:si("group relative overflow-hidden rounded-lg outline-1 outline-black/5","bg-white shadow-sm backdrop-blur","dark:-outline-offset-1 dark:outline-white/10 dark:bg-gray-900/40"),children:[c.jsx("div",{role:i?"button":void 0,tabIndex:i?0:void 0,className:si("group/thumb relative w-full bg-black/5 dark:bg-white/5","aspect-video sm:aspect-[21/9]",i?"cursor-pointer":""),onClick:()=>i?.(_e),onKeyDown:ge=>{i&&(ge.key==="Enter"||ge.key===" ")&&i(_e)},onMouseEnter:()=>{Be(!0),Ce(nt),oi(nt)},onMouseLeave:()=>{Be(!1),Ce(null),oi(null),On(nt),Mt(ge=>ge===nt?null:ge)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[ye?null:c.jsx("div",{className:"absolute inset-0",children:c.jsx(wu,{job:_e,getFileName:ge=>To(_o(ge)),durationSeconds:st[nt]??_e?.durationSeconds,onDuration:Di,variant:"fill",showPopover:!1,blur:u,animated:te?!1:h==="all"?!0:h==="hover"?Je===nt:!1,animatedMode:"teaser",animatedTrigger:"always",muted:Ht,popoverMuted:Ht,scrubProgressRatio:ve,preferScrubProgress:typeof ce=="number"})}),ye?c.jsxs("div",{className:"absolute inset-0 z-10",children:[c.jsx(ab,{src:`/api/preview/live?id=${encodeURIComponent(String(_e?.id??""))}&hover=1`,className:"absolute inset-0 w-full h-full",muted:!0}),c.jsxs("div",{className:"absolute left-2 top-2 z-20 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"]})]}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-20 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",children:c.jsx("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:[sn,Gt?`${Gt.w}×${Gt.h}`:Kt||"",Mn].filter(Boolean).join(" • "),children:c.jsx("span",{children:Mn})})})]})}),c.jsxs("div",{className:"relative px-4 py-3 border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[vt?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:wt,children:wt})]}),c.jsxs("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:["Start:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:$c(_e?.startedAt)})," · ","Status:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:String(_e?.status??"running")})]})]}),c.jsx("div",{className:"mt-2",onClick:ge=>ge.stopPropagation(),onMouseDown:ge=>ge.stopPropagation(),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(hn,{variant:"primary",color:"red",size:"sm",rounded:"md",className:"w-full shadow-none",disabled:!k||!wg(_e)||Ve,title:Ve?"Stoppe…":"Stop","aria-label":Ve?"Stoppe…":"Stop",onClick:async ge=>{if(ge.preventDefault(),ge.stopPropagation(),!!k&&wg(_e)&&!Ve)try{Oe(!0),await k(String(_e?.id??""))}finally{Oe(!1)}},children:Ve?"Stoppe…":"Stoppen"})})}),c.jsx("div",{className:"mt-2",onClick:ge=>ge.stopPropagation(),onMouseDown:ge=>ge.stopPropagation(),children:c.jsx(dd,{rowKey:nt,tags:Yn,activeTagSet:new Set,lower:Pe,onToggleTagFilter:()=>{}})})]})]})})})()})]})}):null]}),c.jsx(kf,{open:!!pe,onClose:()=>we(null),title:pe?.alt||"Bild",width:"max-w-4xl",layout:"single",scroll:"body",footer:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[pe?.src?c.jsxs("a",{href:pe.src,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg border border-gray-200/70 bg-white/70 px-3 py-1.5 text-xs font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white dark:border-white/10 dark:bg-white/5 dark:text-white",children:[c.jsx(Kh,{className:"size-4"}),"In neuem Tab"]}):null,c.jsx(hn,{variant:"secondary",onClick:()=>we(null),children:"Schließen"})]}),children:c.jsx("div",{className:"grid place-items-center",children:pe?.src?c.jsx("img",{src:pe.src,alt:pe.alt||"",className:si("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",af(u))}):null})})]})}const uf=n=>Math.max(0,Math.min(1,n));function cf(n){return n==="good"?"bg-emerald-500":n==="warn"?"bg-amber-500":"bg-red-500"}function T6(n){return n==null?"–":`${Math.round(n)}ms`}function W_(n){return n==null?"–":`${Math.round(n)}%`}function Tg(n){if(n==null||!Number.isFinite(n)||n<=0)return"–";const e=["B","KB","MB","GB","TB"];let t=n,i=0;for(;t>=1024&&i<e.length-1;)t/=1024,i++;const a=i===0?0:t>=10?1:2;return`${t.toFixed(a)} ${e[i]}`}function k6(n=1e3){const[e,t]=fn.useState(null);return fn.useEffect(()=>{let i=0,a=performance.now(),l=0,u=!0,h=!1;const f=A=>{if(!u||!h)return;l+=1;const C=A-a;if(C>=n){const j=Math.round(l*1e3/C);t(j),l=0,a=A}i=requestAnimationFrame(f)},g=()=>{u&&(document.hidden||h||(h=!0,a=performance.now(),l=0,i=requestAnimationFrame(f)))},w=()=>{h=!1,cancelAnimationFrame(i)},S=()=>{document.hidden?w():g()};return g(),document.addEventListener("visibilitychange",S),()=>{u=!1,document.removeEventListener("visibilitychange",S),w()}},[n]),e}function X_({mode:n="inline",className:e,pollMs:t=3e3}){const i=k6(1e3),[a,l]=fn.useState(null),[u,h]=fn.useState(null),[f,g]=fn.useState(null),[w,S]=fn.useState(null),[A,C]=fn.useState(null),j=5*1024*1024*1024,k=8*1024*1024*1024,B=fn.useRef(!1);fn.useEffect(()=>{const Q=`/api/perf/stream?ms=${encodeURIComponent(String(t))}`,ue=Mw(Q,"perf",se=>{const $=typeof se?.cpuPercent=="number"?se.cpuPercent:null,F=typeof se?.diskFreeBytes=="number"?se.diskFreeBytes:null,X=typeof se?.diskTotalBytes=="number"?se.diskTotalBytes:null,le=typeof se?.diskUsedPercent=="number"?se.diskUsedPercent:null;h($),g(F),S(X),C(le);const de=typeof se?.serverMs=="number"?se.serverMs:null;l(de!=null?Math.max(0,Date.now()-de):null)});return()=>ue()},[t]);const V=a==null?"bad":a<=120?"good":a<=300?"warn":"bad",W=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",H=u==null?"bad":u<=60?"good":u<=85?"warn":"bad",ie=uf((a??999)/500),Y=uf((i??0)/60),G=uf((u??0)/100),O=f!=null&&w!=null&&w>0?f/w:null,re=A??(O!=null?(1-O)*100:null),E=uf((re??0)/100);f==null?B.current=!1:B.current?f>=k&&(B.current=!1):f<=j&&(B.current=!0);const R=f==null||B.current||O==null?"bad":O>=.15?"good":O>=.07?"warn":"bad",ee=f==null?"Disk: –":`Free: ${Tg(f)} / Total: ${Tg(w)} · Used: ${W_(re)}`,q=n==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return c.jsx("div",{className:`${q} ${e??""}`,children:c.jsxs("div",{className:`\r
|
||
rounded-lg border border-gray-200/70 bg-white/70 px-2.5 py-1.5 shadow-sm backdrop-blur\r
|
||
dark:border-white/10 dark:bg-white/5\r
|
||
grid grid-cols-2 gap-x-3 gap-y-2\r
|
||
sm:flex sm:items-center sm:gap-3\r
|
||
`,children:[c.jsxs("div",{className:"flex items-center gap-2",title:ee,children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Disk"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${cf(R)}`,style:{width:`${Math.round(E*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:Tg(f)})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"Ping"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${cf(V)}`,style:{width:`${Math.round(ie*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:T6(a)})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"FPS"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${cf(W)}`,style:{width:`${Math.round(Y*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-8 tabular-nums text-gray-900 dark:text-gray-100",children:i??"–"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"CPU"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${cf(H)}`,style:{width:`${Math.round(G*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:W_(u)})]})]})})}async function kg(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function E6(n,e,t,i){const a=`/api/generated/cover?category=${encodeURIComponent(n)}`,l=e?`&v=${e}`:"",u="",h=i&&i.trim()?`&model=${encodeURIComponent(i.trim())}`:"";return`${a}${l}${u}${h}`}function Y_(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function Ok(n){return String(n||"").replaceAll("\\","/").split("/").pop()||""}function Lk(n){return n.toUpperCase().startsWith("HOT ")?n.slice(4).trim():n}function C6(n){const e=Lk(Ok(n||""));return e?e.replace(/\.[^.]+$/,""):""}const A6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Eg(n){const t=Lk(Ok(n)).replace(/\.[^.]+$/,""),i=t.match(A6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a).trim():t?t.trim():null}function N6(n){const e=C6(n);return e?`/generated/meta/${encodeURIComponent(e)}/preview.webp`:null}async function D6(n,e,t,i){const a=(t||"").trim(),l=`/api/generated/cover?category=${encodeURIComponent(n)}&src=${encodeURIComponent(e)}`+(a?`&model=${encodeURIComponent(a)}`:"")+"&refresh=1",u=await fetch(l,{method:"GET",cache:"no-store"});if(!u.ok){const h=await u.text().catch(()=>"");throw new Error(h||`ensureCover failed: HTTP ${u.status}`)}}function M6(){const[n,e]=m.useState([]),[t,i]=m.useState(!1),[a,l]=m.useState(null),[u,h]=m.useState(()=>Date.now()),[f,g]=m.useState({}),[w,S]=m.useState({}),[A,C]=m.useState(!1),[j,k]=m.useState(null),[B,V]=m.useState({}),W=m.useRef(null),H=m.useRef({}),ie=m.useCallback((E,R)=>{const ee={};for(const Q of Array.isArray(E)?E:[]){const ue=String(Q?.modelKey??"").trim().toLowerCase();if(!ue)continue;const se=Y_(Q?.tags).map($=>$.toLowerCase());se.length&&(ee[ue]=se)}const q={};for(const Q of Array.isArray(R)?R:[]){const ue=String(Q?.output??"");if(!ue)continue;const se=(Eg(ue)||"").trim().toLowerCase();if(!se)continue;const $=ee[se];if(!(!$||$.length===0))for(const F of $)F&&(q[F]||(q[F]=[]),q[F].push(ue))}for(const[Q,ue]of Object.entries(q))q[Q]=Array.from(new Set(ue));H.current=q},[]),Y=m.useCallback(E=>{const R=String(E||"").trim();if(R){try{localStorage.setItem("finishedDownloads_pendingTags",JSON.stringify([R]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"finished"}})),window.dispatchEvent(new CustomEvent("finished-downloads:tag-filter",{detail:{tags:[R],mode:"replace"}}))}},[]),G=m.useCallback(E=>{const R=String(E||"").trim();if(R){try{localStorage.setItem("models_pendingTags",JSON.stringify([R]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"models"}})),window.dispatchEvent(new CustomEvent("models:set-tag-filter",{detail:{tags:[R]}}))}},[]),O=m.useCallback(async()=>{W.current?.abort();const E=new AbortController;W.current=E,i(!0),l(null);try{const[R,ee]=await Promise.all([kg("/api/models",{cache:"no-store",signal:E.signal}),kg("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:E.signal})]),q=Array.isArray(ee?.items)?ee.items:Array.isArray(ee)?ee:[];ie(Array.isArray(R)?R:[],q);const Q=new Map;for(const le of Array.isArray(R)?R:[])for(const de of Y_(le?.tags)){const L=de.toLowerCase();Q.set(L,(Q.get(L)??0)+1)}const ue=H.current||{},se=Array.from(Q.entries()).map(([le,de])=>({tag:le,modelsCount:de,downloadsCount:(ue[le]||[]).length})).sort((le,de)=>le.tag.localeCompare(de.tag,void 0,{sensitivity:"base"})),$=new Map;try{const le=await kg("/api/generated/coverinfo/list",{cache:"no-store",signal:E.signal});for(const de of Array.isArray(le)?le:[]){const L=String(de?.category??"").trim().toLowerCase();L&&$.set(L,de)}}catch{}const F={};for(const le of se){const de=$.get(le.tag);F[le.tag]=!!de?.hasCover}S(F);const X={};for(const le of se){const L=(ue[le.tag]||[])[0]||"";let pe=L?Eg(L):null;if(!pe){const we=$.get(le.tag);we?.hasCover&&we.model?.trim()&&(pe=we.model.trim())}pe&&(X[le.tag]=pe)}V(X),g(le=>{const de={};for(const L of se){const pe=le[L.tag];pe&&F[L.tag]===!0&&(de[L.tag]=pe)}return de}),e(se)}catch(R){if(R?.name==="AbortError")return;l(R?.message??String(R)),e([]),H.current={},V({}),S({}),g({})}finally{W.current===E&&(W.current=null,i(!1))}},[ie]);m.useEffect(()=>(O(),()=>{W.current?.abort()}),[O]);const re=m.useCallback(async()=>{if(!A){C(!0),l(null),k({done:0,total:n.length});try{const E=H.current||{},R=await Promise.all(n.map(async q=>{try{const Q=E[q.tag]||[];if(Q.length===0)return{tag:q.tag,ok:!0,status:0,text:"skipped (no candidates)"};const ue=Q[Math.floor(Math.random()*Q.length)],se=N6(ue);if(!se)return{tag:q.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const $=Eg(ue);return await D6(q.tag,se,$,!0),S(F=>({...F,[q.tag]:!0})),V(F=>{const X={...F};return $?.trim()?X[q.tag]=$.trim():delete X[q.tag],X}),g(F=>{const X={...F};return delete X[q.tag],X}),{tag:q.tag,ok:!0,status:200,text:""}}catch(Q){return{tag:q.tag,ok:!1,status:0,text:Q?.message??String(Q)}}finally{k(Q=>Q&&{...Q,done:Math.min(Q.total,Q.done+1)})}})),ee=R.filter(q=>!q.ok);if(ee.length){console.warn("Cover renew failed:",ee.slice(0,20));const q=ee.slice(0,8).map(Q=>`${Q.tag} (ERR)`).join(", ");l(`Covers fehlgeschlagen: ${ee.length}/${R.length} — z.B.: ${q}`)}else l(null)}finally{h(Date.now()),C(!1),setTimeout(()=>k(null),400)}}},[n,A]);return c.jsxs(Is,{header:c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:["Kategorien ",c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["(",n.length,")"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[j?c.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300 tabular-nums",children:["Covers: ",j.done,"/",j.total]}),c.jsx("div",{className:"h-2 w-28 rounded-full bg-gray-200 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:"h-full bg-indigo-500",style:{width:j.total>0?`${Math.round(j.done/j.total*100)}%`:"0%"}})})]}):null,c.jsx(hn,{variant:"secondary",size:"md",onClick:re,disabled:t||A,children:"Cover erneuern"}),c.jsx(hn,{variant:"secondary",size:"md",onClick:O,disabled:t||A,children:"Aktualisieren"})]})]}),grayBody:!0,children:[a?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:a}):null,n.length===0&&!t?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Kategorien/Tags gefunden."}):null,c.jsx("div",{className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:n.map(E=>{const R=B[E.tag]??null,ee=w[E.tag]===!0,q=Object.prototype.hasOwnProperty.call(w,E.tag),Q=ee?E6(E.tag,u,!1,R):"",ue=f[E.tag]==="ok",se=f[E.tag]==="error";return c.jsxs("button",{type:"button",onClick:()=>Y(E.tag),className:gn("group text-left rounded-2xl overflow-hidden transition","bg-white/70 dark:bg-white/[0.06]","border border-gray-200/70 dark:border-white/10","shadow-sm hover:shadow-md","hover:-translate-y-[1px]","hover:bg-white dark:hover:bg-white/[0.09]","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/70 focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-gray-950"),title:"In FinishedDownloads öffnen (Tag-Filter setzen)",children:[c.jsx("div",{className:"relative w-full overflow-hidden aspect-[16/9] bg-gray-100/70 dark:bg-white/5",children:q?ee?se?c.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),c.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[c.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Cover konnte nicht geladen werden"}),c.jsx("div",{className:"mt-1 flex justify-center",children:c.jsx("span",{className:`text-[11px] inline-flex items-center rounded-full bg-indigo-50 px-2 py-1 font-semibold text-indigo-700 ring-1 ring-indigo-100 hover:bg-indigo-100\r
|
||
dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20 dark:hover:bg-indigo-500/20`,onClick:$=>{$.preventDefault(),$.stopPropagation(),g(F=>{const X={...F};return delete X[E.tag],X}),h(Date.now())},children:"Retry"})})]})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 z-[1] pointer-events-none",style:{background:"linear-gradient(to bottom, rgba(255,255,255,0.10), rgba(255,255,255,0) 35%),linear-gradient(to top, rgba(0,0,0,0.35), rgba(0,0,0,0) 45%)"}}),c.jsx("img",{src:Q,alt:"","aria-hidden":"true",className:"absolute inset-0 z-0 h-full w-full object-cover blur-xl scale-110 opacity-60",loading:"lazy"}),c.jsx("img",{src:Q,alt:E.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>g($=>({...$,[E.tag]:"ok"})),onError:()=>{g($=>({...$,[E.tag]:"error"})),S($=>({...$,[E.tag]:!1}))}}),ue&&R?c.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:c.jsx("div",{className:gn("truncate rounded-full px-2.5 py-1 text-[11px] font-semibold","bg-black/40 text-white backdrop-blur-md","ring-1 ring-white/15"),children:R})}):null]}):c.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.25), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.18), transparent 55%)"}}),c.jsxs("div",{className:"relative z-10 rounded-xl bg-white/80 dark:bg-black/30 px-3 py-2.5 shadow-sm ring-1 ring-black/5 dark:ring-white/10 backdrop-blur-md",children:[c.jsx("div",{className:"text-xs font-semibold text-gray-900 dark:text-white",children:"Kein Cover vorhanden"}),R?c.jsxs("div",{className:"mt-0.5 text-[11px] text-gray-700 dark:text-gray-300",children:["Model: ",c.jsx("span",{className:"font-semibold",children:R})]}):null,c.jsx("div",{className:"mt-1 text-[11px] text-gray-600 dark:text-gray-400 text-center",children:"(Kein Request / keine 404)"})]})]}):c.jsxs("div",{className:"absolute inset-0",children:[c.jsx("div",{className:"absolute inset-0 opacity-70",style:{background:"radial-gradient(circle at 30% 20%, rgba(99,102,241,0.20), transparent 55%),radial-gradient(circle at 70% 80%, rgba(14,165,233,0.14), transparent 55%)"}}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/20 to-transparent"}),c.jsx("div",{className:"absolute left-3 bottom-3 text-[11px] font-semibold text-white/80 bg-black/30 px-2.5 py-1 rounded-full ring-1 ring-white/10",children:"Cover wird geprüft…"})]})}),c.jsx("div",{className:"px-4 py-3.5",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-semibold text-gray-900 dark:text-white truncate tracking-tight",children:E.tag}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{role:"button",tabIndex:0,className:gn("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap","overflow-hidden","bg-indigo-50 text-indigo-700 ring-1 ring-indigo-100","dark:bg-indigo-500/10 dark:text-indigo-200 dark:ring-indigo-500/20","cursor-pointer"),title:"FinishedDownloads nach diesem Tag filtern",onClick:$=>{$.preventDefault(),$.stopPropagation(),Y(E.tag)},onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),$.stopPropagation(),Y(E.tag))},children:[c.jsx("span",{className:"shrink-0",children:E.downloadsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Downloads"})]}),c.jsxs("span",{role:"button",tabIndex:0,className:gn("inline-flex max-w-full items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold","tabular-nums whitespace-nowrap overflow-hidden","bg-gray-50 text-gray-700 ring-1 ring-gray-200","dark:bg-white/5 dark:text-gray-200 dark:ring-white/10","cursor-pointer"),title:"Models nach diesem Tag filtern",onClick:$=>{$.preventDefault(),$.stopPropagation(),G(E.tag)},onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),$.stopPropagation(),G(E.tag))},children:[c.jsx("span",{className:"shrink-0",children:E.modelsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Models"})]})]})]}),c.jsx("span",{"aria-hidden":"true",className:gn("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},E.tag)})})]})}async function qc(n,e){const t=await fetch(n,{credentials:"include",...e});if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}function R6(){try{const e=new URL(window.location.href).searchParams.get("next")||"/";return!e.startsWith("/")||e.startsWith("/login")?"/":e}catch{return"/"}}const ub="recorder_login_state_v1";function j6(){try{const n=sessionStorage.getItem(ub);if(!n)return null;const e=JSON.parse(n);return!e?.ts||Date.now()-e.ts>900*1e3?null:e}catch{return null}}function O6(n){try{sessionStorage.setItem(ub,JSON.stringify(n))}catch{}}function df(){try{sessionStorage.removeItem(ub)}catch{}}function L6(n){const t=(n??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function I6(n){return(n??[]).join("")}function B6({onLoggedIn:n}){const e=m.useMemo(()=>R6(),[]),[t,i]=m.useState(""),[a,l]=m.useState(""),[u,h]=m.useState(["","","","","",""]),f=m.useRef([]),[g,w]=m.useState(!1),[S,A]=m.useState(null),[C,j]=m.useState("login"),[k,B]=m.useState(null),[V,W]=m.useState(null),[H,ie]=m.useState(null),Y=m.useRef(!1),G=m.useMemo(()=>I6(u),[u]);function O(F){const X=f.current[F];X&&X.focus()}function re(){h(["","","","","",""]),Y.current=!1,window.setTimeout(()=>O(0),0)}function E(F,X){const le=(X??"").replace(/\D/g,"").slice(-1);h(de=>{const L=[...de];return L[F]=le,L})}function R(F,X){const le=(X??"").replace(/\D/g,"");if(!le){E(F,""),Y.current=!1;return}if(le.length>1){h(de=>{const L=[...de];let pe=F;for(const we of le){if(pe>5)break;L[pe]=we,pe++}return L}),Y.current=!1,window.setTimeout(()=>O(Math.min(5,F+le.length)),0);return}E(F,le),Y.current=!1,F<5&&window.setTimeout(()=>O(F+1),0)}function ee(F,X){if(X.key==="Backspace"){if(u[F]){X.preventDefault(),E(F,""),Y.current=!1;return}F>0&&(X.preventDefault(),O(F-1),E(F-1,""),Y.current=!1);return}if(X.key==="ArrowLeft"){X.preventDefault(),F>0&&O(F-1);return}if(X.key==="ArrowRight"){X.preventDefault(),F<5&&O(F+1);return}}function q(F,X){const de=(X.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);de&&(X.preventDefault(),h(L=>{const pe=[...L];let we=F;for(const Be of de){if(we>5)break;pe[we]=Be,we++}return pe}),Y.current=!1,window.setTimeout(()=>O(Math.min(5,F+de.length)),0))}m.useEffect(()=>{const F=j6();F&&(j(F.stage??"login"),i(F.username??""),h(L6(F.code??"")),B(F.setupAuthUrl??null),W(F.setupSecret??null),ie(F.setupInfo??null))},[]),m.useEffect(()=>{O6({stage:C,username:t,code:G,setupAuthUrl:k,setupSecret:V,setupInfo:H,ts:Date.now()})},[C,t,G,k,V,H]),m.useEffect(()=>{Y.current=!1,(C==="verify"||C==="setup")&&window.setTimeout(()=>O(0),0)},[C]),m.useEffect(()=>{let F=!1;return(async()=>{try{const le=await qc("/api/auth/me",{cache:"no-store"});if(F)return;if(le?.authenticated){le?.totpConfigured?(df(),window.location.assign(e||"/")):(j("setup"),se());return}if(le?.pending2fa){j("verify");return}j("login")}catch{}})(),()=>{F=!0}},[e]);const Q=async()=>{w(!0),A(null);try{if((await qc("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:a})}))?.totpRequired){j("verify"),re();return}const X=await qc("/api/auth/me",{cache:"no-store"});if(X?.authenticated&&!X?.totpConfigured){j("setup"),re(),await se();return}n&&await n(),df(),window.location.assign(e||"/")}catch(F){A(F?.message??String(F))}finally{w(!1)}},ue=async()=>{const F=G.trim();if(/^\d{6}$/.test(F)){w(!0),A(null);try{await qc("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:F})}),n&&await n(),df(),window.location.assign(e||"/")}catch(X){Y.current=!1,A(X?.message??String(X))}finally{w(!1)}}},se=async()=>{A(null),ie(null);try{const F=await qc("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),X=(F?.otpauth??"").trim();if(!X)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");B(X),W((F?.secret??"").trim()||null),ie("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(F){A(F?.message??String(F))}};m.useEffect(()=>{g||C!=="verify"&&C!=="setup"||/^\d{6}$/.test(G)&&(Y.current||(Y.current=!0,ue()))},[G,C,g]);const $=c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"2FA Code"}),c.jsx("div",{className:"flex items-center justify-between gap-2",children:u.map((F,X)=>c.jsx("input",{ref:le=>{f.current[X]=le},value:F,onChange:le=>R(X,le.target.value),onKeyDown:le=>ee(X,le),onPaste:le=>q(X,le),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:X===0?"one-time-code":"off",enterKeyHint:X===5?"done":"next",autoCapitalize:"none",autoCorrect:"off",disabled:g,className:`h-12 w-12 rounded-lg text-center text-lg tabular-nums bg-white text-gray-900 shadow-sm 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`,"aria-label":`2FA Ziffer ${X+1}`},X))})]});return c.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[c.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),c.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),c.jsx("div",{className:"relative grid min-h-[100dvh] place-items-center px-4",children:c.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-gray-200/70 bg-white/80 p-6 shadow-sm backdrop-blur dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Recorder Login"}),c.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Bitte melde dich an, um fortzufahren."})]}),c.jsxs("div",{className:"mt-5 space-y-3",children:[C==="login"?c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&Q()},className:"space-y-3",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Username"}),c.jsx("input",{value:t,onChange:F=>i(F.target.value),autoComplete:"username",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"admin",disabled:g})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Passwort"}),c.jsx("input",{type:"password",value:a,onChange:F=>l(F.target.value),autoComplete:"current-password",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"••••••••••",disabled:g})]}),c.jsx(hn,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:g||!t.trim()||!a,children:g?"Login…":"Login"})]}):C==="verify"?c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&ue()},className:"space-y-3",children:[c.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:"2FA ist aktiv – bitte gib den Code aus deiner Authenticator-App ein."}),$,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(hn,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{j("login"),re()},children:"Zurück"}),c.jsx(hn,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(G),children:g?"Prüfe…":"Bestätigen"})]})]}):c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&ue()},className:"space-y-3",children:[c.jsx("div",{className:"rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-2 text-sm text-indigo-900 dark:border-indigo-500/30 dark:bg-indigo-500/10 dark:text-indigo-200",children:"2FA ist noch nicht eingerichtet – bitte richte es jetzt ein (empfohlen)."}),c.jsxs("div",{className:"space-y-2 text-sm text-gray-700 dark:text-gray-200",children:[c.jsx("div",{children:"1) Öffne deine Authenticator-App und füge einen neuen Account hinzu."}),c.jsx("div",{children:"2) Scanne den QR-Code oder verwende den Secret-Key."})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-white/70 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsx("div",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"QR / Setup"}),k?c.jsx("div",{className:"mt-2 flex items-center justify-center",children:c.jsx("img",{alt:"2FA QR Code",className:"h-44 w-44 rounded bg-white p-2",src:`https://api.qrserver.com/v1/create-qr-code/?size=220x220&data=${encodeURIComponent(k)}`})}):c.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-300",children:"QR wird geladen…"}),V?c.jsxs("div",{className:"mt-3",children:[c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Secret (manuell):"}),c.jsx("div",{className:"mt-1 select-all break-all rounded bg-gray-100 px-2 py-1 text-xs font-mono text-gray-900 dark:bg-white/10 dark:text-gray-100",children:V})]}):null,H?c.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:H}):null,c.jsx("div",{className:"mt-3",children:c.jsx(hn,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:g,onClick:()=>{se()},title:"Setup-Infos neu laden",children:k?"QR/Setup erneut laden":"QR/Setup laden"})})]}),$,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(hn,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{n&&n(),df(),window.location.assign(e||"/")},title:"Ohne 2FA fortfahren (nicht empfohlen)",children:"Später"}),c.jsx(hn,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(G),children:g?"Aktiviere…":"2FA aktivieren"})]})]}),S?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:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx("div",{className:"min-w-0 break-words",children:S}),c.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>A(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null]})]})})]})}const Cg="record_cookies";function hf(n){return Object.fromEntries(Object.entries(n??{}).map(([t,i])=>[t.trim().toLowerCase(),String(i??"").trim()]).filter(([t,i])=>t.length>0&&i.length>0))}async function lr(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const Q_={recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!1,autoStartAddedDownloads:!1,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!1,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:3e3};function nu(n){switch(String(n??"").trim().toLowerCase()){case"public":return"public";case"private":return"private";case"hidden":return"hidden";case"away":return"away";case"offline":return"offline";default:return"unknown"}}function _s(n){let e=(n??"").trim();if(!e)return null;e=e.replace(/^[("'[{<]+/,"").replace(/[)"'\]}>.,;:]+$/,""),/^https?:\/\//i.test(e)||(e=`https://${e}`);try{const t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.toString()}catch{return null}}function nl(n){const e=(n??"").trim();if(!e)return null;for(const t of e.split(/\s+/g)){const i=_s(t);if(i)return i}return null}function ud(n){try{const e=new URL(n).hostname.replace(/^www\./i,"").toLowerCase();return e==="chaturbate.com"||e.endsWith(".chaturbate.com")?"chaturbate":e==="myfreecams.com"||e.endsWith(".myfreecams.com")?"mfc":null}catch{return null}}function Ik(n){try{const e=new URL(n),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="chaturbate.com"&&!t.endsWith(".chaturbate.com"))return"";const i=e.pathname.split("/").filter(Boolean);return i[0]?decodeURIComponent(i[0]).trim():""}catch{return""}}function Os(n){const e=ud(n);if(!e)return n;if(e==="chaturbate"){const i=Ik(n);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:n}const t=Bk(n);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:n}function yf(n){const e=ud(n);return e?((e==="chaturbate"?Ik(n):Bk(n))||"").trim().toLowerCase():""}function Bk(n){try{const e=new URL(n),t=e.hostname.replace(/^www\./i,"").toLowerCase();if(t!=="myfreecams.com"&&!t.endsWith(".myfreecams.com"))return"";const i=(e.hash||"").replace(/^#\/?/,"");if(i){const u=i.split("/").filter(Boolean),h=u[u.length-1]||"";if(h)return decodeURIComponent(h).trim()}const a=e.pathname.split("/").filter(Boolean),l=a[a.length-1]||"";return l?decodeURIComponent(l).trim():""}catch{return""}}const Ni=n=>(n||"").replaceAll("\\","/").split("/").pop()||"";function P6(n,e){const i=(n||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function F6(n){return n.startsWith("HOT ")?n.slice(4):n}const U6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function z6(n){const e=String(n?.sourceUrl??"").trim(),t=_s(e),i=t?Os(t):"",a=yf(i);return a||(ru(n?.output||"")||"").trim().toLowerCase()}function ru(n){const t=F6(Ni(n)).replace(/\.[^.]+$/,""),i=t.match(U6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function H6(){const[n,e]=m.useState(!1),[t,i]=m.useState(!1),a=m.useRef(null),l=Pw(),u=m.useRef(l),h=m.useRef(0),f=m.useRef(null),g=m.useRef(!1),w=m.useRef(!1),S=m.useRef(0),A=m.useRef(null),C=m.useRef(0),[j,k]=m.useState(null),B=m.useRef(null),[V,W]=m.useState(null),[H,ie]=m.useState(null),[Y,G]=m.useState(!1),[O,re]=m.useState(!1),[E,R]=m.useState({}),[ee,q]=m.useState(!1),[Q,ue]=m.useState("running"),[se,$]=m.useState(null),[F,X]=m.useState(!1),[le,de]=m.useState(null),[L,pe]=m.useState(0),we=m.useCallback(()=>pe(I=>I+1),[]),[Be,Ve]=m.useState(Q_),Oe=!!Be.autoAddToDownloadList,Te=!!Be.autoStartAddedDownloads,[_t,dt]=m.useState([]),[xe,Ne]=m.useState({}),Se=m.useRef(!1),Ie=m.useRef({}),$e=m.useRef([]),Ct=m.useRef({}),st=m.useRef(!1),gt=I=>(I||"").toLowerCase().trim(),He=m.useRef(null),We=m.useRef(new Set),Je=m.useRef(null),et=m.useCallback(()=>{const I=a.current;I&&(I.focus(),requestAnimationFrame(()=>I.select()))},[]),mt=m.useCallback(async()=>{try{const I=await lr("/api/auth/me",{cache:"no-store"});i(!!I?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),Mt=m.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),ie(null),G(!1),ue("running"),$(null),X(!1),W(null),tt([]),P([]),yt(0),Re(1),Bt({}),un(0),Ct.current={},st.current=!1,dt([]),Ne({}),St("")}},[]);m.useEffect(()=>{mt()},[mt]);const fe=I=>{const U=(I||"").toLowerCase();return U.includes("altersverifikationsseite erhalten")||U.includes("verify your age")||U.includes("schutzseite von cloudflare erhalten")||U.includes("just a moment")||U.includes("kein room-html")},qe=I=>{const U=!!I?.silent,te="Cookies fehlen oder sind abgelaufen",ye="Der Recorder hat statt des Room-HTML eine Schutz-/Altersverifikationsseite erhalten. Bitte Cookies aktualisieren (bei Chaturbate z.B. cf_clearance + sessionId) und erneut starten.";if(!U){ie(`⚠️ ${te}. ${ye}`),re(!0);return}const ge=Date.now();ge-h.current>15e3&&(h.current=ge,u.current?.error(te,ye))};m.useEffect(()=>{u.current=l},[l]);const[Le,Ce]=m.useState(!1);m.useEffect(()=>{const I=window,U=typeof I.requestIdleCallback=="function"?I.requestIdleCallback(()=>Ce(!0),{timeout:1500}):window.setTimeout(()=>Ce(!0),800);return()=>{typeof I.cancelIdleCallback=="function"?I.cancelIdleCallback(U):window.clearTimeout(U)}},[]);const Pe=8,Qe="finishedDownloads_sort",[At,Xt]=m.useState(()=>{try{return window.localStorage.getItem(Qe)||"completed_desc"}catch{return"completed_desc"}}),kt=(I,U)=>`${U}::${I}`,mn=m.useCallback(async I=>{if(I<1||g.current)return;const U=kt(I,At),te=f.current;if(!(te?.key===U&&Date.now()-te.ts<15e3)){g.current=!0;try{const ye=await fetch(`/api/record/done?page=${I}&pageSize=${Pe}&sort=${encodeURIComponent(At)}`,{cache:"no-store"});if(!ye.ok)return;const ge=await ye.json().catch(()=>null),at=Array.isArray(ge?.items)?ge.items:Array.isArray(ge)?ge:[];f.current={key:U,items:at,ts:Date.now()}}finally{g.current=!1}}},[At]),It=m.useCallback(async()=>{const I=Date.now();if(!w.current&&!(I-S.current<500)){w.current=!0,S.current=I;try{const U=await fetch("/api/record/done/meta",{cache:"no-store"});if(!U.ok)return;const te=await U.json().catch(()=>null),ye=Number(te?.count??0),ge=Number.isFinite(ye)&&ye>=0?ye:0;yt(ge),xn(Date.now())}catch{}finally{w.current=!1}}},[]),$t=m.useCallback((I="unknown")=>{const U=Date.now(),te=700;if(wt.current!=="finished"||A.current!=null)return;const ye=U-C.current;if(ye<te){A.current=window.setTimeout(()=>{A.current=null,C.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload(cooldown-tail)",reason:I}}))},te-ye);return}A.current=window.setTimeout(()=>{A.current=null,C.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload",reason:I}}))},150)},[]);m.useEffect(()=>()=>{A.current!=null&&(window.clearTimeout(A.current),A.current=null)},[]);const Ot=m.useCallback(async()=>{try{const I=await fetch("/api/record/list",{cache:"no-store"});if(!I.ok)return;const U=await I.json().catch(()=>null),te=Array.isArray(U)?U:Array.isArray(U?.items)?U.items:[];tt(te),$e.current=te,xn(Date.now())}catch{}},[]);m.useEffect(()=>{try{window.localStorage.setItem(Qe,At)}catch{}},[At]),m.useEffect(()=>{t&&It()},[t,It]);const[en,Sn]=m.useState(null),[Pn,St]=m.useState(""),[Tn,tt]=m.useState([]),[D,P]=m.useState([]),[ne,Re]=m.useState(1),[Ge,yt]=m.useState(0),[tn,un]=m.useState(0),[vn,cn]=m.useState({}),[Cn,xn]=m.useState(()=>Date.now()),[on,Rn]=m.useState(()=>Date.now()),[qt,Bt]=m.useState({}),Zt=m.useCallback(I=>{const U=String(I?.host??"").toLowerCase(),te=String(I?.input??"").toLowerCase();return U.includes("chaturbate")||te.includes("chaturbate.com")},[]),zt=m.useMemo(()=>{let I=0;for(const U of Object.values(qt))Zt(U)&&String(U?.roomStatus??"").trim().toLowerCase()!=="offline"&&(U?.isOnline===!0||String(U?.roomStatus??"").trim()!=="")&&I++;return I},[qt,Zt]),Pt=m.useCallback(I=>{const U=String(I?.jobId??"").trim();if(U){if(I.type==="job_remove"){tt(te=>{const ye=te.filter(ge=>String(ge.id??"")!==U);return $e.current=ye,ye}),$(te=>te&&String(te.id??"")===U?null:te),xn(Date.now());return}I.type==="job_upsert"&&(tt(te=>{const ye=te.findIndex(ut=>String(ut.id??"")===U),ge=ye>=0?te[ye]:null,at={...ge??{},id:U,status:I.status??ge?.status??"running",sourceUrl:I.sourceUrl??ge?.sourceUrl??"",output:I.output??ge?.output??"",startedAt:I.startedAt??ge?.startedAt??"",endedAt:I.endedAt??ge?.endedAt??void 0,phase:I.phase??ge?.phase,progress:I.progress??ge?.progress,startedAtMs:I.startedAtMs??ge?.startedAtMs,endedAtMs:I.endedAtMs??ge?.endedAtMs,sizeBytes:I.sizeBytes??ge?.sizeBytes,durationSeconds:I.durationSeconds??ge?.durationSeconds,previewState:I.previewState??ge?.previewState,roomStatus:I.roomStatus??ge?.roomStatus,isOnline:I.isOnline??ge?.isOnline,modelImageUrl:I.modelImageUrl??ge?.modelImageUrl,modelChatRoomUrl:I.modelChatRoomUrl??ge?.modelChatRoomUrl};let lt;return ye>=0?(lt=[...te],lt[ye]=at):lt=[at,...te],$e.current=lt,lt}),$(te=>te&&(String(te.id??"")===U?{...te,id:U,status:I.status??te.status,sourceUrl:I.sourceUrl??te.sourceUrl,output:I.output??te.output,startedAt:I.startedAt??te.startedAt,endedAt:I.endedAt??te.endedAt,phase:I.phase??te.phase,progress:I.progress??te.progress,startedAtMs:I.startedAtMs??te.startedAtMs,endedAtMs:I.endedAtMs??te.endedAtMs,sizeBytes:I.sizeBytes??te.sizeBytes,durationSeconds:I.durationSeconds??te.durationSeconds,previewState:I.previewState??te.previewState,roomStatus:I.roomStatus??te.roomStatus,isOnline:I.isOnline??te.isOnline,modelImageUrl:I.modelImageUrl??te.modelImageUrl,modelChatRoomUrl:I.modelChatRoomUrl??te.modelChatRoomUrl}:te)),xn(Date.now()))}},[]),Nn=m.useCallback(I=>{const U=He.current,te=Je.current,ye=String(I??"").trim().toLowerCase();!U||!te||!ye||We.current.has(ye)||(We.current.add(ye),U.addEventListener(ye,te))},[]),Ft=m.useCallback(I=>{const U=He.current,te=Je.current,ye=String(I??"").trim().toLowerCase();!U||!te||!ye||We.current.has(ye)&&(U.removeEventListener(ye,te),We.current.delete(ye))},[]),Qn=I=>{const U=String(I??"").trim().toLowerCase();return U==="stopped"||U==="finished"||U==="failed"||U==="done"||U==="completed"||U==="canceled"||U==="cancelled"},Xn=I=>{const U=I;if(Qn(U?.status))return!1;const te=String(U?.phase??"").trim().toLowerCase(),ye=U?.postWork,ge=String(ye?.state??"").trim().toLowerCase();return!!(String(U?.status??"").trim().toLowerCase()==="running"&&!U?.endedAt||te==="postwork"||ge==="queued"||ge==="running"||U?.endedAt&&te)},Gn=I=>{const U=Math.max(0,Math.floor(I/1e3));if(U<2)return"gerade eben";if(U<60)return`vor ${U} Sekunden`;const te=Math.floor(U/60);if(te===1)return"vor 1 Minute";if(te<60)return`vor ${te} Minuten`;const ye=Math.floor(te/60);return ye===1?"vor 1 Stunde":`vor ${ye} Stunden`},ln=m.useMemo(()=>{const I=on-Cn;return`(zuletzt aktualisiert: ${Gn(I)})`},[on,Cn]),Zn=m.useCallback(I=>{const U={};for(const te of Array.isArray(I)?I:[]){const ye=(te?.modelKey||"").trim().toLowerCase();if(!ye)continue;const ge=lt=>(lt.favorite?4:0)+(lt.liked===!0?2:0)+(lt.watching?1:0),at=U[ye];(!at||ge(te)>=ge(at))&&(U[ye]=te)}return U},[]),ti=m.useCallback((I,U)=>{I&&(Bt(te=>{const ye=te[I];if(!ye)return te;const ge={...ye,roomStatus:U.roomStatus!=null?String(U.roomStatus).trim().toLowerCase():ye.roomStatus,isOnline:U.isOnline!=null?!!U.isOnline:ye.isOnline,imageUrl:U.imageUrl&&String(U.imageUrl).trim()?String(U.imageUrl).trim():ye.imageUrl,chatRoomUrl:U.chatRoomUrl&&String(U.chatRoomUrl).trim()?String(U.chatRoomUrl).trim():ye.chatRoomUrl};return{...te,[I]:ge}}),dt(te=>{const ye=te.findIndex(at=>String(at.modelKey??"").trim().toLowerCase()===I);if(ye<0)return te;const ge=[...te];return ge[ye]={...ge[ye],currentShow:nu(U.roomStatus),imageUrl:U.imageUrl&&String(U.imageUrl).trim()?String(U.imageUrl).trim():ge[ye].imageUrl},ge}))},[]),jn=m.useCallback(async()=>{try{const I=await lr("/api/models",{cache:"no-store"});Bt(Zn(Array.isArray(I)?I:[])),xn(Date.now())}catch{}},[Zn]),Kn=m.useCallback(I=>{const U=_s(I.url);if(!U)return!1;const te=Os(U);return _e.current.has(te)||(_e.current.add(te),On.current.push({...I,url:te}),nt.current||(nt.current=!0,queueMicrotask(()=>{nt.current=!1,De()}))),!0},[]);m.useEffect(()=>{Je.current=I=>{try{const U=JSON.parse(String(I.data??"null")),te=String(U?.model??"").trim().toLowerCase();if(U?.type==="room_state"){if(te){const ye=String(U?.roomStatus??"").trim().toLowerCase(),ge=typeof U?.isOnline=="boolean"?!!U.isOnline:ye!=="offline";ti(te,{roomStatus:ye,isOnline:ge,imageUrl:String(U?.modelImageUrl??"").trim(),chatRoomUrl:String(U?.modelChatRoomUrl??"").trim()});const at=String((Kt.current||{})[te]??"").trim();ye==="public"&&at&&!Se.current&&Kn({url:at,silent:!0,pendingKeyLower:te})}return}Pt(U)}catch{}}},[Pt,ti,Kn]),m.useEffect(()=>{const I=window.setInterval(()=>Rn(Date.now()),1e3);return()=>window.clearInterval(I)},[]),m.useEffect(()=>{const I=U=>{const ye=(U.detail?.modelKey??"").trim();if(!ye)return;if(!ye.includes(" ")&&!ye.includes("/")&&!ye.includes("\\")){const Dt=ye.replace(/^@/,"").trim().toLowerCase();Dt&&W(Dt);return}const at=_s(ye);if(!at){let Dt=ye.replace(/^https?:\/\//i,"");Dt.includes("/")&&(Dt=Dt.split("/").filter(Boolean).pop()||Dt),Dt.includes(":")&&(Dt=Dt.split(":").pop()||Dt),Dt=Dt.trim().toLowerCase(),Dt&&W(Dt);return}const lt=Os(at),ut=yf(lt);ut&&W(ut)};return window.addEventListener("open-model-details",I),()=>window.removeEventListener("open-model-details",I)},[]);const rn=m.useCallback(I=>{const U=Date.now(),te=B.current;if(!te){B.current={ts:U,list:[I]};return}te.ts=U;const ye=te.list.findIndex(ge=>ge.id===I.id);ye>=0?te.list[ye]=I:te.list.unshift(I)},[]);m.useEffect(()=>{jn();const I=U=>{const ye=U?.detail??{},ge=ye?.model;if(ge&&typeof ge=="object"){const at=String(ge.modelKey??"").toLowerCase().trim();at&&Bt(lt=>({...lt,[at]:ge}));try{rn(ge)}catch{}k(lt=>lt?.id===ge.id?ge:lt),xn(Date.now());return}if(ye?.removed){const at=String(ye?.id??"").trim(),lt=String(ye?.modelKey??"").toLowerCase().trim();lt&&Bt(ut=>{const{[lt]:Dt,...Yt}=ut;return Yt}),at&&k(ut=>ut?.id===at?null:ut),xn(Date.now());return}jn()};return window.addEventListener("models-changed",I),()=>window.removeEventListener("models-changed",I)},[jn,rn]);const Di=m.useRef(Be);m.useEffect(()=>{Di.current=Be},[Be]);const[oi,ni]=m.useState({paused:!1,pausedByUser:!1,pausedByDisk:!1});m.useEffect(()=>{Se.current=Y},[Y]),m.useEffect(()=>{Ie.current=E},[E]),m.useEffect(()=>{$e.current=Tn},[Tn]);const di=m.useRef(null),Ci=m.useRef(""),Fn=4,On=m.useRef([]),$n=m.useRef(0),_e=m.useRef(new Set),nt=m.useRef(!1),ht=m.useCallback(()=>{const I=$n.current>0;G(I),Se.current=I},[]);async function Ht(I,U){if(I=Os(I),$e.current.some(ye=>{if(String(ye.status||"").toLowerCase()!=="running"||ye.endedAt)return!1;const ge=_s(String(ye.sourceUrl||""));return(ge?Os(ge):"")===I}))return!0;try{const ye=Ie.current,ge=ud(I);if(!ge)return U||ie("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(ge==="chaturbate"&&!Ti(ye))return U||ie('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const at=Object.entries(ye).map(([ut,Dt])=>`${ut}=${Dt}`).join("; "),lt=await lr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:I,cookie:at})});return lt?.id&&(Ct.current[String(lt.id)]=!0),tt(ut=>[lt,...ut]),$e.current=[lt,...$e.current],!0}catch(ye){const ge=ye?.message??String(ye);return fe(ge)?(qe({silent:U}),!1):(U||ie(ge),!1)}}async function De(){for(;$n.current<Fn&&On.current.length>0;){const I=On.current.shift();$n.current++,ht(),(async()=>{try{if(await Ht(I.url,I.silent)&&I.pendingKeyLower){const te=I.pendingKeyLower;Ne(ye=>{const ge={...ye||{}};return delete ge[te],Kt.current=ge,ge}),dt(ye=>ye.filter(ge=>String(ge.modelKey??"").trim().toLowerCase()!==te))}}finally{_e.current.delete(I.url),$n.current=Math.max(0,$n.current-1),ht(),On.current.length>0&&De()}})()}}const vt=m.useMemo(()=>{const I=new Set;for(const U of Object.values(qt)){if(!Zt(U))continue;const te=gt(String(U?.modelKey??""));te&&I.add(te)}return Array.from(I)},[qt,Zt]),wt=m.useRef(Q),Nt=m.useCallback((I,U)=>{I&&(Bt(te=>{const ye=te[I];return ye?{...te,[I]:{...ye,roomStatus:U.show,isOnline:U.show!=="offline",imageUrl:U.imageUrl||ye.imageUrl,chatRoomUrl:U.chatRoomUrl||ye.chatRoomUrl}}:te}),dt(te=>{const ye=te.findIndex(at=>String(at.modelKey??"").trim().toLowerCase()===I);if(ye<0)return te;const ge=[...te];return ge[ye]={...ge[ye],currentShow:U.show,imageUrl:U.imageUrl||ge[ye].imageUrl},ge}))},[]),Gt=m.useRef(qt);m.useEffect(()=>{Gt.current=qt},[qt]);const Kt=m.useRef(xe);m.useEffect(()=>{Kt.current=xe},[xe]),m.useEffect(()=>{const I=Object.keys(xe||{});if(I.length===0){dt([]);return}const U=I.map(te=>{const ye=String(te??"").trim().toLowerCase(),ge=String(xe?.[ye]??"").trim(),at=qt?.[ye]??null;return{id:ye,modelKey:ye,url:ge,currentShow:nu(at?.roomStatus),imageUrl:String(at?.imageUrl??"").trim()||void 0}});dt(U)},[xe,qt]),m.useEffect(()=>{if(!Be.useChaturbateApi)return;let I=!1,U=null,te=!1;const ye=async()=>{if(I||te)return;const at=Kt.current||{},lt=Object.entries(at);if(lt.length===0||Se.current)return;const ut=lt.map(([Dt])=>String(Dt??"").trim().toLowerCase()).filter(Boolean);if(ut.length!==0){te=!0;try{const Dt=await fetch("/api/chaturbate/online",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:ut})});if(!Dt.ok)return;const Yt=await Dt.json().catch(()=>null),Lt=Array.isArray(Yt?.rooms)?Yt.rooms:[],ft={};for(const bt of Lt){const Ut=String(bt?.username??"").trim().toLowerCase();Ut&&(ft[Ut]={show:nu(bt?.current_show),imageUrl:String(bt?.image_url??"").trim()||void 0,chatRoomUrl:String(bt?.chat_room_url??"").trim()||void 0})}for(const bt of ut){const Ut=ft[bt]??{show:"offline"};if(Nt(bt,Ut),Ut.show==="public"){const Jt=String(at?.[bt]??"").trim();if(!Jt)continue;Kn({url:Jt,silent:!0,pendingKeyLower:bt})}}}catch{}finally{te=!1}}},ge=at=>{I||(U=window.setTimeout(async()=>{await ye(),ge(document.hidden?8e3:3e3)},at))};return ge(0),()=>{I=!0,U!=null&&window.clearTimeout(U)}},[Be.useChaturbateApi,Nt,Kn]);const sn=m.useRef(vt);m.useEffect(()=>{sn.current=vt},[vt]);const Mn=m.useCallback(async I=>{const U=String(I??"").trim().toLowerCase();if(!U)return{show:"unknown",imageUrl:"",chatRoomUrl:""};try{const te=await fetch("/api/chaturbate/online",{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:[U]})});if(!te.ok)return{show:"unknown",imageUrl:"",chatRoomUrl:""};const ye=await te.json().catch(()=>null),ge=Array.isArray(ye?.rooms)?ye.rooms.find(at=>String(at?.username??"").trim().toLowerCase()===U):null;return ge?{show:nu(ge.current_show),imageUrl:String(ge.image_url??"").trim(),chatRoomUrl:String(ge.chat_room_url??"").trim()}:{show:"offline",imageUrl:"",chatRoomUrl:""}}catch{return{show:"unknown",imageUrl:"",chatRoomUrl:""}}},[]);m.useEffect(()=>{wt.current=Q},[Q]),m.useEffect(()=>{if(!Be.useChaturbateApi){cn({});return}const I={};for(const U of Tn){const te=z6(U);if(!te)continue;const ye=String(U?.roomStatus??"").trim().toLowerCase();if(ye){I[te]=ye;continue}const ge=String(qt[te]?.roomStatus??"").trim().toLowerCase();ge&&(I[te]=ge)}cn(I)},[Tn,qt,Be.useChaturbateApi]);const Yn=m.useCallback(async(I,U)=>{const te=_s(I);if(!te)return!1;const ye=Os(te),ge=!!U?.silent;ge||ie(null);const at=ud(ye);if(!at)return ge||ie("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const lt=Ie.current;if(at==="chaturbate"&&!Ti(lt))return ge||ie('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if($e.current.some(Dt=>{if(String(Dt.status||"").toLowerCase()!=="running"||Dt.endedAt)return!1;const Yt=_s(String(Dt.sourceUrl||""));return(Yt?Os(Yt):"")===ye}))return!0;if(at==="chaturbate"&&Di.current.useChaturbateApi)try{const Dt=await lr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:ye})}),Yt=String(Dt?.modelKey??"").trim().toLowerCase();if(Yt){const Lt=Ut=>{const Jt=Gt.current[Yt],Qt=nu(Ut??Jt?.roomStatus);dt(wn=>{const fi={id:Yt,modelKey:Yt,url:ye,currentShow:Qt,imageUrl:String(Jt?.imageUrl??"").trim()||void 0},fs=wn.findIndex(Fi=>String(Fi.modelKey??"").trim().toLowerCase()===Yt);if(fs>=0){const Fi=[...wn];return Fi[fs]={...Fi[fs],...fi},Fi}return[fi,...wn]})};if(Se.current)return Ne(Ut=>({...Ut||{},[Yt]:ye})),Lt("public"),!0;const ft=Gt.current[Yt],bt=nu(ft?.roomStatus);if(bt==="private"||bt==="hidden"||bt==="away")return Ne(Ut=>({...Ut||{},[Yt]:ye})),Lt(bt),!0}}catch{}else if(Se.current)return di.current=ye,!0;if(Se.current)return!1;G(!0),Se.current=!0;try{const Dt=Object.entries(lt).map(([Lt,ft])=>`${Lt}=${ft}`).join("; "),Yt=await lr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:ye,cookie:Dt})});return Yt?.id&&(Ct.current[String(Yt.id)]=!0),tt(Lt=>[Yt,...Lt]),$e.current=[Yt,...$e.current],!0}catch(Dt){const Yt=Dt?.message??String(Dt);return fe(Yt)?(qe({silent:ge}),!1):(ge||ie(Yt),!1)}finally{G(!1),Se.current=!1}},[Nt,Mn]);m.useEffect(()=>{let I=!1;const U=async()=>{try{const ge=await lr("/api/settings",{cache:"no-store"});!I&&ge&&Ve({...Q_,...ge})}catch{}},te=()=>{U()},ye=()=>{U()};return window.addEventListener("recorder-settings-updated",te),window.addEventListener("focus",ye),document.addEventListener("visibilitychange",ye),U(),()=>{I=!0,window.removeEventListener("recorder-settings-updated",te),window.removeEventListener("focus",ye),document.removeEventListener("visibilitychange",ye)}},[]),m.useEffect(()=>{let I=!1;const U=async()=>{try{const ye=await lr("/api/models/meta",{cache:"no-store"}),ge=Number(ye?.count??0);!I&&Number.isFinite(ge)&&(un(ge),xn(Date.now()))}catch{}};U();const te=window.setInterval(U,document.hidden?6e4:3e4);return()=>{I=!0,window.clearInterval(te)}},[]);const nr=m.useMemo(()=>Object.entries(E).map(([I,U])=>({name:I,value:U})),[E]),Wn=m.useCallback((I,U)=>{B.current=null,k(null),$(I),X(!1),de(typeof U=="number"&&Number.isFinite(U)&&U>=0?U:null)},[]),Wi=m.useMemo(()=>{let I=0;for(const U of Object.values(qt)){if(!U?.watching||!Zt(U)||!gt(String(U?.modelKey??"")))continue;const ye=String(U?.roomStatus??"").trim().toLowerCase();ye&&ye!=="offline"&&I++}return I},[qt,Zt]),{onlineFavCount:Hi,onlineLikedCount:bi}=m.useMemo(()=>{let I=0,U=0;for(const te of Object.values(qt)){if(!gt(String(te?.modelKey??"")))continue;const ge=String(te?.roomStatus??"").trim().toLowerCase();!ge||ge==="offline"||(te?.favorite&&I++,te?.liked===!0&&U++)}return{onlineFavCount:I,onlineLikedCount:U}},[qt]),Si=[{id:"running",label:"Laufende Downloads",count:Tn.length},{id:"finished",label:"Abgeschlossene Downloads",count:Ge},{id:"models",label:"Models",count:tn},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],Xi=m.useMemo(()=>Pn.trim().length>0&&!Y,[Pn,Y]);m.useEffect(()=>{let I=!1;return(async()=>{try{const te=await lr("/api/cookies",{cache:"no-store"}),ye=hf(te?.cookies);if(I||R(ye),Object.keys(ye).length===0){const ge=localStorage.getItem(Cg);if(ge)try{const at=JSON.parse(ge),lt=hf(at);Object.keys(lt).length>0&&(I||R(lt),await lr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:lt})}))}catch{}}}catch{const te=localStorage.getItem(Cg);if(te)try{const ye=JSON.parse(te);I||R(hf(ye))}catch{}}finally{I||q(!0)}})(),()=>{I=!0}},[]),m.useEffect(()=>{ee&&localStorage.setItem(Cg,JSON.stringify(E))},[E,ee]),m.useEffect(()=>{It();const I=()=>{document.hidden||It()};return document.addEventListener("visibilitychange",I),()=>{document.removeEventListener("visibilitychange",I)}},[It]),m.useEffect(()=>{if(Q!=="finished")return;It(),$t("selectedTab effect");const I=()=>{document.hidden||(It(),$t("selectedTab visibilitychange"))};return document.addEventListener("visibilitychange",I),()=>{document.removeEventListener("visibilitychange",I)}},[Q,It,$t]),m.useEffect(()=>{const I=Math.max(1,Math.ceil(Ge/Pe));ne>I&&Re(I)},[Ge,ne]),m.useEffect(()=>{if(!t)return;let I=null,U=null;const te=()=>{U!=null&&(window.clearInterval(U),U=null)},ye=()=>{U==null&&(U=window.setInterval(()=>{document.hidden||(It(),Ot(),wt.current==="finished"&&$t("sse fallback poll"))},document.hidden?6e4:5e3))},ge={t:0};let at=null;const lt=()=>{const ft=Date.now();if(ft-ge.t<800){if(at!=null)return;at=window.setTimeout(()=>{at=null,ge.t=Date.now(),It(),wt.current==="finished"&&$t("doneChanged coalesced")},900);return}ge.t=ft,It(),wt.current==="finished"&&$t("doneChanged")},ut=ft=>{const bt=ft??{};ni({paused:!!bt?.paused,pausedByUser:!!bt?.pausedByUser,pausedByDisk:!!bt?.pausedByDisk})};Ot(),It(),lr("/api/autostart/state",{cache:"no-store"}).then(ft=>{ni({paused:!!ft?.paused,pausedByUser:!!ft?.pausedByUser,pausedByDisk:!!ft?.pausedByDisk})}).catch(()=>{}),I=new EventSource("/api/events/stream"),He.current=I,We.current=new Set,I.onopen=()=>{te()},I.onerror=()=>{ye()};const Dt=()=>{lt()},Yt=ft=>{try{ut(JSON.parse(String(ft.data??"null")))}catch{}};I.addEventListener("doneChanged",Dt),I.addEventListener("autostart",Yt);for(const ft of $e.current){if(!Xn(ft))continue;const bt=String(ft?.sourceUrl??""),Ut=_s(bt),Jt=Ut?Os(Ut):"",Qt=yf(Jt);Qt&&Nn(Qt)}for(const ft of Object.keys(Kt.current||{})){const bt=String(ft??"").trim().toLowerCase();bt&&Nn(bt)}const Lt=()=>{document.hidden||(Ot(),It(),wt.current==="finished"&&$t("visibilitychange"))};return document.addEventListener("visibilitychange",Lt),()=>{if(document.removeEventListener("visibilitychange",Lt),at!=null&&window.clearTimeout(at),te(),I){I.removeEventListener("doneChanged",Dt),I.removeEventListener("autostart",Yt);const ft=Je.current;if(ft)for(const bt of We.current)I.removeEventListener(bt,ft);I.close()}He.current=null,We.current=new Set,I=null}},[t,Ot,It,$t,Nn]),m.useEffect(()=>{const I=new Set;for(const U of Tn){if(!Xn(U))continue;const te=String(U?.sourceUrl??""),ye=_s(te),ge=ye?Os(ye):"",at=yf(ge);at&&I.add(at)}for(const U of Object.keys(Kt.current||{})){const te=String(U??"").trim().toLowerCase();te&&I.add(te)}for(const U of I)Nn(U);for(const U of Array.from(We.current))I.has(U)||Ft(U)},[Tn,xe,Nn,Ft]);function ii(I){const U=_s(I);if(!U)return!1;try{return new URL(U).hostname.includes("chaturbate.com")}catch{return!1}}function Mi(I,U){const te=Object.fromEntries(Object.entries(I).map(([ye,ge])=>[ye.trim().toLowerCase(),ge]));for(const ye of U){const ge=te[ye.toLowerCase()];if(ge)return ge}}function Ti(I){const U=Mi(I,["cf_clearance"]),te=Mi(I,["sessionid","session_id","sessionId"]);return!!(U&&te)}async function Bi(I){try{await lr(`/api/record/stop?id=${encodeURIComponent(I)}`,{method:"POST"})}catch(U){l.error("Stop fehlgeschlagen",U?.message??String(U))}}m.useEffect(()=>{const I=U=>{const ye=Number(U.detail?.delta??0);Number.isFinite(ye)&&ye!==0&&yt(ge=>Math.max(0,ge+ye)),It()};return window.addEventListener("finished-downloads:count-hint",I),()=>window.removeEventListener("finished-downloads:count-hint",I)},[It]),m.useEffect(()=>{const I=U=>{const te=U.detail||{};te.tab==="finished"&&ue("finished"),te.tab==="categories"&&ue("categories"),te.tab==="models"&&ue("models"),te.tab==="running"&&ue("running"),te.tab==="settings"&&ue("settings")};return window.addEventListener("app:navigate-tab",I),()=>window.removeEventListener("app:navigate-tab",I)},[]),m.useEffect(()=>{if(!se){k(null),Sn(null);return}const I=(ru(se.output||"")||"").trim().toLowerCase();Sn(I||null);const U=I?qt[I]:void 0;k(U??null)},[se,qt]);async function ir(){return Yn(Pn)}const hi=m.useCallback(async I=>{const U=String(I?.sourceUrl??""),te=nl(U);if(!te)return!1;const ye=_s(te);if(!ye)return!1;const ge=Os(ye),at=await Yn(ge,{silent:!0});return at||l.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),at},[Yn,l]);async function Yi(I){const{kind:U,file:te,run:ye,onSuccess:ge,onError:at}=I;(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:te,phase:"start"}}));try{const lt=await ye();return(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:te,phase:"success"}})),await ge?.(lt),lt}catch(lt){throw(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:te,phase:"error"}})),await at?.(lt),lt}}const Pi=m.useCallback(async I=>{const U=Ni(I.output||"");if(U)try{const te=await Yi({kind:"delete",file:U,run:()=>lr(`/api/record/delete?file=${encodeURIComponent(U)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{P(ge=>{const at=ge.filter(ft=>Ni(ft.output||"")!==U);if(Pe-at.length<=0)return at;const ut=kt(ne+1,At),Dt=f.current;if(!Dt||Dt.key!==ut||!Array.isArray(Dt.items)||Dt.items.length===0)return at;const Yt=[...at],Lt=new Set(Yt.map(ft=>String(ft.id||Ni(ft.output||"")).trim()));for(;Yt.length<Pe&&Dt.items.length>0;){const ft=Dt.items.shift(),bt=String(ft.id||Ni(ft.output||"")).trim();!bt||Lt.has(bt)||(Lt.add(bt),Yt.push(ft))}return f.current={...Dt,items:Dt.items,ts:Dt.ts},Yt}),yt(ge=>Math.max(0,ge-1)),tt(ge=>ge.filter(at=>Ni(at.output||"")!==U)),$(ge=>ge&&Ni(ge.output||"")===U?null:ge),mn(ne+1)},320)},onError:async()=>{l.error("Löschen fehlgeschlagen",U)}}),ye=typeof te?.undoToken=="string"?te.undoToken:"";return ye?{undoToken:ye}:{}}catch{return}},[Yi,l,ne,At,mn]),ae=m.useCallback(async I=>{const U=Ni(I.output||"");if(U)try{await Yi({kind:"keep",file:U,run:()=>lr(`/api/record/keep?file=${encodeURIComponent(U)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{P(te=>te.filter(ye=>Ni(ye.output||"")!==U)),tt(te=>te.filter(ye=>Ni(ye.output||"")!==U)),$(te=>te&&Ni(te.output||"")===U?null:te),yt(te=>Math.max(0,te-1)),mn(ne+1)},320)},onError:async()=>{l.error("Keep fehlgeschlagen",U)}})}catch{return}},[Yi,l,ne,mn]),ke=m.useCallback(async I=>{const U=Ni(I.output||"");if(U)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),await new Promise(lt=>window.setTimeout(lt,60));const te=await lr(`/api/record/toggle-hot?file=${encodeURIComponent(U)}`,{method:"POST"}),ye=Ni(te.oldFile||U)||U,ge=Ni(te.newFile||"")||"";if(!ge)throw new Error("Backend lieferte keinen neuen Dateinamen zurück");window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:ye,newFile:ge}}));const at=lt=>P6(lt||"",ge);return $(lt=>lt&&(lt.id===I.id||Ni(lt.output||"")===ye?{...lt,output:at(lt.output||"")}:lt)),P(lt=>lt.map(ut=>ut.id===I.id||Ni(ut.output||"")===ye?{...ut,output:at(ut.output||"")}:ut)),tt(lt=>lt.map(ut=>ut.id===I.id||Ni(ut.output||"")===ye?{...ut,output:at(ut.output||"")}:ut)),te}catch(te){l.error("Umbenennen fehlgeschlagen",te?.message??String(te));return}},[l]),pt=m.useCallback(async I=>{await Pi(I)},[Pi]);async function xt(I){const U=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(I)});if(U.status===204)return null;if(!U.ok){const te=await U.text().catch(()=>"");throw new Error(te||`HTTP ${U.status}`)}return U.json()}const Rt=m.useCallback(I=>{const U=B.current;!U||!I||(U.ts=Date.now(),U.list=U.list.filter(te=>te.id!==I))},[]),Et=m.useRef({}),Z=m.useCallback(async I=>{const U=Ni(I.output||""),te=!!(se&&Ni(se.output||"")===U),ye=ft=>{try{const bt=String(ft.sourceUrl??ft.SourceURL??""),Ut=nl(bt);return Ut?new URL(Ut).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},ge=(ru(I.output||"")||"").trim().toLowerCase();if(ge){const ft=ge;if(Et.current[ft])return;Et.current[ft]=!0;const bt=qt[ge]??{id:"",input:"",host:ye(I)||void 0,modelKey:ge,watching:!1,favorite:!1,liked:null,isUrl:!1},Ut=!bt.favorite,Jt={...bt,modelKey:bt.modelKey||ge,favorite:Ut,liked:Ut?!1:bt.liked};Bt(Qt=>({...Qt,[ge]:Jt})),rn(Jt),te&&k(Jt);try{const Qt=await xt({...Jt.id?{id:Jt.id}:{},host:Jt.host||ye(I)||"",modelKey:ge,favorite:Ut,...Ut?{liked:!1}:{}});if(!Qt){Bt(fi=>{const{[ge]:fs,...Fi}=fi;return Fi}),bt.id&&Rt(bt.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:ge}}));return}const wn=gt(Qt.modelKey||ge);wn&&Bt(fi=>({...fi,[wn]:Qt})),rn(Qt),te&&k(Qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Qt}}))}catch(Qt){Bt(wn=>({...wn,[ge]:bt})),rn(bt),te&&k(bt),l.error("Favorit umschalten fehlgeschlagen",Qt?.message??String(Qt))}finally{delete Et.current[ft]}return}let at=te?j:null;if(at||(at=await Me(I,{ensure:!0})),!at)return;const lt=gt(at.modelKey||at.id||"");if(!lt||Et.current[lt])return;Et.current[lt]=!0;const ut=at,Dt=!ut.favorite,Yt={...ut,favorite:Dt,liked:Dt?!1:ut.liked},Lt=gt(ut.modelKey||"");Lt&&Bt(ft=>({...ft,[Lt]:Yt})),rn(Yt),te&&k(Yt);try{const ft=await xt({id:ut.id,favorite:Dt,...Dt?{liked:!1}:{}});if(!ft){Bt(Ut=>{const Jt=gt(ut.modelKey||"");if(!Jt)return Ut;const{[Jt]:Qt,...wn}=Ut;return wn}),Rt(ut.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:ut.modelKey}}));return}const bt=gt(ft.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ft})),rn(ft),te&&k(ft),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ft}}))}catch(ft){const bt=gt(ut.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ut})),rn(ut),te&&k(ut),l.error("Favorit umschalten fehlgeschlagen",ft?.message??String(ft))}finally{delete Et.current[lt]}},[l,se,j,Me,xt,rn,Rt,qt]),ce=m.useCallback(async I=>{const U=Ni(I.output||""),te=!!(se&&Ni(se.output||"")===U),ye=ft=>{try{const bt=String(ft.sourceUrl??ft.SourceURL??""),Ut=nl(bt);return Ut?new URL(Ut).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},ge=(ru(I.output||"")||"").trim().toLowerCase();if(ge){const ft=ge;if(Et.current[ft])return;Et.current[ft]=!0;const bt=qt[ge]??{id:"",input:"",host:ye(I)||void 0,modelKey:ge,watching:!1,favorite:!1,liked:null,isUrl:!1},Ut=bt.liked!==!0,Jt={...bt,modelKey:bt.modelKey||ge,liked:Ut,favorite:Ut?!1:bt.favorite};Bt(Qt=>({...Qt,[ge]:Jt})),rn(Jt),te&&k(Jt);try{const Qt=await xt({...Jt.id?{id:Jt.id}:{},host:Jt.host||ye(I)||"",modelKey:ge,liked:Ut,...Ut?{favorite:!1}:{}});if(!Qt){Bt(fi=>{const{[ge]:fs,...Fi}=fi;return Fi}),bt.id&&Rt(bt.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:ge}}));return}const wn=gt(Qt.modelKey||ge);wn&&Bt(fi=>({...fi,[wn]:Qt})),rn(Qt),te&&k(Qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Qt}}))}catch(Qt){Bt(wn=>({...wn,[ge]:bt})),rn(bt),te&&k(bt),l.error("Like umschalten fehlgeschlagen",Qt?.message??String(Qt))}finally{delete Et.current[ft]}return}let at=te?j:null;if(at||(at=await Me(I,{ensure:!0})),!at)return;const lt=gt(at.modelKey||at.id||"");if(!lt||Et.current[lt])return;Et.current[lt]=!0;const ut=at,Dt=ut.liked!==!0,Yt={...ut,liked:Dt,favorite:Dt?!1:ut.favorite},Lt=gt(ut.modelKey||"");Lt&&Bt(ft=>({...ft,[Lt]:Yt})),rn(Yt),te&&k(Yt);try{const ft=Dt?await xt({id:ut.id,liked:!0,favorite:!1}):await xt({id:ut.id,liked:!1});if(!ft){Bt(Ut=>{const Jt=gt(ut.modelKey||"");if(!Jt)return Ut;const{[Jt]:Qt,...wn}=Ut;return wn}),Rt(ut.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:ut.modelKey}}));return}const bt=gt(ft.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ft})),rn(ft),te&&k(ft),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ft}}))}catch(ft){const bt=gt(ut.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ut})),rn(ut),te&&k(ut),l.error("Like umschalten fehlgeschlagen",ft?.message??String(ft))}finally{delete Et.current[lt]}},[l,se,j,Me,xt,rn,Rt,qt]),ve=m.useCallback(async I=>{const U=Ni(I.output||""),te=!!(se&&Ni(se.output||"")===U),ye=ft=>{try{const bt=String(ft.sourceUrl??ft.SourceURL??""),Ut=nl(bt);return Ut?new URL(Ut).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},ge=(ru(I.output||"")||"").trim().toLowerCase();if(ge){const ft=ge;if(Et.current[ft])return;Et.current[ft]=!0;const bt=qt[ge]??{id:"",input:"",host:ye(I)||void 0,modelKey:ge,watching:!1,favorite:!1,liked:null,isUrl:!1},Ut=!bt.watching,Jt={...bt,modelKey:bt.modelKey||ge,watching:Ut};Bt(Qt=>({...Qt,[ge]:Jt})),rn(Jt),te&&k(Jt);try{const Qt=await xt({...Jt.id?{id:Jt.id}:{},host:Jt.host||ye(I)||"",modelKey:ge,watched:Ut});if(!Qt){Bt(fi=>{const{[ge]:fs,...Fi}=fi;return Fi}),bt.id&&Rt(bt.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:bt.id,modelKey:ge}}));return}const wn=gt(Qt.modelKey||ge);wn&&Bt(fi=>({...fi,[wn]:Qt})),rn(Qt),te&&k(Qt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Qt}}))}catch(Qt){Bt(wn=>({...wn,[ge]:bt})),rn(bt),te&&k(bt),l.error("Watched umschalten fehlgeschlagen",Qt?.message??String(Qt))}finally{delete Et.current[ft]}return}let at=te?j:null;if(at||(at=await Me(I,{ensure:!0})),!at)return;const lt=gt(at.modelKey||at.id||"");if(!lt||Et.current[lt])return;Et.current[lt]=!0;const ut=at,Dt=!ut.watching,Yt={...ut,watching:Dt},Lt=gt(ut.modelKey||"");Lt&&Bt(ft=>({...ft,[Lt]:Yt})),rn(Yt),te&&k(Yt);try{const ft=await xt({id:ut.id,watched:Dt});if(!ft){Bt(Ut=>{const Jt=gt(ut.modelKey||"");if(!Jt)return Ut;const{[Jt]:Qt,...wn}=Ut;return wn}),Rt(ut.id),te&&k(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:ut.id,modelKey:ut.modelKey}}));return}const bt=gt(ft.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ft})),rn(ft),te&&k(ft),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:ft}}))}catch(ft){const bt=gt(ut.modelKey||"");bt&&Bt(Ut=>({...Ut,[bt]:ut})),rn(ut),te&&k(ut),l.error("Watched umschalten fehlgeschlagen",ft?.message??String(ft))}finally{delete Et.current[lt]}},[l,se,j,Me,xt,rn,Rt,qt]);async function Me(I,U){const te=!!U?.ensure,ye=Yt=>{const Lt=Date.now(),ft=B.current;if(!ft){B.current={ts:Lt,list:[Yt]};return}ft.ts=Lt;const bt=ft.list.findIndex(Ut=>Ut.id===Yt.id);bt>=0?ft.list[bt]=Yt:ft.list.unshift(Yt)},ge=async Yt=>{if(!Yt)return null;const Lt=Yt.trim().toLowerCase();if(!Lt)return null;const ft=qt[Lt];if(ft)return ye(ft),ft;if(te){let wn;try{const fs=I.sourceUrl??I.SourceURL??"",Fi=nl(fs);Fi&&(wn=new URL(Fi).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const fi=await lr("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:Yt,...wn?{host:wn}:{}})});return rn(fi),fi}const bt=Date.now(),Ut=B.current;if(!Ut||bt-Ut.ts>3e4){const wn=Object.values(qt);if(wn.length)B.current={ts:bt,list:wn};else{const fi=await lr("/api/models",{cache:"no-store"});B.current={ts:bt,list:Array.isArray(fi)?fi:[]}}}const Qt=(B.current?.list??[]).find(wn=>(wn.modelKey||"").trim().toLowerCase()===Lt);return Qt||null},at=ru(I.output||"");if(at)return ge(at);const lt=I.status==="running",ut=I.sourceUrl??I.SourceURL??"",Dt=nl(ut);if(lt&&Dt){const Yt=await lr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Dt})}),Lt=await lr("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yt)});return rn(Lt),Lt}return null}return m.useEffect(()=>{if(!Oe&&!Te||!navigator.clipboard?.readText)return;let I=!1,U=!1,te=null;const ye=async()=>{if(!(I||U)){U=!0;try{const lt=await navigator.clipboard.readText(),ut=nl(lt);if(!ut)return;const Dt=_s(ut);if(!Dt||!ud(Dt))return;const Lt=Os(Dt);if(Lt===Ci.current)return;Ci.current=Lt,Oe&&St(Lt),Te&&Kn({url:Lt,silent:!1})}catch{}finally{U=!1}}},ge=lt=>{I||(te=window.setTimeout(async()=>{await ye(),ge(document.hidden?5e3:1500)},lt))},at=()=>{ye()};return window.addEventListener("hover",at),document.addEventListener("visibilitychange",at),ge(0),()=>{I=!0,te&&window.clearTimeout(te),window.removeEventListener("hover",at),document.removeEventListener("visibilitychange",at)}},[Oe,Te,Kn]),n?t?c.jsxs("div",{className:"min-h-[100dvh] bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100",children:[c.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 overflow-hidden",children:[c.jsx("div",{className:"absolute -top-28 left-1/2 h-80 w-[52rem] -translate-x-1/2 rounded-full bg-indigo-500/10 blur-3xl dark:bg-indigo-400/10"}),c.jsx("div",{className:"absolute -bottom-28 right-[-6rem] h-80 w-[46rem] rounded-full bg-sky-500/10 blur-3xl dark:bg-sky-400/10"})]}),c.jsxs("div",{className:"relative",children:[c.jsx("header",{className:"z-30 bg-white/70 backdrop-blur dark:bg-gray-950/60 sm:sticky sm:top-0 sm:border-b sm:border-gray-200/70 sm:dark:border-white/10",children:c.jsxs("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 pt-3 sm:py-4 space-y-2 sm:space-y-3",children:[c.jsxs("div",{className:"flex items-center sm:items-start justify-between gap-3 sm:gap-4",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c.jsx("h1",{className:"text-lg font-semibold tracking-tight text-gray-900 dark:text-white",children:"Recorder"}),c.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"online",children:[c.jsx(IN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:zt})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Watched online",children:[c.jsx(yl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:Wi})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Fav online",children:[c.jsx(bl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:Hi})]}),c.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gray-100/80 px-2 py-1 text-[11px] font-semibold text-gray-900 ring-1 ring-gray-200/60 dark:bg-white/10 dark:text-gray-100 dark:ring-white/10",title:"Like online",children:[c.jsx(NN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:bi})]})]}),c.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:ln})]}),c.jsxs("div",{className:"sm:hidden mt-1 w-full",children:[c.jsx("div",{className:"text-[11px] text-gray-500 dark:text-gray-400",children:ln}),c.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[Le?c.jsx(X_,{mode:"inline",className:"flex-1"}):c.jsx("div",{className:"flex-1"}),c.jsx(hn,{variant:"secondary",onClick:()=>re(!0),className:"px-3 shrink-0",children:"Cookies"}),c.jsx(hn,{variant:"secondary",onClick:Mt,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[Le?c.jsx(X_,{mode:"inline"}):null,c.jsx(hn,{variant:"secondary",onClick:()=>re(!0),className:"h-9 px-3",children:"Cookies"}),c.jsx(hn,{variant:"secondary",onClick:Mt,className:"h-9 px-3",children:"Abmelden"})]})]}),c.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto] sm:items-stretch",children:[c.jsxs("div",{className:"relative",children:[c.jsx("label",{className:"sr-only",children:"Source URL"}),c.jsx("input",{ref:a,value:Pn,onChange:I=>St(I.target.value),onMouseDown:I=>{I.button===0&&(I.preventDefault(),et())},onFocus:()=>{et()},placeholder:"https://…",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10"})]}),c.jsx(hn,{variant:"primary",onClick:ir,disabled:!Xi,className:"w-full sm:w-auto rounded-lg",children:"Start"})]}),H?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:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsx("div",{className:"min-w-0 break-words",children:H}),c.jsx("button",{type:"button",className:"shrink-0 rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-200 dark:hover:bg-white/10",onClick:()=>ie(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,ii(Pn)&&!Ti(E)?c.jsxs("div",{className:"text-xs text-amber-700 dark:text-amber-300",children:["⚠️ Für Chaturbate werden die Cookies ",c.jsx("code",{children:"cf_clearance"})," und ",c.jsx("code",{children:"sessionId"})," benötigt."]}):null,Y?c.jsx("div",{className:"pt-1",children:c.jsx(bd,{label:"Starte Download…",indeterminate:!0})}):null,c.jsx("div",{className:"hidden sm:block pt-2",children:c.jsx(Lg,{tabs:Si,value:Q,onChange:ue,ariaLabel:"Tabs",variant:"barUnderline"})})]})}),c.jsx("div",{className:"sm:hidden sticky top-0 z-20 border-b border-gray-200/70 bg-white/70 backdrop-blur dark:border-white/10 dark:bg-gray-950/60",children:c.jsx("div",{className:"mx-auto max-w-7xl px-4 pt-0 pb-2",children:c.jsx(Lg,{tabs:Si,value:Q,onChange:ue,ariaLabel:"Tabs",variant:"barUnderline"})})}),c.jsxs("main",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-2 space-y-2",children:[Q==="running"?c.jsx(n6,{jobs:Tn,modelsByKey:qt,roomStatusByModelKey:vn,pending:_t,autostartState:oi,onRefreshAutostartState:async()=>{try{const I=await lr("/api/autostart/state",{cache:"no-store"});ni({paused:!!I?.paused,pausedByUser:!!I?.pausedByUser,pausedByDisk:!!I?.pausedByDisk})}catch{}},onOpenPlayer:Wn,onStopJob:Bi,onToggleFavorite:Z,onToggleLike:ce,onToggleWatch:ve,onAddToDownloads:hi,blurPreviews:!!Be.blurPreviews}):null,Q==="finished"?c.jsx(R3,{jobs:Tn,modelsByKey:qt,doneJobs:D,doneTotal:Ge,page:ne,pageSize:Pe,onPageChange:Re,onOpenPlayer:Wn,onDeleteJob:Pi,onToggleHot:ke,onToggleFavorite:Z,onToggleLike:ce,onToggleWatch:ve,onKeepJob:ae,blurPreviews:!!Be.blurPreviews,teaserPlayback:Be.teaserPlayback??"hover",teaserAudio:!!Be.teaserAudio,assetNonce:L,sortMode:At,onSortModeChange:I=>{Xt(I),Re(1)},loadMode:"paged"}):null,Q==="models"?c.jsx(l6,{}):null,Q==="categories"?c.jsx(M6,{}):null,Q==="settings"?c.jsx(zN,{onAssetsGenerated:we}):null]}),c.jsx(vA,{open:O,onClose:()=>re(!1),initialCookies:nr,onApply:I=>{const U=hf(Object.fromEntries(I.map(te=>[te.name,te.value])));R(U),lr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:U})}).catch(()=>{})}}),c.jsx(S6,{open:!!V,modelKey:V,onClose:()=>W(null),onOpenPlayer:Wn,runningJobs:Tn,cookies:E,blurPreviews:Be.blurPreviews,teaserPlayback:Be.teaserPlayback??"hover",teaserAudio:!!Be.teaserAudio,onToggleHot:ke,onDelete:pt,onKeep:ae,onToggleFavorite:Z,onToggleLike:ce,onToggleWatch:ve,onStopJob:Bi}),se?c.jsx(Y8,{job:se,modelKey:en??void 0,modelsByKey:qt,expanded:F,onToggleExpand:()=>X(I=>!I),onClose:()=>{$(null),de(null)},startAtSec:le??void 0,isHot:Ni(se.output||"").startsWith("HOT "),isFavorite:!!j?.favorite,isLiked:j?.liked===!0,isWatching:!!j?.watching,onKeep:ae,onDelete:pt,onToggleHot:ke,onToggleFavorite:Z,onToggleLike:ce,onStopJob:Bi,onToggleWatch:ve},[String(se?.id??""),Ni(se.output||""),String(L)].join("::")):null]})]}):c.jsx(B6,{onLoggedIn:mt}):c.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}J_.createRoot(document.getElementById("root")).render(c.jsx(m.StrictMode,{children:c.jsx(k3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:c.jsx(H6,{})})}));
|