450 lines
1.3 MiB
450 lines
1.3 MiB
function GE(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 gf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Du(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function KE(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 pm={exports:{}},Rc={};var t1;function WE(){if(t1)return Rc;t1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var h in a)h!=="key"&&(l[h]=a[h])}else l=a;return a=l.ref,{$$typeof:n,type:i,key:u,ref:a!==void 0?a:null,props:l}}return Rc.Fragment=e,Rc.jsx=t,Rc.jsxs=t,Rc}var n1;function XE(){return n1||(n1=1,pm.exports=WE()),pm.exports}var c=XE(),mm={exports:{}},gn={};var i1;function YE(){if(i1)return gn;i1=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),C=Symbol.iterator;function D(I){return I===null||typeof I!="object"?null:(I=C&&I[C]||I["@@iterator"],typeof I=="function"?I:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function G(I,pe,ke){this.props=I,this.context=pe,this.refs=B,this.updater=ke||R}G.prototype.isReactComponent={},G.prototype.setState=function(I,pe){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,pe,"setState")},G.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function Y(){}Y.prototype=G.prototype;function q(I,pe,ke){this.props=I,this.context=pe,this.refs=B,this.updater=ke||R}var se=q.prototype=new Y;se.constructor=q,E(se,G.prototype),se.isPureReactComponent=!0;var Q=Array.isArray;function K(){}var O={H:null,A:null,T:null,S:null},re=Object.prototype.hasOwnProperty;function k(I,pe,ke){var ye=ke.ref;return{$$typeof:n,type:I,key:pe,ref:ye!==void 0?ye:null,props:ke}}function j(I,pe){return k(I.type,pe,I.props)}function te(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function V(I){var pe={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ke){return pe[ke]})}var ne=/\/+/g;function he(I,pe){return typeof I=="object"&&I!==null&&I.key!=null?V(""+I.key):pe.toString(36)}function ae(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(K,K):(I.status="pending",I.then(function(pe){I.status==="pending"&&(I.status="fulfilled",I.value=pe)},function(pe){I.status==="pending"&&(I.status="rejected",I.reason=pe)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function z(I,pe,ke,ye,me){var pt=typeof I;(pt==="undefined"||pt==="boolean")&&(I=null);var We=!1;if(I===null)We=!0;else switch(pt){case"bigint":case"string":case"number":We=!0;break;case"object":switch(I.$$typeof){case n:case e:We=!0;break;case _:return We=I._init,z(We(I._payload),pe,ke,ye,me)}}if(We)return me=me(I),We=ye===""?"."+he(I,0):ye,Q(me)?(ke="",We!=null&&(ke=We.replace(ne,"$&/")+"/"),z(me,pe,ke,"",function(wt){return wt})):me!=null&&(te(me)&&(me=j(me,ke+(me.key==null||I&&I.key===me.key?"":(""+me.key).replace(ne,"$&/")+"/")+We)),pe.push(me)),1;We=0;var _e=ye===""?".":ye+":";if(Q(I))for(var Ye=0;Ye<I.length;Ye++)ye=I[Ye],pt=_e+he(ye,Ye),We+=z(ye,pe,ke,pt,me);else if(Ye=D(I),typeof Ye=="function")for(I=Ye.call(I),Ye=0;!(ye=I.next()).done;)ye=ye.value,pt=_e+he(ye,Ye++),We+=z(ye,pe,ke,pt,me);else if(pt==="object"){if(typeof I.then=="function")return z(ae(I),pe,ke,ye,me);throw pe=String(I),Error("Objects are not valid as a React child (found: "+(pe==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":pe)+"). If you meant to render a collection of children, use an array instead.")}return We}function P(I,pe,ke){if(I==null)return I;var ye=[],me=0;return z(I,ye,"","",function(pt){return pe.call(ke,pt,me++)}),ye}function Z(I){if(I._status===-1){var pe=I._result;pe=pe(),pe.then(function(ke){(I._status===0||I._status===-1)&&(I._status=1,I._result=ke)},function(ke){(I._status===0||I._status===-1)&&(I._status=2,I._result=ke)}),I._status===-1&&(I._status=0,I._result=pe)}if(I._status===1)return I._result.default;throw I._result}var ee=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var pe=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(pe))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},fe={map:P,forEach:function(I,pe,ke){P(I,function(){pe.apply(this,arguments)},ke)},count:function(I){var pe=0;return P(I,function(){pe++}),pe},toArray:function(I){return P(I,function(pe){return pe})||[]},only:function(I){if(!te(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return gn.Activity=S,gn.Children=fe,gn.Component=G,gn.Fragment=t,gn.Profiler=a,gn.PureComponent=q,gn.StrictMode=i,gn.Suspense=f,gn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,gn.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},gn.cache=function(I){return function(){return I.apply(null,arguments)}},gn.cacheSignal=function(){return null},gn.cloneElement=function(I,pe,ke){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ye=E({},I.props),me=I.key;if(pe!=null)for(pt in pe.key!==void 0&&(me=""+pe.key),pe)!re.call(pe,pt)||pt==="key"||pt==="__self"||pt==="__source"||pt==="ref"&&pe.ref===void 0||(ye[pt]=pe[pt]);var pt=arguments.length-2;if(pt===1)ye.children=ke;else if(1<pt){for(var We=Array(pt),_e=0;_e<pt;_e++)We[_e]=arguments[_e+2];ye.children=We}return k(I.type,me,ye)},gn.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:l,_context:I},I},gn.createElement=function(I,pe,ke){var ye,me={},pt=null;if(pe!=null)for(ye in pe.key!==void 0&&(pt=""+pe.key),pe)re.call(pe,ye)&&ye!=="key"&&ye!=="__self"&&ye!=="__source"&&(me[ye]=pe[ye]);var We=arguments.length-2;if(We===1)me.children=ke;else if(1<We){for(var _e=Array(We),Ye=0;Ye<We;Ye++)_e[Ye]=arguments[Ye+2];me.children=_e}if(I&&I.defaultProps)for(ye in We=I.defaultProps,We)me[ye]===void 0&&(me[ye]=We[ye]);return k(I,pt,me)},gn.createRef=function(){return{current:null}},gn.forwardRef=function(I){return{$$typeof:h,render:I}},gn.isValidElement=te,gn.lazy=function(I){return{$$typeof:_,_payload:{_status:-1,_result:I},_init:Z}},gn.memo=function(I,pe){return{$$typeof:g,type:I,compare:pe===void 0?null:pe}},gn.startTransition=function(I){var pe=O.T,ke={};O.T=ke;try{var ye=I(),me=O.S;me!==null&&me(ke,ye),typeof ye=="object"&&ye!==null&&typeof ye.then=="function"&&ye.then(K,ee)}catch(pt){ee(pt)}finally{pe!==null&&ke.types!==null&&(pe.types=ke.types),O.T=pe}},gn.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},gn.use=function(I){return O.H.use(I)},gn.useActionState=function(I,pe,ke){return O.H.useActionState(I,pe,ke)},gn.useCallback=function(I,pe){return O.H.useCallback(I,pe)},gn.useContext=function(I){return O.H.useContext(I)},gn.useDebugValue=function(){},gn.useDeferredValue=function(I,pe){return O.H.useDeferredValue(I,pe)},gn.useEffect=function(I,pe){return O.H.useEffect(I,pe)},gn.useEffectEvent=function(I){return O.H.useEffectEvent(I)},gn.useId=function(){return O.H.useId()},gn.useImperativeHandle=function(I,pe,ke){return O.H.useImperativeHandle(I,pe,ke)},gn.useInsertionEffect=function(I,pe){return O.H.useInsertionEffect(I,pe)},gn.useLayoutEffect=function(I,pe){return O.H.useLayoutEffect(I,pe)},gn.useMemo=function(I,pe){return O.H.useMemo(I,pe)},gn.useOptimistic=function(I,pe){return O.H.useOptimistic(I,pe)},gn.useReducer=function(I,pe,ke){return O.H.useReducer(I,pe,ke)},gn.useRef=function(I){return O.H.useRef(I)},gn.useState=function(I){return O.H.useState(I)},gn.useSyncExternalStore=function(I,pe,ke){return O.H.useSyncExternalStore(I,pe,ke)},gn.useTransition=function(){return O.H.useTransition()},gn.version="19.2.3",gn}var r1;function Kf(){return r1||(r1=1,mm.exports=YE()),mm.exports}var m=Kf();const Zt=Du(m),s1=GE({__proto__:null,default:Zt},[m]);var gm={exports:{}},Oc={},ym={exports:{}},bm={};var a1;function QE(){return a1||(a1=1,(function(n){function e(z,P){var Z=z.length;z.push(P);e:for(;0<Z;){var ee=Z-1>>>1,fe=z[ee];if(0<a(fe,P))z[ee]=P,z[Z]=fe,Z=ee;else break e}}function t(z){return z.length===0?null:z[0]}function i(z){if(z.length===0)return null;var P=z[0],Z=z.pop();if(Z!==P){z[0]=Z;e:for(var ee=0,fe=z.length,I=fe>>>1;ee<I;){var pe=2*(ee+1)-1,ke=z[pe],ye=pe+1,me=z[ye];if(0>a(ke,Z))ye<fe&&0>a(me,ke)?(z[ee]=me,z[ye]=Z,ee=ye):(z[ee]=ke,z[pe]=Z,ee=pe);else if(ye<fe&&0>a(me,Z))z[ee]=me,z[ye]=Z,ee=ye;else break e}}return P}function a(z,P){var Z=z.sortIndex-P.sortIndex;return Z!==0?Z:z.id-P.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var f=[],g=[],_=1,S=null,C=3,D=!1,R=!1,E=!1,B=!1,G=typeof setTimeout=="function"?setTimeout:null,Y=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function se(z){for(var P=t(g);P!==null;){if(P.callback===null)i(g);else if(P.startTime<=z)i(g),P.sortIndex=P.expirationTime,e(f,P);else break;P=t(g)}}function Q(z){if(E=!1,se(z),!R)if(t(f)!==null)R=!0,K||(K=!0,V());else{var P=t(g);P!==null&&ae(Q,P.startTime-z)}}var K=!1,O=-1,re=5,k=-1;function j(){return B?!0:!(n.unstable_now()-k<re)}function te(){if(B=!1,K){var z=n.unstable_now();k=z;var P=!0;try{e:{R=!1,E&&(E=!1,Y(O),O=-1),D=!0;var Z=C;try{t:{for(se(z),S=t(f);S!==null&&!(S.expirationTime>z&&j());){var ee=S.callback;if(typeof ee=="function"){S.callback=null,C=S.priorityLevel;var fe=ee(S.expirationTime<=z);if(z=n.unstable_now(),typeof fe=="function"){S.callback=fe,se(z),P=!0;break t}S===t(f)&&i(f),se(z)}else i(f);S=t(f)}if(S!==null)P=!0;else{var I=t(g);I!==null&&ae(Q,I.startTime-z),P=!1}}break e}finally{S=null,C=Z,D=!1}P=void 0}}finally{P?V():K=!1}}}var V;if(typeof q=="function")V=function(){q(te)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,he=ne.port2;ne.port1.onmessage=te,V=function(){he.postMessage(null)}}else V=function(){G(te,0)};function ae(z,P){O=G(function(){z(n.unstable_now())},P)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):re=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return C},n.unstable_next=function(z){switch(C){case 1:case 2:case 3:var P=3;break;default:P=C}var Z=C;C=P;try{return z()}finally{C=Z}},n.unstable_requestPaint=function(){B=!0},n.unstable_runWithPriority=function(z,P){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Z=C;C=z;try{return P()}finally{C=Z}},n.unstable_scheduleCallback=function(z,P,Z){var ee=n.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?ee+Z:ee):Z=ee,z){case 1:var fe=-1;break;case 2:fe=250;break;case 5:fe=1073741823;break;case 4:fe=1e4;break;default:fe=5e3}return fe=Z+fe,z={id:_++,callback:P,priorityLevel:z,startTime:Z,expirationTime:fe,sortIndex:-1},Z>ee?(z.sortIndex=Z,e(g,z),t(f)===null&&z===t(g)&&(E?(Y(O),O=-1):E=!0,ae(Q,Z-ee))):(z.sortIndex=fe,e(f,z),R||D||(R=!0,K||(K=!0,V()))),z},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(z){var P=C;return function(){var Z=C;C=P;try{return z.apply(this,arguments)}finally{C=Z}}}})(bm)),bm}var o1;function ZE(){return o1||(o1=1,ym.exports=QE()),ym.exports}var vm={exports:{}},br={};var l1;function JE(){if(l1)return br;l1=1;var n=Kf();function e(f){var g="https://react.dev/errors/"+f;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)g+="&args[]="+encodeURIComponent(arguments[_])}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,_){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:_}}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 br.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,br.createPortal=function(f,g){var _=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,_)},br.flushSync=function(f){var g=u.T,_=i.p;try{if(u.T=null,i.p=2,f)return f()}finally{u.T=g,i.p=_,i.d.f()}},br.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))},br.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},br.preinit=function(f,g){if(typeof f=="string"&&g&&typeof g.as=="string"){var _=g.as,S=h(_,g.crossOrigin),C=typeof g.integrity=="string"?g.integrity:void 0,D=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;_==="style"?i.d.S(f,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:S,integrity:C,fetchPriority:D}):_==="script"&&i.d.X(f,{crossOrigin:S,integrity:C,fetchPriority:D,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},br.preinitModule=function(f,g){if(typeof f=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var _=h(g.as,g.crossOrigin);i.d.M(f,{crossOrigin:_,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)},br.preload=function(f,g){if(typeof f=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var _=g.as,S=h(_,g.crossOrigin);i.d.L(f,_,{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})}},br.preloadModule=function(f,g){if(typeof f=="string")if(g){var _=h(g.as,g.crossOrigin);i.d.m(f,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else i.d.m(f)},br.requestFormReset=function(f){i.d.r(f)},br.unstable_batchedUpdates=function(f,g){return f(g)},br.useFormState=function(f,g,_){return u.H.useFormState(f,g,_)},br.useFormStatus=function(){return u.H.useHostTransitionStatus()},br.version="19.2.3",br}var u1;function X_(){if(u1)return vm.exports;u1=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(),vm.exports=JE(),vm.exports}var c1;function eC(){if(c1)return Oc;c1=1;var n=ZE(),e=Kf(),t=X_();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,H=y.child;H;){if(H===o){M=!0,o=y,d=b;break}if(H===d){M=!0,d=y,o=b;break}H=H.sibling}if(!M){for(H=b.child;H;){if(H===o){M=!0,o=b,d=y;break}if(H===d){M=!0,d=b,o=y;break}H=H.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 _(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=_(r),s!==null)return s;r=r.sibling}return null}var S=Object.assign,C=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),Y=Symbol.for("react.consumer"),q=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),re=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function V(r){return r===null||typeof r!="object"?null:(r=te&&r[te]||r["@@iterator"],typeof r=="function"?r:null)}var ne=Symbol.for("react.client.reference");function he(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ne?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case E:return"Fragment";case G:return"Profiler";case B:return"StrictMode";case Q:return"Suspense";case K:return"SuspenseList";case k:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case R:return"Portal";case q:return r.displayName||"Context";case Y:return(r._context.displayName||"Context")+".Consumer";case se: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:he(r.type)||"Memo";case re:s=r._payload,r=r._init;try{return he(r(s))}catch{}}return null}var ae=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},ee=[],fe=-1;function I(r){return{current:r}}function pe(r){0>fe||(r.current=ee[fe],ee[fe]=null,fe--)}function ke(r,s){fe++,ee[fe]=r.current,r.current=s}var ye=I(null),me=I(null),pt=I(null),We=I(null);function _e(r,s){switch(ke(pt,s),ke(me,r),ke(ye,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?Sx(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=Sx(s),r=kx(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}pe(ye),ke(ye,r)}function Ye(){pe(ye),pe(me),pe(pt)}function wt(r){r.memoizedState!==null&&ke(We,r);var s=ye.current,o=kx(s,r.type);s!==o&&(ke(me,r),ke(ye,o))}function je(r){me.current===r&&(pe(ye),pe(me)),We.current===r&&(pe(We),Nc._currentValue=Z)}var Se,Je;function tt(r){if(Se===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Se=s&&s[1]||"",Je=-1<o.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Se+r+Je}var ot=!1;function dt(r,s){if(!r||ot)return"";ot=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ut=function(){throw Error()};if(Object.defineProperty(ut.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ut,[])}catch(Xe){var $e=Xe}Reflect.construct(r,[],ut)}else{try{ut.call()}catch(Xe){$e=Xe}r.call(ut.prototype)}}else{try{throw Error()}catch(Xe){$e=Xe}(ut=r())&&typeof ut.catch=="function"&&ut.catch(function(){})}}catch(Xe){if(Xe&&$e&&typeof Xe.stack=="string")return[Xe.stack,$e.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],H=b[1];if(M&&H){var ge=M.split(`
|
||
`),Ue=H.split(`
|
||
`);for(y=d=0;d<ge.length&&!ge[d].includes("DetermineComponentFrameRoot");)d++;for(;y<Ue.length&&!Ue[y].includes("DetermineComponentFrameRoot");)y++;if(d===ge.length||y===Ue.length)for(d=ge.length-1,y=Ue.length-1;1<=d&&0<=y&&ge[d]!==Ue[y];)y--;for(;1<=d&&0<=y;d--,y--)if(ge[d]!==Ue[y]){if(d!==1||y!==1)do if(d--,y--,0>y||ge[d]!==Ue[y]){var st=`
|
||
`+ge[d].replace(" at new "," at ");return r.displayName&&st.includes("<anonymous>")&&(st=st.replace("<anonymous>",r.displayName)),st}while(1<=d&&0<=y);break}}}finally{ot=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?tt(o):""}function Ut(r,s){switch(r.tag){case 26:case 27:case 5:return tt(r.type);case 16:return tt("Lazy");case 13:return r.child!==s&&s!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return dt(r.type,!1);case 11:return dt(r.type.render,!1);case 1:return dt(r.type,!0);case 31:return tt("Activity");default:return""}}function Ge(r){try{var s="",o=null;do s+=Ut(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
|
||
Error generating stack: `+d.message+`
|
||
`+d.stack}}var Ie=Object.prototype.hasOwnProperty,Ze=n.unstable_scheduleCallback,et=n.unstable_cancelCallback,ft=n.unstable_shouldYield,mt=n.unstable_requestPaint,de=n.unstable_now,ze=n.unstable_getCurrentPriorityLevel,Le=n.unstable_ImmediatePriority,Ae=n.unstable_UserBlockingPriority,Pe=n.unstable_NormalPriority,Qe=n.unstable_LowPriority,St=n.unstable_IdlePriority,Ot=n.log,Tt=n.unstable_setDisableYieldValue,an=null,Nt=null;function Lt(r){if(typeof Ot=="function"&&Tt(r),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(an,r)}catch{}}var vt=Math.clz32?Math.clz32:$n,It=Math.log,yn=Math.LN2;function $n(r){return r>>>=0,r===0?32:31-(It(r)/yn|0)|0}var kt=256,Bn=262144,at=4194304;function N(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function F(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var y=0,b=r.suspendedLanes,M=r.pingedLanes;r=r.warmLanes;var H=d&134217727;return H!==0?(d=H&~b,d!==0?y=N(d):(M&=H,M!==0?y=N(M):o||(o=H&~r,o!==0&&(y=N(o))))):(H=d&~b,H!==0?y=N(H):M!==0?y=N(M):o||(o=d&~r,o!==0&&(y=N(o)))),y===0?0:s!==0&&s!==y&&(s&b)===0&&(b=y&-y,o=s&-s,b>=o||b===32&&(o&4194048)!==0)?s:y}function ie(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Me(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 He(){var r=at;return at<<=1,(at&62914560)===0&&(at=4194304),r}function gt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function zt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Jt(r,s,o,d,y,b){var 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 H=r.entanglements,ge=r.expirationTimes,Ue=r.hiddenUpdates;for(o=M&~o;0<o;){var st=31-vt(o),ut=1<<st;H[st]=0,ge[st]=-1;var $e=Ue[st];if($e!==null)for(Ue[st]=null,st=0;st<$e.length;st++){var Xe=$e[st];Xe!==null&&(Xe.lane&=-536870913)}o&=~ut}d!==0&&un(r,d,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(M&~s))}function un(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-vt(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function Xt(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-vt(o),y=1<<d;y&s|r[d]&s&&(r[d]|=s),o&=~y}}function pn(r,s){var o=s&-s;return o=(o&42)!==0?1:fn(o),(o&(r.suspendedLanes|s))!==0?0:o}function fn(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 Kt(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function cn(){var r=P.p;return r!==0?r:(r=window.event,r===void 0?32:Wx(r.type))}function dn(r,s){var o=P.p;try{return P.p=r,s()}finally{P.p=o}}var ln=Math.random().toString(36).slice(2),qt="__reactFiber$"+ln,Rt="__reactProps$"+ln,Dt="__reactContainer$"+ln,Cn="__reactEvents$"+ln,Mt="__reactListeners$"+ln,Pn="__reactHandles$"+ln,Dn="__reactResources$"+ln,Mn="__reactMarker$"+ln;function Wt(r){delete r[qt],delete r[Rt],delete r[Cn],delete r[Mt],delete r[Pn]}function Vn(r){var s=r[qt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[Dt]||o[qt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=jx(r);r!==null;){if(o=r[qt])return o;r=jx(r)}return s}r=o,o=r.parentNode}return null}function Yn(r){if(r=r[qt]||r[Dt]){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 Qn(r){var s=r[Dn];return s||(s=r[Dn]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function mn(r){r[Mn]=!0}var Ri=new Set,Zn={};function Kn(r,s){ni(r,s),ni(r+"Capture",s)}function ni(r,s){for(Zn[r]=s,r=0;r<s.length;r++)Ri.add(s[r])}var Si=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]*$"),An={},Fn={};function Hn(r){return Ie.call(Fn,r)?!0:Ie.call(An,r)?!1:Si.test(r)?Fn[r]=!0:(An[r]=!0,!1)}function ve(r,s,o){if(Hn(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 rt(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 ct(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 jt(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 bt(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 xt(r){if(!r._valueTracker){var s=De(r)?"checked":"value";r._valueTracker=bt(r,s,""+r[s])}}function Et(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 Ft(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 $t=/[\n"\\]/g;function Vt(r){return r.replace($t,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function vn(r,s,o,d,y,b,M,H){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=""+jt(s)):r.value!==""+jt(s)&&(r.value=""+jt(s)):M!=="submit"&&M!=="reset"||r.removeAttribute("value"),s!=null?Yi(r,M,jt(s)):o!=null?Yi(r,M,jt(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?r.name=""+jt(H):r.removeAttribute("name")}function qn(r,s,o,d,y,b,M,H){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)){xt(r);return}o=o!=null?""+jt(o):"",s=s!=null?""+jt(s):o,H||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=H?r.checked:!!d,r.defaultChecked=!!d,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(r.name=M),xt(r)}function Yi(r,s,o){s==="number"&&Ft(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function Gn(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=""+jt(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 ki(r,s,o){if(s!=null&&(s=""+jt(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+jt(o):""}function Ei(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(ae(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=jt(s),r.defaultValue=o,d=r.textContent,d===o&&d!==""&&d!==null&&(r.value=d),xt(r)}function si(r,s){if(s){var o=r.firstChild;if(o&&o===r.lastChild&&o.nodeType===3){o.nodeValue=s;return}}r.textContent=s}var mi=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 Pi(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||mi.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Sn(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&&Pi(r,y,d)}else for(var b in s)s.hasOwnProperty(b)&&Pi(r,b,s[b])}function Jn(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 wn=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"]]),Ci=/^[\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 Oi(r){return Ci.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function ei(){}var Li=null;function we(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var L=null,$=null;function xe(r){var s=Yn(r);if(s&&(r=s.stateNode)){var o=r[Rt]||null;e:switch(r=s.stateNode,s.type){case"input":if(vn(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="'+Vt(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var y=d[Rt]||null;if(!y)throw Error(i(90));vn(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&&Et(d)}break e;case"textarea":ki(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Gn(r,!!o.multiple,s,!1)}}}var Te=!1;function Ve(r,s,o){if(Te)return r(s,o);Te=!0;try{var d=r(s);return d}finally{if(Te=!1,(L!==null||$!==null)&&(wh(),L&&(s=L,r=$,$=L=null,xe(s),r)))for(s=0;s<r.length;s++)xe(r[s])}}function qe(r,s){var o=r.stateNode;if(o===null)return null;var d=o[Rt]||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 U=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),W=!1;if(U)try{var le={};Object.defineProperty(le,"passive",{get:function(){W=!0}}),window.addEventListener("test",le,le),window.removeEventListener("test",le,le)}catch{W=!1}var be=null,Ce=null,Oe=null;function ht(){if(Oe)return Oe;var r,s=Ce,o=s.length,d,y="value"in be?be.value:be.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 Oe=y.slice(r,1<d?1-d:void 0)}function At(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 yt(){return!0}function rn(){return!1}function Yt(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 H in r)r.hasOwnProperty(H)&&(o=r[H],this[H]=o?o(b):b[H]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?yt:rn,this.isPropagationStopped=rn,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=yt)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=yt)},persist:function(){},isPersistent:yt}),s}var Rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ui=Yt(Rn),Kr=S({},Rn,{view:0,detail:0}),xn=Yt(Kr),Os,sa,Ar,ci=S({},Kr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pu,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!==Ar&&(Ar&&r.type==="mousemove"?(Os=r.screenX-Ar.screenX,sa=r.screenY-Ar.screenY):sa=Os=0,Ar=r),Os)},movementY:function(r){return"movementY"in r?r.movementY:sa}}),Fi=Yt(ci),_s=S({},ci,{dataTransfer:0}),Do=Yt(_s),k0=S({},Kr,{relatedTarget:0}),Oa=Yt(k0),Mo=S({},Rn,{animationName:0,elapsedTime:0,pseudoElement:0}),jo=Yt(Mo),wl=S({},Rn,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Wr=Yt(wl),ws=S({},Rn,{data:0}),Ro=Yt(ws),Cd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},E0={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"},C0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function A0(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=C0[r])?!!s[r]:!1}function Pu(){return A0}var Ad=S({},Kr,{key:function(r){if(r.key){var s=Cd[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=At(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?E0[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pu,charCode:function(r){return r.type==="keypress"?At(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?At(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Nd=Yt(Ad),Tl=S({},ci,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),La=Yt(Tl),Sl=S({},Kr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pu}),aa=Yt(Sl),N0=S({},Rn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Dd=Yt(N0),Md=S({},ci,{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=Yt(Md),D0=S({},Rn,{newState:0,oldState:0}),M0=Yt(D0),j0=[9,13,27,32],Ia=U&&"CompositionEvent"in window,Oo=null;U&&"documentMode"in document&&(Oo=document.documentMode);var Rd=U&&"TextEvent"in window&&!Oo,Od=U&&(!Ia||Oo&&8<Oo&&11>=Oo),Ld=" ",Fu=!1;function kl(r,s){switch(r){case"keyup":return j0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Id(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ba=!1;function R0(r,s){switch(r){case"compositionend":return Id(s);case"keypress":return s.which!==32?null:(Fu=!0,Ld);case"textInput":return r=s.data,r===Ld&&Fu?null:r;default:return null}}function Uu(r,s){if(Ba)return r==="compositionend"||!Ia&&kl(r,s)?(r=ht(),Oe=Ce=be=null,Ba=!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 Od&&s.locale!=="ko"?null:s.data;default:return null}}var O0={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 zu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!O0[r.type]:s==="textarea"}function Bd(r,s,o,d){L?$?$.push(d):$=[d]:L=d,s=Nh(s,"onChange"),0<s.length&&(o=new ui("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var Lo=null,Pa=null;function L0(r){bx(r,0)}function Io(r){var s=jn(r);if(Et(s))return r}function $u(r,s){if(r==="change")return s}var Hu=!1;if(U){var qu;if(U){var Vu="oninput"in document;if(!Vu){var Bo=document.createElement("div");Bo.setAttribute("oninput","return;"),Vu=typeof Bo.oninput=="function"}qu=Vu}else qu=!1;Hu=qu&&(!document.documentMode||9<document.documentMode)}function Pd(){Lo&&(Lo.detachEvent("onpropertychange",Fd),Pa=Lo=null)}function Fd(r){if(r.propertyName==="value"&&Io(Pa)){var s=[];Bd(s,Pa,r,we(r)),Ve(L0,s)}}function I0(r,s,o){r==="focusin"?(Pd(),Lo=s,Pa=o,Lo.attachEvent("onpropertychange",Fd)):r==="focusout"&&Pd()}function B0(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Io(Pa)}function Ud(r,s){if(r==="click")return Io(s)}function P0(r,s){if(r==="input"||r==="change")return Io(s)}function Po(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var gr=typeof Object.is=="function"?Object.is:Po;function Ls(r,s){if(gr(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(!Ie.call(s,y)||!gr(r[y],s[y]))return!1}return!0}function Fa(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ai(r,s){var o=Fa(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=Fa(o)}}function oa(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?oa(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=Ft(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=Ft(r.document)}return s}function Gu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var F0=U&&"documentMode"in document&&11>=document.documentMode,Ua=null,Ku=null,za=null,Cl=!1;function Wu(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Cl||Ua==null||Ua!==Ft(d)||(d=Ua,"selectionStart"in d&&Gu(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),za&&Ls(za,d)||(za=d,d=Nh(Ku,"onSelect"),0<d.length&&(s=new ui("onSelect","select",null,s,o),r.push({event:s,listeners:d}),s.target=Ua)))}function Is(r,s){var o={};return o[r.toLowerCase()]=s.toLowerCase(),o["Webkit"+r]="webkit"+s,o["Moz"+r]="moz"+s,o}var la={animationend:Is("Animation","AnimationEnd"),animationiteration:Is("Animation","AnimationIteration"),animationstart:Is("Animation","AnimationStart"),transitionrun:Is("Transition","TransitionRun"),transitionstart:Is("Transition","TransitionStart"),transitioncancel:Is("Transition","TransitionCancel"),transitionend:Is("Transition","TransitionEnd")},Fo={},Xu={};U&&(Xu=document.createElement("div").style,"AnimationEvent"in window||(delete la.animationend.animation,delete la.animationiteration.animation,delete la.animationstart.animation),"TransitionEvent"in window||delete la.transitionend.transition);function Ts(r){if(Fo[r])return Fo[r];if(!la[r])return r;var s=la[r],o;for(o in s)if(s.hasOwnProperty(o)&&o in Xu)return Fo[r]=s[o];return r}var zd=Ts("animationend"),$a=Ts("animationiteration"),$d=Ts("animationstart"),Hd=Ts("transitionrun"),qd=Ts("transitionstart"),U0=Ts("transitioncancel"),Vd=Ts("transitionend"),Yu=new Map,Qu="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(" ");Qu.push("scrollEnd");function Xr(r,s){Yu.set(r,s),Kn(s,[r])}var Ha=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)},Nr=[],qa=0,Zu=0;function Al(){for(var r=qa,s=Zu=qa=0;s<r;){var o=Nr[s];Nr[s++]=null;var d=Nr[s];Nr[s++]=null;var y=Nr[s];Nr[s++]=null;var b=Nr[s];if(Nr[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&&Gd(o,y,b)}}function Nl(r,s,o,d){Nr[qa++]=r,Nr[qa++]=s,Nr[qa++]=o,Nr[qa++]=d,Zu|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Ju(r,s,o,d){return Nl(r,s,o,d),Dl(r)}function ua(r,s){return Nl(r,null,null,s),Dl(r)}function Gd(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-vt(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<wc)throw wc=0,Pp=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Va={};function z0(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 Ui(r,s,o,d){return new z0(r,s,o,d)}function ec(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ss(r,s){var o=r.alternate;return o===null?(o=Ui(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 Kd(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 tc(r,s,o,d,y,b){var M=0;if(d=r,typeof r=="function")ec(r)&&(M=1);else if(typeof r=="string")M=OE(r,o,ye.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case k:return r=Ui(31,o,s,y),r.elementType=k,r.lanes=b,r;case E:return Bs(o.children,y,b,s);case B:M=8,y|=24;break;case G:return r=Ui(12,o,s,y|2),r.elementType=G,r.lanes=b,r;case Q:return r=Ui(13,o,s,y),r.elementType=Q,r.lanes=b,r;case K:return r=Ui(19,o,s,y),r.elementType=K,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case q:M=10;break e;case Y:M=9;break e;case se: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=Ui(M,o,s,y),s.elementType=r,s.type=d,s.lanes=b,s}function Bs(r,s,o,d){return r=Ui(7,r,d,s),r.lanes=o,r}function Uo(r,s,o){return r=Ui(6,r,null,s),r.lanes=o,r}function nc(r){var s=Ui(18,null,null,0);return s.stateNode=r,s}function Ga(r,s,o){return s=Ui(4,r.children!==null?r.children:[],r.key,s),s.lanes=o,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var zo=new WeakMap;function Dr(r,s){if(typeof r=="object"&&r!==null){var o=zo.get(r);return o!==void 0?o:(s={value:r,source:s,stack:Ge(s)},zo.set(r,s),s)}return{value:r,source:s,stack:Ge(s)}}var Ka=[],Wa=0,Ml=null,$o=0,yr=[],Mr=0,Ps=null,Yr=1,cr="";function kn(r,s){Ka[Wa++]=$o,Ka[Wa++]=Ml,Ml=r,$o=s}function Fs(r,s,o){yr[Mr++]=Yr,yr[Mr++]=cr,yr[Mr++]=Ps,Ps=r;var d=Yr;r=cr;var y=32-vt(d)-1;d&=~(1<<y),o+=1;var b=32-vt(s)+y;if(30<b){var M=y-y%5;b=(d&(1<<M)-1).toString(32),d>>=M,y-=M,Yr=1<<32-vt(s)+y|o<<y|d,cr=b+r}else Yr=1<<b|o<<y|d,cr=r}function nr(r){r.return!==null&&(kn(r,1),Fs(r,1,0))}function jr(r){for(;r===Ml;)Ml=Ka[--Wa],Ka[Wa]=null,$o=Ka[--Wa],Ka[Wa]=null;for(;r===Ps;)Ps=yr[--Mr],yr[Mr]=null,cr=yr[--Mr],yr[Mr]=null,Yr=yr[--Mr],yr[Mr]=null}function Wd(r,s){yr[Mr++]=Yr,yr[Mr++]=cr,yr[Mr++]=Ps,Yr=s.id,cr=s.overflow,Ps=r}var Qi=null,gi=null,On=!1,Us=null,Rr=!1,ic=Error(i(519));function zs(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw x(Dr(s,r)),ic}function Xd(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[qt]=r,s[Rt]=d,o){case"dialog":In("cancel",s),In("close",s);break;case"iframe":case"object":case"embed":In("load",s);break;case"video":case"audio":for(o=0;o<Sc.length;o++)In(Sc[o],s);break;case"source":In("error",s);break;case"img":case"image":case"link":In("error",s),In("load",s);break;case"details":In("toggle",s);break;case"input":In("invalid",s),qn(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":In("invalid",s);break;case"textarea":In("invalid",s),Ei(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||wx(s.textContent,o)?(d.popover!=null&&(In("beforetoggle",s),In("toggle",s)),d.onScroll!=null&&In("scroll",s),d.onScrollEnd!=null&&In("scrollend",s),d.onClick!=null&&(s.onclick=ei),s=!0):s=!1,s||zs(r,!0)}function rc(r){for(Qi=r.return;Qi;)switch(Qi.tag){case 5:case 31:case 13:Rr=!1;return;case 27:case 3:Rr=!0;return;default:Qi=Qi.return}}function p(r){if(r!==Qi)return!1;if(!On)return rc(r),On=!0,!1;var s=r.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=r.type,o=!(o!=="form"&&o!=="button")||Jp(r.type,r.memoizedProps)),o=!o),o&&gi&&zs(r),rc(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));gi=Mx(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));gi=Mx(r)}else s===27?(s=gi,oo(r.type)?(r=rm,rm=null,gi=r):gi=s):gi=Qi?cs(r.stateNode.nextSibling):null;return!0}function v(){gi=Qi=null,On=!1}function w(){var r=Us;return r!==null&&(Br===null?Br=r:Br.push.apply(Br,r),Us=null),r}function x(r){Us===null?Us=[r]:Us.push(r)}var T=I(null),A=null,X=null;function J(r,s,o){ke(T,s._currentValue),s._currentValue=o}function oe(r){r._currentValue=T.current,pe(T)}function ce(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 Ne(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 H=b;b=y;for(var ge=0;ge<s.length;ge++)if(H.context===s[ge]){b.lanes|=o,H=b.alternate,H!==null&&(H.lanes|=o),ce(b.return,o,r),d||(M=null);break e}b=H.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),ce(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 Ke(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 H=y.type;gr(y.pendingProps.value,M.value)||(r!==null?r.push(H):r=[H])}}else if(y===We.current){if(M=y.alternate,M===null)throw Error(i(387));M.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Nc):r=[Nc])}y=y.return}r!==null&&Ne(s,r,o,d),s.flags|=262144}function Ct(r){for(r=r.firstContext;r!==null;){if(!gr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function it(r){A=r,X=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bt(r){return Vi(A,r)}function hn(r,s){return A===null&&it(r),Vi(r,s)}function Vi(r,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},X===null){if(r===null)throw Error(i(308));X=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else X=X.next=s;return o}var wr=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()})}},$s=n.unstable_scheduleCallback,Ho=n.unstable_NormalPriority,xi={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new wr,data:new Map,refCount:0}}function ks(r){r.refCount--,r.refCount===0&&$s(Ho,function(){r.controller.abort()})}var Hs=null,ai=0,ls=0,sr=null;function Rk(r,s){if(Hs===null){var o=Hs=[];ai=0,ls=qp(),sr={status:"pending",value:void 0,then:function(d){o.push(d)}}}return ai++,s.then(lb,lb),s}function lb(){if(--ai===0&&Hs!==null){sr!==null&&(sr.status="fulfilled");var r=Hs;Hs=null,ls=0,sr=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Ok(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 ub=z.S;z.S=function(r,s){Gv=de(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Rk(r,s),ub!==null&&ub(r,s)};var qo=I(null);function $0(){var r=qo.current;return r!==null?r:yi.pooledCache}function Yd(r,s){s===null?ke(qo,qo.current):ke(qo,s.pool)}function cb(){var r=$0();return r===null?null:{parent:xi._currentValue,pool:r}}var jl=Error(i(460)),H0=Error(i(474)),Qd=Error(i(542)),Zd={then:function(){}};function db(r){return r=r.status,r==="fulfilled"||r==="rejected"}function hb(r,s,o){switch(o=r[o],o===void 0?r.push(s):o!==s&&(s.then(ei,ei),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,pb(r),r;default:if(typeof s.status=="string")s.then(ei,ei);else{if(r=yi,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,pb(r),r}throw Go=s,jl}}function Vo(r){try{var s=r._init;return s(r._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Go=o,jl):o}}var Go=null;function fb(){if(Go===null)throw Error(i(459));var r=Go;return Go=null,r}function pb(r){if(r===jl||r===Qd)throw Error(i(483))}var Rl=null,sc=0;function Jd(r){var s=sc;return sc+=1,Rl===null&&(Rl=[]),hb(Rl,r,s)}function ac(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function eh(r,s){throw s.$$typeof===C?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function mb(r){function s(Re,Ee){if(r){var Fe=Re.deletions;Fe===null?(Re.deletions=[Ee],Re.flags|=16):Fe.push(Ee)}}function o(Re,Ee){if(!r)return null;for(;Ee!==null;)s(Re,Ee),Ee=Ee.sibling;return null}function d(Re){for(var Ee=new Map;Re!==null;)Re.key!==null?Ee.set(Re.key,Re):Ee.set(Re.index,Re),Re=Re.sibling;return Ee}function y(Re,Ee){return Re=Ss(Re,Ee),Re.index=0,Re.sibling=null,Re}function b(Re,Ee,Fe){return Re.index=Fe,r?(Fe=Re.alternate,Fe!==null?(Fe=Fe.index,Fe<Ee?(Re.flags|=67108866,Ee):Fe):(Re.flags|=67108866,Ee)):(Re.flags|=1048576,Ee)}function M(Re){return r&&Re.alternate===null&&(Re.flags|=67108866),Re}function H(Re,Ee,Fe,lt){return Ee===null||Ee.tag!==6?(Ee=Uo(Fe,Re.mode,lt),Ee.return=Re,Ee):(Ee=y(Ee,Fe),Ee.return=Re,Ee)}function ge(Re,Ee,Fe,lt){var Qt=Fe.type;return Qt===E?st(Re,Ee,Fe.props.children,lt,Fe.key):Ee!==null&&(Ee.elementType===Qt||typeof Qt=="object"&&Qt!==null&&Qt.$$typeof===re&&Vo(Qt)===Ee.type)?(Ee=y(Ee,Fe.props),ac(Ee,Fe),Ee.return=Re,Ee):(Ee=tc(Fe.type,Fe.key,Fe.props,null,Re.mode,lt),ac(Ee,Fe),Ee.return=Re,Ee)}function Ue(Re,Ee,Fe,lt){return Ee===null||Ee.tag!==4||Ee.stateNode.containerInfo!==Fe.containerInfo||Ee.stateNode.implementation!==Fe.implementation?(Ee=Ga(Fe,Re.mode,lt),Ee.return=Re,Ee):(Ee=y(Ee,Fe.children||[]),Ee.return=Re,Ee)}function st(Re,Ee,Fe,lt,Qt){return Ee===null||Ee.tag!==7?(Ee=Bs(Fe,Re.mode,lt,Qt),Ee.return=Re,Ee):(Ee=y(Ee,Fe),Ee.return=Re,Ee)}function ut(Re,Ee,Fe){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ee=Uo(""+Ee,Re.mode,Fe),Ee.return=Re,Ee;if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case D:return Fe=tc(Ee.type,Ee.key,Ee.props,null,Re.mode,Fe),ac(Fe,Ee),Fe.return=Re,Fe;case R:return Ee=Ga(Ee,Re.mode,Fe),Ee.return=Re,Ee;case re:return Ee=Vo(Ee),ut(Re,Ee,Fe)}if(ae(Ee)||V(Ee))return Ee=Bs(Ee,Re.mode,Fe,null),Ee.return=Re,Ee;if(typeof Ee.then=="function")return ut(Re,Jd(Ee),Fe);if(Ee.$$typeof===q)return ut(Re,hn(Re,Ee),Fe);eh(Re,Ee)}return null}function $e(Re,Ee,Fe,lt){var Qt=Ee!==null?Ee.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint")return Qt!==null?null:H(Re,Ee,""+Fe,lt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case D:return Fe.key===Qt?ge(Re,Ee,Fe,lt):null;case R:return Fe.key===Qt?Ue(Re,Ee,Fe,lt):null;case re:return Fe=Vo(Fe),$e(Re,Ee,Fe,lt)}if(ae(Fe)||V(Fe))return Qt!==null?null:st(Re,Ee,Fe,lt,null);if(typeof Fe.then=="function")return $e(Re,Ee,Jd(Fe),lt);if(Fe.$$typeof===q)return $e(Re,Ee,hn(Re,Fe),lt);eh(Re,Fe)}return null}function Xe(Re,Ee,Fe,lt,Qt){if(typeof lt=="string"&<!==""||typeof lt=="number"||typeof lt=="bigint")return Re=Re.get(Fe)||null,H(Ee,Re,""+lt,Qt);if(typeof lt=="object"&<!==null){switch(lt.$$typeof){case D:return Re=Re.get(lt.key===null?Fe:lt.key)||null,ge(Ee,Re,lt,Qt);case R:return Re=Re.get(lt.key===null?Fe:lt.key)||null,Ue(Ee,Re,lt,Qt);case re:return lt=Vo(lt),Xe(Re,Ee,Fe,lt,Qt)}if(ae(lt)||V(lt))return Re=Re.get(Fe)||null,st(Ee,Re,lt,Qt,null);if(typeof lt.then=="function")return Xe(Re,Ee,Fe,Jd(lt),Qt);if(lt.$$typeof===q)return Xe(Re,Ee,Fe,hn(Ee,lt),Qt);eh(Ee,lt)}return null}function Ht(Re,Ee,Fe,lt){for(var Qt=null,Wn=null,Gt=Ee,Tn=Ee=0,zn=null;Gt!==null&&Tn<Fe.length;Tn++){Gt.index>Tn?(zn=Gt,Gt=null):zn=Gt.sibling;var Xn=$e(Re,Gt,Fe[Tn],lt);if(Xn===null){Gt===null&&(Gt=zn);break}r&&Gt&&Xn.alternate===null&&s(Re,Gt),Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn,Gt=zn}if(Tn===Fe.length)return o(Re,Gt),On&&kn(Re,Tn),Qt;if(Gt===null){for(;Tn<Fe.length;Tn++)Gt=ut(Re,Fe[Tn],lt),Gt!==null&&(Ee=b(Gt,Ee,Tn),Wn===null?Qt=Gt:Wn.sibling=Gt,Wn=Gt);return On&&kn(Re,Tn),Qt}for(Gt=d(Gt);Tn<Fe.length;Tn++)zn=Xe(Gt,Re,Tn,Fe[Tn],lt),zn!==null&&(r&&zn.alternate!==null&&Gt.delete(zn.key===null?Tn:zn.key),Ee=b(zn,Ee,Tn),Wn===null?Qt=zn:Wn.sibling=zn,Wn=zn);return r&&Gt.forEach(function(fo){return s(Re,fo)}),On&&kn(Re,Tn),Qt}function sn(Re,Ee,Fe,lt){if(Fe==null)throw Error(i(151));for(var Qt=null,Wn=null,Gt=Ee,Tn=Ee=0,zn=null,Xn=Fe.next();Gt!==null&&!Xn.done;Tn++,Xn=Fe.next()){Gt.index>Tn?(zn=Gt,Gt=null):zn=Gt.sibling;var fo=$e(Re,Gt,Xn.value,lt);if(fo===null){Gt===null&&(Gt=zn);break}r&&Gt&&fo.alternate===null&&s(Re,Gt),Ee=b(fo,Ee,Tn),Wn===null?Qt=fo:Wn.sibling=fo,Wn=fo,Gt=zn}if(Xn.done)return o(Re,Gt),On&&kn(Re,Tn),Qt;if(Gt===null){for(;!Xn.done;Tn++,Xn=Fe.next())Xn=ut(Re,Xn.value,lt),Xn!==null&&(Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn);return On&&kn(Re,Tn),Qt}for(Gt=d(Gt);!Xn.done;Tn++,Xn=Fe.next())Xn=Xe(Gt,Re,Tn,Xn.value,lt),Xn!==null&&(r&&Xn.alternate!==null&&Gt.delete(Xn.key===null?Tn:Xn.key),Ee=b(Xn,Ee,Tn),Wn===null?Qt=Xn:Wn.sibling=Xn,Wn=Xn);return r&&Gt.forEach(function(VE){return s(Re,VE)}),On&&kn(Re,Tn),Qt}function fi(Re,Ee,Fe,lt){if(typeof Fe=="object"&&Fe!==null&&Fe.type===E&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case D:e:{for(var Qt=Fe.key;Ee!==null;){if(Ee.key===Qt){if(Qt=Fe.type,Qt===E){if(Ee.tag===7){o(Re,Ee.sibling),lt=y(Ee,Fe.props.children),lt.return=Re,Re=lt;break e}}else if(Ee.elementType===Qt||typeof Qt=="object"&&Qt!==null&&Qt.$$typeof===re&&Vo(Qt)===Ee.type){o(Re,Ee.sibling),lt=y(Ee,Fe.props),ac(lt,Fe),lt.return=Re,Re=lt;break e}o(Re,Ee);break}else s(Re,Ee);Ee=Ee.sibling}Fe.type===E?(lt=Bs(Fe.props.children,Re.mode,lt,Fe.key),lt.return=Re,Re=lt):(lt=tc(Fe.type,Fe.key,Fe.props,null,Re.mode,lt),ac(lt,Fe),lt.return=Re,Re=lt)}return M(Re);case R:e:{for(Qt=Fe.key;Ee!==null;){if(Ee.key===Qt)if(Ee.tag===4&&Ee.stateNode.containerInfo===Fe.containerInfo&&Ee.stateNode.implementation===Fe.implementation){o(Re,Ee.sibling),lt=y(Ee,Fe.children||[]),lt.return=Re,Re=lt;break e}else{o(Re,Ee);break}else s(Re,Ee);Ee=Ee.sibling}lt=Ga(Fe,Re.mode,lt),lt.return=Re,Re=lt}return M(Re);case re:return Fe=Vo(Fe),fi(Re,Ee,Fe,lt)}if(ae(Fe))return Ht(Re,Ee,Fe,lt);if(V(Fe)){if(Qt=V(Fe),typeof Qt!="function")throw Error(i(150));return Fe=Qt.call(Fe),sn(Re,Ee,Fe,lt)}if(typeof Fe.then=="function")return fi(Re,Ee,Jd(Fe),lt);if(Fe.$$typeof===q)return fi(Re,Ee,hn(Re,Fe),lt);eh(Re,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Ee!==null&&Ee.tag===6?(o(Re,Ee.sibling),lt=y(Ee,Fe),lt.return=Re,Re=lt):(o(Re,Ee),lt=Uo(Fe,Re.mode,lt),lt.return=Re,Re=lt),M(Re)):o(Re,Ee)}return function(Re,Ee,Fe,lt){try{sc=0;var Qt=fi(Re,Ee,Fe,lt);return Rl=null,Qt}catch(Gt){if(Gt===jl||Gt===Qd)throw Gt;var Wn=Ui(29,Gt,null,Re.mode);return Wn.lanes=lt,Wn.return=Re,Wn}}}var Ko=mb(!0),gb=mb(!1),Xa=!1;function q0(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function V0(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ya(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Qa(r,s,o){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ti&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),Gd(r,null,o),s}return Nl(r,d,s,o),Dl(r)}function oc(r,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Xt(r,o)}}function G0(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var y=null,b=null;if(o=o.firstBaseUpdate,o!==null){do{var 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 K0=!1;function lc(){if(K0){var r=sr;if(r!==null)throw r}}function uc(r,s,o,d){K0=!1;var y=r.updateQueue;Xa=!1;var b=y.firstBaseUpdate,M=y.lastBaseUpdate,H=y.shared.pending;if(H!==null){y.shared.pending=null;var ge=H,Ue=ge.next;ge.next=null,M===null?b=Ue:M.next=Ue,M=ge;var st=r.alternate;st!==null&&(st=st.updateQueue,H=st.lastBaseUpdate,H!==M&&(H===null?st.firstBaseUpdate=Ue:H.next=Ue,st.lastBaseUpdate=ge))}if(b!==null){var ut=y.baseState;M=0,st=Ue=ge=null,H=b;do{var $e=H.lane&-536870913,Xe=$e!==H.lane;if(Xe?(Un&$e)===$e:(d&$e)===$e){$e!==0&&$e===ls&&(K0=!0),st!==null&&(st=st.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ht=r,sn=H;$e=s;var fi=o;switch(sn.tag){case 1:if(Ht=sn.payload,typeof Ht=="function"){ut=Ht.call(fi,ut,$e);break e}ut=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=sn.payload,$e=typeof Ht=="function"?Ht.call(fi,ut,$e):Ht,$e==null)break e;ut=S({},ut,$e);break e;case 2:Xa=!0}}$e=H.callback,$e!==null&&(r.flags|=64,Xe&&(r.flags|=8192),Xe=y.callbacks,Xe===null?y.callbacks=[$e]:Xe.push($e))}else Xe={lane:$e,tag:H.tag,payload:H.payload,callback:H.callback,next:null},st===null?(Ue=st=Xe,ge=ut):st=st.next=Xe,M|=$e;if(H=H.next,H===null){if(H=y.shared.pending,H===null)break;Xe=H,H=Xe.next,Xe.next=null,y.lastBaseUpdate=Xe,y.shared.pending=null}}while(!0);st===null&&(ge=ut),y.baseState=ge,y.firstBaseUpdate=Ue,y.lastBaseUpdate=st,b===null&&(y.shared.lanes=0),no|=M,r.lanes=M,r.memoizedState=ut}}function yb(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function bb(r,s){var o=r.callbacks;if(o!==null)for(r.callbacks=null,r=0;r<o.length;r++)yb(o[r],s)}var Ol=I(null),th=I(0);function vb(r,s){r=va,ke(th,r),ke(Ol,s),va=r|s.baseLanes}function W0(){ke(th,va),ke(Ol,Ol.current)}function X0(){va=th.current,pe(Ol),pe(th)}var Qr=I(null),us=null;function Za(r){var s=r.alternate;ke(Gi,Gi.current&1),ke(Qr,r),us===null&&(s===null||Ol.current!==null||s.memoizedState!==null)&&(us=r)}function Y0(r){ke(Gi,Gi.current),ke(Qr,r),us===null&&(us=r)}function xb(r){r.tag===22?(ke(Gi,Gi.current),ke(Qr,r),us===null&&(us=r)):Ja()}function Ja(){ke(Gi,Gi.current),ke(Qr,Qr.current)}function Zr(r){pe(Qr),us===r&&(us=null),pe(Gi)}var Gi=I(0);function nh(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||nm(o)||im(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 da=0,_n=null,di=null,Zi=null,ih=!1,Ll=!1,Wo=!1,rh=0,cc=0,Il=null,Lk=0;function zi(){throw Error(i(321))}function Q0(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!gr(r[o],s[o]))return!1;return!0}function Z0(r,s,o,d,y,b){return da=b,_n=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,z.H=r===null||r.memoizedState===null?iv:fp,Wo=!1,b=o(d,y),Wo=!1,Ll&&(b=wb(s,o,d,y)),_b(r),b}function _b(r){z.H=fc;var s=di!==null&&di.next!==null;if(da=0,Zi=di=_n=null,ih=!1,cc=0,Il=null,s)throw Error(i(300));r===null||Ji||(r=r.dependencies,r!==null&&Ct(r)&&(Ji=!0))}function wb(r,s,o,d){_n=r;var y=0;do{if(Ll&&(Il=null),cc=0,Ll=!1,25<=y)throw Error(i(301));if(y+=1,Zi=di=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}z.H=rv,b=s(o,d)}while(Ll);return b}function Ik(){var r=z.H,s=r.useState()[0];return s=typeof s.then=="function"?dc(s):s,r=r.useState()[0],(di!==null?di.memoizedState:null)!==r&&(_n.flags|=1024),s}function J0(){var r=rh!==0;return rh=0,r}function ep(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function tp(r){if(ih){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}ih=!1}da=0,Zi=di=_n=null,Ll=!1,cc=rh=0,Il=null}function Tr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zi===null?_n.memoizedState=Zi=r:Zi=Zi.next=r,Zi}function Ki(){if(di===null){var r=_n.alternate;r=r!==null?r.memoizedState:null}else r=di.next;var s=Zi===null?_n.memoizedState:Zi.next;if(s!==null)Zi=s,di=r;else{if(r===null)throw _n.alternate===null?Error(i(467)):Error(i(310));di=r,r={memoizedState:di.memoizedState,baseState:di.baseState,baseQueue:di.baseQueue,queue:di.queue,next:null},Zi===null?_n.memoizedState=Zi=r:Zi=Zi.next=r}return Zi}function sh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function dc(r){var s=cc;return cc+=1,Il===null&&(Il=[]),r=hb(Il,r,s),s=_n,(Zi===null?s.memoizedState:Zi.next)===null&&(s=s.alternate,z.H=s===null||s.memoizedState===null?iv:fp),r}function ah(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return dc(r);if(r.$$typeof===q)return Bt(r)}throw Error(i(438,String(r)))}function np(r){var s=null,o=_n.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=_n.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=sh(),_n.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]=j;return s.index++,o}function ha(r,s){return typeof s=="function"?s(r):s}function oh(r){var s=Ki();return ip(s,di,r)}function ip(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 H=M=null,ge=null,Ue=s,st=!1;do{var ut=Ue.lane&-536870913;if(ut!==Ue.lane?(Un&ut)===ut:(da&ut)===ut){var $e=Ue.revertLane;if($e===0)ge!==null&&(ge=ge.next={lane:0,revertLane:0,gesture:null,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null}),ut===ls&&(st=!0);else if((da&$e)===$e){Ue=Ue.next,$e===ls&&(st=!0);continue}else ut={lane:0,revertLane:Ue.revertLane,gesture:null,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null},ge===null?(H=ge=ut,M=b):ge=ge.next=ut,_n.lanes|=$e,no|=$e;ut=Ue.action,Wo&&o(b,ut),b=Ue.hasEagerState?Ue.eagerState:o(b,ut)}else $e={lane:ut,revertLane:Ue.revertLane,gesture:Ue.gesture,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null},ge===null?(H=ge=$e,M=b):ge=ge.next=$e,_n.lanes|=ut,no|=ut;Ue=Ue.next}while(Ue!==null&&Ue!==s);if(ge===null?M=b:ge.next=H,!gr(b,r.memoizedState)&&(Ji=!0,st&&(o=sr,o!==null)))throw o;r.memoizedState=b,r.baseState=M,r.baseQueue=ge,d.lastRenderedState=b}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function rp(r){var s=Ki(),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);gr(b,s.memoizedState)||(Ji=!0),s.memoizedState=b,s.baseQueue===null&&(s.baseState=b),o.lastRenderedState=b}return[b,d]}function Tb(r,s,o){var d=_n,y=Ki(),b=On;if(b){if(o===void 0)throw Error(i(407));o=o()}else o=s();var M=!gr((di||y).memoizedState,o);if(M&&(y.memoizedState=o,Ji=!0),y=y.queue,op(Eb.bind(null,d,y,r),[r]),y.getSnapshot!==s||M||Zi!==null&&Zi.memoizedState.tag&1){if(d.flags|=2048,Bl(9,{destroy:void 0},kb.bind(null,d,y,o,s),null),yi===null)throw Error(i(349));b||(da&127)!==0||Sb(d,s,o)}return o}function Sb(r,s,o){r.flags|=16384,r={getSnapshot:s,value:o},s=_n.updateQueue,s===null?(s=sh(),_n.updateQueue=s,s.stores=[r]):(o=s.stores,o===null?s.stores=[r]:o.push(r))}function kb(r,s,o,d){s.value=o,s.getSnapshot=d,Cb(s)&&Ab(r)}function Eb(r,s,o){return o(function(){Cb(s)&&Ab(r)})}function Cb(r){var s=r.getSnapshot;r=r.value;try{var o=s();return!gr(r,o)}catch{return!0}}function Ab(r){var s=ua(r,2);s!==null&&Pr(s,r,2)}function sp(r){var s=Tr();if(typeof r=="function"){var o=r;if(r=o(),Wo){Lt(!0);try{o()}finally{Lt(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:r},s}function Nb(r,s,o,d){return r.baseState=o,ip(r,di,typeof d=="function"?d:ha)}function Bk(r,s,o,d,y){if(ch(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)}};z.T!==null?o(!0):b.isTransition=!1,d(b),o=s.pending,o===null?(b.next=s.pending=b,Db(s,b)):(b.next=o.next,s.pending=o.next=b)}}function Db(r,s){var o=s.action,d=s.payload,y=r.state;if(s.isTransition){var b=z.T,M={};z.T=M;try{var H=o(y,d),ge=z.S;ge!==null&&ge(M,H),Mb(r,s,H)}catch(Ue){ap(r,s,Ue)}finally{b!==null&&M.types!==null&&(b.types=M.types),z.T=b}}else try{b=o(y,d),Mb(r,s,b)}catch(Ue){ap(r,s,Ue)}}function Mb(r,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){jb(r,s,d)},function(d){return ap(r,s,d)}):jb(r,s,o)}function jb(r,s,o){s.status="fulfilled",s.value=o,Rb(s),r.state=o,s=r.pending,s!==null&&(o=s.next,o===s?r.pending=null:(o=o.next,s.next=o,Db(r,o)))}function ap(r,s,o){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=o,Rb(s),s=s.next;while(s!==d)}r.action=null}function Rb(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function Ob(r,s){return s}function Lb(r,s){if(On){var o=yi.formState;if(o!==null){e:{var d=_n;if(On){if(gi){t:{for(var y=gi,b=Rr;y.nodeType!==8;){if(!b){y=null;break t}if(y=cs(y.nextSibling),y===null){y=null;break t}}b=y.data,y=b==="F!"||b==="F"?y:null}if(y){gi=cs(y.nextSibling),d=y.data==="F!";break e}}zs(d)}d=!1}d&&(s=o[0])}}return o=Tr(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ob,lastRenderedState:s},o.queue=d,o=ev.bind(null,_n,d),d.dispatch=o,d=sp(!1),b=hp.bind(null,_n,!1,d.queue),d=Tr(),y={state:s,dispatch:null,action:r,pending:null},d.queue=y,o=Bk.bind(null,_n,y,b,o),y.dispatch=o,d.memoizedState=r,[s,o,!1]}function Ib(r){var s=Ki();return Bb(s,di,r)}function Bb(r,s,o){if(s=ip(r,s,Ob)[0],r=oh(ha)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=dc(s)}catch(M){throw M===jl?Qd:M}else d=s;s=Ki();var y=s.queue,b=y.dispatch;return o!==s.memoizedState&&(_n.flags|=2048,Bl(9,{destroy:void 0},Pk.bind(null,y,o),null)),[d,b,r]}function Pk(r,s){r.action=s}function Pb(r){var s=Ki(),o=di;if(o!==null)return Bb(s,o,r);Ki(),s=s.memoizedState,o=Ki();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=_n.updateQueue,s===null&&(s=sh(),_n.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 Fb(){return Ki().memoizedState}function lh(r,s,o,d){var y=Tr();_n.flags|=r,y.memoizedState=Bl(1|s,{destroy:void 0},o,d===void 0?null:d)}function uh(r,s,o,d){var y=Ki();d=d===void 0?null:d;var b=y.memoizedState.inst;di!==null&&d!==null&&Q0(d,di.memoizedState.deps)?y.memoizedState=Bl(s,b,o,d):(_n.flags|=r,y.memoizedState=Bl(1|s,b,o,d))}function Ub(r,s){lh(8390656,8,r,s)}function op(r,s){uh(2048,8,r,s)}function Fk(r){_n.flags|=4;var s=_n.updateQueue;if(s===null)s=sh(),_n.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function zb(r){var s=Ki().memoizedState;return Fk({ref:s,nextImpl:r}),function(){if((ti&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function $b(r,s){return uh(4,2,r,s)}function Hb(r,s){return uh(4,4,r,s)}function qb(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 Vb(r,s,o){o=o!=null?o.concat([r]):null,uh(4,4,qb.bind(null,s,r),o)}function lp(){}function Gb(r,s){var o=Ki();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&Q0(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function Kb(r,s){var o=Ki();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&Q0(s,d[1]))return d[0];if(d=r(),Wo){Lt(!0);try{r()}finally{Lt(!1)}}return o.memoizedState=[d,s],d}function up(r,s,o){return o===void 0||(da&1073741824)!==0&&(Un&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=Wv(),_n.lanes|=r,no|=r,o)}function Wb(r,s,o,d){return gr(o,s)?o:Ol.current!==null?(r=up(r,o,d),gr(r,s)||(Ji=!0),r):(da&42)===0||(da&1073741824)!==0&&(Un&261930)===0?(Ji=!0,r.memoizedState=o):(r=Wv(),_n.lanes|=r,no|=r,s)}function Xb(r,s,o,d,y){var b=P.p;P.p=b!==0&&8>b?b:8;var M=z.T,H={};z.T=H,hp(r,!1,s,o);try{var ge=y(),Ue=z.S;if(Ue!==null&&Ue(H,ge),ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var st=Ok(ge,d);hc(r,s,st,ts(r))}else hc(r,s,d,ts(r))}catch(ut){hc(r,s,{then:function(){},status:"rejected",reason:ut},ts())}finally{P.p=b,M!==null&&H.types!==null&&(M.types=H.types),z.T=M}}function Uk(){}function cp(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Yb(r).queue;Xb(r,y,s,Z,o===null?Uk:function(){return Qb(r),o(d)})}function Yb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:Z},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:o},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Qb(r){var s=Yb(r);s.next===null&&(s=r.alternate.memoizedState),hc(r,s.next.queue,{},ts())}function dp(){return Bt(Nc)}function Zb(){return Ki().memoizedState}function Jb(){return Ki().memoizedState}function zk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var o=ts();r=Ya(o);var d=Qa(s,r,o);d!==null&&(Pr(d,s,o),oc(d,s,o)),s={cache:ca()},r.payload=s;return}s=s.return}}function $k(r,s,o){var d=ts();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},ch(r)?tv(s,o):(o=Ju(r,s,o,d),o!==null&&(Pr(o,r,d),nv(o,s,d)))}function ev(r,s,o){var d=ts();hc(r,s,o,d)}function hc(r,s,o,d){var y={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(ch(r))tv(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,H=b(M,o);if(y.hasEagerState=!0,y.eagerState=H,gr(H,M))return Nl(r,s,y,0),yi===null&&Al(),!1}catch{}if(o=Ju(r,s,y,d),o!==null)return Pr(o,r,d),nv(o,s,d),!0}return!1}function hp(r,s,o,d){if(d={lane:2,revertLane:qp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},ch(r)){if(s)throw Error(i(479))}else s=Ju(r,o,d,2),s!==null&&Pr(s,r,2)}function ch(r){var s=r.alternate;return r===_n||s!==null&&s===_n}function tv(r,s){Ll=ih=!0;var o=r.pending;o===null?s.next=s:(s.next=o.next,o.next=s),r.pending=s}function nv(r,s,o){if((o&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,o|=d,s.lanes=o,Xt(r,o)}}var fc={readContext:Bt,use:ah,useCallback:zi,useContext:zi,useEffect:zi,useImperativeHandle:zi,useLayoutEffect:zi,useInsertionEffect:zi,useMemo:zi,useReducer:zi,useRef:zi,useState:zi,useDebugValue:zi,useDeferredValue:zi,useTransition:zi,useSyncExternalStore:zi,useId:zi,useHostTransitionStatus:zi,useFormState:zi,useActionState:zi,useOptimistic:zi,useMemoCache:zi,useCacheRefresh:zi};fc.useEffectEvent=zi;var iv={readContext:Bt,use:ah,useCallback:function(r,s){return Tr().memoizedState=[r,s===void 0?null:s],r},useContext:Bt,useEffect:Ub,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,lh(4194308,4,qb.bind(null,s,r),o)},useLayoutEffect:function(r,s){return lh(4194308,4,r,s)},useInsertionEffect:function(r,s){lh(4,2,r,s)},useMemo:function(r,s){var o=Tr();s=s===void 0?null:s;var d=r();if(Wo){Lt(!0);try{r()}finally{Lt(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Tr();if(o!==void 0){var y=o(s);if(Wo){Lt(!0);try{o(s)}finally{Lt(!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=$k.bind(null,_n,r),[d.memoizedState,r]},useRef:function(r){var s=Tr();return r={current:r},s.memoizedState=r},useState:function(r){r=sp(r);var s=r.queue,o=ev.bind(null,_n,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:lp,useDeferredValue:function(r,s){var o=Tr();return up(o,r,s)},useTransition:function(){var r=sp(!1);return r=Xb.bind(null,_n,r.queue,!0,!1),Tr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=_n,y=Tr();if(On){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),yi===null)throw Error(i(349));(Un&127)!==0||Sb(d,s,o)}y.memoizedState=o;var b={value:o,getSnapshot:s};return y.queue=b,Ub(Eb.bind(null,d,b,r),[r]),d.flags|=2048,Bl(9,{destroy:void 0},kb.bind(null,d,b,o,s),null),o},useId:function(){var r=Tr(),s=yi.identifierPrefix;if(On){var o=cr,d=Yr;o=(d&~(1<<32-vt(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=rh++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=Lk++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:dp,useFormState:Lb,useActionState:Lb,useOptimistic:function(r){var s=Tr();s.memoizedState=s.baseState=r;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=hp.bind(null,_n,!0,o),o.dispatch=s,[r,s]},useMemoCache:np,useCacheRefresh:function(){return Tr().memoizedState=zk.bind(null,_n)},useEffectEvent:function(r){var s=Tr(),o={impl:r};return s.memoizedState=o,function(){if((ti&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},fp={readContext:Bt,use:ah,useCallback:Gb,useContext:Bt,useEffect:op,useImperativeHandle:Vb,useInsertionEffect:$b,useLayoutEffect:Hb,useMemo:Kb,useReducer:oh,useRef:Fb,useState:function(){return oh(ha)},useDebugValue:lp,useDeferredValue:function(r,s){var o=Ki();return Wb(o,di.memoizedState,r,s)},useTransition:function(){var r=oh(ha)[0],s=Ki().memoizedState;return[typeof r=="boolean"?r:dc(r),s]},useSyncExternalStore:Tb,useId:Zb,useHostTransitionStatus:dp,useFormState:Ib,useActionState:Ib,useOptimistic:function(r,s){var o=Ki();return Nb(o,di,r,s)},useMemoCache:np,useCacheRefresh:Jb};fp.useEffectEvent=zb;var rv={readContext:Bt,use:ah,useCallback:Gb,useContext:Bt,useEffect:op,useImperativeHandle:Vb,useInsertionEffect:$b,useLayoutEffect:Hb,useMemo:Kb,useReducer:rp,useRef:Fb,useState:function(){return rp(ha)},useDebugValue:lp,useDeferredValue:function(r,s){var o=Ki();return di===null?up(o,r,s):Wb(o,di.memoizedState,r,s)},useTransition:function(){var r=rp(ha)[0],s=Ki().memoizedState;return[typeof r=="boolean"?r:dc(r),s]},useSyncExternalStore:Tb,useId:Zb,useHostTransitionStatus:dp,useFormState:Pb,useActionState:Pb,useOptimistic:function(r,s){var o=Ki();return di!==null?Nb(o,di,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:np,useCacheRefresh:Jb};rv.useEffectEvent=zb;function pp(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 mp={enqueueSetState:function(r,s,o){r=r._reactInternals;var d=ts(),y=Ya(d);y.payload=s,o!=null&&(y.callback=o),s=Qa(r,y,d),s!==null&&(Pr(s,r,d),oc(s,r,d))},enqueueReplaceState:function(r,s,o){r=r._reactInternals;var d=ts(),y=Ya(d);y.tag=1,y.payload=s,o!=null&&(y.callback=o),s=Qa(r,y,d),s!==null&&(Pr(s,r,d),oc(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var o=ts(),d=Ya(o);d.tag=2,s!=null&&(d.callback=s),s=Qa(r,d,o),s!==null&&(Pr(s,r,o),oc(s,r,o))}};function sv(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?!Ls(o,d)||!Ls(y,b):!0}function av(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&&mp.enqueueReplaceState(s,s.state,null)}function Xo(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 ov(r){Ha(r)}function lv(r){console.error(r)}function uv(r){Ha(r)}function dh(r,s){try{var o=r.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function cv(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 gp(r,s,o){return o=Ya(o),o.tag=3,o.payload={element:null},o.callback=function(){dh(r,s)},o}function dv(r){return r=Ya(r),r.tag=3,r}function hv(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(){cv(s,o,d)}}var M=o.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(r.callback=function(){cv(s,o,d),typeof y!="function"&&(io===null?io=new Set([this]):io.add(this));var H=d.stack;this.componentDidCatch(d.value,{componentStack:H!==null?H:""})})}function Hk(r,s,o,d,y){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&Ke(s,o,y,!0),o=Qr.current,o!==null){switch(o.tag){case 31:case 13:return us===null?Th():o.alternate===null&&$i===0&&($i=3),o.flags&=-257,o.flags|=65536,o.lanes=y,d===Zd?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([d]):s.add(d),zp(r,d,y)),!1;case 22:return o.flags|=65536,d===Zd?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)),zp(r,d,y)),!1}throw Error(i(435,o.tag))}return zp(r,d,y),Th(),!1}if(On)return s=Qr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=y,d!==ic&&(r=Error(i(422),{cause:d}),x(Dr(r,o)))):(d!==ic&&(s=Error(i(423),{cause:d}),x(Dr(s,o))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Dr(d,o),y=gp(r.stateNode,d,y),G0(r,y),$i!==4&&($i=2)),!1;var b=Error(i(520),{cause:d});if(b=Dr(b,o),_c===null?_c=[b]:_c.push(b),$i!==4&&($i=2),s===null)return!0;d=Dr(d,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,r=y&-y,o.lanes|=r,r=gp(o.stateNode,d,r),G0(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"&&(io===null||!io.has(b))))return o.flags|=65536,y&=-y,o.lanes|=y,y=dv(y),hv(y,r,o,d),G0(o,y),!1}o=o.return}while(o!==null);return!1}var yp=Error(i(461)),Ji=!1;function dr(r,s,o,d){s.child=r===null?gb(s,null,o,d):Ko(s,r.child,o,d)}function fv(r,s,o,d,y){o=o.render;var b=s.ref;if("ref"in d){var M={};for(var H in d)H!=="ref"&&(M[H]=d[H])}else M=d;return it(s),d=Z0(r,s,o,M,b,y),H=J0(),r!==null&&!Ji?(ep(r,s,y),fa(r,s,y)):(On&&H&&nr(s),s.flags|=1,dr(r,s,d,y),s.child)}function pv(r,s,o,d,y){if(r===null){var b=o.type;return typeof b=="function"&&!ec(b)&&b.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=b,mv(r,s,b,d,y)):(r=tc(o.type,null,d,s,s.mode,y),r.ref=s.ref,r.return=s,s.child=r)}if(b=r.child,!kp(r,y)){var M=b.memoizedProps;if(o=o.compare,o=o!==null?o:Ls,o(M,d)&&r.ref===s.ref)return fa(r,s,y)}return s.flags|=1,r=Ss(b,d),r.ref=s.ref,r.return=s,s.child=r}function mv(r,s,o,d,y){if(r!==null){var b=r.memoizedProps;if(Ls(b,d)&&r.ref===s.ref)if(Ji=!1,s.pendingProps=d=b,kp(r,y))(r.flags&131072)!==0&&(Ji=!0);else return s.lanes=r.lanes,fa(r,s,y)}return bp(r,s,o,d,y)}function gv(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 yv(r,s,b,o,d)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Yd(s,b!==null?b.cachePool:null),b!==null?vb(s,b):W0(),xb(s);else return d=s.lanes=536870912,yv(r,s,b!==null?b.baseLanes|o:o,o,d)}else b!==null?(Yd(s,b.cachePool),vb(s,b),Ja(),s.memoizedState=null):(r!==null&&Yd(s,null),W0(),Ja());return dr(r,s,y,o),s.child}function pc(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function yv(r,s,o,d,y){var b=$0();return b=b===null?null:{parent:xi._currentValue,pool:b},s.memoizedState={baseLanes:o,cachePool:b},r!==null&&Yd(s,null),W0(),xb(s),r!==null&&Ke(r,s,d,!0),s.childLanes=y,null}function hh(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 bv(r,s,o){return Ko(s,r.child,null,o),r=hh(s,s.pendingProps),r.flags|=2,Zr(s),s.memoizedState=null,r}function qk(r,s,o){var d=s.pendingProps,y=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(On){if(d.mode==="hidden")return r=hh(s,d),s.lanes=536870912,pc(null,r);if(Y0(s),(r=gi)?(r=Dx(r,Rr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ps!==null?{id:Yr,overflow:cr}:null,retryLane:536870912,hydrationErrors:null},o=nc(r),o.return=s,s.child=o,Qi=s,gi=null)):r=null,r===null)throw zs(s);return s.lanes=536870912,null}return hh(s,d)}var b=r.memoizedState;if(b!==null){var M=b.dehydrated;if(Y0(s),y)if(s.flags&256)s.flags&=-257,s=bv(r,s,o);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(Ji||Ke(r,s,o,!1),y=(o&r.childLanes)!==0,Ji||y){if(d=yi,d!==null&&(M=pn(d,o),M!==0&&M!==b.retryLane))throw b.retryLane=M,ua(r,M),Pr(d,r,M),yp;Th(),s=bv(r,s,o)}else r=b.treeContext,gi=cs(M.nextSibling),Qi=s,On=!0,Us=null,Rr=!1,r!==null&&Wd(s,r),s=hh(s,d),s.flags|=4096;return s}return r=Ss(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function fh(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 bp(r,s,o,d,y){return it(s),o=Z0(r,s,o,d,void 0,y),d=J0(),r!==null&&!Ji?(ep(r,s,y),fa(r,s,y)):(On&&d&&nr(s),s.flags|=1,dr(r,s,o,y),s.child)}function vv(r,s,o,d,y,b){return it(s),s.updateQueue=null,o=wb(s,d,o,y),_b(r),d=J0(),r!==null&&!Ji?(ep(r,s,b),fa(r,s,b)):(On&&d&&nr(s),s.flags|=1,dr(r,s,o,b),s.child)}function xv(r,s,o,d,y){if(it(s),s.stateNode===null){var b=Va,M=o.contextType;typeof M=="object"&&M!==null&&(b=Bt(M)),b=new o(d,b),s.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=mp,s.stateNode=b,b._reactInternals=s,b=s.stateNode,b.props=d,b.state=s.memoizedState,b.refs={},q0(s),M=o.contextType,b.context=typeof M=="object"&&M!==null?Bt(M):Va,b.state=s.memoizedState,M=o.getDerivedStateFromProps,typeof M=="function"&&(pp(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&&mp.enqueueReplaceState(b,b.state,null),uc(s,d,b,y),lc(),b.state=s.memoizedState),typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){b=s.stateNode;var H=s.memoizedProps,ge=Xo(o,H);b.props=ge;var Ue=b.context,st=o.contextType;M=Va,typeof st=="object"&&st!==null&&(M=Bt(st));var ut=o.getDerivedStateFromProps;st=typeof ut=="function"||typeof b.getSnapshotBeforeUpdate=="function",H=s.pendingProps!==H,st||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(H||Ue!==M)&&av(s,b,d,M),Xa=!1;var $e=s.memoizedState;b.state=$e,uc(s,d,b,y),lc(),Ue=s.memoizedState,H||$e!==Ue||Xa?(typeof ut=="function"&&(pp(s,o,ut,d),Ue=s.memoizedState),(ge=Xa||sv(s,o,ge,d,$e,Ue,M))?(st||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=Ue),b.props=d,b.state=Ue,b.context=M,d=ge):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{b=s.stateNode,V0(r,s),M=s.memoizedProps,st=Xo(o,M),b.props=st,ut=s.pendingProps,$e=b.context,Ue=o.contextType,ge=Va,typeof Ue=="object"&&Ue!==null&&(ge=Bt(Ue)),H=o.getDerivedStateFromProps,(Ue=typeof H=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(M!==ut||$e!==ge)&&av(s,b,d,ge),Xa=!1,$e=s.memoizedState,b.state=$e,uc(s,d,b,y),lc();var Xe=s.memoizedState;M!==ut||$e!==Xe||Xa||r!==null&&r.dependencies!==null&&Ct(r.dependencies)?(typeof H=="function"&&(pp(s,o,H,d),Xe=s.memoizedState),(st=Xa||sv(s,o,st,d,$e,Xe,ge)||r!==null&&r.dependencies!==null&&Ct(r.dependencies))?(Ue||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,Xe,ge),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,Xe,ge)),typeof b.componentDidUpdate=="function"&&(s.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof b.componentDidUpdate!="function"||M===r.memoizedProps&&$e===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&$e===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=Xe),b.props=d,b.state=Xe,b.context=ge,d=st):(typeof b.componentDidUpdate!="function"||M===r.memoizedProps&&$e===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||M===r.memoizedProps&&$e===r.memoizedState||(s.flags|=1024),d=!1)}return b=d,fh(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=Ko(s,r.child,null,y),s.child=Ko(s,null,o,y)):dr(r,s,o,y),s.memoizedState=b.state,r=s.child):r=fa(r,s,y),r}function _v(r,s,o,d){return v(),s.flags|=256,dr(r,s,o,d),s.child}var vp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xp(r){return{baseLanes:r,cachePool:cb()}}function _p(r,s,o){return r=r!==null?r.childLanes&~o:0,s&&(r|=es),r}function wv(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:(Gi.current&2)!==0),M&&(y=!0,s.flags&=-129),M=(s.flags&32)!==0,s.flags&=-33,r===null){if(On){if(y?Za(s):Ja(),(r=gi)?(r=Dx(r,Rr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ps!==null?{id:Yr,overflow:cr}:null,retryLane:536870912,hydrationErrors:null},o=nc(r),o.return=s,s.child=o,Qi=s,gi=null)):r=null,r===null)throw zs(s);return im(r)?s.lanes=32:s.lanes=536870912,null}var H=d.children;return d=d.fallback,y?(Ja(),y=s.mode,H=ph({mode:"hidden",children:H},y),d=Bs(d,y,o,null),H.return=s,d.return=s,H.sibling=d,s.child=H,d=s.child,d.memoizedState=xp(o),d.childLanes=_p(r,M,o),s.memoizedState=vp,pc(null,d)):(Za(s),wp(s,H))}var ge=r.memoizedState;if(ge!==null&&(H=ge.dehydrated,H!==null)){if(b)s.flags&256?(Za(s),s.flags&=-257,s=Tp(r,s,o)):s.memoizedState!==null?(Ja(),s.child=r.child,s.flags|=128,s=null):(Ja(),H=d.fallback,y=s.mode,d=ph({mode:"visible",children:d.children},y),H=Bs(H,y,o,null),H.flags|=2,d.return=s,H.return=s,d.sibling=H,s.child=d,Ko(s,r.child,null,o),d=s.child,d.memoizedState=xp(o),d.childLanes=_p(r,M,o),s.memoizedState=vp,s=pc(null,d));else if(Za(s),im(H)){if(M=H.nextSibling&&H.nextSibling.dataset,M)var Ue=M.dgst;M=Ue,d=Error(i(419)),d.stack="",d.digest=M,x({value:d,source:null,stack:null}),s=Tp(r,s,o)}else if(Ji||Ke(r,s,o,!1),M=(o&r.childLanes)!==0,Ji||M){if(M=yi,M!==null&&(d=pn(M,o),d!==0&&d!==ge.retryLane))throw ge.retryLane=d,ua(r,d),Pr(M,r,d),yp;nm(H)||Th(),s=Tp(r,s,o)}else nm(H)?(s.flags|=192,s.child=r.child,s=null):(r=ge.treeContext,gi=cs(H.nextSibling),Qi=s,On=!0,Us=null,Rr=!1,r!==null&&Wd(s,r),s=wp(s,d.children),s.flags|=4096);return s}return y?(Ja(),H=d.fallback,y=s.mode,ge=r.child,Ue=ge.sibling,d=Ss(ge,{mode:"hidden",children:d.children}),d.subtreeFlags=ge.subtreeFlags&65011712,Ue!==null?H=Ss(Ue,H):(H=Bs(H,y,o,null),H.flags|=2),H.return=s,d.return=s,d.sibling=H,s.child=d,pc(null,d),d=s.child,H=r.child.memoizedState,H===null?H=xp(o):(y=H.cachePool,y!==null?(ge=xi._currentValue,y=y.parent!==ge?{parent:ge,pool:ge}:y):y=cb(),H={baseLanes:H.baseLanes|o,cachePool:y}),d.memoizedState=H,d.childLanes=_p(r,M,o),s.memoizedState=vp,pc(r.child,d)):(Za(s),o=r.child,r=o.sibling,o=Ss(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 wp(r,s){return s=ph({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function ph(r,s){return r=Ui(22,r,null,s),r.lanes=0,r}function Tp(r,s,o){return Ko(s,r.child,null,o),r=wp(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function Tv(r,s,o){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),ce(r.return,s,o)}function Sp(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 Sv(r,s,o){var d=s.pendingProps,y=d.revealOrder,b=d.tail;d=d.children;var M=Gi.current,H=(M&2)!==0;if(H?(M=M&1|2,s.flags|=128):M&=1,ke(Gi,M),dr(r,s,d,o),d=On?$o:0,!H&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Tv(r,o,s);else if(r.tag===19)Tv(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&&nh(r)===null&&(y=o),o=o.sibling;o=y,o===null?(y=s.child,s.child=null):(y=o.sibling,o.sibling=null),Sp(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&&nh(r)===null){s.child=y;break}r=y.sibling,y.sibling=o,o=y,y=r}Sp(s,!0,o,null,b,d);break;case"together":Sp(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function fa(r,s,o){if(r!==null&&(s.dependencies=r.dependencies),no|=s.lanes,(o&s.childLanes)===0)if(r!==null){if(Ke(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=Ss(r,r.pendingProps),s.child=o,o.return=s;r.sibling!==null;)r=r.sibling,o=o.sibling=Ss(r,r.pendingProps),o.return=s;o.sibling=null}return s.child}function kp(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Ct(r)))}function Vk(r,s,o){switch(s.tag){case 3:_e(s,s.stateNode.containerInfo),J(s,xi,r.memoizedState.cache),v();break;case 27:case 5:wt(s);break;case 4:_e(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,Y0(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(Za(s),s.flags|=128,null):(o&s.child.childLanes)!==0?wv(r,s,o):(Za(s),r=fa(r,s,o),r!==null?r.sibling:null);Za(s);break;case 19:var y=(r.flags&128)!==0;if(d=(o&s.childLanes)!==0,d||(Ke(r,s,o,!1),d=(o&s.childLanes)!==0),y){if(d)return Sv(r,s,o);s.flags|=128}if(y=s.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),ke(Gi,Gi.current),d)break;return null;case 22:return s.lanes=0,gv(r,s,o,s.pendingProps);case 24:J(s,xi,r.memoizedState.cache)}return fa(r,s,o)}function kv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)Ji=!0;else{if(!kp(r,o)&&(s.flags&128)===0)return Ji=!1,Vk(r,s,o);Ji=(r.flags&131072)!==0}else Ji=!1,On&&(s.flags&1048576)!==0&&Fs(s,$o,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Vo(s.elementType),s.type=r,typeof r=="function")ec(r)?(d=Xo(r,d),s.tag=1,s=xv(null,s,r,d,o)):(s.tag=0,s=bp(null,s,r,d,o));else{if(r!=null){var y=r.$$typeof;if(y===se){s.tag=11,s=fv(null,s,r,d,o);break e}else if(y===O){s.tag=14,s=pv(null,s,r,d,o);break e}}throw s=he(r)||r,Error(i(306,s,""))}}return s;case 0:return bp(r,s,s.type,s.pendingProps,o);case 1:return d=s.type,y=Xo(d,s.pendingProps),xv(r,s,d,y,o);case 3:e:{if(_e(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var b=s.memoizedState;y=b.element,V0(r,s),uc(s,d,null,o);var M=s.memoizedState;if(d=M.cache,J(s,xi,d),d!==b.cache&&Ne(s,[xi],o,!0),lc(),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=_v(r,s,d,o);break e}else if(d!==y){y=Dr(Error(i(424)),s),x(y),s=_v(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,gi=cs(r.firstChild),Qi=s,On=!0,Us=null,Rr=!0,o=gb(s,null,d,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(v(),d===y){s=fa(r,s,o);break e}dr(r,s,d,o)}s=s.child}return s;case 26:return fh(r,s),r===null?(o=Ix(s.type,null,s.pendingProps,null))?s.memoizedState=o:On||(o=s.type,r=s.pendingProps,d=Dh(pt.current).createElement(o),d[qt]=s,d[Rt]=r,hr(d,o,r),mn(d),s.stateNode=d):s.memoizedState=Ix(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return wt(s),r===null&&On&&(d=s.stateNode=Rx(s.type,s.pendingProps,pt.current),Qi=s,Rr=!0,y=gi,oo(s.type)?(rm=y,gi=cs(d.firstChild)):gi=y),dr(r,s,s.pendingProps.children,o),fh(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&On&&((y=d=gi)&&(d=_E(d,s.type,s.pendingProps,Rr),d!==null?(s.stateNode=d,Qi=s,gi=cs(d.firstChild),Rr=!1,y=!0):y=!1),y||zs(s)),wt(s),y=s.type,b=s.pendingProps,M=r!==null?r.memoizedProps:null,d=b.children,Jp(y,b)?d=null:M!==null&&Jp(y,M)&&(s.flags|=32),s.memoizedState!==null&&(y=Z0(r,s,Ik,null,null,o),Nc._currentValue=y),fh(r,s),dr(r,s,d,o),s.child;case 6:return r===null&&On&&((r=o=gi)&&(o=wE(o,s.pendingProps,Rr),o!==null?(s.stateNode=o,Qi=s,gi=null,r=!0):r=!1),r||zs(s)),null;case 13:return wv(r,s,o);case 4:return _e(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Ko(s,null,d,o):dr(r,s,d,o),s.child;case 11:return fv(r,s,s.type,s.pendingProps,o);case 7:return dr(r,s,s.pendingProps,o),s.child;case 8:return dr(r,s,s.pendingProps.children,o),s.child;case 12:return dr(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,J(s,s.type,d.value),dr(r,s,d.children,o),s.child;case 9:return y=s.type._context,d=s.pendingProps.children,it(s),y=Bt(y),d=d(y),s.flags|=1,dr(r,s,d,o),s.child;case 14:return pv(r,s,s.type,s.pendingProps,o);case 15:return mv(r,s,s.type,s.pendingProps,o);case 19:return Sv(r,s,o);case 31:return qk(r,s,o);case 22:return gv(r,s,o,s.pendingProps);case 24:return it(s),d=Bt(xi),r===null?(y=$0(),y===null&&(y=yi,b=ca(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=o),y=b),s.memoizedState={parent:d,cache:y},q0(s),J(s,xi,y)):((r.lanes&o)!==0&&(V0(r,s),uc(s,null,null,o),lc()),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,xi,d)):(d=b.cache,J(s,xi,d),d!==y.cache&&Ne(s,[xi],o,!0))),dr(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function pa(r){r.flags|=4}function Ep(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(Zv())r.flags|=8192;else throw Go=Zd,H0}else r.flags&=-16777217}function Ev(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!zx(s))if(Zv())r.flags|=8192;else throw Go=Zd,H0}function mh(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?He():536870912,r.lanes|=s,zl|=s)}function mc(r,s){if(!On)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 wi(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 Gk(r,s,o){var d=s.pendingProps;switch(jr(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return wi(s),null;case 1:return wi(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),oe(xi),Ye(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(p(s)?pa(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,w())),wi(s),null;case 26:var y=s.type,b=s.memoizedState;return r===null?(pa(s),b!==null?(wi(s),Ev(s,b)):(wi(s),Ep(s,y,null,d,o))):b?b!==r.memoizedState?(pa(s),wi(s),Ev(s,b)):(wi(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&pa(s),wi(s),Ep(s,y,r,d,o)),null;case 27:if(je(s),o=pt.current,y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&pa(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return wi(s),null}r=ye.current,p(s)?Xd(s):(r=Rx(y,d,o),s.stateNode=r,pa(s))}return wi(s),null;case 5:if(je(s),y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&pa(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return wi(s),null}if(b=ye.current,p(s))Xd(s);else{var M=Dh(pt.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[qt]=s,b[Rt]=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(hr(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&&pa(s)}}return wi(s),Ep(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&pa(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=pt.current,p(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=Qi,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[qt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||wx(r.nodeValue,o)),r||zs(s,!0)}else r=Dh(r).createTextNode(d),r[qt]=s,s.stateNode=r}return wi(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[qt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wi(s),r=!1}else o=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(Zr(s),s):(Zr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return wi(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[qt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;wi(s),y=!1}else y=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(Zr(s),s):(Zr(s),null)}return Zr(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),mh(s,s.updateQueue),wi(s),null);case 4:return Ye(),r===null&&Wp(s.stateNode.containerInfo),wi(s),null;case 10:return oe(s.type),wi(s),null;case 19:if(pe(Gi),d=s.memoizedState,d===null)return wi(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)mc(d,!1);else{if($i!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=nh(r),b!==null){for(s.flags|=128,mc(d,!1),r=b.updateQueue,s.updateQueue=r,mh(s,r),s.subtreeFlags=0,r=o,o=s.child;o!==null;)Kd(o,r),o=o.sibling;return ke(Gi,Gi.current&1|2),On&&kn(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&de()>xh&&(s.flags|=128,y=!0,mc(d,!1),s.lanes=4194304)}else{if(!y)if(r=nh(b),r!==null){if(s.flags|=128,y=!0,r=r.updateQueue,s.updateQueue=r,mh(s,r),mc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!On)return wi(s),null}else 2*de()-d.renderingStartTime>xh&&o!==536870912&&(s.flags|=128,y=!0,mc(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=de(),r.sibling=null,o=Gi.current,ke(Gi,y?o&1|2:o&1),On&&kn(s,d.treeForkCount),r):(wi(s),null);case 22:case 23:return Zr(s),X0(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(wi(s),s.subtreeFlags&6&&(s.flags|=8192)):wi(s),o=s.updateQueue,o!==null&&mh(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(qo),null;case 24:return o=null,r!==null&&(o=r.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),oe(xi),wi(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Kk(r,s){switch(jr(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return oe(xi),Ye(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return je(s),null;case 31:if(s.memoizedState!==null){if(Zr(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(Zr(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(Gi),null;case 4:return Ye(),null;case 10:return oe(s.type),null;case 22:case 23:return Zr(s),X0(),r!==null&&pe(qo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(xi),null;case 25:return null;default:return null}}function Cv(r,s){switch(jr(s),s.tag){case 3:oe(xi),Ye();break;case 26:case 27:case 5:je(s);break;case 4:Ye();break;case 31:s.memoizedState!==null&&Zr(s);break;case 13:Zr(s);break;case 19:pe(Gi);break;case 10:oe(s.type);break;case 22:case 23:Zr(s),X0(),r!==null&&pe(qo);break;case 24:oe(xi)}}function gc(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var y=d.next;o=y;do{if((o.tag&r)===r){d=void 0;var b=o.create,M=o.inst;d=b(),M.destroy=d}o=o.next}while(o!==y)}}catch(H){li(s,s.return,H)}}function eo(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,H=M.destroy;if(H!==void 0){M.destroy=void 0,y=s;var ge=o,Ue=H;try{Ue()}catch(st){li(y,ge,st)}}}d=d.next}while(d!==b)}}catch(st){li(s,s.return,st)}}function Av(r){var s=r.updateQueue;if(s!==null){var o=r.stateNode;try{bb(s,o)}catch(d){li(r,r.return,d)}}}function Nv(r,s,o){o.props=Xo(r.type,r.memoizedProps),o.state=r.memoizedState;try{o.componentWillUnmount()}catch(d){li(r,s,d)}}function yc(r,s){try{var o=r.ref;if(o!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof o=="function"?r.refCleanup=o(d):o.current=d}}catch(y){li(r,s,y)}}function qs(r,s){var o=r.ref,d=r.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(y){li(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){li(r,s,y)}else o.current=null}function Dv(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){li(r,r.return,y)}}function Cp(r,s,o){try{var d=r.stateNode;mE(d,r.type,o,s),d[Rt]=s}catch(y){li(r,r.return,y)}}function Mv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&oo(r.type)||r.tag===4}function Ap(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Mv(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&&oo(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 Np(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=ei));else if(d!==4&&(d===27&&oo(r.type)&&(o=r.stateNode,s=null),r=r.child,r!==null))for(Np(r,s,o),r=r.sibling;r!==null;)Np(r,s,o),r=r.sibling}function gh(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&&oo(r.type)&&(o=r.stateNode),r=r.child,r!==null))for(gh(r,s,o),r=r.sibling;r!==null;)gh(r,s,o),r=r.sibling}function jv(r){var s=r.stateNode,o=r.memoizedProps;try{for(var d=r.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);hr(s,d,o),s[qt]=r,s[Rt]=o}catch(b){li(r,r.return,b)}}var ma=!1,er=!1,Dp=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,ar=null;function Wk(r,s){if(r=r.containerInfo,Qp=Bh,r=El(r),Gu(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var y=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var M=0,H=-1,ge=-1,Ue=0,st=0,ut=r,$e=null;t:for(;;){for(var Xe;ut!==o||y!==0&&ut.nodeType!==3||(H=M+y),ut!==b||d!==0&&ut.nodeType!==3||(ge=M+d),ut.nodeType===3&&(M+=ut.nodeValue.length),(Xe=ut.firstChild)!==null;)$e=ut,ut=Xe;for(;;){if(ut===r)break t;if($e===o&&++Ue===y&&(H=M),$e===b&&++st===d&&(ge=M),(Xe=ut.nextSibling)!==null)break;ut=$e,$e=ut.parentNode}ut=Xe}o=H===-1||ge===-1?null:{start:H,end:ge}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zp={focusedElem:r,selectionRange:o},Bh=!1,ar=s;ar!==null;)if(s=ar,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,ar=r;else for(;ar!==null;){switch(s=ar,b=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(o=0;o<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 Ht=Xo(o.type,y);r=d.getSnapshotBeforeUpdate(Ht,b),d.__reactInternalSnapshotBeforeUpdate=r}catch(sn){li(o,o.return,sn)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)tm(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":tm(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,ar=r;break}ar=s.return}}function Ov(r,s,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:ya(r,o),d&4&&gc(5,o);break;case 1:if(ya(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(M){li(o,o.return,M)}else{var y=Xo(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(y,s,r.__reactInternalSnapshotBeforeUpdate)}catch(M){li(o,o.return,M)}}d&64&&Av(o),d&512&&yc(o,o.return);break;case 3:if(ya(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{bb(r,s)}catch(M){li(o,o.return,M)}}break;case 27:s===null&&d&4&&jv(o);case 26:case 5:ya(r,o),s===null&&d&4&&Dv(o),d&512&&yc(o,o.return);break;case 12:ya(r,o);break;case 31:ya(r,o),d&4&&Bv(r,o);break;case 13:ya(r,o),d&4&&Pv(r,o),d&64&&(r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(o=iE.bind(null,o),TE(r,o))));break;case 22:if(d=o.memoizedState!==null||ma,!d){s=s!==null&&s.memoizedState!==null||er,y=ma;var b=er;ma=d,(er=s)&&!b?ba(r,o,(o.subtreeFlags&8772)!==0):ya(r,o),ma=y,er=b}break;case 30:break;default:ya(r,o)}}function Lv(r){var s=r.alternate;s!==null&&(r.alternate=null,Lv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Wt(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 Ni=null,Or=!1;function ga(r,s,o){for(o=o.child;o!==null;)Iv(r,s,o),o=o.sibling}function Iv(r,s,o){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(an,o)}catch{}switch(o.tag){case 26:er||qs(o,s),ga(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:er||qs(o,s);var d=Ni,y=Or;oo(o.type)&&(Ni=o.stateNode,Or=!1),ga(r,s,o),Ec(o.stateNode),Ni=d,Or=y;break;case 5:er||qs(o,s);case 6:if(d=Ni,y=Or,Ni=null,ga(r,s,o),Ni=d,Or=y,Ni!==null)if(Or)try{(Ni.nodeType===9?Ni.body:Ni.nodeName==="HTML"?Ni.ownerDocument.body:Ni).removeChild(o.stateNode)}catch(b){li(o,s,b)}else try{Ni.removeChild(o.stateNode)}catch(b){li(o,s,b)}break;case 18:Ni!==null&&(Or?(r=Ni,Ax(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Xl(r)):Ax(Ni,o.stateNode));break;case 4:d=Ni,y=Or,Ni=o.stateNode.containerInfo,Or=!0,ga(r,s,o),Ni=d,Or=y;break;case 0:case 11:case 14:case 15:eo(2,o,s),er||eo(4,o,s),ga(r,s,o);break;case 1:er||(qs(o,s),d=o.stateNode,typeof d.componentWillUnmount=="function"&&Nv(o,s,d)),ga(r,s,o);break;case 21:ga(r,s,o);break;case 22:er=(d=er)||o.memoizedState!==null,ga(r,s,o),er=d;break;default:ga(r,s,o)}}function Bv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{Xl(r)}catch(o){li(s,s.return,o)}}}function Pv(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){li(s,s.return,o)}}function Xk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Rv),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Rv),s;default:throw Error(i(435,r.tag))}}function yh(r,s){var o=Xk(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var y=rE.bind(null,r,d);d.then(y,y)}})}function Lr(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,H=M;e:for(;H!==null;){switch(H.tag){case 27:if(oo(H.type)){Ni=H.stateNode,Or=!1;break e}break;case 5:Ni=H.stateNode,Or=!1;break e;case 3:case 4:Ni=H.stateNode.containerInfo,Or=!0;break e}H=H.return}if(Ni===null)throw Error(i(160));Iv(b,M,y),Ni=null,Or=!1,b=y.alternate,b!==null&&(b.return=null),y.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Fv(s,r),s=s.sibling}var Es=null;function Fv(r,s){var o=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Lr(s,r),Ir(r),d&4&&(eo(3,r,r.return),gc(3,r),eo(5,r,r.return));break;case 1:Lr(s,r),Ir(r),d&512&&(er||o===null||qs(o,o.return)),d&64&&ma&&(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=Es;if(Lr(s,r),Ir(r),d&512&&(er||o===null||qs(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[Mn]||b[qt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(d),y.head.insertBefore(b,y.querySelector("head > title"))),hr(b,d,o),b[qt]=r,mn(b),d=b;break e;case"link":var M=Fx("link","href",y).get(d+(o.href||""));if(M){for(var H=0;H<M.length;H++)if(b=M[H],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(H,1);break t}}b=y.createElement(d),hr(b,d,o),y.head.appendChild(b);break;case"meta":if(M=Fx("meta","content",y).get(d+(o.content||""))){for(H=0;H<M.length;H++)if(b=M[H],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(H,1);break t}}b=y.createElement(d),hr(b,d,o),y.head.appendChild(b);break;default:throw Error(i(468,d))}b[qt]=r,mn(b),d=b}r.stateNode=d}else Ux(y,r.type,r.stateNode);else r.stateNode=Px(y,d,r.memoizedProps);else b!==d?(b===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):b.count--,d===null?Ux(y,r.type,r.stateNode):Px(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Cp(r,r.memoizedProps,o.memoizedProps)}break;case 27:Lr(s,r),Ir(r),d&512&&(er||o===null||qs(o,o.return)),o!==null&&d&4&&Cp(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Lr(s,r),Ir(r),d&512&&(er||o===null||qs(o,o.return)),r.flags&32){y=r.stateNode;try{si(y,"")}catch(Ht){li(r,r.return,Ht)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,Cp(r,y,o!==null?o.memoizedProps:y)),d&1024&&(Dp=!0);break;case 6:if(Lr(s,r),Ir(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(Ht){li(r,r.return,Ht)}}break;case 3:if(Rh=null,y=Es,Es=Mh(s.containerInfo),Lr(s,r),Es=y,Ir(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Xl(s.containerInfo)}catch(Ht){li(r,r.return,Ht)}Dp&&(Dp=!1,Uv(r));break;case 4:d=Es,Es=Mh(r.stateNode.containerInfo),Lr(s,r),Ir(r),Es=d;break;case 12:Lr(s,r),Ir(r);break;case 31:Lr(s,r),Ir(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,yh(r,d)));break;case 13:Lr(s,r),Ir(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(vh=de()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,yh(r,d)));break;case 22:y=r.memoizedState!==null;var ge=o!==null&&o.memoizedState!==null,Ue=ma,st=er;if(ma=Ue||y,er=st||ge,Lr(s,r),er=st,ma=Ue,Ir(r),d&8192)e:for(s=r.stateNode,s._visibility=y?s._visibility&-2:s._visibility|1,y&&(o===null||ge||ma||er||Yo(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){ge=o=s;try{if(b=ge.stateNode,y)M=b.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{H=ge.stateNode;var ut=ge.memoizedProps.style,$e=ut!=null&&ut.hasOwnProperty("display")?ut.display:null;H.style.display=$e==null||typeof $e=="boolean"?"":(""+$e).trim()}}catch(Ht){li(ge,ge.return,Ht)}}}else if(s.tag===6){if(o===null){ge=s;try{ge.stateNode.nodeValue=y?"":ge.memoizedProps}catch(Ht){li(ge,ge.return,Ht)}}}else if(s.tag===18){if(o===null){ge=s;try{var Xe=ge.stateNode;y?Nx(Xe,!0):Nx(ge.stateNode,!1)}catch(Ht){li(ge,ge.return,Ht)}}}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,yh(r,o))));break;case 19:Lr(s,r),Ir(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,yh(r,d)));break;case 30:break;case 21:break;default:Lr(s,r),Ir(r)}}function Ir(r){var s=r.flags;if(s&2){try{for(var o,d=r.return;d!==null;){if(Mv(d)){o=d;break}d=d.return}if(o==null)throw Error(i(160));switch(o.tag){case 27:var y=o.stateNode,b=Ap(r);gh(r,b,y);break;case 5:var M=o.stateNode;o.flags&32&&(si(M,""),o.flags&=-33);var H=Ap(r);gh(r,H,M);break;case 3:case 4:var ge=o.stateNode.containerInfo,Ue=Ap(r);Np(r,Ue,ge);break;default:throw Error(i(161))}}catch(st){li(r,r.return,st)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Uv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Uv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function ya(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ov(r,s.alternate,s),s=s.sibling}function Yo(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:eo(4,s,s.return),Yo(s);break;case 1:qs(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Nv(s,s.return,o),Yo(s);break;case 27:Ec(s.stateNode);case 26:case 5:qs(s,s.return),Yo(s);break;case 22:s.memoizedState===null&&Yo(s);break;case 30:Yo(s);break;default:Yo(s)}r=r.sibling}}function ba(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:ba(y,b,o),gc(4,b);break;case 1:if(ba(y,b,o),d=b,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(Ue){li(d,d.return,Ue)}if(d=b,y=d.updateQueue,y!==null){var H=d.stateNode;try{var ge=y.shared.hiddenCallbacks;if(ge!==null)for(y.shared.hiddenCallbacks=null,y=0;y<ge.length;y++)yb(ge[y],H)}catch(Ue){li(d,d.return,Ue)}}o&&M&64&&Av(b),yc(b,b.return);break;case 27:jv(b);case 26:case 5:ba(y,b,o),o&&d===null&&M&4&&Dv(b),yc(b,b.return);break;case 12:ba(y,b,o);break;case 31:ba(y,b,o),o&&M&4&&Bv(y,b);break;case 13:ba(y,b,o),o&&M&4&&Pv(y,b);break;case 22:b.memoizedState===null&&ba(y,b,o),yc(b,b.return);break;case 30:break;default:ba(y,b,o)}s=s.sibling}}function Mp(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&&ks(o))}function jp(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&ks(r))}function Cs(r,s,o,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)zv(r,s,o,d),s=s.sibling}function zv(r,s,o,d){var y=s.flags;switch(s.tag){case 0:case 11:case 15:Cs(r,s,o,d),y&2048&&gc(9,s);break;case 1:Cs(r,s,o,d);break;case 3:Cs(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&&ks(r)));break;case 12:if(y&2048){Cs(r,s,o,d),r=s.stateNode;try{var b=s.memoizedProps,M=b.id,H=b.onPostCommit;typeof H=="function"&&H(M,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(ge){li(s,s.return,ge)}}else Cs(r,s,o,d);break;case 31:Cs(r,s,o,d);break;case 13:Cs(r,s,o,d);break;case 23:break;case 22:b=s.stateNode,M=s.alternate,s.memoizedState!==null?b._visibility&2?Cs(r,s,o,d):bc(r,s):b._visibility&2?Cs(r,s,o,d):(b._visibility|=2,Pl(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),y&2048&&Mp(M,s);break;case 24:Cs(r,s,o,d),y&2048&&jp(s.alternate,s);break;default:Cs(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,H=o,ge=d,Ue=M.flags;switch(M.tag){case 0:case 11:case 15:Pl(b,M,H,ge,y),gc(8,M);break;case 23:break;case 22:var st=M.stateNode;M.memoizedState!==null?st._visibility&2?Pl(b,M,H,ge,y):bc(b,M):(st._visibility|=2,Pl(b,M,H,ge,y)),y&&Ue&2048&&Mp(M.alternate,M);break;case 24:Pl(b,M,H,ge,y),y&&Ue&2048&&jp(M.alternate,M);break;default:Pl(b,M,H,ge,y)}s=s.sibling}}function bc(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:bc(o,d),y&2048&&Mp(d.alternate,d);break;case 24:bc(o,d),y&2048&&jp(d.alternate,d);break;default:bc(o,d)}s=s.sibling}}var vc=8192;function Fl(r,s,o){if(r.subtreeFlags&vc)for(r=r.child;r!==null;)$v(r,s,o),r=r.sibling}function $v(r,s,o){switch(r.tag){case 26:Fl(r,s,o),r.flags&vc&&r.memoizedState!==null&&LE(o,Es,r.memoizedState,r.memoizedProps);break;case 5:Fl(r,s,o);break;case 3:case 4:var d=Es;Es=Mh(r.stateNode.containerInfo),Fl(r,s,o),Es=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vc,vc=16777216,Fl(r,s,o),vc=d):Fl(r,s,o));break;default:Fl(r,s,o)}}function Hv(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 xc(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];ar=d,Vv(d,r)}Hv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)qv(r),r=r.sibling}function qv(r){switch(r.tag){case 0:case 11:case 15:xc(r),r.flags&2048&&eo(9,r,r.return);break;case 3:xc(r);break;case 12:xc(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,bh(r)):xc(r);break;default:xc(r)}}function bh(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];ar=d,Vv(d,r)}Hv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:eo(8,s,s.return),bh(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,bh(s));break;default:bh(s)}r=r.sibling}}function Vv(r,s){for(;ar!==null;){var o=ar;switch(o.tag){case 0:case 11:case 15:eo(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:ks(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,ar=d;else e:for(o=r;ar!==null;){d=ar;var y=d.sibling,b=d.return;if(Lv(d),d===o){ar=null;break e}if(y!==null){y.return=b,ar=y;break e}ar=b}}}var Yk={getCacheForType:function(r){var s=Bt(xi),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return Bt(xi).controller.signal}},Qk=typeof WeakMap=="function"?WeakMap:Map,ti=0,yi=null,Ln=null,Un=0,oi=0,Jr=null,to=!1,Ul=!1,Rp=!1,va=0,$i=0,no=0,Qo=0,Op=0,es=0,zl=0,_c=null,Br=null,Lp=!1,vh=0,Gv=0,xh=1/0,_h=null,io=null,ir=0,ro=null,$l=null,xa=0,Ip=0,Bp=null,Kv=null,wc=0,Pp=null;function ts(){return(ti&2)!==0&&Un!==0?Un&-Un:z.T!==null?qp():cn()}function Wv(){if(es===0)if((Un&536870912)===0||On){var r=Bn;Bn<<=1,(Bn&3932160)===0&&(Bn=262144),es=r}else es=536870912;return r=Qr.current,r!==null&&(r.flags|=32),es}function Pr(r,s,o){(r===yi&&(oi===2||oi===9)||r.cancelPendingCommit!==null)&&(Hl(r,0),so(r,Un,es,!1)),zt(r,o),((ti&2)===0||r!==yi)&&(r===yi&&((ti&2)===0&&(Qo|=o),$i===4&&so(r,Un,es,!1)),Vs(r))}function Xv(r,s,o){if((ti&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||ie(r,s),y=d?eE(r,s):Up(r,s,!0),b=d;do{if(y===0){Ul&&!d&&so(r,s,0,!1);break}else{if(o=r.current.alternate,b&&!Zk(o)){y=Up(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 H=r;y=_c;var ge=H.current.memoizedState.isDehydrated;if(ge&&(Hl(H,M).flags|=256),M=Up(H,M,!1),M!==2){if(Rp&&!ge){H.errorRecoveryDisabledLanes|=b,Qo|=b,y=4;break e}b=Br,Br=y,b!==null&&(Br===null?Br=b:Br.push.apply(Br,b))}y=M}if(b=!1,y!==2)continue}}if(y===1){Hl(r,0),so(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:so(d,s,es,!to);break e;case 2:Br=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(y=vh+300-de(),10<y)){if(so(d,s,es,!to),F(d,0,!0)!==0)break e;xa=s,d.timeoutHandle=Ex(Yv.bind(null,d,o,Br,_h,Lp,s,es,Qo,zl,to,b,"Throttled",-0,0),y);break e}Yv(d,o,Br,_h,Lp,s,es,Qo,zl,to,b,null,-0,0)}}break}while(!0);Vs(r)}function Yv(r,s,o,d,y,b,M,H,ge,Ue,st,ut,$e,Xe){if(r.timeoutHandle=-1,ut=s.subtreeFlags,ut&8192||(ut&16785408)===16785408){ut={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ei},$v(s,b,ut);var Ht=(b&62914560)===b?vh-de():(b&4194048)===b?Gv-de():0;if(Ht=IE(ut,Ht),Ht!==null){xa=b,r.cancelPendingCommit=Ht(rx.bind(null,r,s,b,o,d,y,M,H,ge,st,ut,null,$e,Xe)),so(r,b,M,!Ue);return}}rx(r,s,b,o,d,y,M,H,ge)}function Zk(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(!gr(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 so(r,s,o,d){s&=~Op,s&=~Qo,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var y=s;0<y;){var b=31-vt(y),M=1<<b;d[b]=-1,y&=~M}o!==0&&un(r,o,s)}function wh(){return(ti&6)===0?(Tc(0),!1):!0}function Fp(){if(Ln!==null){if(oi===0)var r=Ln.return;else r=Ln,X=A=null,tp(r),Rl=null,sc=0,r=Ln;for(;r!==null;)Cv(r.alternate,r),r=r.return;Ln=null}}function Hl(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,bE(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),xa=0,Fp(),yi=r,Ln=o=Ss(r.current,null),Un=s,oi=0,Jr=null,to=!1,Ul=ie(r,s),Rp=!1,zl=es=Op=Qo=no=$i=0,Br=_c=null,Lp=!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-vt(d),b=1<<y;s|=r[y],d&=~b}return va=s,Al(),o}function Qv(r,s){_n=null,z.H=fc,s===jl||s===Qd?(s=fb(),oi=3):s===H0?(s=fb(),oi=4):oi=s===yp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Jr=s,Ln===null&&($i=1,dh(r,Dr(s,r.current)))}function Zv(){var r=Qr.current;return r===null?!0:(Un&4194048)===Un?us===null:(Un&62914560)===Un||(Un&536870912)!==0?r===us:!1}function Jv(){var r=z.H;return z.H=fc,r===null?fc:r}function ex(){var r=z.A;return z.A=Yk,r}function Th(){$i=4,to||(Un&4194048)!==Un&&Qr.current!==null||(Ul=!0),(no&134217727)===0&&(Qo&134217727)===0||yi===null||so(yi,Un,es,!1)}function Up(r,s,o){var d=ti;ti|=2;var y=Jv(),b=ex();(yi!==r||Un!==s)&&(_h=null,Hl(r,s)),s=!1;var M=$i;e:do try{if(oi!==0&&Ln!==null){var H=Ln,ge=Jr;switch(oi){case 8:Fp(),M=6;break e;case 3:case 2:case 9:case 6:Qr.current===null&&(s=!0);var Ue=oi;if(oi=0,Jr=null,ql(r,H,ge,Ue),o&&Ul){M=0;break e}break;default:Ue=oi,oi=0,Jr=null,ql(r,H,ge,Ue)}}Jk(),M=$i;break}catch(st){Qv(r,st)}while(!0);return s&&r.shellSuspendCounter++,X=A=null,ti=d,z.H=y,z.A=b,Ln===null&&(yi=null,Un=0,Al()),M}function Jk(){for(;Ln!==null;)tx(Ln)}function eE(r,s){var o=ti;ti|=2;var d=Jv(),y=ex();yi!==r||Un!==s?(_h=null,xh=de()+500,Hl(r,s)):Ul=ie(r,s);e:do try{if(oi!==0&&Ln!==null){s=Ln;var b=Jr;t:switch(oi){case 1:oi=0,Jr=null,ql(r,s,b,1);break;case 2:case 9:if(db(b)){oi=0,Jr=null,nx(s);break}s=function(){oi!==2&&oi!==9||yi!==r||(oi=7),Vs(r)},b.then(s,s);break e;case 3:oi=7;break e;case 4:oi=5;break e;case 7:db(b)?(oi=0,Jr=null,nx(s)):(oi=0,Jr=null,ql(r,s,b,7));break;case 5:var M=null;switch(Ln.tag){case 26:M=Ln.memoizedState;case 5:case 27:var H=Ln;if(M?zx(M):H.stateNode.complete){oi=0,Jr=null;var ge=H.sibling;if(ge!==null)Ln=ge;else{var Ue=H.return;Ue!==null?(Ln=Ue,Sh(Ue)):Ln=null}break t}}oi=0,Jr=null,ql(r,s,b,5);break;case 6:oi=0,Jr=null,ql(r,s,b,6);break;case 8:Fp(),$i=6;break e;default:throw Error(i(462))}}tE();break}catch(st){Qv(r,st)}while(!0);return X=A=null,z.H=d,z.A=y,ti=o,Ln!==null?0:(yi=null,Un=0,Al(),$i)}function tE(){for(;Ln!==null&&!ft();)tx(Ln)}function tx(r){var s=kv(r.alternate,r,va);r.memoizedProps=r.pendingProps,s===null?Sh(r):Ln=s}function nx(r){var s=r,o=s.alternate;switch(s.tag){case 15:case 0:s=vv(o,s,s.pendingProps,s.type,void 0,Un);break;case 11:s=vv(o,s,s.pendingProps,s.type.render,s.ref,Un);break;case 5:tp(s);default:Cv(o,s),s=Ln=Kd(s,va),s=kv(o,s,va)}r.memoizedProps=r.pendingProps,s===null?Sh(r):Ln=s}function ql(r,s,o,d){X=A=null,tp(s),Rl=null,sc=0;var y=s.return;try{if(Hk(r,y,s,o,Un)){$i=1,dh(r,Dr(o,r.current)),Ln=null;return}}catch(b){if(y!==null)throw Ln=y,b;$i=1,dh(r,Dr(o,r.current)),Ln=null;return}s.flags&32768?(On||d===1?r=!0:Ul||(Un&536870912)!==0?r=!1:(to=r=!0,(d===2||d===9||d===3||d===6)&&(d=Qr.current,d!==null&&d.tag===13&&(d.flags|=16384))),ix(s,r)):Sh(s)}function Sh(r){var s=r;do{if((s.flags&32768)!==0){ix(s,to);return}r=s.return;var o=Gk(s.alternate,s,va);if(o!==null){Ln=o;return}if(s=s.sibling,s!==null){Ln=s;return}Ln=s=r}while(s!==null);$i===0&&($i=5)}function ix(r,s){do{var o=Kk(r.alternate,r);if(o!==null){o.flags&=32767,Ln=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){Ln=r;return}Ln=r=o}while(r!==null);$i=6,Ln=null}function rx(r,s,o,d,y,b,M,H,ge){r.cancelPendingCommit=null;do kh();while(ir!==0);if((ti&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(b=s.lanes|s.childLanes,b|=Zu,Jt(r,o,b,M,H,ge),r===yi&&(Ln=yi=null,Un=0),$l=s,ro=r,xa=o,Ip=b,Bp=y,Kv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,sE(Pe,function(){return ux(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=z.T,z.T=null,y=P.p,P.p=2,M=ti,ti|=4;try{Wk(r,s,o)}finally{ti=M,P.p=y,z.T=d}}ir=1,sx(),ax(),ox()}}function sx(){if(ir===1){ir=0;var r=ro,s=$l,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=z.T,z.T=null;var d=P.p;P.p=2;var y=ti;ti|=4;try{Fv(s,r);var b=Zp,M=El(r.containerInfo),H=b.focusedElem,ge=b.selectionRange;if(M!==H&&H&&H.ownerDocument&&oa(H.ownerDocument.documentElement,H)){if(ge!==null&&Gu(H)){var Ue=ge.start,st=ge.end;if(st===void 0&&(st=Ue),"selectionStart"in H)H.selectionStart=Ue,H.selectionEnd=Math.min(st,H.value.length);else{var ut=H.ownerDocument||document,$e=ut&&ut.defaultView||window;if($e.getSelection){var Xe=$e.getSelection(),Ht=H.textContent.length,sn=Math.min(ge.start,Ht),fi=ge.end===void 0?sn:Math.min(ge.end,Ht);!Xe.extend&&sn>fi&&(M=fi,fi=sn,sn=M);var Re=Ai(H,sn),Ee=Ai(H,fi);if(Re&&Ee&&(Xe.rangeCount!==1||Xe.anchorNode!==Re.node||Xe.anchorOffset!==Re.offset||Xe.focusNode!==Ee.node||Xe.focusOffset!==Ee.offset)){var Fe=ut.createRange();Fe.setStart(Re.node,Re.offset),Xe.removeAllRanges(),sn>fi?(Xe.addRange(Fe),Xe.extend(Ee.node,Ee.offset)):(Fe.setEnd(Ee.node,Ee.offset),Xe.addRange(Fe))}}}}for(ut=[],Xe=H;Xe=Xe.parentNode;)Xe.nodeType===1&&ut.push({element:Xe,left:Xe.scrollLeft,top:Xe.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<ut.length;H++){var lt=ut[H];lt.element.scrollLeft=lt.left,lt.element.scrollTop=lt.top}}Bh=!!Qp,Zp=Qp=null}finally{ti=y,P.p=d,z.T=o}}r.current=s,ir=2}}function ax(){if(ir===2){ir=0;var r=ro,s=$l,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=z.T,z.T=null;var d=P.p;P.p=2;var y=ti;ti|=4;try{Ov(r,s.alternate,s)}finally{ti=y,P.p=d,z.T=o}}ir=3}}function ox(){if(ir===4||ir===3){ir=0,mt();var r=ro,s=$l,o=xa,d=Kv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ir=5:(ir=0,$l=ro=null,lx(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(io=null),Kt(o),s=s.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(an,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=z.T,y=P.p,P.p=2,z.T=null;try{for(var b=r.onRecoverableError,M=0;M<d.length;M++){var H=d[M];b(H.value,{componentStack:H.stack})}}finally{z.T=s,P.p=y}}(xa&3)!==0&&kh(),Vs(r),y=r.pendingLanes,(o&261930)!==0&&(y&42)!==0?r===Pp?wc++:(wc=0,Pp=r):wc=0,Tc(0)}}function lx(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,ks(s)))}function kh(){return sx(),ax(),ox(),ux()}function ux(){if(ir!==5)return!1;var r=ro,s=Ip;Ip=0;var o=Kt(xa),d=z.T,y=P.p;try{P.p=32>o?32:o,z.T=null,o=Bp,Bp=null;var b=ro,M=xa;if(ir=0,$l=ro=null,xa=0,(ti&6)!==0)throw Error(i(331));var H=ti;if(ti|=4,qv(b.current),zv(b,b.current,M,o),ti=H,Tc(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(an,b)}catch{}return!0}finally{P.p=y,z.T=d,lx(r,s)}}function cx(r,s,o){s=Dr(o,s),s=gp(r.stateNode,s,2),r=Qa(r,s,2),r!==null&&(zt(r,2),Vs(r))}function li(r,s,o){if(r.tag===3)cx(r,r,o);else for(;s!==null;){if(s.tag===3){cx(s,r,o);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(io===null||!io.has(d))){r=Dr(o,r),o=dv(2),d=Qa(s,o,2),d!==null&&(hv(o,d,s,r),zt(d,2),Vs(d));break}}s=s.return}}function zp(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new Qk;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)||(Rp=!0,y.add(o),r=nE.bind(null,r,s,o),s.then(r,r))}function nE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,yi===r&&(Un&o)===o&&($i===4||$i===3&&(Un&62914560)===Un&&300>de()-vh?(ti&2)===0&&Hl(r,0):Op|=o,zl===Un&&(zl=0)),Vs(r)}function dx(r,s){s===0&&(s=He()),r=ua(r,s),r!==null&&(zt(r,s),Vs(r))}function iE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),dx(r,o)}function rE(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),dx(r,o)}function sE(r,s){return Ze(r,s)}var Eh=null,Vl=null,$p=!1,Ch=!1,Hp=!1,ao=0;function Vs(r){r!==Vl&&r.next===null&&(Vl===null?Eh=Vl=r:Vl=Vl.next=r),Ch=!0,$p||($p=!0,oE())}function Tc(r,s){if(!Hp&&Ch){Hp=!0;do for(var o=!1,d=Eh;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var b=0;else{var M=d.suspendedLanes,H=d.pingedLanes;b=(1<<31-vt(42|r)+1)-1,b&=y&~(M&~H),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,mx(d,b))}else b=Un,b=F(d,d===yi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ie(d,b)||(o=!0,mx(d,b));d=d.next}while(o);Hp=!1}}function aE(){hx()}function hx(){Ch=$p=!1;var r=0;ao!==0&&yE()&&(r=ao);for(var s=de(),o=null,d=Eh;d!==null;){var y=d.next,b=fx(d,s);b===0?(d.next=null,o===null?Eh=y:o.next=y,y===null&&(Vl=o)):(o=d,(r!==0||(b&3)!==0)&&(Ch=!0)),d=y}ir!==0&&ir!==5||Tc(r),ao!==0&&(ao=0)}function fx(r,s){for(var o=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var M=31-vt(b),H=1<<M,ge=y[M];ge===-1?((H&o)===0||(H&d)!==0)&&(y[M]=Me(H,s)):ge<=s&&(r.expiredLanes|=H),b&=~H}if(s=yi,o=Un,o=F(r,r===s?o:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,o===0||r===s&&(oi===2||oi===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&et(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||ie(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&et(d),Kt(o)){case 2:case 8:o=Ae;break;case 32:o=Pe;break;case 268435456:o=St;break;default:o=Pe}return d=px.bind(null,r),o=Ze(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&et(d),r.callbackPriority=2,r.callbackNode=null,2}function px(r,s){if(ir!==0&&ir!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(kh()&&r.callbackNode!==o)return null;var d=Un;return d=F(r,r===yi?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Xv(r,d,s),fx(r,de()),r.callbackNode!=null&&r.callbackNode===o?px.bind(null,r):null)}function mx(r,s){if(kh())return null;Xv(r,s,!0)}function oE(){vE(function(){(ti&6)!==0?Ze(Le,aE):hx()})}function qp(){if(ao===0){var r=ls;r===0&&(r=kt,kt<<=1,(kt&261888)===0&&(kt=256)),ao=r}return ao}function gx(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Oi(""+r)}function yx(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 lE(r,s,o,d,y){if(s==="submit"&&o&&o.stateNode===y){var b=gx((y[Rt]||null).action),M=d.submitter;M&&(s=(s=M[Rt]||null)?gx(s.formAction):M.getAttribute("formAction"),s!==null&&(b=s,M=null));var H=new ui("action","action",null,d,y);r.push({event:H,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ao!==0){var ge=M?yx(y,M):new FormData(y);cp(o,{pending:!0,data:ge,method:y.method,action:b},null,ge)}}else typeof b=="function"&&(H.preventDefault(),ge=M?yx(y,M):new FormData(y),cp(o,{pending:!0,data:ge,method:y.method,action:b},b,ge))},currentTarget:y}]})}}for(var Vp=0;Vp<Qu.length;Vp++){var Gp=Qu[Vp],uE=Gp.toLowerCase(),cE=Gp[0].toUpperCase()+Gp.slice(1);Xr(uE,"on"+cE)}Xr(zd,"onAnimationEnd"),Xr($a,"onAnimationIteration"),Xr($d,"onAnimationStart"),Xr("dblclick","onDoubleClick"),Xr("focusin","onFocus"),Xr("focusout","onBlur"),Xr(Hd,"onTransitionRun"),Xr(qd,"onTransitionStart"),Xr(U0,"onTransitionCancel"),Xr(Vd,"onTransitionEnd"),ni("onMouseEnter",["mouseout","mouseover"]),ni("onMouseLeave",["mouseout","mouseover"]),ni("onPointerEnter",["pointerout","pointerover"]),ni("onPointerLeave",["pointerout","pointerover"]),Kn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Kn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Kn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Kn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Kn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Kn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sc="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(" "),dE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Sc));function bx(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 H=d[M],ge=H.instance,Ue=H.currentTarget;if(H=H.listener,ge!==b&&y.isPropagationStopped())break e;b=H,y.currentTarget=Ue;try{b(y)}catch(st){Ha(st)}y.currentTarget=null,b=ge}else for(M=0;M<d.length;M++){if(H=d[M],ge=H.instance,Ue=H.currentTarget,H=H.listener,ge!==b&&y.isPropagationStopped())break e;b=H,y.currentTarget=Ue;try{b(y)}catch(st){Ha(st)}y.currentTarget=null,b=ge}}}}function In(r,s){var o=s[Cn];o===void 0&&(o=s[Cn]=new Set);var d=r+"__bubble";o.has(d)||(vx(s,r,2,!1),o.add(d))}function Kp(r,s,o){var d=0;s&&(d|=4),vx(o,r,d,s)}var Ah="_reactListening"+Math.random().toString(36).slice(2);function Wp(r){if(!r[Ah]){r[Ah]=!0,Ri.forEach(function(o){o!=="selectionchange"&&(dE.has(o)||Kp(o,!1,r),Kp(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Ah]||(s[Ah]=!0,Kp("selectionchange",!1,s))}}function vx(r,s,o,d){switch(Wx(s)){case 2:var y=FE;break;case 8:y=UE;break;default:y=um}o=y.bind(null,s,o,r),y=void 0,!W||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 Xp(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 H=d.stateNode.containerInfo;if(H===y)break;if(M===4)for(M=d.return;M!==null;){var ge=M.tag;if((ge===3||ge===4)&&M.stateNode.containerInfo===y)return;M=M.return}for(;H!==null;){if(M=Vn(H),M===null)return;if(ge=M.tag,ge===5||ge===6||ge===26||ge===27){d=b=M;continue e}H=H.parentNode}}d=d.return}Ve(function(){var Ue=b,st=we(o),ut=[];e:{var $e=Yu.get(r);if($e!==void 0){var Xe=ui,Ht=r;switch(r){case"keypress":if(At(o)===0)break e;case"keydown":case"keyup":Xe=Nd;break;case"focusin":Ht="focus",Xe=Oa;break;case"focusout":Ht="blur",Xe=Oa;break;case"beforeblur":case"afterblur":Xe=Oa;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":Xe=Fi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Xe=Do;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Xe=aa;break;case zd:case $a:case $d:Xe=jo;break;case Vd:Xe=Dd;break;case"scroll":case"scrollend":Xe=xn;break;case"wheel":Xe=jd;break;case"copy":case"cut":case"paste":Xe=Wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Xe=La;break;case"toggle":case"beforetoggle":Xe=M0}var sn=(s&4)!==0,fi=!sn&&(r==="scroll"||r==="scrollend"),Re=sn?$e!==null?$e+"Capture":null:$e;sn=[];for(var Ee=Ue,Fe;Ee!==null;){var lt=Ee;if(Fe=lt.stateNode,lt=lt.tag,lt!==5&<!==26&<!==27||Fe===null||Re===null||(lt=qe(Ee,Re),lt!=null&&sn.push(kc(Ee,lt,Fe))),fi)break;Ee=Ee.return}0<sn.length&&($e=new Xe($e,Ht,null,o,st),ut.push({event:$e,listeners:sn}))}}if((s&7)===0){e:{if($e=r==="mouseover"||r==="pointerover",Xe=r==="mouseout"||r==="pointerout",$e&&o!==Li&&(Ht=o.relatedTarget||o.fromElement)&&(Vn(Ht)||Ht[Dt]))break e;if((Xe||$e)&&($e=st.window===st?st:($e=st.ownerDocument)?$e.defaultView||$e.parentWindow:window,Xe?(Ht=o.relatedTarget||o.toElement,Xe=Ue,Ht=Ht?Vn(Ht):null,Ht!==null&&(fi=l(Ht),sn=Ht.tag,Ht!==fi||sn!==5&&sn!==27&&sn!==6)&&(Ht=null)):(Xe=null,Ht=Ue),Xe!==Ht)){if(sn=Fi,lt="onMouseLeave",Re="onMouseEnter",Ee="mouse",(r==="pointerout"||r==="pointerover")&&(sn=La,lt="onPointerLeave",Re="onPointerEnter",Ee="pointer"),fi=Xe==null?$e:jn(Xe),Fe=Ht==null?$e:jn(Ht),$e=new sn(lt,Ee+"leave",Xe,o,st),$e.target=fi,$e.relatedTarget=Fe,lt=null,Vn(st)===Ue&&(sn=new sn(Re,Ee+"enter",Ht,o,st),sn.target=Fe,sn.relatedTarget=fi,lt=sn),fi=lt,Xe&&Ht)t:{for(sn=hE,Re=Xe,Ee=Ht,Fe=0,lt=Re;lt;lt=sn(lt))Fe++;lt=0;for(var Qt=Ee;Qt;Qt=sn(Qt))lt++;for(;0<Fe-lt;)Re=sn(Re),Fe--;for(;0<lt-Fe;)Ee=sn(Ee),lt--;for(;Fe--;){if(Re===Ee||Ee!==null&&Re===Ee.alternate){sn=Re;break t}Re=sn(Re),Ee=sn(Ee)}sn=null}else sn=null;Xe!==null&&xx(ut,$e,Xe,sn,!1),Ht!==null&&fi!==null&&xx(ut,fi,Ht,sn,!0)}}e:{if($e=Ue?jn(Ue):window,Xe=$e.nodeName&&$e.nodeName.toLowerCase(),Xe==="select"||Xe==="input"&&$e.type==="file")var Wn=$u;else if(zu($e))if(Hu)Wn=P0;else{Wn=B0;var Gt=I0}else Xe=$e.nodeName,!Xe||Xe.toLowerCase()!=="input"||$e.type!=="checkbox"&&$e.type!=="radio"?Ue&&Jn(Ue.elementType)&&(Wn=$u):Wn=Ud;if(Wn&&(Wn=Wn(r,Ue))){Bd(ut,Wn,o,st);break e}Gt&&Gt(r,$e,Ue),r==="focusout"&&Ue&&$e.type==="number"&&Ue.memoizedProps.value!=null&&Yi($e,"number",$e.value)}switch(Gt=Ue?jn(Ue):window,r){case"focusin":(zu(Gt)||Gt.contentEditable==="true")&&(Ua=Gt,Ku=Ue,za=null);break;case"focusout":za=Ku=Ua=null;break;case"mousedown":Cl=!0;break;case"contextmenu":case"mouseup":case"dragend":Cl=!1,Wu(ut,o,st);break;case"selectionchange":if(F0)break;case"keydown":case"keyup":Wu(ut,o,st)}var Tn;if(Ia)e:{switch(r){case"compositionstart":var zn="onCompositionStart";break e;case"compositionend":zn="onCompositionEnd";break e;case"compositionupdate":zn="onCompositionUpdate";break e}zn=void 0}else Ba?kl(r,o)&&(zn="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(zn="onCompositionStart");zn&&(Od&&o.locale!=="ko"&&(Ba||zn!=="onCompositionStart"?zn==="onCompositionEnd"&&Ba&&(Tn=ht()):(be=st,Ce="value"in be?be.value:be.textContent,Ba=!0)),Gt=Nh(Ue,zn),0<Gt.length&&(zn=new Ro(zn,r,null,o,st),ut.push({event:zn,listeners:Gt}),Tn?zn.data=Tn:(Tn=Id(o),Tn!==null&&(zn.data=Tn)))),(Tn=Rd?R0(r,o):Uu(r,o))&&(zn=Nh(Ue,"onBeforeInput"),0<zn.length&&(Gt=new Ro("onBeforeInput","beforeinput",null,o,st),ut.push({event:Gt,listeners:zn}),Gt.data=Tn)),lE(ut,r,Ue,o,st)}bx(ut,s)})}function kc(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Nh(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=qe(r,o),y!=null&&d.unshift(kc(r,y,b)),y=qe(r,s),y!=null&&d.push(kc(r,y,b))),r.tag===3)return d;r=r.return}return[]}function hE(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function xx(r,s,o,d,y){for(var b=s._reactName,M=[];o!==null&&o!==d;){var H=o,ge=H.alternate,Ue=H.stateNode;if(H=H.tag,ge!==null&&ge===d)break;H!==5&&H!==26&&H!==27||Ue===null||(ge=Ue,y?(Ue=qe(o,b),Ue!=null&&M.unshift(kc(o,Ue,ge))):y||(Ue=qe(o,b),Ue!=null&&M.push(kc(o,Ue,ge)))),o=o.return}M.length!==0&&r.push({event:s,listeners:M})}var fE=/\r\n?/g,pE=/\u0000|\uFFFD/g;function _x(r){return(typeof r=="string"?r:""+r).replace(fE,`
|
||
`).replace(pE,"")}function wx(r,s){return s=_x(s),_x(r)===s}function hi(r,s,o,d,y,b){switch(o){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||si(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&si(r,""+d);break;case"className":rt(r,"class",d);break;case"tabIndex":rt(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":rt(r,o,d);break;case"style":Sn(r,d,b);break;case"data":if(s!=="object"){rt(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=Oi(""+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"&&hi(r,s,"name",y.name,y,null),hi(r,s,"formEncType",y.formEncType,y,null),hi(r,s,"formMethod",y.formMethod,y,null),hi(r,s,"formTarget",y.formTarget,y,null)):(hi(r,s,"encType",y.encType,y,null),hi(r,s,"method",y.method,y,null),hi(r,s,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(o);break}d=Oi(""+d),r.setAttribute(o,d);break;case"onClick":d!=null&&(r.onclick=ei);break;case"onScroll":d!=null&&In("scroll",r);break;case"onScrollEnd":d!=null&&In("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=Oi(""+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":In("beforetoggle",r),In("toggle",r),ve(r,"popover",d);break;case"xlinkActuate":ct(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ct(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ct(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ct(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ct(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ct(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ct(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ct(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ct(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ve(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=wn.get(o)||o,ve(r,o,d))}}function Yp(r,s,o,d,y,b){switch(o){case"style":Sn(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"?si(r,d):(typeof d=="number"||typeof d=="bigint")&&si(r,""+d);break;case"onScroll":d!=null&&In("scroll",r);break;case"onScrollEnd":d!=null&&In("scrollend",r);break;case"onClick":d!=null&&(r.onclick=ei);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zn.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[Rt]||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,""):ve(r,o,d)}}}function hr(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":In("error",r),In("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:hi(r,s,b,M,o,null)}}y&&hi(r,s,"srcSet",o.srcSet,o,null),d&&hi(r,s,"src",o.src,o,null);return;case"input":In("invalid",r);var H=b=M=y=null,ge=null,Ue=null;for(d in o)if(o.hasOwnProperty(d)){var st=o[d];if(st!=null)switch(d){case"name":y=st;break;case"type":M=st;break;case"checked":ge=st;break;case"defaultChecked":Ue=st;break;case"value":b=st;break;case"defaultValue":H=st;break;case"children":case"dangerouslySetInnerHTML":if(st!=null)throw Error(i(137,s));break;default:hi(r,s,d,st,o,null)}}qn(r,b,H,ge,Ue,M,y,!1);return;case"select":In("invalid",r),d=M=b=null;for(y in o)if(o.hasOwnProperty(y)&&(H=o[y],H!=null))switch(y){case"value":b=H;break;case"defaultValue":M=H;break;case"multiple":d=H;default:hi(r,s,y,H,o,null)}s=b,o=M,r.multiple=!!d,s!=null?Gn(r,!!d,s,!1):o!=null&&Gn(r,!!d,o,!0);return;case"textarea":In("invalid",r),b=y=d=null;for(M in o)if(o.hasOwnProperty(M)&&(H=o[M],H!=null))switch(M){case"value":d=H;break;case"defaultValue":y=H;break;case"children":b=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(i(91));break;default:hi(r,s,M,H,o,null)}Ei(r,d,y,b);return;case"option":for(ge in o)o.hasOwnProperty(ge)&&(d=o[ge],d!=null)&&(ge==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":hi(r,s,ge,d,o,null));return;case"dialog":In("beforetoggle",r),In("toggle",r),In("cancel",r),In("close",r);break;case"iframe":case"object":In("load",r);break;case"video":case"audio":for(d=0;d<Sc.length;d++)In(Sc[d],r);break;case"image":In("error",r),In("load",r);break;case"details":In("toggle",r);break;case"embed":case"source":case"link":In("error",r),In("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(Ue in o)if(o.hasOwnProperty(Ue)&&(d=o[Ue],d!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:hi(r,s,Ue,d,o,null)}return;default:if(Jn(s)){for(st in o)o.hasOwnProperty(st)&&(d=o[st],d!==void 0&&Yp(r,s,st,d,o,void 0));return}}for(H in o)o.hasOwnProperty(H)&&(d=o[H],d!=null&&hi(r,s,H,d,o,null))}function mE(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,H=null,ge=null,Ue=null,st=null;for(Xe in o){var ut=o[Xe];if(o.hasOwnProperty(Xe)&&ut!=null)switch(Xe){case"checked":break;case"value":break;case"defaultValue":ge=ut;default:d.hasOwnProperty(Xe)||hi(r,s,Xe,null,d,ut)}}for(var $e in d){var Xe=d[$e];if(ut=o[$e],d.hasOwnProperty($e)&&(Xe!=null||ut!=null))switch($e){case"type":b=Xe;break;case"name":y=Xe;break;case"checked":Ue=Xe;break;case"defaultChecked":st=Xe;break;case"value":M=Xe;break;case"defaultValue":H=Xe;break;case"children":case"dangerouslySetInnerHTML":if(Xe!=null)throw Error(i(137,s));break;default:Xe!==ut&&hi(r,s,$e,Xe,d,ut)}}vn(r,M,H,ge,Ue,st,b,y);return;case"select":Xe=M=H=$e=null;for(b in o)if(ge=o[b],o.hasOwnProperty(b)&&ge!=null)switch(b){case"value":break;case"multiple":Xe=ge;default:d.hasOwnProperty(b)||hi(r,s,b,null,d,ge)}for(y in d)if(b=d[y],ge=o[y],d.hasOwnProperty(y)&&(b!=null||ge!=null))switch(y){case"value":$e=b;break;case"defaultValue":H=b;break;case"multiple":M=b;default:b!==ge&&hi(r,s,y,b,d,ge)}s=H,o=M,d=Xe,$e!=null?Gn(r,!!o,$e,!1):!!d!=!!o&&(s!=null?Gn(r,!!o,s,!0):Gn(r,!!o,o?[]:"",!1));return;case"textarea":Xe=$e=null;for(H in o)if(y=o[H],o.hasOwnProperty(H)&&y!=null&&!d.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:hi(r,s,H,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":$e=y;break;case"defaultValue":Xe=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==b&&hi(r,s,M,y,d,b)}ki(r,$e,Xe);return;case"option":for(var Ht in o)$e=o[Ht],o.hasOwnProperty(Ht)&&$e!=null&&!d.hasOwnProperty(Ht)&&(Ht==="selected"?r.selected=!1:hi(r,s,Ht,null,d,$e));for(ge in d)$e=d[ge],Xe=o[ge],d.hasOwnProperty(ge)&&$e!==Xe&&($e!=null||Xe!=null)&&(ge==="selected"?r.selected=$e&&typeof $e!="function"&&typeof $e!="symbol":hi(r,s,ge,$e,d,Xe));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 sn in o)$e=o[sn],o.hasOwnProperty(sn)&&$e!=null&&!d.hasOwnProperty(sn)&&hi(r,s,sn,null,d,$e);for(Ue in d)if($e=d[Ue],Xe=o[Ue],d.hasOwnProperty(Ue)&&$e!==Xe&&($e!=null||Xe!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":if($e!=null)throw Error(i(137,s));break;default:hi(r,s,Ue,$e,d,Xe)}return;default:if(Jn(s)){for(var fi in o)$e=o[fi],o.hasOwnProperty(fi)&&$e!==void 0&&!d.hasOwnProperty(fi)&&Yp(r,s,fi,void 0,d,$e);for(st in d)$e=d[st],Xe=o[st],!d.hasOwnProperty(st)||$e===Xe||$e===void 0&&Xe===void 0||Yp(r,s,st,$e,d,Xe);return}}for(var Re in o)$e=o[Re],o.hasOwnProperty(Re)&&$e!=null&&!d.hasOwnProperty(Re)&&hi(r,s,Re,null,d,$e);for(ut in d)$e=d[ut],Xe=o[ut],!d.hasOwnProperty(ut)||$e===Xe||$e==null&&Xe==null||hi(r,s,ut,$e,d,Xe)}function Tx(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gE(){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,H=y.duration;if(b&&H&&Tx(M)){for(M=0,H=y.responseEnd,d+=1;d<o.length;d++){var ge=o[d],Ue=ge.startTime;if(Ue>H)break;var st=ge.transferSize,ut=ge.initiatorType;st&&Tx(ut)&&(ge=ge.responseEnd,M+=st*(ge<H?1:(H-Ue)/(ge-Ue)))}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 Qp=null,Zp=null;function Dh(r){return r.nodeType===9?r:r.ownerDocument}function Sx(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 kx(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 Jp(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 em=null;function yE(){var r=window.event;return r&&r.type==="popstate"?r===em?!1:(em=r,!0):(em=null,!1)}var Ex=typeof setTimeout=="function"?setTimeout:void 0,bE=typeof clearTimeout=="function"?clearTimeout:void 0,Cx=typeof Promise=="function"?Promise:void 0,vE=typeof queueMicrotask=="function"?queueMicrotask:typeof Cx<"u"?function(r){return Cx.resolve(null).then(r).catch(xE)}:Ex;function xE(r){setTimeout(function(){throw r})}function oo(r){return r==="head"}function Ax(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")Ec(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,Ec(o);for(var b=o.firstChild;b;){var M=b.nextSibling,H=b.nodeName;b[Mn]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=M}}else o==="body"&&Ec(r.ownerDocument.body);o=y}while(o);Xl(s)}function Nx(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 tm(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":tm(o),Wt(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function _E(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[Mn])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=cs(r.nextSibling),r===null)break}return null}function wE(r,s,o){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=cs(r.nextSibling),r===null))return null;return r}function Dx(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=cs(r.nextSibling),r===null))return null;return r}function nm(r){return r.data==="$?"||r.data==="$~"}function im(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function TE(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 cs(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 rm=null;function Mx(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var o=r.data;if(o==="/$"||o==="/&"){if(s===0)return cs(r.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}r=r.nextSibling}return null}function jx(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 Rx(r,s,o){switch(s=Dh(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 Ec(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Wt(r)}var ds=new Map,Ox=new Set;function Mh(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var _a=P.d;P.d={f:SE,r:kE,D:EE,C:CE,L:AE,m:NE,X:ME,S:DE,M:jE};function SE(){var r=_a.f(),s=wh();return r||s}function kE(r){var s=Yn(r);s!==null&&s.tag===5&&s.type==="form"?Qb(s):_a.r(r)}var Gl=typeof document>"u"?null:document;function Lx(r,s,o){var d=Gl;if(d&&typeof s=="string"&&s){var y=Vt(s);y='link[rel="'+r+'"][href="'+y+'"]',typeof o=="string"&&(y+='[crossorigin="'+o+'"]'),Ox.has(y)||(Ox.add(y),r={rel:r,crossOrigin:o,href:s},d.querySelector(y)===null&&(s=d.createElement("link"),hr(s,"link",r),mn(s),d.head.appendChild(s)))}}function EE(r){_a.D(r),Lx("dns-prefetch",r,null)}function CE(r,s){_a.C(r,s),Lx("preconnect",r,s)}function AE(r,s,o){_a.L(r,s,o);var d=Gl;if(d&&r&&s){var y='link[rel="preload"][as="'+Vt(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+Vt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+Vt(o.imageSizes)+'"]')):y+='[href="'+Vt(r)+'"]';var b=y;switch(s){case"style":b=Kl(r);break;case"script":b=Wl(r)}ds.has(b)||(r=S({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),ds.set(b,r),d.querySelector(y)!==null||s==="style"&&d.querySelector(Cc(b))||s==="script"&&d.querySelector(Ac(b))||(s=d.createElement("link"),hr(s,"link",r),mn(s),d.head.appendChild(s)))}}function NE(r,s){_a.m(r,s);var o=Gl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+Vt(d)+'"][href="'+Vt(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Wl(r)}if(!ds.has(b)&&(r=S({rel:"modulepreload",href:r},s),ds.set(b,r),o.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ac(b)))return}d=o.createElement("link"),hr(d,"link",r),mn(d),o.head.appendChild(d)}}}function DE(r,s,o){_a.S(r,s,o);var d=Gl;if(d&&r){var y=Qn(d).hoistableStyles,b=Kl(r);s=s||"default";var M=y.get(b);if(!M){var H={loading:0,preload:null};if(M=d.querySelector(Cc(b)))H.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ds.get(b))&&sm(r,o);var ge=M=d.createElement("link");mn(ge),hr(ge,"link",r),ge._p=new Promise(function(Ue,st){ge.onload=Ue,ge.onerror=st}),ge.addEventListener("load",function(){H.loading|=1}),ge.addEventListener("error",function(){H.loading|=2}),H.loading|=4,jh(M,s,d)}M={type:"stylesheet",instance:M,count:1,state:H},y.set(b,M)}}}function ME(r,s){_a.X(r,s);var o=Gl;if(o&&r){var d=Qn(o).hoistableScripts,y=Wl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0},s),(s=ds.get(y))&&am(r,s),b=o.createElement("script"),mn(b),hr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function jE(r,s){_a.M(r,s);var o=Gl;if(o&&r){var d=Qn(o).hoistableScripts,y=Wl(r),b=d.get(y);b||(b=o.querySelector(Ac(y)),b||(r=S({src:r,async:!0,type:"module"},s),(s=ds.get(y))&&am(r,s),b=o.createElement("script"),mn(b),hr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function Ix(r,s,o,d){var y=(y=pt.current)?Mh(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=Qn(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=Qn(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(Cc(r)))&&!b._p&&(M.instance=b,M.state.loading=5),ds.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ds.set(r,o),b||RE(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=Qn(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="'+Vt(r)+'"'}function Cc(r){return'link[rel="stylesheet"]['+r+"]"}function Bx(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function RE(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}),hr(s,"link",o),mn(s),r.head.appendChild(s))}function Wl(r){return'[src="'+Vt(r)+'"]'}function Ac(r){return"script[async]"+r}function Px(r,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+Vt(o.href)+'"]');if(d)return s.instance=d,mn(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"),mn(d),hr(d,"style",y),jh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Kl(o.href);var b=r.querySelector(Cc(y));if(b)return s.state.loading|=4,s.instance=b,mn(b),b;d=Bx(o),(y=ds.get(y))&&sm(d,y),b=(r.ownerDocument||r).createElement("link"),mn(b);var M=b;return M._p=new Promise(function(H,ge){M.onload=H,M.onerror=ge}),hr(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(Ac(b)))?(s.instance=y,mn(y),y):(d=o,(y=ds.get(b))&&(d=S({},o),am(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),mn(y),hr(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 H=d[M];if(H.dataset.precedence===s)b=H;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 sm(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function am(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Rh=null;function Fx(r,s,o){if(Rh===null){var d=new Map,y=Rh=new Map;y.set(o,d)}else y=Rh,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[Mn]||b[qt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var M=b.getAttribute(s)||"";M=r+M;var H=d.get(M);H?H.push(b):d.set(M,[b])}}return d}function Ux(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function OE(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 zx(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function LE(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(Cc(y));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Oh.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=b,mn(b);return}b=s.ownerDocument||s,d=Bx(d),(y=ds.get(y))&&sm(d,y),b=b.createElement("link"),mn(b);var M=b;M._p=new Promise(function(H,ge){M.onload=H,M.onerror=ge}),hr(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=Oh.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var om=0;function IE(r,s){return r.stylesheets&&r.count===0&&Ih(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Ih(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+s);0<r.imgBytes&&om===0&&(om=62500*gE());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Ih(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>om?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Oh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ih(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Lh=null;function Ih(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Lh=new Map,s.forEach(BE,r),Lh=null,Oh.call(r))}function BE(r,s){if(!(s.state.loading&4)){var o=Lh.get(r);if(o)var d=o.get(null);else{o=new Map,Lh.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=Oh.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 Nc={$$typeof:q,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function PE(r,s,o,d,y,b,M,H,ge){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=gt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.hiddenUpdates=gt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ge,this.incompleteTransitions=new Map}function $x(r,s,o,d,y,b,M,H,ge,Ue,st,ut){return r=new PE(r,s,o,M,ge,Ue,st,ut,H),s=1,b===!0&&(s|=24),b=Ui(3,null,null,s),r.current=b,b.stateNode=r,s=ca(),s.refCount++,r.pooledCache=s,s.refCount++,b.memoizedState={element:d,isDehydrated:o,cache:s},q0(b),r}function Hx(r){return r?(r=Va,r):Va}function qx(r,s,o,d,y,b){y=Hx(y),d.context===null?d.context=y:d.pendingContext=y,d=Ya(s),d.payload={element:o},b=b===void 0?null:b,b!==null&&(d.callback=b),o=Qa(r,d,s),o!==null&&(Pr(o,r,s),oc(o,r,s))}function Vx(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var o=r.retryLane;r.retryLane=o!==0&&o<s?o:s}}function lm(r,s){Vx(r,s),(r=r.alternate)&&Vx(r,s)}function Gx(r){if(r.tag===13||r.tag===31){var s=ua(r,67108864);s!==null&&Pr(s,r,67108864),lm(r,67108864)}}function Kx(r){if(r.tag===13||r.tag===31){var s=ts();s=fn(s);var o=ua(r,s);o!==null&&Pr(o,r,s),lm(r,s)}}var Bh=!0;function FE(r,s,o,d){var y=z.T;z.T=null;var b=P.p;try{P.p=2,um(r,s,o,d)}finally{P.p=b,z.T=y}}function UE(r,s,o,d){var y=z.T;z.T=null;var b=P.p;try{P.p=8,um(r,s,o,d)}finally{P.p=b,z.T=y}}function um(r,s,o,d){if(Bh){var y=cm(d);if(y===null)Xp(r,s,d,Ph,o),Xx(r,d);else if($E(y,r,s,o,d))d.stopPropagation();else if(Xx(r,d),s&4&&-1<zE.indexOf(r)){for(;y!==null;){var b=Yn(y);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var M=N(b.pendingLanes);if(M!==0){var H=b;for(H.pendingLanes|=2,H.entangledLanes|=2;M;){var ge=1<<31-vt(M);H.entanglements[1]|=ge,M&=~ge}Vs(b),(ti&6)===0&&(xh=de()+500,Tc(0))}}break;case 31:case 13:H=ua(b,2),H!==null&&Pr(H,b,2),wh(),lm(b,2)}if(b=cm(d),b===null&&Xp(r,s,d,Ph,o),b===y)break;y=b}y!==null&&d.stopPropagation()}else Xp(r,s,d,null,o)}}function cm(r){return r=we(r),dm(r)}var Ph=null;function dm(r){if(Ph=null,r=Vn(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 Ph=r,null}function Wx(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(ze()){case Le:return 2;case Ae:return 8;case Pe:case Qe:return 32;case St:return 268435456;default:return 32}default:return 32}}var hm=!1,lo=null,uo=null,co=null,Dc=new Map,Mc=new Map,ho=[],zE="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 Xx(r,s){switch(r){case"focusin":case"focusout":lo=null;break;case"dragenter":case"dragleave":uo=null;break;case"mouseover":case"mouseout":co=null;break;case"pointerover":case"pointerout":Dc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Mc.delete(s.pointerId)}}function jc(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=Yn(s),s!==null&&Gx(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,y!==null&&s.indexOf(y)===-1&&s.push(y),r)}function $E(r,s,o,d,y){switch(s){case"focusin":return lo=jc(lo,r,s,o,d,y),!0;case"dragenter":return uo=jc(uo,r,s,o,d,y),!0;case"mouseover":return co=jc(co,r,s,o,d,y),!0;case"pointerover":var b=y.pointerId;return Dc.set(b,jc(Dc.get(b)||null,r,s,o,d,y)),!0;case"gotpointercapture":return b=y.pointerId,Mc.set(b,jc(Mc.get(b)||null,r,s,o,d,y)),!0}return!1}function Yx(r){var s=Vn(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,dn(r.priority,function(){Kx(o)});return}}else if(s===31){if(s=h(o),s!==null){r.blockedOn=s,dn(r.priority,function(){Kx(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 Fh(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=cm(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Li=d,o.target.dispatchEvent(d),Li=null}else return s=Yn(o),s!==null&&Gx(s),r.blockedOn=o,!1;s.shift()}return!0}function Qx(r,s,o){Fh(r)&&o.delete(s)}function HE(){hm=!1,lo!==null&&Fh(lo)&&(lo=null),uo!==null&&Fh(uo)&&(uo=null),co!==null&&Fh(co)&&(co=null),Dc.forEach(Qx),Mc.forEach(Qx)}function Uh(r,s){r.blockedOn===s&&(r.blockedOn=null,hm||(hm=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,HE)))}var zh=null;function Zx(r){zh!==r&&(zh=r,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){zh===r&&(zh=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(dm(d||o)===null)continue;break}var b=Yn(o);b!==null&&(r.splice(s,3),s-=3,cp(b,{pending:!0,data:y,method:o.method,action:d},d,y))}}))}function Xl(r){function s(ge){return Uh(ge,r)}lo!==null&&Uh(lo,r),uo!==null&&Uh(uo,r),co!==null&&Uh(co,r),Dc.forEach(s),Mc.forEach(s);for(var o=0;o<ho.length;o++){var d=ho[o];d.blockedOn===r&&(d.blockedOn=null)}for(;0<ho.length&&(o=ho[0],o.blockedOn===null);)Yx(o),o.blockedOn===null&&ho.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[Rt]||null;if(typeof b=="function")M||Zx(o);else if(M){var H=null;if(b&&b.hasAttribute("formAction")){if(y=b,M=b[Rt]||null)H=M.formAction;else if(dm(y)!==null)continue}else H=M.action;typeof H=="function"?o[d+1]=H:(o.splice(d,3),d-=3),Zx(o)}}}function Jx(){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 fm(r){this._internalRoot=r}$h.prototype.render=fm.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var o=s.current,d=ts();qx(o,d,r,s,null,null)},$h.prototype.unmount=fm.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;qx(r.current,2,null,r,null,null),wh(),s[Dt]=null}};function $h(r){this._internalRoot=r}$h.prototype.unstable_scheduleHydration=function(r){if(r){var s=cn();r={blockedOn:null,target:r,priority:s};for(var o=0;o<ho.length&&s!==0&&s<ho[o].priority;o++);ho.splice(o,0,r),o===0&&Yx(r)}};var e1=e.version;if(e1!=="19.2.3")throw Error(i(527,e1,"19.2.3"));P.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?_(r):null,r=r===null?null:r.stateNode,r};var qE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hh.isDisabled&&Hh.supportsFiber)try{an=Hh.inject(qE),Nt=Hh}catch{}}return Oc.createRoot=function(r,s){if(!a(r))throw Error(i(299));var o=!1,d="",y=ov,b=lv,M=uv;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=$x(r,1,!1,null,null,o,d,null,y,b,M,Jx),r[Dt]=s.current,Wp(r),new fm(s)},Oc.hydrateRoot=function(r,s,o){if(!a(r))throw Error(i(299));var d=!1,y="",b=ov,M=lv,H=uv,ge=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&&(H=o.onRecoverableError),o.formState!==void 0&&(ge=o.formState)),s=$x(r,1,!0,s,o??null,d,y,ge,b,M,H,Jx),s.context=Hx(null),o=s.current,d=ts(),d=fn(d),y=Ya(d),y.callback=null,Qa(o,y,d),o=d,s.current.lanes=o,zt(s,o),Vs(s),r[Dt]=s.current,Wp(r),new $h(s)},Oc.version="19.2.3",Oc}var d1;function tC(){if(d1)return gm.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(),gm.exports=eC(),gm.exports}var Y_=tC();function nC(...n){return n.filter(Boolean).join(" ")}const iC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",rC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},sC={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"},aC={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 oC(){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 en({children:n,variant:e="primary",color:t="indigo",size:i="md",rounded:a="md",leadingIcon:l,trailingIcon:u,isLoading:h=!1,disabled:f,className:g,type:_="button",...S}){const C=l||u||h?"gap-x-1.5":"";return c.jsxs("button",{type:_,disabled:f||h,className:nC(iC,rC[a],sC[i],aC[t][e],C,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(oC,{})}):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 Q_(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=Q_(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function nn(){for(var n,e,t=0,i="",a=arguments.length;t<a;t++)(n=arguments[t])&&(e=Q_(n))&&(i&&(i+=" "),i+=e);return i}var yu=X_(),lC=Object.defineProperty,uC=(n,e,t)=>e in n?lC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,xm=(n,e,t)=>(uC(n,typeof e!="symbol"?e+"":e,t),t);let cC=class{constructor(){xm(this,"current",this.detect()),xm(this,"handoffState","pending"),xm(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"}},ea=new cC;function bd(n){var e;return ea.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function Eg(n){var e,t;return ea.isServer?null:n==null?document:(t=(e=n?.getRootNode)==null?void 0:e.call(n))!=null?t:document}function Z_(n){var e,t;return(t=(e=Eg(n))==null?void 0:e.activeElement)!=null?t:null}function dC(n){return Z_(n)===n}function Wf(n){typeof queueMicrotask=="function"?queueMicrotask(n):Promise.resolve().then(n).catch(e=>setTimeout(()=>{throw e}))}function Ra(){let n=[],e={addEventListener(t,i,a,l){return t.addEventListener(i,a,l),e.add(()=>t.removeEventListener(i,a,l))},requestAnimationFrame(...t){let i=requestAnimationFrame(...t);return e.add(()=>cancelAnimationFrame(i))},nextFrame(...t){return e.requestAnimationFrame(()=>e.requestAnimationFrame(...t))},setTimeout(...t){let i=setTimeout(...t);return e.add(()=>clearTimeout(i))},microTask(...t){let i={current:!0};return Wf(()=>{i.current&&t[0]()}),e.add(()=>{i.current=!1})},style(t,i,a){let l=t.style.getPropertyValue(i);return Object.assign(t.style,{[i]:a}),this.add(()=>{Object.assign(t.style,{[i]:l})})},group(t){let i=Ra();return t(i),this.add(()=>i.dispose())},add(t){return n.includes(t)||n.push(t),()=>{let i=n.indexOf(t);if(i>=0)for(let a of n.splice(i,1))a()}},dispose(){for(let t of n.splice(0))t()}};return e}function Xf(){let[n]=m.useState(Ra);return m.useEffect(()=>()=>n.dispose(),[n]),n}let qr=(n,e)=>{ea.isServer?m.useEffect(n,e):m.useLayoutEffect(n,e)};function _l(n){let e=m.useRef(n);return qr(()=>{e.current=n},[n]),e}let vi=function(n){let e=_l(n);return Zt.useCallback((...t)=>e.current(...t),[e])};function vd(n){return m.useMemo(()=>n,Object.values(n))}let hC=m.createContext(void 0);function fC(){return m.useContext(hC)}function Cg(...n){return Array.from(new Set(n.flatMap(e=>typeof e=="string"?e.split(" "):[]))).filter(Boolean).join(" ")}function Ma(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,Ma),i}var yf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(yf||{}),So=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(So||{});function vs(){let n=mC();return m.useCallback(e=>pC({mergeRefs:n,...e}),[n])}function pC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??gC;let f=J_(e,n);if(l)return qh(f,t,i,u,h);let g=a??0;if(g&2){let{static:_=!1,...S}=f;if(_)return qh(S,t,i,u,h)}if(g&1){let{unmount:_=!0,...S}=f;return Ma(_?0:1,{0(){return null},1(){return qh({...S,hidden:!0,style:{display:"none"}},t,i,u,h)}})}return qh(f,t,i,u,h)}function qh(n,e={},t,i,a){let{as:l=t,children:u,refName:h="ref",...f}=_m(n,["unmount","static"]),g=n.ref!==void 0?{[h]:n.ref}:{},_=typeof u=="function"?u(e):u;"className"in f&&f.className&&typeof f.className=="function"&&(f.className=f.className(e)),f["aria-labelledby"]&&f["aria-labelledby"]===f.id&&(f["aria-labelledby"]=void 0);let S={};if(e){let C=!1,D=[];for(let[R,E]of Object.entries(e))typeof E=="boolean"&&(C=!0),E===!0&&D.push(R.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(C){S["data-headlessui-state"]=D.join(" ");for(let R of D)S[`data-${R}`]=""}}if(Yc(l)&&(Object.keys(nl(f)).length>0||Object.keys(nl(S)).length>0))if(!m.isValidElement(_)||Array.isArray(_)&&_.length>1||bC(_)){if(Object.keys(nl(f)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${i} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(nl(f)).concat(Object.keys(nl(S))).map(C=>` - ${C}`).join(`
|
||
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(C=>` - ${C}`).join(`
|
||
`)].join(`
|
||
`))}else{let C=_.props,D=C?.className,R=typeof D=="function"?(...G)=>Cg(D(...G),f.className):Cg(D,f.className),E=R?{className:R}:{},B=J_(_.props,nl(_m(f,["ref"])));for(let G in S)G in B&&delete S[G];return m.cloneElement(_,Object.assign({},B,S,g,{ref:a(yC(_),g.ref)},E))}return m.createElement(l,Object.assign({},_m(f,["ref"]),!Yc(l)&&g,!Yc(l)&&S),_)}function mC(){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 gC(...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 J_(...n){if(n.length===0)return{};if(n.length===1)return n[0];let e={},t={};for(let i of n)for(let a in i)a.startsWith("on")&&typeof i[a]=="function"?(t[a]!=null||(t[a]=[]),t[a].push(i[a])):e[a]=i[a];if(e.disabled||e["aria-disabled"])for(let i in t)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(i)&&(t[i]=[a=>{var l;return(l=a?.preventDefault)==null?void 0:l.call(a)}]);for(let i in t)Object.assign(e,{[i](a,...l){let u=t[i];for(let h of u){if((a instanceof Event||a?.nativeEvent instanceof Event)&&a.defaultPrevented)return;h(a,...l)}}});return e}function Gr(n){var e;return Object.assign(m.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function nl(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function _m(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function yC(n){return Zt.version.split(".")[0]>="19"?n.props.ref:n.ref}function Yc(n){return n===m.Fragment||n===Symbol.for("react.fragment")}function bC(n){return Yc(n.type)}let vC="span";var bf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(bf||{});function xC(n,e){var t;let{features:i=1,...a}=n,l={ref:e,"aria-hidden":(i&2)===2?!0:(t=a["aria-hidden"])!=null?t:void 0,hidden:(i&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(i&4)===4&&(i&2)!==2&&{display:"none"}}};return vs()({ourProps:l,theirProps:a,slot:{},defaultTag:vC,name:"Hidden"})}let Ag=Gr(xC);function _C(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function Eo(n){return _C(n)&&"tagName"in n}function gl(n){return Eo(n)&&"accessKey"in n}function ko(n){return Eo(n)&&"tabIndex"in n}function wC(n){return Eo(n)&&"style"in n}function TC(n){return gl(n)&&n.nodeName==="IFRAME"}function SC(n){return gl(n)&&n.nodeName==="INPUT"}let ew=Symbol();function kC(n,e=!0){return Object.assign(n,{[ew]:e})}function ra(...n){let e=m.useRef(n);m.useEffect(()=>{e.current=n},[n]);let t=vi(i=>{for(let a of e.current)a!=null&&(typeof a=="function"?a(i):a.current=i)});return n.every(i=>i==null||i?.[ew])?void 0:t}let hy=m.createContext(null);hy.displayName="DescriptionContext";function tw(){let n=m.useContext(hy);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,tw),e}return n}function EC(){let[n,e]=m.useState([]);return[n.length>0?n.join(" "):void 0,m.useMemo(()=>function(t){let i=vi(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 Zt.createElement(hy.Provider,{value:a},t.children)},[e])]}let CC="p";function AC(n,e){let t=m.useId(),i=fC(),{id:a=`headlessui-description-${t}`,...l}=n,u=tw(),h=ra(e);qr(()=>u.register(a),[a,u.register]);let f=vd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return vs()({ourProps:g,theirProps:l,slot:f,defaultTag:CC,name:u.name||"Description"})}let NC=Gr(AC),DC=Object.assign(NC,{});var nw=(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))(nw||{});let MC=m.createContext(()=>{});function jC({value:n,children:e}){return Zt.createElement(MC.Provider,{value:n},e)}let iw=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 RC=Object.defineProperty,OC=(n,e,t)=>e in n?RC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,LC=(n,e,t)=>(OC(n,e+"",t),t),rw=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},hs=(n,e,t)=>(rw(n,e,"read from private field"),t?t.call(n):e.get(n)),wm=(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)},h1=(n,e,t,i)=>(rw(n,e,"write to private field"),e.set(n,t),t),Ks,qc,Vc;let IC=class{constructor(e){wm(this,Ks,{}),wm(this,qc,new iw(()=>new Set)),wm(this,Vc,new Set),LC(this,"disposables",Ra()),h1(this,Ks,e),ea.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return hs(this,Ks)}subscribe(e,t){if(ea.isServer)return()=>{};let i={selector:e,callback:t,current:e(hs(this,Ks))};return hs(this,Vc).add(i),this.disposables.add(()=>{hs(this,Vc).delete(i)})}on(e,t){return ea.isServer?()=>{}:(hs(this,qc).get(e).add(t),this.disposables.add(()=>{hs(this,qc).get(e).delete(t)}))}send(e){let t=this.reduce(hs(this,Ks),e);if(t!==hs(this,Ks)){h1(this,Ks,t);for(let i of hs(this,Vc)){let a=i.selector(hs(this,Ks));sw(i.current,a)||(i.current=a,i.callback(a))}for(let i of hs(this,qc).get(e.type))i(hs(this,Ks),e)}}};Ks=new WeakMap,qc=new WeakMap,Vc=new WeakMap;function sw(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:Tm(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:Tm(n.entries(),e.entries()):f1(n)&&f1(e)?Tm(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function Tm(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 f1(n){if(Object.prototype.toString.call(n)!=="[object Object]")return!1;let e=Object.getPrototypeOf(n);return e===null||Object.getPrototypeOf(e)===null}var BC=Object.defineProperty,PC=(n,e,t)=>e in n?BC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,p1=(n,e,t)=>(PC(n,typeof e!="symbol"?e+"":e,t),t),FC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(FC||{});let UC={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}}},zC=class aw extends IC{constructor(){super(...arguments),p1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),p1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new aw({stack:[]})}reduce(e,t){return Ma(t.type,UC,e,t)}};const ow=new iw(()=>zC.new());var Sm={exports:{}},km={};var m1;function $C(){if(m1)return km;m1=1;var n=Kf();function e(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var t=typeof Object.is=="function"?Object.is:e,i=n.useSyncExternalStore,a=n.useRef,l=n.useEffect,u=n.useMemo,h=n.useDebugValue;return km.useSyncExternalStoreWithSelector=function(f,g,_,S,C){var D=a(null);if(D.current===null){var R={hasValue:!1,value:null};D.current=R}else R=D.current;D=u(function(){function B(Q){if(!G){if(G=!0,Y=Q,Q=S(Q),C!==void 0&&R.hasValue){var K=R.value;if(C(K,Q))return q=K}return q=Q}if(K=q,t(Y,Q))return K;var O=S(Q);return C!==void 0&&C(K,O)?(Y=Q,K):(Y=Q,q=O)}var G=!1,Y,q,se=_===void 0?null:_;return[function(){return B(g())},se===null?void 0:function(){return B(se())}]},[g,_,S,C]);var E=i(f,D[0],D[1]);return l(function(){R.hasValue=!0,R.value=E},[E]),h(E),E},km}var g1;function HC(){return g1||(g1=1,Sm.exports=$C()),Sm.exports}var qC=HC();function lw(n,e,t=sw){return qC.useSyncExternalStoreWithSelector(vi(i=>n.subscribe(VC,i)),vi(()=>n.state),vi(()=>n.state),vi(e),t)}function VC(n){return n}function xd(n,e){let t=m.useId(),i=ow.get(e),[a,l]=lw(i,m.useCallback(u=>[i.selectors.isTop(u,t),i.selectors.inStack(u,t)],[i,t]));return qr(()=>{if(n)return i.actions.push(t),()=>i.actions.pop(t)},[i,n,t]),n?l?a:!0:!1}let Ng=new Map,Qc=new Map;function y1(n){var e;let t=(e=Qc.get(n))!=null?e:0;return Qc.set(n,t+1),t!==0?()=>b1(n):(Ng.set(n,{"aria-hidden":n.getAttribute("aria-hidden"),inert:n.inert}),n.setAttribute("aria-hidden","true"),n.inert=!0,()=>b1(n))}function b1(n){var e;let t=(e=Qc.get(n))!=null?e:1;if(t===1?Qc.delete(n):Qc.set(n,t-1),t!==1)return;let i=Ng.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,Ng.delete(n))}function GC(n,{allowed:e,disallowed:t}={}){let i=xd(n,"inert-others");qr(()=>{var a,l;if(!i)return;let u=Ra();for(let f of(a=t?.())!=null?a:[])f&&u.add(y1(f));let h=(l=e?.())!=null?l:[];for(let f of h){if(!f)continue;let g=bd(f);if(!g)continue;let _=f.parentElement;for(;_&&_!==g.body;){for(let S of _.children)h.some(C=>S.contains(C))||u.add(y1(S));_=_.parentElement}}return u.dispose},[i,e,t])}function KC(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=Ra();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>i.current(a));u.observe(a),l.add(()=>u.disconnect())}return()=>l.dispose()},[e,i,n])}let vf=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(n=>`${n}:not([tabindex='-1'])`).join(","),WC=["[data-autofocus]"].map(n=>`${n}:not([tabindex='-1'])`).join(",");var Ea=(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))(Ea||{}),Dg=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Dg||{}),XC=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(XC||{});function YC(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(vf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function QC(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(WC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var uw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(uw||{});function ZC(n,e=0){var t;return n===((t=bd(n))==null?void 0:t.body)?!1:Ma(e,{0(){return n.matches(vf)},1(){let i=n;for(;i!==null;){if(i.matches(vf))return!0;i=i.parentElement}return!1}})}var JC=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(JC||{});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 Na(n){n?.focus({preventScroll:!0})}let e5=["textarea","input"].join(",");function t5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,e5))!=null?t:!1}function n5(n,e=t=>t){return n.slice().sort((t,i)=>{let a=e(t),l=e(i);if(a===null||l===null)return 0;let u=a.compareDocumentPosition(l);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Zc(n,e,{sorted:t=!0,relativeTo:i=null,skipElements:a=[]}={}){let l=Array.isArray(n)?n.length>0?Eg(n[0]):document:Eg(n),u=Array.isArray(n)?t?n5(n):n:e&64?QC(n):YC(n);a.length>0&&u.length>1&&(u=u.filter(D=>!a.some(R=>R!=null&&"current"in R?R?.current===D:R===D))),i=i??l?.activeElement;let h=(()=>{if(e&5)return 1;if(e&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),f=(()=>{if(e&1)return 0;if(e&2)return Math.max(0,u.indexOf(i))-1;if(e&4)return Math.max(0,u.indexOf(i))+1;if(e&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),g=e&32?{preventScroll:!0}:{},_=0,S=u.length,C;do{if(_>=S||_+S<=0)return 0;let D=f+_;if(e&16)D=(D+S)%S;else{if(D<0)return 3;if(D>=S)return 1}C=u[D],C?.focus(g),_+=h}while(C!==Z_(C));return e&6&&t5(C)&&C.select(),2}function cw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function i5(){return/Android/gi.test(window.navigator.userAgent)}function v1(){return cw()||i5()}function Vh(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 dw(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 x1=30;function r5(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 _=(function S(C){return typeof C=="function"?S(C()):Array.isArray(C)||C instanceof Set?C:[C]})(e);for(let S of _)if(S!==null&&(S.contains(g)||h.composed&&h.composedPath().includes(S)))return;return!ZC(g,uw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=m.useRef(null);Vh(n,"pointerdown",h=>{var f,g;v1()||(l.current=((g=(f=h.composedPath)==null?void 0:f.call(h))==null?void 0:g[0])||h.target)},!0),Vh(n,"pointerup",h=>{if(v1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=m.useRef({x:0,y:0});Vh(n,"touchstart",h=>{u.current.x=h.touches[0].clientX,u.current.y=h.touches[0].clientY},!0),Vh(n,"touchend",h=>{let f={x:h.changedTouches[0].clientX,y:h.changedTouches[0].clientY};if(!(Math.abs(f.x-u.current.x)>=x1||Math.abs(f.y-u.current.y)>=x1))return a(h,()=>ko(h.target)?h.target:null)},!0),dw(n,"blur",h=>a(h,()=>TC(window.document.activeElement)?window.document.activeElement:null),!0)}function fy(...n){return m.useMemo(()=>bd(...n),[...n])}function hw(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 s5(n){return m.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function a5(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 o5(){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 l5(){return cw()?{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=Ra();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(ko(h.target))try{let f=h.target.closest("a");if(!f)return;let{hash:g}=new URL(f.href),_=n.querySelector(g);ko(_)&&!i(_)&&(u=_)}catch{}},!0),e.group(h=>{e.addEventListener(n,"touchstart",f=>{if(h.dispose(),ko(f.target)&&wC(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(ko(h.target)){if(SC(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 u5(){return{before({doc:n,d:e}){e.style(n.documentElement,"overflow","hidden")}}}function _1(n){let e={};for(let t of n)Object.assign(e,t(e));return e}let ol=a5(()=>new Map,{PUSH(n,e){var t;let i=(t=this.get(n))!=null?t:{doc:n,count:0,d:Ra(),meta:new Set,computedMeta:{}};return i.count++,i.meta.add(e),i.computedMeta=_1(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=_1(t.meta)),this},SCROLL_PREVENT(n){let e={doc:n.doc,d:n.d,meta(){return n.computedMeta}},t=[l5(),o5(),u5()];t.forEach(({before:i})=>i?.(e)),t.forEach(({after:i})=>i?.(e))},SCROLL_ALLOW({d:n}){n.dispose()},TEARDOWN({doc:n}){this.delete(n)}});ol.subscribe(()=>{let n=ol.getSnapshot(),e=new Map;for(let[t]of n)e.set(t,t.documentElement.style.overflow);for(let t of n.values()){let i=e.get(t.doc)==="hidden",a=t.count!==0;(a&&!i||!a&&i)&&ol.dispatch(t.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",t),t.count===0&&ol.dispatch("TEARDOWN",t)}});function c5(n,e,t=()=>({containers:[]})){let i=s5(ol),a=e?i.get(e):void 0,l=a?a.count>0:!1;return qr(()=>{if(!(!e||!n))return ol.dispatch("PUSH",e,t),()=>ol.dispatch("POP",e,t)},[n,e]),l}function d5(n,e,t=()=>[document.body]){let i=xd(n,"scroll-lock");c5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function h5(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 f5={},w1,T1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((w1=process==null?void 0:f5)==null?void 0:w1.NODE_ENV)==="test"&&typeof((T1=Element?.prototype)==null?void 0:T1.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 p5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(p5||{});function m5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function g5(n,e,t,i){let[a,l]=m.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=h5(n&&a?3:0),g=m.useRef(!1),_=m.useRef(!1),S=Xf();return qr(()=>{var C;if(n){if(t&&l(!0),!e){t&&h(3);return}return(C=i?.start)==null||C.call(i,t),y5(e,{inFlight:g,prepare(){_.current?_.current=!1:_.current=g.current,g.current=!0,!_.current&&(t?(h(3),f(4)):(h(4),f(2)))},run(){_.current?t?(f(3),h(4)):(f(4),h(3)):t?f(1):h(1)},done(){var D;_.current&&x5(e)||(g.current=!1,f(7),t||l(!1),(D=i?.end)==null||D.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 y5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ra();return v5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(b5(n,i))})}),l.dispose}function b5(n,e){var t,i;let a=Ra();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 v5(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 x5(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 py(n,e){let t=m.useRef([]),i=vi(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 Yf=m.createContext(null);Yf.displayName="OpenClosedContext";var As=(n=>(n[n.Open=1]="Open",n[n.Closed=2]="Closed",n[n.Closing=4]="Closing",n[n.Opening=8]="Opening",n))(As||{});function Qf(){return m.useContext(Yf)}function _5({value:n,children:e}){return Zt.createElement(Yf.Provider,{value:n},e)}function w5({children:n}){return Zt.createElement(Yf.Provider,{value:null},n)}function T5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let To=[];T5(()=>{function n(e){if(!ko(e.target)||e.target===document.body||To[0]===e.target)return;let t=e.target;t=t.closest(vf),To.unshift(t??e.target),To=To.filter(i=>i!=null&&i.isConnected),To.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 fw(n){let e=vi(n),t=m.useRef(!1);m.useEffect(()=>(t.current=!1,()=>{t.current=!0,Wf(()=>{t.current&&e()})}),[e])}let pw=m.createContext(!1);function S5(){return m.useContext(pw)}function S1(n){return Zt.createElement(pw.Provider,{value:n.force},n.children)}function k5(n){let e=S5(),t=m.useContext(gw),[i,a]=m.useState(()=>{var l;if(!e&&t!==null)return(l=t.current)!=null?l:null;if(ea.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 mw=m.Fragment,E5=Gr(function(n,e){let{ownerDocument:t=null,...i}=n,a=m.useRef(null),l=ra(kC(C=>{a.current=C}),e),u=fy(a.current),h=t??u,f=k5(h),g=m.useContext(Mg),_=Xf(),S=vs();return fw(()=>{var C;f&&f.childNodes.length<=0&&((C=f.parentElement)==null||C.removeChild(f))}),f?yu.createPortal(Zt.createElement("div",{"data-headlessui-portal":"",ref:C=>{_.dispose(),g&&C&&_.add(g.register(C))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:mw,name:"Portal"})),f):null});function C5(n,e){let t=ra(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=vs();return i?Zt.createElement(E5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:mw,name:"Portal"})}let A5=m.Fragment,gw=m.createContext(null);function N5(n,e){let{target:t,...i}=n,a={ref:ra(e)},l=vs();return Zt.createElement(gw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:A5,name:"Popover.Group"}))}let Mg=m.createContext(null);function D5(){let n=m.useContext(Mg),e=m.useRef([]),t=vi(l=>(e.current.push(l),n&&n.register(l),()=>i(l))),i=vi(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 Zt.createElement(Mg.Provider,{value:a},l)},[a])]}let M5=Gr(C5),yw=Gr(N5),j5=Object.assign(M5,{Group:yw});function R5(n,e=typeof document<"u"?document.defaultView:null,t){let i=xd(n,"escape");hw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===nw.Escape&&t(a))})}function O5(){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 qr(()=>{if(!e)return;function a(l){i(l.matches)}return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function L5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=vi(()=>{var a,l;let u=bd(t),h=[];for(let f of n)f!==null&&(Eo(f)?h.push(f):"current"in f&&Eo(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&&Eo(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:vi(a=>i().some(l=>l.contains(a)))}}let bw=m.createContext(null);function k1({children:n,node:e}){let[t,i]=m.useState(null),a=vw(e??t);return Zt.createElement(bw.Provider,{value:a},n,a===null&&Zt.createElement(Ag,{features:bf.Hidden,ref:l=>{var u,h;if(l){for(let f of(h=(u=bd(l))==null?void 0:u.querySelectorAll("html > *, body > *"))!=null?h:[])if(f!==document.body&&f!==document.head&&Eo(f)&&f!=null&&f.contains(l)){i(f);break}}}}))}function vw(n=null){var e;return(e=m.useContext(bw))!=null?e:n}function I5(){let n=typeof document>"u";return"useSyncExternalStore"in s1?(e=>e.useSyncExternalStore)(s1)(()=>()=>{},()=>!1,()=>!n):!1}function Zf(){let n=I5(),[e,t]=m.useState(ea.isHandoffComplete);return e&&ea.isHandoffComplete===!1&&t(!1),m.useEffect(()=>{e!==!0&&t(!0)},[e]),m.useEffect(()=>ea.handoff(),[]),n?!1:e}function my(){let n=m.useRef(!1);return qr(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var Gc=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(Gc||{});function B5(){let n=m.useRef(0);return dw(!0,"keydown",e=>{e.key==="Tab"&&(n.current=e.shiftKey?1:0)},!0),n}function xw(n){if(!n)return new Set;if(typeof n=="function")return new Set(n());let e=new Set;for(let t of n.current)Eo(t.current)&&e.add(t.current);return e}let P5="div";var sl=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(sl||{});function F5(n,e){let t=m.useRef(null),i=ra(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;Zf()||(h=0);let g=fy(t.current);H5(h,{ownerDocument:g});let _=q5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});V5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:_});let S=B5(),C=vi(Y=>{if(!gl(t.current))return;let q=t.current;(se=>se())(()=>{Ma(S.current,{[Gc.Forwards]:()=>{Zc(q,Ea.First,{skipElements:[Y.relatedTarget,l]})},[Gc.Backwards]:()=>{Zc(q,Ea.Last,{skipElements:[Y.relatedTarget,l]})}})})}),D=xd(!!(h&2),"focus-trap#tab-lock"),R=Xf(),E=m.useRef(!1),B={ref:i,onKeyDown(Y){Y.key=="Tab"&&(E.current=!0,R.requestAnimationFrame(()=>{E.current=!1}))},onBlur(Y){if(!(h&4))return;let q=xw(u);gl(t.current)&&q.add(t.current);let se=Y.relatedTarget;ko(se)&&se.dataset.headlessuiFocusGuard!=="true"&&(_w(q,se)||(E.current?Zc(t.current,Ma(S.current,{[Gc.Forwards]:()=>Ea.Next,[Gc.Backwards]:()=>Ea.Previous})|Ea.WrapAround,{relativeTo:Y.target}):ko(Y.target)&&Na(Y.target)))}},G=vs();return Zt.createElement(Zt.Fragment,null,D&&Zt.createElement(Ag,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}),G({ourProps:B,theirProps:f,defaultTag:P5,name:"FocusTrap"}),D&&Zt.createElement(Ag,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:bf.Focusable}))}let U5=Gr(F5),z5=Object.assign(U5,{features:sl});function $5(n=!0){let e=m.useRef(To.slice());return py(([t],[i])=>{i===!0&&t===!1&&Wf(()=>{e.current.splice(0)}),i===!1&&t===!0&&(e.current=To.slice())},[n,To,e]),vi(()=>{var t;return(t=e.current.find(i=>i!=null&&i.isConnected))!=null?t:null})}function H5(n,{ownerDocument:e}){let t=!!(n&8),i=$5(t);py(()=>{t||dC(e?.body)&&Na(i())},[t]),fw(()=>{t&&Na(i())})}function q5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=m.useRef(null),u=xd(!!(n&1),"focus-trap#initial-focus"),h=my();return py(()=>{if(n===0)return;if(!u){a!=null&&a.current&&Na(a.current);return}let f=t.current;f&&Wf(()=>{if(!h.current)return;let g=e?.activeElement;if(i!=null&&i.current){if(i?.current===g){l.current=g;return}}else if(f.contains(g)){l.current=g;return}if(i!=null&&i.current)Na(i.current);else{if(n&16){if(Zc(f,Ea.First|Ea.AutoFocus)!==Dg.Error)return}else if(Zc(f,Ea.First)!==Dg.Error)return;if(a!=null&&a.current&&(Na(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 V5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=my(),u=!!(n&4);hw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=xw(i);gl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let _=h.target;gl(_)?_w(f,_)?(a.current=_,Na(_)):(h.preventDefault(),h.stopPropagation(),Na(g)):Na(a.current)},!0)}function _w(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function ww(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Yc((e=n.as)!=null?e:Sw)||Zt.Children.count(n.children)===1}let Jf=m.createContext(null);Jf.displayName="TransitionContext";var G5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(G5||{});function K5(){let n=m.useContext(Jf);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function W5(){let n=m.useContext(e0);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}let e0=m.createContext(null);e0.displayName="NestingContext";function t0(n){return"children"in n?t0(n.children):n.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Tw(n,e){let t=_l(n),i=m.useRef([]),a=my(),l=Xf(),u=vi((D,R=So.Hidden)=>{let E=i.current.findIndex(({el:B})=>B===D);E!==-1&&(Ma(R,{[So.Unmount](){i.current.splice(E,1)},[So.Hidden](){i.current[E].state="hidden"}}),l.microTask(()=>{var B;!t0(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=vi(D=>{let R=i.current.find(({el:E})=>E===D);return R?R.state!=="visible"&&(R.state="visible"):i.current.push({el:D,state:"visible"}),()=>u(D,So.Unmount)}),f=m.useRef([]),g=m.useRef(Promise.resolve()),_=m.useRef({enter:[],leave:[]}),S=vi((D,R,E)=>{f.current.splice(0),e&&(e.chains.current[R]=e.chains.current[R].filter(([B])=>B!==D)),e?.chains.current[R].push([D,new Promise(B=>{f.current.push(B)})]),e?.chains.current[R].push([D,new Promise(B=>{Promise.all(_.current[R].map(([G,Y])=>Y)).then(()=>B())})]),R==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>E(R)):E(R)}),C=vi((D,R,E)=>{Promise.all(_.current[R].splice(0).map(([B,G])=>G)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>E(R))});return m.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:C,wait:g,chains:_}),[h,u,i,S,C,_,g])}let Sw=m.Fragment,kw=yf.RenderStrategy;function X5(n,e){var t,i;let{transition:a=!0,beforeEnter:l,afterEnter:u,beforeLeave:h,afterLeave:f,enter:g,enterFrom:_,enterTo:S,entered:C,leave:D,leaveFrom:R,leaveTo:E,...B}=n,[G,Y]=m.useState(null),q=m.useRef(null),se=ww(n),Q=ra(...se?[q,e,Y]:e===null?[]:[e]),K=(t=B.unmount)==null||t?So.Unmount:So.Hidden,{show:O,appear:re,initial:k}=K5(),[j,te]=m.useState(O?"visible":"hidden"),V=W5(),{register:ne,unregister:he}=V;qr(()=>ne(q),[ne,q]),qr(()=>{if(K===So.Hidden&&q.current){if(O&&j!=="visible"){te("visible");return}return Ma(j,{hidden:()=>he(q),visible:()=>ne(q)})}},[j,q,ne,he,O,K]);let ae=Zf();qr(()=>{if(se&&ae&&j==="visible"&&q.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[q,j,ae,se]);let z=k&&!re,P=re&&O&&k,Z=m.useRef(!1),ee=Tw(()=>{Z.current||(te("hidden"),he(q))},V),fe=vi(We=>{Z.current=!0;let _e=We?"enter":"leave";ee.onStart(q,_e,Ye=>{Ye==="enter"?l?.():Ye==="leave"&&h?.()})}),I=vi(We=>{let _e=We?"enter":"leave";Z.current=!1,ee.onStop(q,_e,Ye=>{Ye==="enter"?u?.():Ye==="leave"&&f?.()}),_e==="leave"&&!t0(ee)&&(te("hidden"),he(q))});m.useEffect(()=>{se&&a||(fe(O),I(O))},[O,se,a]);let pe=!(!a||!se||!ae||z),[,ke]=g5(pe,G,O,{start:fe,end:I}),ye=nl({ref:Q,className:((i=Cg(B.className,P&&g,P&&_,ke.enter&&g,ke.enter&&ke.closed&&_,ke.enter&&!ke.closed&&S,ke.leave&&D,ke.leave&&!ke.closed&&R,ke.leave&&ke.closed&&E,!ke.transition&&O&&C))==null?void 0:i.trim())||void 0,...m5(ke)}),me=0;j==="visible"&&(me|=As.Open),j==="hidden"&&(me|=As.Closed),O&&j==="hidden"&&(me|=As.Opening),!O&&j==="visible"&&(me|=As.Closing);let pt=vs();return Zt.createElement(e0.Provider,{value:ee},Zt.createElement(_5,{value:me},pt({ourProps:ye,theirProps:B,defaultTag:Sw,features:kw,visible:j==="visible",name:"Transition.Child"})))}function Y5(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=m.useRef(null),h=ww(n),f=ra(...h?[u,e]:e===null?[]:[e]);Zf();let g=Qf();if(t===void 0&&g!==null&&(t=(g&As.Open)===As.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[_,S]=m.useState(t?"visible":"hidden"),C=Tw(()=>{t||S("hidden")}),[D,R]=m.useState(!0),E=m.useRef([t]);qr(()=>{D!==!1&&E.current[E.current.length-1]!==t&&(E.current.push(t),R(!1))},[E,t]);let B=m.useMemo(()=>({show:t,appear:i,initial:D}),[t,i,D]);qr(()=>{t?S("visible"):!t0(C)&&u.current!==null&&S("hidden")},[t,C]);let G={unmount:a},Y=vi(()=>{var Q;D&&R(!1),(Q=n.beforeEnter)==null||Q.call(n)}),q=vi(()=>{var Q;D&&R(!1),(Q=n.beforeLeave)==null||Q.call(n)}),se=vs();return Zt.createElement(e0.Provider,{value:C},Zt.createElement(Jf.Provider,{value:B},se({ourProps:{...G,as:m.Fragment,children:Zt.createElement(Ew,{ref:f,...G,...l,beforeEnter:Y,beforeLeave:q})},theirProps:{},defaultTag:m.Fragment,features:kw,visible:_==="visible",name:"Transition"})))}function Q5(n,e){let t=m.useContext(Jf)!==null,i=Qf()!==null;return Zt.createElement(Zt.Fragment,null,!t&&i?Zt.createElement(jg,{ref:e,...n}):Zt.createElement(Ew,{ref:e,...n}))}let jg=Gr(Y5),Ew=Gr(X5),gy=Gr(Q5),Jc=Object.assign(jg,{Child:gy,Root:jg});var Z5=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(Z5||{}),J5=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(J5||{});let eA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},yy=m.createContext(null);yy.displayName="DialogContext";function n0(n){let e=m.useContext(yy);if(e===null){let t=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,n0),t}return e}function tA(n,e){return Ma(e.type,eA,n,e)}let E1=Gr(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:_=!1,...S}=n,C=m.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(C.current||(C.current=!0,console.warn(`Invalid role [${h}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let D=Qf();a===void 0&&D!==null&&(a=(D&As.Open)===As.Open);let R=m.useRef(null),E=ra(R,e),B=fy(R.current),G=a?0:1,[Y,q]=m.useReducer(tA,{titleId:null,descriptionId:null,panelRef:m.createRef()}),se=vi(()=>l(!1)),Q=vi(ke=>q({type:0,id:ke})),K=Zf()?G===0:!1,[O,re]=D5(),k={get current(){var ke;return(ke=Y.panelRef.current)!=null?ke:R.current}},j=vw(),{resolveContainers:te}=L5({mainTreeNode:j,portals:O,defaultContainers:[k]}),V=D!==null?(D&As.Closing)===As.Closing:!1;GC(g||V?!1:K,{allowed:vi(()=>{var ke,ye;return[(ye=(ke=R.current)==null?void 0:ke.closest("[data-headlessui-portal]"))!=null?ye:null]}),disallowed:vi(()=>{var ke;return[(ke=j?.closest("body > *:not(#headlessui-portal-root)"))!=null?ke:null]})});let ne=ow.get(null);qr(()=>{if(K)return ne.actions.push(i),()=>ne.actions.pop(i)},[ne,i,K]);let he=lw(ne,m.useCallback(ke=>ne.selectors.isTop(ke,i),[ne,i]));r5(he,te,ke=>{ke.preventDefault(),se()}),R5(he,B?.defaultView,ke=>{ke.preventDefault(),ke.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),se()}),d5(g||V?!1:K,B,te),KC(K,R,se);let[ae,z]=EC(),P=m.useMemo(()=>[{dialogState:G,close:se,setTitleId:Q,unmount:_},Y],[G,se,Q,_,Y]),Z=vd({open:G===0}),ee={ref:E,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:G===0?!0:void 0,"aria-labelledby":Y.titleId,"aria-describedby":ae,unmount:_},fe=!O5(),I=sl.None;K&&!g&&(I|=sl.RestoreFocus,I|=sl.TabLock,f&&(I|=sl.AutoFocus),fe&&(I|=sl.InitialFocus));let pe=vs();return Zt.createElement(w5,null,Zt.createElement(S1,{force:!0},Zt.createElement(j5,null,Zt.createElement(yy.Provider,{value:P},Zt.createElement(yw,{target:R},Zt.createElement(S1,{force:!1},Zt.createElement(z,{slot:Z},Zt.createElement(re,null,Zt.createElement(z5,{initialFocus:u,initialFocusFallback:R,containers:te,features:I},Zt.createElement(jC,{value:se},pe({ourProps:ee,theirProps:S,slot:Z,defaultTag:nA,features:iA,visible:G===0,name:"Dialog"})))))))))))}),nA="div",iA=yf.RenderStrategy|yf.Static;function rA(n,e){let{transition:t=!1,open:i,...a}=n,l=Qf(),u=n.hasOwnProperty("open")||l!==null,h=n.hasOwnProperty("onClose");if(!u&&!h)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!u)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!h)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!l&&typeof n.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${n.open}`);if(typeof n.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n.onClose}`);return(i!==void 0||t)&&!a.static?Zt.createElement(k1,null,Zt.createElement(Jc,{show:i,transition:t,unmount:a.unmount},Zt.createElement(E1,{ref:e,...a}))):Zt.createElement(k1,null,Zt.createElement(E1,{ref:e,open:i,...a}))}let sA="div";function aA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=n0("Dialog.Panel"),g=ra(e,f.panelRef),_=vd({open:u===0}),S=vi(B=>{B.stopPropagation()}),C={ref:g,id:i,onClick:S},D=a?gy:m.Fragment,R=a?{unmount:h}:{},E=vs();return Zt.createElement(D,{...R},E({ourProps:C,theirProps:l,slot:_,defaultTag:sA,name:"Dialog.Panel"}))}let oA="div";function lA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=n0("Dialog.Backdrop"),u=vd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?gy:m.Fragment,g=t?{unmount:l}:{},_=vs();return Zt.createElement(f,{...g},_({ourProps:h,theirProps:i,slot:u,defaultTag:oA,name:"Dialog.Backdrop"}))}let uA="h2";function cA(n,e){let t=m.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=n0("Dialog.Title"),h=ra(e);m.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=vd({open:l===0}),g={ref:h,id:i};return vs()({ourProps:g,theirProps:a,slot:f,defaultTag:uA,name:"Dialog.Title"})}let dA=Gr(rA),hA=Gr(aA);Gr(lA);let fA=Gr(cA),au=Object.assign(dA,{Panel:hA,Title:fA,Description:DC});function pA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=m.useState(""),[u,h]=m.useState(""),[f,g]=m.useState([]),_=m.useRef(!1);m.useEffect(()=>{n&&!_.current&&(l(""),h(""),g(i??[])),_.current=n},[n,i]);function S(){const R=a.trim(),E=u.trim();!R||!E||(g(B=>[...B.filter(Y=>Y.name!==R),{name:R,value:E}]),l(""),h(""))}function C(R){g(E=>E.filter(B=>B.name!==R))}function D(){t(f),e()}return c.jsxs(au,{open:n,onClose:e,className:"relative z-50",children:[c.jsx("div",{className:"fixed inset-0 bg-black/40","aria-hidden":"true"}),c.jsx("div",{className:"fixed inset-0 flex items-center justify-center p-4",children:c.jsxs(au.Panel,{className:"w-full max-w-lg rounded-lg bg-white dark:bg-gray-800 p-6 shadow-xl dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[c.jsx(au.Title,{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Zusätzliche Cookies"}),c.jsxs("div",{className:"mt-4 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[c.jsx("input",{value:a,onChange:R=>l(R.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:R=>h(R.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(en,{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(R=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:R.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:R.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>C(R.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},R.name))})]})}),c.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[c.jsx(en,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:D,children:"Übernehmen"})]})]})})]})}function mA({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 gA=m.forwardRef(mA);function Rg({tabs:n,value:e,onChange:t,className:i,ariaLabel:a="Ansicht auswählen",variant:l="underline",hideCountUntilMd:u=!1}){if(!n?.length)return null;const h=n.find(C=>C.id===e)??n[0],f=nn("col-start-1 row-start-1 w-full appearance-none rounded-md bg-white py-2 pr-8 pl-3 text-base text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 dark:text-gray-100 dark:outline-white/10 dark:*:bg-gray-800 dark:focus:outline-indigo-500",l==="pillsBrand"?"dark:bg-gray-800/50":"dark:bg-white/5"),g=C=>nn(C?"bg-indigo-100 text-indigo-600 dark:bg-indigo-500/20 dark:text-indigo-400":"bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300",u?"ml-3 hidden rounded-full px-2.5 py-0.5 text-xs font-medium md:inline-block":"ml-3 rounded-full px-2.5 py-0.5 text-xs font-medium"),_=(C,D)=>D.count===void 0?null:c.jsx("span",{className:g(C),children:D.count}),S=()=>{switch(l){case"underline":case"underlineIcons":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex space-x-8",children:n.map(C=>{const D=C.id===h.id,R=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"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",R&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[l==="underlineIcons"&&C.icon?c.jsx(C.icon,{"aria-hidden":"true",className:nn(D?"text-indigo-500 dark:text-indigo-400":"text-gray-400 group-hover:text-gray-500 dark:text-gray-500 dark:group-hover:text-gray-400","mr-2 -ml-0.5 size-5")}):null,c.jsx("span",{children:C.label}),_(D,C)]},C.id)})})});case"pills":case"pillsGray":case"pillsBrand":{const C=l==="pills"?"bg-gray-100 text-gray-700 dark:bg-white/10 dark:text-gray-200":l==="pillsGray"?"bg-gray-200 text-gray-800 dark:bg-white/10 dark:text-white":"bg-indigo-100 text-indigo-700 dark:bg-indigo-500/20 dark:text-indigo-300",D=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(R=>{const E=R.id===h.id,B=!!R.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(R.id),disabled:B,"aria-current":E?"page":void 0,className:nn(E?C:D,"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:R.label}),R.count!==void 0?c.jsx("span",{className:nn(E?"ml-2 bg-white/70 text-gray-900 dark:bg-white/10 dark:text-white":"ml-2 bg-gray-100 text-gray-900 dark:bg-white/10 dark:text-gray-300","rounded-full px-2 py-0.5 text-xs font-medium"),children:R.count}):null]},R.id)})})}case"fullWidthUnderline":return c.jsx("div",{className:"border-b border-gray-200 dark:border-white/10",children:c.jsx("nav",{"aria-label":a,className:"-mb-px flex",children:n.map(C=>{const D=C.id===h.id,R=!!C.disabled;return c.jsx("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"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",R&&"cursor-not-allowed opacity-50 hover:border-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:C.label},C.id)})})});case"barUnderline":return c.jsx("nav",{"aria-label":a,className:"isolate flex divide-x divide-gray-200 rounded-lg bg-white shadow-sm dark:divide-white/10 dark:bg-gray-800/50 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",children:n.map((C,D)=>{const R=C.id===h.id,E=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!E&&t(C.id),disabled:E,"aria-current":R?"page":void 0,className:nn(R?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",D===0?"rounded-l-lg":"",D===n.length-1?"rounded-r-lg":"","group relative min-w-0 flex-1 overflow-hidden px-4 py-4 text-center text-sm font-medium hover:bg-gray-50 focus:z-10 dark:hover:bg-white/5",E&&"cursor-not-allowed opacity-50 hover:bg-transparent hover:text-gray-500 dark:hover:text-gray-400"),children:[c.jsxs("span",{className:"inline-flex max-w-full min-w-0 items-center justify-center",children:[c.jsx("span",{className:"min-w-0 truncate whitespace-nowrap",title:C.label,children:C.label}),C.count!==void 0?c.jsx("span",{className:"ml-2 shrink-0 tabular-nums min-w-[2.25rem] rounded-full bg-white/70 px-2 py-0.5 text-center text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-white",children:C.count}):null]}),c.jsx("span",{"aria-hidden":"true",className:nn(R?"bg-indigo-500 dark:bg-indigo-400":"bg-transparent","absolute inset-x-0 bottom-0 h-0.5")})]},C.id)})});case"simple":return c.jsx("nav",{className:"flex border-b border-gray-200 py-4 dark:border-white/10","aria-label":a,children:c.jsx("ul",{role:"list",className:"flex min-w-full flex-none gap-x-8 px-2 text-sm/6 font-semibold text-gray-500 dark:text-gray-400",children:n.map(C=>{const D=C.id===h.id,R=!!C.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!R&&t(C.id),disabled:R,"aria-current":D?"page":void 0,className:nn(D?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",R&&"cursor-not-allowed opacity-50 hover:text-inherit"),children:C.label})},C.id)})})});default:return null}};return c.jsxs("div",{className:i,children:[c.jsxs("div",{className:"grid grid-cols-1 sm:hidden",children:[c.jsx("select",{value:h.id,onChange:C=>t(C.target.value),"aria-label":a,className:f,children:n.map(C=>c.jsx("option",{value:C.id,children:C.label},C.id))}),c.jsx(gA,{"aria-hidden":"true",className:"pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end fill-gray-500 dark:fill-gray-400"})]}),c.jsx("div",{className:"hidden sm:block",children:S()})]})}function Ns({header:n,footer:e,grayBody:t=!1,grayFooter:i=!1,edgeToEdgeMobile:a=!1,well:l=!1,noBodyPadding:u=!1,className:h,bodyClassName:f,children:g}){const _=l;return c.jsxs("div",{className:nn("overflow-hidden",a?"sm:rounded-lg":"rounded-lg",_?"bg-gray-50 dark:bg-gray-800 shadow-none":"bg-white shadow-sm dark:bg-gray-800 dark:shadow-none dark:outline dark:-outline-offset-1 dark:outline-white/10",h),children:[n&&c.jsx("div",{className:"shrink-0 px-4 py-5 sm:px-6 border-b border-gray-200 dark:border-white/10",children:n}),c.jsx("div",{className:nn("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:nn("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 Og({checked:n,onChange:e,id:t,name:i,disabled:a,required:l,ariaLabel:u,ariaLabelledby:h,ariaDescribedby:f,size:g="default",variant:_="simple",className:S}){const C=R=>{a||e(R.target.checked)},D=nn("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:nn("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:nn("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:nn("absolute left-0 size-5 rounded-full border border-gray-300 bg-white shadow-xs transition-transform duration-200 ease-in-out dark:shadow-none",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:D})]}):c.jsxs("div",{className:nn("group relative inline-flex w-11 shrink-0 rounded-full bg-gray-200 p-0.5 inset-ring inset-ring-gray-900/5 outline-offset-2 outline-indigo-600 transition-colors duration-200 ease-in-out has-focus-visible:outline-2 dark:bg-white/5 dark:inset-ring-white/10 dark:outline-indigo-500",n&&"bg-indigo-600 dark:bg-indigo-500",a&&"opacity-60",S),children:[_==="icon"?c.jsxs("span",{className:nn("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:nn("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:nn("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:nn("size-5 rounded-full bg-white shadow-xs ring-1 ring-gray-900/5 transition-transform duration-200 ease-in-out",n&&"translate-x-5")}),c.jsx("input",{id:t,name:i,type:"checkbox",checked:n,onChange:C,disabled:a,required:l,"aria-label":u,"aria-labelledby":h,"aria-describedby":f,className:D})]})}function Sa({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:nn("flex items-center justify-between gap-3",a),children:[c.jsx(Og,{...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:nn("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(Og,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const bu=new Map;let C1=!1;function yA(){C1||(C1=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const n of bu.values())n.es&&(n.es.close(),n.es=null,n.dispatchers.clear());else for(const n of bu.values())n.refs>0&&!n.es&&Cw(n)}))}function Cw(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 bA(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function vA(n){let e=bu.get(n);return e||(e={url:n,es:null,refs:0,listeners:new Map,dispatchers:new Map},bu.set(n,e)),e}function ll(n,e,t){yA();const i=vA(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 Cw(i);return()=>{const l=bu.get(n);if(!l)return;const u=l.listeners.get(e);u&&(u.delete(t),u.size===0&&l.listeners.delete(e)),l.refs=Math.max(0,l.refs-1),l.refs===0&&(bA(l),bu.delete(n))}}async function xA(n,e){const t=await fetch(n,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const a=i&&(i.error||i.message)||t.statusText;throw new Error(a)}return i}const _A="/api/stream",wA="state";function A1({startUrl:n,stopUrl:e,onTrigger:t,title:i="Task",description:a="Startet eine Hintergrundaufgabe. Fortschritt & Abbrechen oben in der Taskliste.",startLabel:l="Start",startingLabel:u="Starte…",disabled:h=!1,busy:f=!1,onFinished:g,onStart:_,onProgress:S,onDone:C,onCancelled:D,onError:R}){const[E,B]=m.useState(null),[G,Y]=m.useState(!1),[q,se]=m.useState(null),Q=m.useRef(null),K=m.useRef(!1),O=m.useRef(!1),re=m.useRef(!1),k=m.useRef(!1),j=m.useRef(""),te=m.useRef(S),V=m.useRef(R);m.useEffect(()=>{te.current=S},[S]),m.useEffect(()=>{V.current=R},[R]);async function ne(){if(e&&!re.current){re.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{re.current=!1}}}function he(){if(Q.current)return Q.current;const Z=new AbortController;Q.current=Z;const ee=()=>{O.current=!0,ne()};return Z.signal.addEventListener("abort",ee,{once:!0}),Z}function ae(Z){K.current||(K.current=!0,_?.(Z))}m.useEffect(()=>{const Z=k.current,ee=!!E?.running;if(k.current=ee,Z&&!ee){const fe=String(E?.error??"").trim();Q.current=null,K.current=!1,O.current||fe==="abgebrochen"?(O.current=!1,D?.()):fe||C?.(),g?.()}},[E?.running,E?.error,g,C,D]),m.useEffect(()=>{if(t||!n)return;const Z=ll(_A,wA,ee=>{if(B(ee),!!ee?.running){const pe=he();ae(pe)}te.current?.({done:ee?.done??0,total:ee?.total??0,currentFile:ee?.currentFile??""});const I=String(ee?.error??"").trim();I&&I!=="abgebrochen"&&I!==j.current&&(j.current=I,V.current?.(I))});return()=>Z()},[n,t]);async function z(){if(f||E?.running)return;if(se(null),Y(!0),O.current=!1,j.current="",t){try{await t()}catch(ee){const fe=ee?.message??String(ee);se(fe),R?.(fe)}finally{Y(!1)}return}if(!n){const ee="Task ist nicht konfiguriert (startUrl fehlt).";se(ee),R?.(ee),Y(!1);return}const Z=he();try{const ee=await xA(n,{method:"POST"});B(ee),ae(Z),ee?.running&&S?.({done:ee?.done??0,total:ee?.total??0,currentFile:ee?.currentFile??""})}catch(ee){Q.current=null,K.current=!1;const fe=ee?.message??String(ee);se(fe),R?.(fe)}finally{Y(!1)}}const P=!!E?.running;return c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:i}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:a}),q?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:q}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(en,{variant:"primary",onClick:z,disabled:h||f||G||P,children:G||f?u:l})})]})}function TA(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 SA({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=TA(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 kA({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 EA=m.forwardRef(kA);function CA({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 N1=m.forwardRef(CA);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:"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 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:"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 Gh=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:"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 jA=m.forwardRef(MA);function RA({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 OA=m.forwardRef(RA);function LA({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 D1=m.forwardRef(LA);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:"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 Em=m.forwardRef(IA);function BA({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 PA=m.forwardRef(BA);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:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const UA=m.forwardRef(FA);function zA({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 $A=m.forwardRef(zA);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 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 qA=m.forwardRef(HA);function VA({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 xf=m.forwardRef(VA);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:"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 M1=m.forwardRef(GA);function KA({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 ed=m.forwardRef(KA);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:"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 XA=m.forwardRef(WA);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:"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 QA=m.forwardRef(YA);function ZA({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 JA=m.forwardRef(ZA);function eN({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 tN=m.forwardRef(eN);function nN({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 j1=m.forwardRef(nN);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:"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 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:"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 aN=m.forwardRef(sN);function oN({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 lN=m.forwardRef(oN);function uN({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 Cm=m.forwardRef(uN);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:"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 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:"M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"}))}const _f=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.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 pN=m.forwardRef(fN);function mN({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 R1=m.forwardRef(mN);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:"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 O1=m.forwardRef(gN);function yN({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 bN=m.forwardRef(yN);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:"M6 18 18 6M6 6l12 12"}))}const wf=m.forwardRef(vN);function fr(...n){return n.filter(Boolean).join(" ")}function Tf({open:n,onClose:e,title:t,children:i,footer:a,icon:l,width:u="max-w-lg",layout:h="single",left:f,leftWidthClass:g="lg:w-80",scroll:_,bodyClassName:S,leftClassName:C,rightClassName:D,rightHeader:R,rightBodyClassName:E,mobileCollapsedImageSrc:B,mobileCollapsedImageAlt:G,titleRight:Y}){const q=_??(h==="split"?"right":"body"),se=m.useRef(null),[Q,K]=m.useState(!1);return m.useEffect(()=>{if(!n)return;const O=document.documentElement,re=document.body,k=O.style.overflow,j=re.style.overflow,te=re.style.paddingRight,V=window.innerWidth-O.clientWidth;return O.style.overflow="hidden",re.style.overflow="hidden",V>0&&(re.style.paddingRight=`${V}px`),()=>{O.style.overflow=k,re.style.overflow=j,re.style.paddingRight=te}},[n]),m.useEffect(()=>{n&&K(!1)},[n]),m.useEffect(()=>{if(!n)return;const O=se.current;if(!O)return;const re=72,k=()=>{const j=O.scrollTop||0;K(te=>{const V=j>re;return te===V?te:V})};return k(),O.addEventListener("scroll",k,{passive:!0}),()=>O.removeEventListener("scroll",k)},[n]),c.jsx(Jc,{show:n,as:m.Fragment,children:c.jsxs(au,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(Jc.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(Jc.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(au.Panel,{className:fr("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",u),children:[l?c.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:l}):null,c.jsxs("div",{className:fr("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",h==="split"?"hidden lg:flex":"flex"),children:[c.jsx("div",{className:"min-w-0",children:t?c.jsx(au.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),Y?c.jsx("div",{className:"shrink-0 flex items-center gap-2",children:Y}):null,c.jsx("button",{type:"button",onClick:e,className:fr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]}),h==="single"?c.jsx("div",{className:fr("flex-1 min-h-0 h-full",q==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",D),children:i}):c.jsxs("div",{className:fr("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",S),children:[c.jsxs("div",{ref:se,className:fr("lg:hidden flex-1 min-h-0 relative",q==="right"||q==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:fr("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:fr("flex items-center justify-between gap-3 px-3",Q?"py-2":"py-3"),children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2",children:[B?c.jsx("img",{src:B,alt:G||t||"",className:fr("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",Q?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0",children:t?c.jsx("div",{className:fr("truncate font-semibold text-gray-900 dark:text-white",Q?"text-sm":"text-base"),children:t}):null})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[Y?c.jsx("div",{className:"flex items-center",children:Y}):null,c.jsx("button",{type:"button",onClick:e,className:fr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"size-5"})})]})]}),R?c.jsx("div",{children:R}):null]}),f?c.jsx("div",{className:fr("lg:hidden px-2 pb-2",C),children:f}):null,c.jsx("div",{className:fr("px-2 pt-0 min-h-0",D),children:c.jsx("div",{className:fr("min-h-0",E),children:i})})]}),c.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[c.jsx("div",{className:fr("min-h-0",g,"shrink-0","overflow-hidden",C),children:f}),c.jsxs("div",{className:fr("flex-1 min-h-0 flex flex-col",D),children:[R?c.jsx("div",{className:"shrink-0",children:R}):null,c.jsx("div",{className:fr("flex-1 min-h-0",q==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",E),children:i})]})]})]}),a?c.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:a}):null]})})})})]})})}function Aw(n,e){const t=Number(n);return Number.isFinite(t)&&t>0?Math.floor(t):e}function xN(n){const e=(n.user||"").trim()||"postgres",t=(n.host||"").trim()||"127.0.0.1",i=Aw(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 _N({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,_]=m.useState("nsfwapp"),[S,C]=m.useState("postgres"),[D,R]=m.useState(""),[E,B]=m.useState("disable"),G=m.useMemo(()=>xN({user:S,host:l,port:h,db:g,sslmode:E}),[S,l,h,g,E]),Y=c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:()=>{a({databaseUrl:G,dbPassword:D}),e()},children:"Übernehmen"})]});return c.jsx(Tf,{open:n,onClose:e,title:"Postgres URL erstellen",width:"max-w-2xl",footer:Y,children:c.jsxs("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6 space-y-4",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Passwort wird ",c.jsx("span",{className:"font-semibold",children:"verschlüsselt"})," gespeichert (nicht in der URL).",t?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"mt-1",children:["Aktuelle URL: ",c.jsx("code",{className:"break-all",children:t})]})}):null,i?c.jsx("div",{className:"mt-1",children:"Passwort: ✅ gespeichert"}):null]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Host"}),c.jsx("input",{value:l,onChange:q=>u(q.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:q=>f(Aw(q.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:q=>_(q.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:q=>C(q.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:D,onChange:q=>R(q.target.value),type:"password",className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"••••••••"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"SSL"}),c.jsxs("select",{value:E,onChange:q=>B(q.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:G})]})]})})}function wN({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 Nw=m.forwardRef(wN);function TN({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(TN);function SN({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 Lg=m.forwardRef(SN);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",{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 EN=m.forwardRef(kN);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",{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(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",{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 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",{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 MN=m.forwardRef(DN);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:"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 RN=m.forwardRef(jN);function ON({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 vu=m.forwardRef(ON);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.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 IN=m.forwardRef(LN),Wi={databaseUrl:"",hasDbPassword:!1,recordDir:"records",doneDir:"records/done",ffmpegPath:"",autoAddToDownloadList:!0,useChaturbateApi:!1,useMyFreeCamsWatcher:!1,autoDeleteSmallDownloads:!0,autoDeleteSmallDownloadsBelowMB:200,blurPreviews:!1,teaserPlayback:"hover",teaserAudio:!1,lowDiskPauseBelowGB:5,enableNotifications:!0};function BN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function PN({onAssetsGenerated:n}){const[e,t]=m.useState(Wi),[i,a]=m.useState(!1),[l,u]=m.useState(0),h=m.useRef(null),[f,g]=m.useState(!1),[_,S]=m.useState(null),[C,D]=m.useState(null),[R,E]=m.useState(null),[B,G]=m.useState(null),Y=m.useRef(null),[q,se]=m.useState(!1),[Q,K]=m.useState(""),O=Date.now(),re=l>O,j=i?"saving":re?"success":!!R&&!i&&!re?"error":"idle",te=j==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:j==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(Nw,{className:"size-4"}),isLoading:!1}:j==="error"?{text:"Fehler",color:"red",icon:c.jsx(IN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[V,ne]=m.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[he,ae]=m.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),z=Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB??5),P=B?.pauseGB??z,Z=B?.resumeGB??z+3;m.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),m.useEffect(()=>{let ye=!0;return fetch("/api/settings",{cache:"no-store"}).then(async me=>{if(!me.ok)throw new Error(await me.text());return me.json()}).then(me=>{ye&&t({databaseUrl:String(me.databaseUrl??""),hasDbPassword:!!(me.hasDbPassword??!1),recordDir:(me.recordDir||Wi.recordDir).toString(),doneDir:(me.doneDir||Wi.doneDir).toString(),ffmpegPath:String(me.ffmpegPath??Wi.ffmpegPath??""),autoAddToDownloadList:me.autoAddToDownloadList??Wi.autoAddToDownloadList,autoStartAddedDownloads:me.autoStartAddedDownloads??Wi.autoStartAddedDownloads,useChaturbateApi:me.useChaturbateApi??Wi.useChaturbateApi,useMyFreeCamsWatcher:me.useMyFreeCamsWatcher??Wi.useMyFreeCamsWatcher,autoDeleteSmallDownloads:me.autoDeleteSmallDownloads??Wi.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:me.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB,blurPreviews:me.blurPreviews??Wi.blurPreviews,teaserPlayback:me.teaserPlayback??Wi.teaserPlayback,teaserAudio:me.teaserAudio??Wi.teaserAudio,lowDiskPauseBelowGB:me.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB,enableNotifications:me.enableNotifications??Wi.enableNotifications})}).catch(()=>{}),()=>{ye=!1}},[]),m.useEffect(()=>{let ye=!0;const me=async()=>{try{const We=await fetch("/api/status/disk",{cache:"no-store"});if(!We.ok)return;const _e=await We.json();ye&&G(_e)}catch{}};me();const pt=window.setInterval(me,5e3);return()=>{ye=!1,window.clearInterval(pt)}},[]);async function ee(ye){E(null),D(null),S(ye);try{window.focus();const me=await fetch(`/api/settings/browse?target=${ye}`,{cache:"no-store"});if(me.status===204)return;if(!me.ok){const _e=await me.text().catch(()=>"");throw new Error(_e||`HTTP ${me.status}`)}const We=((await me.json()).path??"").trim();if(!We)return;t(_e=>ye==="record"?{..._e,recordDir:We}:ye==="done"?{..._e,doneDir:We}:{..._e,ffmpegPath:We})}catch(me){E(me?.message??String(me))}finally{S(null)}}async function fe(){E(null),D(null);const ye=e.recordDir.trim(),me=e.doneDir.trim(),pt=(e.ffmpegPath??"").trim(),We=String(e.databaseUrl??"").trim();if(!ye||!me){E("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const _e=!!e.autoAddToDownloadList,Ye=_e?!!e.autoStartAddedDownloads:!1,wt=!!e.useChaturbateApi,je=!!e.useMyFreeCamsWatcher,Se=!!e.autoDeleteSmallDownloads,Je=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB)))),tt=!!e.blurPreviews,ot=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:Wi.teaserPlayback,dt=!!e.teaserAudio,Ut=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??Wi.lowDiskPauseBelowGB))),Ge=!!e.enableNotifications;a(!0);try{const Ie=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:We,dbPassword:Q||void 0,recordDir:ye,doneDir:me,ffmpegPath:pt,autoAddToDownloadList:_e,autoStartAddedDownloads:Ye,useChaturbateApi:wt,useMyFreeCamsWatcher:je,autoDeleteSmallDownloads:Se,autoDeleteSmallDownloadsBelowMB:Je,blurPreviews:tt,teaserPlayback:ot,teaserAudio:dt,lowDiskPauseBelowGB:Ut,enableNotifications:Ge})});if(!Ie.ok){const et=await Ie.text().catch(()=>"");throw new Error(et||`HTTP ${Ie.status}`)}D("✅ Gespeichert.");const Ze=Date.now()+2500;u(Ze),h.current!=null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{u(0),h.current=null},2500),window.dispatchEvent(new CustomEvent("recorder-settings-updated"))}catch(Ie){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),E(Ie?.message??String(Ie))}finally{a(!1)}}function I(ye,me=3500,pt=500){window.setTimeout(()=>{ye(We=>({...We,fading:!0})),window.setTimeout(()=>{ye(We=>({...We,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},pt)},me)}async function pe(){E(null),D(null);const ye=Number(e.autoDeleteSmallDownloadsBelowMB??Wi.autoDeleteSmallDownloadsBelowMB??0),me=(e.doneDir||Wi.doneDir).trim();if(!me){E("doneDir ist leer.");return}if(!ye||ye<=0){E("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen:
|
||
• Löscht Dateien in "${me}" < ${ye} MB (Ordner "keep" wird übersprungen)
|
||
• Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei
|
||
|
||
Fortfahren?`)){g(!0),ae(We=>({...We,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const We=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!We.ok){const Je=await We.text().catch(()=>"");throw new Error(Je||`HTTP ${We.status}`)}const _e=await We.json(),Ye=Number(_e.scannedFiles??0),wt=Number(_e.orphanIdsRemoved??0),je=Number(_e.generatedOrphansRemoved??0),Se=wt+je;ae(Je=>({...Je,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Ye} · Orphans: ${Se}`})),I(ae)}catch(We){const _e=We?.message??String(We);E(_e),ae(Ye=>({...Ye,status:"error",text:"Fehler beim Aufräumen.",err:_e})),I(ae)}finally{g(!1)}}}async function ke(){const ye=Y.current;if(Y.current=null,ne(me=>({...me,status:"cancelled",text:"Abgebrochen."})),ye){ye.abort();return}try{await fetch("/api/tasks/generate-assets",{method:"DELETE",cache:"no-store"})}catch{}}return c.jsx(Ns,{header:c.jsxs("div",{className:"flex items-start justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Einstellungen"}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:"Recorder-Konfiguration, Automatisierung und Tasks."})]}),c.jsxs("div",{className:"flex items-start gap-2",children:[j!=="success"?c.jsx("div",{className:"hidden sm:flex min-w-0 max-w-[520px] items-stretch",children:R?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:R}):C?c.jsx("div",{className:`\r
|
||
inline-flex items-center\r
|
||
px-3 py-[7px] text-sm\r
|
||
rounded-md border border-green-200 bg-green-50 text-green-700\r
|
||
dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200\r
|
||
`,children:C}):null}):null,c.jsx(en,{variant:"primary",color:te.color,onClick:fe,disabled:i,className:"shrink-0",size:"md",isLoading:te.isLoading,leadingIcon:te.icon,children:te.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(SA,{tasks:[V,he],onCancel:ye=>{ye==="generate-assets"&&ke()}}),j!=="success"?c.jsxs("div",{className:"sm:hidden",children:[R&&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:R}),C&&c.jsx("div",{className:"rounded-lg border border-green-200 bg-green-50 px-3 py-2 text-sm text-green-700 dark:border-green-500/30 dark:bg-green-500/10 dark:text-green-200",children:C})]}):null,c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsx("div",{className:"flex items-start justify-between gap-4",children:c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Aufgaben"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Hintergrundaufgaben wie z.B. Asset/Preview-Generierung."})]})}),c.jsxs("div",{className:"mt-3 space-y-3",children:[c.jsx(A1,{title:"Assets-Generator",description:"Erzeugt fehlende Assets (thumb/preview/meta). Fortschritt & Abbrechen oben in der Taskliste.",startLabel:"Start",startingLabel:"Starte…",startUrl:"/api/tasks/generate-assets",stopUrl:"/api/tasks/generate-assets",onFinished:n,onStart:ye=>{Y.current=ye,ne(me=>({...me,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:ye=>{const me=BN(ye.currentFile);ne(pt=>({...pt,status:"running",title:"Assets generieren",text:me||"",done:ye.done,total:ye.total}))},onDone:()=>{Y.current=null,ne(ye=>({...ye,status:"done",title:"Assets generieren"})),I(ne)},onCancelled:()=>{Y.current=null,ne(ye=>({...ye,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),I(ne)},onError:ye=>{Y.current=null,ne(me=>({...me,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:ye})),I(ne)}}),c.jsx(A1,{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:pe,busy:f,disabled:i||!e.autoDeleteSmallDownloads,onError:ye=>{E(ye)}})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Pfad-Einstellungen"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aufnahme- und Zielverzeichnisse sowie optionaler ffmpeg-Pfad."})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Datenbank"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Postgres Verbindung. Passwort wird verschlüsselt gespeichert."})]}),c.jsx("div",{className:"space-y-3",children:c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Database URL"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:String(e.databaseUrl??""),onChange:ye=>t(me=>({...me,databaseUrl:ye.target.value})),placeholder:"postgres://user@host:5432/db?sslmode=disable",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(en,{variant:"secondary",onClick:()=>se(!0),disabled:i,children:"URL erstellen…"})]})]})})]}),c.jsx(_N,{open:q,onClose:()=>se(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:ye,dbPassword:me})=>{t(pt=>({...pt,databaseUrl:ye})),K(me||"")}}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Aufnahme-Ordner"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.recordDir,onChange:ye=>t(me=>({...me,recordDir:ye.target.value})),placeholder:"records (oder absolut: C:\\records / /mnt/data/records)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(en,{variant:"secondary",onClick:()=>ee("record"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Fertige Downloads nach"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.doneDir,onChange:ye=>t(me=>({...me,doneDir:ye.target.value})),placeholder:"records/done",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(en,{variant:"secondary",onClick:()=>ee("done"),disabled:i||_!==null,children:"Durchsuchen..."})]})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"ffmpeg.exe"}),c.jsxs("div",{className:"sm:col-span-9 flex gap-2",children:[c.jsx("input",{value:e.ffmpegPath??"",onChange:ye=>t(me=>({...me,ffmpegPath:ye.target.value})),placeholder:"Leer = automatisch (FFMPEG_PATH / ffmpeg im PATH)",className:`min-w-0 flex-1 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`}),c.jsx(en,{variant:"secondary",onClick:()=>ee("ffmpeg"),disabled:i||_!==null,children:"Durchsuchen..."})]})]})]})]}),c.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white p-4 shadow-sm dark:border-white/10 dark:bg-gray-950/40",children:[c.jsxs("div",{className:"mb-3",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Automatisierung & Anzeige"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Verhalten beim Hinzufügen/Starten sowie Anzeigeoptionen."})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsx(Sa,{checked:!!e.autoAddToDownloadList,onChange:ye=>t(me=>({...me,autoAddToDownloadList:ye,autoStartAddedDownloads:ye?me.autoStartAddedDownloads:!1})),label:"Automatisch zur Downloadliste hinzufügen",description:"Neue Links/Modelle werden automatisch in die Downloadliste übernommen."}),c.jsx(Sa,{checked:!!e.autoStartAddedDownloads,onChange:ye=>t(me=>({...me,autoStartAddedDownloads:ye})),disabled:!e.autoAddToDownloadList,label:"Hinzugefügte Downloads automatisch starten",description:"Wenn ein Download hinzugefügt wurde, startet er direkt (sofern möglich)."}),c.jsx(Sa,{checked:!!e.useChaturbateApi,onChange:ye=>t(me=>({...me,useChaturbateApi:ye})),label:"Chaturbate API",description:"Wenn aktiv, pollt das Backend alle paar Sekunden die Online-Rooms API und cached die aktuell online Models."}),c.jsx(Sa,{checked:!!e.useMyFreeCamsWatcher,onChange:ye=>t(me=>({...me,useMyFreeCamsWatcher:ye})),label:"MyFreeCams Auto-Check (watched)",description:"Geht watched MyFreeCams-Models einzeln durch und startet einen Download. Wenn keine Output-Datei entsteht, ist der Stream nicht öffentlich (offline/away/private) und der Job wird wieder entfernt."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsx(Sa,{checked:!!e.autoDeleteSmallDownloads,onChange:ye=>t(me=>({...me,autoDeleteSmallDownloads:ye,autoDeleteSmallDownloadsBelowMB:me.autoDeleteSmallDownloadsBelowMB??50})),label:"Kleine Downloads automatisch löschen",description:"Löscht fertige Downloads automatisch, wenn die Datei kleiner als die eingestellte Mindestgröße ist."}),c.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center "+(e.autoDeleteSmallDownloads?"":"opacity-50 pointer-events-none"),children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Mindestgröße"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Alles darunter wird gelöscht."})]}),c.jsx("div",{className:"sm:col-span-8",children:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[c.jsx("input",{type:"number",min:0,step:1,value:e.autoDeleteSmallDownloadsBelowMB??50,onChange:ye=>t(me=>({...me,autoDeleteSmallDownloadsBelowMB:Number(ye.target.value||0)})),className:`h-9 w-32 rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
|
||
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100`}),c.jsx("span",{className:"shrink-0 text-xs text-gray-600 dark:text-gray-300",children:"MB"})]})})]})]}),c.jsx(Sa,{checked:!!e.blurPreviews,onChange:ye=>t(me=>({...me,blurPreviews:ye})),label:"Vorschaubilder blurren",description:"Weichzeichnet Vorschaubilder/Teaser (praktisch auf mobilen Geräten oder im öffentlichen Umfeld)."}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-12 sm:items-center",children:[c.jsxs("div",{className:"sm:col-span-4",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-200",children:"Teaser abspielen"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Standbild spart Leistung. „Bei Hover (Standard)“: Desktop spielt bei Hover ab, Mobile im Viewport. „Alle“ kann viel CPU ziehen."})]}),c.jsxs("div",{className:"sm:col-span-8",children:[c.jsx("label",{className:"sr-only",htmlFor:"teaserPlayback",children:"Teaser abspielen"}),c.jsxs("select",{id:"teaserPlayback",value:e.teaserPlayback??"hover",onChange:ye=>t(me=>({...me,teaserPlayback:ye.target.value})),className:`h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
|
||
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"still",children:"Standbild"}),c.jsx("option",{value:"hover",children:"Bei Hover (Standard)"}),c.jsx("option",{value:"all",children:"Alle"})]})]})]}),c.jsx(Sa,{checked:!!e.teaserAudio,onChange:ye=>t(me=>({...me,teaserAudio:ye})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(Sa,{checked:!!e.enableNotifications,onChange:ye=>t(me=>({...me,enableNotifications:ye})),label:"Benachrichtigungen",description:"Wenn aktiv, zeigt das Frontend Toasts (z.B. wenn watched Models online/live gehen oder wenn ein queued Model wieder public wird)."}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50 p-3 dark:border-white/10 dark:bg-white/5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:"Speicherplatz-Notbremse"}),c.jsx("div",{className:"mt-1 text-xs text-gray-600 dark:text-gray-300",children:"Aktiviert automatisch Stop + Autostart-Block bei wenig freiem Speicher (Resume bei +3 GB)."})]}),c.jsx("span",{className:"inline-flex items-center rounded-full px-2 py-1 text-[11px] font-medium "+(B?.emergency?"bg-red-100 text-red-800 dark:bg-red-500/20 dark:text-red-200":"bg-green-100 text-green-800 dark:bg-green-500/20 dark:text-green-200"),title:B?.emergency?"Notfallbremse greift gerade":"OK",children:B?.emergency?"AKTIV":"OK"})]}),c.jsxs("div",{className:"mt-3 text-sm text-gray-900 dark:text-gray-200",children:[c.jsxs("div",{children:[c.jsx("span",{className:"font-medium",children:"Schwelle:"})," ","Pause unter ",c.jsx("span",{className:"tabular-nums",children:P})," GB"," · ","Resume ab"," ",c.jsx("span",{className:"tabular-nums",children:Z})," ","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 Am(...n){return n.filter(Boolean).join(" ")}const FN={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 Ig({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=FN[i];return c.jsx("span",{className:Am("isolate inline-flex rounded-md shadow-xs dark:shadow-none ring-1 ring-gray-300 dark:ring-gray-700 overflow-hidden",a),role:"group","aria-label":l,children:n.map((h,f)=>{const g=h.id===e,_=f===0,S=f===n.length-1,C=!h.label&&!!h.icon;return c.jsxs("button",{type:"button",disabled:h.disabled,onClick:()=>t(h.id),"aria-pressed":g,className:Am("relative inline-flex items-center justify-center font-semibold leading-none focus:z-10 transition-colors",!_&&"before:absolute before:left-0 before:top-0 before:bottom-0 before:w-px before:bg-gray-300 dark:before:bg-gray-700",_&&"rounded-l-md",S&&"rounded-r-md",g?"bg-indigo-100 text-indigo-800 hover:bg-indigo-200 dark:bg-indigo-500/40 dark:text-indigo-100 dark:hover:bg-indigo-500/50":"bg-white text-gray-900 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:hover:bg-white/20","disabled:opacity-50 disabled:cursor-not-allowed",C?`p-0 ${u.iconOnly}`:u.btn),title:typeof h.label=="string"?h.label:h.srLabel,children:[C&&h.srLabel?c.jsx("span",{className:"sr-only",children:h.srLabel}):null,h.icon?c.jsx("span",{className:Am("shrink-0",C?"":"-ml-0.5",g?"text-indigo-600 dark:text-indigo-200":"text-gray-400 dark:text-gray-500"),children:h.icon}):null,h.label?c.jsx("span",{className:h.icon?"ml-1.5":"",children:h.label}):null]},h.id)})})}function UN(...n){return n.filter(Boolean).join(" ")}function zN(){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 $N=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:_=72,ignoreSelector:S="[data-swipe-ignore]",snapMs:C=180,commitMs:D=180,tapIgnoreSelector:R="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:E,hotTargetSelector:B="[data-hot-target]",doubleTapMs:G=360,doubleTapMaxMovePx:Y=48},q){const se=m.useRef(null),Q=m.useRef(!1),K=m.useRef(0),O=m.useRef(null),re=m.useRef(0),k=m.useRef(null),j=m.useRef(null),te=m.useRef(null),V=m.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[ne,he]=m.useState(0),[ae,z]=m.useState(null),[P,Z]=m.useState(0),ee=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0,se.current&&(se.current.style.touchAction="pan-y"),Z(C),he(0),z(null),window.setTimeout(()=>Z(0),C)},[C]),fe=m.useCallback(async(je,Se)=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),se.current&&(se.current.style.touchAction="pan-y");const tt=se.current?.offsetWidth||360;Z(D),z(je==="right"?"right":"left");const ot=je==="right"?tt+40:-(tt+40);K.current=ot,he(ot);let dt;Se?dt=Promise.resolve(je==="right"?u():l()).catch(()=>!1):dt=Promise.resolve(!0);const Ut=new Promise(Ie=>{window.setTimeout(Ie,D)}),[,Ge]=await Promise.all([Ut,dt]);return Ge===!1?(Z(C),z(null),he(0),window.setTimeout(()=>Z(0),C),!1):!0},[D,l,u,C]),I=m.useCallback(()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),pe=m.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0,Z(0),he(0),z(null);try{const je=se.current;je&&(je.style.touchAction="pan-y")}catch{}},[]),ke=m.useCallback((je,Se)=>{const Je=k.current,tt=se.current;if(!Je||!tt)return;const ot=zN();if(!ot)return;let dt=typeof je=="number"?je:window.innerWidth/2,Ut=typeof Se=="number"?Se:window.innerHeight/2;const Ge=B?k.current?.querySelector(B)??tt.querySelector(B):null;let Ie=dt,Ze=Ut;if(Ge){const an=Ge.getBoundingClientRect();Ie=an.left+an.width/2,Ze=an.top+an.height/2}const et=Ie-dt,ft=Ze-Ut,mt=document.createElement("div");mt.style.position="absolute",mt.style.left=`${dt}px`,mt.style.top=`${Ut}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 de=document.createElement("div");de.style.width="30px",de.style.height="30px",de.style.color="#f59e0b",de.style.display="block",mt.appendChild(de),ot.appendChild(mt);const ze=Y_.createRoot(de);ze.render(c.jsx(Lg,{className:"w-full h-full","aria-hidden":"true"})),mt.getBoundingClientRect();const Le=200,Ae=500,Pe=400,Qe=Le+Ae+Pe,St=Le/Qe,Ot=(Le+Ae)/Qe,Tt=mt.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:St*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:St},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Ot},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${ft}px)) scale(0.85)`,opacity:.95,offset:Ot+(1-Ot)*.75},{transform:`translate(calc(-50% + ${et}px), calc(-50% + ${ft}px)) scale(0.55)`,opacity:0,offset:1}],{duration:Qe,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});Ge&&window.setTimeout(()=>{try{Ge.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+Ae+Math.round(Pe*.75)),Tt.onfinish=()=>{try{ze.unmount()}catch{}mt.remove()}},[B]);m.useEffect(()=>()=>{j.current!=null&&window.clearTimeout(j.current)},[]),m.useImperativeHandle(q,()=>({swipeLeft:je=>fe("left",je?.runAction??!0),swipeRight:je=>fe("right",je?.runAction??!0),reset:()=>ee()}),[fe,ee]);const ye=Math.abs(ne),me=ne===0?null:ne>0?"right":"left",pt=re.current||Math.min(f,(se.current?.offsetWidth||360)*g),We=Math.max(0,Math.min(1,ye/Math.max(1,pt))),_e=Math.max(0,Math.min(1,ye/Math.max(1,pt*1.35))),Ye=Math.max(-6,Math.min(6,ne/28)),wt=ne===0?1:.995;return c.jsx("div",{ref:k,className:UN("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:se,className:"relative",style:{transform:ne!==0?`translate3d(${ne}px,0,0) rotate(${Ye}deg) scale(${wt})`:void 0,transition:P?`transform ${P}ms ease`:void 0,touchAction:"pan-y",willChange:ne!==0?"transform":void 0,boxShadow:ne!==0?me==="right"?`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(16,185,129,${.08+We*.12})`:`0 16px 34px rgba(0,0,0,0.28), 0 0 0 1px rgba(244,63,94,${.08+We*.12})`:void 0,borderRadius:ne!==0?"12px":void 0,filter:ne!==0?`saturate(${1+We*.08}) brightness(${1+We*.02})`:void 0},onPointerDown:je=>{if(!t||i)return;const Se=je.target;let Je=!!(R&&Se?.closest?.(R));if(S&&Se?.closest?.(S))return;let tt=!1;const ot=je.currentTarget,Ut=Array.from(ot.querySelectorAll("video")).find(ft=>ft.controls);if(Ut){const ft=Ut.getBoundingClientRect();if(je.clientX>=ft.left&&je.clientX<=ft.right&&je.clientY>=ft.top&&je.clientY<=ft.bottom)if(ft.bottom-je.clientY<=72)tt=!0,Je=!0;else{const Ae=je.clientX-ft.left,Pe=ft.right-je.clientX;Ae<=64||Pe<=64||(tt=!0,Je=!0)}}const Ie=je.currentTarget.getBoundingClientRect().bottom-je.clientY;_&&Ie<=_&&(tt=!0),V.current={id:je.pointerId,x:je.clientX,y:je.clientY,dragging:!1,captured:!1,tapIgnored:Je,noSwipe:tt};const et=se.current?.offsetWidth||360;re.current=Math.min(f,et*g),K.current=0},onPointerMove:je=>{if(!t||i||V.current.id!==je.pointerId||V.current.noSwipe)return;const Se=je.clientX-V.current.x,Je=je.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(Je)>Math.abs(Se)&&Math.abs(Je)>8){V.current.id=null;return}if(Math.abs(Se)<12)return;V.current.dragging=!0,je.currentTarget.style.touchAction="none",Z(0);try{je.currentTarget.setPointerCapture(je.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const tt=(Ge,Ie)=>{const Ze=Ie*.9,et=Math.abs(Ge);if(et<=Ze)return Ge;const ft=et-Ze,mt=Ze+ft*.25;return Math.sign(Ge)*mt},ot=se.current?.offsetWidth||360;K.current=tt(Se,ot),O.current==null&&(O.current=requestAnimationFrame(()=>{O.current=null,he(K.current)}));const dt=re.current,Ut=Se>dt?"right":Se<-dt?"left":null;z(Ge=>{if(Ge===Ut)return Ge;if(Ut)try{navigator.vibrate?.(10)}catch{}return Ut})},onPointerUp:je=>{if(!t||i||V.current.id!==je.pointerId)return;const Se=re.current||Math.min(f,(se.current?.offsetWidth||360)*g),Je=V.current.dragging,tt=V.current.captured,ot=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,tt)try{je.currentTarget.releasePointerCapture(je.pointerId)}catch{}if(je.currentTarget.style.touchAction="pan-y",!Je){const Ut=Date.now(),Ge=te.current,Ie=Ge&&Math.hypot(je.clientX-Ge.x,je.clientY-Ge.y)<=Y;if(!!E&&Ge&&Ut-Ge.t<=G&&Ie){if(te.current=null,I(),Q.current)return;Q.current=!0;try{ke(je.clientX,je.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await E?.()}finally{Q.current=!1}})()});return}if(ot){te.current={t:Ut,x:je.clientX,y:je.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,te.current=null},E?G:0);return}pe(),te.current={t:Ut,x:je.clientX,y:je.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,te.current=null,a?.()},E?G:0);return}const dt=K.current;O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),dt>Se?fe("right",!0):dt<-Se?fe("left",!0):ee(),K.current=0},onPointerCancel:je=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{je.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),K.current=0;try{je.currentTarget.style.touchAction="pan-y"}catch{}ee()}},children:c.jsxs("div",{className:"relative",children:[c.jsx("div",{className:"relative z-10",children:e}),c.jsx("div",{className:"absolute inset-0 z-20 pointer-events-none rounded-lg transition-opacity duration-100",style:{opacity:ne===0?0:.12+_e*.18,background:me==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":me==="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:ae?1:0,boxShadow:ae==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":ae==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function Dw({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)},_=()=>{g(),f.current=window.setTimeout(()=>{l(!1),f.current=null},150)},S=()=>{g(),l(!0)},C=()=>{_()},D=()=>{g(),l(!1)},R=()=>{const B=t.current,G=i.current;if(!B||!G)return;const Y=8,q=8,se=B.getBoundingClientRect(),Q=G.getBoundingClientRect();let K=se.bottom+Y;if(K+Q.height>window.innerHeight-q){const k=se.top-Q.height-Y;k>=q?K=k:K=Math.max(q,window.innerHeight-Q.height-q)}let re=se.left;re+Q.width>window.innerWidth-q&&(re=window.innerWidth-Q.width-q),re=Math.max(q,re),h({left:re,top:K})};m.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>R());return()=>cancelAnimationFrame(B)},[a]),m.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>R());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),m.useEffect(()=>()=>g(),[]);const E=()=>typeof e=="function"?e(a,{close:D}):e;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:S,onMouseLeave:C,children:n}),a&&yu.createPortal(c.jsx("div",{ref:i,className:"fixed z-50",style:{left:u?.left??-9999,top:u?.top??-9999,visibility:u?"visible":"hidden"},onMouseEnter:S,onMouseLeave:C,children:c.jsx(Ns,{className:"shadow-lg ring-1 ring-black/10 dark:ring-white/10 max-w-[calc(100vw-16px)]",noBodyPadding:!0,children:E()})}),document.body)]})}const Sf=!0,HN=!1;function ud(n,e){if(!n)return;const t=e?.muted??Sf;n.muted=t,n.defaultMuted=t,n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline","")}function L1(n){return(n||"").split(/[\\/]/).pop()||""}function xu({job:n,getFileName:e,durationSeconds:t,onDuration:i,onResolution:a,animated:l=!1,animatedMode:u="frames",animatedTrigger:h="always",autoTickMs:f=15e3,thumbStepSec:g,thumbSpread:_,thumbSamples:S,clipSeconds:C=.75,clipCount:D=12,variant:R="thumb",className:E,showPopover:B=!0,blur:G=!1,inlineVideo:Y=!1,inlineNonce:q=0,inlineControls:se=!1,inlineLoop:Q=!0,assetNonce:K=0,muted:O=Sf,popoverMuted:re=Sf,noGenerateTeaser:k,alwaysLoadStill:j=!1,teaserPreloadEnabled:te=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:ne,preferScrubProgress:he=!1}){const ae=L1(n.output||"")||e(n.output||""),z=G?"blur-md":"",P=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]),[Z,ee]=m.useState(null),fe=m.useRef(new Set),I=m.useMemo(()=>!P&&!Z?null:P?Z?{...P,...Z}:P:Z,[P,Z]),pe=m.useMemo(()=>{let De=I?.previewClips;if(typeof De=="string"){const xt=De.trim();if(xt.length>0)try{const Et=JSON.parse(xt);return Array.isArray(Et)&&Et.length>0,!0}catch{return!0}}if(Array.isArray(De)&&De.length>0)return!0;const bt=I?.preview?.clips;return!!(Array.isArray(bt)&&bt.length>0)},[I]),[ke,ye]=m.useState(0),me=m.useMemo(()=>{let De=I?.previewClips;if(typeof De=="string")try{De=JSON.parse(De)}catch{De=null}!Array.isArray(De)&&Array.isArray(I?.preview?.clips)&&(De=I.preview.clips);const bt=De;if(!Array.isArray(bt)||bt.length===0)return null;let xt=0;const Et=[];for(const Ft of bt){const $t=Number(Ft?.startSeconds),Vt=Number(Ft?.durationSeconds);if(!Number.isFinite($t)||$t<0||!Number.isFinite(Vt)||Vt<=0)continue;const vn=xt,qn=xt+Vt;Et.push({start:$t,dur:Vt,cumStart:vn,cumEnd:qn}),xt=qn}return Et.length?Et:null},[I]),pt=m.useMemo(()=>me?me.map(De=>`${De.start.toFixed(3)}:${De.dur.toFixed(3)}`).join("|"):"",[me]),We=(typeof P?.videoWidth=="number"&&Number.isFinite(P.videoWidth)&&P.videoWidth>0?P.videoWidth:void 0)??(typeof n.videoWidth=="number"&&Number.isFinite(n.videoWidth)&&n.videoWidth>0?n.videoWidth:void 0),_e=(typeof P?.videoHeight=="number"&&Number.isFinite(P.videoHeight)&&P.videoHeight>0?P.videoHeight:void 0)??(typeof n.videoHeight=="number"&&Number.isFinite(n.videoHeight)&&n.videoHeight>0?n.videoHeight:void 0),Ye=(typeof P?.fileSize=="number"&&Number.isFinite(P.fileSize)&&P.fileSize>0?P.fileSize:void 0)??(typeof n.sizeBytes=="number"&&Number.isFinite(n.sizeBytes)&&n.sizeBytes>0?n.sizeBytes:void 0),wt=(typeof P?.fps=="number"&&Number.isFinite(P.fps)&&P.fps>0?P.fps:void 0)??(typeof n.fps=="number"&&Number.isFinite(n.fps)&&n.fps>0?n.fps:void 0),je=(typeof I?.durationSeconds=="number"&&Number.isFinite(I.durationSeconds)&&I.durationSeconds>0?I.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 je=="number"&&Number.isFinite(je)&&je>0?je>1440*60?je/1e3:je:void 0,Je=typeof Se=="number"&&Number.isFinite(Se)&&Se>0,tt=typeof We=="number"&&typeof _e=="number"&&Number.isFinite(We)&&Number.isFinite(_e)&&We>0&&_e>0,ot={muted:O,playsInline:!0,preload:"metadata"},[dt,Ut]=m.useState(!0),[Ge,Ie]=m.useState(!0),[Ze,et]=m.useState(!1),[ft,mt]=m.useState(!1),[de,ze]=m.useState(!0),Le=m.useRef(""),Ae=m.useRef(""),Pe=m.useRef(null),[Qe,St]=m.useState(!1),[Ot,Tt]=m.useState(!1),[an,Nt]=m.useState(!1),[Lt,vt]=m.useState(0),[It,yn]=m.useState(!1),$n=Y===!0||Y==="always"?"always":Y==="hover"?"hover":"never",kt=$n==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",Bn=De=>De.startsWith("HOT ")?De.slice(4):De,at=m.useMemo(()=>{const De=L1(n.output||"")||e(n.output||"");if(!De)return"";const bt=De.replace(/\.[^.]+$/,"");return Bn(bt).trim()},[n.output,e]),N=m.useMemo(()=>ae?`/api/record/video?file=${encodeURIComponent(ae)}`:"",[ae]),F=R==="fill"?"w-full h-full":"w-20 h-16",ie=m.useRef(null),Me=m.useRef(null),He=m.useRef(null),gt=m.useRef({inline:null,teaser:null,clips:null}),zt=(De,bt)=>{bt&>.current[De]!==bt&&(gt.current[De]=bt,ye(xt=>xt+1))},[Jt,un]=m.useState(0),[,Xt]=m.useState(0),pn=De=>De<0?0:De>1?1:De,fn=(De,bt,xt=C,Et=!1)=>{if(!De)return{ratio:0,globalSec:0,vvDur:0};const Ft=Number(De.duration);if(!(Number.isFinite(Ft)&&Ft>0))return{ratio:0,globalSec:0,vvDur:0};const Vt=Number(De.currentTime);if(!Number.isFinite(Vt)||Vt<0)return{ratio:0,globalSec:0,vvDur:Ft};const vn=me;let qn=0;if(Et&&Array.isArray(vn)&&vn.length>0){const Gn=vn[vn.length-1];if(Vt>=Gn.cumEnd)qn=typeof bt=="number"&&Number.isFinite(bt)&&bt>0?bt:Gn.start+Gn.dur;else{let ki=0,Ei=vn.length-1,si=0;for(;ki<=Ei;){const Sn=ki+Ei>>1,Jn=vn[Sn];if(Vt<Jn.cumStart)Ei=Sn-1;else if(Vt>=Jn.cumEnd)ki=Sn+1;else{si=Sn;break}}return qn=vn[si].start,{ratio:vn.length>0?pn(si/vn.length):0,globalSec:Math.max(0,qn),vvDur:Ft}}}return Number.isFinite(xt)&&xt>0?qn=Math.floor(Vt/xt)*xt:qn=Vt,{ratio:pn(Math.min(qn,Ft)/Ft),globalSec:Math.max(0,qn),vvDur:Ft}},Kt=De=>{if(De){try{De.pause()}catch{}try{De.removeAttribute("src"),De.src="",De.load()}catch{}}};m.useEffect(()=>{mt(!1),ze(!0),ee(null),Le.current="",Ae.current="",et(!1)},[at,K,k]),m.useEffect(()=>{const De=bt=>{const xt=String(bt?.detail?.file??"");!xt||xt!==ae||(Kt(ie.current),Kt(Me.current),Kt(He.current))};return window.addEventListener("player:release",De),window.addEventListener("player:close",De),()=>{window.removeEventListener("player:release",De),window.removeEventListener("player:close",De)}},[ae]),m.useEffect(()=>{const De=Pe.current;if(!De)return;const bt=new IntersectionObserver(xt=>{const Et=!!xt[0]?.isIntersecting;St(Et),Et&&Nt(!0)},{threshold:.01,rootMargin:"0px"});return bt.observe(De),()=>bt.disconnect()},[]),m.useEffect(()=>{const De=Pe.current;if(!De)return;if(!te){Tt(Qe);return}let bt=!0;const xt=new IntersectionObserver(Et=>{Et[0]?.isIntersecting&&(Tt(!0),bt&&(bt=!1,xt.disconnect()))},{threshold:0,rootMargin:V});return xt.observe(De),()=>xt.disconnect()},[te,V,Qe]),m.useEffect(()=>{if(!l||u!=="frames"||!Qe||document.hidden)return;const De=window.setInterval(()=>vt(bt=>bt+1),f);return()=>window.clearInterval(De)},[l,u,Qe,f]);const cn=m.useMemo(()=>{if(!l||u!=="frames"||!Je)return null;const De=Se,bt=Math.max(.25,g??3);if(_){const Ft=Math.max(4,Math.min(S??16,Math.floor(De))),$t=Lt%Ft,Vt=Math.max(.1,De-bt),vn=Math.min(.25,Vt*.02),qn=$t/Ft*Vt+vn;return Math.min(De-.05,Math.max(.05,qn))}const xt=Math.max(De-.1,bt),Et=Lt*bt%xt;return Math.min(De-.05,Math.max(.05,Et))},[l,u,Je,Se,Lt,g,_,S]),dn=K??0,ln=m.useMemo(()=>at?cn==null?`/api/preview?id=${encodeURIComponent(at)}&v=${dn}`:`/api/preview?id=${encodeURIComponent(at)}&t=${cn}&v=${dn}`:"",[at,cn,dn]),qt=m.useMemo(()=>{if(!at)return"";const De=k?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(at)}${De}&v=${dn}`},[at,dn,k]),Rt=$n!=="never"&&Qe&&Ge&&($n==="always"||$n==="hover"&&It),Dt=l&&Qe&&!document.hidden&&Ge&&!Rt&&(h==="always"||It)&&(u==="teaser"&&de&&!!qt||u==="clips"&&Je),Cn=Je&&typeof Se=="number"?Se:void 0,Mt=j||Qe||an||kt&&It,Pn=Ot||Qe||an||kt&&It;m.useEffect(()=>{let De=!1;if(i&&Je){const bt=Number(Se),xt=`${ae}|dur|${bt}`;Le.current!==xt&&(Le.current=xt,i(n,bt),De=!0)}if(a&&tt){const bt=Number(We),xt=Number(_e),Et=`${ae}|res|${bt}x${xt}`;Ae.current!==Et&&(Ae.current=Et,a(n,bt,xt),De=!0)}De&&et(!0)},[ae,n,i,a,Je,tt,Se,We,_e]),m.useEffect(()=>{if(!at||!ae||!l||u!=="teaser"||!Pn||pe||fe.current.has(ae))return;let De=!1;const bt=new AbortController,xt=async Et=>{try{const Ft=await fetch(Et,{signal:bt.signal,cache:"no-store",credentials:"include"});return Ft.ok?await Ft.json():null}catch{return null}};return(async()=>{const Et=await xt(`/api/record/done/meta?file=${encodeURIComponent(ae)}`);De||(fe.current.add(ae),Et&&ee(Et))})(),()=>{De=!0,bt.abort()}},[at,ae,l,u,Pn,pe]);const Dn=De=>{et(!0);const bt=De.currentTarget;if(i&&!Je){const xt=Number(bt.duration);if(Number.isFinite(xt)&&xt>0){const Et=`${ae}|dur|${xt}`;Le.current!==Et&&(Le.current=Et,i(n,xt))}}if(a&&!tt){const xt=Number(bt.videoWidth),Et=Number(bt.videoHeight);if(Number.isFinite(xt)&&Number.isFinite(Et)&&xt>0&&Et>0){const Ft=`${ae}|res|${xt}x${Et}`;Ae.current!==Ft&&(Ae.current=Ft,a(n,xt,Et))}}};if(m.useEffect(()=>{Ut(!0),Ie(!0),gt.current.inline=null,gt.current.teaser=null,gt.current.clips=null},[at,K]),!N)return c.jsx("div",{className:[F,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Mn=Pn,Wt=l&&u==="teaser"&&de&&!!qt&&!Rt&&Pn,Vn=Rt?ie:!Rt&&Dt&&u==="teaser"?Me:!Rt&&Dt&&u==="clips"?He:null,Yn=!!Vn&&Qe,jn=Rt?"inline":Dt&&u==="teaser"?"teaser":"clips",Qn=l&&u==="frames"&&Je&&typeof cn=="number"&&Number.isFinite(cn)&&cn>=0,mn=Qn?pn(cn/Se):0,Ri=!Rt&&he&&typeof ne=="number"&&Number.isFinite(ne),Zn=Ri?pn(ne):Yn?Jt:Qn?mn:0,ni=!Rt&&(Ri||(Yn||Qn)),Si=m.useMemo(()=>{if(!Je)return null;const De=Se;if(!(De>0))return null;let xt=I?.previewClips;if(typeof xt=="string")try{xt=JSON.parse(xt)}catch{xt=null}if(!Array.isArray(xt)||xt.length===0)return null;const Et=xt.map(Ft=>({start:Number(Ft?.startSeconds),dur:Number(Ft?.durationSeconds)})).filter(Ft=>Number.isFinite(Ft.start)&&Ft.start>=0&&Number.isFinite(Ft.dur)&&Ft.dur>0);return Et.length?Et.map(Ft=>{const $t=pn(Ft.start/De),Vt=pn(Ft.dur/De);return{left:$t,width:Vt,start:Ft.start,dur:Ft.dur}}):null},[I,Je,Se]),An=m.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Je)return[];const De=Se,bt=Math.max(.25,C),xt=Math.max(8,Math.min(D??S??12,Math.floor(De))),Et=Math.max(.1,De-bt),Ft=Math.min(.25,Et*.02),$t=[];for(let Vt=0;Vt<xt;Vt++){const vn=Vt/xt*Et+Ft;$t.push(Math.min(De-.05,Math.max(.05,vn)))}return $t},[l,u,Je,Se,S,C,D]),Fn=m.useMemo(()=>An.map(De=>De.toFixed(2)).join(","),[An]),Hn=m.useRef(0),ve=m.useRef(0);m.useEffect(()=>{const De=Me.current;if(!De)return;if(!(Dt&&u==="teaser")){try{De.pause()}catch{}return}ud(De,{muted:O});const xt=De.play?.();xt&&typeof xt.catch=="function"&&xt.catch(()=>{})},[Dt,u,qt,O]),m.useEffect(()=>{if(!Yn){un(0),Xt(0);return}const De=Vn?.current??null;if(!De){un(0),Xt(0);return}let bt=!1,xt=null;const Et=()=>{if(bt||!De.isConnected)return;const Vt=jn==="teaser"&&Array.isArray(me)&&me.length>0,vn=fn(De,Cn,C,Vt);un(vn.ratio),Xt(vn.globalSec)};Et(),xt=window.setInterval(Et,100);const Ft=()=>Et(),$t=()=>Et();return De.addEventListener("loadedmetadata",Ft),De.addEventListener("durationchange",Ft),De.addEventListener("timeupdate",$t),()=>{bt=!0,xt!=null&&window.clearInterval(xt),De.removeEventListener("loadedmetadata",Ft),De.removeEventListener("durationchange",Ft),De.removeEventListener("timeupdate",$t)}},[Yn,Vn,Cn,pt,jn,me,ke]),m.useEffect(()=>{Rt&&ud(ie.current,{muted:O})},[Rt,O]),m.useEffect(()=>{const De=He.current;if(!De)return;if(!(Dt&&u==="clips")){Dt||De.pause();return}if(!An.length)return;Hn.current=Hn.current%An.length,ve.current=An[Hn.current];const bt=()=>{try{De.currentTime=ve.current}catch{}const Ft=De.play();Ft&&typeof Ft.catch=="function"&&Ft.catch(()=>{})},xt=()=>bt(),Et=()=>{if(An.length&&De.currentTime-ve.current>=C){Hn.current=(Hn.current+1)%An.length,ve.current=An[Hn.current];try{De.currentTime=ve.current+.01}catch{}}};return De.addEventListener("loadedmetadata",xt),De.addEventListener("timeupdate",Et),De.readyState>=1&&bt(),()=>{De.removeEventListener("loadedmetadata",xt),De.removeEventListener("timeupdate",Et),De.pause()}},[Dt,u,Fn,C,An]);const rt=(Ot||Qe)&&(i||a)&&!Ze&&!Rt&&(i&&!Je||a&&!tt),ct=!!Si&&(jn==="teaser"||!Rt&&Ri&&u==="teaser"),jt=c.jsxs("div",{ref:Pe,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",F,E??""].join(" "),onMouseEnter:kt?()=>yn(!0):void 0,onMouseLeave:kt?()=>yn(!1):void 0,onFocus:kt?()=>yn(!0):void 0,onBlur:kt?()=>yn(!1):void 0,"data-duration":Je?String(Se):void 0,"data-res":tt?`${We}x${_e}`:void 0,"data-size":typeof Ye=="number"?String(Ye):void 0,"data-fps":typeof wt=="number"?String(wt):void 0,children:[Mt&&ln&&dt?c.jsx("img",{src:ln,loading:j?"eager":"lazy",decoding:"async",alt:ae,className:["absolute inset-0 w-full h-full object-cover",z].filter(Boolean).join(" "),onError:()=>Ut(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Rt?m.createElement("video",{...ot,ref:De=>{ie.current=De,zt("inline",De)},key:`inline-${at}-${q}`,src:N,className:["absolute inset-0 w-full h-full object-cover",z,se?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:O,controls:se,loop:Q,poster:Mn&&ln||void 0,onLoadedMetadata:Dn,onError:()=>Ie(!1)}):null,!Rt&&Wt&&!(Dt&&u==="teaser")?c.jsx("video",{src:qt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>mt(!0),onCanPlay:()=>mt(!0),onError:()=>{ze(!1),mt(!1)}},`teaser-prewarm-${at}`):null,!Rt&&Dt&&u==="teaser"?c.jsx("video",{ref:De=>{Me.current=De,zt("teaser",De)},src:qt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",z,ft?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:O,playsInline:!0,autoPlay:!0,loop:!0,preload:ft?"auto":"metadata",poster:Mn&&ln||void 0,onLoadedData:()=>mt(!0),onPlaying:()=>mt(!0),onError:()=>{ze(!1),mt(!1)}},`teaser-mp4-${at}`):null,!Rt&&Dt&&u==="clips"?c.jsx("video",{ref:De=>{He.current=De,zt("clips",De)},src:N,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",z].filter(Boolean).join(" "),muted:O,playsInline:!0,preload:"metadata",poster:Mn&&ln||void 0,onError:()=>Ie(!1)},`clips-${at}-${Fn}`):null,ni?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:[ct?c.jsx("div",{className:"absolute inset-0",children:Si.map((De,bt)=>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-${bt}-${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(${pn(Zn)})`,background:"rgba(99,102,241,0.95)"}})]}):null,rt?c.jsx("video",{src:N,preload:"metadata",muted:O,playsInline:!0,className:"hidden",onLoadedMetadata:Dn}):null]});return B?c.jsx(Dw,{content:De=>De&&c.jsx("div",{className:"w-[420px]",children:c.jsx("div",{className:"aspect-video",children:c.jsx("video",{src:N,className:["w-full h-full bg-black",z].filter(Boolean).join(" "),muted:re,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:bt=>bt.stopPropagation(),onMouseDown:bt=>bt.stopPropagation()})})}),children:jt}):jt}function Nn(...n){return n.filter(Boolean).join(" ")}const qN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",VN=n=>n.startsWith("HOT ")?n.slice(4):n,GN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function KN(n){const t=VN(qN(n||"")).replace(/\.[^.]+$/,""),i=t.match(GN);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function Ds({job:n,variant:e="overlay",collapseToMenu:t=!1,inlineCount:i,busy:a=!1,compact:l=!1,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onToggleFavorite:_,onToggleLike:S,onToggleHot:C,onKeep:D,onDelete:R,onToggleWatch:E,onAddToDownloads:B,order:G,className:Y}){const q=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",se=l?"size-4":"size-5",Q="h-full w-full",K=e==="table"?`inline-flex items-center justify-center rounded-md ${q} 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 ${q} 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=G??["watch","favorite","like","hot","keep","delete","details"],k=at=>re.includes(at),j=String(n?.sourceUrl??"").trim(),te=KN(n.output||""),V=te?`Mehr zu ${te} anzeigen`:"Mehr anzeigen",ne=k("favorite"),he=k("like"),ae=k("hot"),z=k("watch"),P=k("keep"),Z=k("delete"),ee=k("details")&&!!te,fe=k("add"),[I,pe]=m.useState("idle"),ke=m.useRef(null);m.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current)},[]);const ye=()=>{pe("ok"),ke.current&&window.clearTimeout(ke.current),ke.current=window.setTimeout(()=>pe("idle"),800)},me=async()=>{if(a||I==="busy"||!B&&!!!j)return!1;pe("busy");try{let N=!0;return B?N=await B(n)!==!1:j?(window.dispatchEvent(new CustomEvent("downloads:add-url",{detail:{url:j}})),N=!0):N=!1,N?ye():pe("idle"),N}catch{return pe("idle"),!1}},[pt,We]=m.useState(0),[_e,Ye]=m.useState(4),wt=at=>N=>{N.preventDefault(),N.stopPropagation(),!(a||!at)&&Promise.resolve(at(n)).catch(()=>{})},je=ee?c.jsxs("button",{type:"button",className:Nn(K),title:V,"aria-label":V,disabled:a,onClick:at=>{at.preventDefault(),at.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:te}}))},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(j1,{className:Nn(Q,O.off)})}),c.jsx("span",{className:"sr-only",children:V})]}):null,Se=fe?c.jsxs("button",{type:"button",className:Nn(K),title:j?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||I==="busy"||!B&&!j,onClick:async at=>{at.preventDefault(),at.stopPropagation(),await me()},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:I==="ok"?c.jsx(Nw,{className:Nn(Q,"text-emerald-600 dark:text-emerald-300")}):c.jsx(N1,{className:Nn(Q,O.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Je=ne?c.jsx("button",{type:"button",className:K,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!_,onClick:wt(_),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(_f,{className:Nn("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",Q,O.off)}),c.jsx(vu,{className:Nn("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",Q,O.favOn)})]})}):null,tt=he?c.jsx("button",{type:"button",className:K,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:wt(S),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(ed,{className:Nn("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",Q,O.off)}),c.jsx(bl,{className:Nn("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",Q,O.likeOn)})]})}):null,ot=ae?c.jsx("button",{type:"button","data-hot-target":!0,className:K,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!C,onClick:wt(C),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(M1,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Q,O.off)}),c.jsx(Lg,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Q,O.hotOn)})]})}):null,dt=z?c.jsx("button",{type:"button",className:K,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!E,onClick:wt(E),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(xf,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Q,O.off)}),c.jsx(yl,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Q,O.watchOn)})]})}):null,Ut=P?c.jsx("button",{type:"button",className:K,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!D,onClick:wt(D),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(D1,{className:Nn(Q,O.keep)})})}):null,Ge=Z?c.jsx("button",{type:"button",className:K,title:"Löschen","aria-label":"Löschen",disabled:a||!R,onClick:wt(R),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(R1,{className:Nn(Q,O.del)})})}):null,Ie={details:je,add:Se,favorite:Je,like:tt,watch:dt,hot:ot,keep:Ut,delete:Ge},Ze=t,et=re.filter(at=>!!Ie[at]),ft=Ze&&typeof i!="number",ze=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Le=l?2:3,Ae=m.useMemo(()=>{if(!ft)return i??Le;const at=pt||0;if(at<=0)return Math.min(et.length,Le);for(let N=et.length;N>=0;N--)if(N*ze+ze+(N>0?N*_e:0)<=at)return N;return 0},[ft,i,Le,pt,et.length,ze,_e]),Pe=Ze?et.slice(0,Ae):et,Qe=Ze?et.slice(Ae):[],[St,Ot]=m.useState(!1),Tt=m.useRef(null);m.useLayoutEffect(()=>{const at=Tt.current;if(!at||typeof window>"u")return;const N=()=>{const ie=Tt.current;if(!ie)return;const Me=Math.floor(ie.getBoundingClientRect().width||0);Me>0&&We(Me);const He=window.getComputedStyle(ie),gt=He.columnGap||He.gap||"0",zt=parseFloat(gt);Number.isFinite(zt)&&zt>=0&&Ye(zt)};N();const F=new ResizeObserver(()=>N());return F.observe(at),window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N),F.disconnect()}},[]);const an=m.useRef(null),Nt=m.useRef(null),Lt=208,vt=4,It=8,[yn,$n]=m.useState(null);m.useEffect(()=>{if(!St)return;const at=F=>{F.key==="Escape"&&Ot(!1)},N=F=>{const ie=Tt.current,Me=Nt.current,He=F.target;ie&&ie.contains(He)||Me&&Me.contains(He)||Ot(!1)};return window.addEventListener("keydown",at),window.addEventListener("mousedown",N),()=>{window.removeEventListener("keydown",at),window.removeEventListener("mousedown",N)}},[St]),m.useLayoutEffect(()=>{if(!St){$n(null);return}const at=()=>{const N=an.current;if(!N)return;const F=N.getBoundingClientRect(),ie=window.innerWidth,Me=window.innerHeight;let He=F.right-Lt;He=Math.max(It,Math.min(He,ie-Lt-It));let gt=F.bottom+vt;gt=Math.max(It,Math.min(gt,Me-It));const zt=Math.max(120,Me-gt-It);$n({top:gt,left:He,maxH:zt})};return at(),window.addEventListener("resize",at),window.addEventListener("scroll",at,!0),()=>{window.removeEventListener("resize",at),window.removeEventListener("scroll",at,!0)}},[St]);const kt=()=>{te&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:te}}))},Bn=at=>at==="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:N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),kt()},children:[c.jsx(j1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):at==="add"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!B&&!j,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await me()},children:[c.jsx(N1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):at==="favorite"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!_,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await _?.(n)},children:[h?c.jsx(vu,{className:Nn("size-4",O.favOn)}):c.jsx(_f,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):at==="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 N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await S?.(n)},children:[f?c.jsx(bl,{className:Nn("size-4",O.favOn)}):c.jsx(ed,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):at==="watch"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!E,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await E?.(n)},children:[g?c.jsx(yl,{className:Nn("size-4",O.favOn)}):c.jsx(xf,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):at==="hot"?c.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm hover:bg-gray-100/70 dark:hover:bg-white/5 disabled:opacity-50",disabled:a||!C,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await C?.(n)},children:[u?c.jsx(Lg,{className:Nn("size-4",O.favOn)}):c.jsx(M1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:u?"HOT entfernen":"Als HOT markieren"})]},"hot"):at==="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||!D,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await D?.(n)},children:[c.jsx(D1,{className:Nn("size-4",O.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):at==="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||!R,onClick:async N=>{N.preventDefault(),N.stopPropagation(),Ot(!1),await R?.(n)},children:[c.jsx(R1,{className:Nn("size-4",O.del)}),c.jsx("span",{className:"truncate",children:"Löschen"})]},"delete"):null;return c.jsxs("div",{ref:Tt,className:Nn("relative flex items-center flex-nowrap",Y??"gap-2"),children:[Pe.map(at=>{const N=Ie[at];return N?c.jsx(m.Fragment,{children:N},at):null}),Ze&&Qe.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:an,type:"button",className:K,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":St,disabled:a,onClick:at=>{at.preventDefault(),at.stopPropagation(),!a&&Ot(N=>!N)},children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx($A,{className:Nn(Q,O.off)})})}),St&&yn&&typeof document<"u"?yu.createPortal(c.jsx("div",{ref:Nt,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:yn.top,left:yn.left,width:Lt,maxHeight:yn.maxH},onClick:at=>at.stopPropagation(),children:Qe.map(Bn)}),document.body):null]}):null]})}function ms({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=nn("inline-flex shrink-0 items-center truncate rounded-md px-2 py-0.5 text-xs",l,"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-200"),C=nn(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),D=E=>E.stopPropagation(),R=h?{onPointerDown:D,onMouseDown:D}:{};return a?c.jsx("button",{type:"button",className:C,title:t??f,"aria-pressed":!!i,...R,onClick:E=>{h&&(E.preventDefault(),E.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:C,title:t??f,...R,onClick:h?D:void 0,children:e??n})}function cd({rowKey:n,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:a,maxVisible:l,maxWidthClassName:u,gapPx:h=6,className:f}){const[g,_]=m.useState(!1),S=m.useRef(null),C=m.useRef(null),D=m.useRef(null);m.useEffect(()=>_(!1),[n]),m.useEffect(()=>{if(!g)return;const O=re=>{re.key==="Escape"&&_(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[g]);const R=m.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),E=m.useMemo(()=>[...e].sort((O,re)=>O.localeCompare(re,void 0,{sensitivity:"base"})),[e]),[B,G]=m.useState(()=>{const O=Math.min(E.length,R);return Math.min(O,6)}),Y=m.useCallback(()=>{const O=S.current,re=C.current;if(!O||!re)return;const k=Math.floor(O.getBoundingClientRect().width);if(k<=0)return;const j=Math.min(E.length,R);if(j<=0){G(0);return}const V=Array.from(re.children).map(P=>P.offsetWidth).slice(0,j),ne=D.current?.offsetWidth??0,he=2,ae=P=>{let Z=0,ee=0;for(let fe=0;fe<V.length;fe++){const I=V[fe]+(ee>0?h:0);if(Z+I<=P-he)Z+=I,ee++;else break}return ee};let z=ae(k);if(z<j){const P=ne>0?ne+h:0,Z=Math.max(0,k-P);z=ae(Z),z=Math.max(0,z)}G(Math.max(0,Math.min(z,j)))},[E,R,h]);m.useLayoutEffect(()=>{Y()},[Y,E.join("\0"),u,R]),m.useEffect(()=>{const O=S.current;if(!O)return;const re=new ResizeObserver(()=>Y());return re.observe(O),()=>re.disconnect()},[Y]);const q=Math.min(E.length,R),se=E.slice(0,Math.min(B,q)),Q=O=>O.stopPropagation(),K=E.length-se.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:Q,onMouseDown:Q,onPointerDown:Q,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:se.length>0?se.map(O=>c.jsx(ms,{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:"—"})})}),K>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(),_(!0)},title:"Alle Tags anzeigen","aria-haspopup":"dialog","aria-expanded":!1,children:["+",K]}):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:Q,onMouseDown:Q,onPointerDown:Q,role:"dialog","aria-label":"Tags",children:[c.jsx("button",{type:"button",className:`\r
|
||
absolute right-2 top-2 z-10\r
|
||
rounded-md bg-gray-100/80 px-2 py-1 text-xs font-semibold text-gray-700\r
|
||
hover:bg-gray-200/80\r
|
||
dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20\r
|
||
`,onClick:()=>_(!1),"aria-label":"Schließen",title:"Schließen",children:"✕"}),c.jsx("div",{className:"h-full overflow-auto pr-1",children:c.jsx("div",{className:"flex flex-wrap gap-1.5",children:E.map(O=>c.jsx(ms,{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:C,className:"flex flex-nowrap items-center gap-1.5",children:E.slice(0,q).map(O=>c.jsx(ms,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))}),c.jsx("button",{ref:D,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 I1(n,e,t){return Math.max(e,Math.min(t,n))}function WN(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 by({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]),_=m.useCallback(Q=>{f.current=Q,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(Q=>{if(!u.current||n<1)return;const K=u.current.getBoundingClientRect();if(K.width<=0)return;const O=Q-K.left,re=I1(O/K.width,0,.999999);return I1(Math.floor(re*n),0,n-1)},[n]),C=m.useCallback(Q=>{const K=S(Q.clientX);_(K)},[S,_]),D=m.useCallback(Q=>{const K=S(Q.clientX);_(K)},[S,_]),R=m.useCallback(()=>{_(void 0)},[_]),E=m.useCallback(Q=>{Q.stopPropagation();const K=S(Q.clientX);_(K);try{Q.currentTarget.setPointerCapture?.(Q.pointerId)}catch{}},[S,_]),B=m.useCallback(Q=>{if(Q.stopPropagation(),!i)return;const K=S(Q.clientX);typeof K=="number"&&i(K)},[S,i]);if(!n||n<1)return null;const G=typeof e=="number"?(e+.5)/n*100:void 0,Y=typeof e=="number"?l>0?WN(e*l):`${e+1}/${n}`:"",q=typeof e=="number",se=typeof G=="number"?{left:`clamp(24px, ${G}%, calc(100% - 24px))`,transform:"translateX(-50%)"}:void 0;return c.jsxs("div",{ref:u,className:["relative h-7 w-full select-none touch-none cursor-col-resize","opacity-0 transition-opacity duration-150","pointer-events-none","group-hover:opacity-100 group-focus-within:opacity-100","group-hover:pointer-events-auto group-focus-within:pointer-events-auto",a].filter(Boolean).join(" "),onPointerMove:C,onPointerEnter:D,onPointerLeave:R,onPointerDown:E,onMouseDown:Q=>Q.stopPropagation(),onClick:B,title:q?Y:`Preview scrubber (${n})`,role:"slider","aria-label":"Preview scrubber","aria-valuemin":1,"aria-valuemax":n,"aria-valuenow":typeof e=="number"?e+1:void 0,children:[c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-4 bg-white/35 ring-1 ring-white/40 backdrop-blur-[1px]",children:typeof G=="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:`${G}%`,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",q?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:se,children:Y})]})}const Mw=/^HOT[ \u00A0]+/i,jw=n=>String(n||"").replaceAll(" "," "),ou=n=>Mw.test(jw(n)),$r=n=>jw(n).replace(Mw,"");function dd(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 XN=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 YN(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function Nm(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function B1(n,e,t){return Math.max(e,Math.min(t,n))}const QN=5;function ZN(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function JN({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 e3({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 t3({rows:n,isSmall:e,isLoading:t,teaserPlayback:i,teaserAudio:a,hoverTeaserKey:l,blurPreviews:u,durations:h,teaserKey:f,inlinePlay:g,deletingKeys:_,keepingKeys:S,removingKeys:C,swipeRefs:D,assetNonce:R,handleScrubberClickIndex:E,keyFor:B,baseName:G,modelNameFromOutput:Y,runtimeOf:q,sizeBytesOf:se,formatBytes:Q,lower:K,onHoverPreviewKeyChange:O,onOpenPlayer:re,openPlayer:k,startInlineAt:j,startInline:te,tryAutoplayInline:V,registerTeaserHost:ne,handleDuration:he,deleteVideo:ae,keepVideo:z,modelsByKey:P,activeTagSet:Z,onToggleTagFilter:ee,onToggleHot:fe,onToggleFavorite:I,onToggleLike:pe,onToggleWatch:ke,enqueueDeleteVideo:ye,enqueueKeepVideo:me,enqueueToggleHot:pt}){const We=m.useCallback(Le=>{const Ae=Le?.meta;if(!Ae)return null;if(typeof Ae=="string")try{return JSON.parse(Ae)}catch{return null}return Ae},[]),_e=m.useCallback(Le=>{const Ae=We(Le),Pe=(typeof Ae?.videoWidth=="number"&&Number.isFinite(Ae.videoWidth)?Ae.videoWidth:0)||(typeof Le.videoWidth=="number"&&Number.isFinite(Le.videoWidth)?Le.videoWidth:0),Qe=(typeof Ae?.videoHeight=="number"&&Number.isFinite(Ae.videoHeight)?Ae.videoHeight:0)||(typeof Le.videoHeight=="number"&&Number.isFinite(Le.videoHeight)?Le.videoHeight:0);return Pe>0&&Qe>0?{w:Pe,h:Qe}:null},[We]),Ye=m.useCallback(Le=>{const Ae=We(Le);let Pe=Ae?.previewSprite??Ae?.preview?.sprite??Ae?.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),St=Number(Pe?.stepSeconds??Pe?.step??Pe?.intervalSeconds);if(Number.isFinite(Qe)&&Qe>=2)return{count:Math.max(2,Math.floor(Qe)),stepSeconds:Number.isFinite(St)&&St>0?St:5};const Ot=B(Le),Tt=h[Ot]??(typeof Le?.durationSeconds=="number"?Le.durationSeconds:void 0);return typeof Tt=="number"&&Number.isFinite(Tt)&&Tt>1?{count:Math.max(2,Math.min(240,Math.floor(Tt/5)+1)),stepSeconds:5}:null},[We,B,h]),[wt,je]=m.useState({}),[Se,Je]=m.useState({}),[tt,ot]=m.useState(null),dt=m.useCallback((Le,Ae)=>{je(Pe=>{if(Ae===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ae?Pe:{...Pe,[Le]:Ae}})},[]),Ut=m.useCallback(Le=>{dt(Le,void 0)},[dt]),Ge=m.useCallback((Le,Ae)=>{Je(Pe=>{if(Ae===void 0){if(!(Le in Pe))return Pe;const Qe={...Pe};return delete Qe[Le],Qe}return Pe[Le]===Ae?Pe:{...Pe,[Le]:Ae}})},[]),Ie=(Le,Ae)=>{const Pe=B(Le),Qe=g?.key===Pe,St=Ae?.disableInline?!1:Qe,Tt=!(!Ae?.forceStill&&!!a&&(St||l===Pe)),an=St?g?.nonce??0:0,Nt=!!Ae?.forceLoadStill,Lt=Ae?.forceStill?!1:Ae?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Pe:!1,vt=_.has(Pe)||S.has(Pe)||C.has(Pe),It=Y(Le.output),yn=G(Le.output||""),$n=$r(yn.replace(/\.[^.]+$/,"")).trim(),kt=K(It),Bn=P[kt],at=We(Le),N=Ye(Le),F=wt[Pe],ie=Se[Pe]===!0,Me=YN(at?.previewSprite?.path,at?.previewSpritePath,Bn?.previewScrubberPath,$n?`/api/preview-sprite/${encodeURIComponent($n)}`:void 0),He=Me?Me.replace(/\/+$/,""):void 0,gt=at?.previewSprite?.stepSeconds??at?.previewSpriteStepSeconds,zt=typeof gt=="number"&&Number.isFinite(gt)&>>0?gt:N?.stepSeconds&&N.stepSeconds>0?N.stepSeconds:QN,Jt=Nm(at?.durationSeconds)??Nm(Le?.durationSeconds)??Nm(h[Pe]),un=typeof Jt=="number"&&Jt>0?Math.max(1,Math.min(200,Math.floor(Jt/zt)+1)):void 0,Xt=at?.previewSprite?.count??at?.previewSpriteCount??Bn?.previewScrubberCount??un,pn=at?.previewSprite?.cols??at?.previewSpriteCols,fn=at?.previewSprite?.rows??at?.previewSpriteRows,Kt=typeof Xt=="number"&&Number.isFinite(Xt)?Math.max(0,Math.floor(Xt)):0,[cn,dn]=Kt>1?ZN(Kt):[0,0],ln=Number(pn),qt=Number(fn),Rt=Number.isFinite(ln)&&Number.isFinite(qt)&&ln>0&&qt>0&&!(Kt>1&&ln===1&&qt===1)&&(Kt<=1||ln*qt>=Kt),Dt=Rt?Math.floor(ln):cn,Cn=Rt?Math.floor(qt):dn,Mt=(typeof at?.updatedAtUnix=="number"&&Number.isFinite(at.updatedAtUnix)?at.updatedAtUnix:void 0)??(typeof at?.fileModUnix=="number"&&Number.isFinite(at.fileModUnix)?at.fileModUnix:void 0)??R??0,Pn=He&&Mt?`${He}?v=${encodeURIComponent(String(Mt))}`:He||void 0,Dn=!!Pn&&Kt>1,Mn=Dn&&Dt>0&&Cn>0,Wt=Dn?Kt:0,Vn=Dn?zt:0,Yn=typeof F=="number"&&Wt>1?B1(F/(Wt-1),0,1):void 0,jn=Mn&&typeof F=="number"?(()=>{const ct=B1(F,0,Math.max(0,Kt-1)),jt=ct%Dt,De=Math.floor(ct/Dt),bt=Dt<=1?0:jt/(Dt-1)*100,xt=Cn<=1?0:De/(Cn-1)*100;return{backgroundImage:`url("${Pn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Dt*100}% ${Cn*100}%`,backgroundPosition:`${bt}% ${xt}%`}})():void 0,Qn=ou(yn),mn=!!Bn?.favorite,Ri=Bn?.liked===!0,Zn=!!Bn?.watching,Kn=XN(Bn?.tags),ni=q(Le),Si=Q(se(Le)),An=_e(Le),Fn=dd(An),Hn=`inline-prev-${encodeURIComponent(Pe)}`,ve=["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",vt&&"pointer-events-none opacity-70",_.has(Pe)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",S.has(Pe)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",C.has(Pe)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),rt=c.jsx("div",{role:"button",tabIndex:0,className:ve,onClick:e?void 0:()=>k(Le),onKeyDown:ct=>{(ct.key==="Enter"||ct.key===" ")&&(ct.preventDefault(),re(Le))},children:c.jsx(JN,{blurred:Ae?.blur,animateUnblurOnMount:Ae?.animateUnblurOnMount,children:c.jsxs(Ns,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:Hn,ref:Ae?.disableInline||Ae?.isDecorative?void 0:ne(Pe),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||Ae?.disablePreviewHover?void 0:()=>{ot(Pe),O?.(Pe)},onMouseLeave:()=>{!e&&!Ae?.disablePreviewHover&&O?.(null),ot(ct=>ct===Pe?null:ct),Ut(Pe),Ge(Pe,!1)},onClick:ct=>{ct.preventDefault(),ct.stopPropagation(),!(e||Ae?.disableInline)&&te(Pe)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[St?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 "+(St?"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:[ni,An?`${An.w}×${An.h}`:Fn||"",Si].filter(Boolean).join(" • "),children:[c.jsx("span",{children:ni}),Fn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,Fn?c.jsx("span",{children:Fn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Si})]})}),c.jsx(xu,{job:Le,getFileName:ct=>$r(G(ct)),className:"h-full w-full",variant:"fill",durationSeconds:h[Pe]??Le?.durationSeconds,onDuration:he,showPopover:!1,blur:St?!1:!!u,animated:Lt,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!Ae?.disableInline&&St?"always":!1,inlineNonce:an,inlineControls:St,inlineLoop:!1,muted:Tt,popoverMuted:Tt,assetNonce:R??0,alwaysLoadStill:Nt,teaserPreloadEnabled:Ae?.mobileStackTopOnlyVideo||Ae?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:Ae?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:Yn,preferScrubProgress:ie&&typeof F=="number"}),Mn&&Pn?c.jsx("img",{src:Pn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Mn&&jn&&!St?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,!Ae?.isDecorative&&!Ae?.disableScrubber&&!St&&Wt>1&&tt===Pe?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.stopPropagation(),onMouseEnter:()=>Ge(Pe,!0),onMouseLeave:()=>{Ge(Pe,!1),dt(Pe,void 0)},children:c.jsx(by,{className:"pointer-events-auto px-1",imageCount:Wt,activeIndex:F,onActiveIndexChange:ct=>dt(Pe,ct),onIndexClick:ct=>{if(e||Ae?.disableInline){E(Le,ct,Wt);return}const jt=Vn>0?ct*Vn:0;if(j){j(Pe,jt,Hn),requestAnimationFrame(()=>{V(Hn)||requestAnimationFrame(()=>V(Hn))});return}te(Pe),requestAnimationFrame(()=>{V(Hn)||requestAnimationFrame(()=>V(Hn))})},stepSeconds:Vn})}):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:It}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[Qn?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:$r(yn)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[Zn?c.jsx(yl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,Ri?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,mn?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:Le,variant:"table",busy:vt,collapseToMenu:!0,compact:!1,isHot:Qn,isFavorite:mn,isLiked:Ri,isWatching:Zn,onToggleWatch:ke,onToggleFavorite:I,onToggleLike:pe,onToggleHot:fe,onKeep:z,onDelete:ae,order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:ct=>ct.stopPropagation(),onMouseDown:ct=>ct.stopPropagation(),children:c.jsx(cd,{rowKey:Pe,tags:Kn,activeTagSet:Z,lower:K,onToggleTagFilter:ee})})]})]})})});return{k:Pe,j:Le,busy:vt,isHot:Qn,inlineDomId:Hn,cardInner:rt}},Ze=3,et=e?n.slice(0,Ze):[],mt=e?n.slice(Ze,Ze+4):[],de=15,ze=Math.min(et.length,Ze)-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:ze>0?`${ze}px`:void 0},children:(()=>{const Le=et,Ae=Le[0],Pe=Le.slice(1);return c.jsxs(c.Fragment,{children:[Pe.map((Qe,St)=>{const Ot=St+1,{k:Tt,cardInner:an}=Ie(Qe,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),Nt=Ot,Lt=-(Nt*de),vt=1-Nt*.03,It=1-Nt*.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-Nt,transform:`translateY(${Lt}px) scale(${vt}) translateZ(0)`,opacity:It,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[an,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},Tt)}).reverse(),Ae?(()=>{const Qe=Ae,{k:St,busy:Ot,isHot:Tt,cardInner:an,inlineDomId:Nt}=Ie(Qe,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(e3,{animateOnMount:!0,children:c.jsx($N,{ref:Lt=>{Lt?D.current.set(St,Lt):D.current.delete(St)},enabled:!0,disabled:Ot,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!Tt){if(pt){pt(Qe);return}await fe?.(Qe)}},onTap:()=>{te(St),requestAnimationFrame(()=>{V(Nt)||requestAnimationFrame(()=>V(Nt))})},onSwipeLeft:()=>ye?ye(Qe):ae(Qe),onSwipeRight:()=>me?me(Qe):z(Qe),children:an})})},St)})():null]})})()}),mt.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:mt.map(Le=>{const Ae=B(Le);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(xu,{job:Le,getFileName:G,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:R??0,alwaysLoadStill:!0})},`preload-still-${Ae}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Le=>{const{k:Ae,cardInner:Pe}=Ie(Le);return c.jsx(m.Fragment,{children:Pe},Ae)})}),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 n3({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 i3=m.forwardRef(n3);function r3({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 s3=m.forwardRef(r3);function a3({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 o3=m.forwardRef(a3);function l3({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 P1=m.forwardRef(l3);function Fr(...n){return n.filter(Boolean).join(" ")}function F1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function u3(n){return n==="center"?"justify-center":n==="right"?"justify-end":"justify-start"}function U1(n,e){const t=n===0,i=n===e-1;return t||i?"pl-2 pr-2":"px-2"}function z1(n){return n==null?{isNull:!0,kind:"string",value:""}:n instanceof Date?{isNull:!1,kind:"number",value:n.getTime()}:typeof n=="number"?{isNull:!1,kind:"number",value:n}:typeof n=="boolean"?{isNull:!1,kind:"number",value:n?1:0}:typeof n=="bigint"?{isNull:!1,kind:"number",value:Number(n)}:{isNull:!1,kind:"string",value:String(n).toLocaleLowerCase()}}function td({columns:n,rows:e,getRowKey:t,title:i,description:a,actions:l,fullWidth:u=!1,card:h=!0,striped:f=!1,stickyHeader:g=!1,compact:_=!1,isLoading:S=!1,emptyLabel:C="Keine Daten vorhanden.",className:D,rowClassName:R,onRowClick:E,onRowContextMenu:B,sort:G,onSortChange:Y,defaultSort:q=null}){const se=_?"py-2":"py-4",Q=_?"py-3":"py-3.5",K=G!==void 0,[O,re]=m.useState(q),k=K?G:O,j=m.useCallback(V=>{K||re(V),Y?.(V)},[K,Y]),te=m.useMemo(()=>{if(!k)return e;const V=n.find(ae=>ae.key===k.key);if(!V)return e;const ne=k.direction==="asc"?1:-1,he=e.map((ae,z)=>({r:ae,i:z}));return he.sort((ae,z)=>{let P=0;if(V.sortFn)P=V.sortFn(ae.r,z.r);else{const Z=V.sortValue?V.sortValue(ae.r):ae.r?.[V.key],ee=V.sortValue?V.sortValue(z.r):z.r?.[V.key],fe=z1(Z),I=z1(ee);fe.isNull&&!I.isNull?P=1:!fe.isNull&&I.isNull?P=-1:fe.kind==="number"&&I.kind==="number"?P=fe.value<I.value?-1:fe.value>I.value?1:0:P=String(fe.value).localeCompare(String(I.value),void 0,{numeric:!0})}return P===0?ae.i-z.i:P*ne}),he.map(ae=>ae.r)},[e,n,k]);return c.jsxs("div",{className:Fr(u?"":"px-4 sm:px-6 lg:px-8",D),children:[(i||a||l)&&c.jsxs("div",{className:"sm:flex sm:items-center",children:[c.jsxs("div",{className:"sm:flex-auto",children:[i&&c.jsx("h1",{className:"text-base font-semibold text-gray-900 dark:text-white",children:i}),a&&c.jsx("p",{className:"mt-2 text-sm text-gray-700 dark:text-gray-300",children:a})]}),l&&c.jsx("div",{className:"mt-4 sm:mt-0 sm:ml-16 sm:flex-none",children:l})]}),c.jsx("div",{className:Fr(i||a||l?"mt-8":""),children:c.jsx("div",{className:"flow-root",children:c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:Fr("inline-block min-w-full align-middle",u?"":"sm:px-6 lg:px-8"),children:c.jsx("div",{className:Fr(h&&"overflow-hidden shadow-sm outline-1 outline-black/5 rounded-lg dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"),children:c.jsxs("table",{className:"relative min-w-full divide-y divide-gray-200 dark:divide-white/10",children:[c.jsx("thead",{className:Fr(h&&"bg-gray-50/90 dark:bg-gray-800/70",g&&"sticky top-0 z-10 backdrop-blur-sm shadow-sm"),children:c.jsx("tr",{children:n.map((V,ne)=>{const he=U1(ne,n.length),ae=!!k&&k.key===V.key,z=ae?k.direction:void 0,P=V.sortable&&!V.srOnlyHeader?ae?z==="asc"?"ascending":"descending":"none":void 0,Z=()=>{if(!(!V.sortable||V.srOnlyHeader))return j(ae?z==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":P,className:Fr(Q,he,"text-xs font-semibold tracking-wide text-gray-700 dark:text-gray-200 whitespace-nowrap",F1(V.align),V.widthClassName,V.headerClassName),children:V.srOnlyHeader?c.jsx("span",{className:"sr-only",children:V.header}):V.sortable?c.jsxs("button",{type:"button",onClick:Z,className:Fr("group inline-flex w-full items-center gap-2 select-none rounded-md px-1.5 py-1 -my-1 hover:bg-gray-100/70 dark:hover:bg-white/5",u3(V.align)),children:[c.jsx("span",{children:V.header}),c.jsx("span",{className:Fr("flex-none rounded-sm text-gray-400 dark:text-gray-500",ae?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(i3,{"aria-hidden":"true",className:Fr("size-5 transition-transform",ae&&z==="asc"&&"rotate-180")})})]}):V.header},V.key)})})}),c.jsx("tbody",{className:Fr("divide-y divide-gray-200 dark:divide-white/10",h?"bg-white dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),children:S?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):te.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Fr(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:C})}):te.map((V,ne)=>{const he=t?t(V,ne):String(ne);return c.jsx("tr",{className:Fr(f&&"even:bg-gray-50 dark:even:bg-gray-800/50",E&&"cursor-pointer",E&&"hover:bg-gray-50 dark:hover:bg-white/5 transition-colors",R?.(V,ne)),onClick:()=>E?.(V),onContextMenu:B?ae=>{ae.preventDefault(),B(V,ae)}:void 0,children:n.map((ae,z)=>{const P=U1(z,n.length),Z=ae.cell?.(V,ne)??ae.accessor?.(V)??V?.[ae.key];return c.jsx("td",{className:Fr(se,P,"text-sm whitespace-nowrap",F1(ae.align),ae.className,ae.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:Z},ae.key)})},he)})})]})})})})})})]})}function c3({rows:n,isLoading:e,keyFor:t,baseName:i,lower:a,modelNameFromOutput:l,runtimeOf:u,sizeBytesOf:h,formatBytes:f,resolutions:g,durations:_,canHover:S,teaserAudio:C,hoverTeaserKey:D,setHoverTeaserKey:R,teaserPlayback:E="hover",teaserKey:B,registerTeaserHost:G,handleDuration:Y,handleResolution:q,blurPreviews:se,assetNonce:Q,deletingKeys:K,keepingKeys:O,removingKeys:re,modelsByKey:k,activeTagSet:j,onToggleTagFilter:te,onOpenPlayer:V,onSortModeChange:ne,page:he,onPageChange:ae,onToggleHot:z,onToggleFavorite:P,onToggleLike:Z,onToggleWatch:ee,deleteVideo:fe,keepVideo:I,enqueueDeleteVideo:pe,enqueueKeepVideo:ke,enqueueToggleHot:ye}){const[me,pt]=m.useState(null),We=m.useCallback(Ge=>{const Ie=Ge?.durationSeconds;if(typeof Ie=="number"&&Number.isFinite(Ie)&&Ie>0)return Ie;const Ze=Date.parse(String(Ge?.startedAt||"")),et=Date.parse(String(Ge?.endedAt||""));if(Number.isFinite(Ze)&&Number.isFinite(et)&&et>Ze){const ft=(et-Ze)/1e3;if(ft>=1&&ft<=1440*60)return ft}return Number.POSITIVE_INFINITY},[]),_e=m.useCallback(Ge=>{const Ie=String(Ge??"").trim();if(!Ie)return[];const Ze=Ie.split(/[\n,;|]+/g).map(mt=>mt.trim()).filter(Boolean),et=new Set,ft=[];for(const mt of Ze){const de=mt.toLowerCase();et.has(de)||(et.add(de),ft.push(mt))}return ft.sort((mt,de)=>mt.localeCompare(de,void 0,{sensitivity:"base"})),ft},[]),Ye=m.useCallback(Ge=>{const Ie=Ge?.meta;if(!Ie)return null;if(typeof Ie=="string")try{return JSON.parse(Ie)}catch{return null}return Ie},[]),wt=m.useCallback(Ge=>{const Ie=Ye(Ge);let Ze=Ie?.previewSprite??Ie?.preview?.sprite??null;if(typeof Ze=="string")try{Ze=JSON.parse(Ze)}catch{Ze=null}const et=Number(Ze?.count),ft=Number(Ze?.stepSeconds);return!Number.isFinite(et)||et<2?null:{count:Math.max(2,Math.floor(et)),stepSeconds:Number.isFinite(ft)&&ft>0?ft:5}},[Ye]),[je,Se]=m.useState({}),Je=m.useCallback((Ge,Ie)=>{Se(Ze=>Ze[Ge]===Ie?Ze:{...Ze,[Ge]:Ie})},[]),tt=m.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Ge=>{const Ie=t(Ge),et=!(!!C&&D===Ie),ft=wt(Ge),mt=je[Ie],de=i(Ge.output||""),ze=$r(de.replace(/\.[^.]+$/,"")).trim(),Le=ft&&typeof mt=="number"?Math.max(0,mt*ft.stepSeconds):void 0,Ae=ze&&typeof Le=="number"?`/api/preview?id=${encodeURIComponent(ze)}&t=${Le.toFixed(3)}&v=${Q??0}`:"";return c.jsxs("div",{ref:G(Ie),className:"group relative py-1",onClick:Pe=>Pe.stopPropagation(),onMouseDown:Pe=>Pe.stopPropagation(),onMouseEnter:()=>{S&&R(Ie)},onMouseLeave:()=>{S&&R(null),Je(Ie,void 0)},children:[c.jsx(xu,{job:Ge,getFileName:i,durationSeconds:_[Ie],muted:et,popoverMuted:et,onDuration:Y,onResolution:q,className:"w-28 h-16 rounded-md ring-1 ring-black/5 dark:ring-white/10",showPopover:!1,blur:se,animated:E==="all"?!0:E==="hover"?B===Ie:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:Q}),ft&&typeof mt=="number"&&Ae?c.jsx("img",{src:Ae,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:Ge=>{const Ie=i(Ge.output||""),Ze=ou(Ie),et=l(Ge.output),ft=$r(Ie);return`${et} ${Ze?"HOT":""} ${ft}`.trim()},cell:Ge=>{const Ie=i(Ge.output||""),Ze=ou(Ie),et=$r(Ie),ft=l(Ge.output),mt=a(l(Ge.output)),de=_e(k[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:ft}),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 ze=t(Ge),Le=g[ze]??null,Ae=dd(Le);return Ae?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:Ae}):null})(),Ze?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]}),de.length>0?c.jsx("div",{className:"mt-1",onClick:ze=>ze.stopPropagation(),onMouseDown:ze=>ze.stopPropagation(),children:c.jsx(cd,{rowKey:t(Ge),tags:de,activeTagSet:j,lower:a,onToggleTagFilter:te,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Ge=>{const Ie=Date.parse(String(Ge.endedAt||""));return Number.isFinite(Ie)?Ie:Number.NEGATIVE_INFINITY},cell:Ge=>{const Ie=Date.parse(String(Ge.endedAt||""));if(!Number.isFinite(Ie))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const Ze=new Date(Ie),et=Ze.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),ft=Ze.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:Ze.toISOString(),title:`${et} ${ft}`,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:ft})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Ge=>We(Ge),cell:Ge=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(Ge)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Ge=>{const Ie=h(Ge);return typeof Ie=="number"?Ie:Number.NEGATIVE_INFINITY},cell:Ge=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(Ge))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Ge=>{const Ie=t(Ge),Ze=K.has(Ie)||O.has(Ie)||re.has(Ie),et=i(Ge.output||""),ft=ou(et),mt=a(l(Ge.output)),de=k[mt],ze=!!de?.favorite,Le=de?.liked===!0,Ae=!!de?.watching;return c.jsx(Ds,{job:Ge,variant:"table",busy:Ze,isHot:ft,isFavorite:ze,isLiked:Le,isWatching:Ae,onToggleWatch:ee,onToggleFavorite:P,onToggleLike:Z,onToggleHot:z?async Pe=>{if(!(ye&&ye(Pe)))return z(Pe)}:void 0,onKeep:async Pe=>ke&&ke(Pe)?!0:I(Pe),onDelete:async Pe=>pe&&pe(Pe)?!0:fe(Pe),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,_,C,D,G,S,R,Y,q,se,E,B,Q,a,l,k,j,te,g,K,O,re,wt,je,Je,ee,P,Z,z,I,fe,h,f,u,_e,We]),ot=m.useCallback(Ge=>{if(!Ge)return"completed_desc";const Ie=Ge,Ze=String(Ie.key??Ie.columnKey??Ie.id??""),et=String(Ie.dir??Ie.direction??Ie.order??"").toLowerCase(),ft=et==="asc"||et==="1"||et==="true";return Ze==="completedAt"?ft?"completed_asc":"completed_desc":Ze==="runtime"?ft?"duration_asc":"duration_desc":Ze==="size"?ft?"size_asc":"size_desc":Ze==="Model"||Ze==="video"?ft?"file_asc":"file_desc":ft?"completed_asc":"completed_desc"},[]),dt=m.useCallback(Ge=>{pt(Ge),ne(ot(Ge)),he!==1&&ae(1)},[ne,ot,he,ae]),Ut=m.useCallback(Ge=>{const Ie=t(Ge);return["transition-all duration-300",(K.has(Ie)||re.has(Ie))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",K.has(Ie)&&"animate-pulse",(O.has(Ie)||re.has(Ie))&&"pointer-events-none",O.has(Ie)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",re.has(Ie)&&"opacity-0"].filter(Boolean).join(" ")},[t,K,O,re]);return c.jsxs("div",{className:"relative",children:[c.jsx(td,{rows:n,columns:tt,getRowKey:Ge=>t(Ge),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:me,onSortChange:dt,onRowClick:V,rowClassName:Ut}),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 $1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function d3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function Dm(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function H1(n,e,t){return Math.max(e,Math.min(t,n))}const h3=5;function f3(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function p3({rows:n,isLoading:e,blurPreviews:t,durations:i,teaserPlayback:a,teaserAudio:l,hoverTeaserKey:u,teaserKey:h,handleDuration:f,handleScrubberClickIndex:g,keyFor:_,baseName:S,modelNameFromOutput:C,runtimeOf:D,sizeBytesOf:R,formatBytes:E,deletingKeys:B,keepingKeys:G,removingKeys:Y,deletedKeys:q,registerTeaserHost:se,onHoverPreviewKeyChange:Q,onOpenPlayer:K,deleteVideo:O,keepVideo:re,onToggleHot:k,lower:j,modelsByKey:te,activeTagSet:V,onToggleTagFilter:ne,onToggleFavorite:he,onToggleLike:ae,onToggleWatch:z,enqueueDeleteVideo:P,enqueueKeepVideo:Z,enqueueToggleHot:ee}){const fe=a==="hover"||a==="all",I=m.useCallback(Se=>Je=>{if(!fe){se(Se)(null);return}se(Se)(Je)},[se,fe]),pe=Se=>{const Je=String(Se??"").trim();if(!Je)return[];const tt=Je.split(/[\n,;|]+/g).map(Ut=>Ut.trim()).filter(Boolean),ot=new Set,dt=[];for(const Ut of tt){const Ge=Ut.toLowerCase();ot.has(Ge)||(ot.add(Ge),dt.push(Ut))}return dt},ke=m.useCallback(Se=>{const Je=(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),tt=(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 Je>0&&tt>0?{w:Je,h:tt}:null},[]),[ye,me]=m.useState(null),[pt,We]=m.useState({}),[_e,Ye]=m.useState(null),wt=m.useCallback((Se,Je)=>{We(tt=>{if(Je===void 0){if(!(Se in tt))return tt;const ot={...tt};return delete ot[Se],ot}return tt[Se]===Je?tt:{...tt,[Se]:Je}})},[]),je=m.useCallback(Se=>{wt(Se,void 0)},[wt]);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 Je=_(Se),ot=!(!!l&&u===Je),dt=C(Se.output),Ut=j(dt),Ge=te[Ut],Ie=!!Ge?.favorite,Ze=Ge?.liked===!0,et=!!Ge?.watching,ft=pe(Ge?.tags),mt=S(Se.output||""),de=ou(mt),ze=$r(mt),Le=D(Se),Ae=E(R(Se)),Pe=ke(Se),Qe=dd(Pe),St=B.has(Je)||G.has(Je)||Y.has(Je),Ot=q.has(Je),Tt=$1(Ge?.image,Ge?.imageUrl,Se?.meta?.modelImage,Se?.meta?.modelImageUrl),Nt=$r(S(Se.output||"")).replace(/\.[^.]+$/,"").trim(),Lt=d3(Se?.meta),vt=$1(Lt?.previewSprite?.path,Lt?.previewSpritePath,Ge?.previewScrubberPath,Nt?`/api/preview-sprite/${encodeURIComponent(Nt)}`:void 0),It=vt?vt.replace(/\/+$/,""):void 0,yn=Lt?.previewSprite?.stepSeconds??Lt?.previewSpriteStepSeconds,$n=typeof yn=="number"&&Number.isFinite(yn)&&yn>0?yn:h3,kt=Dm(Lt?.durationSeconds)??Dm(Se?.durationSeconds)??Dm(i[Je]),Bn=typeof kt=="number"&&kt>0?Math.max(1,Math.min(200,Math.floor(kt/$n)+1)):void 0,at=Lt?.previewSprite?.count??Lt?.previewSpriteCount??Ge?.previewScrubberCount??Bn,N=Lt?.previewSprite?.cols??Lt?.previewSpriteCols,F=Lt?.previewSprite?.rows??Lt?.previewSpriteRows,ie=typeof at=="number"&&Number.isFinite(at)?Math.max(0,Math.floor(at)):0,[Me,He]=ie>1?f3(ie):[0,0],gt=typeof N=="number"&&Number.isFinite(N)?Math.max(0,Math.floor(N)):Me,zt=typeof F=="number"&&Number.isFinite(F)?Math.max(0,Math.floor(F)):He,Jt=(typeof Lt?.updatedAtUnix=="number"&&Number.isFinite(Lt.updatedAtUnix)?Lt.updatedAtUnix:void 0)??(typeof Lt?.fileModUnix=="number"&&Number.isFinite(Lt.fileModUnix)?Lt.fileModUnix:void 0)??0,un=It&&Jt?`${It}?v=${encodeURIComponent(String(Jt))}`:It||void 0,Xt=!!un&&ie>1,pn=Xt&>>0&&zt>0,fn=Xt?ie:0,Kt=Xt?$n:0,cn=Xt,dn=pt[Je],ln=typeof dn=="number"&&fn>1?H1(dn/(fn-1),0,1):void 0,qt=pn&&typeof dn=="number"?(()=>{const Mt=H1(dn,0,Math.max(0,ie-1)),Pn=Mt%gt,Dn=Math.floor(Mt/gt),Mn=gt<=1?0:Pn/(gt-1)*100,Wt=zt<=1?0:Dn/(zt-1)*100;return{backgroundImage:`url("${un}")`,backgroundRepeat:"no-repeat",backgroundSize:`${gt*100}% ${zt*100}%`,backgroundPosition:`${Mn}% ${Wt}%`}})():void 0,Rt=ye===Je&&!!Tt,Dt=!Rt&&!!qt,Cn=Rt||Dt;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",St&&"pointer-events-none opacity-70",B.has(Je)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",Y.has(Je)&&"opacity-0 translate-y-2 scale-[0.98]",Ot&&"hidden"].filter(Boolean).join(" "),onClick:()=>K(Se),onKeyDown:Mt=>{(Mt.key==="Enter"||Mt.key===" ")&&K(Se)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:I(Je),onMouseEnter:()=>{Ye(Je),Q?.(Je)},onMouseLeave:()=>{Ye(Mt=>Mt===Je?null:Mt),Q?.(null),je(Je),me(Mt=>Mt===Je?null:Mt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:Se,getFileName:Mt=>$r(S(Mt)),durationSeconds:i[Je]??Se?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Cn?!1:a==="all"?!0:a==="hover"?h===Je:!1,animatedMode:"teaser",animatedTrigger:"always",muted:ot,popoverMuted:ot,scrubProgressRatio:ln,preferScrubProgress:typeof dn=="number"})}),pn&&un?c.jsx("img",{src:un,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Dt&&qt?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:qt})}):null,Rt&&Tt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:Tt,alt:dt?`${dt} 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,cn&&_e===Je?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation(),children:c.jsx(by,{className:"pointer-events-auto px-1",imageCount:fn,activeIndex:dn,onActiveIndexChange:Mt=>wt(Je,Mt),onIndexClick:Mt=>{wt(Je,Mt),g(Se,Mt,fn)},stepSeconds:Kt})}):null,c.jsx("div",{className:"pointer-events-none absolute right-2 bottom-2 z-10 transition-opacity duration-150 group-hover/thumb:opacity-0 group-focus-within/thumb:opacity-0",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||"",Ae].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:Ae})]})})]})}),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:[de?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:$r(ze)||"—",children:$r(ze)||"—"})]})}),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",Tt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:Tt?`${dt} (Hover: Model-Preview)`:dt,onMouseEnter:Mt=>{Mt.stopPropagation(),Tt&&me(Je)},onMouseLeave:Mt=>{Mt.stopPropagation(),me(Pn=>Pn===Je?null:Pn)},onMouseDown:Mt=>Mt.stopPropagation(),onClick:Mt=>Mt.stopPropagation(),children:dt||"—"})}),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,Ze?c.jsx(bl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Ie?c.jsx(vu,{className:"size-4 text-amber-600 dark:text-amber-300"}):null]})]}),c.jsx("div",{className:"mt-2",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation(),children:c.jsx("div",{className:"w-full",children:c.jsx("div",{className:"w-full rounded-md bg-gray-50/70 p-1 ring-1 ring-black/5 dark:bg-white/5 dark:ring-white/10",children:c.jsx(Ds,{job:Se,variant:"table",busy:St,collapseToMenu:!0,compact:!0,isHot:de,isFavorite:Ie,isLiked:Ze,isWatching:et,onToggleWatch:z,onToggleFavorite:he,onToggleLike:ae,onToggleHot:async Mt=>{if(!(ee&&ee(Mt)))return k(Mt)},onKeep:async Mt=>Z&&Z(Mt)?!0:re(Mt),onDelete:async Mt=>P&&P(Mt)?!0:O(Mt),order:["watch","favorite","like","hot","keep","delete","details","add"],className:"w-full gap-1.5"})})})}),c.jsx("div",{className:"mt-2",onClick:Mt=>Mt.stopPropagation(),onMouseDown:Mt=>Mt.stopPropagation(),children:c.jsx(cd,{rowKey:Je,tags:ft,activeTagSet:V,lower:j,onToggleTagFilter:ne})})]})]},Je)})}),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,e,t){return Math.max(e,Math.min(t,n))}function Mm(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function m3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=Mm(a,Math.min(t,l)),h=Mm(Math.max(l-t+1,t+1),l),f=Math.max(Math.min(e-i,l-t-i*2-1),t+1),g=Math.min(Math.max(e+i,t+i*2+2),l-t),_=[];_.push(...u),f>t+1?_.push("ellipsis"):t+1<l-t&&_.push(t+1),_.push(...Mm(f,g)),g<l-t?_.push("ellipsis"):l-t>t&&_.push(l-t),_.push(...h);const S=new Set;return _.filter(C=>{const D=String(C);return S.has(D)?!1:(S.add(D),!0)})}function g3({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:nn("relative inline-flex items-center px-4 py-2 text-sm font-semibold focus:z-20 focus:outline-offset-0",u,e?"opacity-50 cursor-not-allowed":"cursor-pointer",n?"z-10 bg-indigo-600 text-white focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:bg-indigo-500 dark:focus-visible:outline-indigo-500":"text-gray-900 inset-ring inset-ring-gray-300 hover:bg-gray-50 dark:text-gray-200 dark:inset-ring-gray-700 dark:hover:bg-white/5"),"aria-current":n?"page":void 0,children:a})}function kf({page:n,pageSize:e,totalItems:t,onPageChange:i,siblingCount:a=1,boundaryCount:l=1,showSummary:u=!0,className:h,ariaLabel:f="Pagination",prevLabel:g="Previous",nextLabel:_="Next"}){const S=Math.max(1,Math.ceil((t||0)/Math.max(1,e||1))),C=q1(n||1,1,S);if(S<=1)return null;const D=t===0?0:(C-1)*e+1,R=Math.min(C*e,t),E=m3(S,C,l,a),B=G=>i(q1(G,1,S));return c.jsxs("div",{className:nn("flex items-center justify-between bg-white dark:border-white/10 dark:bg-transparent",h),children:[c.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[c.jsx("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:g}),c.jsx("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative ml-3 inline-flex items-center rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed dark:border-white/10 dark:bg-white/5 dark:text-gray-200 dark:hover:bg-white/10",children:_})]}),c.jsxs("div",{className:"hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",children:[c.jsx("div",{children:u?c.jsxs("p",{className:"text-sm text-gray-700 dark:text-gray-300 px-2",children:["Showing ",c.jsx("span",{className:"font-medium",children:D})," to"," ",c.jsx("span",{className:"font-medium",children:R})," of"," ",c.jsx("span",{className:"font-medium",children:t})," results"]}):null}),c.jsx("div",{children:c.jsxs("nav",{"aria-label":f,className:"isolate inline-flex -space-x-px rounded-md shadow-xs dark:shadow-none",children:[c.jsxs("button",{type:"button",onClick:()=>B(C-1),disabled:C<=1,className:"relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:g}),c.jsx(s3,{"aria-hidden":"true",className:"size-5"})]}),E.map((G,Y)=>G==="ellipsis"?c.jsx("span",{className:"relative inline-flex items-center px-4 py-2 text-sm font-semibold text-gray-700 inset-ring inset-ring-gray-300 dark:text-gray-400 dark:inset-ring-gray-700",children:"…"},`e-${Y}`):c.jsx(g3,{active:G===C,onClick:()=>B(G),rounded:"none",children:G},G)),c.jsxs("button",{type:"button",onClick:()=>B(C+1),disabled:C>=S,className:"relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 inset-ring inset-ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0 disabled:opacity-50 disabled:cursor-not-allowed dark:inset-ring-gray-700 dark:hover:bg-white/5",children:[c.jsx("span",{className:"sr-only",children:_}),c.jsx(o3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Rw=m.createContext(null),jm=220;function y3(n){switch(n){case"success":return{Icon:PA,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:bN,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:qA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:QA,cls:"text-sky-600 dark:text-sky-400"}}}function b3(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 v3(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 x3(n){switch(n){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function _3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function w3({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({}),_=m.useRef({}),S=m.useRef({}),C=m.useRef({}),D=m.useCallback(k=>{const j=f.current[k];j&&(window.clearTimeout(j),delete f.current[k]);const te=g.current[k];te&&(window.clearTimeout(te),delete g.current[k]),delete _.current[k],delete S.current[k],delete C.current[k]},[]),R=m.useCallback(async()=>{try{const k=await fetch("/api/settings",{cache:"no-store"});if(!k.ok)return;const j=await k.json();h(!!(j?.enableNotifications??!0))}catch{}},[]);m.useEffect(()=>{R();const k=()=>R();return window.addEventListener("recorder-settings-updated",k),()=>window.removeEventListener("recorder-settings-updated",k)},[R]),m.useEffect(()=>{u||(l(j=>j.map(te=>te.type==="error"?te:{...te,open:!1})),a.filter(j=>j.type!=="error").map(j=>j.id).forEach(j=>{D(j),g.current[j]=window.setTimeout(()=>{l(te=>te.filter(V=>V.id!==j)),delete g.current[j]},jm)}))},[u]);const E=m.useCallback(k=>{l(j=>j.map(te=>te.id===k?{...te,open:!1}:te)),D(k),g.current[k]=window.setTimeout(()=>{l(j=>j.filter(te=>te.id!==k)),delete g.current[k]},jm)},[D]),B=m.useCallback(()=>{l(k=>k.map(j=>({...j,open:!1}))),Object.keys(f.current).forEach(k=>{window.clearTimeout(f.current[k]),delete f.current[k]}),Object.keys(g.current).forEach(k=>{window.clearTimeout(g.current[k]),delete g.current[k]}),window.setTimeout(()=>l([]),jm)},[]),G=m.useCallback((k,j)=>{if(!j||j<=0)return;const te=f.current[k];te&&(window.clearTimeout(te),delete f.current[k]),_.current[k]=Date.now(),S.current[k]=j,C.current[k]=!1,f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]),Y=m.useCallback(k=>{if(!u&&k.type!=="error")return"";const j=_3(),te=k.durationMs??t;return l(V=>{const ne=[{...k,id:j,durationMs:te,open:!0},...V],he=Math.max(1,e),ae=ne.slice(0,he);return ne.slice(he).forEach(P=>D(P.id)),ae}),te&&te>0&&G(j,te),j},[t,e,u,D,G]),q=m.useCallback(k=>{if(C.current[k])return;const j=f.current[k];if(!j)return;window.clearTimeout(j),delete f.current[k];const te=_.current[k]??Date.now(),V=S.current[k]??0,ne=Date.now()-te,he=Math.max(0,V-ne);S.current[k]=he,C.current[k]=!0},[]),se=m.useCallback(k=>{if(!C.current[k])return;const j=S.current[k]??0;if(j<=0){E(k);return}C.current[k]=!1,_.current[k]=Date.now(),f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]);m.useEffect(()=>()=>{Object.values(f.current).forEach(k=>window.clearTimeout(k)),Object.values(g.current).forEach(k=>window.clearTimeout(k))},[]);const Q=m.useMemo(()=>({push:Y,remove:E,clear:B}),[Y,E,B]),K=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(Rw.Provider,{value:Q,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",K].join(" "),children:c.jsx("div",{className:["flex w-full flex-col gap-2.5 sm:gap-3",O].join(" "),children:a.map(k=>{const{Icon:j,cls:te}=y3(k.type),V=v3(k.type),ne=(k.title||"").trim()||x3(k.type),he=(k.message||"").trim(),ae=(k.imageUrl||"").trim(),z=(k.imageAlt||ne).trim(),P=typeof k.onClick=="function";return c.jsx(Jc,{appear:!0,show:k.open,enter:"transform transition ease-out duration-250",enterFrom:"opacity-0 -translate-y-3 sm:-translate-y-2",enterTo:"opacity-100 translate-y-0",leave:"transform transition ease-in duration-200",leaveFrom:"opacity-100 translate-y-0",leaveTo:"opacity-0 -translate-y-2 sm:-translate-y-3",children:c.jsx("div",{role:P?"button":"status",className:["pointer-events-auto relative w-[22rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-xl","border bg-white dark:bg-slate-900","shadow-sm","ring-1 ring-black/5 dark:ring-white/5",P?"cursor-pointer transition-[box-shadow,transform,background-color] duration-150 hover:bg-gray-50 dark:hover:bg-slate-800/90 hover:shadow-lg hover:ring-black/10 dark:hover:ring-white/10 active:scale-[0.998]":"",b3(k.type)].join(" "),onMouseEnter:()=>q(k.id),onMouseLeave:()=>se(k.id),onFocus:()=>q(k.id),onBlur:()=>se(k.id),onClick:()=>{k.onClick&&(k.onClick(),k.closeOnClick!==!1&&E(k.id))},onKeyDown:Z=>{k.onClick&&(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),k.onClick(),k.closeOnClick!==!1&&E(k.id))},tabIndex:P?0:void 0,"aria-label":P?`${ne} öffnen`:void 0,children:ae?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:ae,alt:z,loading:"lazy",referrerPolicy:"no-referrer",className:["h-full min-h-[72px] w-16 sm:w-[72px]","object-cover object-center","rounded-l-xl","border-r border-black/5 dark:border-white/10","bg-gray-100 dark:bg-white/5"].join(" ")})}),c.jsxs("div",{className:"min-w-0 flex-1 py-3 pl-3 pr-2 sm:py-3.5 sm:pl-3.5 sm:pr-3",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),he?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:he}):null]})]}),c.jsxs("button",{type:"button",onClick:Z=>{Z.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(P1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]}):c.jsxs("div",{className:"relative pr-12 py-2.5 sm:pr-14",children:[c.jsxs("div",{className:"flex items-center gap-3 px-3 sm:px-3.5",children:[c.jsx("div",{className:"shrink-0",children:c.jsx("div",{className:["inline-flex h-12 w-12 sm:h-14 sm:w-14 items-center justify-center rounded-full",V.iconBg,"ring-1 ring-black/5 dark:ring-white/10"].join(" "),children:c.jsx(j,{className:["size-5.5 sm:size-6",te].join(" "),"aria-hidden":"true"})})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:ne}),he?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:he}):null]})]}),c.jsxs("button",{type:"button",onClick:Z=>{Z.stopPropagation(),E(k.id)},title:"Schließen",className:["absolute right-2 top-1/2 -translate-y-1/2","inline-flex h-9 w-9 sm:h-10 sm:w-10 items-center justify-center rounded-full","text-gray-400 hover:text-gray-700 dark:text-gray-300 dark:hover:text-white","hover:bg-gray-100 dark:hover:bg-white/10","active:scale-[0.98] active:bg-gray-200/80 dark:active:bg-white/15","transition","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2","dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-slate-900"].join(" "),children:[c.jsx("span",{className:"sr-only",children:"Schließen"}),c.jsx(P1,{"aria-hidden":"true",className:"size-5.5 sm:size-6"})]})]})})},k.id)})})})})]})}function T3(){const n=m.useContext(Rw);if(!n)throw new Error("useToast must be used within <ToastProvider>");return n}function Ow(){const{push:n,remove:e,clear:t}=T3(),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 S3(n){return typeof n=="number"?n:n==="xs"?12:n==="sm"?16:n==="lg"?28:20}function V1(...n){return n.filter(Boolean).join(" ")}function G1({size:n="md",className:e,label:t,srLabel:i="Lädt…",center:a=!1}){const l=S3(n);return c.jsxs("span",{className:V1("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:V1("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 vy=n=>(n||"").replaceAll("\\","/"),rr=n=>{const t=vy(n).split("/");return t[t.length-1]||""},bi=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):rr(n.output||"")||String(n?.output||"")},k3=n=>{const e=vy(String(n??""));return e.includes("/.trash/")||e.endsWith("/.trash")};function K1(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 Rm(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 W1(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 Lc=n=>{const e=rr(n||""),t=$r(e);if(!t)return"—";const i=t.replace(/\.[^.]+$/,""),a=i.match(/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}$/);if(a?.[1])return a[1];const l=i.lastIndexOf("_");return l>0?i.slice(0,l):i},ns=n=>(n||"").trim().toLowerCase(),E3=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},Om=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 X1(n){return new Promise(e=>window.setTimeout(e,n))}function C3(n){return n instanceof Error?n.message||String(n):String(n??"")}function Y1(n){const e=C3(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 Lm(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 A3(){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 N3({jobs:n,doneJobs:e,blurPreviews:t,teaserPlayback:i,teaserAudio:a,onOpenPlayer:l,onDeleteJob:u,onToggleHot:h,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,onKeepJob:S,doneTotal:C,page:D,pageSize:R,onPageChange:E,assetNonce:B,sortMode:G,onSortModeChange:Y,modelsByKey:q,loadMode:se="paged"}){const Q=se==="all",K=i??"hover",O=W1("(hover: hover) and (pointer: fine)"),re=Ow(),k=A3(),j=m.useRef(new Map),[te,V]=m.useState(null),[ne,he]=m.useState(null),ae=m.useRef(null),z=m.useRef(new WeakMap),[P,Z]=m.useState(()=>new Set),[ee,fe]=m.useState(()=>new Set),[I,pe]=m.useState(!1),ke=m.useRef(!1),ye=m.useRef(!1),me=m.useRef(0),pt="finishedDownloads_lastUndo_v1",[We,_e]=m.useState(()=>{if(typeof window>"u")return null;try{const U=localStorage.getItem(pt);if(!U)return null;const W=JSON.parse(U);if(!W||W.v!==1||!W.action)return null;const le=Date.now()-Number(W.ts||0);return!Number.isFinite(le)||le<0||le>1800*1e3?(localStorage.removeItem(pt),null):W.action}catch{return null}}),[Ye,wt]=m.useState(!1);m.useEffect(()=>{try{if(!We){localStorage.removeItem(pt);return}const U={v:1,action:We,ts:Date.now()};localStorage.setItem(pt,JSON.stringify(U))}catch{}},[We]);const[je,Se]=m.useState({}),[Je,tt]=m.useState(null),[ot,dt]=m.useState(null),[Ut,Ge]=m.useState(0),Ie=m.useRef(null),Ze=m.useRef({pending:0,t:0,timer:0}),et=m.useCallback(U=>{!U||!Number.isFinite(U)||(Ze.current.pending+=U,!Ze.current.timer&&(Ze.current.timer=window.setTimeout(()=>{Ze.current.timer=0;const W=Ze.current.pending;Ze.current.pending=0,W&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:W}}))},120)))},[]),ft="finishedDownloads_view",mt="finishedDownloads_includeKeep_v2",de="finishedDownloads_mobileOptionsOpen_v1",[ze,Le]=m.useState("table"),[Ae,Pe]=m.useState(!1),[Qe,St]=m.useState(!1),Ot=m.useRef(new Map),[Tt,an]=m.useState([]),Nt=m.useMemo(()=>new Set(Tt.map(ns)),[Tt]),Lt=m.useMemo(()=>{const U={},W={};for(const[le,be]of Object.entries(q??{})){const Ce=ns(le),Oe=E3(be?.tags);U[Ce]=Oe,W[Ce]=new Set(Oe.map(ns))}return{tagsByModelKey:U,tagSetByModelKey:W}},[q]),[vt,It]=m.useState(""),yn=m.useDeferredValue(vt),$n=m.useMemo(()=>ns(yn).split(/\s+/g).map(U=>U.trim()).filter(Boolean),[yn]),kt=m.useCallback(()=>It(""),[]),Bn=m.useCallback(U=>{const W=ns(U);an(le=>le.some(Ce=>ns(Ce)===W)?le.filter(Ce=>ns(Ce)!==W):[...le,U])},[]),N=Nt.size>0||$n.some(U=>U.length>=2),F=N||Q,ie=m.useCallback(async U=>{const W=Je==null;W&&pe(!0);try{const le=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(G)}&withCount=1${Ae?"&includeKeep=1":""}`,{cache:"no-store",signal:U});if(!le.ok)return;const be=await le.json().catch(()=>null),Ce=Array.isArray(be?.items)?be.items:[],Oe=Number(be?.count??be?.totalCount??Ce.length);tt(Ce),dt(Number.isFinite(Oe)?Oe:Ce.length)}finally{W&&pe(!1)}},[G,Ae]),Me=m.useCallback(()=>an([]),[]);m.useEffect(()=>{try{const U=localStorage.getItem("finishedDownloads_pendingTags");if(!U)return;const W=JSON.parse(U),le=Array.isArray(W)?W.map(be=>String(be||"").trim()).filter(Boolean):[];if(le.length===0)return;yu.flushSync(()=>an(le)),D!==1&&E(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const He=m.useCallback(()=>{Ie.current==null&&(Ie.current=window.setTimeout(()=>{Ie.current=null,Ge(U=>U+1)},80))},[D,R,G,Ae]);m.useEffect(()=>{if(!F)return;const U=new AbortController,W=window.setTimeout(()=>{ie(U.signal).catch(()=>{})},250);return()=>{window.clearTimeout(W),U.abort()}},[F,ie]),m.useEffect(()=>{if(Ut===0)return;const U=new AbortController;let W=!0,le=!1;const be=++me.current,Ce=()=>{le||(le=!0,me.current===be&&(ke.current=!1,ye.current&&(ye.current=!1,He())))};return me.current===be&&(ke.current=!0),F?((async()=>{try{await ie(U.signal),W&&(cn.current=0)}catch{}finally{W&&Ce()}})(),()=>{W=!1,U.abort(),Ce()}):(pe(!0),(async()=>{try{const Oe=await fetch(`/api/record/done?page=${D}&pageSize=${R}&sort=${encodeURIComponent(G)}&withCount=1${Ae?"&includeKeep=1":""}`,{cache:"no-store",signal:U.signal});if(!W||U.signal.aborted)return;const ht=Oe.ok;if(Oe.ok){const At=await Oe.json().catch(()=>null);if(!W||U.signal.aborted)return;const yt=Array.isArray(At?.items)?At.items:Array.isArray(At)?At:[];tt(yt);const rn=Number(At?.count??At?.totalCount??yt.length),Yt=Number.isFinite(rn)&&rn>=0?rn:0;dt(Yt);const Rn=Math.max(1,Math.ceil(Yt/R));if(D>Rn){E(Rn),tt(null);return}}if(ht)cn.current=0;else if(W&&!U.signal.aborted&&cn.current<2){cn.current+=1;const At=cn.current;window.setTimeout(()=>{U.signal.aborted||Ge(yt=>yt+1)},400*At)}}catch{}finally{W&&(pe(!1),Ce())}})(),()=>{W=!1,U.abort(),Ce()})},[Ut,F,ie,D,R,G,Ae,E]),m.useEffect(()=>{F||(tt(null),dt(null))},[D,R,G,Ae,F]),m.useEffect(()=>{if(!Ae){N||(tt(null),dt(null));return}if(N)return;const U=new AbortController;return(async()=>{try{const W=await fetch(`/api/record/done?page=${D}&pageSize=${R}&sort=${encodeURIComponent(G)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:U.signal});if(!W.ok)return;const le=await W.json().catch(()=>null),be=Array.isArray(le?.items)?le.items:[],Ce=Number(le?.count??le?.totalCount??be.length);tt(be),dt(Number.isFinite(Ce)?Ce:be.length)}catch{}})(),()=>U.abort()},[Ae,N,D,R,G]),m.useEffect(()=>{try{const U=localStorage.getItem(ft);Le(U==="table"||U==="cards"||U==="gallery"?U:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Le("table")}},[]),m.useEffect(()=>{try{localStorage.setItem(ft,ze)}catch{}},[ze]),m.useEffect(()=>{try{const U=localStorage.getItem(mt);Pe(U==="1"||U==="true"||U==="yes")}catch{Pe(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(mt,Ae?"1":"0")}catch{}},[Ae]),m.useEffect(()=>{try{const U=localStorage.getItem(de);St(U==="1"||U==="true"||U==="yes")}catch{St(!1)}},[]),m.useEffect(()=>{try{localStorage.setItem(de,Qe?"1":"0")}catch{}},[Qe]);const[gt,zt]=m.useState({}),Jt=m.useRef({}),un=m.useRef(null),[Xt,pn]=m.useState({}),fn=m.useRef({}),Kt=m.useRef(null),cn=m.useRef(0);m.useEffect(()=>{fn.current=Xt},[Xt]);const dn=m.useCallback(()=>{Kt.current==null&&(Kt.current=window.setTimeout(()=>{Kt.current=null,pn({...fn.current})},200))},[]);m.useEffect(()=>()=>{Kt.current!=null&&(window.clearTimeout(Kt.current),Kt.current=null)},[]),m.useEffect(()=>{Jt.current=gt},[gt]);const ln=m.useCallback(()=>{un.current==null&&(un.current=window.setTimeout(()=>{un.current=null,zt({...Jt.current})},200))},[]);m.useEffect(()=>()=>{un.current!=null&&(window.clearTimeout(un.current),un.current=null)},[]);const[qt,Rt]=m.useState(null),Dt=!a,Cn=m.useCallback(U=>{const le=document.getElementById(U)?.querySelector("video");if(!le)return!1;ud(le,{muted:Dt});const be=le.play?.();return be&&typeof be.catch=="function"&&be.catch(()=>{}),!0},[Dt]),Mt=m.useCallback(U=>{Rt(W=>W?.key===U?{key:U,nonce:W.nonce+1}:{key:U,nonce:1})},[]),Pn=m.useCallback((U,W,le)=>{const be=Number.isFinite(W)&&W>0?W:0;Rt(Oe=>Oe?.key===U?{key:U,nonce:Oe.nonce+1}:{key:U,nonce:1});const Ce=Oe=>{const At=document.getElementById(le)?.querySelector("video");if(!At){Oe>0&&requestAnimationFrame(()=>Ce(Oe-1));return}ud(At,{muted:Dt});const yt=()=>{try{const ui=Number(At.duration),Kr=Number.isFinite(ui)&&ui>0?Math.max(0,ui-.05):be;At.currentTime=Math.max(0,Math.min(be,Kr))}catch{}const Rn=At.play?.();Rn&&typeof Rn.catch=="function"&&Rn.catch(()=>{})};if(At.readyState>=1){yt();return}const rn=()=>{At.removeEventListener("loadedmetadata",rn),yt()};At.addEventListener("loadedmetadata",rn,{once:!0});const Yt=At.play?.();Yt&&typeof Yt.catch=="function"&&Yt.catch(()=>{})};requestAnimationFrame(()=>Ce(8))},[Dt]),Dn=m.useCallback(U=>{Rt(null),l(U)},[l]),Mn=m.useCallback((U,W)=>{const le=Number.isFinite(W)&&W>=0?W:0;Rt(null),l(U,le)},[l]),Wt=m.useCallback((U,W,le)=>{const be=Number.isFinite(W)?Math.floor(W):0,Ce=Number.isFinite(le)?Math.floor(le):0;if(Ce<=0){Dn(U);return}const Oe=bi(U),ht=gt[Oe]??U?.durationSeconds??0;if(!Number.isFinite(ht)||ht<=0){Dn(U);return}const At=Math.max(0,Math.min(be,Ce-1)),yt=ht/Ce,rn=At*yt;Mn(U,rn)},[gt,bi,Dn,Mn]),Vn=m.useCallback((U,W)=>{fe(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Yn=m.useCallback(U=>{Z(W=>{const le=new Set(W);return le.add(U),le})},[]),[jn,Qn]=m.useState(()=>new Set),mn=m.useCallback((U,W)=>{Qn(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),[Ri,Zn]=m.useState(()=>new Set),Kn=m.useRef(new Map);m.useEffect(()=>()=>{for(const U of Kn.current.values())window.clearTimeout(U);Kn.current.clear()},[]);const ni=m.useCallback((U,W)=>{Zn(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Si=m.useCallback(U=>{const W=Kn.current.get(U);W!=null&&(window.clearTimeout(W),Kn.current.delete(U))},[]),An=m.useCallback(U=>{Si(U),Z(W=>{const le=new Set(W);return le.delete(U),le}),Zn(W=>{const le=new Set(W);return le.delete(U),le}),fe(W=>{const le=new Set(W);return le.delete(U),le}),Qn(W=>{const le=new Set(W);return le.delete(U),le})},[Si]),Fn=m.useCallback(U=>{ni(U,!0),Si(U);const W=window.setTimeout(()=>{Kn.current.delete(U),Yn(U),ni(U,!1)},320);Kn.current.set(U,W)},[Yn,ni,Si]),Hn=m.useCallback(async(U,W)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),W?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:U}})),await new Promise(le=>requestAnimationFrame(()=>le())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),await new Promise(le=>window.setTimeout(le,260))},[]),ve=m.useCallback(async(U,W,le)=>{const be=Math.max(1,le?.attempts??4),Ce=Math.max(50,le?.baseDelayMs??220);let Oe;for(let ht=1;ht<=be;ht++)try{return await Hn(U,{close:le?.close??!0}),ht>1?await X1(Ce*ht):await X1(80),await W()}catch(At){if(Oe=At,!Y1(At)||ht>=be)throw At;continue}throw Oe instanceof Error?Oe:new Error(String(Oe??"Unbekannter Fehler"))},[Hn]),rt=m.useCallback(async U=>{const{file:W,rowKey:le,setBusy:be,isBusyNow:Ce,optimisticRemove:Oe,alreadyRemoved:ht,run:At,onSuccess:yt,onError:rn,labels:Yt}=U;if(!W)return re.error(Yt.invalidTitle,Yt.invalidBody),{ok:!1};if(Ce?.())return{ok:!1};be?.(!0);try{Oe&&!ht&&Fn(le);const Rn=await At();return await yt?.(Rn),{ok:!0,result:Rn}}catch(Rn){if(Oe&&An(le),await rn?.(Rn),Y1(Rn))re.error(Yt.inUseTitle,`${W} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const ui=Rn?.message?` — ${String(Rn.message)}`:"";re.error(Yt.failTitle,`${Yt.failPrefix??W}${ui}`)}return{ok:!1}}finally{be?.(!1)}},[re,Fn,An]),ct=m.useCallback(async(U,W)=>{const le=rr(U.output||""),be=bi(U);return(await rt({kind:"delete",job:U,file:le,rowKey:be,setBusy:Oe=>Vn(be,Oe),isBusyNow:()=>ee.has(be),optimisticRemove:!0,alreadyRemoved:W?.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:le},run:async()=>u?await ve(le,async()=>await u(U),{close:!0,attempts:4,baseDelayMs:220}):await(await ve(le,async()=>await Lm(`/api/record/delete?file=${encodeURIComponent(le)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Oe=>{if(u){const yt=typeof Oe?.undoToken=="string"?Oe.undoToken:"";_e(yt?{kind:"delete",undoToken:yt,originalFile:le,rowKey:be}:null);return}const ht=Oe?.from==="keep"?"keep":"done",At=typeof Oe?.undoToken=="string"?Oe.undoToken:"";_e(At?{kind:"delete",undoToken:At,originalFile:le,rowKey:be,from:ht}:null),He(),et(-1)}})).ok},[rr,bi,ee,Vn,u,ve,rt,He,et]),jt=m.useCallback(async(U,W)=>{const le=rr(U.output||""),be=bi(U);return(await rt({kind:"keep",job:U,file:le,rowKey:be,setBusy:Oe=>mn(be,Oe),isBusyNow:()=>jn.has(be)||ee.has(be),optimisticRemove:!0,alreadyRemoved:W?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:le},run:async()=>S?await ve(le,async()=>await S(U),{close:!0,attempts:4,baseDelayMs:220}):await(await ve(le,async()=>await Lm(`/api/record/keep?file=${encodeURIComponent(le)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Oe=>{const ht=typeof Oe?.newFile=="string"&&Oe.newFile?Oe.newFile:le;_e({kind:"keep",keptFile:ht,originalFile:le,rowKey:be}),He(),et(Ae?0:-1)}})).ok},[rr,bi,mn,jn,ee,ve,rt,He,et,Ae]),De=m.useCallback((U,W)=>{!U||!W||U===W||Se(le=>{const be={...le};for(const[Ce,Oe]of Object.entries(be))(Ce===U||Ce===W||Oe===U||Oe===W)&&delete be[Ce];return be[U]=W,be})},[]),bt=m.useCallback((U,W)=>{!U&&!W||Se(le=>{const be={...le};for(const[Ce,Oe]of Object.entries(be))(Ce===U||Ce===W||Oe===U||Oe===W)&&delete be[Ce];return be})},[]),xt=m.useCallback(async()=>{if(!We||Ye)return;wt(!0);const U=W=>{Z(le=>{const be=new Set(le);return be.delete(W),be}),fe(le=>{const be=new Set(le);return be.delete(W),be}),Qn(le=>{const be=new Set(le);return be.delete(W),be}),Zn(le=>{const be=new Set(le);return be.delete(W),be})};try{if(We.kind==="delete"){const W=await fetch(`/api/record/restore?token=${encodeURIComponent(We.undoToken)}`,{method:"POST"});if(!W.ok){const Oe=await W.text().catch(()=>"");throw new Error(Oe||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.restoredFile||We.originalFile);We.rowKey&&U(We.rowKey),U(We.originalFile),U(be);const Ce=We.from==="keep"&&!Ae?0:1;et(Ce),He(),_e(null);return}if(We.kind==="keep"){const W=await fetch(`/api/record/unkeep?file=${encodeURIComponent(We.keptFile)}`,{method:"POST"});if(!W.ok){const Ce=await W.text().catch(()=>"");throw new Error(Ce||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.newFile||We.originalFile);We.rowKey&&U(We.rowKey),U(We.originalFile),U(be),et(1),He(),_e(null);return}if(We.kind==="hot"){const W=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(We.currentFile)}`,{method:"POST"});if(!W.ok){const Oe=await W.text().catch(()=>"");throw new Error(Oe||`HTTP ${W.status}`)}const le=await W.json().catch(()=>null),be=String(le?.oldFile||We.currentFile),Ce=String(le?.newFile||"");Ce&&De(be,Ce),He(),_e(null);return}}catch(W){re.error("Undo fehlgeschlagen",String(W?.message||W))}finally{wt(!1)}},[We,Ye,re,He,Ae,et,De]),[Et,Ft]=m.useState(()=>new Set),$t=m.useCallback((U,W)=>{Ft(le=>{const be=new Set(le);return W?be.add(U):be.delete(U),be})},[]),Vt=m.useCallback(async U=>{const W=rr(U.output||""),le=bi(U),be=ht=>ou(ht)?$r(ht):`HOT ${ht}`,Ce=W,Oe=be(Ce);await rt({kind:"rename",job:U,file:W,rowKey:le,setBusy:ht=>$t(le,ht),isBusyNow:()=>Et.has(le),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:Ce},run:async()=>(De(Ce,Oe),h?await h(U):await(await ve(Ce,async()=>await Lm(`/api/record/toggle-hot?file=${encodeURIComponent(Ce)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async ht=>{const At=typeof ht?.oldFile=="string"&&ht.oldFile?ht.oldFile:Ce,yt=typeof ht?.newFile=="string"&&ht.newFile?ht.newFile:Oe;At&&yt&&At!==yt&&De(At,yt),_e({kind:"hot",currentFile:yt}),(!h||G==="file_asc"||G==="file_desc")&&He()},onError:async()=>{bt(Ce,Oe),_e(null)}})},[rr,bi,Et,$t,rt,De,bt,h,ve,He,G]),vn=m.useCallback(U=>{const W=bi(U),le=rr(U.output||"");if(!W||!le||ee.has(W)||jn.has(W))return!1;Vn(W,!0),Fn(W);const be=`delete:${W}`,Ce=k.enqueue(be,async()=>{await ct(U,{alreadyRemoved:!0})});return Ce||An(W),Ce},[k,bi,rr,ee,jn,Vn,ct]),qn=m.useCallback(U=>{const W=bi(U),le=rr(U.output||"");if(!W||!le||jn.has(W)||ee.has(W))return!1;mn(W,!0),Fn(W);const be=`keep:${W}`,Ce=k.enqueue(be,async()=>{await jt(U,{alreadyRemoved:!0})});return Ce||An(W),Ce},[k,bi,rr,jn,ee,mn,jt]),Yi=m.useCallback(U=>{const W=bi(U);if(!W||Et.has(W))return!1;const le=`hot:${W}`;return k.enqueue(le,async()=>{await Vt(U)})},[k,bi,Vt,Et]),Gn=m.useCallback(U=>{const W=vy(U.output||""),le=rr(W),be=je[le];if(!be)return U;const Ce=W.lastIndexOf("/"),Oe=Ce>=0?W.slice(0,Ce+1):"";return{...U,output:Oe+be}},[je]),ki=Je??e,Ei=ot??C,mi=m.useMemo(()=>{const U=new Map;for(const le of ki){const be=Gn(le);U.set(bi(be),be)}for(const le of n){const be=Gn(le),Ce=bi(be);U.has(Ce)&&U.set(Ce,{...U.get(Ce),...be})}return Array.from(U.values()).filter(le=>P.has(bi(le))||k3(le.output)?!1:le.status==="finished"||le.status==="failed"||le.status==="stopped")},[n,ki,P,Gn]),Pi=m.useRef(new Map);m.useEffect(()=>{const U=new Map;for(const W of mi){const le=rr(W.output||"");le&&U.set(le,bi(W))}Pi.current=U},[mi]),m.useEffect(()=>{const U=W=>{const le=W.detail;if(!le?.file)return;const be=Pi.current.get(le.file)||le.file;if(le.phase==="start"){Vn(be,!0),Fn(be);return}if(le.phase==="error"){An(be),Ot.current.get(be)?.reset();return}if(le.phase==="success"){Vn(be,!1);return}};return window.addEventListener("finished-downloads:delete",U),()=>window.removeEventListener("finished-downloads:delete",U)},[Fn,Vn,He,An]),m.useEffect(()=>{const U=()=>{if(ke.current){ye.current||(ye.current=!0);return}Ie.current==null&&He()};return window.addEventListener("finished-downloads:reload",U),()=>window.removeEventListener("finished-downloads:reload",U)},[He]),m.useEffect(()=>{const U=W=>{const le=W.detail,be=String(le?.oldFile??"").trim(),Ce=String(le?.newFile??"").trim();!be||!Ce||be===Ce||De(be,Ce)};return window.addEventListener("finished-downloads:rename",U),()=>window.removeEventListener("finished-downloads:rename",U)},[De]);const Sn=m.useMemo(()=>{const U=mi.filter(le=>!P.has(bi(le))),W=$n.length?U.filter(le=>{const be=rr(le.output||""),Ce=Lc(le.output),Oe=ns(Ce),ht=Lt.tagsByModelKey[Oe]??[],At=ns([be,$r(be),Ce,le.id,ht.join(" ")].join(" "));for(const yt of $n)if(!At.includes(yt))return!1;return!0}):U;return Nt.size===0?W:W.filter(le=>{const be=ns(Lc(le.output)),Ce=Lt.tagSetByModelKey[be];if(!Ce||Ce.size===0)return!1;for(const Oe of Nt)if(!Ce.has(Oe))return!1;return!0})},[mi,P,Nt,Lt,$n]),Jn=F?Sn.length:Ei,wn=m.useMemo(()=>{if(!F)return Sn;const U=(D-1)*R,W=U+R;return Sn.slice(Math.max(0,U),Math.max(0,W))},[F,Sn,D,R]),Ci=!F&&Jn===0,Oi=N&&Sn.length===0,ei=Q&&Sn.length===0,Li=I&&(Ci||ei||Oi);m.useEffect(()=>{if(!N)return;const U=Math.max(1,Math.ceil(Sn.length/R));D>U&&E(U)},[N,Sn.length,D,R,E]),m.useEffect(()=>{if(!(K==="hover"&&!O&&(ze==="cards"||ze==="gallery"||ze==="table"))){V(null),ae.current?.disconnect(),ae.current=null;return}if(ze==="cards"&&qt?.key){V(qt.key);return}ae.current?.disconnect();const W=new IntersectionObserver(le=>{let be=null,Ce=0;for(const Oe of le){if(!Oe.isIntersecting)continue;const ht=z.current.get(Oe.target);ht&&Oe.intersectionRatio>Ce&&(Ce=Oe.intersectionRatio,be=ht)}be&&V(Oe=>Oe===be?Oe:be)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});ae.current=W;for(const[le,be]of j.current)z.current.set(be,le),W.observe(be);return()=>{W.disconnect(),ae.current===W&&(ae.current=null)}},[ze,K,O,qt?.key]);const we=U=>{const W=bi(U),le=gt[W]??U?.durationSeconds;if(typeof le=="number"&&Number.isFinite(le)&&le>0)return K1(le*1e3);const be=Date.parse(String(U.startedAt||"")),Ce=Date.parse(String(U.endedAt||""));return Number.isFinite(be)&&Number.isFinite(Ce)&&Ce>be?K1(Ce-be):"—"},L=m.useCallback(U=>W=>{const le=j.current.get(U);le&&ae.current&&ae.current.unobserve(le),W?(j.current.set(U,W),z.current.set(W,U),ae.current?.observe(W)):j.current.delete(U)},[]),$=m.useCallback((U,W)=>{if(!Number.isFinite(W)||W<=0)return;const le=bi(U),be=Jt.current[le];typeof be=="number"&&Math.abs(be-W)<.5||(Jt.current={...Jt.current,[le]:W},ln())},[ln]),xe=m.useCallback((U,W,le)=>{if(!Number.isFinite(W)||!Number.isFinite(le)||W<=0||le<=0)return;const be=bi(U),Ce=fn.current[be];Ce&&Ce.w===W&&Ce.h===le||(fn.current={...fn.current,[be]:{w:W,h:le}},dn())},[dn]),Te=W1("(max-width: 639px)"),Ve="mt-10",qe="mb-2";return m.useEffect(()=>{if(!Te||ze!=="cards")return;const U=wn[0];if(!U){V(null);return}const W=bi(U);V(be=>be===W?be:null);const le=window.setTimeout(()=>{V(be=>be===W?be:W)},140);return()=>window.clearTimeout(le)},[Te,ze,wn,bi]),m.useEffect(()=>{Te||(Ot.current=new Map)},[Te]),m.useEffect(()=>{Ci&&D!==1&&E(1)},[Ci,D,E]),c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"sticky top-[56px] z-20",children:c.jsxs("div",{className:`\r
|
||
rounded-xl border border-gray-200/70 bg-white/80 shadow-sm\r
|
||
backdrop-blur supports-[backdrop-filter]:bg-white/60\r
|
||
dark:border-white/10 dark:bg-gray-950/60 dark:supports-[backdrop-filter]:bg-gray-950/40\r
|
||
`,children:[c.jsxs("div",{className:"flex items-center gap-3 p-3",children:[c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",children:"Abgeschlossene Downloads"}),c.jsx("span",{className:"shrink-0 rounded-full bg-gray-100 px-2 py-0.5 text-xs font-medium text-gray-900 dark:bg-white/10 dark:text-gray-200",children:Jn})]}),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:Jn})]}),c.jsxs("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[I?c.jsx(G1,{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:vt,onChange:U=>It(U.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
|
||
`}),(vt||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:kt,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(Sa,{label:"Behaltene Downloads anzeigen",checked:Ae,onChange:U=>{D!==1&&E(1),Pe(U)}})}),ze!=="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:G,onChange:U=>{const W=U.target.value;Y(W),D!==1&&E(1)},className:`\r
|
||
h-9 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r
|
||
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r
|
||
`,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}),c.jsx(en,{size:"md",variant:"soft",disabled:!We||Ye,onClick:xt,title:We?`Letzte Aktion rückgängig machen (${We.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Ig,{value:ze,onChange:U=>Le(U),size:Te?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(pN,{className:Te?"size-4":"size-5"}),label:Te?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(lN,{className:Te?"size-4":"size-5"}),label:Te?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(dN,{className:Te?"size-4":"size-5"}),label:Te?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:()=>St(U=>!U),"aria-expanded":Qe,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(EA,{className:"size-5"}),N||Ae?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]})]})]}),Tt.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:[Tt.map(U=>c.jsx(ms,{tag:U,active:!0,onClick:Bn},U)),c.jsx(en,{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:Me,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:vt,onChange:U=>It(U.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
|
||
`}),(vt||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:kt,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(Og,{checked:Ae,onChange:U=>{D!==1&&E(1),Pe(U)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),ze!=="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:G,onChange:U=>{const W=U.target.value;Y(W),D!==1&&E(1)},className:`\r
|
||
w-full h-10 rounded-md border border-gray-200 bg-white px-2 text-sm text-gray-900 shadow-sm\r
|
||
dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r
|
||
`,children:[c.jsx("option",{value:"completed_desc",children:"Fertiggestellt am ↓"}),c.jsx("option",{value:"completed_asc",children:"Fertiggestellt am ↑"}),c.jsx("option",{value:"file_asc",children:"Modelname A→Z"}),c.jsx("option",{value:"file_desc",children:"Modelname Z→A"}),c.jsx("option",{value:"duration_desc",children:"Dauer ↓"}),c.jsx("option",{value:"duration_asc",children:"Dauer ↑"}),c.jsx("option",{value:"size_desc",children:"Größe ↓"}),c.jsx("option",{value:"size_asc",children:"Größe ↑"})]})]}):null]})}),Tt.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:[Tt.map(U=>c.jsx(ms,{tag:U,active:!0,onClick:Bn},U)),c.jsx(en,{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:Me,children:"Zurücksetzen"})]})]})}):null]})]})}),Li?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Lade Downloads…"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Bitte warte einen Moment."})]}),c.jsx(G1,{size:"lg",className:"text-indigo-500",srLabel:"Lade Downloads…"})]})}):Ci||ei?c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:c.jsx("span",{className:"text-lg",children:"📁"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine abgeschlossenen Downloads"}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Im Zielordner ist aktuell nichts vorhanden."})]})]})}):Oi?c.jsxs(Ns,{grayBody:!0,children:[c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine Treffer für die aktuellen Filter."}),Tt.length>0||(vt||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[Tt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:Me,children:"Tag-Filter zurücksetzen"}):null,(vt||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:kt,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[ze==="cards"&&c.jsx("div",{className:Te?`${Ve} ${qe}`:"",children:c.jsx(t3,{rows:wn,isSmall:Te,isLoading:I,blurPreviews:t,durations:gt,teaserKey:te,teaserPlayback:K,teaserAudio:a,hoverTeaserKey:ne,inlinePlay:qt,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,swipeRefs:Ot,keyFor:bi,baseName:rr,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,lower:ns,onOpenPlayer:l,openPlayer:Dn,onOpenPlayerAt:Mn,handleScrubberClickIndex:Wt,startInlineAt:Pn,startInline:Mt,tryAutoplayInline:Cn,registerTeaserHost:L,handleDuration:$,deleteVideo:ct,keepVideo:jt,releasePlayingFile:Hn,modelsByKey:q,onToggleHot:Vt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Nt,onToggleTagFilter:Bn,onHoverPreviewKeyChange:he,assetNonce:B??0,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi})}),ze==="table"&&c.jsx(c3,{rows:wn,isLoading:I,keyFor:bi,baseName:rr,lower:ns,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,resolutions:Xt,durations:gt,canHover:O,teaserAudio:a,hoverTeaserKey:ne,setHoverTeaserKey:he,teaserPlayback:K,teaserKey:te,registerTeaserHost:L,handleDuration:$,handleResolution:xe,blurPreviews:t,assetNonce:B,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,modelsByKey:q,activeTagSet:Nt,onToggleTagFilter:Bn,onOpenPlayer:l,handleScrubberClickIndex:Wt,onSortModeChange:Y,page:D,onPageChange:E,onToggleHot:Vt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,deleteVideo:ct,keepVideo:jt,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi}),ze==="gallery"&&c.jsx(p3,{rows:wn,isLoading:I,blurPreviews:t,durations:gt,handleDuration:$,teaserKey:te,teaserPlayback:K,teaserAudio:a,hoverTeaserKey:ne,keyFor:bi,baseName:rr,modelNameFromOutput:Lc,runtimeOf:we,sizeBytesOf:Om,formatBytes:Rm,deletingKeys:ee,keepingKeys:jn,removingKeys:Ri,deletedKeys:P,registerTeaserHost:L,onOpenPlayer:l,handleScrubberClickIndex:Wt,deleteVideo:ct,keepVideo:jt,onToggleHot:Vt,lower:ns,modelsByKey:q,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Nt,onToggleTagFilter:Bn,onHoverPreviewKeyChange:he,enqueueDeleteVideo:vn,enqueueKeepVideo:qn,enqueueToggleHot:Yi}),c.jsx(kf,{page:D,pageSize:R,totalItems:Jn,onPageChange:U=>{yu.flushSync(()=>{Rt(null),V(null),he(null)});for(const W of wn){const le=rr(W.output||"");le&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:le}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:le}})))}window.scrollTo({top:0,behavior:"auto"}),E(U)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var Im,Q1;function i0(){if(Q1)return Im;Q1=1;var n;return typeof window<"u"?n=window:typeof gf<"u"?n=gf:typeof self<"u"?n=self:n={},Im=n,Im}var D3=i0();const ue=Du(D3),M3={},j3=Object.freeze(Object.defineProperty({__proto__:null,default:M3},Symbol.toStringTag,{value:"Module"})),R3=KE(j3);var Bm,Z1;function Lw(){if(Z1)return Bm;Z1=1;var n=typeof gf<"u"?gf:typeof window<"u"?window:{},e=R3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Bm=t,Bm}var O3=Lw();const _t=Du(O3);var Kh={exports:{}},Pm={exports:{}},J1;function L3(){return J1||(J1=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})(Pm)),Pm.exports}var Fm,e2;function I3(){if(e2)return Fm;e2=1,Fm=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 Fm}var Um,t2;function B3(){if(t2)return Um;t2=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),_=n(g),S;!(S=_()).done;){var C=S.value;try{f=C(f)}catch{}}return f},a})();return Um=i,Um}var zm,n2;function P3(){if(n2)return zm;n2=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,_=u.initialDelay;return new e({maxAttempts:h||this.maxAttempts_,delayFactor:f||this.delayFactor_,fuzzFactor:g||this.fuzzFactor_,initialDelay:_||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 zm=n,zm}var $m,i2;function F3(){if(i2)return $m;i2=1;var n=i0(),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 _=t(h.headers&&h.headers["content-type"]);try{g=new TextDecoder(_).decode(f)}catch{}}else g=String.fromCharCode.apply(null,new Uint8Array(f));a({cause:g});return}a(null,f)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(a,l){var u=l.split("="),h=u[0],f=u[1];return h.trim()==="charset"?f.trim():a},"utf-8")}return $m=e,$m}var r2;function U3(){if(r2)return Kh.exports;r2=1;var n=i0(),e=L3(),t=I3(),i=B3(),a=P3();g.httpHandler=F3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(R){var E={};return R&&R.trim().split(`
|
||
`).forEach(function(B){var G=B.indexOf(":"),Y=B.slice(0,G).trim().toLowerCase(),q=B.slice(G+1).trim();typeof E[Y]>"u"?E[Y]=q:Array.isArray(E[Y])?E[Y].push(q):E[Y]=[E[Y],q]}),E};Kh.exports=g,Kh.exports.default=g,g.XMLHttpRequest=n.XMLHttpRequest||C,g.XDomainRequest="withCredentials"in new g.XMLHttpRequest?g.XMLHttpRequest:n.XDomainRequest,u(["get","put","post","patch","head","delete"],function(D){g[D==="delete"?"del":D]=function(R,E,B){return E=f(R,E,B),E.method=D.toUpperCase(),_(E)}});function u(D,R){for(var E=0;E<D.length;E++)R(D[E])}function h(D){for(var R in D)if(D.hasOwnProperty(R))return!1;return!0}function f(D,R,E){var B=D;return t(R)?(E=R,typeof D=="string"&&(B={uri:D})):B=e({},R,{uri:D}),B.callback=E,B}function g(D,R,E){return R=f(D,R,E),_(R)}function _(D){if(typeof D.callback>"u")throw new Error("callback argument missing");if(D.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var R={uri:D.uri||D.url,headers:D.headers||{},body:D.body,metadata:D.metadata||{},retry:D.retry,timeout:D.timeout},E=g.requestInterceptorsStorage.execute(D.requestType,R);D.uri=E.uri,D.headers=E.headers,D.body=E.body,D.metadata=E.metadata,D.retry=E.retry,D.timeout=E.timeout}var B=!1,G=function(Z,ee,fe){B||(B=!0,D.callback(Z,ee,fe))};function Y(){K.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(Q,0)}function q(){var P=void 0;if(K.response?P=K.response:P=K.responseText||S(K),he)try{P=JSON.parse(P)}catch{}return P}function se(P){if(clearTimeout(ae),clearTimeout(D.retryTimeout),P instanceof Error||(P=new Error(""+(P||"Unknown XMLHttpRequest Error"))),P.statusCode=0,!re&&g.retryManager.getIsEnabled()&&D.retry&&D.retry.shouldRetry()){D.retryTimeout=setTimeout(function(){D.retry.moveToNextAttempt(),D.xhr=K,_(D)},D.retry.getCurrentFuzzedDelay());return}if(D.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var Z={headers:z.headers||{},body:z.body,responseUrl:K.responseURL,responseType:K.responseType},ee=g.responseInterceptorsStorage.execute(D.requestType,Z);z.body=ee.body,z.headers=ee.headers}return G(P,z)}function Q(){if(!re){var P;clearTimeout(ae),clearTimeout(D.retryTimeout),D.useXDR&&K.status===void 0?P=200:P=K.status===1223?204:K.status;var Z=z,ee=null;if(P!==0?(Z={body:q(),statusCode:P,method:j,headers:{},url:k,rawRequest:K},K.getAllResponseHeaders&&(Z.headers=l(K.getAllResponseHeaders()))):ee=new Error("Internal XMLHttpRequest Error"),D.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var fe={headers:Z.headers||{},body:Z.body,responseUrl:K.responseURL,responseType:K.responseType},I=g.responseInterceptorsStorage.execute(D.requestType,fe);Z.body=I.body,Z.headers=I.headers}return G(ee,Z,Z.body)}}var K=D.xhr||null;K||(D.cors||D.useXDR?K=new g.XDomainRequest:K=new g.XMLHttpRequest);var O,re,k=K.url=D.uri||D.url,j=K.method=D.method||"GET",te=D.body||D.data,V=K.headers=D.headers||{},ne=!!D.sync,he=!1,ae,z={body:void 0,headers:{},statusCode:0,method:j,url:k,rawRequest:K};if("json"in D&&D.json!==!1&&(he=!0,V.accept||V.Accept||(V.Accept="application/json"),j!=="GET"&&j!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),te=JSON.stringify(D.json===!0?te:D.json))),K.onreadystatechange=Y,K.onload=Q,K.onerror=se,K.onprogress=function(){},K.onabort=function(){re=!0,clearTimeout(D.retryTimeout)},K.ontimeout=se,K.open(j,k,!ne,D.username,D.password),ne||(K.withCredentials=!!D.withCredentials),!ne&&D.timeout>0&&(ae=setTimeout(function(){if(!re){re=!0,K.abort("timeout");var P=new Error("XMLHttpRequest timeout");P.code="ETIMEDOUT",se(P)}},D.timeout)),K.setRequestHeader)for(O in V)V.hasOwnProperty(O)&&K.setRequestHeader(O,V[O]);else if(D.headers&&!h(D.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in D&&(K.responseType=D.responseType),"beforeSend"in D&&typeof D.beforeSend=="function"&&D.beforeSend(K),K.send(te||null),K}function S(D){try{if(D.responseType==="document")return D.responseXML;var R=D.responseXML&&D.responseXML.documentElement.nodeName==="parsererror";if(D.responseType===""&&!R)return D.responseXML}catch{}return null}function C(){}return Kh.exports}var z3=U3();const Iw=Du(z3);var Hm={exports:{}},qm,s2;function $3(){if(s2)return qm;s2=1;var n=Lw(),e=Object.create||(function(){function k(){}return function(j){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return k.prototype=j,new k}})();function t(k,j){this.name="ParsingError",this.code=k.code,this.message=j||k.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(k){function j(V,ne,he,ae){return(V|0)*3600+(ne|0)*60+(he|0)+(ae|0)/1e3}var te=k.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return te?te[3]?j(te[1],te[2],te[3].replace(":",""),te[4]):te[1]>59?j(te[1],te[2],0,te[4]):j(0,te[1],te[2],te[4]):null}function a(){this.values=e(null)}a.prototype={set:function(k,j){!this.get(k)&&j!==""&&(this.values[k]=j)},get:function(k,j,te){return te?this.has(k)?this.values[k]:j[te]:this.has(k)?this.values[k]:j},has:function(k){return k in this.values},alt:function(k,j,te){for(var V=0;V<te.length;++V)if(j===te[V]){this.set(k,j);break}},integer:function(k,j){/^-?\d+$/.test(j)&&this.set(k,parseInt(j,10))},percent:function(k,j){return j.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(j=parseFloat(j),j>=0&&j<=100)?(this.set(k,j),!0):!1}};function l(k,j,te,V){var ne=V?k.split(V):[k];for(var he in ne)if(typeof ne[he]=="string"){var ae=ne[he].split(te);if(ae.length===2){var z=ae[0].trim(),P=ae[1].trim();j(z,P)}}}function u(k,j,te){var V=k;function ne(){var z=i(k);if(z===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return k=k.replace(/^[^\sa-zA-Z-]+/,""),z}function he(z,P){var Z=new a;l(z,function(ee,fe){switch(ee){case"region":for(var I=te.length-1;I>=0;I--)if(te[I].id===fe){Z.set(ee,te[I].region);break}break;case"vertical":Z.alt(ee,fe,["rl","lr"]);break;case"line":var pe=fe.split(","),ke=pe[0];Z.integer(ee,ke),Z.percent(ee,ke)&&Z.set("snapToLines",!1),Z.alt(ee,ke,["auto"]),pe.length===2&&Z.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=fe.split(","),Z.percent(ee,pe[0]),pe.length===2&&Z.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":Z.percent(ee,fe);break;case"align":Z.alt(ee,fe,["start","center","end","left","right"]);break}},/:/,/\s/),P.region=Z.get("region",null),P.vertical=Z.get("vertical","");try{P.line=Z.get("line","auto")}catch{}P.lineAlign=Z.get("lineAlign","start"),P.snapToLines=Z.get("snapToLines",!0),P.size=Z.get("size",100);try{P.align=Z.get("align","center")}catch{P.align=Z.get("align","middle")}try{P.position=Z.get("position","auto")}catch{P.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},P.align)}P.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},P.align)}function ae(){k=k.replace(/^\s+/,"")}if(ae(),j.startTime=ne(),ae(),k.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);k=k.substr(3),ae(),j.endTime=ne(),ae(),he(k,j)}var h=n.createElement&&n.createElement("textarea"),f={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},g={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},_={v:"title",lang:"lang"},S={rt:"ruby"};function C(k,j){function te(){if(!j)return null;function ke(me){return j=j.substr(me.length),me}var ye=j.match(/^([^<]*)(<[^>]*>?)?/);return ke(ye[1]?ye[1]:ye[2])}function V(ke){return h.innerHTML=ke,ke=h.textContent,h.textContent="",ke}function ne(ke,ye){return!S[ye.localName]||S[ye.localName]===ke.localName}function he(ke,ye){var me=f[ke];if(!me)return null;var pt=k.document.createElement(me),We=_[ke];return We&&ye&&(pt[We]=ye.trim()),pt}for(var ae=k.document.createElement("div"),z=ae,P,Z=[];(P=te())!==null;){if(P[0]==="<"){if(P[1]==="/"){Z.length&&Z[Z.length-1]===P.substr(2).replace(">","")&&(Z.pop(),z=z.parentNode);continue}var ee=i(P.substr(1,P.length-2)),fe;if(ee){fe=k.document.createProcessingInstruction("timestamp",ee),z.appendChild(fe);continue}var I=P.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!I||(fe=he(I[1],I[3]),!fe)||!ne(z,fe))continue;if(I[2]){var pe=I[2].split(".");pe.forEach(function(ke){var ye=/^bg_/.test(ke),me=ye?ke.slice(3):ke;if(g.hasOwnProperty(me)){var pt=ye?"background-color":"color",We=g[me];fe.style[pt]=We}}),fe.className=pe.join(" ")}Z.push(I[1]),z.appendChild(fe),z=fe;continue}z.appendChild(k.document.createTextNode(V(P)))}return ae}var D=[[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 R(k){for(var j=0;j<D.length;j++){var te=D[j];if(k>=te[0]&&k<=te[1])return!0}return!1}function E(k){var j=[],te="",V;if(!k||!k.childNodes)return"ltr";function ne(z,P){for(var Z=P.childNodes.length-1;Z>=0;Z--)z.push(P.childNodes[Z])}function he(z){if(!z||!z.length)return null;var P=z.pop(),Z=P.textContent||P.innerText;if(Z){var ee=Z.match(/^.*(\n|\r)/);return ee?(z.length=0,ee[0]):Z}if(P.tagName==="ruby")return he(z);if(P.childNodes)return ne(z,P),he(z)}for(ne(j,k);te=he(j);)for(var ae=0;ae<te.length;ae++)if(V=te.charCodeAt(ae),R(V))return"rtl";return"ltr"}function B(k){if(typeof k.line=="number"&&(k.snapToLines||k.line>=0&&k.line<=100))return k.line;if(!k.track||!k.track.textTrackList||!k.track.textTrackList.mediaElement)return-1;for(var j=k.track,te=j.textTrackList,V=0,ne=0;ne<te.length&&te[ne]!==j;ne++)te[ne].mode==="showing"&&V++;return++V*-1}function G(){}G.prototype.applyStyles=function(k,j){j=j||this.div;for(var te in k)k.hasOwnProperty(te)&&(j.style[te]=k[te])},G.prototype.formatStyle=function(k,j){return k===0?0:k+j};function Y(k,j,te){G.call(this),this.cue=j,this.cueDiv=C(k,j.text);var V={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:j.vertical===""?"horizontal-tb":j.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(V,this.cueDiv),this.div=k.document.createElement("div"),V={direction:E(this.cueDiv),writingMode:j.vertical===""?"horizontal-tb":j.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:j.align==="middle"?"center":j.align,font:te.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(V),this.div.appendChild(this.cueDiv);var ne=0;switch(j.positionAlign){case"start":case"line-left":ne=j.position;break;case"center":ne=j.position-j.size/2;break;case"end":case"line-right":ne=j.position-j.size;break}j.vertical===""?this.applyStyles({left:this.formatStyle(ne,"%"),width:this.formatStyle(j.size,"%")}):this.applyStyles({top:this.formatStyle(ne,"%"),height:this.formatStyle(j.size,"%")}),this.move=function(he){this.applyStyles({top:this.formatStyle(he.top,"px"),bottom:this.formatStyle(he.bottom,"px"),left:this.formatStyle(he.left,"px"),right:this.formatStyle(he.right,"px"),height:this.formatStyle(he.height,"px"),width:this.formatStyle(he.width,"px")})}}Y.prototype=e(G.prototype),Y.prototype.constructor=Y;function q(k){var j,te,V,ne;if(k.div){te=k.div.offsetHeight,V=k.div.offsetWidth,ne=k.div.offsetTop;var he=(he=k.div.childNodes)&&(he=he[0])&&he.getClientRects&&he.getClientRects();k=k.div.getBoundingClientRect(),j=he?Math.max(he[0]&&he[0].height||0,k.height/he.length):0}this.left=k.left,this.right=k.right,this.top=k.top||ne,this.height=k.height||te,this.bottom=k.bottom||ne+(k.height||te),this.width=k.width||V,this.lineHeight=j!==void 0?j:k.lineHeight}q.prototype.move=function(k,j){switch(j=j!==void 0?j:this.lineHeight,k){case"+x":this.left+=j,this.right+=j;break;case"-x":this.left-=j,this.right-=j;break;case"+y":this.top+=j,this.bottom+=j;break;case"-y":this.top-=j,this.bottom-=j;break}},q.prototype.overlaps=function(k){return this.left<k.right&&this.right>k.left&&this.top<k.bottom&&this.bottom>k.top},q.prototype.overlapsAny=function(k){for(var j=0;j<k.length;j++)if(this.overlaps(k[j]))return!0;return!1},q.prototype.within=function(k){return this.top>=k.top&&this.bottom<=k.bottom&&this.left>=k.left&&this.right<=k.right},q.prototype.overlapsOppositeAxis=function(k,j){switch(j){case"+x":return this.left<k.left;case"-x":return this.right>k.right;case"+y":return this.top<k.top;case"-y":return this.bottom>k.bottom}},q.prototype.intersectPercentage=function(k){var j=Math.max(0,Math.min(this.right,k.right)-Math.max(this.left,k.left)),te=Math.max(0,Math.min(this.bottom,k.bottom)-Math.max(this.top,k.top)),V=j*te;return V/(this.height*this.width)},q.prototype.toCSSCompatValues=function(k){return{top:this.top-k.top,bottom:k.bottom-this.bottom,left:this.left-k.left,right:k.right-this.right,height:this.height,width:this.width}},q.getSimpleBoxPosition=function(k){var j=k.div?k.div.offsetHeight:k.tagName?k.offsetHeight:0,te=k.div?k.div.offsetWidth:k.tagName?k.offsetWidth:0,V=k.div?k.div.offsetTop:k.tagName?k.offsetTop:0;k=k.div?k.div.getBoundingClientRect():k.tagName?k.getBoundingClientRect():k;var ne={left:k.left,right:k.right,top:k.top||V,height:k.height||j,bottom:k.bottom||V+(k.height||j),width:k.width||te};return ne};function se(k,j,te,V){function ne(me,pt){for(var We,_e=new q(me),Ye=1,wt=0;wt<pt.length;wt++){for(;me.overlapsOppositeAxis(te,pt[wt])||me.within(te)&&me.overlapsAny(V);)me.move(pt[wt]);if(me.within(te))return me;var je=me.intersectPercentage(te);Ye>je&&(We=new q(me),Ye=je),me=new q(_e)}return We||_e}var he=new q(j),ae=j.cue,z=B(ae),P=[];if(ae.snapToLines){var Z;switch(ae.vertical){case"":P=["+y","-y"],Z="height";break;case"rl":P=["+x","-x"],Z="width";break;case"lr":P=["-x","+x"],Z="width";break}var ee=he.lineHeight,fe=ee*Math.round(z),I=te[Z]+ee,pe=P[0];Math.abs(fe)>I&&(fe=fe<0?-1:1,fe*=Math.ceil(I/ee)*ee),z<0&&(fe+=ae.vertical===""?te.height:te.width,P=P.reverse()),he.move(pe,fe)}else{var ke=he.lineHeight/te.height*100;switch(ae.lineAlign){case"center":z-=ke/2;break;case"end":z-=ke;break}switch(ae.vertical){case"":j.applyStyles({top:j.formatStyle(z,"%")});break;case"rl":j.applyStyles({left:j.formatStyle(z,"%")});break;case"lr":j.applyStyles({right:j.formatStyle(z,"%")});break}P=["+y","-x","+x","-y"],he=new q(j)}var ye=ne(he,P);j.move(ye.toCSSCompatValues(te))}function Q(){}Q.StringDecoder=function(){return{decode:function(k){if(!k)return"";if(typeof k!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(k))}}},Q.convertCueToDOMTree=function(k,j){return!k||!j?null:C(k,j)};var K=.05,O="sans-serif",re="1.5%";return Q.processCues=function(k,j,te){if(!k||!j||!te)return null;for(;te.firstChild;)te.removeChild(te.firstChild);var V=k.document.createElement("div");V.style.position="absolute",V.style.left="0",V.style.right="0",V.style.top="0",V.style.bottom="0",V.style.margin=re,te.appendChild(V);function ne(ee){for(var fe=0;fe<ee.length;fe++)if(ee[fe].hasBeenReset||!ee[fe].displayState)return!0;return!1}if(!ne(j)){for(var he=0;he<j.length;he++)V.appendChild(j[he].displayState);return}var ae=[],z=q.getSimpleBoxPosition(V),P=Math.round(z.height*K*100)/100,Z={font:P+"px "+O};(function(){for(var ee,fe,I=0;I<j.length;I++)fe=j[I],ee=new Y(k,fe,Z),V.appendChild(ee.div),se(k,ee,z,ae),fe.displayState=ee.div,ae.push(q.getSimpleBoxPosition(ee))})()},Q.Parser=function(k,j,te){te||(te=j,j={}),j||(j={}),this.window=k,this.vttjs=j,this.state="INITIAL",this.buffer="",this.decoder=te||new TextDecoder("utf8"),this.regionList=[]},Q.Parser.prototype={reportOrThrowError:function(k){if(k instanceof t)this.onparsingerror&&this.onparsingerror(k);else throw k},parse:function(k){var j=this;k&&(j.buffer+=j.decoder.decode(k,{stream:!0}));function te(){for(var ee=j.buffer,fe=0;fe<ee.length&&ee[fe]!=="\r"&&ee[fe]!==`
|
||
`;)++fe;var I=ee.substr(0,fe);return ee[fe]==="\r"&&++fe,ee[fe]===`
|
||
`&&++fe,j.buffer=ee.substr(fe),I}function V(ee){var fe=new a;if(l(ee,function(pe,ke){switch(pe){case"id":fe.set(pe,ke);break;case"width":fe.percent(pe,ke);break;case"lines":fe.integer(pe,ke);break;case"regionanchor":case"viewportanchor":var ye=ke.split(",");if(ye.length!==2)break;var me=new a;if(me.percent("x",ye[0]),me.percent("y",ye[1]),!me.has("x")||!me.has("y"))break;fe.set(pe+"X",me.get("x")),fe.set(pe+"Y",me.get("y"));break;case"scroll":fe.alt(pe,ke,["up"]);break}},/=/,/\s/),fe.has("id")){var I=new(j.vttjs.VTTRegion||j.window.VTTRegion);I.width=fe.get("width",100),I.lines=fe.get("lines",3),I.regionAnchorX=fe.get("regionanchorX",0),I.regionAnchorY=fe.get("regionanchorY",100),I.viewportAnchorX=fe.get("viewportanchorX",0),I.viewportAnchorY=fe.get("viewportanchorY",100),I.scroll=fe.get("scroll",""),j.onregion&&j.onregion(I),j.regionList.push({id:fe.get("id"),region:I})}}function ne(ee){var fe=new a;l(ee,function(I,pe){switch(I){case"MPEGT":fe.integer(I+"S",pe);break;case"LOCA":fe.set(I+"L",i(pe));break}},/[^\d]:/,/,/),j.ontimestampmap&&j.ontimestampmap({MPEGTS:fe.get("MPEGTS"),LOCAL:fe.get("LOCAL")})}function he(ee){ee.match(/X-TIMESTAMP-MAP/)?l(ee,function(fe,I){fe==="X-TIMESTAMP-MAP"&&ne(I)},/=/):l(ee,function(fe,I){fe==="Region"&&V(I)},/:/)}try{var ae;if(j.state==="INITIAL"){if(!/\r\n|\n/.test(j.buffer))return this;ae=te();var z=ae.match(/^WEBVTT([ \t].*)?$/);if(!z||!z[0])throw new t(t.Errors.BadSignature);j.state="HEADER"}for(var P=!1;j.buffer;){if(!/\r\n|\n/.test(j.buffer))return this;switch(P?P=!1:ae=te(),j.state){case"HEADER":/:/.test(ae)?he(ae):ae||(j.state="ID");continue;case"NOTE":ae||(j.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(ae)){j.state="NOTE";break}if(!ae)continue;j.cue=new(j.vttjs.VTTCue||j.window.VTTCue)(0,0,"");try{j.cue.align="center"}catch{j.cue.align="middle"}if(j.state="CUE",ae.indexOf("-->")===-1){j.cue.id=ae;continue}case"CUE":try{u(ae,j.cue,j.regionList)}catch(ee){j.reportOrThrowError(ee),j.cue=null,j.state="BADCUE";continue}j.state="CUETEXT";continue;case"CUETEXT":var Z=ae.indexOf("-->")!==-1;if(!ae||Z&&(P=!0)){j.oncue&&j.oncue(j.cue),j.cue=null,j.state="ID";continue}j.cue.text&&(j.cue.text+=`
|
||
`),j.cue.text+=ae.replace(/\u2028/g,`
|
||
`).replace(/u2029/g,`
|
||
`);continue;case"BADCUE":ae||(j.state="ID");continue}}}catch(ee){j.reportOrThrowError(ee),j.state==="CUETEXT"&&j.cue&&j.oncue&&j.oncue(j.cue),j.cue=null,j.state=j.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var k=this;try{if(k.buffer+=k.decoder.decode(),(k.cue||k.state==="HEADER")&&(k.buffer+=`
|
||
|
||
`,k.parse()),k.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(j){k.reportOrThrowError(j)}return k.onflush&&k.onflush(),this}},qm=Q,qm}var Vm,a2;function H3(){if(a2)return Vm;a2=1;var n="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(u){if(typeof u!="string")return!1;var h=e[u.toLowerCase()];return h?u.toLowerCase():!1}function a(u){if(typeof u!="string")return!1;var h=t[u.toLowerCase()];return h?u.toLowerCase():!1}function l(u,h,f){this.hasBeenReset=!1;var g="",_=!1,S=u,C=h,D=f,R=null,E="",B=!0,G="auto",Y="start",q="auto",se="auto",Q=100,K="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(O){g=""+O}},pauseOnExit:{enumerable:!0,get:function(){return _},set:function(O){_=!!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 C},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");C=O,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return D},set:function(O){D=""+O,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return R},set:function(O){R=O,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return E},set:function(O){var re=i(O);if(re===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");E=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 G},set:function(O){if(typeof O!="number"&&O!==n)throw new SyntaxError("Line: an invalid number or illegal string was specified.");G=O,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return Y},set:function(O){var re=a(O);re?(Y=re,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return q},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");q=O,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return se},set:function(O){var re=a(O);re?(se=re,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return Q},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");Q=O,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return K},set:function(O){var re=a(O);if(!re)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");K=re,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Vm=l,Vm}var Gm,o2;function q3(){if(o2)return Gm;o2=1;var n={"":!0,up:!0};function e(a){if(typeof a!="string")return!1;var l=n[a.toLowerCase()];return l?a.toLowerCase():!1}function t(a){return typeof a=="number"&&a>=0&&a<=100}function i(){var a=100,l=3,u=0,h=100,f=0,g=100,_="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(S){if(!t(S))throw new Error("Width must be between 0 and 100.");a=S}},lines:{enumerable:!0,get:function(){return l},set:function(S){if(typeof S!="number")throw new TypeError("Lines must be set to a number.");l=S}},regionAnchorY:{enumerable:!0,get:function(){return h},set:function(S){if(!t(S))throw new Error("RegionAnchorX must be between 0 and 100.");h=S}},regionAnchorX:{enumerable:!0,get:function(){return u},set:function(S){if(!t(S))throw new Error("RegionAnchorY must be between 0 and 100.");u=S}},viewportAnchorY:{enumerable:!0,get:function(){return g},set:function(S){if(!t(S))throw new Error("ViewportAnchorY must be between 0 and 100.");g=S}},viewportAnchorX:{enumerable:!0,get:function(){return f},set:function(S){if(!t(S))throw new Error("ViewportAnchorX must be between 0 and 100.");f=S}},scroll:{enumerable:!0,get:function(){return _},set:function(S){var C=e(S);C===!1?console.warn("Scroll: an invalid or illegal string was specified."):_=C}}})}return Gm=i,Gm}var l2;function V3(){if(l2)return Hm.exports;l2=1;var n=i0(),e=Hm.exports={WebVTT:$3(),VTTCue:H3(),VTTRegion:q3()};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(),Hm.exports}var G3=V3();const u2=Du(G3);function Xi(){return Xi=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},Xi.apply(null,arguments)}var c2="https://example.com",r0=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=ue.location&&ue.location.href||"");var i=/^\/\//.test(e),a=!ue.location&&!/\/\//i.test(e);e=new ue.URL(e,ue.location||c2);var l=new URL(t,e);return a?l.href.slice(c2.length):i?l.href.slice(l.protocol.length):l.href},xy=(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})(),K3=function(e){return ue.atob?ue.atob(e):Buffer.from(e,"base64").toString("binary")};function Bw(n){for(var e=K3(n),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class W3 extends xy{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 X3=" ",Km=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},Y3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Sr=function(n){const e={};if(!n)return e;const t=n.split(Y3());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},d2=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 Q3 extends xy{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=Xi(Km(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=Sr(t[1]);u.URI&&(i.uri=u.URI),u.BYTERANGE&&(i.byterange=Km(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=Sr(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=d2(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=Sr(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=Sr(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=Sr(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=Sr(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(X3)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=Sr(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=Km(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=Sr(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=Sr(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=Sr(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=Sr(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=Sr(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=Sr(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=Sr(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=d2(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=Sr(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 Z3=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),po=function(n){const e={};return Object.keys(n).forEach(function(t){e[Z3(t)]=n[t]}),e},Wm=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 J3 extends xy{constructor(e={}){super(),this.lineStream=new W3,this.parseStream=new Q3,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:{}},_="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let S=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let C=0,D=0;const R={};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(E){let B,G;if(t.manifest.definitions){for(const Y in t.manifest.definitions)if(E.uri&&(E.uri=E.uri.replace(`{$${Y}}`,t.manifest.definitions[Y])),E.attributes)for(const q in E.attributes)typeof E.attributes[q]=="string"&&(E.attributes[q]=E.attributes[q].replace(`{$${Y}}`,t.manifest.definitions[Y]))}({tag(){({version(){E.version&&(this.manifest.version=E.version)},"allow-cache"(){this.manifest.allowCache=E.allowed,"allowed"in E||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in E&&(a.byterange=Y,Y.length=E.length,"offset"in E||(E.offset=C)),"offset"in E&&(a.byterange=Y,Y.offset=E.offset),C=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),E.title&&(a.title=E.title),E.duration>0&&(a.duration=E.duration),E.duration===0&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!E.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(E.attributes.METHOD==="NONE"){u=null;return}if(!E.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(E.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:E.attributes};return}if(E.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:E.attributes.URI};return}if(E.attributes.KEYFORMAT===_){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(E.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(E.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),E.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(E.attributes.KEYID&&E.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:E.attributes.KEYFORMAT,keyId:E.attributes.KEYID.substring(2)},pssh:Bw(E.attributes.URI.split(",")[1])};return}E.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),u={method:E.attributes.METHOD||"AES-128",uri:E.attributes.URI},typeof E.attributes.IV<"u"&&(u.iv=E.attributes.IV)},"media-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+E.number});return}this.manifest.mediaSequence=E.number},"discontinuity-sequence"(){if(!isFinite(E.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+E.number});return}this.manifest.discontinuitySequence=E.number,S=E.number},"playlist-type"(){if(!/VOD|EVENT/.test(E.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+E.playlist});return}this.manifest.playlistType=E.playlistType},map(){l={},E.uri&&(l.uri=E.uri),E.byterange&&(l.byterange=E.byterange),u&&(l.key=u)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||g,!E.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}a.attributes||(a.attributes={}),Xi(a.attributes,E.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||g,!(E.attributes&&E.attributes.TYPE&&E.attributes["GROUP-ID"]&&E.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[E.attributes.TYPE];Y[E.attributes["GROUP-ID"]]=Y[E.attributes["GROUP-ID"]]||{},B=Y[E.attributes["GROUP-ID"]],G={default:/yes/i.test(E.attributes.DEFAULT)},G.default?G.autoselect=!0:G.autoselect=/yes/i.test(E.attributes.AUTOSELECT),E.attributes.LANGUAGE&&(G.language=E.attributes.LANGUAGE),E.attributes.URI&&(G.uri=E.attributes.URI),E.attributes["INSTREAM-ID"]&&(G.instreamId=E.attributes["INSTREAM-ID"]),E.attributes.CHARACTERISTICS&&(G.characteristics=E.attributes.CHARACTERISTICS),E.attributes.FORCED&&(G.forced=/yes/i.test(E.attributes.FORCED)),B[E.attributes.NAME]=G},discontinuity(){S+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=E.dateTimeString,this.manifest.dateTimeObject=E.dateTimeObject),a.dateTimeString=E.dateTimeString,a.dateTimeObject=E.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(E.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight((q,se)=>(se.programDateTime=q-se.duration*1e3,se.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(E.duration)||E.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+E.duration});return}this.manifest.targetDuration=E.duration,Wm.call(this,this.manifest)},start(){if(!E.attributes||isNaN(E.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:E.attributes["TIME-OFFSET"],precise:E.attributes.PRECISE}},"cue-out"(){a.cueOut=E.data},"cue-out-cont"(){a.cueOutCont=E.data},"cue-in"(){a.cueIn=E.data},skip(){this.manifest.skip=po(E.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",E.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const Y=this.manifest.segments.length,q=po(E.attributes);a.parts=a.parts||[],a.parts.push(q),q.byterange&&(q.byterange.hasOwnProperty("offset")||(q.byterange.offset=D),D=q.byterange.offset+q.byterange.length);const se=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${se} for segment #${Y}`,E.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Q,K)=>{Q.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${K} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=po(E.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Wm.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,q=po(E.attributes),se=q.type&&q.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(q),q.byterange&&(q.byterange.hasOwnProperty("offset")||(q.byterange.offset=se?D:0,se&&(D=q.byterange.offset+q.byterange.length)));const Q=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Q} for segment #${Y}`,E.attributes,["TYPE","URI"]),!!q.type)for(let K=0;K<a.preloadHints.length-1;K++){const O=a.preloadHints[K];O.type&&O.type===q.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${Q} for segment #${Y} has the same TYPE ${q.type} as preload hint #${K}`})}},"rendition-report"(){const Y=po(E.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(Y);const q=this.manifest.renditionReports.length-1,se=["LAST-MSN","URI"];h&&se.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${q}`,E.attributes,se)},"part-inf"(){this.manifest.partInf=po(E.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",E.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Wm.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(po(E.attributes));const Y=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${Y}`,E.attributes,["ID","START-DATE"]);const q=this.manifest.dateRanges[Y];q.endDate&&q.startDate&&new Date(q.endDate)<new Date(q.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),q.duration&&q.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),q.plannedDuration&&q.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const se=!!q.endOnNext;if(se&&!q.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),se&&(q.duration||q.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),q.duration&&q.endDate){const K=q.startDate.getTime()+q.duration*1e3;this.manifest.dateRanges[Y].endDate=new Date(K)}if(!R[q.id])R[q.id]=q;else{for(const K in R[q.id])if(q[K]&&JSON.stringify(R[q.id][K])!==JSON.stringify(q[K])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const Q=this.manifest.dateRanges.findIndex(K=>K.id===q.id);this.manifest.dateRanges[Q]=Xi(this.manifest.dateRanges[Q],q),R[q.id]=Xi(R[q.id],q),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=po(E.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",E.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(q,se)=>{if(q in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${q}`});return}this.manifest.definitions[q]=se};if("QUERYPARAM"in E.attributes){if("NAME"in E.attributes||"IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const q=this.params.get(E.attributes.QUERYPARAM);if(!q){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${E.attributes.QUERYPARAM}`});return}Y(E.attributes.QUERYPARAM,decodeURIComponent(q));return}if("NAME"in E.attributes){if("IMPORT"in E.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in E.attributes)||typeof E.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${E.attributes.NAME}`});return}Y(E.attributes.NAME,E.attributes.VALUE);return}if("IMPORT"in E.attributes){if(!this.mainDefinitions[E.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${E.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(E.attributes.IMPORT,this.mainDefinitions[E.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:E.attributes,uri:E.uri,timeline:S}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",E.attributes,["BANDWIDTH","URI"])}}[E.tagType]||f).call(t)},uri(){a.uri=E.uri,i.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),u&&(a.key=u),a.timeline=S,l&&(a.map=l),D=0,this.lastProgramDateTime!==null&&(a.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=a.duration*1e3),a={}},comment(){},custom(){E.segment?(a.custom=a.custom||{},a.custom[E.customType]=E.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[E.customType]=E.data)}})[E.type].call(t)})}requiredCompatibilityversion(e,t){(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^/},eD=["video","audio","text"],h2=["Video","Audio","Text"],Pw=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})},Ws=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(a){a=a.trim();var l;eD.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},tD=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 Ws(l.playlists[0].attributes.CODECS)}return null},Fw=function(e){return e===void 0&&(e=""),dl.audio.test(e.trim().toLowerCase())},nD=function(e){return e===void 0&&(e=""),dl.text.test(e.trim().toLowerCase())},_u=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(l){return Pw(l.trim())}),i="video";t.length===1&&Fw(t[0])?i="audio":t.length===1&&nD(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+'"'}},nd=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),ue.MediaSource&&ue.MediaSource.isTypeSupported&&ue.MediaSource.isTypeSupported(_u(e))||t&&ue.ManagedMediaSource&&ue.ManagedMediaSource.isTypeSupported&&ue.ManagedMediaSource.isTypeSupported(_u(e))||!1},Xm=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<h2.length;i++){var a=h2[i];if(dl["muxer"+a].test(t))return!0}return!1})},f2="mp4a.40.2",iD="avc1.4d400d",rD=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,sD=/^application\/dash\+xml/i,Uw=function(e){return rD.test(e)?"hls":sD.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},aD=function(e){return e.toString(2).length},oD=function(e){return Math.ceil(aD(e)/8)},zw=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},lD=function(e){return zw(e)},tn=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!lD(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))},mr=ue.BigInt||Number,Bg=[mr("0x1"),mr("0x100"),mr("0x10000"),mr("0x1000000"),mr("0x100000000"),mr("0x10000000000"),mr("0x1000000000000"),mr("0x100000000000000"),mr("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 uD=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=tn(e);var f=h?"reduce":"reduceRight",g=e[f]?e[f]:Array.prototype[f],_=g.call(e,function(C,D,R){var E=h?R:Math.abs(R+1-e.length);return C+mr(D)*Bg[E]},mr(0));if(l){var S=Bg[e.length]/mr(2)-mr(1);_=mr(_),_>S&&(_-=S,_-=S,_-=mr(2))}return Number(_)},cD=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=mr(e);for(var u=oD(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/Bg[f]&mr(255)),e<0&&(h[g]=Math.abs(~h[g]),h[g]-=f===0?1:2)}return h},$w=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},dD=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 tn(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=tn(h),l.set(h,u),u+=h.byteLength}),l},Di=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=tn(e),t=tn(t);var g=t.every?t.every:Array.prototype.every;return t.length&&e.length-u>=t.length&&g.call(t,function(_,S){var C=f[S]?f[S]&e[u+S]:e[u+S];return _===C})},hD=function(e,t,i){t.forEach(function(a){for(var l in e.mediaGroups[a])for(var u in e.mediaGroups[a][l]){var h=e.mediaGroups[a][l][u];i(h,a,l,u)}})},Ic={},wa={},Zo={},p2;function s0(){if(p2)return Zo;p2=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 Zo.assign=t,Zo.find=n,Zo.freeze=e,Zo.MIME_TYPE=i,Zo.NAMESPACE=a,Zo}var m2;function Hw(){if(m2)return wa;m2=1;var n=s0(),e=n.find,t=n.NAMESPACE;function i(N){return N!==""}function a(N){return N?N.split(/[\t\n\f\r ]+/).filter(i):[]}function l(N,F){return N.hasOwnProperty(F)||(N[F]=!0),N}function u(N){if(!N)return[];var F=a(N);return Object.keys(F.reduce(l,{}))}function h(N){return function(F){return N&&N.indexOf(F)!==-1}}function f(N,F){for(var ie in N)Object.prototype.hasOwnProperty.call(N,ie)&&(F[ie]=N[ie])}function g(N,F){var ie=N.prototype;if(!(ie instanceof F)){let He=function(){};var Me=He;He.prototype=F.prototype,He=new He,f(ie,He),N.prototype=ie=He}ie.constructor!=N&&(typeof N!="function"&&console.error("unknown Class:"+N),ie.constructor=N)}var _={},S=_.ELEMENT_NODE=1,C=_.ATTRIBUTE_NODE=2,D=_.TEXT_NODE=3,R=_.CDATA_SECTION_NODE=4,E=_.ENTITY_REFERENCE_NODE=5,B=_.ENTITY_NODE=6,G=_.PROCESSING_INSTRUCTION_NODE=7,Y=_.COMMENT_NODE=8,q=_.DOCUMENT_NODE=9,se=_.DOCUMENT_TYPE_NODE=10,Q=_.DOCUMENT_FRAGMENT_NODE=11,K=_.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 k=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 j=O.NOT_FOUND_ERR=(re[8]="Not found",8);O.NOT_SUPPORTED_ERR=(re[9]="Not supported",9);var te=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 V(N,F){if(F instanceof Error)var ie=F;else ie=this,Error.call(this,re[N]),this.message=re[N],Error.captureStackTrace&&Error.captureStackTrace(this,V);return ie.code=N,F&&(this.message=this.message+": "+F),ie}V.prototype=Error.prototype,f(O,V);function ne(){}ne.prototype={length:0,item:function(N){return N>=0&&N<this.length?this[N]:null},toString:function(N,F){for(var ie=[],Me=0;Me<this.length;Me++)yn(this[Me],ie,N,F);return ie.join("")},filter:function(N){return Array.prototype.filter.call(this,N)},indexOf:function(N){return Array.prototype.indexOf.call(this,N)}};function he(N,F){this._node=N,this._refresh=F,ae(this)}function ae(N){var F=N._node._inc||N._node.ownerDocument._inc;if(N._inc!==F){var ie=N._refresh(N._node);if(Bn(N,"length",ie.length),!N.$$length||ie.length<N.$$length)for(var Me=ie.length;Me in N;Me++)Object.prototype.hasOwnProperty.call(N,Me)&&delete N[Me];f(ie,N),N._inc=F}}he.prototype.item=function(N){return ae(this),this[N]||null},g(he,ne);function z(){}function P(N,F){for(var ie=N.length;ie--;)if(N[ie]===F)return ie}function Z(N,F,ie,Me){if(Me?F[P(F,Me)]=ie:F[F.length++]=ie,N){ie.ownerElement=N;var He=N.ownerDocument;He&&(Me&&pt(He,N,Me),me(He,N,ie))}}function ee(N,F,ie){var Me=P(F,ie);if(Me>=0){for(var He=F.length-1;Me<He;)F[Me]=F[++Me];if(F.length=He,N){var gt=N.ownerDocument;gt&&(pt(gt,N,ie),ie.ownerElement=null)}}else throw new V(j,new Error(N.tagName+"@"+ie))}z.prototype={length:0,item:ne.prototype.item,getNamedItem:function(N){for(var F=this.length;F--;){var ie=this[F];if(ie.nodeName==N)return ie}},setNamedItem:function(N){var F=N.ownerElement;if(F&&F!=this._ownerElement)throw new V(te);var ie=this.getNamedItem(N.nodeName);return Z(this._ownerElement,this,N,ie),ie},setNamedItemNS:function(N){var F=N.ownerElement,ie;if(F&&F!=this._ownerElement)throw new V(te);return ie=this.getNamedItemNS(N.namespaceURI,N.localName),Z(this._ownerElement,this,N,ie),ie},removeNamedItem:function(N){var F=this.getNamedItem(N);return ee(this._ownerElement,this,F),F},removeNamedItemNS:function(N,F){var ie=this.getNamedItemNS(N,F);return ee(this._ownerElement,this,ie),ie},getNamedItemNS:function(N,F){for(var ie=this.length;ie--;){var Me=this[ie];if(Me.localName==F&&Me.namespaceURI==N)return Me}return null}};function fe(){}fe.prototype={hasFeature:function(N,F){return!0},createDocument:function(N,F,ie){var Me=new ye;if(Me.implementation=this,Me.childNodes=new ne,Me.doctype=ie||null,ie&&Me.appendChild(ie),F){var He=Me.createElementNS(N,F);Me.appendChild(He)}return Me},createDocumentType:function(N,F,ie){var Me=new Pe;return Me.name=N,Me.nodeName=N,Me.publicId=F||"",Me.systemId=ie||"",Me}};function I(){}I.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(N,F){return Ie(this,N,F)},replaceChild:function(N,F){Ie(this,N,F,Ge),F&&this.removeChild(F)},removeChild:function(N){return _e(this,N)},appendChild:function(N){return this.insertBefore(N,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(N){return kt(this.ownerDocument||this,this,N)},normalize:function(){for(var N=this.firstChild;N;){var F=N.nextSibling;F&&F.nodeType==D&&N.nodeType==D?(this.removeChild(F),N.appendData(F.data)):(N.normalize(),N=F)}},isSupported:function(N,F){return this.ownerDocument.implementation.hasFeature(N,F)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(N){for(var F=this;F;){var ie=F._nsMap;if(ie){for(var Me in ie)if(Object.prototype.hasOwnProperty.call(ie,Me)&&ie[Me]===N)return Me}F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},lookupNamespaceURI:function(N){for(var F=this;F;){var ie=F._nsMap;if(ie&&Object.prototype.hasOwnProperty.call(ie,N))return ie[N];F=F.nodeType==C?F.ownerDocument:F.parentNode}return null},isDefaultNamespace:function(N){var F=this.lookupPrefix(N);return F==null}};function pe(N){return N=="<"&&"<"||N==">"&&">"||N=="&"&&"&"||N=='"'&&"""||"&#"+N.charCodeAt()+";"}f(_,I),f(_,I.prototype);function ke(N,F){if(F(N))return!0;if(N=N.firstChild)do if(ke(N,F))return!0;while(N=N.nextSibling)}function ye(){this.ownerDocument=this}function me(N,F,ie){N&&N._inc++;var Me=ie.namespaceURI;Me===t.XMLNS&&(F._nsMap[ie.prefix?ie.localName:""]=ie.value)}function pt(N,F,ie,Me){N&&N._inc++;var He=ie.namespaceURI;He===t.XMLNS&&delete F._nsMap[ie.prefix?ie.localName:""]}function We(N,F,ie){if(N&&N._inc){N._inc++;var Me=F.childNodes;if(ie)Me[Me.length++]=ie;else{for(var He=F.firstChild,gt=0;He;)Me[gt++]=He,He=He.nextSibling;Me.length=gt,delete Me[Me.length]}}}function _e(N,F){var ie=F.previousSibling,Me=F.nextSibling;return ie?ie.nextSibling=Me:N.firstChild=Me,Me?Me.previousSibling=ie:N.lastChild=ie,F.parentNode=null,F.previousSibling=null,F.nextSibling=null,We(N.ownerDocument,N),F}function Ye(N){return N&&(N.nodeType===I.DOCUMENT_NODE||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.ELEMENT_NODE)}function wt(N){return N&&(Se(N)||Je(N)||je(N)||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.COMMENT_NODE||N.nodeType===I.PROCESSING_INSTRUCTION_NODE)}function je(N){return N&&N.nodeType===I.DOCUMENT_TYPE_NODE}function Se(N){return N&&N.nodeType===I.ELEMENT_NODE}function Je(N){return N&&N.nodeType===I.TEXT_NODE}function tt(N,F){var ie=N.childNodes||[];if(e(ie,Se)||je(F))return!1;var Me=e(ie,je);return!(F&&Me&&ie.indexOf(Me)>ie.indexOf(F))}function ot(N,F){var ie=N.childNodes||[];function Me(gt){return Se(gt)&>!==F}if(e(ie,Me))return!1;var He=e(ie,je);return!(F&&He&&ie.indexOf(He)>ie.indexOf(F))}function dt(N,F,ie){if(!Ye(N))throw new V(k,"Unexpected parent node type "+N.nodeType);if(ie&&ie.parentNode!==N)throw new V(j,"child not in parent");if(!wt(F)||je(F)&&N.nodeType!==I.DOCUMENT_NODE)throw new V(k,"Unexpected node type "+F.nodeType+" for parent node type "+N.nodeType)}function Ut(N,F,ie){var Me=N.childNodes||[],He=F.childNodes||[];if(F.nodeType===I.DOCUMENT_FRAGMENT_NODE){var gt=He.filter(Se);if(gt.length>1||e(He,Je))throw new V(k,"More than one element or text in fragment");if(gt.length===1&&!tt(N,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(Se(F)&&!tt(N,ie))throw new V(k,"Only one element can be added and only after doctype");if(je(F)){if(e(Me,je))throw new V(k,"Only one doctype is allowed");var zt=e(Me,Se);if(ie&&Me.indexOf(zt)<Me.indexOf(ie))throw new V(k,"Doctype can only be inserted before an element");if(!ie&&zt)throw new V(k,"Doctype can not be appended since element is present")}}function Ge(N,F,ie){var Me=N.childNodes||[],He=F.childNodes||[];if(F.nodeType===I.DOCUMENT_FRAGMENT_NODE){var gt=He.filter(Se);if(gt.length>1||e(He,Je))throw new V(k,"More than one element or text in fragment");if(gt.length===1&&!ot(N,ie))throw new V(k,"Element in fragment can not be inserted before doctype")}if(Se(F)&&!ot(N,ie))throw new V(k,"Only one element can be added and only after doctype");if(je(F)){let un=function(Xt){return je(Xt)&&Xt!==ie};var Jt=un;if(e(Me,un))throw new V(k,"Only one doctype is allowed");var zt=e(Me,Se);if(ie&&Me.indexOf(zt)<Me.indexOf(ie))throw new V(k,"Doctype can only be inserted before an element")}}function Ie(N,F,ie,Me){dt(N,F,ie),N.nodeType===I.DOCUMENT_NODE&&(Me||Ut)(N,F,ie);var He=F.parentNode;if(He&&He.removeChild(F),F.nodeType===Q){var gt=F.firstChild;if(gt==null)return F;var zt=F.lastChild}else gt=zt=F;var Jt=ie?ie.previousSibling:N.lastChild;gt.previousSibling=Jt,zt.nextSibling=ie,Jt?Jt.nextSibling=gt:N.firstChild=gt,ie==null?N.lastChild=zt:ie.previousSibling=zt;do{gt.parentNode=N;var un=N.ownerDocument||N;Ze(gt,un)}while(gt!==zt&&(gt=gt.nextSibling));return We(N.ownerDocument||N,N),F.nodeType==Q&&(F.firstChild=F.lastChild=null),F}function Ze(N,F){if(N.ownerDocument!==F){if(N.ownerDocument=F,N.nodeType===S&&N.attributes)for(var ie=0;ie<N.attributes.length;ie++){var Me=N.attributes.item(ie);Me&&(Me.ownerDocument=F)}for(var He=N.firstChild;He;)Ze(He,F),He=He.nextSibling}}function et(N,F){F.parentNode&&F.parentNode.removeChild(F),F.parentNode=N,F.previousSibling=N.lastChild,F.nextSibling=null,F.previousSibling?F.previousSibling.nextSibling=F:N.firstChild=F,N.lastChild=F,We(N.ownerDocument,N,F);var ie=N.ownerDocument||N;return Ze(F,ie),F}ye.prototype={nodeName:"#document",nodeType:q,doctype:null,documentElement:null,_inc:1,insertBefore:function(N,F){if(N.nodeType==Q){for(var ie=N.firstChild;ie;){var Me=ie.nextSibling;this.insertBefore(ie,F),ie=Me}return N}return Ie(this,N,F),Ze(N,this),this.documentElement===null&&N.nodeType===S&&(this.documentElement=N),N},removeChild:function(N){return this.documentElement==N&&(this.documentElement=null),_e(this,N)},replaceChild:function(N,F){Ie(this,N,F,Ge),Ze(N,this),F&&this.removeChild(F),Se(N)&&(this.documentElement=N)},importNode:function(N,F){return $n(this,N,F)},getElementById:function(N){var F=null;return ke(this.documentElement,function(ie){if(ie.nodeType==S&&ie.getAttribute("id")==N)return F=ie,!0}),F},getElementsByClassName:function(N){var F=u(N);return new he(this,function(ie){var Me=[];return F.length>0&&ke(ie.documentElement,function(He){if(He!==ie&&He.nodeType===S){var gt=He.getAttribute("class");if(gt){var zt=N===gt;if(!zt){var Jt=u(gt);zt=F.every(h(Jt))}zt&&Me.push(He)}}}),Me})},createElement:function(N){var F=new ft;F.ownerDocument=this,F.nodeName=N,F.tagName=N,F.localName=N,F.childNodes=new ne;var ie=F.attributes=new z;return ie._ownerElement=F,F},createDocumentFragment:function(){var N=new Tt;return N.ownerDocument=this,N.childNodes=new ne,N},createTextNode:function(N){var F=new ze;return F.ownerDocument=this,F.appendData(N),F},createComment:function(N){var F=new Le;return F.ownerDocument=this,F.appendData(N),F},createCDATASection:function(N){var F=new Ae;return F.ownerDocument=this,F.appendData(N),F},createProcessingInstruction:function(N,F){var ie=new an;return ie.ownerDocument=this,ie.tagName=ie.nodeName=ie.target=N,ie.nodeValue=ie.data=F,ie},createAttribute:function(N){var F=new mt;return F.ownerDocument=this,F.name=N,F.nodeName=N,F.localName=N,F.specified=!0,F},createEntityReference:function(N){var F=new Ot;return F.ownerDocument=this,F.nodeName=N,F},createElementNS:function(N,F){var ie=new ft,Me=F.split(":"),He=ie.attributes=new z;return ie.childNodes=new ne,ie.ownerDocument=this,ie.nodeName=F,ie.tagName=F,ie.namespaceURI=N,Me.length==2?(ie.prefix=Me[0],ie.localName=Me[1]):ie.localName=F,He._ownerElement=ie,ie},createAttributeNS:function(N,F){var ie=new mt,Me=F.split(":");return ie.ownerDocument=this,ie.nodeName=F,ie.name=F,ie.namespaceURI=N,ie.specified=!0,Me.length==2?(ie.prefix=Me[0],ie.localName=Me[1]):ie.localName=F,ie}},g(ye,I);function ft(){this._nsMap={}}ft.prototype={nodeType:S,hasAttribute:function(N){return this.getAttributeNode(N)!=null},getAttribute:function(N){var F=this.getAttributeNode(N);return F&&F.value||""},getAttributeNode:function(N){return this.attributes.getNamedItem(N)},setAttribute:function(N,F){var ie=this.ownerDocument.createAttribute(N);ie.value=ie.nodeValue=""+F,this.setAttributeNode(ie)},removeAttribute:function(N){var F=this.getAttributeNode(N);F&&this.removeAttributeNode(F)},appendChild:function(N){return N.nodeType===Q?this.insertBefore(N,null):et(this,N)},setAttributeNode:function(N){return this.attributes.setNamedItem(N)},setAttributeNodeNS:function(N){return this.attributes.setNamedItemNS(N)},removeAttributeNode:function(N){return this.attributes.removeNamedItem(N.nodeName)},removeAttributeNS:function(N,F){var ie=this.getAttributeNodeNS(N,F);ie&&this.removeAttributeNode(ie)},hasAttributeNS:function(N,F){return this.getAttributeNodeNS(N,F)!=null},getAttributeNS:function(N,F){var ie=this.getAttributeNodeNS(N,F);return ie&&ie.value||""},setAttributeNS:function(N,F,ie){var Me=this.ownerDocument.createAttributeNS(N,F);Me.value=Me.nodeValue=""+ie,this.setAttributeNode(Me)},getAttributeNodeNS:function(N,F){return this.attributes.getNamedItemNS(N,F)},getElementsByTagName:function(N){return new he(this,function(F){var ie=[];return ke(F,function(Me){Me!==F&&Me.nodeType==S&&(N==="*"||Me.tagName==N)&&ie.push(Me)}),ie})},getElementsByTagNameNS:function(N,F){return new he(this,function(ie){var Me=[];return ke(ie,function(He){He!==ie&&He.nodeType===S&&(N==="*"||He.namespaceURI===N)&&(F==="*"||He.localName==F)&&Me.push(He)}),Me})}},ye.prototype.getElementsByTagName=ft.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=ft.prototype.getElementsByTagNameNS,g(ft,I);function mt(){}mt.prototype.nodeType=C,g(mt,I);function de(){}de.prototype={data:"",substringData:function(N,F){return this.data.substring(N,N+F)},appendData:function(N){N=this.data+N,this.nodeValue=this.data=N,this.length=N.length},insertData:function(N,F){this.replaceData(N,0,F)},appendChild:function(N){throw new Error(re[k])},deleteData:function(N,F){this.replaceData(N,F,"")},replaceData:function(N,F,ie){var Me=this.data.substring(0,N),He=this.data.substring(N+F);ie=Me+ie+He,this.nodeValue=this.data=ie,this.length=ie.length}},g(de,I);function ze(){}ze.prototype={nodeName:"#text",nodeType:D,splitText:function(N){var F=this.data,ie=F.substring(N);F=F.substring(0,N),this.data=this.nodeValue=F,this.length=F.length;var Me=this.ownerDocument.createTextNode(ie);return this.parentNode&&this.parentNode.insertBefore(Me,this.nextSibling),Me}},g(ze,de);function Le(){}Le.prototype={nodeName:"#comment",nodeType:Y},g(Le,de);function Ae(){}Ae.prototype={nodeName:"#cdata-section",nodeType:R},g(Ae,de);function Pe(){}Pe.prototype.nodeType=se,g(Pe,I);function Qe(){}Qe.prototype.nodeType=K,g(Qe,I);function St(){}St.prototype.nodeType=B,g(St,I);function Ot(){}Ot.prototype.nodeType=E,g(Ot,I);function Tt(){}Tt.prototype.nodeName="#document-fragment",Tt.prototype.nodeType=Q,g(Tt,I);function an(){}an.prototype.nodeType=G,g(an,I);function Nt(){}Nt.prototype.serializeToString=function(N,F,ie){return Lt.call(N,F,ie)},I.prototype.toString=Lt;function Lt(N,F){var ie=[],Me=this.nodeType==9&&this.documentElement||this,He=Me.prefix,gt=Me.namespaceURI;if(gt&&He==null){var He=Me.lookupPrefix(gt);if(He==null)var zt=[{namespace:gt,prefix:null}]}return yn(this,ie,N,F,zt),ie.join("")}function vt(N,F,ie){var Me=N.prefix||"",He=N.namespaceURI;if(!He||Me==="xml"&&He===t.XML||He===t.XMLNS)return!1;for(var gt=ie.length;gt--;){var zt=ie[gt];if(zt.prefix===Me)return zt.namespace!==He}return!0}function It(N,F,ie){N.push(" ",F,'="',ie.replace(/[<>&"\t\n\r]/g,pe),'"')}function yn(N,F,ie,Me,He){if(He||(He=[]),Me)if(N=Me(N),N){if(typeof N=="string"){F.push(N);return}}else return;switch(N.nodeType){case S:var gt=N.attributes,zt=gt.length,Rt=N.firstChild,Jt=N.tagName;ie=t.isHTML(N.namespaceURI)||ie;var un=Jt;if(!ie&&!N.prefix&&N.namespaceURI){for(var Xt,pn=0;pn<gt.length;pn++)if(gt.item(pn).name==="xmlns"){Xt=gt.item(pn).value;break}if(!Xt)for(var fn=He.length-1;fn>=0;fn--){var Kt=He[fn];if(Kt.prefix===""&&Kt.namespace===N.namespaceURI){Xt=Kt.namespace;break}}if(Xt!==N.namespaceURI)for(var fn=He.length-1;fn>=0;fn--){var Kt=He[fn];if(Kt.namespace===N.namespaceURI){Kt.prefix&&(un=Kt.prefix+":"+Jt);break}}}F.push("<",un);for(var cn=0;cn<zt;cn++){var dn=gt.item(cn);dn.prefix=="xmlns"?He.push({prefix:dn.localName,namespace:dn.value}):dn.nodeName=="xmlns"&&He.push({prefix:"",namespace:dn.value})}for(var cn=0;cn<zt;cn++){var dn=gt.item(cn);if(vt(dn,ie,He)){var ln=dn.prefix||"",qt=dn.namespaceURI;It(F,ln?"xmlns:"+ln:"xmlns",qt),He.push({prefix:ln,namespace:qt})}yn(dn,F,ie,Me,He)}if(Jt===un&&vt(N,ie,He)){var ln=N.prefix||"",qt=N.namespaceURI;It(F,ln?"xmlns:"+ln:"xmlns",qt),He.push({prefix:ln,namespace:qt})}if(Rt||ie&&!/^(?:meta|link|img|br|hr|input)$/i.test(Jt)){if(F.push(">"),ie&&/^script$/i.test(Jt))for(;Rt;)Rt.data?F.push(Rt.data):yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;else for(;Rt;)yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;F.push("</",un,">")}else F.push("/>");return;case q:case Q:for(var Rt=N.firstChild;Rt;)yn(Rt,F,ie,Me,He.slice()),Rt=Rt.nextSibling;return;case C:return It(F,N.name,N.value);case D:return F.push(N.data.replace(/[<&>]/g,pe));case R:return F.push("<![CDATA[",N.data,"]]>");case Y:return F.push("<!--",N.data,"-->");case se:var Dt=N.publicId,Cn=N.systemId;if(F.push("<!DOCTYPE ",N.name),Dt)F.push(" PUBLIC ",Dt),Cn&&Cn!="."&&F.push(" ",Cn),F.push(">");else if(Cn&&Cn!=".")F.push(" SYSTEM ",Cn,">");else{var Mt=N.internalSubset;Mt&&F.push(" [",Mt,"]"),F.push(">")}return;case G:return F.push("<?",N.target," ",N.data,"?>");case E:return F.push("&",N.nodeName,";");default:F.push("??",N.nodeName)}}function $n(N,F,ie){var Me;switch(F.nodeType){case S:Me=F.cloneNode(!1),Me.ownerDocument=N;case Q:break;case C:ie=!0;break}if(Me||(Me=F.cloneNode(!1)),Me.ownerDocument=N,Me.parentNode=null,ie)for(var He=F.firstChild;He;)Me.appendChild($n(N,He,ie)),He=He.nextSibling;return Me}function kt(N,F,ie){var Me=new F.constructor;for(var He in F)if(Object.prototype.hasOwnProperty.call(F,He)){var gt=F[He];typeof gt!="object"&>!=Me[He]&&(Me[He]=gt)}switch(F.childNodes&&(Me.childNodes=new ne),Me.ownerDocument=N,Me.nodeType){case S:var zt=F.attributes,Jt=Me.attributes=new z,un=zt.length;Jt._ownerElement=Me;for(var Xt=0;Xt<un;Xt++)Me.setAttributeNode(kt(N,zt.item(Xt),!0));break;case C:ie=!0}if(ie)for(var pn=F.firstChild;pn;)Me.appendChild(kt(N,pn,ie)),pn=pn.nextSibling;return Me}function Bn(N,F,ie){N[F]=ie}try{if(Object.defineProperty){let N=function(F){switch(F.nodeType){case S:case Q:var ie=[];for(F=F.firstChild;F;)F.nodeType!==7&&F.nodeType!==8&&ie.push(N(F)),F=F.nextSibling;return ie.join("");default:return F.nodeValue}};var at=N;Object.defineProperty(he.prototype,"length",{get:function(){return ae(this),this.$$length}}),Object.defineProperty(I.prototype,"textContent",{get:function(){return N(this)},set:function(F){switch(this.nodeType){case S:case Q:for(;this.firstChild;)this.removeChild(this.firstChild);(F||String(F))&&this.appendChild(this.ownerDocument.createTextNode(F));break;default:this.data=F,this.value=F,this.nodeValue=F}}}),Bn=function(F,ie,Me){F["$$"+ie]=Me}}}catch{}return wa.DocumentType=Pe,wa.DOMException=V,wa.DOMImplementation=fe,wa.Element=ft,wa.Node=I,wa.NodeList=ne,wa.XMLSerializer=Nt,wa}var Bc={},Ym={},g2;function fD(){return g2||(g2=1,(function(n){var e=s0().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})(Ym)),Ym}var Wh={},y2;function pD(){if(y2)return Wh;y2=1;var n=s0().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),a=0,l=1,u=2,h=3,f=4,g=5,_=6,S=7;function C(k,j){this.message=k,this.locator=j,Error.captureStackTrace&&Error.captureStackTrace(this,C)}C.prototype=new Error,C.prototype.name=C.name;function D(){}D.prototype={parse:function(k,j,te){var V=this.domBuilder;V.startDocument(),se(j,j={}),R(k,j,te,V,this.errorHandler),V.endDocument()}};function R(k,j,te,V,ne){function he(et){if(et>65535){et-=65536;var ft=55296+(et>>10),mt=56320+(et&1023);return String.fromCharCode(ft,mt)}else return String.fromCharCode(et)}function ae(et){var ft=et.slice(1,-1);return Object.hasOwnProperty.call(te,ft)?te[ft]:ft.charAt(0)==="#"?he(parseInt(ft.substr(1).replace("x","0x"))):(ne.error("entity not found:"+et),et)}function z(et){if(et>ye){var ft=k.substring(ye,et).replace(/&#?\w+;/g,ae);I&&P(ye),V.characters(ft,0,et-ye),ye=et}}function P(et,ft){for(;et>=ee&&(ft=fe.exec(k));)Z=ft.index,ee=Z+ft[0].length,I.lineNumber++;I.columnNumber=et-Z+1}for(var Z=0,ee=0,fe=/.*(?:\r\n?|\n)|.*$/g,I=V.locator,pe=[{currentNSMap:j}],ke={},ye=0;;){try{var me=k.indexOf("<",ye);if(me<0){if(!k.substr(ye).match(/^\s*$/)){var pt=V.doc,We=pt.createTextNode(k.substr(ye));pt.appendChild(We),V.currentElement=We}return}switch(me>ye&&z(me),k.charAt(me+1)){case"/":var dt=k.indexOf(">",me+3),_e=k.substring(me+2,dt).replace(/[ \t\n\r]+$/g,""),Ye=pe.pop();dt<0?(_e=k.substring(me+2).replace(/[\s<].*/,""),ne.error("end tag name: "+_e+" is not complete:"+Ye.tagName),dt=me+1+_e.length):_e.match(/\s</)&&(_e=_e.replace(/[\s<].*/,""),ne.error("end tag name: "+_e+" maybe not complete"),dt=me+1+_e.length);var wt=Ye.localNSMap,je=Ye.tagName==_e,Se=je||Ye.tagName&&Ye.tagName.toLowerCase()==_e.toLowerCase();if(Se){if(V.endElement(Ye.uri,Ye.localName,_e),wt)for(var Je in wt)Object.prototype.hasOwnProperty.call(wt,Je)&&V.endPrefixMapping(Je);je||ne.fatalError("end tag name: "+_e+" is not match the current start tagName:"+Ye.tagName)}else pe.push(Ye);dt++;break;case"?":I&&P(me),dt=K(k,me,V);break;case"!":I&&P(me),dt=Q(k,me,V,ne);break;default:I&&P(me);var tt=new O,ot=pe[pe.length-1].currentNSMap,dt=B(k,me,tt,ot,ae,ne),Ut=tt.length;if(!tt.closed&&q(k,dt,tt.tagName,ke)&&(tt.closed=!0,te.nbsp||ne.warning("unclosed xml attribute")),I&&Ut){for(var Ge=E(I,{}),Ie=0;Ie<Ut;Ie++){var Ze=tt[Ie];P(Ze.offset),Ze.locator=E(I,{})}V.locator=Ge,G(tt,V,ot)&&pe.push(tt),V.locator=I}else G(tt,V,ot)&&pe.push(tt);n.isHTML(tt.uri)&&!tt.closed?dt=Y(k,dt,tt.tagName,ae,V):dt++}}catch(et){if(et instanceof C)throw et;ne.error("element parse error: "+et),dt=-1}dt>ye?ye=dt:z(Math.max(me,ye)+1)}}function E(k,j){return j.lineNumber=k.lineNumber,j.columnNumber=k.columnNumber,j}function B(k,j,te,V,ne,he){function ae(I,pe,ke){te.attributeNames.hasOwnProperty(I)&&he.fatalError("Attribute "+I+" redefined"),te.addValue(I,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,ne),ke)}for(var z,P,Z=++j,ee=a;;){var fe=k.charAt(Z);switch(fe){case"=":if(ee===l)z=k.slice(j,Z),ee=h;else if(ee===u)ee=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ee===h||ee===l)if(ee===l&&(he.warning('attribute value must after "="'),z=k.slice(j,Z)),j=Z+1,Z=k.indexOf(fe,j),Z>0)P=k.slice(j,Z),ae(z,P,j-1),ee=g;else throw new Error("attribute value no end '"+fe+"' match");else if(ee==f)P=k.slice(j,Z),ae(z,P,j),he.warning('attribute "'+z+'" missed start quot('+fe+")!!"),j=Z+1,ee=g;else throw new Error('attribute value must after "="');break;case"/":switch(ee){case a:te.setTagName(k.slice(j,Z));case g:case _:case S:ee=S,te.closed=!0;case f:case l:break;case u:te.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return he.error("unexpected end of input"),ee==a&&te.setTagName(k.slice(j,Z)),Z;case">":switch(ee){case a:te.setTagName(k.slice(j,Z));case g:case _:case S:break;case f:case l:P=k.slice(j,Z),P.slice(-1)==="/"&&(te.closed=!0,P=P.slice(0,-1));case u:ee===u&&(P=z),ee==f?(he.warning('attribute "'+P+'" missed quot(")!'),ae(z,P,j)):((!n.isHTML(V[""])||!P.match(/^(?:disabled|checked|selected)$/i))&&he.warning('attribute "'+P+'" missed value!! "'+P+'" instead!!'),ae(P,P,j));break;case h:throw new Error("attribute value missed!!")}return Z;case"":fe=" ";default:if(fe<=" ")switch(ee){case a:te.setTagName(k.slice(j,Z)),ee=_;break;case l:z=k.slice(j,Z),ee=u;break;case f:var P=k.slice(j,Z);he.warning('attribute "'+P+'" missed quot(")!!'),ae(z,P,j);case g:ee=_;break}else switch(ee){case u:te.tagName,(!n.isHTML(V[""])||!z.match(/^(?:disabled|checked|selected)$/i))&&he.warning('attribute "'+z+'" missed value!! "'+z+'" instead2!!'),ae(z,z,j),j=Z,ee=l;break;case g:he.warning('attribute space is required"'+z+'"!!');case _:ee=l,j=Z;break;case h:ee=f,j=Z;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function G(k,j,te){for(var V=k.tagName,ne=null,fe=k.length;fe--;){var he=k[fe],ae=he.qName,z=he.value,I=ae.indexOf(":");if(I>0)var P=he.prefix=ae.slice(0,I),Z=ae.slice(I+1),ee=P==="xmlns"&&Z;else Z=ae,P=null,ee=ae==="xmlns"&&"";he.localName=Z,ee!==!1&&(ne==null&&(ne={},se(te,te={})),te[ee]=ne[ee]=z,he.uri=n.XMLNS,j.startPrefixMapping(ee,z))}for(var fe=k.length;fe--;){he=k[fe];var P=he.prefix;P&&(P==="xml"&&(he.uri=n.XML),P!=="xmlns"&&(he.uri=te[P||""]))}var I=V.indexOf(":");I>0?(P=k.prefix=V.slice(0,I),Z=k.localName=V.slice(I+1)):(P=null,Z=k.localName=V);var pe=k.uri=te[P||""];if(j.startElement(pe,Z,V,k),k.closed){if(j.endElement(pe,Z,V),ne)for(P in ne)Object.prototype.hasOwnProperty.call(ne,P)&&j.endPrefixMapping(P)}else return k.currentNSMap=te,k.localNSMap=ne,!0}function Y(k,j,te,V,ne){if(/^(?:script|textarea)$/i.test(te)){var he=k.indexOf("</"+te+">",j),ae=k.substring(j+1,he);if(/[&<]/.test(ae))return/^script$/i.test(te)?(ne.characters(ae,0,ae.length),he):(ae=ae.replace(/&#?\w+;/g,V),ne.characters(ae,0,ae.length),he)}return j+1}function q(k,j,te,V){var ne=V[te];return ne==null&&(ne=k.lastIndexOf("</"+te+">"),ne<j&&(ne=k.lastIndexOf("</"+te)),V[te]=ne),ne<j}function se(k,j){for(var te in k)Object.prototype.hasOwnProperty.call(k,te)&&(j[te]=k[te])}function Q(k,j,te,V){var ne=k.charAt(j+2);switch(ne){case"-":if(k.charAt(j+3)==="-"){var he=k.indexOf("-->",j+4);return he>j?(te.comment(k,j+4,he-j-4),he+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(j+3,6)=="CDATA["){var he=k.indexOf("]]>",j+9);return te.startCDATA(),te.characters(k,j+9,he-j-9),te.endCDATA(),he+3}var ae=re(k,j),z=ae.length;if(z>1&&/!doctype/i.test(ae[0][0])){var P=ae[1][0],Z=!1,ee=!1;z>3&&(/^public$/i.test(ae[2][0])?(Z=ae[3][0],ee=z>4&&ae[4][0]):/^system$/i.test(ae[2][0])&&(ee=ae[3][0]));var fe=ae[z-1];return te.startDTD(P,Z,ee),te.endDTD(),fe.index+fe[0].length}}return-1}function K(k,j,te){var V=k.indexOf("?>",j);if(V){var ne=k.substring(j,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return ne?(ne[0].length,te.processingInstruction(ne[1],ne[2]),V+2):-1}return-1}function O(){this.attributeNames={}}O.prototype={setTagName:function(k){if(!i.test(k))throw new Error("invalid tagName:"+k);this.tagName=k},addValue:function(k,j,te){if(!i.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:j,offset:te}},length:0,getLocalName:function(k){return this[k].localName},getLocator:function(k){return this[k].locator},getQName:function(k){return this[k].qName},getURI:function(k){return this[k].uri},getValue:function(k){return this[k].value}};function re(k,j){var te,V=[],ne=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(ne.lastIndex=j,ne.exec(k);te=ne.exec(k);)if(V.push(te),te[1])return V}return Wh.XMLReader=D,Wh.ParseError=C,Wh}var b2;function mD(){if(b2)return Bc;b2=1;var n=s0(),e=Hw(),t=fD(),i=pD(),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,G){var Y=this.options,q=new h,se=Y.domBuilder||new S,Q=Y.errorHandler,K=Y.locator,O=Y.xmlns||{},re=/\/x?html?$/.test(G),k=re?t.HTML_ENTITIES:t.XML_ENTITIES;K&&se.setDocumentLocator(K),q.errorHandler=_(Q,se,K),q.domBuilder=Y.domBuilder||se,re&&(O[""]=l.HTML),O.xml=O.xml||l.XML;var j=Y.normalizeLineEndings||f;return B&&typeof B=="string"?q.parse(j(B),O,k):q.errorHandler.error("invalid doc source"),se.doc};function _(B,G,Y){if(!B){if(G instanceof S)return G;B=G}var q={},se=B instanceof Function;Y=Y||{};function Q(K){var O=B[K];!O&&se&&(O=B.length==2?function(re){B(K,re)}:B),q[K]=O&&function(re){O("[xmldom "+K+"] "+re+D(Y))}||function(){}}return Q("warning"),Q("error"),Q("fatalError"),q}function S(){this.cdata=!1}function C(B,G){G.lineNumber=B.lineNumber,G.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,G,Y,q){var se=this.doc,Q=se.createElementNS(B,Y||G),K=q.length;E(this,Q),this.currentElement=Q,this.locator&&C(this.locator,Q);for(var O=0;O<K;O++){var B=q.getURI(O),re=q.getValue(O),Y=q.getQName(O),k=se.createAttributeNS(B,Y);this.locator&&C(q.getLocator(O),k),k.value=k.nodeValue=re,Q.setAttributeNode(k)}},endElement:function(B,G,Y){var q=this.currentElement;q.tagName,this.currentElement=q.parentNode},startPrefixMapping:function(B,G){},endPrefixMapping:function(B){},processingInstruction:function(B,G){var Y=this.doc.createProcessingInstruction(B,G);this.locator&&C(this.locator,Y),E(this,Y)},ignorableWhitespace:function(B,G,Y){},characters:function(B,G,Y){if(B=R.apply(this,arguments),B){if(this.cdata)var q=this.doc.createCDATASection(B);else var q=this.doc.createTextNode(B);this.currentElement?this.currentElement.appendChild(q):/^\s*$/.test(B)&&this.doc.appendChild(q),this.locator&&C(this.locator,q)}},skippedEntity:function(B){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(B){(this.locator=B)&&(B.lineNumber=0)},comment:function(B,G,Y){B=R.apply(this,arguments);var q=this.doc.createComment(B);this.locator&&C(this.locator,q),E(this,q)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(B,G,Y){var q=this.doc.implementation;if(q&&q.createDocumentType){var se=q.createDocumentType(B,G,Y);this.locator&&C(this.locator,se),E(this,se),this.doc.doctype=se}},warning:function(B){console.warn("[xmldom warning] "+B,D(this.locator))},error:function(B){console.error("[xmldom error] "+B,D(this.locator))},fatalError:function(B){throw new u(B,this.locator)}};function D(B){if(B)return`
|
||
@`+(B.systemId||"")+"#[line:"+B.lineNumber+",col:"+B.columnNumber+"]"}function R(B,G,Y){return typeof B=="string"?B.substr(G,Y):B.length>=G+Y||G?new java.lang.String(B,G,Y)+"":B}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(B){S.prototype[B]=function(){return null}});function E(B,G){B.currentElement?B.currentElement.appendChild(G):B.doc.appendChild(G)}return Bc.__DOMHandler=S,Bc.normalizeLineEndings=f,Bc.DOMParser=g,Bc}var v2;function gD(){if(v2)return Ic;v2=1;var n=Hw();return Ic.DOMImplementation=n.DOMImplementation,Ic.XMLSerializer=n.XMLSerializer,Ic.DOMParser=mD().DOMParser,Ic}var yD=gD();const x2=n=>!!n&&typeof n=="object",lr=(...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]):x2(e[i])&&x2(t[i])?e[i]=lr(e[i],t[i]):e[i]=t[i]}),e),{}),qw=n=>Object.keys(n).map(e=>n[e]),bD=(n,e)=>{const t=[];for(let i=n;i<e;i++)t.push(i);return t},wu=n=>n.reduce((e,t)=>e.concat(t),[]),Vw=n=>{if(!n.length)return[];const e=[];for(let t=0;t<n.length;t++)e.push(n[t]);return e},vD=(n,e)=>n.reduce((t,i,a)=>(i[e]&&t.push(a),t),[]),xD=(n,e)=>qw(n.reduce((t,i)=>(i.forEach(a=>{t[e(a)]=a}),t),{}));var Tu={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const hd=({baseUrl:n="",source:e="",range:t="",indexRange:i=""})=>{const a={uri:e,resolvedUri:r0(n||"",e)};if(t||i){const u=(t||i).split("-");let h=ue.BigInt?ue.BigInt(u[0]):parseInt(u[0],10),f=ue.BigInt?ue.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=ue.BigInt(f)-ue.BigInt(h)+ue.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},_D=n=>{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ue.BigInt(n.offset)+ue.BigInt(n.length)-ue.BigInt(1):e=n.offset+n.length-1,`${n.offset}-${e}`},_2=n=>(n&&typeof n!="number"&&(n=parseInt(n,10)),isNaN(n)?null:n),wD={static(n){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:a}=n,l=_2(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=_2(n.endNumber),_=(e+t)/1e3,S=i+u,D=_+h-S,R=Math.ceil(D*a/l),E=Math.floor((_-S-f)*a/l),B=Math.floor((_-S)*a/l);return{start:Math.max(0,E),end:typeof g=="number"?g:Math.min(R,B)}}},TD=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}},_y=n=>{const{type:e,duration:t,timescale:i=1,periodDuration:a,sourceDuration:l}=n,{start:u,end:h}=wD[e](n),f=bD(u,h).map(TD(n));if(e==="static"){const g=f.length-1,_=typeof a=="number"?a:l;f[g].duration=_-t/i*g}return f},Gw=n=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:a="",periodStart:l,presentationTime:u,number:h=0,duration:f}=n;if(!e)throw new Error(Tu.NO_BASE_URL);const g=hd({baseUrl:e,source:t.sourceURL,range:t.range}),_=hd({baseUrl:e,source:e,indexRange:a});if(_.map=g,f){const S=_y(n);S.length&&(_.duration=S[0].duration,_.timeline=S[0].timeline)}else i&&(_.duration=i,_.timeline=l);return _.presentationTime=u||l,_.number=h,[_]},wy=(n,e,t)=>{const i=n.sidx.map?n.sidx.map:null,a=n.sidx.duration,l=n.timeline||0,u=n.sidx.byterange,h=u.offset+u.length,f=e.timescale,g=e.references.filter(B=>B.referenceType!==1),_=[],S=n.endList?"static":"dynamic",C=n.sidx.timeline;let D=C,R=n.mediaSequence||0,E;typeof e.firstOffset=="bigint"?E=ue.BigInt(h)+e.firstOffset:E=h+e.firstOffset;for(let B=0;B<g.length;B++){const G=e.references[B],Y=G.referencedSize,q=G.subsegmentDuration;let se;typeof E=="bigint"?se=E+ue.BigInt(Y)-ue.BigInt(1):se=E+Y-1;const Q=`${E}-${se}`,O=Gw({baseUrl:t,timescale:f,timeline:l,periodStart:C,presentationTime:D,number:R,duration:q,sourceDuration:a,indexRange:Q,type:S})[0];i&&(O.map=i),_.push(O),typeof E=="bigint"?E+=ue.BigInt(Y):E+=Y,D+=q/f,R++}return n.segments=_,n},SD=["AUDIO","SUBTITLES"],kD=1/60,Kw=n=>xD(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),ED=(n,e)=>{for(let t=0;t<n.length;t++)if(n[t].attributes.NAME===e)return n[t];return null},w2=n=>{let e=[];return hD(n,SD,(t,i,a,l)=>{e=e.concat(t.playlists||[])}),e},T2=({playlist:n,mediaSequence:e})=>{n.mediaSequence=e,n.segments.forEach((t,i)=>{t.number=n.mediaSequence+i})},CD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=ED(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)<kD});if(u===-1){T2({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--),T2({playlist:i,mediaSequence:a.segments[u].number})})},AD=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(w2(n)),i=e.playlists.concat(w2(e));return e.timelineStarts=Kw([n.timelineStarts,e.timelineStarts]),CD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},a0=n=>n&&n.uri+"-"+_D(n.byterange),Qm=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=qw(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=vD(i.segments||[],"discontinuity"),i))},Ty=(n,e)=>{const t=a0(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&wy(n,i,n.sidx.resolvedUri),n},ND=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=Ty(n[t],e);return n},DD=({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},MD=({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},jD=(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 _=Ty(DD(u,t),e);return l[g].playlists.push(_),typeof i>"u"&&h==="main"&&(i=u,i.default=!0),l},{});if(!i){const l=Object.keys(a)[0];a[l].default=!0}return a},RD=(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(Ty(MD(i),e)),t},{}),OD=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),{}),LD=({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},ID=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",BD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",PD=({attributes:n})=>n.mimeType==="text/vtt"||n.contentType==="text",FD=(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})})},S2=n=>n?Object.keys(n).reduce((e,t)=>{const i=n[t];return e.concat(i.playlists)},[]):[],UD=({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,_=Qm(n.filter(ID)).map(LD),S=Qm(n.filter(BD)),C=Qm(n.filter(PD)),D=n.map(se=>se.attributes.captionServices).filter(Boolean),R={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:ND(_,i)};g>=0&&(R.minimumUpdatePeriod=g*1e3),e&&(R.locations=e),t&&(R.contentSteering=t),h==="dynamic"&&(R.suggestedPresentationDelay=f),l&&l.length>0&&(R.eventStream=l);const E=R.playlists.length===0,B=S.length?jD(S,i,E):null,G=C.length?RD(C,i):null,Y=_.concat(S2(B),S2(G)),q=Y.map(({timelineStarts:se})=>se);return R.timelineStarts=Kw(q),FD(Y,R.timelineStarts),B&&(R.mediaGroups.AUDIO.audio=B),G&&(R.mediaGroups.SUBTITLES.subs=G),D.length&&(R.mediaGroups["CLOSED-CAPTIONS"].cc=OD(D)),a?AD({oldManifest:a,newManifest:R}):R},zD=(n,e,t)=>{const{NOW:i,clientOffset:a,availabilityStartTime:l,timescale:u=1,periodStart:h=0,minimumUpdatePeriod:f=0}=n,g=(i+a)/1e3,_=l+h,C=g+f-_;return Math.ceil((C*u-e)/t)},Ww=(n,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:a="",sourceDuration:l,timescale:u=1,startNumber:h=1,periodStart:f}=n,g=[];let _=-1;for(let S=0;S<e.length;S++){const C=e[S],D=C.d,R=C.r||0,E=C.t||0;_<0&&(_=E),E&&E>_&&(_=E);let B;if(R<0){const q=S+1;q===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=zD(n,_,D):B=(l*u-_)/D:B=(e[q].t-_)/D}else B=R+1;const G=h+g.length+B;let Y=h+g.length;for(;Y<G;)g.push({number:Y,duration:D/u,time:_,timeline:f}),_+=D,Y++}return g},$D=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,HD=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}`},k2=(n,e)=>n.replace($D,HD(e)),qD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?_y(n):Ww(n,e),VD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=hd({baseUrl:n.baseUrl,source:k2(i.sourceURL,t),range:i.range});return qD(n,e).map(u=>{t.Number=u.number,t.Time=u.time;const h=k2(n.media||"",t),f=n.timescale||1,g=n.presentationTimeOffset||0,_=n.periodStart+(u.time-g)/f;return{uri:h,timeline:u.timeline,duration:u.duration,resolvedUri:r0(n.baseUrl||"",h),map:a,number:u.number,presentationTime:_}})},GD=(n,e)=>{const{baseUrl:t,initialization:i={}}=n,a=hd({baseUrl:t,source:i.sourceURL,range:i.range}),l=hd({baseUrl:t,source:e.media,range:e.mediaRange});return l.map=a,l},KD=(n,e)=>{const{duration:t,segmentUrls:i=[],periodStart:a}=n;if(!t&&!e||t&&e)throw new Error(Tu.SEGMENT_TIME_UNSPECIFIED);const l=i.map(f=>GD(n,f));let u;return t&&(u=_y(n)),e&&(u=Ww(n,e)),u.map((f,g)=>{if(l[g]){const _=l[g],S=n.timescale||1,C=n.presentationTimeOffset||0;return _.timeline=f.timeline,_.duration=f.duration,_.number=f.number,_.presentationTime=a+(f.time-C)/S,_}}).filter(f=>f)},WD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=VD,t=lr(n,e.template)):e.base?(i=Gw,t=lr(n,e.base)):e.list&&(i=KD,t=lr(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},XD=n=>n.map(WD),Mi=(n,e)=>Vw(n.childNodes).filter(({tagName:t})=>t===e),_d=n=>n.textContent.trim(),YD=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,_,S,C,D]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(_||0)*86400+parseFloat(S||0)*3600+parseFloat(C||0)*60+parseFloat(D||0)},QD=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),E2={mediaPresentationDuration(n){return Yl(n)},availabilityStartTime(n){return QD(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 YD(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}},tr=n=>n&&n.attributes?Vw(n.attributes).reduce((e,t)=>{const i=E2[t.name]||E2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},ZD={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},o0=(n,e)=>e.length?wu(n.map(function(t){return e.map(function(i){const a=_d(i),l=r0(t.baseUrl,a),u=lr(tr(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Sy=n=>{const e=Mi(n,"SegmentTemplate")[0],t=Mi(n,"SegmentList")[0],i=t&&Mi(t,"SegmentURL").map(S=>lr({tag:"SegmentURL"},tr(S))),a=Mi(n,"SegmentBase")[0],l=t||e,u=l&&Mi(l,"SegmentTimeline")[0],h=t||a||e,f=h&&Mi(h,"Initialization")[0],g=e&&tr(e);g&&f?g.initialization=f&&tr(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const _={template:g,segmentTimeline:u&&Mi(u,"S").map(S=>tr(S)),list:t&&lr(tr(t),{segmentUrls:i,initialization:tr(f)}),base:a&&lr(tr(a),{initialization:tr(f)})};return Object.keys(_).forEach(S=>{_[S]||delete _[S]}),_},JD=(n,e,t)=>i=>{const a=Mi(i,"BaseURL"),l=o0(e,a),u=lr(n,tr(i)),h=Sy(i);return l.map(f=>({segmentInfo:lr(t,h),attributes:lr(u,f)}))},e4=n=>n.reduce((e,t)=>{const i=tr(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=ZD[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Mi(t,"cenc:pssh")[0];if(l){const u=_d(l);e[a].pssh=u&&Bw(u)}}return e},{}),t4=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})},n4=n=>wu(Mi(n.node,"EventStream").map(e=>{const t=tr(e),i=t.schemeIdUri;return Mi(e,"Event").map(a=>{const l=tr(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:_d(a)||l.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),i4=(n,e,t)=>i=>{const a=tr(i),l=o0(e,Mi(i,"BaseURL")),u=Mi(i,"Role")[0],h={role:tr(u)};let f=lr(n,a,h);const g=Mi(i,"Accessibility")[0],_=t4(tr(g));_&&(f=lr(f,{captionServices:_}));const S=Mi(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=lr(f,{label:B})}const C=e4(Mi(i,"ContentProtection"));Object.keys(C).length&&(f=lr(f,{contentProtection:C}));const D=Sy(i),R=Mi(i,"Representation"),E=lr(t,D);return wu(R.map(JD(f,l,E)))},r4=(n,e)=>(t,i)=>{const a=o0(e,Mi(t.node,"BaseURL")),l=lr(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Mi(t.node,"AdaptationSet"),h=Sy(t.node);return wu(u.map(i4(l,a,h)))},s4=(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=lr({serverURL:_d(n[0])},tr(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},a4=({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,o4=(n,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:a=0,eventHandler:l=function(){}}=e,u=Mi(n,"Period");if(!u.length)throw new Error(Tu.INVALID_NUMBER_OF_PERIOD);const h=Mi(n,"Location"),f=tr(n),g=o0([{baseUrl:t}],Mi(n,"BaseURL")),_=Mi(n,"ContentSteering");f.type=f.type||"static",f.sourceDuration=f.mediaPresentationDuration||0,f.NOW=i,f.clientOffset=a,h.length&&(f.locations=h.map(_d));const S=[];return u.forEach((C,D)=>{const R=tr(C),E=S[D-1];R.start=a4({attributes:R,priorPeriodAttributes:E?E.attributes:null,mpdType:f.type}),S.push({node:C,attributes:R})}),{locations:f.locations,contentSteeringInfo:s4(_,l),representationInfo:wu(S.map(r4(f,g))),eventStream:wu(S.map(n4))}},Xw=n=>{if(n==="")throw new Error(Tu.DASH_EMPTY_MANIFEST);const e=new yD.DOMParser;let t,i;try{t=e.parseFromString(n,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Tu.DASH_INVALID_XML);return i},l4=n=>{const e=Mi(n,"UTCTiming")[0];if(!e)return null;const t=tr(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Tu.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},u4=(n,e={})=>{const t=o4(Xw(n),e),i=XD(t.representationInfo);return UD({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},c4=n=>l4(Xw(n));var Zm,C2;function d4(){if(C2)return Zm;C2=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 Zm={getUint64:e,MAX_UINT32:n},Zm}var Jm,A2;function h4(){if(A2)return Jm;A2=1;var n=d4().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 Jm=e,Jm}var f4=h4();const p4=Du(f4);var m4=tn([73,68,51]),g4=function(e,t){t===void 0&&(t=0),e=tn(e);var i=e[t+5],a=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],l=(i&16)>>4;return l?a+20:a+10},Kc=function n(e,t){return t===void 0&&(t=0),e=tn(e),e.length-t<10||!Di(e,m4,{offset:t})?t:(t+=g4(e,t),n(e,t))},N2=function(e){return typeof e=="string"?$w(e):e},y4=function(e){return Array.isArray(e)?e.map(function(t){return N2(t)}):[N2(e)]},b4=function n(e,t,i){i===void 0&&(i=!1),t=y4(t),e=tn(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);Di(h,t[0])&&(t.length===1?a.push(g):a.push.apply(a,n(g,t.slice(1),i))),l=f}return a},Xh={EBML:tn([26,69,223,163]),DocType:tn([66,130]),Segment:tn([24,83,128,103]),SegmentInfo:tn([21,73,169,102]),Tracks:tn([22,84,174,107]),Track:tn([174]),TrackNumber:tn([215]),DefaultDuration:tn([35,227,131]),TrackEntry:tn([174]),TrackType:tn([131]),FlagDefault:tn([136]),CodecID:tn([134]),CodecPrivate:tn([99,162]),VideoTrack:tn([224]),AudioTrack:tn([225]),Cluster:tn([31,67,182,117]),Timestamp:tn([231]),TimestampScale:tn([42,215,177]),BlockGroup:tn([160]),BlockDuration:tn([155]),Block:tn([161]),SimpleBlock:tn([163])},Pg=[128,64,32,16,8,4,2,1],v4=function(e){for(var t=1,i=0;i<Pg.length&&!(e&Pg[i]);i++)t++;return t},Ef=function(e,t,i,a){i===void 0&&(i=!0),a===void 0&&(a=!1);var l=v4(e[t]),u=e.subarray(t,t+l);return i&&(u=Array.prototype.slice.call(e,t,t+l),u[0]^=Pg[l-1]),{length:l,value:uD(u,{signed:a}),bytes:u}},D2=function n(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return n(t)}):typeof e=="number"?cD(e):e},x4=function(e){return Array.isArray(e)?e.map(function(t){return D2(t)}):[D2(e)]},_4=function n(e,t,i){if(i>=t.length)return t.length;var a=Ef(t,i,!1);if(Di(e.bytes,a.bytes))return i;var l=Ef(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},M2=function n(e,t){t=x4(t),e=tn(e);var i=[];if(!t.length)return i;for(var a=0;a<e.length;){var l=Ef(e,a,!1),u=Ef(e,a+l.length),h=a+l.length+u.length;u.value===127&&(u.value=_4(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);Di(t[0],l.bytes)&&(t.length===1?i.push(g):i=i.concat(n(g,t.slice(1))));var _=l.length+u.length+g.length;a+=_}return i},w4=tn([0,0,0,1]),T4=tn([0,0,1]),S4=tn([0,0,3]),k4=function(e){for(var t=[],i=1;i<e.length-2;)Di(e.subarray(i,i+3),S4)&&(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},Yw=function(e,t,i,a){e=tn(e),i=[].concat(i);for(var l=0,u,h=0;l<e.length&&(h<a||u);){var f=void 0;if(Di(e.subarray(l),w4)?f=4:Di(e.subarray(l),T4)&&(f=3),!f){l++;continue}if(h++,u)return k4(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)},E4=function(e,t,i){return Yw(e,"h264",t,i)},C4=function(e,t,i){return Yw(e,"h265",t,i)},kr={webm:tn([119,101,98,109]),matroska:tn([109,97,116,114,111,115,107,97]),flac:tn([102,76,97,67]),ogg:tn([79,103,103,83]),ac3:tn([11,119]),riff:tn([82,73,70,70]),avi:tn([65,86,73]),wav:tn([87,65,86,69]),"3gp":tn([102,116,121,112,51,103]),mp4:tn([102,116,121,112]),fmp4:tn([115,116,121,112]),mov:tn([102,116,121,112,113,116]),moov:tn([109,111,111,118]),moof:tn([109,111,111,102])},Su={aac:function(e){var t=Kc(e);return Di(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Kc(e);return Di(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=M2(e,[Xh.EBML,Xh.DocType])[0];return Di(t,kr.webm)},mkv:function(e){var t=M2(e,[Xh.EBML,Xh.DocType])[0];return Di(t,kr.matroska)},mp4:function(e){if(Su["3gp"](e)||Su.mov(e))return!1;if(Di(e,kr.mp4,{offset:4})||Di(e,kr.fmp4,{offset:4})||Di(e,kr.moof,{offset:4})||Di(e,kr.moov,{offset:4}))return!0},mov:function(e){return Di(e,kr.mov,{offset:4})},"3gp":function(e){return Di(e,kr["3gp"],{offset:4})},ac3:function(e){var t=Kc(e);return Di(e,kr.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=Kc(e);return Di(e,kr.flac,{offset:t})},ogg:function(e){return Di(e,kr.ogg)},avi:function(e){return Di(e,kr.riff)&&Di(e,kr.avi,{offset:8})},wav:function(e){return Di(e,kr.riff)&&Di(e,kr.wav,{offset:8})},h264:function(e){return E4(e,7,3).length},h265:function(e){return C4(e,[32,33],3).length}},Fg=Object.keys(Su).filter(function(n){return n!=="ts"&&n!=="h264"&&n!=="h265"}).concat(["ts","h264","h265"]);Fg.forEach(function(n){var e=Su[n];Su[n]=function(t){return e(tn(t))}});var A4=Su,ky=function(e){e=tn(e);for(var t=0;t<Fg.length;t++){var i=Fg[t];if(A4[i](e))return i}return""},N4=function(e){return b4(e,["moof"]).length>0},eg,j2;function D4(){if(j2)return eg;j2=1;var n=9e4,e,t,i,a,l,u,h;return e=function(f){return f*n},t=function(f,g){return f*g},i=function(f){return f/n},a=function(f,g){return f/g},l=function(f,g){return e(a(f,g))},u=function(f,g){return t(i(f),g)},h=function(f,g,_){return i(_?f:f-g)},eg={ONE_SECOND_IN_TS:n,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:a,audioTsToVideoTs:l,videoTsToAudioTs:u,metadataTsToSeconds:h},eg}var ul=D4();var Ug="8.23.4";const Ca={},Co=function(n,e){return Ca[n]=Ca[n]||[],e&&(Ca[n]=Ca[n].concat(e)),Ca[n]},M4=function(n,e){Co(n,e)},Qw=function(n,e){const t=Co(n).indexOf(e);return t<=-1?!1:(Ca[n]=Ca[n].slice(),Ca[n].splice(t,1),!0)},j4=function(n,e){Co(n,[].concat(e).map(t=>{const i=(...a)=>(Qw(n,i),t(...a));return i}))},Cf={prefixed:!0},hf=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],R2=hf[0];let Wc;for(let n=0;n<hf.length;n++)if(hf[n][1]in _t){Wc=hf[n];break}if(Wc){for(let n=0;n<Wc.length;n++)Cf[R2[n]]=Wc[n];Cf.prefixed=Wc[0]!==R2[0]}let Ur=[];const R4=(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+":"),Ur){Ur.push([].concat(l));const _=Ur.length-1e3;Ur.splice(0,_>0?_:0)}if(!ue.console)return;let g=ue.console[i];!g&&i==="debug"&&(g=ue.console.info||ue.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](ue.console,l)};function zg(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=R4(n,l,t),l.createLogger=(u,h,f)=>{const g=h!==void 0?h:e,_=f!==void 0?f:t,S=`${n} ${g} ${u}`;return zg(S,g,_)},l.createNewLogger=(u,h,f)=>zg(u,h,f),l.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},l.level=u=>{if(typeof u=="string"){if(!l.levels.hasOwnProperty(u))throw new Error(`"${u}" in not a valid log level`);i=u}return i},l.history=()=>Ur?[].concat(Ur):[],l.history.filter=u=>(Ur||[]).filter(h=>new RegExp(`.*${u}.*`).test(h[0])),l.history.clear=()=>{Ur&&(Ur.length=0)},l.history.disable=()=>{Ur!==null&&(Ur.length=0,Ur=null)},l.history.enable=()=>{Ur===null&&(Ur=[])},l.error=(...u)=>a("error",i,u),l.warn=(...u)=>a("warn",i,u),l.debug=(...u)=>a("debug",i,u),l}const En=zg("VIDEOJS"),Zw=En.createLogger,O4=Object.prototype.toString,Jw=function(n){return ta(n)?Object.keys(n):[]};function lu(n,e){Jw(n).forEach(t=>e(n[t],t))}function eT(n,e,t=0){return Jw(n).reduce((i,a)=>e(i,n[a],a),t)}function ta(n){return!!n&&typeof n=="object"}function ku(n){return ta(n)&&O4.call(n)==="[object Object]"&&n.constructor===Object}function pi(...n){const e={};return n.forEach(t=>{t&&lu(t,(i,a)=>{if(!ku(i)){e[a]=i;return}ku(e[a])||(e[a]={}),e[a]=pi(e[a],i)})}),e}function tT(n={}){const e=[];for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];e.push(i)}return e}function l0(n,e,t,i=!0){const a=u=>Object.defineProperty(n,e,{value:u,enumerable:!0,writable:!0}),l={configurable:!0,enumerable:!0,get(){const u=t();return a(u),u}};return i&&(l.set=a),Object.defineProperty(n,e,l)}var L4=Object.freeze({__proto__:null,each:lu,reduce:eT,isObject:ta,isPlain:ku,merge:pi,values:tT,defineLazyProperty:l0});let Ey=!1,nT=null,js=!1,iT,rT=!1,uu=!1,cu=!1,na=!1,Cy=null,u0=null;const I4=!!(ue.cast&&ue.cast.framework&&ue.cast.framework.CastReceiverContext);let sT=null,Af=!1,c0=!1,Nf=!1,d0=!1,Df=!1,Mf=!1,jf=!1;const fd=!!(Mu()&&("ontouchstart"in ue||ue.navigator.maxTouchPoints||ue.DocumentTouch&&ue.document instanceof ue.DocumentTouch)),mo=ue.navigator&&ue.navigator.userAgentData;mo&&mo.platform&&mo.brands&&(js=mo.platform==="Android",uu=!!mo.brands.find(n=>n.brand==="Microsoft Edge"),cu=!!mo.brands.find(n=>n.brand==="Chromium"),na=!uu&&cu,Cy=u0=(mo.brands.find(n=>n.brand==="Chromium")||{}).version||null,c0=mo.platform==="Windows");if(!cu){const n=ue.navigator&&ue.navigator.userAgent||"";Ey=/iPod/i.test(n),nT=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),js=/Android/i.test(n),iT=(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})(),rT=/Firefox/i.test(n),uu=/Edg/i.test(n),cu=/Chrome/i.test(n)||/CriOS/i.test(n),na=!uu&&cu,Cy=u0=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),sT=(function(){const e=/MSIE\s(\d+)\.\d/.exec(n);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(n)&&/rv:11.0/.test(n)&&(t=11),t})(),Df=/Tizen/i.test(n),Mf=/Web0S/i.test(n),jf=Df||Mf,Af=/Safari/i.test(n)&&!na&&!js&&!uu&&!jf,c0=/Windows/i.test(n),Nf=/iPad/i.test(n)||Af&&fd&&!/iPhone/i.test(n),d0=/iPhone/i.test(n)&&!Nf}const vr=d0||Nf||Ey,h0=(Af||vr)&&!na;var aT=Object.freeze({__proto__:null,get IS_IPOD(){return Ey},get IOS_VERSION(){return nT},get IS_ANDROID(){return js},get ANDROID_VERSION(){return iT},get IS_FIREFOX(){return rT},get IS_EDGE(){return uu},get IS_CHROMIUM(){return cu},get IS_CHROME(){return na},get CHROMIUM_VERSION(){return Cy},get CHROME_VERSION(){return u0},IS_CHROMECAST_RECEIVER:I4,get IE_VERSION(){return sT},get IS_SAFARI(){return Af},get IS_WINDOWS(){return c0},get IS_IPAD(){return Nf},get IS_IPHONE(){return d0},get IS_TIZEN(){return Df},get IS_WEBOS(){return Mf},get IS_SMART_TV(){return jf},TOUCH_ENABLED:fd,IS_IOS:vr,IS_ANY_SAFARI:h0});function O2(n){return typeof n=="string"&&!!n.trim()}function B4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Mu(){return _t===ue.document}function ju(n){return ta(n)&&n.nodeType===1}function oT(){try{return ue.parent!==ue.self}catch{return!0}}function lT(n){return function(e,t){if(!O2(e))return _t[n](null);O2(t)&&(t=_t.querySelector(t));const i=ju(t)?t:_t;return i[n]&&i[n](e)}}function on(n="div",e={},t={},i){const a=_t.createElement(n);return Object.getOwnPropertyNames(e).forEach(function(l){const u=e[l];l==="textContent"?No(a,u):(a[l]!==u||l==="tabIndex")&&(a[l]=u)}),Object.getOwnPropertyNames(t).forEach(function(l){a.setAttribute(l,t[l])}),i&&Ay(a,i),a}function No(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function $g(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function id(n,e){return B4(e),n.classList.contains(e)}function hl(n,...e){return n.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n}function f0(n,...e){return n?(n.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n):(En.warn("removeClass was called with an element that doesn't exist"),null)}function uT(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 cT(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 xo(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 dT(n,e){return n.getAttribute(e)}function Eu(n,e,t){n.setAttribute(e,t)}function p0(n,e){n.removeAttribute(e)}function hT(){_t.body.focus(),_t.onselectstart=function(){return!1}}function fT(){_t.onselectstart=function(){return!0}}function Cu(n){if(n&&n.getBoundingClientRect&&n.parentNode){const e=n.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Au(n,"height"))),t.width||(t.width=parseFloat(Au(n,"width"))),t}}function pd(n){if(!n||n&&!n.offsetParent)return{left:0,top:0,width:0,height:0};const e=n.offsetWidth,t=n.offsetHeight;let i=0,a=0;for(;n.offsetParent&&n!==_t[Cf.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function m0(n,e){const t={x:0,y:0};if(vr){let _=n;for(;_&&_.nodeName.toLowerCase()!=="html";){const S=Au(_,"transform");if(/^matrix/.test(S)){const C=S.slice(7,-1).split(/,\s/).map(Number);t.x+=C[4],t.y+=C[5]}else if(/^matrix3d/.test(S)){const C=S.slice(9,-1).split(/,\s/).map(Number);t.x+=C[12],t.y+=C[13]}if(_.assignedSlot&&_.assignedSlot.parentElement&&ue.WebKitCSSMatrix){const C=ue.getComputedStyle(_.assignedSlot.parentElement).transform,D=new ue.WebKitCSSMatrix(C);t.x+=D.m41,t.y+=D.m42}_=_.parentNode||_.host}}const i={},a=pd(e.target),l=pd(n),u=l.width,h=l.height;let f=e.offsetY-(l.top-a.top),g=e.offsetX-(l.left-a.left);return e.changedTouches&&(g=e.changedTouches[0].pageX-l.left,f=e.changedTouches[0].pageY+l.top,vr&&(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 pT(n){return ta(n)&&n.nodeType===3}function g0(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function mT(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),ju(e)||pT(e))return e;if(typeof e=="string"&&/\S/.test(e))return _t.createTextNode(e)}).filter(e=>e)}function Ay(n,e){return mT(e).forEach(t=>n.appendChild(t)),n}function gT(n,e){return Ay(g0(n),e)}function md(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 Ao=lT("querySelector"),yT=lT("querySelectorAll");function Au(n,e){if(!n||!e)return"";if(typeof ue.getComputedStyle=="function"){let t;try{t=ue.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function bT(n){[..._t.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(a=>a.cssText).join(""),i=_t.createElement("style");i.textContent=t,n.document.head.appendChild(i)}catch{const i=_t.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,n.document.head.appendChild(i)}})}var vT=Object.freeze({__proto__:null,isReal:Mu,isEl:ju,isInFrame:oT,createEl:on,textContent:No,prependTo:$g,hasClass:id,addClass:hl,removeClass:f0,toggleClass:uT,setAttributes:cT,getAttributes:xo,getAttribute:dT,setAttribute:Eu,removeAttribute:p0,blockTextSelection:hT,unblockTextSelection:fT,getBoundingClientRect:Cu,findPosition:pd,getPointerPosition:m0,isTextNode:pT,emptyEl:g0,normalizeContent:mT,appendContent:Ay,insertContent:gT,isSingleLeftClick:md,$:Ao,$$:yT,computedStyle:Au,copyStyleSheetsToWindow:bT});let xT=!1,Hg;const P4=function(){if(Hg.options.autoSetup===!1)return;const n=Array.prototype.slice.call(_t.getElementsByTagName("video")),e=Array.prototype.slice.call(_t.getElementsByTagName("audio")),t=Array.prototype.slice.call(_t.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&&Hg(u);else{qg(1);break}}else xT||qg(1)};function qg(n,e){Mu()&&(e&&(Hg=e),ue.setTimeout(P4,n))}function Vg(){xT=!0,ue.removeEventListener("load",Vg)}Mu()&&(_t.readyState==="complete"?Vg():ue.addEventListener("load",Vg));const _T=function(n){const e=_t.createElement("style");return e.className=n,e},wT=function(n,e){n.styleSheet?n.styleSheet.cssText=e:n.textContent=e};var Cr=new WeakMap;const F4=3;let U4=F4;function ys(){return U4++}function L2(n,e){if(!Cr.has(n))return;const t=Cr.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&&Cr.delete(n)}function Ny(n,e,t,i){t.forEach(function(a){n(e,a,i)})}function y0(n){if(n.fixed_)return n;function e(){return!0}function t(){return!1}if(!n||!n.isPropagationStopped||!n.isImmediatePropagationStopped){const i=n||ue.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||_t),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=_t.documentElement,u=_t.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 Yh;const z4=function(){if(typeof Yh!="boolean"){Yh=!1;try{const n=Object.defineProperty({},"passive",{get(){Yh=!0}});ue.addEventListener("test",null,n),ue.removeEventListener("test",null,n)}catch{}}return Yh},$4=["touchstart","touchmove"];function as(n,e,t){if(Array.isArray(e))return Ny(as,n,e,t);Cr.has(n)||Cr.set(n,{});const i=Cr.get(n);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=ys()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(a,l){if(i.disabled)return;a=y0(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(_){En.error(_)}}}),i.handlers[e].length===1)if(n.addEventListener){let a=!1;z4()&&$4.indexOf(e)>-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function xr(n,e,t){if(!Cr.has(n))return;const i=Cr.get(n);if(!i.handlers)return;if(Array.isArray(e))return Ny(xr,n,e,t);const a=function(u,h){i.handlers[h]=[],L2(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);L2(n,e)}}function Ru(n,e,t){const i=Cr.has(n)?Cr.get(n):{},a=n.parentNode||n.ownerDocument;if(typeof e=="string"?e={type:e,target:n}:e.target||(e.target=n),e=y0(e),i.dispatcher&&i.dispatcher.call(n,e,t),a&&!e.isPropagationStopped()&&e.bubbles===!0)Ru.call(null,a,e,t);else if(!a&&!e.defaultPrevented&&e.target&&e.target[e.type]){Cr.has(e.target)||Cr.set(e.target,{});const l=Cr.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 b0(n,e,t){if(Array.isArray(e))return Ny(b0,n,e,t);const i=function(){xr(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),as(n,e,i)}function Dy(n,e,t){const i=function(){xr(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),as(n,e,i)}var H4=Object.freeze({__proto__:null,fixEvent:y0,on:as,off:xr,trigger:Ru,one:b0,any:Dy});const bs=30,_i=function(n,e,t){e.guid||(e.guid=ys());const i=e.bind(n);return i.guid=t?t+"_"+e.guid:e.guid,i},ia=function(n,e){let t=ue.performance.now();return function(...a){const l=ue.performance.now();l-t>=e&&(n(...a),t=l)}},TT=function(n,e,t,i=ue){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 q4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:bs,bind_:_i,throttle:ia,debounce:TT});let Pc;class os{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},as(this,e,t),this.addEventListener=i}off(e,t){xr(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},b0(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Dy(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=y0(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ru(this,e)}queueTrigger(e){Pc||(Pc=new Map);const t=e.type||e;let i=Pc.get(this);i||(i=new Map,Pc.set(this,i));const a=i.get(t);i.delete(t),ue.clearTimeout(a);const l=ue.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Pc.delete(this)),this.trigger(e)},0);i.set(t,l)}}os.prototype.allowedEvents_={};os.prototype.addEventListener=os.prototype.on;os.prototype.removeEventListener=os.prototype.off;os.prototype.dispatchEvent=os.prototype.trigger;const v0=n=>typeof n.name=="function"?n.name():typeof n.name=="string"?n.name:n.name_?n.name_:n.constructor&&n.constructor.name?n.constructor.name:typeof n,Da=n=>n instanceof os||!!n.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof n[e]=="function"),V4=(n,e)=>{Da(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Gg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,Rf=(n,e,t)=>{if(!n||!n.nodeName&&!Da(n))throw new Error(`Invalid target for ${v0(e)}#${t}; must be a DOM node or evented object.`)},ST=(n,e,t)=>{if(!Gg(n))throw new Error(`Invalid event type for ${v0(e)}#${t}; must be a non-empty string or array.`)},kT=(n,e,t)=>{if(typeof n!="function")throw new Error(`Invalid listener for ${v0(e)}#${t}; must be a function.`)},tg=(n,e,t)=>{const i=e.length<3||e[0]===n||e[0]===n.eventBusEl_;let a,l,u;return i?(a=n.eventBusEl_,e.length>=3&&e.shift(),[l,u]=e):(a=e[0],l=e[1],u=e[2]),Rf(a,n,t),ST(l,n,t),kT(u,n,t),u=_i(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},Jo=(n,e,t,i)=>{Rf(n,n,e),n.nodeName?H4[e](n,t,i):n[e](t,i)},G4={on(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"on");if(Jo(t,"on",i,a),!e){const l=()=>this.off(t,i,a);l.guid=a.guid;const u=()=>this.off("dispose",l);u.guid=a.guid,Jo(this,"on","dispose",l),Jo(t,"on","dispose",u)}},one(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"one");if(e)Jo(t,"one",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"one",i,l)}},any(...n){const{isTargetingSelf:e,target:t,type:i,listener:a}=tg(this,n,"any");if(e)Jo(t,"any",i,a);else{const l=(...u)=>{this.off(t,i,l),a.apply(null,u)};l.guid=a.guid,Jo(t,"any",i,l)}},off(n,e,t){if(!n||Gg(n))xr(this.eventBusEl_,n,e);else{const i=n,a=e;Rf(i,this,"off"),ST(a,this,"off"),kT(t,this,"off"),t=_i(this,t),this.off("dispose",t),i.nodeName?(xr(i,a,t),xr(i,"dispose",t)):Da(i)&&(i.off(a,t),i.off("dispose",t))}},trigger(n,e){Rf(this.eventBusEl_,this,"trigger");const t=n&&typeof n!="string"?n.type:n;if(!Gg(t))throw new Error(`Invalid event type for ${v0(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ru(this.eventBusEl_,n,e)}};function My(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_=on("span",{className:"vjs-event-bus"});return Object.assign(n,G4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Cr.has(i)&&Cr.delete(i)}),ue.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const K4={state:{},setState(n){typeof n=="function"&&(n=n());let e;return lu(n,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Da(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function ET(n,e){return Object.assign(n,K4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Da(n)&&n.on("statechanged",n.handleStateChanged),n}const rd=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toLowerCase())},qi=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},CT=function(n,e){return qi(n)===qi(e)};var W4=Object.freeze({__proto__:null,toLowerCase:rd,toTitleCase:qi,titleCaseEquals:CT});class nt{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=pi({},this.options_),t=this.options_=pi(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const a=e&&e.id&&e.id()||"no_player";this.id_=`${a}_component_${ys()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(a=>this.addClass(a)),["on","off","one","any","trigger"].forEach(a=>{this[a]=void 0}),t.evented!==!1&&(My(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),ET(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_=pi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return on(e,t,i)}localize(e,t,i=e){const a=this.player_.language&&this.player_.language(),l=this.player_.languages&&this.player_.languages(),u=l&&l[a],h=a&&a.split("-")[0],f=l&&l[h];let g=i;return u&&u[e]?g=u[e]:f&&f[e]&&(g=f[e]),t&&(g=g.replace(/\{(\d+)\}/g,function(_,S){const C=t[S-1];let D=C;return typeof C>"u"&&(D=_),D})),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=on("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),l=_t.createElementNS(i,"svg");l.setAttributeNS(null,"viewBox","0 0 512 512");const u=_t.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=qi(e);const u=t.componentClass||l;t.name=l;const h=nt.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&&qi(a.name()),l&&(this.childNameIndex_[l]=a,this.childNameIndex_[rd(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_:ju(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_[qi(e.name())]=null,this.childNameIndex_[rd(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=u=>{const h=u.name;let f=u.opts;if(t[h]!==void 0&&(f=t[h]),f===!1)return;f===!0&&(f={}),f.playerOptions=this.options_.playerOptions;const g=this.addChild(h,f);g&&(this[h]=g)};let a;const l=nt.getComponent("Tech");Array.isArray(e)?a=e:a=Object.keys(e),a.concat(Object.keys(this.options_).filter(function(u){return!a.some(function(h){return typeof h=="string"?u===h:u===h.name})})).map(u=>{let h,f;return typeof u=="string"?(h=u,f=e[h]||this.options_[h]||{}):(h=u.name,f=u),{name:h,opts:f}}).filter(u=>{const h=nt.getComponent(u.opts.componentClass||qi(u.name));return h&&!l.isTech(h)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Ao(e,t||this.contentEl())}$$(e,t){return yT(e,t||this.contentEl())}hasClass(e){return id(this.el_,e)}addClass(...e){hl(this.el_,...e)}removeClass(...e){f0(this.el_,...e)}toggleClass(e,t){uT(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 dT(this.el_,e)}setAttribute(e,t){Eu(this.el_,e,t)}removeAttribute(e){p0(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const a=this.el_.style[e],l=a.indexOf("px");return parseInt(l!==-1?a.slice(0,l):this.el_["offset"+qi(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Au(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${qi(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,a=200;let l;this.on("touchstart",function(h){h.touches.length===1&&(t={pageX:h.touches[0].pageX,pageY:h.touches[0].pageY},e=ue.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&&ue.performance.now()-e<a&&(h.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=_i(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=_i(this,e),this.clearTimersOnDispose_(),i=ue.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),ue.clearTimeout(e)),e}setInterval(e,t){e=_i(this,e),this.clearTimersOnDispose_();const i=ue.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),ue.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=_i(this,e),t=ue.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=_i(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),ue.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=ue.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"||ue.getComputedStyle(l).height==="0px"||ue.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>(_t.documentElement.clientWidth||ue.innerWidth)||u.y<0||u.y>(_t.documentElement.clientHeight||ue.innerHeight))return!1;let h=_t.elementFromPoint(u.x,u.y);for(;h;){if(h===l)return!0;if(h.parentNode)h=h.parentNode;else return!1}}return e||(e=this.el()),!!(a(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=nt.getComponent("Tech"),a=i&&i.isTech(t),l=nt===t||nt.prototype.isPrototypeOf(t.prototype);if(a||!l){let h;throw a?h="techs must be registered using Tech.registerTech()":h="must be a Component subclass",new Error(`Illegal component, "${e}"; ${h}.`)}e=qi(e),nt.components_||(nt.components_={});const u=nt.getComponent("Player");if(e==="Player"&&u&&u.players){const h=u.players,f=Object.keys(h);if(h&&f.length>0){for(let g=0;g<f.length;g++)if(h[f[g]]!==null)throw new Error("Can not register Player component after player has been created.")}}return nt.components_[e]=t,nt.components_[rd(e)]=t,t}static getComponent(e){if(!(!e||!nt.components_))return nt.components_[e]}}nt.registerComponent("Component",nt);function X4(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 I2(n,e,t,i){return X4(n,i,t.length-1),t[i][e]}function ng(n){let e;return n===void 0||n.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:n.length,start:I2.bind(null,"start",0,n),end:I2.bind(null,"end",1,n)},ue.Symbol&&ue.Symbol.iterator&&(e[ue.Symbol.iterator]=()=>(n||[]).values()),e}function Ms(n,e){return Array.isArray(n)?ng(n):n===void 0||e===void 0?ng():ng([[n,e]])}const AT=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 jy=AT;function NT(n){jy=n}function DT(){jy=AT}function vl(n,e=n){return jy(n,e)}var Y4=Object.freeze({__proto__:null,createTimeRanges:Ms,createTimeRange:Ms,setFormatTime:NT,resetFormatTime:DT,formatTime:vl});function MT(n,e){let t=0,i,a;if(!e)return 0;(!n||!n.length)&&(n=Ms(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 Bi(n){if(n instanceof Bi)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:ta(n)&&(typeof n.code=="number"&&(this.code=n.code),Object.assign(this,n)),this.message||(this.message=Bi.defaultMessages[this.code]||"")}Bi.prototype.code=0;Bi.prototype.message="";Bi.prototype.status=null;Bi.prototype.metadata=null;Bi.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Bi.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."};Bi.MEDIA_ERR_CUSTOM=0;Bi.prototype.MEDIA_ERR_CUSTOM=0;Bi.MEDIA_ERR_ABORTED=1;Bi.prototype.MEDIA_ERR_ABORTED=1;Bi.MEDIA_ERR_NETWORK=2;Bi.prototype.MEDIA_ERR_NETWORK=2;Bi.MEDIA_ERR_DECODE=3;Bi.prototype.MEDIA_ERR_DECODE=3;Bi.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Bi.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Bi.MEDIA_ERR_ENCRYPTED=5;Bi.prototype.MEDIA_ERR_ENCRYPTED=5;function sd(n){return n!=null&&typeof n.then=="function"}function Ys(n){sd(n)&&n.then(null,e=>{})}const Kg=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}})})},Q4=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=Kg(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(Kg))},Z4=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 Wg={textTracksToJson:Q4,jsonToTextTracks:Z4,trackToJson:Kg};const ig="vjs-modal-dialog";class Ou extends nt{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=on("div",{className:`${ig}-content`},{role:"document"}),this.descEl_=on("p",{className:`${ig}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),No(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${ig} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const a=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=a,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,a=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),gT(t,e),this.trigger("modalfill"),a?i.insertBefore(t,a):i.appendChild(t);const l=this.getChild("closeButton");l&&i.appendChild(l.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),g0(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=_t.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}_t.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 ue.HTMLAnchorElement||t instanceof ue.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof ue.HTMLInputElement||t instanceof ue.HTMLSelectElement||t instanceof ue.HTMLTextAreaElement||t instanceof ue.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof ue.HTMLIFrameElement||t instanceof ue.HTMLObjectElement||t instanceof ue.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ou.prototype.options_={pauseOnOpen:!0,temporary:!0};nt.registerComponent("ModalDialog",Ou);class xl extends os{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})},Da(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 rg=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 jT extends xl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){rg(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&rg(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,rg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const sg=function(n,e){for(let t=0;t<n.length;t++)!Object.keys(n[t]).length||e.id===n[t].id||(n[t].selected=!1)};class RT extends xl{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){sg(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&sg(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,sg(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Ry 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 J4{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 Of{constructor(e){Of.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 eM={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},tM={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},nM={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},B2={disabled:"disabled",hidden:"hidden",showing:"showing"};class Oy extends os{constructor(e={}){super();const t={id:e.id||"vjs_track_"+ys(),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 Ly=function(n){return new URL(n,_t.baseURI)},OT=function(n){return new URL(n,_t.baseURI).href},Iy=function(n){if(typeof n=="string"){const t=n.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},x0=function(n,e=ue.location){return Ly(n).origin!==e.origin};var iM=Object.freeze({__proto__:null,parseUrl:Ly,getAbsoluteURL:OT,getFileExtension:Iy,isCrossOrigin:x0});const P2=function(n,e){const t=new ue.WebVTT.Parser(ue,ue.vttjs,ue.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&&(ue.console&&ue.console.groupCollapsed&&ue.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>En.error(a)),ue.console&&ue.console.groupEnd&&ue.console.groupEnd()),t.flush()},F2=function(n,e){const t={uri:n},i=x0(n);i&&(t.cors=i);const a=e.tech_.crossOrigin()==="use-credentials";a&&(t.withCredentials=a),Iw(t,_i(this,function(l,u,h){if(l)return En.error(l,u);e.loaded_=!0,typeof ue.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],f=>{if(f.type==="vttjserror"){En.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return P2(h,e)}):P2(h,e)}))};class wd extends Oy{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=pi(e,{kind:nM[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=B2[t.mode]||"disabled";const a=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const l=new Of(this.cues_),u=new Of(this.activeCues_);let h=!1;this.timeupdateHandler=_i(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){B2[g]&&i!==g&&(i=g,!this.preload_&&i!=="disabled"&&this.cues.length===0&&F2(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?l:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return u;const g=this.tech_.currentTime(),_=[];for(let S=0,C=this.cues.length;S<C;S++){const D=this.cues[S];D.startTime<=g&&D.endTime>=g&&_.push(D)}if(h=!1,_.length!==this.activeCues_.length)h=!0;else for(let S=0;S<_.length;S++)this.activeCues_.indexOf(_[S])===-1&&(h=!0);return this.activeCues_=_,u.setCues_(this.activeCues_),u},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&F2(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 ue.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 Wg.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}}}}wd.prototype.allowedEvents_={cuechange:"cuechange"};class LT extends Oy{constructor(e={}){const t=pi(e,{kind:tM[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 IT extends Oy{constructor(e={}){const t=pi(e,{kind:eM[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 ja extends os{constructor(e={}){super();let t;const i=new wd(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=ja.NONE,i.addEventListener("loadeddata",()=>{t=ja.LOADED,this.trigger({type:"load",target:this})})}}ja.prototype.allowedEvents_={load:"load"};ja.NONE=0;ja.LOADING=1;ja.LOADED=2;ja.ERROR=3;const gs={audio:{ListClass:jT,TrackClass:LT,capitalName:"Audio"},video:{ListClass:RT,TrackClass:IT,capitalName:"Video"},text:{ListClass:Ry,TrackClass:wd,capitalName:"Text"}};Object.keys(gs).forEach(function(n){gs[n].getterName=`${n}Tracks`,gs[n].privateName=`${n}Tracks_`});const Nu={remoteText:{ListClass:Ry,TrackClass:wd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:J4,TrackClass:ja,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Er=Object.assign({},gs,Nu);Nu.names=Object.keys(Nu);gs.names=Object.keys(gs);Er.names=[].concat(Nu.names).concat(gs.names);function rM(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 Er.text.TrackClass(a);return l.addTrack(u),u}class bn extends nt{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Er.names.forEach(i=>{const a=Er[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 Er.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(_i(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ms(0,0)}bufferedPercent(){return MT(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(gs.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let a=i.length;for(;a--;){const l=i[a];t==="text"&&this.removeRemoteTextTrack(l),i.removeTrack(l)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Bi(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ms(0,0):Ms()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){gs.names.forEach(e=>{const t=gs[e],i=()=>{this.trigger(`${e}trackchange`)},a=this[t.getterName]();a.addEventListener("removetrack",i),a.addEventListener("addtrack",i),this.on("dispose",()=>{a.removeEventListener("removetrack",i),a.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!ue.WebVTT)if(_t.body.contains(this.el())){if(!this.options_["vtt.js"]&&ku(u2)&&Object.keys(u2).length>0){this.trigger("vttjsloaded");return}const e=_t.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}),ue.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 rM(this,e,t,i)}createRemoteTextTrack(e){const t=pi(e,{tech:this});return new Nu.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=ys();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return bn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof bn||e instanceof bn||e===bn}static registerTech(e,t){if(bn.techs_||(bn.techs_={}),!bn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!bn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!bn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qi(e),bn.techs_[e]=t,bn.techs_[rd(e)]=t,e!=="Tech"&&bn.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(bn.techs_&&bn.techs_[e])return bn.techs_[e];if(e=qi(e),ue&&ue.videojs&&ue.videojs[e])return En.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),ue.videojs[e]}}}Er.names.forEach(function(n){const e=Er[n];bn.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});bn.prototype.featuresVolumeControl=!0;bn.prototype.featuresMuteControl=!0;bn.prototype.featuresFullscreenResize=!1;bn.prototype.featuresPlaybackRate=!1;bn.prototype.featuresProgressEvents=!1;bn.prototype.featuresSourceset=!1;bn.prototype.featuresTimeupdateEvents=!1;bn.prototype.featuresNativeTextTracks=!1;bn.prototype.featuresVideoFrameCallback=!1;bn.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:En.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)}};nt.registerComponent("Tech",bn);bn.registerTech("Tech",bn);bn.defaultTechOrder_=[];const fl={},Lf={},If={};function sM(n,e){fl[n]=fl[n]||[],fl[n].push(e)}function aM(n,e,t){n.setTimeout(()=>il(e,fl[e.type],t,n),1)}function oM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function lM(n,e,t){return n.reduceRight(By(t),e[t]())}function uM(n,e,t,i){return e[t](n.reduce(By(t),i))}function U2(n,e,t,i=null){const a="call"+qi(t),l=n.reduce(By(a),i),u=l===If,h=u?null:e[t](l);return hM(n,t,h,u),h}const cM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},dM={setCurrentTime:1,setMuted:1,setVolume:1},z2={play:1,pause:1};function By(n){return(e,t)=>e===If?If:t[n]?t[n](e):e}function hM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function fM(n){Lf.hasOwnProperty(n.id())&&delete Lf[n.id()]}function pM(n,e){const t=Lf[n.id()];let i=null;if(t==null)return i=e(n),Lf[n.id()]=[[e,i]],i;for(let a=0;a<t.length;a++){const[l,u]=t[a];l===e&&(i=u)}return i===null&&(i=e(n),t.push([e,i])),i}function il(n={},e=[],t,i,a=[],l=!1){const[u,...h]=e;if(typeof u=="string")il(n,fl[u],t,i,a,l);else if(u){const f=pM(i,u);if(!f.setSource)return a.push(f),il(n,h,t,i,a,l);f.setSource(Object.assign({},n),function(g,_){if(g)return il(n,h,t,i,a,l);a.push(f),il(_,n.type===_.type?h:fl[_.type],t,i,a,l)})}else h.length?il(n,h,t,i,a,l):l?t(n,a):il(n,fl["*"],t,i,a,!0)}const mM={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"},Bf=function(n=""){const e=Iy(n);return mM[e.toLowerCase()]||""},gM=(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 Bf(e)},BT=function(n){if(Array.isArray(n)){let e=[];n.forEach(function(t){t=BT(t),Array.isArray(t)?e=e.concat(t):ta(t)&&e.push(t)}),n=e}else typeof n=="string"&&n.trim()?n=[$2({src:n})]:ta(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?n=[$2(n)]:n=[];return n};function $2(n){if(!n.type){const e=Bf(n.src);e&&(n.type=e)}return n}var yM=`<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 H2=Df?10009:Mf?461:8,Ql={codes:{play:415,pause:19,ff:417,rw:412,back:H2},names:{415:"play",19:"pause",417:"ff",412:"rw",[H2]:"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}},q2=5;class bM extends os{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()+q2);break;case"rw":this.userSeek_(this.player_.currentTime()-q2);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const a=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(a&&a.name()==="CloseButton"?this.refocusComponent():(this.pause(),a&&a.el()&&(this.lastFocusedComponent_=a)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(a){for(const l of a)l.hasOwnProperty("el_")&&l.getIsFocusable()&&l.getIsAvailableToBeFocused(l.el())&&t.push(l),l.hasOwnProperty("children_")&&l.children_.length>0&&i(l.children_)}return e.children_.forEach(a=>{if(a.hasOwnProperty("el_"))if(a.getIsFocusable&&a.getIsAvailableToBeFocused&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el())){t.push(a);return}else a.hasOwnProperty("children_")&&a.children_.length>0?i(a.children_):a.hasOwnProperty("items")&&a.items.length>0?i(a.items):this.findSuitableDOMChild(a)&&t.push(a);if(a.name_==="ErrorDisplay"&&a.opened_){const l=a.el_.querySelector(".vjs-errors-ok-button-container");l&&l.querySelectorAll("button").forEach((h,f)=>{t.push({name:()=>"ModalButton"+(f+1),el:()=>h,getPositions:()=>{const g=h.getBoundingClientRect(),_={x:g.x,y:g.y,width:g.width,height:g.height,top:g.top,right:g.right,bottom:g.bottom,left:g.left},S={x:g.left+g.width/2,y:g.top+g.height/2,width:0,height:0,top:g.top+g.height/2,right:g.left+g.width/2,bottom:g.top+g.height/2,left:g.left+g.width/2};return{boundingClientRect:_,center:S}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:g=>!0,focus:()=>h.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let a=0;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 vM extends nt{constructor(e,t,i){const a=pi({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=qi(u[l]);let f=bn.getTech(h);if(h||(f=nt.getComponent(h)),f&&f.isSupported()){e.loadTech_(h);break}}else e.src(t.playerOptions.sources)}}nt.registerComponent("MediaLoader",vM);class _0 extends nt{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"&&En.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=on(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=on("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,No(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("ClickableComponent",_0);class Xg extends _0{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return on("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(on("picture",{className:"vjs-poster",tabIndex:-1},{},on("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()?Ys(this.player_.play()):this.player_.pause())}}Xg.prototype.crossorigin=Xg.prototype.crossOrigin;nt.registerComponent("PosterImage",Xg);const fs="#222",V2="#ccc",xM={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function ag(n,e){let t;if(n.length===4)t=n[1]+n[1]+n[2]+n[2]+n[3]+n[3];else if(n.length===7)t=n.slice(1);else throw new Error("Invalid color code provided, "+n+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Gs(n,e,t){try{n.style[e]=t}catch{return}}function G2(n){return n?`${n}px`:""}class _M extends nt{constructor(e,t,i){super(e,t,i);const a=u=>this.updateDisplay(u),l=u=>{this.updateDisplayOverlay(),this.updateDisplay(u)};e.on("loadstart",u=>this.toggleDisplay(u)),e.on("useractive",a),e.on("userinactive",a),e.on("texttrackchange",a),e.on("loadedmetadata",u=>{this.updateDisplayOverlay(),this.preselectTrack(u)}),e.ready(_i(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=ue.screen.orientation||ue,h=ue.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 ue.WebVTT=="function"&&ue.WebVTT.processCues(ue,[],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)),!ue.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="",Gs(u,"position","relative"),Gs(u,"height",g-f+"px"),Gs(u,"top","unset"),jf?Gs(u,"bottom",g+"px"):Gs(u,"bottom","0px"),h.length>0&&h.forEach(_=>{if(_.style.inset){const S=_.style.inset.split(" ");S.length===3&&Object.assign(_.style,{top:S[0],right:S[1],bottom:S[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!ue.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)),Gs(this.el_,"insetInline",G2(l)),Gs(this.el_,"insetBlock",G2(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&&Gs(u.firstChild,"color",ag(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(u.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Gs(u.firstChild,"backgroundColor",ag(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Gs(u,"backgroundColor",ag(t.windowColor,t.windowOpacity)):u.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?u.firstChild.style.textShadow=`2px 2px 3px ${fs}, 2px 2px 4px ${fs}, 2px 2px 5px ${fs}`:t.edgeStyle==="raised"?u.firstChild.style.textShadow=`1px 1px ${fs}, 2px 2px ${fs}, 3px 3px ${fs}`:t.edgeStyle==="depressed"?u.firstChild.style.textShadow=`1px 1px ${V2}, 0 1px ${V2}, -1px -1px ${fs}, 0 -1px ${fs}`:t.edgeStyle==="uniform"&&(u.firstChild.style.textShadow=`0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}, 0 0 4px ${fs}`)),t.fontPercent&&t.fontPercent!==1){const h=ue.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=xM[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof ue.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])}ue.WebVTT.processCues(ue,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&&Eu(u,"lang",a.language)}this.player_.textTrackSettings&&this.updateDisplayState(a)}}}nt.registerComponent("TextTrackDisplay",_M);class wM extends nt{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=on("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"])}}nt.registerComponent("LoadingSpinner",wM);class _r extends _0{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const a=on(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}addChild(e,t={}){const i=this.constructor.name;return En.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),nt.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)}}nt.registerComponent("Button",_r);class PT extends _r{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){Ys(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),a=i&&i.getChild("playToggle");if(!a){this.player_.tech(!0).focus();return}const l=()=>a.focus();sd(t)?t.then(l,()=>{}):this.setTimeout(l,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}PT.prototype.controlText_="Play Video";nt.registerComponent("BigPlayButton",PT);class TM extends _r{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}nt.registerComponent("CloseButton",TM);class FT extends _r{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()?Ys(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))}}FT.prototype.controlText_="Play";nt.registerComponent("PlayToggle",FT);class Lu extends nt{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=on("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=on("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,En.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_=_t.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Lu.prototype.labelText_="Time";Lu.prototype.controlText_="Time";nt.registerComponent("TimeDisplay",Lu);class Py extends Lu{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Py.prototype.labelText_="Current Time";Py.prototype.controlText_="Current Time";nt.registerComponent("CurrentTimeDisplay",Py);class Fy extends Lu{constructor(e,t){super(e,t);const i=a=>this.updateContent(a);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Fy.prototype.labelText_="Duration";Fy.prototype.controlText_="Duration";nt.registerComponent("DurationDisplay",Fy);class SM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}nt.registerComponent("TimeDivider",SM);class Uy extends Lu{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(on("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)}}Uy.prototype.labelText_="Remaining Time";Uy.prototype.controlText_="Remaining Time";nt.registerComponent("RemainingTimeDisplay",Uy);class kM extends nt{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=on("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(on("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(_t.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}nt.registerComponent("LiveDisplay",kM);class UT extends _r{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_=on("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()}}UT.prototype.controlText_="Seek to live, currently playing live";nt.registerComponent("SeekToLive",UT);function Td(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var EM=Object.freeze({__proto__:null,clamp:Td});class zy extends nt{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!na&&e.preventDefault(),hT(),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;fT(),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=m0(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,a=t&&t.horizontalSeek;i?a&&e.key==="ArrowLeft"||!a&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):a&&e.key==="ArrowRight"||!a&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}nt.registerComponent("Slider",zy);const og=(n,e)=>Td(n/e*100,0,100).toFixed(2)+"%";class CM extends nt{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=on("span",{className:"vjs-control-text"}),i=on("span",{textContent:this.localize("Loaded")}),a=_t.createTextNode(": ");return this.percentageEl_=on("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(a),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),a=t&&t.isLive()?t.seekableEnd():this.player_.duration(),l=this.player_.bufferedEnd(),u=this.partEls_,h=og(l,a);this.percent_!==h&&(this.el_.style.width=h,No(this.percentageEl_,h),this.percent_=h);for(let f=0;f<i.length;f++){const g=i.start(f),_=i.end(f);let S=u[f];S||(S=this.el_.appendChild(on()),u[f]=S),!(S.dataset.start===g&&S.dataset.end===_)&&(S.dataset.start=g,S.dataset.end=_,S.style.left=og(g,l),S.style.width=og(_-g,l))}for(let f=u.length;f>i.length;f--)this.el_.removeChild(u[f-1]);u.length=i.length})}}nt.registerComponent("LoadProgressBar",CM);class AM extends nt{constructor(e,t){super(e,t),this.update=ia(_i(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const a=pd(this.el_),l=Cu(this.player_.el()),u=e.width*t;if(!l||!a)return;let h=e.left-l.left+u,f=e.width-u+(l.right-e.right);f||(f=e.width-u,h=u);let g=a.width/2;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){No(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()})}}nt.registerComponent("TimeTooltip",AM);class $y extends nt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ia(_i(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const a=this.getChild("timeTooltip");if(!a)return;const l=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();a.updateTime(e,t,l)}}$y.prototype.options_={children:[]};!vr&&!js&&$y.prototype.options_.children.push("timeTooltip");nt.registerComponent("PlayProgressBar",$y);class zT extends nt{constructor(e,t){super(e,t),this.update=ia(_i(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}zT.prototype.options_={children:["timeTooltip"]};nt.registerComponent("MouseTimeDisplay",zT);class w0 extends zy{constructor(e,t){t=pi(w0.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(vr||js)||e.options_.disableSeekWhileScrubbingOnSTV;(!vr&&!js||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=_i(this,this.update),this.update=ia(this.update_,bs),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in _t&&"visibilityState"in _t&&this.on(_t,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){_t.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,bs))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(_t.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(Cu(this.el()),this.getProgress(),e)}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){md(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!md(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?Ys(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 _t&&"visibilityState"in _t&&this.off(_t,"visibilitychange",this.toggleVisibility_),super.dispose()}}w0.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};nt.registerComponent("SeekBar",w0);class $T extends nt{constructor(e,t){super(e,t),this.handleMouseMove=ia(_i(this,this.handleMouseMove),bs),this.throttledHandleMouseSeek=ia(_i(this,this.handleMouseSeek),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),a=t.getChild("mouseTimeDisplay");if(!i&&!a)return;const l=t.el(),u=pd(l);let h=m0(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&&Ys(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()}}$T.prototype.options_={children:["seekBar"]};nt.registerComponent("ProgressControl",$T);class HT extends _r{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(){_t.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in ue?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 _t.exitPictureInPicture=="function"&&super.show()}}HT.prototype.controlText_="Picture-in-Picture";nt.registerComponent("PictureInPictureToggle",HT);class qT extends _r{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),_t[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()}}qT.prototype.controlText_="Fullscreen";nt.registerComponent("FullscreenToggle",qT);const NM=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 DM extends nt{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}nt.registerComponent("VolumeLevel",DM);class MM extends nt{constructor(e,t){super(e,t),this.update=ia(_i(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,a){if(!i){const l=Cu(this.el_),u=Cu(this.player_.el()),h=e.width*t;if(!u||!l)return;const f=e.left-u.left+h,g=e.width-h+(u.right-e.right);let _=l.width/2;f<_?_+=_-f:g<_&&(_=g),_<0?_=0:_>l.width&&(_=l.width),this.el_.style.right=`-${_}px`}this.write(`${a}%`)}write(e){No(this.el_,e)}updateVolume(e,t,i,a,l){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,a.toFixed(0)),l&&l()})}}nt.registerComponent("VolumeLevelTooltip",MM);class VT extends nt{constructor(e,t){super(e,t),this.update=ia(_i(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const a=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,a,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}VT.prototype.options_={children:["volumeLevelTooltip"]};nt.registerComponent("MouseVolumeLevelDisplay",VT);class T0 extends zy{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){md(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),a=Cu(i),l=this.vertical();let u=m0(i,e);u=l?u.y:u.x,u=Td(u,0,1),t.update(a,u,l)}md(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}T0.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!vr&&!js&&T0.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");T0.prototype.playerEvent="volumechange";nt.registerComponent("VolumeBar",T0);class GT extends nt{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||ku(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),NM(this,e),this.throttledHandleMouseMove=ia(_i(this,this.handleMouseMove),bs),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}GT.prototype.options_={children:["volumeBar"]};nt.registerComponent("VolumeControl",GT);const jM=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 KT extends _r{constructor(e,t){super(e,t),jM(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"),vr&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),f0(this.el_,[0,1,2,3].reduce((i,a)=>i+`${a?" ":""}vjs-vol-${a}`,"")),hl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}KT.prototype.controlText_="Mute";nt.registerComponent("MuteToggle",KT);class WT extends nt{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||ku(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),as(_t,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),xr(_t,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}WT.prototype.options_={children:["muteToggle","volumeControl"]};nt.registerComponent("VolumePanel",WT);class XT extends _r{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]))}}XT.prototype.controlText_="Skip Forward";nt.registerComponent("SkipForward",XT);class YT extends _r{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]))}}YT.prototype.controlText_="Skip Backward";nt.registerComponent("SkipBackward",YT);class QT extends nt{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof nt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof nt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=on(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_),as(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||_t.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(a=>a.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}nt.registerComponent("Menu",QT);class Hy extends nt{constructor(e,t={}){super(e,t),this.menuButton_=new _r(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=_r.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(),as(_t,"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 QT(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=on("li",{className:"vjs-menu-title",textContent:qi(this.options_.title),tabIndex:-1}),i=new nt(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.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=_r.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"),xr(_t,"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"),vr&&oT())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()}}nt.registerComponent("MenuButton",Hy);class qy extends Hy{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const a=_i(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)})}}nt.registerComponent("TrackButton",qy);class Sd extends _0{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=on("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))}}nt.registerComponent("MenuItem",Sd);class kd extends Sd{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 ue.Event!="object")try{h=new ue.Event("change")}catch{}h||(h=_t.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()}}nt.registerComponent("TextTrackMenuItem",kd);class ZT extends kd{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()}}nt.registerComponent("OffTextTrackMenuItem",ZT);class Iu extends qy{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=kd){let i;this.label_&&(i=`${this.label_} off`),e.push(new ZT(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}}nt.registerComponent("TextTrackButton",Iu);class JT extends Sd{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)}}nt.registerComponent("ChaptersTrackMenuItem",JT);class Vy extends Iu{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(qi(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,a=t.length;i<a;i++){const l=t[i],u=new JT(this.player_,{track:this.track_,cue:l});e.push(u)}return e}}Vy.prototype.kind_="chapters";Vy.prototype.controlText_="Chapters";nt.registerComponent("ChaptersButton",Vy);class Gy extends Iu{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const a=e.textTracks(),l=_i(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()}`}}Gy.prototype.kind_="descriptions";Gy.prototype.controlText_="Descriptions";nt.registerComponent("DescriptionsButton",Gy);class Ky extends Iu{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()}`}}Ky.prototype.kind_="subtitles";Ky.prototype.controlText_="Subtitles";nt.registerComponent("SubtitlesButton",Ky);class Wy extends kd{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()}}nt.registerComponent("CaptionSettingsMenuItem",Wy);class Xy extends Iu{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 Wy(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Xy.prototype.kind_="captions";Xy.prototype.controlText_="Captions";nt.registerComponent("CaptionsButton",Xy);class eS extends kd{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(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(on("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),a}}nt.registerComponent("SubsCapsMenuItem",eS);class Yy extends Iu{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(qi(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Wy(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,eS),e}}Yy.prototype.kinds_=["captions","subtitles"];Yy.prototype.controlText_="Subtitles";nt.registerComponent("SubsCapsButton",Yy);class tS extends Sd{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(on("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(on("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)}}nt.registerComponent("AudioTrackMenuItem",tS);class nS extends qy{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 tS(this.player_,{track:a,selectable:!0,multiSelectable:!1}))}return e}}nS.prototype.controlText_="Audio Track";nt.registerComponent("AudioTrackButton",nS);class Qy extends Sd{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)}}Qy.prototype.contentElType="button";nt.registerComponent("PlaybackRateMenuItem",Qy);class iS extends Hy{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_=on("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 Qy(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")}}iS.prototype.controlText_="Playback Rate";nt.registerComponent("PlaybackRateMenuButton",iS);class rS extends nt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}nt.registerComponent("Spacer",rS);class RM extends rS{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}nt.registerComponent("CustomControlSpacer",RM);class sS extends nt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}sS.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};nt.registerComponent("ControlBar",sS);class aS extends Ou{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}aS.prototype.options_=Object.assign({},Ou.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});nt.registerComponent("ErrorDisplay",aS);class oS extends nt{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),on("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${ys()}`)+"-"+t[1].replace(/\W+/g,""),a=on("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return a.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),a}))}}nt.registerComponent("TextTrackSelect",oS);class pl extends nt{constructor(e,t={}){super(e,t);const i=on("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const a=this.options_.selects;for(const l of a){const u=this.options_.selectConfigs[l],h=u.className,f=u.id.replace("%s",this.options_.id_);let g=null;const _=`vjs_select_${ys()}`;if(this.options_.type==="colors"){g=on("span",{className:h});const C=on("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});C.setAttribute("for",_),g.appendChild(C)}const S=new oS(e,{SelectOptions:u.options,legendId:this.options_.legendId,id:_,labelId:f});this.addChild(S),this.options_.type==="colors"&&(g.appendChild(S.el()),this.el().appendChild(g))}}createEl(){return on("fieldset",{className:this.options_.className})}}nt.registerComponent("TextTrackFieldset",pl);class lS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new pl(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 pl(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 pl(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 on("div",{className:"vjs-track-settings-colors"})}}nt.registerComponent("TextTrackSettingsColors",lS);class uS extends nt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new pl(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 pl(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 pl(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 on("div",{className:"vjs-track-settings-font"})}}nt.registerComponent("TextTrackSettingsFont",uS);class cS extends nt{constructor(e,t={}){super(e,t);const i=new _r(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 _r(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return on("div",{className:"vjs-track-settings-controls"})}}nt.registerComponent("TrackSettingsControls",cS);const lg="vjs-text-track-settings",K2=["#000","Black"],W2=["#00F","Blue"],X2=["#0FF","Cyan"],Y2=["#0F0","Green"],Q2=["#F0F","Magenta"],Z2=["#F00","Red"],J2=["#FFF","White"],e_=["#FF0","Yellow"],ug=["1","Opaque"],cg=["0.5","Semi-Transparent"],t_=["0","Transparent"],_o={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[K2,J2,Z2,Y2,W2,e_,Q2,X2],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ug,cg,t_],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[J2,K2,Z2,Y2,W2,e_,Q2,X2],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:n=>n==="1.00"?null:Number(n)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ug,cg],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[t_,cg,ug],className:"vjs-window-opacity vjs-opacity"}};_o.windowColor.options=_o.backgroundColor.options;function dS(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function OM(n,e){const t=n.options[n.options.selectedIndex].value;return dS(t,e)}function LM(n,e,t){if(e){for(let i=0;i<n.options.length;i++)if(dS(n.options[i].value,t)===e){n.selectedIndex=i;break}}}class IM extends Ou{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=on("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 lS(e,{textTrackComponentid:this.id_,selectConfigs:_o,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new uS(e,{textTrackComponentid:this.id_,selectConfigs:_o,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const a=new cS(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()}),lu(_o,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 eT(_o,(e,t,i)=>{const a=OM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){lu(_o,(t,i)=>{LM(this.$(t.selector),e[i],t.parser)})}setDefaults(){lu(_o,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(ue.localStorage.getItem(lg))}catch(t){En.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?ue.localStorage.setItem(lg,JSON.stringify(e)):ue.localStorage.removeItem(lg)}catch(t){En.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}nt.registerComponent("TextTrackSettings",IM);class BM extends nt{constructor(e,t){let i=t.ResizeObserver||ue.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=pi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||ue.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=TT(()=>{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(){xr(this,"resize",l),xr(this,"unload",u),u=null};as(this.el_.contentWindow,"unload",u),as(this.el_.contentWindow,"resize",l)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}nt.registerComponent("ResizeManager",BM);const PM={trackingThreshold:20,liveTolerance:15};class FM extends nt{constructor(e,t){const i=pi(PM,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(ue.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const a=this.liveCurrentTime(),l=this.player_.currentTime();let u=this.player_.paused()||this.seekedBehindLive_||Math.abs(a-l)>this.options_.liveTolerance;(!this.timeupdateSeen_||a===1/0)&&(u=!1),u!==this.behindLiveEdge_&&(this.behindLiveEdge_=u,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,bs),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}nt.registerComponent("LiveTracker",FM);class UM extends nt{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:on("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ys()}`}),description:on("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ys()}`})},on("div",{className:"vjs-title-bar"},{},tT(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(a=>{const l=this.state[a],u=this.els[a],h=i[a];g0(u),l&&No(u,l),t&&(t.removeAttribute(h),l&&t.setAttribute(h,u.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}nt.registerComponent("TitleBar",UM);const zM={initialDisplay:4e3,position:[],takeFocus:!1};class $M extends _r{constructor(e,t){t=pi(zM,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=on("button",{},{type:"button",class:this.buildCSSClass()},on("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}nt.registerComponent("TransientButton",$M);const Yg=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},HM=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(n){const e=_t.createElement(this.nodeName.toLowerCase());e.innerHTML=n;const t=_t.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",ue.Element.prototype.appendChild.call(this,t),this.innerHTML}}),hS=(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},qM=n=>hS([n.el(),ue.HTMLMediaElement.prototype,ue.Element.prototype,HM],"innerHTML"),n_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=qM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Yg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",pi(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_)},VM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?OT(ue.Element.prototype.getAttribute.call(this,"src")):""},set(n){return ue.Element.prototype.setAttribute.call(this,"src",n),n}}),GM=n=>hS([n.el(),ue.HTMLMediaElement.prototype,VM],"src"),KM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=GM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",pi(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 Yg(n)||(n.triggerSourceset(""),n_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Yg(n)||n_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Pt extends bn{constructor(e,t){super(e,t);const i=e.source;let a=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const l=this.el_.childNodes;let u=l.length;const h=[];for(;u--;){const f=l[u];f.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(f),this.remoteTextTracks().addTrack(f.track),this.textTracks().addTrack(f.track),!a&&!this.el_.hasAttribute("crossorigin")&&x0(f.src)&&(a=!0)):h.push(f))}for(let f=0;f<h.length;f++)this.el_.removeChild(h[f])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&a&&En.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_(),(fd||d0)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Pt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){KM(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=gs[e],i=this.el()[t.getterName],a=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const l={change:h=>{const f={type:"change",target:a,currentTarget:a,srcElement:a};a.trigger(f),e==="text"&&this[Nu.remoteText.getterName]().trigger(f)},addtrack(h){a.addTrack(h.track)},removetrack(h){a.removeTrack(h.track)}},u=function(){const h=[];for(let f=0;f<a.length;f++){let g=!1;for(let _=0;_<i.length;_++)if(i[_]===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_(){gs.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),Pt.disposeMediaElement(e),e=i}else{e=_t.createElement("video");const i=this.options_.tag&&xo(this.options_.tag),a=pi({},i);(!fd||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,cT(e,Object.assign(a,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Eu(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const a=t[i],l=this.options_[a];typeof l<"u"&&(l?Eu(e,a,a):p0(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&&h0?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){En(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&js&&na&&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)Ys(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 En.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const a=on("source",{},i);return this.el_.appendChild(a),!0}removeSourceElement(e){if(!e)return En.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 En.warn(`No matching source element found with src: ${e}`),!1}reset(){Pt.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=_t.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),ue.performance&&(e.creationTime=ue.performance.now()),e}}l0(Pt,"TEST_VID",function(){if(!Mu())return;const n=_t.createElement("video"),e=_t.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Pt.isSupported=function(){try{Pt.TEST_VID.volume=.5}catch{return!1}return!!(Pt.TEST_VID&&Pt.TEST_VID.canPlayType)};Pt.canPlayType=function(n){return Pt.TEST_VID.canPlayType(n)};Pt.canPlaySource=function(n,e){return Pt.canPlayType(n.type)};Pt.canControlVolume=function(){try{const n=Pt.TEST_VID.volume;Pt.TEST_VID.volume=n/2+.1;const e=n!==Pt.TEST_VID.volume;return e&&vr?(ue.setTimeout(()=>{Pt&&Pt.prototype&&(Pt.prototype.featuresVolumeControl=n!==Pt.TEST_VID.volume)}),!1):e}catch{return!1}};Pt.canMuteVolume=function(){try{const n=Pt.TEST_VID.muted;return Pt.TEST_VID.muted=!n,Pt.TEST_VID.muted?Eu(Pt.TEST_VID,"muted","muted"):p0(Pt.TEST_VID,"muted","muted"),n!==Pt.TEST_VID.muted}catch{return!1}};Pt.canControlPlaybackRate=function(){if(js&&na&&u0<58)return!1;try{const n=Pt.TEST_VID.playbackRate;return Pt.TEST_VID.playbackRate=n/2+.1,n!==Pt.TEST_VID.playbackRate}catch{return!1}};Pt.canOverrideAttributes=function(){try{const n=()=>{};Object.defineProperty(_t.createElement("video"),"src",{get:n,set:n}),Object.defineProperty(_t.createElement("audio"),"src",{get:n,set:n}),Object.defineProperty(_t.createElement("video"),"innerHTML",{get:n,set:n}),Object.defineProperty(_t.createElement("audio"),"innerHTML",{get:n,set:n})}catch{return!1}return!0};Pt.supportsNativeTextTracks=function(){return h0||vr&&na};Pt.supportsNativeVideoTracks=function(){return!!(Pt.TEST_VID&&Pt.TEST_VID.videoTracks)};Pt.supportsNativeAudioTracks=function(){return!!(Pt.TEST_VID&&Pt.TEST_VID.audioTracks)};Pt.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([n,e]){l0(Pt.prototype,n,()=>Pt[e](),!0)});Pt.prototype.featuresVolumeControl=Pt.canControlVolume();Pt.prototype.movingMediaElementInDOM=!vr;Pt.prototype.featuresFullscreenResize=!0;Pt.prototype.featuresProgressEvents=!0;Pt.prototype.featuresTimeupdateEvents=!0;Pt.prototype.featuresVideoFrameCallback=!!(Pt.TEST_VID&&Pt.TEST_VID.requestVideoFrameCallback);Pt.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{}})()}};Pt.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){Pt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Pt.prototype["set"+qi(n)]=function(e){this.el_[n]=e,e?this.el_.setAttribute(n,n):this.el_.removeAttribute(n)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(n){Pt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Pt.prototype["set"+qi(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Pt.prototype[n]=function(){return this.el_[n]()}});bn.withSourceHandlers(Pt);Pt.nativeSourceHandler={};Pt.nativeSourceHandler.canPlayType=function(n){try{return Pt.TEST_VID.canPlayType(n)}catch{return""}};Pt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Pt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Iy(n.src);return Pt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Pt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Pt.nativeSourceHandler.dispose=function(){};Pt.registerSourceHandler(Pt.nativeSourceHandler);bn.registerTech("Html5",Pt);const fS=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],dg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Qg=["tiny","xsmall","small","medium","large","xlarge","huge"],ff={};Qg.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;ff[n]=`vjs-layout-${e}`});const WM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let ji=class nu extends nt{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${ys()}`,t=Object.assign(nu.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const u=e.closest("[lang]");u&&(t.language=u.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=u=>this.documentFullscreenChange_(u),this.boundFullWindowOnEscKey_=u=>this.fullWindowOnEscKey(u),this.boundUpdateStyleEl_=u=>this.updateStyleEl_(u),this.boundApplyInitTime_=u=>this.applyInitTime_(u),this.boundUpdateCurrentBreakpoint_=u=>this.updateCurrentBreakpoint_(u),this.boundHandleTechClick_=u=>this.handleTechClick_(u),this.boundHandleTechDoubleClick_=u=>this.handleTechDoubleClick_(u),this.boundHandleTechTouchStart_=u=>this.handleTechTouchStart_(u),this.boundHandleTechTouchMove_=u=>this.handleTechTouchMove_(u),this.boundHandleTechTouchEnd_=u=>this.handleTechTouchEnd_(u),this.boundHandleTechTap_=u=>this.handleTechTap_(u),this.boundUpdatePlayerHeightOnAudioOnlyMode_=u=>this.updatePlayerHeightOnAudioOnlyMode_(u),this.isFullscreen_=!1,this.log=Zw(this.id_),this.fsApi_=Cf,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&xo(e),this.language(this.options_.language),t.languages){const u={};Object.getOwnPropertyNames(t.languages).forEach(function(h){u[h.toLowerCase()]=t.languages[h]}),this.languages_=u}else this.languages_=nu.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(u=>{if(typeof this[u]!="function")throw new Error(`plugin "${u}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),My(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(as(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const a=pi(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 ue.DOMParser().parseFromString(yM,"image/svg+xml");if(h.querySelector("parsererror"))En.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 bM(this),this.addClass("vjs-spatial-navigation-enabled")),fd&&this.addClass("vjs-touch-enabled"),vr||this.addClass("vjs-workinghover"),nu.players[this.id_]=this;const l=Ug.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"),xr(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),xr(_t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),nu.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),fM(this),Er.names.forEach(e=>{const t=Er[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=xo(e);if(a){for(t=this.el_=e,e=this.tag=_t.createElement("video");t.children.length;)e.appendChild(t.firstChild);id(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",na&&c0&&(e.setAttribute("role","application"),l.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in l&&delete l.width,"height"in l&&delete l.height,Object.getOwnPropertyNames(l).forEach(function(f){a&&f==="class"||t.setAttribute(f,l[f]),a&&e.setAttribute(f,l[f])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const u=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(f=>aT[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),ue.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=_T("vjs-styles-dimensions");const f=Ao(".vjs-styles-defaults"),g=Ao("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),$g(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"){En.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)){En.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,Da(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),V4(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(ue.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),wT(this.styleEl_,`
|
||
.${a} {
|
||
width: ${e}px;
|
||
height: ${t}px;
|
||
}
|
||
|
||
.${a}.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
padding-top: ${u*100}%;
|
||
}
|
||
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=qi(e),a=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(bn.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};Er.names.forEach(f=>{const g=Er[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=bn.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(_i(this,this.handleTechReady_),!0),Wg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),fS.forEach(f=>{this.on(this.tech_,f,g=>this[`handleTech${qi(f)}_`](g))}),Object.keys(dg).forEach(f=>{this.on(this.tech_,f,g=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${dg[f]}_`].bind(this),event:g});return}this[`handleTech${dg[f]}_`](g)})}),this.on(this.tech_,"loadstart",f=>this.handleTechLoadStart_(f)),this.on(this.tech_,"sourceset",f=>this.handleTechSourceset_(f)),this.on(this.tech_,"waiting",f=>this.handleTechWaiting_(f)),this.on(this.tech_,"ended",f=>this.handleTechEnded_(f)),this.on(this.tech_,"seeking",f=>this.handleTechSeeking_(f)),this.on(this.tech_,"play",f=>this.handleTechPlay_(f)),this.on(this.tech_,"pause",f=>this.handleTechPause_(f)),this.on(this.tech_,"durationchange",f=>this.handleTechDurationChange_(f)),this.on(this.tech_,"fullscreenchange",(f,g)=>this.handleTechFullscreenChange_(f,g)),this.on(this.tech_,"fullscreenerror",(f,g)=>this.handleTechFullscreenError_(f,g)),this.on(this.tech_,"enterpictureinpicture",f=>this.handleTechEnterPictureInPicture_(f)),this.on(this.tech_,"leavepictureinpicture",f=>this.handleTechLeavePictureInPicture_(f)),this.on(this.tech_,"error",f=>this.handleTechError_(f)),this.on(this.tech_,"posterchange",f=>this.handleTechPosterChange_(f)),this.on(this.tech_,"textdata",f=>this.handleTechTextData_(f)),this.on(this.tech_,"ratechange",f=>this.handleTechRateChange_(f)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&$g(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Er.names.forEach(e=>{const t=Er[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Wg.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&&En.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":Ug}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const a=this.muted();this.muted(!0);const l=()=>{this.muted(a)};this.playTerminatedQueue_.push(l);const u=this.play();if(sd(u))return u.catch(h=>{throw l(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${h||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),sd(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!sd(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=gM(this,t)),this.cache_.source=pi({},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=xo(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()?Ys(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()&&!_t.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=_t[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 dM)return uM(this.middleware_,this.tech_,e,t);if(e in z2)return U2(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw En(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in cM)return lM(this.middleware_,this.tech_,e);if(e in z2)return U2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(En(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(En(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(En(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Ys){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(h0||vr);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=u=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const a=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),a===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(a)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ms(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Ms(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ms(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return MT(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,a)=>{function l(){t.off("fullscreenerror",h),t.off("fullscreenchange",u)}function u(){l(),i()}function h(g,_){l(),a(_)}t.one("fullscreenchange",u),t.one("fullscreenerror",h);const f=t.requestFullscreenHelper_(e);f&&(f.then(l,l),f.then(i,a))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function a(){e.off("fullscreenerror",u),e.off("fullscreenchange",l)}function l(){a(),t()}function u(f,g){a(),i(g)}e.one("fullscreenchange",l),e.one("fullscreenerror",u);const h=e.exitFullscreenHelper_();h&&(h.then(a,a),h.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=_t[this.fsApi_.exitFullscreen]();return e&&Ys(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=_t.documentElement.style.overflow,as(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow="hidden",hl(_t.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,xr(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow=this.docOrigOverflow,f0(_t.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&&ue.documentPictureInPicture){const e=_t.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(on("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),ue.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(bT(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 _t&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(ue.documentPictureInPicture&&ue.documentPictureInPicture.window)return ue.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in _t)return _t.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(a=>{const l=a.tagName.toLowerCase();if(a.isContentEditable)return!0;const u=["button","checkbox","hidden","radio","reset","submit"];return l==="input"?u.indexOf(a.type)===-1:["textarea"].indexOf(l)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:i=u=>e.key.toLowerCase()==="f",muteKey:a=u=>e.key.toLowerCase()==="m",playPauseKey:l=u=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const u=nt.getComponent("FullscreenToggle");_t[this.fsApi_.fullscreenEnabled]!==!1&&u.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),nt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):l.call(this,e)&&(e.preventDefault(),e.stopPropagation(),nt.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,a=this.options_.techOrder;i<a.length;i++){const l=a[i];let u=bn.getTech(l);if(u||(u=nt.getComponent(l)),!u){En.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,bn.getTech(h)]).filter(([h,f])=>f?f.isSupported():(En.error(`The "${h}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(h,f,g){let _;return h.some(S=>f.some(C=>{if(_=g(S,C),_)return!0})),_};let a;const l=h=>(f,g)=>h(g,f),u=([h,f],g)=>{if(f.canPlaySource(g,this.options_[h.toLowerCase()]))return{source:g,tech:h}};return this.options_.sourceOrder?a=i(e,t,l(u)):a=i(t,e,u),a||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=BT(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]),aM(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}oM(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?CT(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();Ys(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}),Da(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(Co("beforeerror").forEach(t=>{const i=t(this,e);if(!(ta(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 Bi(e),this.addClass("vjs-error"),En.error(`(CODE:${this.error_.code} ${Bi.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Co("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=_i(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&&!vr&&!js&&(f.on("mouseenter",function(S){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),f.on("mouseleave",function(S){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",a),this.on("keyup",a);let g;const _=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(g);const S=this.options_.inactivityTimeout;S<=0||(g=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},S))};this.setInterval(_,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(a=>{a!==t&&a.el_&&!a.hasClass("vjs-hidden")&&(a.hide(),this.audioOnlyCache_.hiddenChildren.push(a))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Da(this)&&this.trigger("languagechange"))}languages(){return pi(nu.prototype.options_.languages,this.languages_)}toJSON(){const e=pi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let a=t[i];a=pi(a),a.player=void 0,e.tracks[i]=a}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Ou(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<Qg.length;i++){const a=Qg[i],l=this.breakpoints_[a];if(t<=l){if(e===a)return;e&&this.removeClass(ff[e]),this.addClass(ff[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({},WM,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 ff[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=pi(e);const{artist:a,artwork:l,description:u,poster:h,src:f,textTracks:g,title:_}=this.cache_.media;!l&&h&&(this.cache_.media.artwork=[{src:h,type:Bf(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:_,description:u||a||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),l=>({kind:l.kind,label:l.label,language:l.language,src:l.src})),a={src:t,textTracks:i};return e&&(a.poster=e,a.artwork=[{src:a.poster,type:Bf(a.poster)}]),a}return pi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=xo(e),a=i["data-setup"];if(id(e,"vjs-fill")&&(i.fill=!0),id(e,"vjs-fluid")&&(i.fluid=!0),a!==null)try{Object.assign(i,JSON.parse(a||"{}"))}catch(l){En.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(xo(f)):g==="track"&&t.tracks.push(xo(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"))}};ji.prototype.videoTracks=()=>{};ji.prototype.audioTracks=()=>{};ji.prototype.textTracks=()=>{};ji.prototype.remoteTextTracks=()=>{};ji.prototype.remoteTextTrackEls=()=>{};Er.names.forEach(function(n){const e=Er[n];ji.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});ji.prototype.crossorigin=ji.prototype.crossOrigin;ji.players={};const Fc=ue.navigator;ji.prototype.options_={techOrder:bn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Fc&&(Fc.languages&&Fc.languages[0]||Fc.userLanguage||Fc.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};fS.forEach(function(n){ji.prototype[`handleTech${qi(n)}_`]=function(){return this.trigger(n)}});nt.registerComponent("Player",ji);const Pf="plugin",du="activePlugins_",iu={},Ff=n=>iu.hasOwnProperty(n),pf=n=>Ff(n)?iu[n]:void 0,pS=(n,e)=>{n[du]=n[du]||{},n[du][e]=!0},Uf=(n,e,t)=>{const i=(t?"before":"")+"pluginsetup";n.trigger(i,e),n.trigger(i+":"+e.name,e)},XM=function(n,e){const t=function(){Uf(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return pS(this,n),Uf(this,{name:n,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},i_=(n,e)=>(e.prototype.name=n,function(...t){Uf(this,{name:n,plugin:e,instance:null},!0);const i=new e(this,...t);return this[n]=()=>i,Uf(this,i.getEventHash()),i});class Vr{constructor(e){if(this.constructor===Vr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),My(this),delete this.trigger,ET(this,this.constructor.defaultState),pS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ru(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[du][e]=!1,this.player=this.state=null,t[e]=i_(e,iu[e])}static isBasic(e){const t=typeof e=="string"?pf(e):e;return typeof t=="function"&&!Vr.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Ff(e))En.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ji.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return iu[e]=t,e!==Pf&&(Vr.isBasic(t)?ji.prototype[e]=XM(e,t):ji.prototype[e]=i_(e,t)),t}static deregisterPlugin(e){if(e===Pf)throw new Error("Cannot de-register base plugin.");Ff(e)&&(delete iu[e],delete ji.prototype[e])}static getPlugins(e=Object.keys(iu)){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||""}}Vr.getPlugin=pf;Vr.BASE_PLUGIN_NAME=Pf;Vr.registerPlugin(Pf,Vr);ji.prototype.usingPlugin=function(n){return!!this[du]&&this[du][n]===!0};ji.prototype.hasPlugin=function(n){return!!Ff(n)};function YM(n,e){let t=!1;return function(...i){return t||En.warn(n),t=!0,e.apply(this,i)}}function Rs(n,e,t,i){return YM(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var QM={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 mS=n=>n.indexOf("#")===0?n.slice(1):n;function Be(n,e,t){let i=Be.getPlayer(n);if(i)return e&&En.warn(`Player "${n}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const a=typeof n=="string"?Ao("#"+mS(n)):n;if(!ju(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");const u=("getRootNode"in a?a.getRootNode()instanceof ue.ShadowRoot:!1)?a.getRootNode():a.ownerDocument.body;(!a.ownerDocument.defaultView||!u.contains(a))&&En.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)),Co("beforesetup").forEach(f=>{const g=f(a,pi(e));if(!ta(g)||Array.isArray(g)){En.error("please return an object in beforesetup hooks");return}e=pi(e,g)});const h=nt.getComponent("Player");return i=new h(a,e,t),Co("setup").forEach(f=>f(i)),i}Be.hooks_=Ca;Be.hooks=Co;Be.hook=M4;Be.hookOnce=j4;Be.removeHook=Qw;if(ue.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Mu()){let n=Ao(".vjs-styles-defaults");if(!n){n=_T("vjs-styles-defaults");const e=Ao("head");e&&e.insertBefore(n,e.firstChild),wT(n,`
|
||
.video-js {
|
||
width: 300px;
|
||
height: 150px;
|
||
}
|
||
|
||
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
padding-top: 56.25%
|
||
}
|
||
`)}}qg(1,Be);Be.VERSION=Ug;Be.options=ji.prototype.options_;Be.getPlayers=()=>ji.players;Be.getPlayer=n=>{const e=ji.players;let t;if(typeof n=="string"){const i=mS(n),a=e[i];if(a)return a;t=Ao("#"+i)}else t=n;if(ju(t)){const{player:i,playerId:a}=t;if(i||e[a])return i||e[a]}};Be.getAllPlayers=()=>Object.keys(ji.players).map(n=>ji.players[n]).filter(Boolean);Be.players=ji.players;Be.getComponent=nt.getComponent;Be.registerComponent=(n,e)=>(bn.isTech(e)&&En.warn(`The ${n} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),nt.registerComponent.call(nt,n,e));Be.getTech=bn.getTech;Be.registerTech=bn.registerTech;Be.use=sM;Object.defineProperty(Be,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Be.middleware,"TERMINATOR",{value:If,writeable:!1,enumerable:!0});Be.browser=aT;Be.obj=L4;Be.mergeOptions=Rs(9,"videojs.mergeOptions","videojs.obj.merge",pi);Be.defineLazyProperty=Rs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",l0);Be.bind=Rs(9,"videojs.bind","native Function.prototype.bind",_i);Be.registerPlugin=Vr.registerPlugin;Be.deregisterPlugin=Vr.deregisterPlugin;Be.plugin=(n,e)=>(En.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Vr.registerPlugin(n,e));Be.getPlugins=Vr.getPlugins;Be.getPlugin=Vr.getPlugin;Be.getPluginVersion=Vr.getPluginVersion;Be.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Be.options.languages=pi(Be.options.languages,{[n]:e}),Be.options.languages[n]};Be.log=En;Be.createLogger=Zw;Be.time=Y4;Be.createTimeRange=Rs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ms);Be.createTimeRanges=Rs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ms);Be.formatTime=Rs(9,"videojs.formatTime","videojs.time.formatTime",vl);Be.setFormatTime=Rs(9,"videojs.setFormatTime","videojs.time.setFormatTime",NT);Be.resetFormatTime=Rs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",DT);Be.parseUrl=Rs(9,"videojs.parseUrl","videojs.url.parseUrl",Ly);Be.isCrossOrigin=Rs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",x0);Be.EventTarget=os;Be.any=Dy;Be.on=as;Be.one=b0;Be.off=xr;Be.trigger=Ru;Be.xhr=Iw;Be.TrackList=xl;Be.TextTrack=wd;Be.TextTrackList=Ry;Be.AudioTrack=LT;Be.AudioTrackList=jT;Be.VideoTrack=IT;Be.VideoTrackList=RT;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(n=>{Be[n]=function(){return En.warn(`videojs.${n}() is deprecated; use videojs.dom.${n}() instead`),vT[n].apply(null,arguments)}});Be.computedStyle=Rs(9,"videojs.computedStyle","videojs.dom.computedStyle",Au);Be.dom=vT;Be.fn=q4;Be.num=EM;Be.str=W4;Be.url=iM;Be.Error=QM;class ZM{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class zf extends Be.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 ZM(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}}zf.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const n in zf.prototype.allowedEvents_)zf.prototype["on"+n]=null;var gS="4.1.0";const JM=function(n,e){const t=n.qualityLevels,i=new zf,a=function(){i.dispose(),n.qualityLevels=t,n.off("dispose",a)};return n.on("dispose",a),n.qualityLevels=()=>i,n.qualityLevels.VERSION=gS,i},yS=function(n){return JM(this,Be.obj.merge({},n))};Be.registerPlugin("qualityLevels",yS);yS.VERSION=gS;const zr=r0,$f=(n,e)=>e&&e.responseURL&&n!==e.responseURL?e.responseURL:n,xs=n=>Be.log.debug?Be.log.debug.bind(Be,"VHS:",`${n} >`):function(){};function ri(...n){const e=Be.obj||Be;return(e.merge||e.mergeOptions).apply(e,n)}function ur(...n){const e=Be.time||Be;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function ej(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 Qs=1/30,Zs=Qs*3,bS=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 ur(t)},ru=function(n,e){return bS(n,function(t,i){return t-Zs<=e&&i+Zs>=e})},Qh=function(n,e){return bS(n,function(t){return t-Qs>=e})},tj=function(n){if(n.length<2)return ur();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 ur(e)},nj=function(n,e){let t=null,i=null,a=0;const l=[],u=[];if(!n||!n.length||!e||!e.length)return ur();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 ur(u)},vS=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(", ")},ij=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},rj=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},hg=function(n){if(!(!n||!n.length||!n.end))return n.end(n.length-1)},Zy=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},Jy=(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},Zg=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),[]),xS=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},_S=({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},wS=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=xS(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},sj=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+=Jy(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},aj=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+=Jy(n,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},TS=function(n,e,t){if(typeof e>"u"&&(e=n.mediaSequence+n.segments.length),e<n.mediaSequence)return 0;const i=sj(n,e);if(i.precise)return i.result;const a=aj(n,e);return a.precise?a.result:i.result+t},SS=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 ue.Infinity}return TS(n,e,t)},ad=function({defaultDuration:n,durationList:e,startIndex:t,endIndex:i}){let a=0;if(t>i&&([t,i]=[i,t]),t<0){for(let l=t;l<Math.min(0,i);l++)a+=n;t=0}for(let l=t;l<i;l++)a+=e[l].duration;return a},kS=function(n,e,t,i){if(!n||!n.segments)return null;if(n.endList)return SS(n);if(e===null)return null;e=e||0;let a=TS(n,n.mediaSequence+n.segments.length,e);return t&&(i=typeof i=="number"?i:wS(null,n),a-=i),Math.max(0,a)},oj=function(n,e,t){const a=e||0;let l=kS(n,e,!0,t);return l===null?ur():(l<a&&(l=a),ur(a,l))},lj=function({playlist:n,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:a,exactManifestTimings:l}){let u=e-a;const h=Zg(n);let f=0;for(let g=0;g<h.length;g++){const _=h[g];if(t===_.segmentIndex&&!(typeof i=="number"&&typeof _.partIndex=="number"&&i!==_.partIndex)){f=g;break}}if(u<0){if(f>0)for(let g=f-1;g>=0;g--){const _=h[g];if(u+=_.duration,l){if(u<0)continue}else if(u+Qs<=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a-ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e}}if(f<0){for(let g=f;g<0;g++)if(u-=n.targetDuration,u<0)return{partIndex:h[0]&&h[0].partIndex||null,segmentIndex:h[0]&&h[0].segmentIndex||0,startTime:e};f=0}for(let g=f;g<h.length;g++){const _=h[g];u-=_.duration;const S=_.duration>Qs,C=u===0,D=S&&u+Qs>=0;if(!((C||D)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-Qs>=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a+ad({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:e}},ES=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},eb=function(n){return n.excludeUntil&&n.excludeUntil===1/0},S0=function(n){const e=ES(n);return!n.disabled&&!e},uj=function(n){return n.disabled},cj=function(n){for(let e=0;e<n.segments.length;e++)if(n.segments[e].key)return!0;return!1},CS=function(n,e){return e.attributes&&e.attributes[n]},dj=function(n,e,t,i=0){return CS("BANDWIDTH",t)?(n*t.attributes.BANDWIDTH-i*8)/e:NaN},Jg=(n,e)=>{if(n.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(i=>S0(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},tb=(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),r_=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},Ed=n=>{if(!n||!n.playlists||!n.playlists.length)return r_(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=>Fw(l))||r_(n,l=>tb(t,l))))return!1}return!0};var Hr={liveEdgeDelay:wS,duration:SS,seekable:oj,getMediaInfoForTime:lj,isEnabled:S0,isDisabled:uj,isExcluded:ES,isIncompatible:eb,playlistEnd:kS,isAes:cj,hasAttribute:CS,estimateSegmentRequestTime:dj,isLowestEnabledRendition:Jg,isAudioOnly:Ed,playlistMatch:tb,segmentDurationWithParts:Jy};const{log:AS}=Be,hu=(n,e)=>`${n}-${e}`,NS=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,hj=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new J3;n&&u.on("warn",n),e&&u.on("info",e),i.forEach(g=>u.addParser(g)),a.forEach(g=>u.addTagMapper(g)),u.push(t),u.end();const h=u.manifest;if(l||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(g){h.hasOwnProperty(g)&&delete h[g]}),h.segments&&h.segments.forEach(function(g){["parts","preloadHints"].forEach(function(_){g.hasOwnProperty(_)&&delete g[_]})})),!h.targetDuration){let g=10;h.segments&&h.segments.length&&(g=h.segments.reduce((_,S)=>Math.max(_,S.duration),0)),n&&n({message:`manifest has no targetDuration defaulting to ${g}`}),h.targetDuration=g}const f=xS(h);if(f.length&&!h.partTargetDuration){const g=f.reduce((_,S)=>Math.max(_,S.duration),0);n&&(n({message:`manifest has no partTargetDuration defaulting to ${g}`}),AS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),h.partTargetDuration=g}return h},Bu=(n,e)=>{n.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(n.mediaGroups[t])for(const i in n.mediaGroups[t])for(const a in n.mediaGroups[t][i]){const l=n.mediaGroups[t][i][a];e(l,t,i,a)}})},DS=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},fj=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];DS({playlist:t,id:hu(e,t.uri)}),t.resolvedUri=zr(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||AS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},pj=n=>{Bu(n,e=>{e.uri&&(e.resolvedUri=zr(n.uri,e.uri))})},mj=(n,e)=>{const t=hu(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:ue.location.href,resolvedUri:ue.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},MS=(n,e,t=NS)=>{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=Ed(n);Bu(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=[Xi({},a)]}a.playlists.forEach(function(f,g){const _=t(l,u,h,f),S=hu(g,_);f.uri?f.resolvedUri=f.resolvedUri||zr(n.uri,f.uri):(f.uri=g===0?_:S,f.resolvedUri=f.uri),f.id=f.id||S,f.attributes=f.attributes||{},n.playlists[f.id]=f,n.playlists[f.uri]=f})}),fj(n),pj(n)};class s_{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 jS=22,ml=({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=Xi({},t),u.errorType=Be.Error.NetworkRequestFailed;else if(e.aborted)u.errorType=Be.Error.NetworkRequestAborted;else if(e.timedout)u.errorType=Be.Error.NetworkRequestTimeout;else if(h){const f=i?Be.Error.NetworkBodyParserFailed:Be.Error.NetworkBadStatus;u.errorType=f,u.status=e.status,u.headers=e.headers}return u},gj=xs("CodecUtils"),RS=function(n){const e=n.attributes||{};if(e.CODECS)return Ws(e.CODECS)},OS=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},yj=(n,e)=>{if(!OS(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},gd=function(n){const e={};return n.forEach(({mediaType:t,type:i,details:a})=>{e[t]=e[t]||[],e[t].push(Pw(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){gj(`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},a_=function(n){let e=0;return n.audio&&e++,n.video&&e++,e},od=function(n,e){const t=e.attributes||{},i=gd(RS(e)||[]);if(OS(n,e)&&!i.audio&&!yj(n,e)){const a=gd(tD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:bj}=Be,vj=(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=_S(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 ue.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},xj=(n,e)=>{if(!n)return e;const t=ri(n,e);if(n.preloadHints&&!e.preloadHints&&delete t.preloadHints,n.parts&&!e.parts)delete t.parts;else if(n.parts&&e.parts)for(let i=0;i<e.parts.length;i++)n.parts&&n.parts[i]&&(t.parts[i]=ri(n.parts[i],e.parts[i]));return!n.skipped&&e.skipped&&(t.skipped=!1),n.preload&&!e.preload&&(t.preload=!1),t},_j=(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(xj(f,g))):(u&&!g.map&&(g.map=u),l.push(g))}return l},LS=(n,e)=>{!n.resolvedUri&&n.uri&&(n.resolvedUri=zr(e,n.uri)),n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=zr(e,n.key.uri)),n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=zr(e,n.map.uri)),n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=zr(e,n.map.key.uri)),n.parts&&n.parts.length&&n.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))}),n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=zr(e,t.uri))})},IS=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},BS=(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,ey=(n,e,t=BS)=>{const i=ri(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=IS(e);const l=ri(a,e);if(l.preloadSegment&&!e.preloadSegment&&delete l.preloadSegment,a.segments){if(e.skip){e.segments=e.segments||[];for(let u=0;u<e.skip.skippedSegments;u++)e.segments.unshift({skipped:!0})}l.segments=_j(a.segments,e.segments,e.mediaSequence-a.mediaSequence)}l.segments.forEach(u=>{LS(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,Bu(n,(u,h,f,g)=>{if(u.playlists)for(let _=0;_<u.playlists.length;_++)e.id===u.playlists[_].id&&(u.playlists[_]=l)}),i},ty=(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},o_=(n,e,t)=>{if(!n)return;const i=[];return n.forEach(a=>{if(!a.attributes)return;const{BANDWIDTH:l,RESOLUTION:u,CODECS:h}=a.attributes;i.push({id:a.id,bandwidth:l,resolution:u,codecs:h})}),{type:e,isLive:t,renditions:i}};class su extends bj{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=xs("PlaylistLoader");const{withCredentials:a=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=a,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const l=t.options_;this.customTagParsers=l&&l.customTagParsers||[],this.customTagMappers=l&&l.customTagMappers||[],this.llhls=l&&l.llhls,this.dateRangesStorage_=new s_,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=zr(this.main.uri,e.uri);this.llhls&&(t=vj(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,a)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:a,id:l}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[l],status:e.status,message:`HLS playlist request error at URL: ${a}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ml({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=hj({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:Be.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=RS(i)||[];return!!gd(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(),DS({playlist:u,uri:i,id:a});const h=ey(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_(ty(this.media(),!!h)),l.parsedPlaylist=o_(this.main.playlists,l.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:l}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),ue.clearTimeout(this.mediaUpdateTimeout),ue.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new s_,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(ue.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=ue.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_(ty(e,!0)),!a)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const u={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:u}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(h,f)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=$f(e.resolvedUri,f),h)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:u}),this.haveMetadata({playlistString:f.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(ue.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&&(ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=ue.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&&(ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=ue.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=ue.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:ml({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=$f(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const a=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=o_(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,MS(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=IS(i),i.segments.forEach(a=>{LS(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||ue.location.href;this.main=mj(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,a=e.ID;let l=i.playlists.length;for(;l--;){const u=i.playlists[l];if(u.attributes["PATHWAY-ID"]===a){const h=u.resolvedUri,f=u.id;if(t){const g=this.createCloneURI_(u.resolvedUri,e),_=hu(a,g),S=this.createCloneAttributes_(a,u.attributes),C=this.createClonePlaylist_(u,_,e,S);i.playlists[l]=C,i.playlists[_]=C,i.playlists[g]=C}else i.playlists.splice(l,1);delete i.playlists[f],delete i.playlists[h]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,a=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!i.mediaGroups[l]||!i.mediaGroups[l][a])){for(const u in i.mediaGroups[l])if(u===a){for(const h in i.mediaGroups[l][u])i.mediaGroups[l][u][h].playlists.forEach((g,_)=>{const S=i.playlists[g.id],C=S.id,D=S.resolvedUri;delete i.playlists[C],delete i.playlists[D]});delete i.mediaGroups[l][u]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,a=i.playlists.length,l=this.createCloneURI_(t.resolvedUri,e),u=hu(e.ID,l),h=this.createCloneAttributes_(e.ID,t.attributes),f=this.createClonePlaylist_(t,u,e,h);i.playlists[a]=f,i.playlists[u]=f,i.playlists[l]=f,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],a=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(l=>{if(!(!a.mediaGroups[l]||a.mediaGroups[l][t]))for(const u in a.mediaGroups[l]){if(u===i)a.mediaGroups[l][t]={};else continue;for(const h in a.mediaGroups[l][u]){const f=a.mediaGroups[l][u][h];a.mediaGroups[l][t][h]=Xi({},f);const g=a.mediaGroups[l][t][h],_=this.createCloneURI_(f.resolvedUri,e);g.resolvedUri=_,g.uri=_,g.playlists=[],f.playlists.forEach((S,C)=>{const D=a.playlists[S.id],R=NS(l,t,h),E=hu(t,R);if(D&&!a.playlists[E]){const B=this.createClonePlaylist_(D,E,e),G=B.resolvedUri;a.playlists[E]=B,a.playlists[G]=B}g.playlists[C]=this.createClonePlaylist_(S,E,e)})}}})}createClonePlaylist_(e,t,i,a){const l=this.createCloneURI_(e.resolvedUri,i),u={resolvedUri:l,uri:l,id:t};return e.segments&&(u.segments=[]),a&&(u.attributes=a),ri(e,u)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const a=t["URI-REPLACEMENT"].PARAMS;for(const l of Object.keys(a))i.searchParams.set(l,a[l]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(a=>{t[a]&&(i[a]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const a=e.contentProtection[i].attributes.keyId;t.add(a.toLowerCase())}return t}}const ny=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)},wj=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},Tj=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},PS=function(){const n=function e(t,i){t=ri({timeout:45e3},t);const a=e.beforeRequest||Be.Vhs.xhr.beforeRequest,l=e._requestCallbackSet||Be.Vhs.xhr._requestCallbackSet||new Set,u=e._responseCallbackSet||Be.Vhs.xhr._responseCallbackSet;a&&typeof a=="function"&&(Be.log.warn("beforeRequest is deprecated, use onRequest instead."),l.add(a));const h=Be.Vhs.xhr.original===!0?Be.xhr:Be.Vhs.xhr,f=wj(l,t);l.delete(a);const g=h(f||t,function(S,C){return Tj(u,g,S,C),ny(g,S,C,i)}),_=g.abort;return g.abort=function(){return g.aborted=!0,_.apply(g,arguments)},g.uri=t.uri,g.requestType=t.requestType,g.requestTime=Date.now(),g};return n.original=!0,n},Sj=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ue.BigInt(n.offset)+ue.BigInt(n.length)-ue.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},iy=function(n){const e={};return n.byterange&&(e.Range=Sj(n.byterange)),e},kj=function(n,e){return n.start(e)+"-"+n.end(e)},Ej=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Cj=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},FS=function(n){const e={};return Object.keys(n).forEach(t=>{const i=n[t];zw(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Hf=function(n){const e=n.byterange||{length:1/0,offset:0};return[e.length,e.offset,n.resolvedUri].join(",")},US=function(n){return n.resolvedUri},zS=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(Ej).join(""),l=e.slice(u*t,u*t+t).map(Cj).join(""),i+=a+" "+l+`
|
||
`;return i},Aj=({bytes:n})=>zS(n),Nj=n=>{let e="",t;for(t=0;t<n.length;t++)e+=kj(n,t)+" ";return e};var Dj=Object.freeze({__proto__:null,createTransferableMessage:FS,initSegmentId:Hf,segmentKeyId:US,hexDump:zS,tagDump:Aj,textRanges:Nj});const $S=.25,Mj=(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)},jj=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,Rj=(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?jj(a.videoTimingInfo):a.duration+a.duration*$S,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:Hr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Oj=(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*$S)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},Lj=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},Ij=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},Bj=({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=Oj(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=Mj(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},HS=({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(!Ij(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=Rj(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=Lj(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",()=>{HS({programTime:n,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:a,tech:l,callback:u})});return}const _=f.start+g,S=()=>u(null,l.currentTime());l.one("seeked",S),a&&l.pause(),i(_)},fg=(n,e)=>{if(n.readyState===4)return e()},Pj=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,C,D,R){return C.abort(),u=!0,t(S,C,D,R)},f=function(S,C){if(u)return;if(S)return S.metadata=ml({requestType:i,request:C,error:S}),h(S,C,"",a);const D=C.responseText.substring(a&&a.byteLength||0,C.responseText.length);if(a=dD(a,$w(D,!0)),l=l||Kc(a),a.length<10||l&&a.length<l+2)return fg(C,()=>h(S,C,"",a));const R=ky(a);return R==="ts"&&a.length<188?fg(C,()=>h(S,C,"",a)):!R&&a.length<376?fg(C,()=>h(S,C,"",a)):h(null,C,R,a)},_=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:C,loaded:D}){return ny(S,null,{statusCode:S.status},f)})}},function(S,C){return ny(_,S,C,f)});return _},{EventTarget:Fj}=Be,l_=function(n,e){if(!BS(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},Uj=(n,e,t,i)=>{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},zj=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=u4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return MS(l,e,Uj),l},$j=(n,e)=>{Bu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},Hj=(n,e,t)=>{let i=!0,a=ri(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=a0(u.sidx);t&&t[f]&&t[f].sidx&&wy(u,t[f].sidx,u.sidx.resolvedUri)}const h=ey(a,u,l_);h&&(a=h,i=!1)}return Bu(e,(l,u,h,f)=>{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,_=ey(a,l.playlists[0],l_);_&&(a=_,f in a.mediaGroups[u][h]||(a.mediaGroups[u][h][f]=l),a.mediaGroups[u][h][f].playlists[0]=a.playlists[g],i=!1)}}),$j(a,e),e.minimumUpdatePeriod!==n.minimumUpdatePeriod&&(i=!1),i?null:a},qj=(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,u_=(n,e)=>{const t={};for(const i in n){const l=n[i].sidx;if(l){const u=a0(l);if(!e[u])break;const h=e[u].sidxInfo;qj(h,l)&&(t[u]=e[u])}}return t},Vj=(n,e)=>{let i=u_(n.playlists,e);return Bu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ri(i,u_(f,e))}}),i};class ry extends Fj{constructor(e,t,i={},a){super(),this.isPaused_=!0,this.mainPlaylistLoader_=a||this,a||(this.isMain_=!0);const{withCredentials:l=!1}=i;if(this.vhs_=t,this.withCredentials=l,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=xs("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const a=e.sidx&&a0(e.sidx);if(!e.sidx||!a||this.mainPlaylistLoader_.sidxMapping_[a]){ue.clearTimeout(this.mediaRequest_),this.mediaRequest_=ue.setTimeout(()=>i(!1),0);return}const l=$f(e.sidx.resolvedUri),u=(f,g)=>{if(this.requestErrored_(f,g,t))return;const _=this.mainPlaylistLoader_.sidxMapping_,{requestType:S}=g;let C;try{C=p4(tn(g.response).subarray(8))}catch(D){D.metadata=ml({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(D,g,t);return}return _[a]={sidxInfo:e.sidx,sidx:C},wy(e,C,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=Pj(l,this.vhs_.xhr,(f,g,_,S)=>{if(f)return u(f,g);if(!_||_!=="mp4"){const R=_||"unknown";return u({status:g.status,message:`Unsupported ${R} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:C,length:D}=e.sidx.byterange;if(S.length>=D+C)return u(f,{response:S.subarray(C,C+D),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:iy({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},ue.clearTimeout(this.minimumUpdatePeriodTimeout_),ue.clearTimeout(this.mediaRequest_),ue.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,ue.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(),ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(ue.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,ue.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=ue.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_){ue.clearTimeout(this.mediaRequest_),this.mediaRequest_=ue.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,a)=>{if(i){const{requestType:u}=a;i.metadata=ml({requestType:u,request:a,error:i})}if(this.requestErrored_(i,a)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const l=a.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=a.responseText,a.responseHeaders&&a.responseHeaders.date?this.mainLoaded_=Date.parse(a.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=$f(this.mainPlaylistLoader_.srcUrl,a),l){this.handleMain_(),this.syncClientServerClock_(()=>e(a,l));return}return e(a,l)})}syncClientServerClock_(e){const t=c4(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:zr(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,a)=>{if(!this.request)return;if(i){const{requestType:u}=a;return this.error.metadata=ml({requestType:u,request:a,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let l;t.method==="HEAD"?!a.responseHeaders||!a.responseHeaders.date?l=this.mainLoaded_:l=Date.parse(a.responseHeaders.date):l=Date.parse(a.responseText),this.mainPlaylistLoader_.clientOffset_=l-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){ue.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=zj({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:Be.Error.StreamingDashManifestParserError,error:l},this.trigger("error")}e&&(i=Hj(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_&&(ue.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_=ue.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_=Vj(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=ue.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},ty(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 or={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 Gj=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},qS=function(n){return n.on=n.addEventListener,n.off=n.removeEventListener,n},Kj=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())}},VS=function(n){return function(){const e=Kj(n),t=qS(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}},GS=function(n){return`var browserWorkerPolyFill = ${qS.toString()};
|
||
browserWorkerPolyFill(self);
|
||
`+n},KS=function(n){return n.toString().replace(/^function.+?{/,"").slice(0,-1)},Wj=GS(KS(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,w){p[v]||(p[v]=[]),p[v]=p[v].concat(w)},this.off=function(v,w){var x;return p[v]?(x=p[v].indexOf(w),p[v]=p[v].slice(),p[v].splice(x,1),x>-1):!1},this.trigger=function(v){var w,x,T,A;if(w=p[v],!!w)if(arguments.length===2)for(T=w.length,x=0;x<T;++x)w[x].call(this,arguments[1]);else{for(A=[],x=arguments.length,x=1;x<arguments.length;++x)A.push(arguments[x]);for(T=w.length,x=0;x<T;++x)w[x].apply(this,A)}},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),w;return v.getBigUint64?(w=v.getBigUint64(0),w<Number.MAX_SAFE_INTEGER?Number(w):w):v.getUint32(0)*i+v.getUint32(4)},l={getUint64:a,MAX_UINT32:i},u=l.MAX_UINT32,h,f,g,_,S,C,D,R,E,B,G,Y,q,se,Q,K,O,re,k,j,te,V,ne,he,ae,z,P,Z,ee,fe,I,pe,ke,ye,me,pt;(function(){var p;if(ne={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 ne)ne.hasOwnProperty(p)&&(ne[p]=[p.charCodeAt(0),p.charCodeAt(1),p.charCodeAt(2),p.charCodeAt(3)]);he=new Uint8Array([105,115,111,109]),z=new Uint8Array([97,118,99,49]),ae=new Uint8Array([0,0,0,1]),P=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Z=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]),ee={video:P,audio:Z},pe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),I=new Uint8Array([0,0,0,0,0,0,0,0]),ke=new Uint8Array([0,0,0,0,0,0,0,0]),ye=ke,me=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),pt=ke,fe=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(p){var v=[],w=0,x,T,A;for(x=1;x<arguments.length;x++)v.push(arguments[x]);for(x=v.length;x--;)w+=v[x].byteLength;for(T=new Uint8Array(w+8),A=new DataView(T.buffer,T.byteOffset,T.byteLength),A.setUint32(0,T.byteLength),T.set(p,4),x=0,w=8;x<v.length;x++)T.set(v[x],w),w+=v[x].byteLength;return T},f=function(){return h(ne.dinf,h(ne.dref,pe))},g=function(p){return h(ne.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]))},_=function(){return h(ne.ftyp,he,ae,he,z)},K=function(p){return h(ne.hdlr,ee[p])},S=function(p){return h(ne.mdat,p)},Q=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(ne.mdhd,v)},se=function(p){return h(ne.mdia,Q(p),K(p.type),D(p))},C=function(p){return h(ne.mfhd,new Uint8Array([0,0,0,0,(p&4278190080)>>24,(p&16711680)>>16,(p&65280)>>8,p&255]))},D=function(p){return h(ne.minf,p.type==="video"?h(ne.vmhd,fe):h(ne.smhd,I),f(),re(p))},R=function(p,v){for(var w=[],x=v.length;x--;)w[x]=j(v[x]);return h.apply(null,[ne.moof,C(p)].concat(w))},E=function(p){for(var v=p.length,w=[];v--;)w[v]=Y(p[v]);return h.apply(null,[ne.moov,G(4294967295)].concat(w).concat(B(p)))},B=function(p){for(var v=p.length,w=[];v--;)w[v]=te(p[v]);return h.apply(null,[ne.mvex].concat(w))},G=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(ne.mvhd,v)},O=function(p){var v=p.samples||[],w=new Uint8Array(4+v.length),x,T;for(T=0;T<v.length;T++)x=v[T].flags,w[T+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return h(ne.sdtp,w)},re=function(p){return h(ne.stbl,k(p),h(ne.stts,pt),h(ne.stsc,ye),h(ne.stsz,me),h(ne.stco,ke))},(function(){var p,v;k=function(w){return h(ne.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),w.type==="video"?p(w):v(w))},p=function(w){var x=w.sps||[],T=w.pps||[],A=[],X=[],J,oe;for(J=0;J<x.length;J++)A.push((x[J].byteLength&65280)>>>8),A.push(x[J].byteLength&255),A=A.concat(Array.prototype.slice.call(x[J]));for(J=0;J<T.length;J++)X.push((T[J].byteLength&65280)>>>8),X.push(T[J].byteLength&255),X=X.concat(Array.prototype.slice.call(T[J]));if(oe=[ne.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(w.width&65280)>>8,w.width&255,(w.height&65280)>>8,w.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),h(ne.avcC,new Uint8Array([1,w.profileIdc,w.profileCompatibility,w.levelIdc,255].concat([x.length],A,[T.length],X))),h(ne.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],w.sarRatio){var ce=w.sarRatio[0],Ne=w.sarRatio[1];oe.push(h(ne.pasp,new Uint8Array([(ce&4278190080)>>24,(ce&16711680)>>16,(ce&65280)>>8,ce&255,(Ne&4278190080)>>24,(Ne&16711680)>>16,(Ne&65280)>>8,Ne&255])))}return h.apply(null,oe)},v=function(w){return h(ne.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(w.channelcount&65280)>>8,w.channelcount&255,(w.samplesize&65280)>>8,w.samplesize&255,0,0,0,0,(w.samplerate&65280)>>8,w.samplerate&255,0,0]),g(w))}})(),q=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(ne.tkhd,v)},j=function(p){var v,w,x,T,A,X,J;return v=h(ne.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])),X=Math.floor(p.baseMediaDecodeTime/u),J=Math.floor(p.baseMediaDecodeTime%u),w=h(ne.tfdt,new Uint8Array([1,0,0,0,X>>>24&255,X>>>16&255,X>>>8&255,X&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255])),A=92,p.type==="audio"?(x=V(p,A),h(ne.traf,v,w,x)):(T=O(p),x=V(p,T.length+A),h(ne.traf,v,w,x,T))},Y=function(p){return p.duration=p.duration||4294967295,h(ne.trak,q(p),se(p))},te=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(ne.trex,v)},(function(){var p,v,w;w=function(x,T){var A=0,X=0,J=0,oe=0;return x.length&&(x[0].duration!==void 0&&(A=1),x[0].size!==void 0&&(X=2),x[0].flags!==void 0&&(J=4),x[0].compositionTimeOffset!==void 0&&(oe=8)),[0,0,A|X|J|oe,1,(x.length&4278190080)>>>24,(x.length&16711680)>>>16,(x.length&65280)>>>8,x.length&255,(T&4278190080)>>>24,(T&16711680)>>>16,(T&65280)>>>8,T&255]},v=function(x,T){var A,X,J,oe,ce,Ne;for(oe=x.samples||[],T+=20+16*oe.length,J=w(oe,T),X=new Uint8Array(J.length+oe.length*16),X.set(J),A=J.length,Ne=0;Ne<oe.length;Ne++)ce=oe[Ne],X[A++]=(ce.duration&4278190080)>>>24,X[A++]=(ce.duration&16711680)>>>16,X[A++]=(ce.duration&65280)>>>8,X[A++]=ce.duration&255,X[A++]=(ce.size&4278190080)>>>24,X[A++]=(ce.size&16711680)>>>16,X[A++]=(ce.size&65280)>>>8,X[A++]=ce.size&255,X[A++]=ce.flags.isLeading<<2|ce.flags.dependsOn,X[A++]=ce.flags.isDependedOn<<6|ce.flags.hasRedundancy<<4|ce.flags.paddingValue<<1|ce.flags.isNonSyncSample,X[A++]=ce.flags.degradationPriority&61440,X[A++]=ce.flags.degradationPriority&15,X[A++]=(ce.compositionTimeOffset&4278190080)>>>24,X[A++]=(ce.compositionTimeOffset&16711680)>>>16,X[A++]=(ce.compositionTimeOffset&65280)>>>8,X[A++]=ce.compositionTimeOffset&255;return h(ne.trun,X)},p=function(x,T){var A,X,J,oe,ce,Ne;for(oe=x.samples||[],T+=20+8*oe.length,J=w(oe,T),A=new Uint8Array(J.length+oe.length*8),A.set(J),X=J.length,Ne=0;Ne<oe.length;Ne++)ce=oe[Ne],A[X++]=(ce.duration&4278190080)>>>24,A[X++]=(ce.duration&16711680)>>>16,A[X++]=(ce.duration&65280)>>>8,A[X++]=ce.duration&255,A[X++]=(ce.size&4278190080)>>>24,A[X++]=(ce.size&16711680)>>>16,A[X++]=(ce.size&65280)>>>8,A[X++]=ce.size&255;return h(ne.trun,A)},V=function(x,T){return x.type==="audio"?p(x,T):v(x,T)}})();var We={ftyp:_,mdat:S,moof:R,moov:E,initSegment:function(p){var v=_(),w=E(p),x;return x=new Uint8Array(v.byteLength+w.byteLength),x.set(v),x.set(w,v.byteLength),x}},_e=function(p){var v,w,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v<p.length;v++)w=p[v],w.nalUnitType==="access_unit_delimiter_rbsp"?(x.length&&(x.duration=w.dts-x.dts,T.byteLength+=x.byteLength,T.nalCount+=x.length,T.duration+=x.duration,T.push(x)),x=[w],x.byteLength=w.data.byteLength,x.pts=w.pts,x.dts=w.dts):(w.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(x.keyFrame=!0),x.duration=w.dts-x.dts,x.byteLength+=w.data.byteLength,x.push(w));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},Ye=function(p){var v,w,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++)w=p[v],w.keyFrame?(x.length&&(T.push(x),T.byteLength+=x.byteLength,T.nalCount+=x.nalCount,T.duration+=x.duration),x=[w],x.nalCount=w.length,x.byteLength=w.byteLength,x.pts=w.pts,x.dts=w.dts,x.duration=w.duration):(x.duration+=w.duration,x.nalCount+=w.length,x.byteLength+=w.byteLength,x.push(w));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},wt=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},je=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Se=function(p,v){var w=je();return w.dataOffset=v,w.compositionTimeOffset=p.pts-p.dts,w.duration=p.duration,w.size=4*p.length,w.size+=p.byteLength,p.keyFrame&&(w.flags.dependsOn=2,w.flags.isNonSyncSample=0),w},Je=function(p,v){var w,x,T,A,X,J=v||0,oe=[];for(w=0;w<p.length;w++)for(A=p[w],x=0;x<A.length;x++)X=A[x],T=Se(X,J),J+=T.size,oe.push(T);return oe},tt=function(p){var v,w,x,T,A,X,J=0,oe=p.byteLength,ce=p.nalCount,Ne=oe+4*ce,Ke=new Uint8Array(Ne),Ct=new DataView(Ke.buffer);for(v=0;v<p.length;v++)for(T=p[v],w=0;w<T.length;w++)for(A=T[w],x=0;x<A.length;x++)X=A[x],Ct.setUint32(J,X.data.byteLength),J+=4,Ke.set(X.data,J),J+=X.data.byteLength;return Ke},ot=function(p,v){var w,x=v||0,T=[];return w=Se(p,x),T.push(w),T},dt=function(p){var v,w,x=0,T=p.byteLength,A=p.length,X=T+4*A,J=new Uint8Array(X),oe=new DataView(J.buffer);for(v=0;v<p.length;v++)w=p[v],oe.setUint32(x,w.data.byteLength),x+=4,J.set(w.data,x),x+=w.data.byteLength;return J},Ut={groupNalsIntoFrames:_e,groupFramesIntoGops:Ye,extendFirstKeyFrame:wt,generateSampleTable:Je,concatenateNalData:tt,generateSampleTableForFrame:ot,concatenateNalDataForFrame:dt},Ge=[33,16,5,32,164,27],Ie=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Ze=function(p){for(var v=[];p--;)v.push(0);return v},et=function(p){return Object.keys(p).reduce(function(v,w){return v[w]=new Uint8Array(p[w].reduce(function(x,T){return x.concat(T)},[])),v},{})},ft,mt=function(){if(!ft){var p={96e3:[Ge,[227,64],Ze(154),[56]],88200:[Ge,[231],Ze(170),[56]],64e3:[Ge,[248,192],Ze(240),[56]],48e3:[Ge,[255,192],Ze(268),[55,148,128],Ze(54),[112]],44100:[Ge,[255,192],Ze(268),[55,163,128],Ze(84),[112]],32e3:[Ge,[255,192],Ze(268),[55,234],Ze(226),[112]],24e3:[Ge,[255,192],Ze(268),[55,255,128],Ze(268),[111,112],Ze(126),[224]],16e3:[Ge,[255,192],Ze(268),[55,255,128],Ze(268),[111,255],Ze(269),[223,108],Ze(195),[1,192]],12e3:[Ie,Ze(268),[3,127,248],Ze(268),[6,255,240],Ze(268),[13,255,224],Ze(268),[27,253,128],Ze(259),[56]],11025:[Ie,Ze(268),[3,127,248],Ze(268),[6,255,240],Ze(268),[13,255,224],Ze(268),[27,255,192],Ze(268),[55,175,128],Ze(108),[112]],8e3:[Ie,Ze(268),[3,121,16],Ze(47),[7]]};ft=et(p)}return ft},de=9e4,ze,Le,Ae,Pe,Qe,St,Ot;ze=function(p){return p*de},Le=function(p,v){return p*v},Ae=function(p){return p/de},Pe=function(p,v){return p/v},Qe=function(p,v){return ze(Pe(p,v))},St=function(p,v){return Le(Ae(p),v)},Ot=function(p,v,w){return Ae(w?p:p-v)};var Tt={ONE_SECOND_IN_TS:de,secondsToVideoTs:ze,secondsToAudioTs:Le,videoTsToSeconds:Ae,audioTsToSeconds:Pe,audioTsToVideoTs:Qe,videoTsToAudioTs:St,metadataTsToSeconds:Ot},an=mt,Nt=Tt,Lt=function(p){var v,w,x=0;for(v=0;v<p.length;v++)w=p[v],x+=w.data.byteLength;return x},vt=function(p,v,w,x){var T,A=0,X=0,J=0,oe=0,ce,Ne,Ke;if(v.length&&(T=Nt.audioTsToVideoTs(p.baseMediaDecodeTime,p.samplerate),A=Math.ceil(Nt.ONE_SECOND_IN_TS/(p.samplerate/1024)),w&&x&&(X=T-Math.max(w,x),J=Math.floor(X/A),oe=J*A),!(J<1||oe>Nt.ONE_SECOND_IN_TS/2))){for(ce=an()[p.samplerate],ce||(ce=v[0].data),Ne=0;Ne<J;Ne++)Ke=v[0],v.splice(0,0,{data:ce,dts:Ke.dts-A,pts:Ke.pts-A});return p.baseMediaDecodeTime-=Math.floor(Nt.videoTsToAudioTs(oe,p.samplerate)),oe}},It=function(p,v,w){return v.minSegmentDts>=w?p:(v.minSegmentDts=1/0,p.filter(function(x){return x.dts>=w?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},yn=function(p){var v,w,x=[];for(v=0;v<p.length;v++)w=p[v],x.push({size:w.data.byteLength,duration:1024});return x},$n=function(p){var v,w,x=0,T=new Uint8Array(Lt(p));for(v=0;v<p.length;v++)w=p[v],T.set(w.data,x),x+=w.data.byteLength;return T},kt={prefixWithSilence:vt,trimAdtsFramesByEarliestDts:It,generateSampleTable:yn,concatenateFrameData:$n},Bn=Tt.ONE_SECOND_IN_TS,at=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))},N=function(p){delete p.minSegmentDts,delete p.maxSegmentDts,delete p.minSegmentPts,delete p.maxSegmentPts},F=function(p,v){var w,x,T=p.minSegmentDts;return v||(T-=p.timelineStartInfo.dts),w=p.timelineStartInfo.baseMediaDecodeTime,w+=T,w=Math.max(0,w),p.type==="audio"&&(x=p.samplerate/Bn,w*=x,w=Math.floor(w)),w},ie={clearDtsInfo:N,calculateTrackBaseMediaDecodeTime:F,collectDtsInfo:at},Me=4,He=128,gt=function(p){for(var v=0,w={payloadType:-1,payloadSize:0},x=0,T=0;v<p.byteLength&&p[v]!==He;){for(;p[v]===255;)x+=255,v++;for(x+=p[v++];p[v]===255;)T+=255,v++;if(T+=p[v++],!w.payload&&x===Me){var A=String.fromCharCode(p[v+3],p[v+4],p[v+5],p[v+6]);if(A==="GA94"){w.payloadType=x,w.payloadSize=T,w.payload=p.subarray(v,v+T);break}else w.payload=void 0}v+=T,x=0,T=0}return w},zt=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)},Jt=function(p,v){var w=[],x,T,A,X;if(!(v[0]&64))return w;for(T=v[0]&31,x=0;x<T;x++)A=x*3,X={type:v[A+2]&3,pts:p},v[A+2]&4&&(X.ccData=v[A+3]<<8|v[A+4],w.push(X));return w},un=function(p){for(var v=p.byteLength,w=[],x=1,T,A;x<v-2;)p[x]===0&&p[x+1]===0&&p[x+2]===3?(w.push(x+2),x+=2):x++;if(w.length===0)return p;T=v-w.length,A=new Uint8Array(T);var X=0;for(x=0;x<T;X++,x++)X===w[0]&&(X++,w.shift()),A[x]=p[X];return A},Xt={parseSei:gt,parseUserData:zt,parseCaptionPackets:Jt,discardEmulationPreventionBytes:un,USER_DATA_REGISTERED_ITU_T_T35:Me},pn=t,fn=Xt,Kt=function(p){p=p||{},Kt.prototype.init.call(this),this.parse708captions_=typeof p.parse708captions=="boolean"?p.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Wt(0,0),new Wt(0,1),new Wt(1,0),new Wt(1,1)],this.parse708captions_&&(this.cc708Stream_=new Dt({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")))};Kt.prototype=new pn,Kt.prototype.push=function(p){var v,w,x;if(p.nalUnitType==="sei_rbsp"&&(v=fn.parseSei(p.escapedRBSP),!!v.payload&&v.payloadType===fn.USER_DATA_REGISTERED_ITU_T_T35&&(w=fn.parseUserData(v),!!w))){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=fn.parseCaptionPackets(p.pts,w),this.captionPackets_=this.captionPackets_.concat(x),this.latestDts_!==p.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=p.dts}},Kt.prototype.flushCCStreams=function(p){this.ccStreams_.forEach(function(v){return p==="flush"?v.flush():v.partialFlush()},this)},Kt.prototype.flushStream=function(p){if(!this.captionPackets_.length){this.flushCCStreams(p);return}this.captionPackets_.forEach(function(v,w){v.presortIndex=w}),this.captionPackets_.sort(function(v,w){return v.pts===w.pts?v.presortIndex-w.presortIndex:v.pts-w.pts}),this.captionPackets_.forEach(function(v){v.type<2?this.dispatchCea608Packet(v):this.dispatchCea708Packet(v)},this),this.captionPackets_.length=0,this.flushCCStreams(p)},Kt.prototype.flush=function(){return this.flushStream("flush")},Kt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Kt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(p){p.reset()})},Kt.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)},Kt.prototype.setsChannel1Active=function(p){return(p.ccData&30720)===4096},Kt.prototype.setsChannel2Active=function(p){return(p.ccData&30720)===6144},Kt.prototype.setsTextOrXDSActive=function(p){return(p.ccData&28928)===256||(p.ccData&30974)===4138||(p.ccData&30974)===6186},Kt.prototype.dispatchCea708Packet=function(p){this.parse708captions_&&this.cc708Stream_.push(p)};var cn={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},dn=function(p){var v=cn[p]||p;return p&4096&&p===v?"":String.fromCharCode(v)},ln=function(p){return 32<=p&&p<=127||160<=p&&p<=255},qt=function(p){this.windowNum=p,this.reset()};qt.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},qt.prototype.getText=function(){return this.rows.join(`
|
||
`)},qt.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},qt.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--},qt.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},qt.prototype.addText=function(p){this.rows[this.rowIdx]+=p},qt.prototype.backspace=function(){if(!this.isEmpty()){var p=this.rows[this.rowIdx];this.rows[this.rowIdx]=p.substr(0,p.length-1)}};var Rt=function(p,v,w){this.serviceNum=p,this.text="",this.currentWindow=new qt(-1),this.windows=[],this.stream=w,typeof v=="string"&&this.createTextDecoder(v)};Rt.prototype.init=function(p,v){this.startPts=p;for(var w=0;w<8;w++)this.windows[w]=new qt(w),typeof v=="function"&&(this.windows[w].beforeRowOverflow=v)},Rt.prototype.setCurrentWindow=function(p){this.currentWindow=this.windows[p]},Rt.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 Dt=function(p){p=p||{},Dt.prototype.init.call(this);var v=this,w=p.captionServices||{},x={},T;Object.keys(w).forEach(A=>{T=w[A],/^SERVICE/.test(A)&&(x[A]=T.encoding)}),this.serviceEncodings=x,this.current708Packet=null,this.services={},this.push=function(A){A.type===3?(v.new708Packet(),v.add708Bytes(A)):(v.current708Packet===null&&v.new708Packet(),v.add708Bytes(A))}};Dt.prototype=new pn,Dt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Dt.prototype.add708Bytes=function(p){var v=p.ccData,w=v>>>8,x=v&255;this.current708Packet.ptsVals.push(p.pts),this.current708Packet.data.push(w),this.current708Packet.data.push(x)},Dt.prototype.push708Packet=function(){var p=this.current708Packet,v=p.data,w=null,x=null,T=0,A=v[T++];for(p.seq=A>>6,p.sizeCode=A&63;T<v.length;T++)A=v[T++],w=A>>5,x=A&31,w===7&&x>0&&(A=v[T++],w=A),this.pushServiceBlock(w,T,x),x>0&&(T+=x-1)},Dt.prototype.pushServiceBlock=function(p,v,w){var x,T=v,A=this.current708Packet.data,X=this.services[p];for(X||(X=this.initService(p,T));T<v+w&&T<A.length;T++)x=A[T],ln(x)?T=this.handleText(T,X):x===24?T=this.multiByteCharacter(T,X):x===16?T=this.extendedCommands(T,X):128<=x&&x<=135?T=this.setCurrentWindow(T,X):152<=x&&x<=159?T=this.defineWindow(T,X):x===136?T=this.clearWindows(T,X):x===140?T=this.deleteWindows(T,X):x===137?T=this.displayWindows(T,X):x===138?T=this.hideWindows(T,X):x===139?T=this.toggleWindows(T,X):x===151?T=this.setWindowAttributes(T,X):x===144?T=this.setPenAttributes(T,X):x===145?T=this.setPenColor(T,X):x===146?T=this.setPenLocation(T,X):x===143?X=this.reset(T,X):x===8?X.currentWindow.backspace():x===12?X.currentWindow.clearText():x===13?X.currentWindow.pendingNewLine=!0:x===14?X.currentWindow.clearText():x===141&&T++},Dt.prototype.extendedCommands=function(p,v){var w=this.current708Packet.data,x=w[++p];return ln(x)&&(p=this.handleText(p,v,{isExtended:!0})),p},Dt.prototype.getPts=function(p){return this.current708Packet.ptsVals[Math.floor(p/2)]},Dt.prototype.initService=function(p,v){var x="SERVICE"+p,w=this,x,T;return x in this.serviceEncodings&&(T=this.serviceEncodings[x]),this.services[p]=new Rt(p,T,w),this.services[p].init(this.getPts(v),function(A){w.flushDisplayed(A,w.services[p])}),this.services[p]},Dt.prototype.handleText=function(p,v,w){var x=w&&w.isExtended,T=w&&w.isMultiByte,A=this.current708Packet.data,X=x?4096:0,J=A[p],oe=A[p+1],ce=v.currentWindow,Ne,Ke;function Ct(it){return it.map(Bt=>("0"+(Bt&255).toString(16)).slice(-2)).join("")}if(T?(Ke=[J,oe],p++):Ke=[J],v.textDecoder_&&!x)Ne=v.textDecoder_.decode(new Uint8Array(Ke));else if(T){const it=Ct(Ke);Ne=String.fromCharCode(parseInt(it,16))}else Ne=dn(X|J);return ce.pendingNewLine&&!ce.isEmpty()&&ce.newLine(this.getPts(p)),ce.pendingNewLine=!1,ce.addText(Ne),p},Dt.prototype.multiByteCharacter=function(p,v){var w=this.current708Packet.data,x=w[p+1],T=w[p+2];return ln(x)&&ln(T)&&(p=this.handleText(++p,v,{isMultiByte:!0})),p},Dt.prototype.setCurrentWindow=function(p,v){var w=this.current708Packet.data,x=w[p],T=x&7;return v.setCurrentWindow(T),p},Dt.prototype.defineWindow=function(p,v){var w=this.current708Packet.data,x=w[p],T=x&7;v.setCurrentWindow(T);var A=v.currentWindow;return x=w[++p],A.visible=(x&32)>>5,A.rowLock=(x&16)>>4,A.columnLock=(x&8)>>3,A.priority=x&7,x=w[++p],A.relativePositioning=(x&128)>>7,A.anchorVertical=x&127,x=w[++p],A.anchorHorizontal=x,x=w[++p],A.anchorPoint=(x&240)>>4,A.rowCount=x&15,x=w[++p],A.columnCount=x&63,x=w[++p],A.windowStyle=(x&56)>>3,A.penStyle=x&7,A.virtualRowCount=A.rowCount+1,p},Dt.prototype.setWindowAttributes=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.winAttr;return x=w[++p],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=w[++p],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=w[++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=w[++p],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,p},Dt.prototype.flushDisplayed=function(p,v){for(var w=[],x=0;x<8;x++)v.windows[x].visible&&!v.windows[x].isEmpty()&&w.push(v.windows[x].getText());v.endPts=p,v.text=w.join(`
|
||
|
||
`),this.pushCaption(v),v.startPts=p},Dt.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)},Dt.prototype.displayWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=1);return p},Dt.prototype.hideWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=0);return p},Dt.prototype.toggleWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible^=1);return p},Dt.prototype.clearWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].clearText();return p},Dt.prototype.deleteWindows=function(p,v){var w=this.current708Packet.data,x=w[++p],T=this.getPts(p);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].reset();return p},Dt.prototype.setPenAttributes=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.penAttr;return x=w[++p],T.textTag=(x&240)>>4,T.offset=(x&12)>>2,T.penSize=x&3,x=w[++p],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,p},Dt.prototype.setPenColor=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.penColor;return x=w[++p],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=w[++p],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=w[++p],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,p},Dt.prototype.setPenLocation=function(p,v){var w=this.current708Packet.data,x=w[p],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=w[++p],T.row=x&15,x=w[++p],T.column=x&63,p},Dt.prototype.reset=function(p,v){var w=this.getPts(p);return this.flushDisplayed(w,v),this.initService(v.serviceNum,p)};var Cn={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},Mt=function(p){return p===null?"":(p=Cn[p]||p,String.fromCharCode(p))},Pn=14,Dn=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Mn=function(){for(var p=[],v=Pn+1;v--;)p.push({text:"",indent:0,offset:0});return p},Wt=function(p,v){Wt.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(w){var x,T,A,X,J;if(x=w.ccData&32639,x===this.lastControlCode_){this.lastControlCode_=null;return}if((x&61440)===4096?this.lastControlCode_=x:x!==this.PADDING_&&(this.lastControlCode_=null),A=x>>>8,X=x&255,x!==this.PADDING_)if(x===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(x===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(w.pts),this.flushDisplayed(w.pts),T=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=T,this.startPts_=w.pts;else if(x===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(w.pts);else if(x===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(w.pts);else if(x===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(w.pts);else if(x===this.CARRIAGE_RETURN_)this.clearFormatting(w.pts),this.flushDisplayed(w.pts),this.shiftRowsUp_(),this.startPts_=w.pts;else if(x===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(x===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(w.pts),this.displayed_=Mn();else if(x===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Mn();else if(x===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(w.pts),this.displayed_=Mn()),this.mode_="paintOn",this.startPts_=w.pts;else if(this.isSpecialCharacter(A,X))A=(A&3)<<8,J=Mt(A|X),this[this.mode_](w.pts,J),this.column_++;else if(this.isExtCharacter(A,X))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),A=(A&3)<<8,J=Mt(A|X),this[this.mode_](w.pts,J),this.column_++;else if(this.isMidRowCode(A,X))this.clearFormatting(w.pts),this[this.mode_](w.pts," "),this.column_++,(X&14)===14&&this.addFormatting(w.pts,["i"]),(X&1)===1&&this.addFormatting(w.pts,["u"]);else if(this.isOffsetControlCode(A,X)){const ce=X&3;this.nonDisplayed_[this.row_].offset=ce,this.column_+=ce}else if(this.isPAC(A,X)){var oe=Dn.indexOf(x&7968);if(this.mode_==="rollUp"&&(oe-this.rollUpRows_+1<0&&(oe=this.rollUpRows_-1),this.setRollUp(w.pts,oe)),oe!==this.row_&&oe>=0&&oe<=14&&(this.clearFormatting(w.pts),this.row_=oe),X&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(w.pts,["u"]),(x&16)===16){const ce=(x&14)>>1;this.column_=ce*4,this.nonDisplayed_[this.row_].indent+=ce}this.isColorPAC(X)&&(X&14)===14&&this.addFormatting(w.pts,["i"])}else this.isNormalChar(A)&&(X===0&&(X=null),J=Mt(A),J+=Mt(X),this[this.mode_](w.pts,J),this.column_+=J.length)}};Wt.prototype=new pn,Wt.prototype.flushDisplayed=function(p){const v=x=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+x+"."})},w=[];this.displayed_.forEach((x,T)=>{if(x&&x.text&&x.text.length){try{x.text=x.text.trim()}catch{v(T)}x.text.length&&w.push({text:x.text,line:T+1,position:10+Math.min(70,x.indent*10)+x.offset*2.5})}else x==null&&v(T)}),w.length&&this.trigger("data",{startPts:this.startPts_,endPts:p,content:w,stream:this.name_})},Wt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Mn(),this.nonDisplayed_=Mn(),this.lastControlCode_=null,this.column_=0,this.row_=Pn,this.rollUpRows_=2,this.formatting_=[]},Wt.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Wt.prototype.isSpecialCharacter=function(p,v){return p===this.EXT_&&v>=48&&v<=63},Wt.prototype.isExtCharacter=function(p,v){return(p===this.EXT_+1||p===this.EXT_+2)&&v>=32&&v<=63},Wt.prototype.isMidRowCode=function(p,v){return p===this.EXT_&&v>=32&&v<=47},Wt.prototype.isOffsetControlCode=function(p,v){return p===this.OFFSET_&&v>=33&&v<=35},Wt.prototype.isPAC=function(p,v){return p>=this.BASE_&&p<this.BASE_+8&&v>=64&&v<=127},Wt.prototype.isColorPAC=function(p){return p>=64&&p<=79||p>=96&&p<=127},Wt.prototype.isNormalChar=function(p){return p>=32&&p<=127},Wt.prototype.setRollUp=function(p,v){if(this.mode_!=="rollUp"&&(this.row_=Pn,this.mode_="rollUp",this.flushDisplayed(p),this.nonDisplayed_=Mn(),this.displayed_=Mn()),v!==void 0&&v!==this.row_)for(var w=0;w<this.rollUpRows_;w++)this.displayed_[v-w]=this.displayed_[this.row_-w],this.displayed_[this.row_-w]={text:"",indent:0,offset:0};v===void 0&&(v=this.row_),this.topRow_=v-this.rollUpRows_+1},Wt.prototype.addFormatting=function(p,v){this.formatting_=this.formatting_.concat(v);var w=v.reduce(function(x,T){return x+"<"+T+">"},"");this[this.mode_](p,w)},Wt.prototype.clearFormatting=function(p){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(w,x){return w+"</"+x+">"},"");this.formatting_=[],this[this.mode_](p,v)}},Wt.prototype.popOn=function(p,v){var w=this.nonDisplayed_[this.row_].text;w+=v,this.nonDisplayed_[this.row_].text=w},Wt.prototype.rollUp=function(p,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w},Wt.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<Pn+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}},Wt.prototype.paintOn=function(p,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w};var Vn={CaptionStream:Kt,Cea608Stream:Wt,Cea708Stream:Dt},Yn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},jn=t,Qn=8589934592,mn=4294967296,Ri="shared",Zn=function(p,v){var w=1;for(p>v&&(w=-1);Math.abs(v-p)>mn;)p+=w*Qn;return p},Kn=function(p){var v,w;Kn.prototype.init.call(this),this.type_=p||Ri,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==Ri&&x.type!==this.type_||(w===void 0&&(w=x.dts),x.dts=Zn(x.dts,w),x.pts=Zn(x.pts,w),v=x.dts,this.trigger("data",x))},this.flush=function(){w=v,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){w=void 0,v=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Kn.prototype=new jn;var ni={TimestampRolloverStream:Kn,handleRollover:Zn},Si=(p,v,w)=>{if(!p)return-1;for(var x=w;x<p.length;x++)if(p[x]===v)return x;return-1},An={typedArrayIndexOf:Si},Fn=An.typedArrayIndexOf,Hn={Utf8:3},ve=function(p,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+p[x].toString(16)).slice(-2);return T},rt=function(p,v,w){return decodeURIComponent(ve(p,v,w))},ct=function(p,v,w){return unescape(ve(p,v,w))},jt=function(p){return p[0]<<21|p[1]<<14|p[2]<<7|p[3]},De={APIC:function(p){var v=1,w,x,T="-->";p.data[0]===Hn.Utf8&&(w=Fn(p.data,0,v),!(w<0)&&(p.mimeType=ct(p.data,v,w),v=w+1,p.pictureType=p.data[v],v++,x=Fn(p.data,0,v),!(x<0)&&(p.description=rt(p.data,v,x),v=x+1,p.mimeType===T?p.url=ct(p.data,v,p.data.length):p.pictureData=p.data.subarray(v,p.data.length))))},"T*":function(p){p.data[0]===Hn.Utf8&&(p.value=rt(p.data,1,p.data.length).replace(/\0*$/,""),p.values=p.value.split("\0"))},TXXX:function(p){var v;p.data[0]===Hn.Utf8&&(v=Fn(p.data,0,1),v!==-1&&(p.description=rt(p.data,1,v),p.value=rt(p.data,v+1,p.data.length).replace(/\0*$/,""),p.data=p.value))},"W*":function(p){p.url=ct(p.data,0,p.data.length).replace(/\0.*$/,"")},WXXX:function(p){var v;p.data[0]===Hn.Utf8&&(v=Fn(p.data,0,1),v!==-1&&(p.description=rt(p.data,1,v),p.url=ct(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=ct(p.data,0,v);break}p.privateData=p.data.subarray(v+1),p.data=p.privateData}},bt=function(p){var v,w,x=10,T=0,A=[];if(!(p.length<10||p[0]!==73||p[1]!==68||p[2]!==51)){T=jt(p.subarray(6,10)),T+=10;var X=p[5]&64;X&&(x+=4,x+=jt(p.subarray(10,14)),T-=jt(p.subarray(16,20)));do{if(v=jt(p.subarray(x+4,x+8)),v<1)break;w=String.fromCharCode(p[x],p[x+1],p[x+2],p[x+3]);var J={id:w,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),A.push(J),x+=10,x+=v}while(x<T);return A}},xt={parseId3Frames:bt,parseSyncSafeInteger:jt,frameParsers:De},Et=t,Ft=Yn,$t=xt,Vt;Vt=function(p){var v={descriptor:p&&p.descriptor},w=0,x=[],T=0,A;if(Vt.prototype.init.call(this),this.dispatchType=Ft.METADATA_STREAM_TYPE.toString(16),v.descriptor)for(A=0;A<v.descriptor.length;A++)this.dispatchType+=("00"+v.descriptor[A].toString(16)).slice(-2);this.push=function(X){var J,oe,ce,Ne,Ke,Ct;if(X.type==="timed-metadata"){if(X.dataAlignmentIndicator&&(T=0,x.length=0),x.length===0&&(X.data.length<10||X.data[0]!==73||X.data[1]!==68||X.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(x.push(X),T+=X.data.byteLength,x.length===1&&(w=$t.parseSyncSafeInteger(X.data.subarray(6,10)),w+=10),!(T<w)){for(J={data:new Uint8Array(w),frames:[],pts:x[0].pts,dts:x[0].dts},Ke=0;Ke<w;)J.data.set(x[0].data.subarray(0,w-Ke),Ke),Ke+=x[0].data.byteLength,T-=x[0].data.byteLength,x.shift();oe=10,J.data[5]&64&&(oe+=4,oe+=$t.parseSyncSafeInteger(J.data.subarray(10,14)),w-=$t.parseSyncSafeInteger(J.data.subarray(16,20)));do{if(ce=$t.parseSyncSafeInteger(J.data.subarray(oe+4,oe+8)),ce<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Ct=String.fromCharCode(J.data[oe],J.data[oe+1],J.data[oe+2],J.data[oe+3]),Ne={id:Ct,data:J.data.subarray(oe+10,oe+ce+10)},Ne.key=Ne.id,$t.frameParsers[Ne.id]?$t.frameParsers[Ne.id](Ne):Ne.id[0]==="T"?$t.frameParsers["T*"](Ne):Ne.id[0]==="W"&&$t.frameParsers["W*"](Ne),Ne.owner==="com.apple.streaming.transportStreamTimestamp"){var it=Ne.data,Bt=(it[3]&1)<<30|it[4]<<22|it[5]<<14|it[6]<<6|it[7]>>>2;Bt*=4,Bt+=it[7]&3,Ne.timeStamp=Bt,J.pts===void 0&&J.dts===void 0&&(J.pts=Ne.timeStamp,J.dts=Ne.timeStamp),this.trigger("timestamp",Ne)}J.frames.push(Ne),oe+=10,oe+=ce}while(oe<w);this.trigger("data",J)}}}},Vt.prototype=new Et;var vn=Vt,qn=t,Yi=Vn,Gn=Yn,ki=ni.TimestampRolloverStream,Ei,si,mi,Pi=188,Sn=71;Ei=function(){var p=new Uint8Array(Pi),v=0;Ei.prototype.init.call(this),this.push=function(w){var x=0,T=Pi,A;for(v?(A=new Uint8Array(w.byteLength+v),A.set(p.subarray(0,v)),A.set(w,v),v=0):A=w;T<A.byteLength;){if(A[x]===Sn&&A[T]===Sn){this.trigger("data",A.subarray(x,T)),x+=Pi,T+=Pi;continue}x++,T++}x<A.byteLength&&(p.set(A.subarray(x),0),v=A.byteLength-x)},this.flush=function(){v===Pi&&p[0]===Sn&&(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")}},Ei.prototype=new qn,si=function(){var p,v,w,x;si.prototype.init.call(this),x=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,p=function(T,A){var X=0;A.payloadUnitStartIndicator&&(X+=T[X]+1),A.type==="pat"?v(T.subarray(X),A):w(T.subarray(X),A)},v=function(T,A){A.section_number=T[7],A.last_section_number=T[8],x.pmtPid=(T[10]&31)<<8|T[11],A.pmtPid=x.pmtPid},w=function(T,A){var X,J,oe,ce;if(T[5]&1){for(x.programMapTable={video:null,audio:null,"timed-metadata":{}},X=(T[1]&15)<<8|T[2],J=3+X-4,oe=(T[10]&15)<<8|T[11],ce=12+oe;ce<J;){var Ne=T[ce],Ke=(T[ce+1]&31)<<8|T[ce+2];Ne===Gn.H264_STREAM_TYPE&&x.programMapTable.video===null?x.programMapTable.video=Ke:Ne===Gn.ADTS_STREAM_TYPE&&x.programMapTable.audio===null?x.programMapTable.audio=Ke:Ne===Gn.METADATA_STREAM_TYPE&&(x.programMapTable["timed-metadata"][Ke]=Ne),ce+=((T[ce+3]&15)<<8|T[ce+4])+5}A.programMapTable=x.programMapTable}},this.push=function(T){var A={},X=4;if(A.payloadUnitStartIndicator=!!(T[1]&64),A.pid=T[1]&31,A.pid<<=8,A.pid|=T[2],(T[3]&48)>>>4>1&&(X+=T[X]+1),A.pid===0)A.type="pat",p(T.subarray(X),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",p(T.subarray(X),A),this.trigger("data",A);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,X,A]):this.processPes_(T,X,A)},this.processPes_=function(T,A,X){X.pid===this.programMapTable.video?X.streamType=Gn.H264_STREAM_TYPE:X.pid===this.programMapTable.audio?X.streamType=Gn.ADTS_STREAM_TYPE:X.streamType=this.programMapTable["timed-metadata"][X.pid],X.type="pes",X.data=T.subarray(A),this.trigger("data",X)}},si.prototype=new qn,si.STREAM_TYPES={h264:27,adts:15},mi=function(){var p=this,v=!1,w={data:[],size:0},x={data:[],size:0},T={data:[],size:0},A,X=function(oe,ce){var Ne;const Ke=oe[0]<<16|oe[1]<<8|oe[2];ce.data=new Uint8Array,Ke===1&&(ce.packetLength=6+(oe[4]<<8|oe[5]),ce.dataAlignmentIndicator=(oe[6]&4)!==0,Ne=oe[7],Ne&192&&(ce.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,ce.pts*=4,ce.pts+=(oe[13]&6)>>>1,ce.dts=ce.pts,Ne&64&&(ce.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,ce.dts*=4,ce.dts+=(oe[18]&6)>>>1)),ce.data=oe.subarray(9+oe[8]))},J=function(oe,ce,Ne){var Ke=new Uint8Array(oe.size),Ct={type:ce},it=0,Bt=0,hn=!1,Vi;if(!(!oe.data.length||oe.size<9)){for(Ct.trackId=oe.data[0].pid,it=0;it<oe.data.length;it++)Vi=oe.data[it],Ke.set(Vi.data,Bt),Bt+=Vi.data.byteLength;X(Ke,Ct),hn=ce==="video"||Ct.packetLength<=oe.size,(Ne||hn)&&(oe.size=0,oe.data.length=0),hn&&p.trigger("data",Ct)}};mi.prototype.init.call(this),this.push=function(oe){({pat:function(){},pes:function(){var ce,Ne;switch(oe.streamType){case Gn.H264_STREAM_TYPE:ce=w,Ne="video";break;case Gn.ADTS_STREAM_TYPE:ce=x,Ne="audio";break;case Gn.METADATA_STREAM_TYPE:ce=T,Ne="timed-metadata";break;default:return}oe.payloadUnitStartIndicator&&J(ce,Ne,!0),ce.data.push(oe),ce.size+=oe.data.byteLength},pmt:function(){var ce={type:"metadata",tracks:[]};A=oe.programMapTable,A.video!==null&&ce.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.video,codec:"avc",type:"video"}),A.audio!==null&&ce.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.audio,codec:"adts",type:"audio"}),v=!0,p.trigger("data",ce)}})[oe.type]()},this.reset=function(){w.size=0,w.data.length=0,x.size=0,x.data.length=0,this.trigger("reset")},this.flushStreams_=function(){J(w,"video"),J(x,"audio"),J(T,"timed-metadata")},this.flush=function(){if(!v&&A){var oe={type:"metadata",tracks:[]};A.video!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.video,codec:"avc",type:"video"}),A.audio!==null&&oe.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.audio,codec:"adts",type:"audio"}),p.trigger("data",oe)}v=!1,this.flushStreams_(),this.trigger("done")}},mi.prototype=new qn;var Jn={PAT_PID:0,MP2T_PACKET_LENGTH:Pi,TransportPacketStream:Ei,TransportParseStream:si,ElementaryStream:mi,TimestampRolloverStream:ki,CaptionStream:Yi.CaptionStream,Cea608Stream:Yi.Cea608Stream,Cea708Stream:Yi.Cea708Stream,MetadataStream:vn};for(var wn in Gn)Gn.hasOwnProperty(wn)&&(Jn[wn]=Gn[wn]);var Ci=Jn,Oi=t,ei=Tt.ONE_SECOND_IN_TS,Li,we=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Li=function(p){var v,w=0;Li.prototype.init.call(this),this.skipWarn_=function(x,T){this.trigger("log",{level:"warn",message:`adts skiping bytes ${x} to ${T} in frame ${w} outside syncword`})},this.push=function(x){var T=0,A,X,J,oe,ce;if(p||(w=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 Ne;T+7<v.length;){if(v[T]!==255||(v[T+1]&246)!==240){typeof Ne!="number"&&(Ne=T),T++;continue}if(typeof Ne=="number"&&(this.skipWarn_(Ne,T),Ne=null),X=(~v[T+1]&1)*2,A=(v[T+3]&3)<<11|v[T+4]<<3|(v[T+5]&224)>>5,oe=((v[T+6]&3)+1)*1024,ce=oe*ei/we[(v[T+2]&60)>>>2],v.byteLength-T<A)break;this.trigger("data",{pts:x.pts+w*ce,dts:x.dts+w*ce,sampleCount:oe,audioobjecttype:(v[T+2]>>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:we[(v[T+2]&60)>>>2],samplingfrequencyindex:(v[T+2]&60)>>>2,samplesize:16,data:v.subarray(T+7+X,T+A)}),w++,T+=A}typeof Ne=="number"&&(this.skipWarn_(Ne,T),Ne=null),v=v.subarray(T)}},this.flush=function(){w=0,this.trigger("done")},this.reset=function(){v=void 0,this.trigger("reset")},this.endTimeline=function(){v=void 0,this.trigger("endedtimeline")}},Li.prototype=new Oi;var L=Li,$;$=function(p){var v=p.byteLength,w=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=p.byteLength-v,A=new Uint8Array(4),X=Math.min(4,v);if(X===0)throw new Error("no bytes available");A.set(p.subarray(T,T+X)),w=new DataView(A.buffer).getUint32(0),x=X*8,v-=X},this.skipBits=function(T){var A;x>T?(w<<=T,x-=T):(T-=x,A=Math.floor(T/8),T-=A*8,v-=A,this.loadWord(),w<<=T,x-=T)},this.readBits=function(T){var A=Math.min(x,T),X=w>>>32-A;return x-=A,x>0?w<<=A:v>0&&this.loadWord(),A=T-A,A>0?X<<A|this.readBits(A):X},this.skipLeadingZeros=function(){var T;for(T=0;T<x;++T)if((w&2147483648>>>T)!==0)return w<<=T,x-=T,T;return this.loadWord(),T+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var T=this.skipLeadingZeros();return this.readBits(T+1)-1},this.readExpGolomb=function(){var T=this.readUnsignedExpGolomb();return 1&T?1+T>>>1:-1*(T>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var xe=$,Te=t,Ve=xe,qe,U,W;U=function(){var p=0,v,w;U.prototype.init.call(this),this.push=function(x){var T;w?(T=new Uint8Array(w.byteLength+x.data.byteLength),T.set(w),T.set(x.data,w.byteLength),w=T):w=x.data;for(var A=w.byteLength;p<A-3;p++)if(w[p+2]===1){v=p+5;break}for(;v<A;)switch(w[v]){case 0:if(w[v-1]!==0){v+=2;break}else if(w[v-2]!==0){v++;break}p+3!==v-2&&this.trigger("data",w.subarray(p+3,v-2));do v++;while(w[v]!==1&&v<A);p=v-2,v+=3;break;case 1:if(w[v-1]!==0||w[v-2]!==0){v+=3;break}this.trigger("data",w.subarray(p+3,v-2)),p=v-2,v+=3;break;default:v+=3;break}w=w.subarray(p),v-=p,p=0},this.reset=function(){w=null,p=0,this.trigger("reset")},this.flush=function(){w&&w.byteLength>3&&this.trigger("data",w.subarray(p+3)),w=null,p=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},U.prototype=new Te,W={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},qe=function(){var p=new U,v,w,x,T,A,X,J;qe.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(w=oe.trackId,x=oe.pts,T=oe.dts,p.push(oe))},p.on("data",function(oe){var ce={trackId:w,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(ce.nalUnitTypeCode){case 5:ce.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:ce.nalUnitType="sei_rbsp",ce.escapedRBSP=A(oe.subarray(1));break;case 7:ce.nalUnitType="seq_parameter_set_rbsp",ce.escapedRBSP=A(oe.subarray(1)),ce.config=X(ce.escapedRBSP);break;case 8:ce.nalUnitType="pic_parameter_set_rbsp";break;case 9:ce.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",ce)}),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,ce){var Ne=8,Ke=8,Ct,it;for(Ct=0;Ct<oe;Ct++)Ke!==0&&(it=ce.readExpGolomb(),Ke=(Ne+it+256)%256),Ne=Ke===0?Ne:Ke},A=function(oe){for(var ce=oe.byteLength,Ne=[],Ke=1,Ct,it;Ke<ce-2;)oe[Ke]===0&&oe[Ke+1]===0&&oe[Ke+2]===3?(Ne.push(Ke+2),Ke+=2):Ke++;if(Ne.length===0)return oe;Ct=ce-Ne.length,it=new Uint8Array(Ct);var Bt=0;for(Ke=0;Ke<Ct;Bt++,Ke++)Bt===Ne[0]&&(Bt++,Ne.shift()),it[Ke]=oe[Bt];return it},X=function(oe){var ce=0,Ne=0,Ke=0,Ct=0,it,Bt,hn,Vi,wr,$s,Ho,xi,ca,ks,Hs,ai=[1,1],ls,sr;if(it=new Ve(oe),Bt=it.readUnsignedByte(),Vi=it.readUnsignedByte(),hn=it.readUnsignedByte(),it.skipUnsignedExpGolomb(),W[Bt]&&(wr=it.readUnsignedExpGolomb(),wr===3&&it.skipBits(1),it.skipUnsignedExpGolomb(),it.skipUnsignedExpGolomb(),it.skipBits(1),it.readBoolean()))for(Hs=wr!==3?8:12,sr=0;sr<Hs;sr++)it.readBoolean()&&(sr<6?J(16,it):J(64,it));if(it.skipUnsignedExpGolomb(),$s=it.readUnsignedExpGolomb(),$s===0)it.readUnsignedExpGolomb();else if($s===1)for(it.skipBits(1),it.skipExpGolomb(),it.skipExpGolomb(),Ho=it.readUnsignedExpGolomb(),sr=0;sr<Ho;sr++)it.skipExpGolomb();if(it.skipUnsignedExpGolomb(),it.skipBits(1),xi=it.readUnsignedExpGolomb(),ca=it.readUnsignedExpGolomb(),ks=it.readBits(1),ks===0&&it.skipBits(1),it.skipBits(1),it.readBoolean()&&(ce=it.readUnsignedExpGolomb(),Ne=it.readUnsignedExpGolomb(),Ke=it.readUnsignedExpGolomb(),Ct=it.readUnsignedExpGolomb()),it.readBoolean()&&it.readBoolean()){switch(ls=it.readUnsignedByte(),ls){case 1:ai=[1,1];break;case 2:ai=[12,11];break;case 3:ai=[10,11];break;case 4:ai=[16,11];break;case 5:ai=[40,33];break;case 6:ai=[24,11];break;case 7:ai=[20,11];break;case 8:ai=[32,11];break;case 9:ai=[80,33];break;case 10:ai=[18,11];break;case 11:ai=[15,11];break;case 12:ai=[64,33];break;case 13:ai=[160,99];break;case 14:ai=[4,3];break;case 15:ai=[3,2];break;case 16:ai=[2,1];break;case 255:{ai=[it.readUnsignedByte()<<8|it.readUnsignedByte(),it.readUnsignedByte()<<8|it.readUnsignedByte()];break}}ai&&ai[0]/ai[1]}return{profileIdc:Bt,levelIdc:hn,profileCompatibility:Vi,width:(xi+1)*16-ce*2-Ne*2,height:(2-ks)*(ca+1)*16-Ke*2-Ct*2,sarRatio:ai}}},qe.prototype=new Te;var le={H264Stream:qe},be=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ce=function(p,v){var w=p[v+6]<<21|p[v+7]<<14|p[v+8]<<7|p[v+9],x=p[v+5],T=(x&16)>>4;return w=w>=0?w:0,T?w+20:w+10},Oe=function(p,v){return p.length-v<10||p[v]!==73||p[v+1]!==68||p[v+2]!==51?v:(v+=Ce(p,v),Oe(p,v))},ht=function(p){var v=Oe(p,0);return p.length>=v+2&&(p[v]&255)===255&&(p[v+1]&240)===240&&(p[v+1]&22)===16},At=function(p){return p[0]<<21|p[1]<<14|p[2]<<7|p[3]},yt=function(p,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+p[x].toString(16)).slice(-2);return T},rn=function(p,v,w){return unescape(yt(p,v,w))},Yt=function(p,v){var w=(p[v+5]&224)>>5,x=p[v+4]<<3,T=p[v+3]&6144;return T|x|w},Rn=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},ui=function(p){for(var v=0;v+5<p.length;){if(p[v]!==255||(p[v+1]&246)!==240){v++;continue}return be[(p[v+2]&60)>>>2]}return null},Kr=function(p){var v,w,x,T;v=10,p[5]&64&&(v+=4,v+=At(p.subarray(10,14)));do{if(w=At(p.subarray(v+4,v+8)),w<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+w+10);for(var A=0;A<x.byteLength;A++)if(x[A]===0){var X=rn(x,0,A);if(X==="com.apple.streaming.transportStreamTimestamp"){var J=x.subarray(A+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+=w}while(v<p.byteLength);return null},xn={isLikelyAacData:ht,parseId3TagSize:Ce,parseAdtsSize:Yt,parseType:Rn,parseSampleRate:ui,parseAacTimestamp:Kr},Os=t,sa=xn,Ar;Ar=function(){var p=new Uint8Array,v=0;Ar.prototype.init.call(this),this.setTimestamp=function(w){v=w},this.push=function(w){var x=0,T=0,A,X,J,oe;for(p.length?(oe=p.length,p=new Uint8Array(w.byteLength+oe),p.set(p.subarray(0,oe)),p.set(w,oe)):p=w;p.length-T>=3;){if(p[T]===73&&p[T+1]===68&&p[T+2]===51){if(p.length-T<10||(x=sa.parseId3TagSize(p,T),T+x>p.length))break;X={type:"timed-metadata",data:p.subarray(T,T+x)},this.trigger("data",X),T+=x;continue}else if((p[T]&255)===255&&(p[T+1]&240)===240){if(p.length-T<7||(x=sa.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++}A=p.length-T,A>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")}},Ar.prototype=new Os;var ci=Ar,Fi=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],_s=Fi,Do=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],k0=Do,Oa=t,Mo=We,jo=Ut,wl=kt,Wr=ie,ws=Ci,Ro=Tt,Cd=L,E0=le.H264Stream,C0=ci,A0=xn.isLikelyAacData,Pu=Tt.ONE_SECOND_IN_TS,Ad=_s,Nd=k0,Tl,La,Sl,aa,N0=function(p,v){v.stream=p,this.trigger("log",v)},Dd=function(p,v){for(var w=Object.keys(v),x=0;x<w.length;x++){var T=w[x];T==="headOfPipeline"||!v[T].on||v[T].on("log",N0.bind(p,T))}},Md=function(p,v){var w;if(p.length!==v.length)return!1;for(w=0;w<p.length;w++)if(p[w]!==v[w])return!1;return!0},jd=function(p,v,w,x,T,A){var X=w-v,J=x-v,oe=T-w;return{start:{dts:p,pts:p+X},end:{dts:p+J,pts:p+oe},prependedContentDuration:A,baseMediaDecodeTime:p}};La=function(p,v){var w=[],x,T=0,A=0,X=1/0;v=v||{},x=v.firstSequenceNumber||0,La.prototype.init.call(this),this.push=function(J){Wr.collectDtsInfo(p,J),p&&Ad.forEach(function(oe){p[oe]=J[oe]}),w.push(J)},this.setEarliestDts=function(J){T=J},this.setVideoBaseMediaDecodeTime=function(J){X=J},this.setAudioAppendStart=function(J){A=J},this.flush=function(){var J,oe,ce,Ne,Ke,Ct,it;if(w.length===0){this.trigger("done","AudioSegmentStream");return}J=wl.trimAdtsFramesByEarliestDts(w,p,T),p.baseMediaDecodeTime=Wr.calculateTrackBaseMediaDecodeTime(p,v.keepOriginalTimestamps),it=wl.prefixWithSilence(p,J,A,X),p.samples=wl.generateSampleTable(J),ce=Mo.mdat(wl.concatenateFrameData(J)),w=[],oe=Mo.moof(x,[p]),Ne=new Uint8Array(oe.byteLength+ce.byteLength),x++,Ne.set(oe),Ne.set(ce,oe.byteLength),Wr.clearDtsInfo(p),Ke=Math.ceil(Pu*1024/p.samplerate),J.length&&(Ct=J.length*Ke,this.trigger("segmentTimingInfo",jd(Ro.audioTsToVideoTs(p.baseMediaDecodeTime,p.samplerate),J[0].dts,J[0].pts,J[0].dts+Ct,J[0].pts+Ct,it||0)),this.trigger("timingInfo",{start:J[0].pts,end:J[0].pts+Ct})),this.trigger("data",{track:p,boxes:Ne}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Wr.clearDtsInfo(p),w=[],this.trigger("reset")}},La.prototype=new Oa,Tl=function(p,v){var w,x=[],T=[],A,X;v=v||{},w=v.firstSequenceNumber||0,Tl.prototype.init.call(this),delete p.minPTS,this.gopCache_=[],this.push=function(J){Wr.collectDtsInfo(p,J),J.nalUnitType==="seq_parameter_set_rbsp"&&!A&&(A=J.config,p.sps=[J.data],Nd.forEach(function(oe){p[oe]=A[oe]},this)),J.nalUnitType==="pic_parameter_set_rbsp"&&!X&&(X=J.data,p.pps=[J.data]),x.push(J)},this.flush=function(){for(var J,oe,ce,Ne,Ke,Ct,it=0,Bt,hn;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),ce=jo.groupFramesIntoGops(J),ce[0][0].keyFrame||(oe=this.getGopForFusion_(x[0],p),oe?(it=oe.duration,ce.unshift(oe),ce.byteLength+=oe.byteLength,ce.nalCount+=oe.nalCount,ce.pts=oe.pts,ce.dts=oe.dts,ce.duration+=oe.duration):ce=jo.extendFirstKeyFrame(ce)),T.length){var Vi;if(v.alignGopsAtEnd?Vi=this.alignGopsAtEnd_(ce):Vi=this.alignGopsAtStart_(ce),!Vi){this.gopCache_.unshift({gop:ce.pop(),pps:p.pps,sps:p.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Wr.clearDtsInfo(p),ce=Vi}Wr.collectDtsInfo(p,ce),p.samples=jo.generateSampleTable(ce),Ke=Mo.mdat(jo.concatenateNalData(ce)),p.baseMediaDecodeTime=Wr.calculateTrackBaseMediaDecodeTime(p,v.keepOriginalTimestamps),this.trigger("processedGopsInfo",ce.map(function(wr){return{pts:wr.pts,dts:wr.dts,byteLength:wr.byteLength}})),Bt=ce[0],hn=ce[ce.length-1],this.trigger("segmentTimingInfo",jd(p.baseMediaDecodeTime,Bt.dts,Bt.pts,hn.dts+hn.duration,hn.pts+hn.duration,it)),this.trigger("timingInfo",{start:ce[0].pts,end:ce[ce.length-1].pts+ce[ce.length-1].duration}),this.gopCache_.unshift({gop:ce.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),Ne=Mo.moof(w,[p]),Ct=new Uint8Array(Ne.byteLength+Ke.byteLength),w++,Ct.set(Ne),Ct.set(Ke,Ne.byteLength),this.trigger("data",{track:p,boxes:Ct}),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(){Wr.clearDtsInfo(p),A=void 0,X=void 0},this.getGopForFusion_=function(J){var oe=45e3,ce=1/0,Ne,Ke,Ct,it,Bt;for(Bt=0;Bt<this.gopCache_.length;Bt++)it=this.gopCache_[Bt],Ct=it.gop,!(!(p.pps&&Md(p.pps[0],it.pps[0]))||!(p.sps&&Md(p.sps[0],it.sps[0])))&&(Ct.dts<p.timelineStartInfo.dts||(Ne=J.dts-Ct.dts-Ct.duration,Ne>=-1e4&&Ne<=oe&&(!Ke||ce>Ne)&&(Ke=it,ce=Ne)));return Ke?Ke.gop:null},this.alignGopsAtStart_=function(J){var oe,ce,Ne,Ke,Ct,it,Bt,hn;for(Ct=J.byteLength,it=J.nalCount,Bt=J.duration,oe=ce=0;oe<T.length&&ce<J.length&&(Ne=T[oe],Ke=J[ce],Ne.pts!==Ke.pts);){if(Ke.pts>Ne.pts){oe++;continue}ce++,Ct-=Ke.byteLength,it-=Ke.nalCount,Bt-=Ke.duration}return ce===0?J:ce===J.length?null:(hn=J.slice(ce),hn.byteLength=Ct,hn.duration=Bt,hn.nalCount=it,hn.pts=hn[0].pts,hn.dts=hn[0].dts,hn)},this.alignGopsAtEnd_=function(J){var oe,ce,Ne,Ke,Ct,it;for(oe=T.length-1,ce=J.length-1,Ct=null,it=!1;oe>=0&&ce>=0;){if(Ne=T[oe],Ke=J[ce],Ne.pts===Ke.pts){it=!0;break}if(Ne.pts>Ke.pts){oe--;continue}oe===T.length-1&&(Ct=ce),ce--}if(!it&&Ct===null)return null;var Bt;if(it?Bt=ce:Bt=Ct,Bt===0)return J;var hn=J.slice(Bt),Vi=hn.reduce(function(wr,$s){return wr.byteLength+=$s.byteLength,wr.duration+=$s.duration,wr.nalCount+=$s.nalCount,wr},{byteLength:0,duration:0,nalCount:0});return hn.byteLength=Vi.byteLength,hn.duration=Vi.duration,hn.nalCount=Vi.nalCount,hn.pts=hn[0].pts,hn.dts=hn[0].dts,hn},this.alignGopsWith=function(J){T=J}},Tl.prototype=new Oa,aa=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,aa.prototype.init.call(this),this.push=function(w){if(w.content||w.text)return this.pendingCaptions.push(w);if(w.frames)return this.pendingMetadata.push(w);this.pendingTracks.push(w.track),this.pendingBytes+=w.boxes.byteLength,w.track.type==="video"&&(this.videoTrack=w.track,this.pendingBoxes.push(w.boxes)),w.track.type==="audio"&&(this.audioTrack=w.track,this.pendingBoxes.unshift(w.boxes))}},aa.prototype=new Oa,aa.prototype.flush=function(p){var v=0,w={captions:[],captionStreams:{},metadata:[],info:{}},x,T,A,X=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?(X=this.videoTrack.timelineStartInfo.pts,Nd.forEach(function(oe){w.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(X=this.audioTrack.timelineStartInfo.pts,Ad.forEach(function(oe){w.info[oe]=this.audioTrack[oe]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?w.type=this.pendingTracks[0].type:w.type="combined",this.emittedTracks+=this.pendingTracks.length,A=Mo.initSegment(this.pendingTracks),w.initSegment=new Uint8Array(A.byteLength),w.initSegment.set(A),w.data=new Uint8Array(this.pendingBytes),J=0;J<this.pendingBoxes.length;J++)w.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=Ro.metadataTsToSeconds(x.startPts,X,this.keepOriginalTimestamps),x.endTime=Ro.metadataTsToSeconds(x.endPts,X,this.keepOriginalTimestamps),w.captionStreams[x.stream]=!0,w.captions.push(x);for(J=0;J<this.pendingMetadata.length;J++)T=this.pendingMetadata[J],T.cueTime=Ro.metadataTsToSeconds(T.pts,X,this.keepOriginalTimestamps),w.metadata.push(T);for(w.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",w),J=0;J<w.captions.length;J++)x=w.captions[J],this.trigger("caption",x);for(J=0;J<w.metadata.length;J++)T=w.metadata[J],this.trigger("id3Frame",T)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},aa.prototype.setRemux=function(p){this.remuxTracks=p},Sl=function(p){var v=this,w=!0,x,T;Sl.prototype.init.call(this),p=p||{},this.baseMediaDecodeTime=p.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new ws.MetadataStream,A.aacStream=new C0,A.audioTimestampRolloverStream=new ws.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new ws.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Cd,A.coalesceStream=new aa(p,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(X){A.aacStream.setTimestamp(X.timeStamp)}),A.aacStream.on("data",function(X){X.type!=="timed-metadata"&&X.type!=="audio"||A.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:v.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new La(T,p),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x}))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Dd(this,A)},this.setupTsPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="ts",A.metadataStream=new ws.MetadataStream,A.packetStream=new ws.TransportPacketStream,A.parseStream=new ws.TransportParseStream,A.elementaryStream=new ws.ElementaryStream,A.timestampRolloverStream=new ws.TimestampRolloverStream,A.adtsStream=new Cd,A.h264Stream=new E0,A.captionStream=new ws.CaptionStream(p),A.coalesceStream=new aa(p,A.metadataStream),A.headOfPipeline=A.packetStream,A.packetStream.pipe(A.parseStream).pipe(A.elementaryStream).pipe(A.timestampRolloverStream),A.timestampRolloverStream.pipe(A.h264Stream),A.timestampRolloverStream.pipe(A.adtsStream),A.timestampRolloverStream.pipe(A.metadataStream).pipe(A.coalesceStream),A.h264Stream.pipe(A.captionStream).pipe(A.coalesceStream),A.elementaryStream.on("data",function(X){var J;if(X.type==="metadata"){for(J=X.tracks.length;J--;)!x&&X.tracks[J].type==="video"?(x=X.tracks[J],x.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime):!T&&X.tracks[J].type==="audio"&&(T=X.tracks[J],T.timelineStartInfo.baseMediaDecodeTime=v.baseMediaDecodeTime);x&&!A.videoSegmentStream&&(A.coalesceStream.numberOfTracks++,A.videoSegmentStream=new Tl(x,p),A.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!p.keepOriginalTimestamps&&(T.timelineStartInfo=oe,A.audioSegmentStream.setEarliestDts(oe.dts-v.baseMediaDecodeTime))}),A.videoSegmentStream.on("processedGopsInfo",v.trigger.bind(v,"gopInfo")),A.videoSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"videoSegmentTimingInfo")),A.videoSegmentStream.on("baseMediaDecodeTime",function(oe){T&&A.audioSegmentStream.setVideoBaseMediaDecodeTime(oe)}),A.videoSegmentStream.on("timingInfo",v.trigger.bind(v,"videoTimingInfo")),A.h264Stream.pipe(A.videoSegmentStream).pipe(A.coalesceStream)),T&&!A.audioSegmentStream&&(A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new La(T,p),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.audioSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"audioSegmentTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream)),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x})}}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("id3Frame",function(X){X.dispatchType=A.metadataStream.dispatchType,v.trigger("id3Frame",X)}),A.coalesceStream.on("caption",this.trigger.bind(this,"caption")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Dd(this,A)},this.setBaseMediaDecodeTime=function(A){var X=this.transmuxPipeline_;p.keepOriginalTimestamps||(this.baseMediaDecodeTime=A),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Wr.clearDtsInfo(T),X.audioTimestampRolloverStream&&X.audioTimestampRolloverStream.discontinuity()),x&&(X.videoSegmentStream&&(X.videoSegmentStream.gopCache_=[]),x.timelineStartInfo.dts=void 0,x.timelineStartInfo.pts=void 0,Wr.clearDtsInfo(x),X.captionStream.reset()),X.timestampRolloverStream&&X.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(A){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(A)},this.setRemux=function(A){var X=this.transmuxPipeline_;p.remux=A,X&&X.coalesceStream&&X.coalesceStream.setRemux(A)},this.alignGopsWith=function(A){x&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(A)},this.getLogTrigger_=function(A){var X=this;return function(J){J.stream=A,X.trigger("log",J)}},this.push=function(A){if(w){var X=A0(A);X&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!X&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),w=!1}this.transmuxPipeline_.headOfPipeline.push(A)},this.flush=function(){w=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Sl.prototype=new Oa;var D0={Transmuxer:Sl},M0=function(p){return p>>>0},j0=function(p){return("00"+p.toString(16)).slice(-2)},Ia={toUnsigned:M0,toHexString:j0},Oo=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},Rd=Oo,Od=Ia.toUnsigned,Ld=Rd,Fu=function(p,v){var w=[],x,T,A,X,J;if(!v.length)return null;for(x=0;x<p.byteLength;)T=Od(p[x]<<24|p[x+1]<<16|p[x+2]<<8|p[x+3]),A=Ld(p.subarray(x+4,x+8)),X=T>1?x+T:p.byteLength,A===v[0]&&(v.length===1?w.push(p.subarray(x+8,X)):(J=Fu(p.subarray(x+8,X),v.slice(1)),J.length&&(w=w.concat(J)))),x=X;return w},kl=Fu,Id=Ia.toUnsigned,Ba=l.getUint64,R0=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ba(p.subarray(4)):v.baseMediaDecodeTime=Id(p[4]<<24|p[5]<<16|p[6]<<8|p[7]),v},Uu=R0,O0=function(p){var v=new DataView(p.buffer,p.byteOffset,p.byteLength),w={version:p[0],flags:new Uint8Array(p.subarray(1,4)),trackId:v.getUint32(4)},x=w.flags[2]&1,T=w.flags[2]&2,A=w.flags[2]&8,X=w.flags[2]&16,J=w.flags[2]&32,oe=w.flags[0]&65536,ce=w.flags[0]&131072,Ne;return Ne=8,x&&(Ne+=4,w.baseDataOffset=v.getUint32(12),Ne+=4),T&&(w.sampleDescriptionIndex=v.getUint32(Ne),Ne+=4),A&&(w.defaultSampleDuration=v.getUint32(Ne),Ne+=4),X&&(w.defaultSampleSize=v.getUint32(Ne),Ne+=4),J&&(w.defaultSampleFlags=v.getUint32(Ne)),oe&&(w.durationIsEmpty=!0),!x&&ce&&(w.baseDataOffsetIsMoof=!0),w},zu=O0,Bd=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]}},Lo=Bd,Pa=Lo,L0=function(p){var v={version:p[0],flags:new Uint8Array(p.subarray(1,4)),samples:[]},w=new DataView(p.buffer,p.byteOffset,p.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,A=v.flags[1]&1,X=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,ce=w.getUint32(4),Ne=8,Ke;for(x&&(v.dataOffset=w.getInt32(Ne),Ne+=4),T&&ce&&(Ke={flags:Pa(p.subarray(Ne,Ne+4))},Ne+=4,A&&(Ke.duration=w.getUint32(Ne),Ne+=4),X&&(Ke.size=w.getUint32(Ne),Ne+=4),oe&&(v.version===1?Ke.compositionTimeOffset=w.getInt32(Ne):Ke.compositionTimeOffset=w.getUint32(Ne),Ne+=4),v.samples.push(Ke),ce--);ce--;)Ke={},A&&(Ke.duration=w.getUint32(Ne),Ne+=4),X&&(Ke.size=w.getUint32(Ne),Ne+=4),J&&(Ke.flags=Pa(p.subarray(Ne,Ne+4)),Ne+=4),oe&&(v.version===1?Ke.compositionTimeOffset=w.getInt32(Ne):Ke.compositionTimeOffset=w.getUint32(Ne),Ne+=4),v.samples.push(Ke);return v},Io=L0,$u={tfdt:Uu,trun:Io},Hu={parseTfdt:$u.tfdt,parseTrun:$u.trun},qu=function(p){for(var v=0,w=String.fromCharCode(p[v]),x="";w!=="\0";)x+=w,v++,w=String.fromCharCode(p[v]);return x+=w,x},Vu={uint8ToCString:qu},Bo=Vu.uint8ToCString,Pd=l.getUint64,Fd=function(p){var v=4,w=p[0],x,T,A,X,J,oe,ce,Ne;if(w===0){x=Bo(p.subarray(v)),v+=x.length,T=Bo(p.subarray(v)),v+=T.length;var Ke=new DataView(p.buffer);A=Ke.getUint32(v),v+=4,J=Ke.getUint32(v),v+=4,oe=Ke.getUint32(v),v+=4,ce=Ke.getUint32(v),v+=4}else if(w===1){var Ke=new DataView(p.buffer);A=Ke.getUint32(v),v+=4,X=Pd(p.subarray(v)),v+=8,oe=Ke.getUint32(v),v+=4,ce=Ke.getUint32(v),v+=4,x=Bo(p.subarray(v)),v+=x.length,T=Bo(p.subarray(v)),v+=T.length}Ne=new Uint8Array(p.subarray(v,p.byteLength));var Ct={scheme_id_uri:x,value:T,timescale:A||1,presentation_time:X,presentation_time_delta:J,event_duration:oe,id:ce,message_data:Ne};return B0(w,Ct)?Ct:void 0},I0=function(p,v,w,x){return p||p===0?p/v:x+w/v},B0=function(p,v){var w=v.scheme_id_uri!=="\0",x=p===0&&Ud(v.presentation_time_delta)&&w,T=p===1&&Ud(v.presentation_time)&&w;return!(p>1)&&x||T},Ud=function(p){return p!==void 0||p!==null},P0={parseEmsgBox:Fd,scaleTime:I0},Po;typeof window<"u"?Po=window:typeof n<"u"?Po=n:typeof self<"u"?Po=self:Po={};var gr=Po,Ls=Ia.toUnsigned,Fa=Ia.toHexString,Ai=kl,oa=Rd,El=P0,Gu=zu,F0=Io,Ua=Uu,Ku=l.getUint64,za,Cl,Wu,Is,la,Fo,Xu,Ts=gr,zd=xt.parseId3Frames;za=function(p){var v={},w=Ai(p,["moov","trak"]);return w.reduce(function(x,T){var A,X,J,oe,ce;return A=Ai(T,["tkhd"])[0],!A||(X=A[0],J=X===0?12:20,oe=Ls(A[J]<<24|A[J+1]<<16|A[J+2]<<8|A[J+3]),ce=Ai(T,["mdia","mdhd"])[0],!ce)?null:(X=ce[0],J=X===0?12:20,x[oe]=Ls(ce[J]<<24|ce[J+1]<<16|ce[J+2]<<8|ce[J+3]),x)},v)},Cl=function(p,v){var w;w=Ai(v,["moof","traf"]);var x=w.reduce(function(T,A){var X=Ai(A,["tfhd"])[0],J=Ls(X[4]<<24|X[5]<<16|X[6]<<8|X[7]),oe=p[J]||9e4,ce=Ai(A,["tfdt"])[0],Ne=new DataView(ce.buffer,ce.byteOffset,ce.byteLength),Ke;ce[0]===1?Ke=Ku(ce.subarray(4,12)):Ke=Ne.getUint32(4);let Ct;return typeof Ke=="bigint"?Ct=Ke/Ts.BigInt(oe):typeof Ke=="number"&&!isNaN(Ke)&&(Ct=Ke/oe),Ct<Number.MAX_SAFE_INTEGER&&(Ct=Number(Ct)),Ct<T&&(T=Ct),T},1/0);return typeof x=="bigint"||isFinite(x)?x:0},Wu=function(p,v){var w=Ai(v,["moof","traf"]),x=0,T=0,A;if(w&&w.length){var X=Ai(w[0],["tfhd"])[0],J=Ai(w[0],["trun"])[0],oe=Ai(w[0],["tfdt"])[0];if(X){var ce=Gu(X);A=ce.trackId}if(oe){var Ne=Ua(oe);x=Ne.baseMediaDecodeTime}if(J){var Ke=F0(J);Ke.samples&&Ke.samples.length&&(T=Ke.samples[0].compositionTimeOffset||0)}}var Ct=p[A]||9e4;typeof x=="bigint"&&(T=Ts.BigInt(T),Ct=Ts.BigInt(Ct));var it=(x+T)/Ct;return typeof it=="bigint"&&it<Number.MAX_SAFE_INTEGER&&(it=Number(it)),it},Is=function(p){var v=Ai(p,["moov","trak"]),w=[];return v.forEach(function(x){var T=Ai(x,["mdia","hdlr"]),A=Ai(x,["tkhd"]);T.forEach(function(X,J){var oe=oa(X.subarray(8,12)),ce=A[J],Ne,Ke,Ct;oe==="vide"&&(Ne=new DataView(ce.buffer,ce.byteOffset,ce.byteLength),Ke=Ne.getUint8(0),Ct=Ke===0?Ne.getUint32(12):Ne.getUint32(20),w.push(Ct))})}),w},Fo=function(p){var v=p[0],w=v===0?12:20;return Ls(p[w]<<24|p[w+1]<<16|p[w+2]<<8|p[w+3])},la=function(p){var v=Ai(p,["moov","trak"]),w=[];return v.forEach(function(x){var T={},A=Ai(x,["tkhd"])[0],X,J;A&&(X=new DataView(A.buffer,A.byteOffset,A.byteLength),J=X.getUint8(0),T.id=J===0?X.getUint32(12):X.getUint32(20));var oe=Ai(x,["mdia","hdlr"])[0];if(oe){var ce=oa(oe.subarray(8,12));ce==="vide"?T.type="video":ce==="soun"?T.type="audio":T.type=ce}var Ne=Ai(x,["mdia","minf","stbl","stsd"])[0];if(Ne){var Ke=Ne.subarray(8);T.codec=oa(Ke.subarray(4,8));var Ct=Ai(Ke,[T.codec])[0],it,Bt;Ct&&(/^[asm]vc[1-9]$/i.test(T.codec)?(it=Ct.subarray(78),Bt=oa(it.subarray(4,8)),Bt==="avcC"&&it.length>11?(T.codec+=".",T.codec+=Fa(it[9]),T.codec+=Fa(it[10]),T.codec+=Fa(it[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(it=Ct.subarray(28),Bt=oa(it.subarray(4,8)),Bt==="esds"&&it.length>20&&it[19]!==0?(T.codec+="."+Fa(it[19]),T.codec+="."+Fa(it[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var hn=Ai(x,["mdia","mdhd"])[0];hn&&(T.timescale=Fo(hn)),w.push(T)}),w},Xu=function(p,v=0){var w=Ai(p,["emsg"]);return w.map(x=>{var T=El.parseEmsgBox(new Uint8Array(x)),A=zd(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:A}})};var $a={findBox:Ai,parseType:oa,timescale:za,startTime:Cl,compositionStartTime:Wu,videoTrackIds:Is,tracks:la,getTimescaleFromMediaHeader:Fo,getEmsgID3:Xu};const{parseTrun:$d}=Hu,{findBox:Hd}=$a;var qd=gr,U0=function(p){var v=Hd(p,["moof","traf"]),w=Hd(p,["mdat"]),x=[];return w.forEach(function(T,A){var X=v[A];x.push({mdat:T,traf:X})}),x},Vd=function(p,v,w){var x=v,T=w.defaultSampleDuration||0,A=w.defaultSampleSize||0,X=w.trackId,J=[];return p.forEach(function(oe){var ce=$d(oe),Ne=ce.samples;Ne.forEach(function(Ke){Ke.duration===void 0&&(Ke.duration=T),Ke.size===void 0&&(Ke.size=A),Ke.trackId=X,Ke.dts=x,Ke.compositionTimeOffset===void 0&&(Ke.compositionTimeOffset=0),typeof x=="bigint"?(Ke.pts=x+qd.BigInt(Ke.compositionTimeOffset),x+=qd.BigInt(Ke.duration)):(Ke.pts=x+Ke.compositionTimeOffset,x+=Ke.duration)}),J=J.concat(Ne)}),J},Yu={getMdatTrafPairs:U0,parseSamples:Vd},Qu=Xt.discardEmulationPreventionBytes,Xr=Vn.CaptionStream,Ha=kl,Nr=Uu,qa=zu,{getMdatTrafPairs:Zu,parseSamples:Al}=Yu,Nl=function(p,v){for(var w=p,x=0;x<v.length;x++){var T=v[x];if(w<T.size)return T;w-=T.size}return null},Ju=function(p,v,w){var x=new DataView(p.buffer,p.byteOffset,p.byteLength),T={logs:[],seiNals:[]},A,X,J,oe;for(X=0;X+4<p.length;X+=J)if(J=x.getUint32(X),X+=4,!(J<=0))switch(p[X]&31){case 6:var ce=p.subarray(X+1,X+1+J),Ne=Nl(X,v);if(A={nalUnitType:"sei_rbsp",size:J,data:ce,escapedRBSP:Qu(ce),trackId:w},Ne)A.pts=Ne.pts,A.dts=Ne.dts,oe=Ne;else if(oe)A.pts=oe.pts,A.dts=oe.dts;else{T.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+X+" for trackId "+w+". See mux.js#223."});break}T.seiNals.push(A);break}return T},ua=function(p,v){var w={},x=Zu(p);return x.forEach(function(T){var A=T.mdat,X=T.traf,J=Ha(X,["tfhd"]),oe=qa(J[0]),ce=oe.trackId,Ne=Ha(X,["tfdt"]),Ke=Ne.length>0?Nr(Ne[0]).baseMediaDecodeTime:0,Ct=Ha(X,["trun"]),it,Bt;v===ce&&Ct.length>0&&(it=Al(Ct,Ke,oe),Bt=Ju(A,it,ce),w[ce]||(w[ce]={seiNals:[],logs:[]}),w[ce].seiNals=w[ce].seiNals.concat(Bt.seiNals),w[ce].logs=w[ce].logs.concat(Bt.logs))}),w},Gd=function(p,v,w){var x;if(v===null)return null;x=ua(p,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:w}},Dl=function(){var p=!1,v,w,x,T,A,X;this.isInitialized=function(){return p},this.init=function(J){v=new Xr,p=!0,X=J?J.isPartial:!1,v.on("data",function(oe){oe.startTime=oe.startPts/T,oe.endTime=oe.endPts/T,A.captions.push(oe),A.captionStreams[oe.stream]=!0}),v.on("log",function(oe){A.logs.push(oe)})},this.isNewInit=function(J,oe){return J&&J.length===0||oe&&typeof oe=="object"&&Object.keys(oe).length===0?!1:x!==J[0]||T!==oe[x]},this.parse=function(J,oe,ce){var Ne;if(this.isInitialized()){if(!oe||!ce)return null;if(this.isNewInit(oe,ce))x=oe[0],T=ce[x];else if(x===null||!T)return w.push(J),null}else return null;for(;w.length>0;){var Ke=w.shift();this.parse(Ke,oe,ce)}return Ne=Gd(J,x,T),Ne&&Ne.logs&&(A.logs=A.logs.concat(Ne.logs)),Ne===null||!Ne.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ne.seiNals),this.flushStream(),A)},this.pushNals=function(J){if(!this.isInitialized()||!J||J.length===0)return null;J.forEach(function(oe){v.push(oe)})},this.flushStream=function(){if(!this.isInitialized())return null;X?v.partialFlush():v.flush()},this.clearParsedCaptions=function(){A.captions=[],A.captionStreams={},A.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;v.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){w=[],x=null,T=null,A?this.clearParsedCaptions():A={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Va=Dl;const{parseTfdt:z0}=Hu,Ui=kl,{getTimescaleFromMediaHeader:ec}=$a,{parseSamples:Ss,getMdatTrafPairs:Kd}=Yu;var Bs=function(){let p=9e4;this.init=function(v){const w=Ui(v,["moov","trak","mdia","mdhd"])[0];w&&(p=ec(w))},this.parseSegment=function(v){const w=[],x=Kd(v);let T=0;return x.forEach(function(A){const X=A.mdat,J=A.traf,oe=Ui(J,["tfdt"])[0],ce=Ui(J,["tfhd"])[0],Ne=Ui(J,["trun"]);if(oe&&(T=z0(oe).baseMediaDecodeTime),Ne.length&&ce){const Ke=Ss(Ne,T,ce);let Ct=0;Ke.forEach(function(it){const Bt="utf-8",hn=new TextDecoder(Bt),Vi=X.slice(Ct,Ct+it.size);if(Ui(Vi,["vtte"])[0]){Ct+=it.size;return}Ui(Vi,["vttc"]).forEach(function(Ho){const xi=Ui(Ho,["payl"])[0],ca=Ui(Ho,["sttg"])[0],ks=it.pts/p,Hs=(it.pts+it.duration)/p;let ai,ls;if(xi)try{ai=hn.decode(xi)}catch(sr){console.error(sr)}if(ca)try{ls=hn.decode(ca)}catch(sr){console.error(sr)}it.duration&&ai&&w.push({cueText:ai,start:ks,end:Hs,settings:ls})}),Ct+=it.size})}}),w}},Uo=Yn,nc=function(p){var v=p[1]&31;return v<<=8,v|=p[2],v},Ga=function(p){return!!(p[1]&64)},zo=function(p){var v=0;return(p[3]&48)>>>4>1&&(v+=p[4]+1),v},Dr=function(p,v){var w=nc(p);return w===0?"pat":w===v?"pmt":v?"pes":null},Ka=function(p){var v=Ga(p),w=4+zo(p);return v&&(w+=p[w]+1),(p[w+10]&31)<<8|p[w+11]},Wa=function(p){var v={},w=Ga(p),x=4+zo(p);if(w&&(x+=p[x]+1),!!(p[x+5]&1)){var T,A,X;T=(p[x+1]&15)<<8|p[x+2],A=3+T-4,X=(p[x+10]&15)<<8|p[x+11];for(var J=12+X;J<A;){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 w=nc(p),x=v[w];switch(x){case Uo.H264_STREAM_TYPE:return"video";case Uo.ADTS_STREAM_TYPE:return"audio";case Uo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},$o=function(p){var v=Ga(p);if(!v)return null;var w=4+zo(p);if(w>=p.byteLength)return null;var x=null,T;return T=p[w+7],T&192&&(x={},x.pts=(p[w+9]&14)<<27|(p[w+10]&255)<<20|(p[w+11]&254)<<12|(p[w+12]&255)<<5|(p[w+13]&254)>>>3,x.pts*=4,x.pts+=(p[w+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(p[w+14]&14)<<27|(p[w+15]&255)<<20|(p[w+16]&254)<<12|(p[w+17]&255)<<5|(p[w+18]&254)>>>3,x.dts*=4,x.dts+=(p[w+18]&6)>>>1)),x},yr=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}},Mr=function(p){for(var v=4+zo(p),w=p.subarray(v),x=0,T=0,A=!1,X;T<w.byteLength-3;T++)if(w[T+2]===1){x=T+5;break}for(;x<w.byteLength;)switch(w[x]){case 0:if(w[x-1]!==0){x+=2;break}else if(w[x-2]!==0){x++;break}T+3!==x-2&&(X=yr(w[T+3]&31),X==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0));do x++;while(w[x]!==1&&x<w.length);T=x-2,x+=3;break;case 1:if(w[x-1]!==0||w[x-2]!==0){x+=3;break}X=yr(w[T+3]&31),X==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0),T=x-2,x+=3;break;default:x+=3;break}return w=w.subarray(T),x-=T,T=0,w&&w.byteLength>3&&(X=yr(w[T+3]&31),X==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},Ps={parseType:Dr,parsePat:Ka,parsePmt:Wa,parsePayloadUnitStartIndicator:Ga,parsePesType:Ml,parsePesTime:$o,videoPacketContainsKeyFrame:Mr},Yr=Yn,cr=ni.handleRollover,kn={};kn.ts=Ps,kn.aac=xn;var Fs=Tt.ONE_SECOND_IN_TS,nr=188,jr=71,Wd=function(p,v){for(var w=0,x=nr,T,A;x<p.byteLength;){if(p[w]===jr&&p[x]===jr){switch(T=p.subarray(w,x),A=kn.ts.parseType(T,v.pid),A){case"pat":v.pid=kn.ts.parsePat(T);break;case"pmt":var X=kn.ts.parsePmt(T);v.table=v.table||{},Object.keys(X).forEach(function(J){v.table[J]=X[J]});break}w+=nr,x+=nr;continue}w++,x++}},Qi=function(p,v,w){for(var x=0,T=nr,A,X,J,oe,ce,Ne=!1;T<=p.byteLength;){if(p[x]===jr&&(p[T]===jr||T===p.byteLength)){if(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X==="pes"&&(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="audio",w.audio.push(ce),Ne=!0))),Ne)break;x+=nr,T+=nr;continue}x++,T++}for(T=p.byteLength,x=T-nr,Ne=!1;x>=0;){if(p[x]===jr&&(p[T]===jr||T===p.byteLength)){if(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X==="pes"&&(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="audio"&&oe&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="audio",w.audio.push(ce),Ne=!0))),Ne)break;x-=nr,T-=nr;continue}x--,T--}},gi=function(p,v,w){for(var x=0,T=nr,A,X,J,oe,ce,Ne,Ke,Ct,it=!1,Bt={data:[],size:0};T<p.byteLength;){if(p[x]===jr&&p[T]===jr){switch(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X){case"pes":if(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&(oe&&!it&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="video",w.video.push(ce),it=!0)),!w.firstKeyFrame)){if(oe&&Bt.size!==0){for(Ne=new Uint8Array(Bt.size),Ke=0;Bt.data.length;)Ct=Bt.data.shift(),Ne.set(Ct,Ke),Ke+=Ct.byteLength;if(kn.ts.videoPacketContainsKeyFrame(Ne)){var hn=kn.ts.parsePesTime(Ne);hn?(w.firstKeyFrame=hn,w.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.")}Bt.size=0}Bt.data.push(A),Bt.size+=A.byteLength}break}if(it&&w.firstKeyFrame)break;x+=nr,T+=nr;continue}x++,T++}for(T=p.byteLength,x=T-nr,it=!1;x>=0;){if(p[x]===jr&&p[T]===jr){if(A=p.subarray(x,T),X=kn.ts.parseType(A,v.pid),X==="pes"&&(J=kn.ts.parsePesType(A,v.table),oe=kn.ts.parsePayloadUnitStartIndicator(A),J==="video"&&oe&&(ce=kn.ts.parsePesTime(A),ce&&(ce.type="video",w.video.push(ce),it=!0))),it)break;x-=nr,T-=nr;continue}x--,T--}},On=function(p,v){if(p.audio&&p.audio.length){var w=v;(typeof w>"u"||isNaN(w))&&(w=p.audio[0].dts),p.audio.forEach(function(A){A.dts=cr(A.dts,w),A.pts=cr(A.pts,w),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs})}if(p.video&&p.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=p.video[0].dts),p.video.forEach(function(A){A.dts=cr(A.dts,x),A.pts=cr(A.pts,x),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs}),p.firstKeyFrame){var T=p.firstKeyFrame;T.dts=cr(T.dts,x),T.pts=cr(T.pts,x),T.dtsTime=T.dts/Fs,T.ptsTime=T.pts/Fs}}},Us=function(p){for(var v=!1,w=0,x=null,T=null,A=0,X=0,J;p.length-X>=3;){var oe=kn.aac.parseType(p,X);switch(oe){case"timed-metadata":if(p.length-X<10){v=!0;break}if(A=kn.aac.parseId3TagSize(p,X),A>p.length){v=!0;break}T===null&&(J=p.subarray(X,X+A),T=kn.aac.parseAacTimestamp(J)),X+=A;break;case"audio":if(p.length-X<7){v=!0;break}if(A=kn.aac.parseAdtsSize(p,X),A>p.length){v=!0;break}x===null&&(J=p.subarray(X,X+A),x=kn.aac.parseSampleRate(J)),w++,X+=A;break;default:X++;break}if(v)return null}if(x===null||T===null)return null;var ce=Fs/x,Ne={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+w*1024*ce,pts:T+w*1024*ce}]};return Ne},Rr=function(p){var v={pid:null,table:null},w={};Wd(p,v);for(var x in v.table)if(v.table.hasOwnProperty(x)){var T=v.table[x];switch(T){case Yr.H264_STREAM_TYPE:w.video=[],gi(p,v,w),w.video.length===0&&delete w.video;break;case Yr.ADTS_STREAM_TYPE:w.audio=[],Qi(p,v,w),w.audio.length===0&&delete w.audio;break}}return w},ic=function(p,v){var w=kn.aac.isLikelyAacData(p),x;return w?x=Us(p):x=Rr(p),!x||!x.audio&&!x.video?null:(On(x,v),x)},zs={inspect:ic,parseAudioPes_:Qi};const Xd=function(p,v){v.on("data",function(w){const x=w.initSegment;w.initSegment={data:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength};const T=w.data;w.data=T.buffer,p.postMessage({action:"data",segment:w,byteOffset:T.byteOffset,byteLength:T.byteLength},[w.data])}),v.on("done",function(w){p.postMessage({action:"done"})}),v.on("gopInfo",function(w){p.postMessage({action:"gopInfo",gopInfo:w})}),v.on("videoSegmentTimingInfo",function(w){const x={start:{decode:Tt.videoTsToSeconds(w.start.dts),presentation:Tt.videoTsToSeconds(w.start.pts)},end:{decode:Tt.videoTsToSeconds(w.end.dts),presentation:Tt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:Tt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=Tt.videoTsToSeconds(w.prependedContentDuration)),p.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(w){const x={start:{decode:Tt.videoTsToSeconds(w.start.dts),presentation:Tt.videoTsToSeconds(w.start.pts)},end:{decode:Tt.videoTsToSeconds(w.end.dts),presentation:Tt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:Tt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=Tt.videoTsToSeconds(w.prependedContentDuration)),p.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(w){p.postMessage({action:"id3Frame",id3Frame:w})}),v.on("caption",function(w){p.postMessage({action:"caption",caption:w})}),v.on("trackinfo",function(w){p.postMessage({action:"trackinfo",trackInfo:w})}),v.on("audioTimingInfo",function(w){p.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Tt.videoTsToSeconds(w.start),end:Tt.videoTsToSeconds(w.end)}})}),v.on("videoTimingInfo",function(w){p.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Tt.videoTsToSeconds(w.start),end:Tt.videoTsToSeconds(w.end)}})}),v.on("log",function(w){p.postMessage({action:"log",log:w})})};class rc{constructor(v,w){this.options=w||{},this.self=v,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new D0.Transmuxer(this.options),Xd(this.self,this.transmuxer)}pushMp4Captions(v){this.captionParser||(this.captionParser=new Va,this.captionParser.init());const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.captionParser.parse(w,v.trackIds,v.timescales);this.self.postMessage({action:"mp4Captions",captions:x&&x.captions||[],logs:x&&x.logs||[],data:w.buffer},[w.buffer])}initMp4WebVttParser(v){this.webVttParser||(this.webVttParser=new Bs);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.webVttParser.init(w)}getMp4WebVttText(v){this.webVttParser||(this.webVttParser=new Bs);const w=new Uint8Array(v.data,v.byteOffset,v.byteLength),x=this.webVttParser.parseSegment(w);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:x||[],data:w.buffer},[w.buffer])}probeMp4StartTime({timescales:v,data:w}){const x=$a.startTime(v,w);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:w},[w.buffer])}probeMp4Tracks({data:v}){const w=$a.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:w,data:v},[v.buffer])}probeEmsgID3({data:v,offset:w}){const x=$a.getEmsgID3(v,w);this.self.postMessage({action:"probeEmsgID3",id3Frames:x,emsgData:v},[v.buffer])}probeTs({data:v,baseStartTime:w}){const x=typeof w=="number"&&!isNaN(w)?w*Tt.ONE_SECOND_IN_TS:void 0,T=zs.inspect(v,x);let A=null;T&&(A={hasVideo:T.video&&T.video.length===2||!1,hasAudio:T.audio&&T.audio.length===2||!1},A.hasVideo&&(A.videoStart=T.video[0].ptsTime),A.hasAudio&&(A.audioStart=T.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:A,data:v},[v.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(v){const w=new Uint8Array(v.data,v.byteOffset,v.byteLength);this.transmuxer.push(w)}reset(){this.transmuxer.reset()}setTimestampOffset(v){const w=v.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Tt.secondsToVideoTs(w)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(Tt.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 rc(self,p.data.options);return}this.messageHandlers||(this.messageHandlers=new rc(self)),p.data&&p.data.action&&p.data.action!=="init"&&this.messageHandlers[p.data.action]&&this.messageHandlers[p.data.action](p.data)}}));var Xj=VS(Wj);const Yj=(n,e,t)=>{const{type:i,initSegment:a,captions:l,captionStreams:u,metadata:h,videoFrameDtsTime:f,videoFramePtsTime:g}=n.data.segment;e.buffer.push({captions:l,captionStreams:u,metadata:h});const _=n.data.segment.boxes||{data:n.data.segment.data},S={type:i,data:new Uint8Array(_.data,_.data.byteOffset,_.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};typeof f<"u"&&(S.videoFrameDtsTime=f),typeof g<"u"&&(S.videoFramePtsTime=g),t(S)},Qj=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},Zj=(n,e)=>{e.gopInfo=n.data.gopInfo},WS=n=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:a,remux:l,onData:u,onTrackInfo:h,onAudioTimingInfo:f,onVideoTimingInfo:g,onVideoSegmentTimingInfo:_,onAudioSegmentTimingInfo:S,onId3:C,onCaptions:D,onDone:R,onEndedTimeline:E,onTransmuxerLog:B,isEndOfTimeline:G,segment:Y,triggerSegmentEventFn:q}=n,se={buffer:[]};let Q=G;const K=re=>{e.currentTransmux===n&&(re.data.action==="data"&&Yj(re,se,u),re.data.action==="trackinfo"&&h(re.data.trackInfo),re.data.action==="gopInfo"&&Zj(re,se),re.data.action==="audioTimingInfo"&&f(re.data.audioTimingInfo),re.data.action==="videoTimingInfo"&&g(re.data.videoTimingInfo),re.data.action==="videoSegmentTimingInfo"&&_(re.data.videoSegmentTimingInfo),re.data.action==="audioSegmentTimingInfo"&&S(re.data.audioSegmentTimingInfo),re.data.action==="id3Frame"&&C([re.data.id3Frame],re.data.id3Frame.dispatchType),re.data.action==="caption"&&D(re.data.caption),re.data.action==="endedtimeline"&&(Q=!1,E()),re.data.action==="log"&&B(re.data.log),re.data.type==="transmuxed"&&(Q||(e.onmessage=null,Qj({transmuxedData:se,callback:R}),XS(e))))},O=()=>{const re={message:"Received an error message from the transmuxer worker",metadata:{errorType:Be.Error.StreamingFailedToTransmuxSegment,segmentInfo:al({segment:Y})}};R(null,re)};if(e.onmessage=K,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,k=t instanceof ArrayBuffer?0:t.byteOffset;q({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:re,byteOffset:k,byteLength:t.byteLength},[re])}G&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():WS(n.currentTransmux))},c_=(n,e)=>{n.postMessage({action:e}),XS(n)},YS=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,c_(e,n);return}e.transmuxQueue.push(c_.bind(null,e,n))},Jj=n=>{YS("reset",n)},eR=n=>{YS("endTimeline",n)},QS=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,WS(n);return}n.transmuxer.transmuxQueue.push(n)},tR=n=>{const e=new Xj;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 pg={reset:Jj,endTimeline:eR,transmux:QS,createTransmuxer:tR};const fu=function(n){const e=n.transmuxer,t=n.endAction||n.action,i=n.callback,a=Xi({},n,{endAction:null,transmuxer:null,callback:null}),l=u=>{u.data.action===t&&(e.removeEventListener("message",l),u.data.data&&(u.data.data=new Uint8Array(u.data.data,n.byteOffset||0,n.byteLength||u.data.data.byteLength),n.data&&(n.data=u.data.data)),i(u.data))};if(e.addEventListener("message",l),n.data){const u=n.data instanceof ArrayBuffer;a.byteOffset=u?0:n.data.byteOffset,a.byteLength=n.data.byteLength;const h=[u?n.data:n.data.buffer];e.postMessage(a,h)}else e.postMessage(a)},Js={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ZS="wvtt",sy=n=>{n.forEach(e=>{e.abort()})},nR=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),iR=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},nb=(n,e)=>{const{requestType:t}=e,i=ml({requestType:t,request:e,error:n});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Js.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Js.ABORTED,xhr:e,metadata:i}:n?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Js.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Js.FAILURE,xhr:e,metadata:i}:null},d_=(n,e,t,i)=>(a,l)=>{const u=l.response,h=nb(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:Js.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 _={uri:l.uri};return i({type:"segmentkeyloadcomplete",segment:n,keyInfo:_}),t(null,n)},rR=(n,e)=>{e===ZS&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},sR=(n,e,t)=>{e===ZS&&fu({action:"getMp4WebVttText",data:n.bytes,transmuxer:n.transmuxer,callback:({data:i,mp4VttCues:a})=>{n.bytes=i,t(null,n,{mp4VttCues:a})}})},JS=(n,e)=>{const t=ky(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:Js.FAILURE,metadata:{mediaType:a}})}fu({action:"probeMp4Tracks",data:n.map.bytes,transmuxer:n.transmuxer,callback:({tracks:i,data:a})=>(n.map.bytes=a,i.forEach(function(l){n.map.tracks=n.map.tracks||{},!n.map.tracks[l.type]&&(n.map.tracks[l.type]=l,typeof l.id=="number"&&l.timescale&&(n.map.timescales=n.map.timescales||{},n.map.timescales[l.id]=l.timescale),l.type==="text"&&rR(n,l.codec))}),e(null))})},aR=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=nb(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,JS(n,function(h){if(h)return h.xhr=a,h.status=a.status,e(h,n);e(null,n)})},oR=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=nb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:Gj(l.responseText.substring(n.lastReachedChar||0));return n.stats=nR(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},lR=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})=>{const R=n.map&&n.map.tracks||{},E=!!(R.audio&&R.video);let B=i.bind(null,n,"audio","start");const G=i.bind(null,n,"audio","end");let Y=i.bind(null,n,"video","start");const q=i.bind(null,n,"video","end"),se=()=>QS({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:E,onData:Q=>{Q.type=Q.type==="combined"?"video":Q.type,_(n,Q)},onTrackInfo:Q=>{t&&(E&&(Q.isMuxed=!0),t(n,Q))},onAudioTimingInfo:Q=>{B&&typeof Q.start<"u"&&(B(Q.start),B=null),G&&typeof Q.end<"u"&&G(Q.end)},onVideoTimingInfo:Q=>{Y&&typeof Q.start<"u"&&(Y(Q.start),Y=null),q&&typeof Q.end<"u"&&q(Q.end)},onVideoSegmentTimingInfo:Q=>{const K={pts:{start:Q.start.presentation,end:Q.end.presentation},dts:{start:Q.start.decode,end:Q.end.decode}};D({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:K}),a(Q)},onAudioSegmentTimingInfo:Q=>{const K={pts:{start:Q.start.pts,end:Q.end.pts},dts:{start:Q.start.dts,end:Q.end.dts}};D({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:K}),l(Q)},onId3:(Q,K)=>{u(n,Q,K)},onCaptions:Q=>{h(n,[Q])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:C,onDone:(Q,K)=>{S&&(Q.type=Q.type==="combined"?"video":Q.type,D({type:"segmenttransmuxingcomplete",segment:n}),S(K,n,Q))},segment:n,triggerSegmentEventFn:D});fu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:Q=>{n.bytes=e=Q.data;const K=Q.result;K&&(t(n,{hasAudio:K.hasAudio,hasVideo:K.hasVideo,isMuxed:E}),t=null),se()}})},ek=({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})=>{let R=new Uint8Array(e);if(N4(R)){n.isFmp4=!0;const{tracks:E}=n.map;if(E.text&&(!E.audio||!E.video)){_(n,{data:R,type:"text"}),sR(n,E.text.codec,S);return}const G={isFmp4:!0,hasVideo:!!E.video,hasAudio:!!E.audio};E.audio&&E.audio.codec&&E.audio.codec!=="enca"&&(G.audioCodec=E.audio.codec),E.video&&E.video.codec&&E.video.codec!=="encv"&&(G.videoCodec=E.video.codec),E.video&&E.audio&&(G.isMuxed=!0),t(n,G);const Y=(q,se)=>{_(n,{data:R,type:G.hasAudio&&!G.isMuxed?"audio":"video"}),se&&se.length&&u(n,se),q&&q.length&&h(n,q),S(null,n,{})};fu({action:"probeMp4StartTime",timescales:n.map.timescales,data:R,transmuxer:n.transmuxer,callback:({data:q,startTime:se})=>{e=q.buffer,n.bytes=R=q,G.hasAudio&&!G.isMuxed&&i(n,"audio","start",se),G.hasVideo&&i(n,"video","start",se),fu({action:"probeEmsgID3",data:R,transmuxer:n.transmuxer,offset:se,callback:({emsgData:Q,id3Frames:K})=>{if(e=Q.buffer,n.bytes=R=Q,!E.video||!Q.byteLength||!n.transmuxer){Y(void 0,K);return}fu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:R,timescales:n.map.timescales,trackIds:[E.video.id],callback:O=>{e=O.data.buffer,n.bytes=R=O.data,O.logs.forEach(function(re){C(ri(re,{stream:"mp4CaptionParser"}))}),Y(O.captions,K)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=ky(R)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}lR({segment:n,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})},tk=function({id:n,key:e,encryptedBytes:t,decryptionWorker:i,segment:a,doneFn:l},u){const h=g=>{if(g.data.source===n){i.removeEventListener("message",h);const _=g.data.decrypted;u(new Uint8Array(_.bytes,_.byteOffset,_.byteLength))}};i.onerror=()=>{const g="An error occurred in the decryption worker",_=al({segment:a}),S={message:g,metadata:{error:new Error(g),errorType:Be.Error.StreamingFailedToDecryptSegment,segmentInfo:_,keyInfo:{uri:a.key.resolvedUri||a.map.key.resolvedUri}}};l(S,a)},i.addEventListener("message",h);let f;e.bytes.slice?f=e.bytes.slice():f=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(FS({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},uR=({decryptionWorker:n,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})=>{D({type:"segmentdecryptionstart"}),tk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},R=>{e.bytes=R,D({type:"segmentdecryptioncomplete",segment:e}),ek({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})})},cR=({activeXhrs:n,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})=>{let R=0,E=!1;return(B,G)=>{if(!E){if(B)return E=!0,sy(n),S(B,G);if(R+=1,R===n.length){const Y=function(){if(G.encryptedBytes)return uR({decryptionWorker:e,segment:G,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D});ek({segment:G,bytes:G.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_,doneFn:S,onTransmuxerLog:C,triggerSegmentEventFn:D})};if(G.endOfAllRequests=Date.now(),G.map&&G.map.encryptedBytes&&!G.map.bytes)return D({type:"segmentdecryptionstart",segment:G}),tk({decryptionWorker:e,id:G.requestId+"-init",encryptedBytes:G.map.encryptedBytes,key:G.map.key,segment:G,doneFn:S},q=>{G.map.bytes=q,D({type:"segmentdecryptioncomplete",segment:G}),JS(G,se=>{if(se)return sy(n),S(se,G);Y()})});Y()}}}},dR=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},hR=({segment:n,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:l,id3Fn:u,captionsFn:h,isEndOfTimeline:f,endedTimelineFn:g,dataFn:_})=>S=>{if(!S.target.aborted)return n.stats=ri(n.stats,iR(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},fR=({xhr:n,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:a,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:D,dataFn:R,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G})=>{const Y=[],q=cR({activeXhrs:Y,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:D,dataFn:R,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G});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 k=ri(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),j=d_(i,re,q,G),te={uri:i.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:te});const V=n(k,j);Y.push(V)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const V=ri(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ne=d_(i,[i.map.key],q,G),he={uri:i.map.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:he});const ae=n(V,ne);Y.push(ae)}const k=ri(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:iy(i.map),requestType:"segment-media-initialization"}),j=aR({segment:i,finishProcessingFn:q,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const te=n(k,j);Y.push(te)}const se=ri(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:iy(i),requestType:"segment"}),Q=oR({segment:i,finishProcessingFn:q,responseType:se.responseType,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const K=n(se,Q);K.addEventListener("progress",hR({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:D,dataFn:R})),Y.push(K);const O={};return Y.forEach(re=>{re.addEventListener("loadend",dR({loadendState:O,abortFn:a}))}),()=>sy(Y)},Zh=xs("PlaylistSelector"),h_=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||""})},pu=function(n,e){if(!n)return"";const t=ue.getComputedStyle(n);return t?t[e]:""},mu=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})},ib=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||ue.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||ue.Number.MAX_VALUE,t-i},pR=function(n,e){let t,i;return n.attributes.RESOLUTION&&n.attributes.RESOLUTION.width&&(t=n.attributes.RESOLUTION.width),t=t||ue.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||ue.Number.MAX_VALUE,t===i&&n.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?n.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let nk=function(n){const{main:e,bandwidth:t,playerWidth:i,playerHeight:a,playerObjectFit:l,limitRenditionByPlayerDimensions:u,playlistController:h}=n;if(!e)return;const f={bandwidth:t,width:i,height:a,limitRenditionByPlayerDimensions:u};let g=e.playlists;Hr.isAudioOnly(e)&&(g=h.getAudioTrackPlaylists_(),f.audioOnly=!0);let _=g.map(O=>{let re;const k=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,j=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return re=O.attributes&&O.attributes.BANDWIDTH,re=re||ue.Number.MAX_VALUE,{bandwidth:re,width:k,height:j,playlist:O}});mu(_,(O,re)=>O.bandwidth-re.bandwidth),_=_.filter(O=>!Hr.isIncompatible(O.playlist));let S=_.filter(O=>Hr.isEnabled(O.playlist));S.length||(S=_.filter(O=>!Hr.isDisabled(O.playlist)));const C=S.filter(O=>O.bandwidth*or.BANDWIDTH_VARIANCE<t);let D=C[C.length-1];const R=C.filter(O=>O.bandwidth===D.bandwidth)[0];if(u===!1){const O=R||S[0]||_[0];if(O&&O.playlist){let re="sortedPlaylistReps";return R&&(re="bandwidthBestRep"),S[0]&&(re="enabledPlaylistReps"),Zh(`choosing ${h_(O)} using ${re} with options`,f),O.playlist}return Zh("could not choose a playlist with options",f),null}const E=C.filter(O=>O.width&&O.height);mu(E,(O,re)=>O.width-re.width);const B=E.filter(O=>O.width===i&&O.height===a);D=B[B.length-1];const G=B.filter(O=>O.bandwidth===D.bandwidth)[0];let Y,q,se;G||(Y=E.filter(O=>l==="cover"?O.width>i&&O.height>a:O.width>i||O.height>a),q=Y.filter(O=>O.width===Y[0].width&&O.height===Y[0].height),D=q[q.length-1],se=q.filter(O=>O.bandwidth===D.bandwidth)[0]);let Q;if(h.leastPixelDiffSelector){const O=E.map(re=>(re.pixelDiff=Math.abs(re.width-i)+Math.abs(re.height-a),re));mu(O,(re,k)=>re.pixelDiff===k.pixelDiff?k.bandwidth-re.bandwidth:re.pixelDiff-k.pixelDiff),Q=O[0]}const K=Q||se||G||R||S[0]||_[0];if(K&&K.playlist){let O="sortedPlaylistReps";return Q?O="leastPixelDiffRep":se?O="resolutionPlusOneRep":G?O="resolutionBestRep":R?O="bandwidthBestRep":S[0]&&(O="enabledPlaylistReps"),Zh(`choosing ${h_(K)} using ${O} with options`,f),K.playlist}return Zh("could not choose a playlist with options",f),null};const f_=function(){let n=this.useDevicePixelRatio&&ue.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),nk({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(pu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(pu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?pu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},mR=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&&ue.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),nk({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(pu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(pu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?pu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},gR=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(R=>!Hr.isIncompatible(R));let _=g.filter(Hr.isEnabled);_.length||(_=g.filter(R=>!Hr.isDisabled(R)));const C=_.filter(Hr.hasAttribute.bind(null,"BANDWIDTH")).map(R=>{const B=f.getSyncPoint(R,a,h,t)?1:2,Y=Hr.estimateSegmentRequestTime(l,i,R)*B-u;return{playlist:R,rebufferingImpact:Y}}),D=C.filter(R=>R.rebufferingImpact<=0);return mu(D,(R,E)=>ib(E.playlist,R.playlist)),D.length?D[0]:(mu(C,(R,E)=>R.rebufferingImpact-E.rebufferingImpact),C[0]||null)},yR=function(){const n=this.playlists.main.playlists.filter(Hr.isEnabled);return mu(n,(t,i)=>ib(t,i)),n.filter(t=>!!od(this.playlists.main,t).video)[0]||null},bR=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 ik(n){try{return new URL(n).pathname.split("/").slice(-2).join("/")}catch{return""}}const vR=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}}},xR=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=ue.WebKitDataCue||ue.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))})},_R=function(n){Object.defineProperties(n.frame,{id:{get(){return Be.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),n.value.key}},value:{get(){return Be.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),n.value.data}},privateData:{get(){return Be.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),n.value.data}}})},wR=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=ue.WebKitDataCue||ue.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(_=>{const S=_.cueTime+t;typeof S!="number"||ue.isNaN(S)||S<0||!(S<1/0)||!_.frames||!_.frames.length||_.frames.forEach(C=>{const D=new a(S,S,C.value||C.url||C.data||"");D.frame=C,D.value=C,_R(D),l.addCue(D)})}),!l.cues||!l.cues.length))return;const u=l.cues,h=[];for(let _=0;_<u.length;_++)u[_]&&h.push(u[_]);const f=h.reduce((_,S)=>{const C=_[S.startTime]||[];return C.push(S),_[S.startTime]=C,_},{}),g=Object.keys(f).sort((_,S)=>Number(_)-Number(S));g.forEach((_,S)=>{const C=f[_],D=isFinite(i)?i:_,R=Number(g[S+1])||D;C.forEach(E=>{E.endTime=R})})},TR={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"},SR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),kR=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=ue.WebKitDataCue||ue.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(SR.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:TR[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()})},p_=(n,e,t)=>{n.metadataTrack_||(n.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,Be.browser.IS_ANY_SAFARI||(n.metadataTrack_.inBandMetadataTrackDispatchType=e))},Xc=function(n,e,t){let i,a;if(t&&t.cues)for(i=t.cues.length;i--;)a=t.cues[i],a.startTime>=n&&a.endTime<=e&&t.removeCue(a)},ER=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}},CR=(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)},AR=(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)},NR=(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},DR=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},MR=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]},Uc=1,jR=500,m_=n=>typeof n=="number"&&isFinite(n),Jh=1/60,RR=(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,OR=(n,e,t)=>{let i=e-or.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:_}=n,S=h.length-1;let C="mediaIndex/partIndex increment";n.getMediaInfoForTime?C=`getMediaInfoForTime (${n.getMediaInfoForTime})`:n.isSyncRequest&&(C="getSyncSegmentCandidate (isSyncRequest)"),n.independent&&(C+=` with independent ${n.independent}`);const D=typeof g=="number",R=n.segment.uri?"segment":"pre-segment",E=D?_S({preloadSegment:i})-1:0;return`${R} [${l+f}/${l+S}]`+(D?` part [${g}/${E}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(D?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${_}] selected by [${C}] playlist [${u}]`},g_=n=>`${n}TimingInfo`,LR=({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,ay=({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},IR=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)},BR=n=>{const e=n.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=n.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},go=n=>{const e=n.pendingSegment_;if(!e)return;if(ay({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&IR(n.timelineChangeController_)){if(BR(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},PR=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=ue.BigInt(l)-ue.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},y_=({segmentDuration:n,maxDuration:e})=>n?Math.round(n)>e+Qs:!1,FR=(n,e)=>{if(e!=="hls")return null;const t=PR({audioTimingInfo:n.audioTimingInfo,videoTimingInfo:n.videoTimingInfo});if(!t)return null;const i=n.playlist.targetDuration,a=y_({segmentDuration:t,maxDuration:i*2}),l=y_({segmentDuration:t,maxDuration:i}),u=`Segment with index ${n.mediaIndex} from playlist ${n.playlist.id} has a duration of ${t} when the reported duration is ${n.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return a||l?{severity:a?"warn":"info",message:u}:null},al=({type:n,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),a=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:n||e.type,uri:e.resolvedUri||e.uri,start:a,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class oy extends Be.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=xs(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Xi({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Xi({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():go(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return pg.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_&&ue.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,ue.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_&&pg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ur();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:a}=e;if(i&&t&&!this.audioDisabled_&&!a)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];return t&&!a&&e.bytes&&(this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),a||e}segmentKey(e,t=!1){if(!e)return null;const i=US(e);let a=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!a&&e.bytes&&(this.keyCache_[i]=a={resolvedUri:e.resolvedUri,bytes:e.bytes});const l={resolvedUri:(a||e).resolvedUri};return a&&(l.bytes=a.bytes),l}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,a=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let l=null;if(i&&(i.id?l=i.id:i.uri&&(l=i.uri)),this.logger_(`playlist update [${l} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
||
currentTime: ${this.currentTime_()}
|
||
bufferedEnd: ${hg(this.buffered_())}
|
||
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const u=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${u}]`),this.mediaIndex!==null)if(this.mediaIndex-=u,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const h=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!h.parts||!h.parts.length||!h.parts[this.partIndex])){const f=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=f}}a&&(a.mediaIndex-=u,a.mediaIndex<0?(a.mediaIndex=null,a.partIndex=null):(a.mediaIndex>=0&&(a.segment=e.segments[a.mediaIndex]),a.partIndex>=0&&a.segment.parts&&(a.part=a.segment.parts[a.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(ue.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_&&pg.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_=NR(this.gopBuffer_,e,t,this.timeMapping_),l++,this.sourceUpdater_.removeVideo(e,t,u));for(const h in this.inbandTextTracks_)Xc(e,t,this.inbandTextTracks_[h]);Xc(e,t,this.segmentMetadataTrack_),u()}monitorBuffer_(){this.checkBufferTimeout_&&ue.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ue.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&ue.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ue.setTimeout(this.monitorBufferTick_.bind(this),jR)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const a=typeof e=="number"&&t.segments[e],l=e+1===t.segments.length,u=!a||!a.parts||i+1===a.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&l&&u}chooseNextRequest_(){const e=this.buffered_(),t=hg(e)||0,i=Zy(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=MR(this.currentTimeline_,u,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${h.mediaIndex}`);else if(this.mediaIndex!==null){const C=u[this.mediaIndex],D=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=C.end?C.end:t,C.parts&&C.parts[D+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=D+1):h.mediaIndex=this.mediaIndex+1}else{let C,D,R;const E=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
||
For TargetTime: ${E}.
|
||
CurrentTime: ${this.currentTime_()}
|
||
BufferedEnd: ${t}
|
||
Fetch At Buffer: ${this.fetchAtBuffer_}
|
||
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const B=this.getSyncInfoFromMediaSequenceSync_(E);if(!B){const G="No sync info found while using media sequence sync";return this.error({message:G,metadata:{errorType:Be.Error.StreamingFailedToSelectNextSegment,error:new Error(G)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${B.start} --> ${B.end})`),C=B.segmentIndex,D=B.partIndex,R=B.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const B=Hr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:E,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});C=B.segmentIndex,D=B.partIndex,R=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${E}`:`currentTime ${E}`,h.mediaIndex=C,h.startOfSegment=R,h.partIndex=D,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${h.mediaIndex} `)}const f=u[h.mediaIndex];let g=f&&typeof h.partIndex=="number"&&f.parts&&f.parts[h.partIndex];if(!f||typeof h.partIndex=="number"&&!g)return null;typeof h.partIndex!="number"&&f.parts&&(h.partIndex=0,g=f.parts[0]);const _=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&g&&!_&&!g.independent)if(h.partIndex===0){const C=u[h.mediaIndex-1],D=C.parts&&C.parts.length&&C.parts[C.parts.length-1];D&&D.independent&&(h.mediaIndex-=1,h.partIndex=C.parts.length-1,h.independent="previous segment")}else f.parts[h.partIndex-1].independent&&(h.partIndex-=1,h.independent="previous part");const S=this.mediaSource_&&this.mediaSource_.readyState==="ended";return h.mediaIndex>=u.length-1&&S&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,h.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(h))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const a=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return a?(a.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),a):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:a,startOfSegment:l,isSyncRequest:u,partIndex:h,forceTimestampOffset:f,getMediaInfoForTime:g}=e,_=i.segments[a],S=typeof h=="number"&&_.parts[h],C={requestId:"segment-loader-"+Math.random(),uri:S&&S.resolvedUri||_.resolvedUri,mediaIndex:a,partIndex:S?h:null,isSyncRequest:u,startOfSegment:l,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:_.timeline,duration:S&&S.duration||_.duration,segment:_,part:S,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:g,independent:t},D=typeof f<"u"?f:this.isPendingTimestampOffset_;C.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:_.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:D});const R=hg(this.sourceUpdater_.audioBuffered());return typeof R=="number"&&(C.audioAppendStart=R-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(C.gopsToAlignWith=CR(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),C}timestampOffsetForSegment_(e){return LR(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,a=this.pendingSegment_.duration,l=Hr.estimateSegmentRequestTime(a,i,this.playlist_,e.bytesReceived),u=ij(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=gR({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:u,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!h)return;const g=l-u-h.rebufferingImpact;let _=.5;u<=Qs&&(_=1),!(!h.playlist||h.playlist.uri===this.playlist_.uri||g<_)&&(this.bandwidth=h.playlist.attributes.BANDWIDTH*or.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:al({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:a}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:l}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},DR(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_():go(this))))}handleTimingInfo_(e,t,i,a){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const l=this.pendingSegment_,u=g_(t);l[u]=l[u]||{},l[u][i]=a,this.logger_(`timinginfo: ${t} - ${i} - ${a}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():go(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const a=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),l={};t.forEach(u=>{l[u.stream]=l[u.stream]||{startTime:1/0,captions:[],endTime:0};const h=l[u.stream];h.startTime=Math.min(h.startTime,u.startTime+a),h.endTime=Math.max(h.endTime,u.endTime+a),h.captions.push(u)}),Object.keys(l).forEach(u=>{const{startTime:h,endTime:f,captions:g}=l[u],_=this.inbandTextTracks_;this.logger_(`adding cues from ${h} -> ${f} for ${u}`),vR(_,this.vhs_.tech_,u),Xc(h,f,_[u]),xR({captionArray:g,inbandTextTracks:_,timestampOffset:a})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!ay({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||ay({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_()){go(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[g_(t.type)].start;else{const a=this.getCurrentMediaInfo_(),l=this.loaderType_==="main"&&a&&a.hasVideo;let u;l&&(u=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:l,firstVideoFrameTimeForData:u,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const a=this.chooseNextRequest_();if(a.mediaIndex!==i.mediaIndex||a.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:a}){if(i){const l=Hf(i);if(this.activeInitSegmentId_===l)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=l}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=a,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},a){const l=this.sourceUpdater_.audioBuffered(),u=this.sourceUpdater_.videoBuffered();l.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+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,_=u.length?u.end(u.length-1):0;if(f-h<=Uc&&_-g<=Uc){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${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 C=this.currentTime_()-Uc;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${C}`),this.remove(0,C,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Uc}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=ue.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Uc*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},a){if(a){if(a.code===jS){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:Be.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=bR({bytes:f,segments:h})}const u={segmentInfo:al({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:u}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:l},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:l}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const a=this.pendingSegment_.segment,l=`${e}TimingInfo`;a[l]||(a[l]={}),a[l].transmuxerPrependedSeconds=i.prependedContentDuration||0,a[l].transmuxedPresentationStart=i.start.presentation,a[l].transmuxedDecodeStart=i.start.decode,a[l].transmuxedPresentationEnd=i.end.presentation,a[l].transmuxedDecodeEnd=i.end.decode,a[l].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:a}=t;if(!a||!a.byteLength||i==="audio"&&this.audioDisabled_)return;const l=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:l,data:a})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){go(this),this.loadQueue_.push(()=>{const t=Xi({},e,{forceTimestampOffset:!0});Xi(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),a=this.mediaIndex!==null,l=e.timeline!==this.currentTimeline_&&e.timeline>0,u=i||a&&l;this.logger_(`Requesting
|
||
${ik(e.uri)}
|
||
${Zl(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=fR({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:_,timingInfo:S})=>{const D={segmentInfo:al({segment:f})};g&&(D.keyInfo=g),_&&(D.trackInfo=_),S&&(D.timingInfo=S),this.trigger({type:h,metadata:D})}})}trimBackBuffer_(e){const t=OR(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<Jh){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Jh}`);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===Js.ABORTED)return;if(this.pause(),e.code===Js.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_=AR(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=RR(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),a=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;a&&(e.timingInfo.end=typeof a.end=="number"?a.end:a.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const f={segmentInfo:al({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:f})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=FR(e,this.sourceType_);if(t&&(t.severity==="warn"?Be.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<Jh){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Jh}`);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(!m_(i)||!m_(a))return;Xc(i,a,this.segmentMetadataTrack_);const l=ue.WebKitDataCue||ue.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 Aa(){}const rk=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},UR=["video","audio"],ly=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},zR=(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},gu=(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(),gu("audio",e),gu("video",e));return}if(n!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||ly(n,e))){if(i.type!==n){if(t=zR(n,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[n]=i,i.action(n,e),!i.doneFn){e.queuePending[n]=null,gu(n,e);return}}},sk=(n,e)=>{const t=e[`${n}Buffer`],i=rk(n);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[n]=null,e[`${n}Buffer`]=null)},Xs=(n,e)=>n&&e&&Array.prototype.indexOf.call(n.sourceBuffers,e)!==-1,is={appendBuffer:(n,e,t)=>(i,a)=>{const l=a[`${i}Buffer`];if(Xs(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===jS?"(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(Xs(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`];Xs(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){Be.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){Be.log.warn("Failed to set media source duration",t)}},abort:()=>(n,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${n}Buffer`];if(Xs(e.mediaSource,t)){e.logger_(`calling abort on ${n}Buffer`);try{t.abort()}catch(i){Be.log.warn(`Failed to abort on ${n}Buffer`,i)}}},addSourceBuffer:(n,e)=>t=>{const i=rk(n),a=_u(e);t.logger_(`Adding ${n}Buffer with codec ${e} to mediaSource`);const l=t.mediaSource.addSourceBuffer(a);l.addEventListener("updateend",t[`on${i}UpdateEnd_`]),l.addEventListener("error",t[`on${i}Error_`]),t.codecs[n]=e,t[`${n}Buffer`]=l},removeSourceBuffer:n=>e=>{const t=e[`${n}Buffer`];if(sk(n,e),!!Xs(e.mediaSource,t)){e.logger_(`Removing ${n}Buffer with codec ${e.codecs[n]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){Be.log.warn(`Failed to removeSourceBuffer ${n}Buffer`,i)}}},changeType:n=>(e,t)=>{const i=t[`${e}Buffer`],a=_u(n);if(!Xs(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=Be.Error.StreamingCodecsChangeError,f.error=g,g.metadata=f,t.error_=g,t.trigger("error"),Be.log.warn(`Failed to changeType on ${e}Buffer`,g)}}},rs=({type:n,sourceUpdater:e,action:t,doneFn:i,name:a})=>{e.queue.push({type:n,action:t,doneFn:i,name:a}),gu(n,e)},b_=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=ej(i);if(e.logger_(`received "updateend" event for ${n} Source Buffer: `,a),e.queuePending[n]){const l=e.queuePending[n].doneFn;e.queuePending[n]=null,l&&l(e[`${n}Error_`])}gu(n,e)};class ak extends Be.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gu("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=xs("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=b_("video",this),this.onAudioUpdateEnd_=b_("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){rs({type:"mediaSource",sourceUpdater:this,action:is.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){rs({type:e,sourceUpdater:this,action:is.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){Be.log.error("removeSourceBuffer is not supported!");return}rs({type:"mediaSource",sourceUpdater:this,action:is.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!Be.browser.IS_FIREFOX&&ue.MediaSource&&ue.MediaSource.prototype&&typeof ue.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return ue.SourceBuffer&&ue.SourceBuffer.prototype&&typeof ue.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){Be.log.error("changeType is not supported!");return}rs({type:e,sourceUpdater:this,action:is.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(rs({type:a,sourceUpdater:this,action:is.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 Xs(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ur()}videoBuffered(){return Xs(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ur()}buffered(){const e=Xs(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Xs(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():nj(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Aa){rs({type:"mediaSource",sourceUpdater:this,action:is.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Aa){typeof e!="string"&&(e=void 0),rs({type:"mediaSource",sourceUpdater:this,action:is.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Aa){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}rs({type:"audio",sourceUpdater:this,action:is.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Aa){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}rs({type:"video",sourceUpdater:this,action:is.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(ly("audio",this)||ly("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(rs({type:"audio",sourceUpdater:this,action:is.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(rs({type:"video",sourceUpdater:this,action:is.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&rs({type:"audio",sourceUpdater:this,action:is.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&rs({type:"video",sourceUpdater:this,action:is.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),UR.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>sk(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const v_=n=>decodeURIComponent(escape(String.fromCharCode.apply(null,n))),$R=n=>{const e=new Uint8Array(n);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},x_=new Uint8Array(`
|
||
|
||
`.split("").map(n=>n.charCodeAt(0)));class HR extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qR extends oy{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 ur();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return ur([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Hf(e);let a=this.initSegments_[i];if(t&&!a&&e.bytes){const l=x_.byteLength+e.bytes.byteLength,u=new Uint8Array(l);u.set(e.bytes),u.set(x_,e.bytes.byteLength),this.initSegments_[i]=a={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:u}}return a||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Xc(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Js.TIMEOUT&&this.handleTimeout_(),e.code===Js.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 ue.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:Be.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 ue.VTTCue(h.startTime,h.endTime,h.text):h)}),ER(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 ue.VTTCue(a,l,i.cueText);i.settings&&i.settings.split(" ").forEach(h=>{const f=h.split(":"),g=f[0],_=f[1];u[g]=isNaN(_)?_:Number(_)}),e.cues.push(u)})}parseVTTCues_(e){let t,i=!1;if(typeof ue.WebVTT!="function")throw new HR;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof ue.TextDecoder=="function"?t=new ue.TextDecoder("utf8"):(t=ue.WebVTT.StringDecoder(),i=!0);const a=new ue.WebVTT.Parser(ue,ue.vttjs,t);if(a.oncue=e.cues.push.bind(e.cues),a.ontimestampmap=u=>{e.timestampmap=u},a.onparsingerror=u=>{Be.log.warn("Error encountered when parsing cues: "+u.message)},e.segment.map){let u=e.segment.map.bytes;i&&(u=v_(u)),a.parse(u)}let l=e.bytes;i&&(l=v_(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 _=g.endTime-g.startTime,S=this.handleRollover_(g.startTime+f,t.time);g.startTime=Math.max(S,0),g.endTime=Math.max(S+_,0)}),!i.syncInfo){const g=e.cues[0].startTime,_=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(g,_-a.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*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 VR=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},GR=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=VR(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 ue.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 ue.VTTCue(i,i+u.duration,""),a.adStartTime=i-h,a.adEndTime=a.adStartTime+f,e.addCue(a)}i+=u.duration}};class __{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 KR{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 ok{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:a}=e;if(this.isReliable_=this.isReliablePlaylist_(i,a),!!this.isReliable_)return this.updateStorage_(a,i,this.calculateBaseTime_(i,a,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const a of i)if(a.isInRange(e))return a}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const a=new Map;let l=`
|
||
`,u=i,h=t;this.start_=u,e.forEach((f,g)=>{const _=this.storage_.get(h),S=u,C=S+f.duration,D=!!(_&&_.segmentSyncInfo&&_.segmentSyncInfo.isAppended),R=new __({start:S,end:C,appended:D,segmentIndex:g});f.syncInfo=R;let E=u;const B=(f.parts||[]).map((G,Y)=>{const q=E,se=E+G.duration,Q=!!(_&&_.partsSyncInfo&&_.partsSyncInfo[Y]&&_.partsSyncInfo[Y].isAppended),K=new __({start:q,end:se,appended:Q,segmentIndex:g,partIndex:Y});return E=se,l+=`Media Sequence: ${h}.${Y} | Range: ${q} --> ${se} | Appended: ${Q}
|
||
`,G.syncInfo=K,K});a.set(h,new KR(R,B)),l+=`${ik(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${C} | Appended: ${D}
|
||
`,h++,u=C}),this.end_=u,this.storage_=a,this.diagnostics_=l}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const a=Math.min(...this.storage_.keys());if(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 w_ extends ok{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 WR=86400,mg=[{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=Zg(e);a=a||0;for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),_=h[g],S=_.segment,C=n.timelineToDatetimeMappings[S.timeline];if(!C||!S.dateTimeObject)continue;let R=S.dateTimeObject.getTime()/1e3+C;if(S.parts&&typeof _.partIndex=="number")for(let B=0;B<_.partIndex;B++)R+=S.parts[B].duration;const E=Math.abs(a-R);if(u!==null&&(E===0||u<E))break;u=E,l={time:R,segmentIndex:_.segmentIndex,partIndex:_.partIndex}}return l}},{name:"Segment",run:(n,e,t,i,a)=>{let l=null,u=null;a=a||0;const h=Zg(e);for(let f=0;f<h.length;f++){const g=e.endList||a===0?f:h.length-(f+1),_=h[g],S=_.segment,C=_.part&&_.part.start||S&&S.start;if(S.timeline===i&&typeof C<"u"){const D=Math.abs(a-C);if(u!==null&&u<D)break;(!l||u===null||u>=D)&&(u=D,l={time:C,segmentIndex:_.segmentIndex,partIndex:_.partIndex})}}return l}},{name:"Discontinuity",run:(n,e,t,i,a)=>{let l=null;if(a=a||0,e.discontinuityStarts&&e.discontinuityStarts.length){let u=null;for(let h=0;h<e.discontinuityStarts.length;h++){const f=e.discontinuityStarts[h],g=e.discontinuitySequence+h+1,_=n.discontinuities[g];if(_){const S=Math.abs(a-_.time);if(u!==null&&u<S)break;(!l||u===null||u>=S)&&(u=S,l={time:_.time,segmentIndex:f,partIndex:null})}}}return l}},{name:"Playlist",run:(n,e,t,i,a)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class XR extends Be.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new ok,i=new w_(t),a=new w_(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:a},this.logger_=xs("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,a,l){if(t!==1/0)return mg.find(({name:f})=>f==="VOD").run(this,e,t);const u=this.runStrategies_(e,t,i,a,l);if(!u.length)return null;for(const h of u){const{syncPoint:f,strategy:g}=h,{segmentIndex:_,time:S}=f;if(_<0)continue;const C=e.segments[_],D=S,R=D+C.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${_}. Time: [${D} -> ${R}]}`),a>=D&&a<R)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+ad({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:a.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,a,l){const u=[];for(let h=0;h<mg.length;h++){const f=mg[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>WR){Be.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-ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:l}):g=i.end+ad({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:l}),this.discontinuities[u]={time:g,accuracy:f}}}}dispose(){this.trigger("dispose"),this.off()}}class YR extends Be.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 QR=GS(KS(function(){var n=(function(){function E(){this.listeners={}}var B=E.prototype;return B.on=function(Y,q){this.listeners[Y]||(this.listeners[Y]=[]),this.listeners[Y].push(q)},B.off=function(Y,q){if(!this.listeners[Y])return!1;var se=this.listeners[Y].indexOf(q);return this.listeners[Y]=this.listeners[Y].slice(0),this.listeners[Y].splice(se,1),se>-1},B.trigger=function(Y){var q=this.listeners[Y];if(q)if(arguments.length===2)for(var se=q.length,Q=0;Q<se;++Q)q[Q].call(this,arguments[1]);else for(var K=Array.prototype.slice.call(arguments,1),O=q.length,re=0;re<O;++re)q[re].apply(this,K)},B.dispose=function(){this.listeners={}},B.pipe=function(Y){this.on("data",function(q){Y.push(q)})},E})();function e(E){return E.subarray(0,E.byteLength-E[E.byteLength-1])}const t=function(){const E=[[[],[],[],[],[]],[[],[],[],[],[]]],B=E[0],G=E[1],Y=B[4],q=G[4];let se,Q,K;const O=[],re=[];let k,j,te,V,ne,he;for(se=0;se<256;se++)re[(O[se]=se<<1^(se>>7)*283)^se]=se;for(Q=K=0;!Y[Q];Q^=k||1,K=re[K]||1)for(V=K^K<<1^K<<2^K<<3^K<<4,V=V>>8^V&255^99,Y[Q]=V,q[V]=Q,te=O[j=O[k=O[Q]]],he=te*16843009^j*65537^k*257^Q*16843008,ne=O[V]*257^V*16843008,se=0;se<4;se++)B[se][Q]=ne=ne<<24^ne>>>8,G[se][V]=he=he<<24^he>>>8;for(se=0;se<5;se++)B[se]=B[se].slice(0),G[se]=G[se].slice(0);return E};let i=null;class a{constructor(B){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let G,Y,q;const se=this._tables[0][4],Q=this._tables[1],K=B.length;let O=1;if(K!==4&&K!==6&&K!==8)throw new Error("Invalid aes key size");const re=B.slice(0),k=[];for(this._key=[re,k],G=K;G<4*K+28;G++)q=re[G-1],(G%K===0||K===8&&G%K===4)&&(q=se[q>>>24]<<24^se[q>>16&255]<<16^se[q>>8&255]<<8^se[q&255],G%K===0&&(q=q<<8^q>>>24^O<<24,O=O<<1^(O>>7)*283)),re[G]=re[G-K]^q;for(Y=0;G;Y++,G--)q=re[Y&3?G:G-4],G<=4||Y<4?k[Y]=q:k[Y]=Q[0][se[q>>>24]]^Q[1][se[q>>16&255]]^Q[2][se[q>>8&255]]^Q[3][se[q&255]]}decrypt(B,G,Y,q,se,Q){const K=this._key[1];let O=B^K[0],re=q^K[1],k=Y^K[2],j=G^K[3],te,V,ne;const he=K.length/4-2;let ae,z=4;const P=this._tables[1],Z=P[0],ee=P[1],fe=P[2],I=P[3],pe=P[4];for(ae=0;ae<he;ae++)te=Z[O>>>24]^ee[re>>16&255]^fe[k>>8&255]^I[j&255]^K[z],V=Z[re>>>24]^ee[k>>16&255]^fe[j>>8&255]^I[O&255]^K[z+1],ne=Z[k>>>24]^ee[j>>16&255]^fe[O>>8&255]^I[re&255]^K[z+2],j=Z[j>>>24]^ee[O>>16&255]^fe[re>>8&255]^I[k&255]^K[z+3],z+=4,O=te,re=V,k=ne;for(ae=0;ae<4;ae++)se[(3&-ae)+Q]=pe[O>>>24]<<24^pe[re>>16&255]<<16^pe[k>>8&255]<<8^pe[j&255]^K[z++],te=O,O=re,re=k,k=j,j=te}}class l extends n{constructor(){super(n),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(B){this.jobs.push(B),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const u=function(E){return E<<24|(E&65280)<<8|(E&16711680)>>8|E>>>24},h=function(E,B,G){const Y=new Int32Array(E.buffer,E.byteOffset,E.byteLength>>2),q=new a(Array.prototype.slice.call(B)),se=new Uint8Array(E.byteLength),Q=new Int32Array(se.buffer);let K,O,re,k,j,te,V,ne,he;for(K=G[0],O=G[1],re=G[2],k=G[3],he=0;he<Y.length;he+=4)j=u(Y[he]),te=u(Y[he+1]),V=u(Y[he+2]),ne=u(Y[he+3]),q.decrypt(j,te,V,ne,Q,he),Q[he]=u(Q[he]^K),Q[he+1]=u(Q[he+1]^O),Q[he+2]=u(Q[he+2]^re),Q[he+3]=u(Q[he+3]^k),K=j,O=te,re=V,k=ne;return se};class f{constructor(B,G,Y,q){const se=f.STEP,Q=new Int32Array(B.buffer),K=new Uint8Array(B.byteLength);let O=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(Q.subarray(O,O+se),G,Y,K)),O=se;O<Q.length;O+=se)Y=new Uint32Array([u(Q[O-4]),u(Q[O-3]),u(Q[O-2]),u(Q[O-1])]),this.asyncStream_.push(this.decryptChunk_(Q.subarray(O,O+se),G,Y,K));this.asyncStream_.push(function(){q(null,e(K))})}static get STEP(){return 32e3}decryptChunk_(B,G,Y,q){return function(){const se=h(B,G,Y);q.set(se,B.byteOffset)}}}var g=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_;typeof window<"u"?_=window:typeof g<"u"?_=g:typeof self<"u"?_=self:_={};var S=_,C=function(B){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(B):B&&B.buffer instanceof ArrayBuffer},D=S.BigInt||Number;D("0x1"),D("0x100"),D("0x10000"),D("0x1000000"),D("0x100000000"),D("0x10000000000"),D("0x1000000000000"),D("0x100000000000000"),D("0x10000000000000000"),(function(){var E=new Uint16Array([65484]),B=new Uint8Array(E.buffer,E.byteOffset,E.byteLength);return B[0]===255?"big":B[0]===204?"little":"unknown"})();const R=function(E){const B={};return Object.keys(E).forEach(G=>{const Y=E[G];C(Y)?B[G]={bytes:Y.buffer,byteOffset:Y.byteOffset,byteLength:Y.byteLength}:B[G]=Y}),B};self.onmessage=function(E){const B=E.data,G=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),Y=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),q=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(G,Y,q,function(se,Q){self.postMessage(R({source:B.source,decrypted:Q}),[Q.buffer])})}}));var ZR=VS(QR);const JR=n=>{let e=n.default?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},lk=(n,e)=>{n.abort(),n.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},uy=(n,e)=>{e.activePlaylistLoader=n,n.load()},e8=(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,lk(t,a),!(!u||u.isMainPlaylist))){if(!u.playlistLoader){h&&i.resetEverything();return}t.resyncLoader(),uy(u.playlistLoader,a)}},t8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},n8=(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,lk(i,l),!!h)){if(h.isMainPlaylist){if(!u||!g||u.id===g.id)return;const _=e.vhs.playlistController_,S=_.selectPlaylist();if(_.media()===S)return;l.logger_(`track change. Switching main audio from ${g.id} to ${u.id}`),t.pause(),a.resetEverything(),_.fastQualityChange_(S);return}if(n==="AUDIO"){if(!h.playlistLoader){a.setAudio(!0),a.resetEverything();return}i.setAudio(!0),a.setAudio(!1)}if(f===h.playlistLoader){uy(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),uy(h.playlistLoader,l)}},qf={AUDIO:(n,e)=>()=>{const{mediaTypes:{[n]:t},excludePlaylist:i}=e,a=t.activeTrack(),l=t.activeGroup(),u=(l.filter(f=>f.default)[0]||l[0]).id,h=t.tracks[u];if(a===h){i({error:{message:"Problem encountered loading the default audio track."}});return}Be.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;Be.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},T_={AUDIO:(n,e,t)=>{if(!e)return;const{tech:i,requestOptions:a,segmentLoaders:{[n]:l}}=t;e.on("loadedmetadata",()=>{const u=e.media();l.playlist(u,a),(!i.paused()||u.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))},SUBTITLES:(n,e,t)=>{const{tech:i,requestOptions:a,segmentLoaders:{[n]:l},mediaTypes:{[n]:u}}=t;e.on("loadedmetadata",()=>{const h=e.media();l.playlist(h,a),l.track(u.activeTrack()),(!i.paused()||h.endList&&i.preload()!=="none")&&l.load()}),e.on("loadedplaylist",()=>{l.playlist(e.media(),a),i.paused()||l.load()}),e.on("error",qf[n](n,t))}},i8={AUDIO:(n,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[n]:a},requestOptions:l,main:{mediaGroups:u},mediaTypes:{[n]:{groups:h,tracks:f,logger_:g}},mainPlaylistLoader:_}=e,S=Ed(_.main);(!u[n]||Object.keys(u[n]).length===0)&&(u[n]={main:{default:{default:!0}}},S&&(u[n].main.default.playlists=_.main.playlists));for(const C in u[n]){h[C]||(h[C]=[]);for(const D in u[n][C]){let R=u[n][C][D],E;if(S?(g(`AUDIO group '${C}' label '${D}' is a main playlist`),R.isMainPlaylist=!0,E=null):i==="vhs-json"&&R.playlists?E=new su(R.playlists[0],t,l):R.resolvedUri?E=new su(R.resolvedUri,t,l):R.playlists&&i==="dash"?E=new ry(R.playlists[0],t,l,_):E=null,R=ri({id:D,playlistLoader:E},R),T_[n](n,R.playlistLoader,e),h[C].push(R),typeof f[D]>"u"){const B=new Be.AudioTrack({id:D,kind:JR(R),enabled:!1,language:R.language,default:R.default,label:D});f[D]=B}}}a.on("error",qf[n](n,e))},SUBTITLES:(n,e)=>{const{tech:t,vhs:i,sourceType:a,segmentLoaders:{[n]:l},requestOptions:u,main:{mediaGroups:h},mediaTypes:{[n]:{groups:f,tracks:g}},mainPlaylistLoader:_}=e;for(const S in h[n]){f[S]||(f[S]=[]);for(const C in h[n][S]){if(!i.options_.useForcedSubtitles&&h[n][S][C].forced)continue;let D=h[n][S][C],R;if(a==="hls")R=new su(D.resolvedUri,i,u);else if(a==="dash"){if(!D.playlists.filter(B=>B.excludeUntil!==1/0).length)return;R=new ry(D.playlists[0],i,u,_)}else a==="vhs-json"&&(R=new su(D.playlists?D.playlists[0]:D.resolvedUri,i,u));if(D=ri({id:C,playlistLoader:R},D),T_[n](n,D.playlistLoader,e),f[S].push(D),typeof g[C]>"u"){const E=t.addRemoteTextTrack({id:C,kind:"subtitles",default:D.default&&D.autoselect,language:D.language,label:C},!1).track;g[C]=E}}}l.on("error",qf[n](n,e))},"CLOSED-CAPTIONS":(n,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[n]:{groups:a,tracks:l}}}=e;for(const u in i[n]){a[u]||(a[u]=[]);for(const h in i[n][u]){const f=i[n][u][h];if(!/^(?:CC|SERVICE)/.test(f.instreamId))continue;const g=t.options_.vhs&&t.options_.vhs.captionServices||{};let _={label:h,language:f.language,instreamId:f.instreamId,default:f.default&&f.autoselect};if(g[_.instreamId]&&(_=ri(_,g[_.instreamId])),_.default===void 0&&delete _.default,a[u].push(ri({id:h},f)),typeof l[h]>"u"){const S=t.addRemoteTextTrack({id:_.instreamId,kind:"captions",default:_.default,language:_.language,label:_.label},!1).track;l[h]=S}}}}},uk=(n,e)=>{for(let t=0;t<n.length;t++)if(tb(e,n[t])||n[t].playlists&&uk(n[t].playlists,e))return!0;return!1},r8=(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&&Ed(e.main))for(let f=0;f<h.length;f++){const g=a[h[f]];if(uk(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},s8={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}},a8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},o8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{i8[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=r8(g,n),e[g].activeTrack=s8[g](g,n),e[g].onGroupChanged=e8(g,n),e[g].onGroupChanging=t8(g,n),e[g].onTrackChanged=n8(g,n),e[g].getActiveGroup=a8(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])},l8=()=>{const n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{n[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Aa,activeTrack:Aa,getActiveGroup:Aa,onGroupChanged:Aa,onTrackChanged:Aa,lastTrack_:null,logger_:xs(`MediaGroups[${e}]`)}}),n};class S_{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=zr(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class u8 extends Be.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new S_,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=xs("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=zr(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const a={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:a}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(l,u)=>{if(l){if(u.status===410){this.logger_(`manifest request 410 ${l}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(u.status===429){const g=u.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${l}.`),this.logger_(`content steering will retry in ${g} seconds.`),this.startTTLTimeout_(parseInt(g,10));return}this.logger_(`manifest failed to load ${l}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:a});let h;try{h=JSON.parse(this.request_.responseText)}catch(g){const _={errorType:Be.Error.StreamingContentSteeringParserError,error:g};this.trigger({type:"error",metadata:_})}this.assignSteeringProperties_(h);const f={contentSteeringInfo:a.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:f}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new ue.URL(e),i=new ue.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(ue.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new ue.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_=ue.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){ue.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 S_}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(zr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const c8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},d8=10;let yo;const h8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],f8=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},p8=function({currentPlaylist:n,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:a,bufferHighWaterLine:l,duration:u,bufferBasedABR:h,log:f}){if(!i)return Be.log.warn("We received no playlist to switch to. Please check your stream."),!1;const g=`allowing switch ${n&&n.id||"null"} -> ${i.id}`;if(!n)return f(`${g} as current playlist is not set`),!0;if(i.id===n.id)return!1;const _=!!ru(e,t).length;if(!n.endList)return!_&&typeof n.partTargetDuration=="number"?(f(`not ${g} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(f(`${g} as current playlist is live`),!0);const S=Zy(e,t),C=h?or.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:or.MAX_BUFFER_LOW_WATER_LINE;if(u<C)return f(`${g} as duration < max low water line (${u} < ${C})`),!0;const D=i.attributes.BANDWIDTH,R=n.attributes.BANDWIDTH;if(D<R&&(!h||S<l)){let E=`${g} as next bandwidth < current bandwidth (${D} < ${R})`;return h&&(E+=` and forwardBuffer < bufferHighWaterLine (${S} < ${l})`),f(E),!0}if((!h||D>R)&&S>=a){let E=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(E+=` and next bandwidth > current bandwidth (${D} > ${R})`),f(E),!0}return f(`not ${g} as no switching criteria met`),!1};class m8 extends Be.EventTarget{constructor(e){super(),this.fastQualityChange_=c8(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:a,bandwidth:l,externVhs:u,useCueTags:h,playlistExclusionDuration:f,enableLowInitialPlaylist:g,sourceType:_,cacheEncryptionKeys:S,bufferBasedABR:C,leastPixelDiffSelector:D,captionServices:R,experimentalUseMMS:E}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:B}=e;(B===null||typeof B>"u")&&(B=1/0),yo=u,this.bufferBasedABR=!!C,this.leastPixelDiffSelector=!!D,this.withCredentials=i,this.tech_=a,this.vhs_=a.vhs,this.player_=e.player_,this.sourceType_=_,this.useCueTags_=h,this.playlistExclusionDuration=f,this.maxPlaylistRetries=B,this.enableLowInitialPlaylist=g,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:B,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=l8(),E&&ue.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new ue.ManagedMediaSource,this.usingManagedMediaSource_=!0,Be.log("Using ManagedMediaSource")):ue.MediaSource&&(this.mediaSource=new ue.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_=ur(),this.hasPlayed_=!1,this.syncController_=new XR(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new ZR,this.sourceUpdater_=new ak(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new YR,this.keyStatusMap_=new Map;const G={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:R,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 ry(t,this.vhs_,ri(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new su(t,this.vhs_,ri(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new oy(ri(G,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new oy(ri(G,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new qR(ri(G,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((se,Q)=>{function K(){a.off("vttjserror",O),se()}function O(){a.off("vttjsloaded",K),Q()}a.one("vttjsloaded",K),a.one("vttjserror",O),a.addWebVttScript_()})}),e);const Y=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new u8(this.vhs_.xhr,Y),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),h8.forEach(se=>{this[se+"_"]=f8.bind(this,se)}),this.logger_=xs("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const q=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(q,()=>{const se=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-se,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_=ue.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(ue.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 _=e.playlists[g];_.attributes&&_.attributes.AUDIO&&_.attributes.AUDIO===h&&u.push(_)}}return u.length?u:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Jg(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()),o8({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;Jg(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(Xi({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let a=!0;const l=Object.keys(i.AUDIO);for(const u in i.AUDIO)for(const h in i.AUDIO[u])i.AUDIO[u][h].uri||(a=!1);a&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),yo.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 p8({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:d8}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.audioSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))}),this.subtitleSegmentLoader_.on(i,a=>{this.player_.trigger(Xi({},a))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<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=yo.Playlist.playlistEnd(e,i),l=this.tech_.currentTime(),u=this.tech_.buffered();if(!u.length)return a-l<=Zs;const h=u.end(u.length-1);return h-l<=Zs&&a-h<=Zs}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const a=this.mainPlaylistLoader_.main.playlists,l=a.filter(S0),u=l.length===1&&l[0]===e;if(a.length===1&&i!==1/0)return Be.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 R=this.pathwayAttribute_(e),E=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(R),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(R)},E);return}let D=!1;a.forEach(R=>{if(R===e)return;const E=R.excludeUntil;typeof E<"u"&&E!==1/0&&(D=!0,delete R.excludeUntil)}),D&&(Be.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_:Be.log.warn,_=t.message?" "+t.message:"";g(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${_} Switching to playlist ${f.id}.`),f.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),f.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const S=f.targetDuration/2*1e3||5*1e3,C=typeof f.lastRequest=="number"&&Date.now()-f.lastRequest<=S;return this.switchMedia_(f,"exclude",u||C)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],a=e==="all";(a||e==="main")&&i.push(this.mainPlaylistLoader_);const l=[];(a||e==="audio")&&l.push("AUDIO"),(a||e==="subtitle")&&(l.push("CLOSED-CAPTIONS"),l.push("SUBTITLES")),l.forEach(u=>{const h=this.mediaTypes_[u]&&this.mediaTypes_[u].activePlaylistLoader;h&&i.push(h)}),["main","audio","subtitle"].forEach(u=>{const h=this[`${u}SegmentLoader_`];h&&(e===u||e==="all")&&i.push(h)}),i.forEach(u=>t.forEach(h=>{typeof u[h]=="function"&&u[h]()}))}setCurrentTime(e){const t=ru(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:yo.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=yo.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),_=Math.max(h,f-g);return ur([[h,_]])}const l=this.syncController_.getExpiredTime(i,this.duration());if(l===null)return null;const u=yo.Playlist.seekable(i,l,yo.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:ur([[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 [${vS(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=yo.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=od(this.main(),t),a={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(a.video=i.video||e.main.videoCodec||iD),e.main.isMuxed&&(a.video+=`,${i.audio||e.main.audioCodec||f2}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||l)&&(a.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||f2,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!a.audio&&!a.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const u=(g,_)=>g?nd(_,this.usingManagedMediaSource_):Xm(_),h={};let f;if(["video","audio"].forEach(function(g){if(a.hasOwnProperty(g)&&!u(e[g].isFmp4,a[g])){const _=e[g].isFmp4?"browser":"muxer";h[_]=h[_]||[],h[_].push(a[g]),g==="audio"&&(f=_)}}),l&&f&&t.attributes.AUDIO){const g=t.attributes.AUDIO;this.main().playlists.forEach(_=>{(_.attributes&&_.attributes.AUDIO)===g&&_!==t&&(_.excludeUntil=1/0)}),this.logger_(`excluding audio group ${g} as ${f} does not support codec(s): "${a.audio}"`)}if(Object.keys(h).length){const g=Object.keys(h).reduce((_,S)=>(_&&(_+=", "),_+=`${S} does not support codec(s): "${h[S].join(",")}"`,_),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:g},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const g=[];if(["video","audio"].forEach(_=>{const S=(Ws(this.sourceUpdater_.codecs[_]||"")[0]||{}).type,C=(Ws(a[_]||"")[0]||{}).type;S&&C&&S.toLowerCase()!==C.toLowerCase()&&g.push(`"${this.sourceUpdater_.codecs[_]}" -> "${a[_]}"`)}),g.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${g.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return a}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const a=e[i];if(t.indexOf(a.id)!==-1)return;t.push(a.id);const l=od(this.main,a),u=[];l.audio&&!Xm(l.audio)&&!nd(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!Xm(l.video)&&!nd(l.video,this.usingManagedMediaSource_)&&u.push(`video codec ${l.video}`),l.text&&l.text==="stpp.ttml.im1t"&&u.push(`text codec ${l.text}`),u.length&&(a.excludeUntil=1/0,this.logger_(`excluding ${a.id} for unsupported: ${u.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,a=gd(Ws(e)),l=a_(a),u=a.video&&Ws(a.video)[0]||null,h=a.audio&&Ws(a.audio)[0]||null;Object.keys(i).forEach(f=>{const g=i[f];if(t.indexOf(g.id)!==-1||g.excludeUntil===1/0)return;t.push(g.id);const _=[],S=od(this.mainPlaylistLoader_.main,g),C=a_(S);if(!(!S.audio&&!S.video)){if(C!==l&&_.push(`codec count "${C}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const D=S.video&&Ws(S.video)[0]||null,R=S.audio&&Ws(S.audio)[0]||null;D&&u&&D.type.toLowerCase()!==u.type.toLowerCase()&&_.push(`video codec "${D.type}" !== "${u.type}"`),R&&h&&R.type.toLowerCase()!==h.type.toLowerCase()&&_.push(`audio codec "${R.type}" !== "${h.type}"`)}_.length&&(g.excludeUntil=1/0,this.logger_(`excluding ${g.id}: ${_.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),GR(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=or.GOAL_BUFFER_LENGTH,i=or.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,or.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=or.BUFFER_LOW_WATER_LINE,i=or.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,or.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,or.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return or.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){p_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),kR({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();p_(this.inbandTextTracks_,e,this.tech_),wR({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:a,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(Xi({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const l=this.contentSteeringController_.getAvailablePathways(),u=[];for(const h of t.playlists){const f=h.attributes.serviceLocation;if(f&&(u.push(f),!l.has(f)))return!0}return!!(!u.length&&l.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,a=new Set;let l=!1;Object.keys(i).forEach(u=>{const h=i[u],f=this.pathwayAttribute_(h),g=f&&e!==f;h.excludeUntil===1/0&&h.lastExcludeReason_==="content-steering"&&!g&&(delete h.excludeUntil,delete h.lastExcludeReason_,l=!0);const S=!h.excludeUntil&&h.excludeUntil!==1/0;!a.has(h.id)&&g&&S&&(a.add(h.id),h.excludeUntil=1/0,h.lastExcludeReason_="content-steering",this.logger_(`excluding ${h.id} for ${h.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(u=>{const h=this.mediaTypes_[u];if(h.activePlaylistLoader){const f=h.activePlaylistLoader.media_;f&&f.attributes.serviceLocation!==e&&(l=!0)}}),l&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,a=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||a&&a.size){for(const[u,h]of i.entries())a.get(u)||(this.mainPlaylistLoader_.updateOrDeleteClone(h),this.contentSteeringController_.excludePathway(u));for(const[u,h]of a.entries()){const f=i.get(u);if(!f){t.filter(_=>_.attributes["PATHWAY-ID"]===h["BASE-ID"]).forEach(_=>{this.mainPlaylistLoader_.addClonePathway(h,_)}),this.contentSteeringController_.addAvailablePathway(u);continue}this.equalPathwayClones_(f,h)||(this.mainPlaylistLoader_.updateOrDeleteClone(h,!0),this.contentSteeringController_.addAvailablePathway(u))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...a])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,a=t["URI-REPLACEMENT"].PARAMS;for(const l in i)if(i[l]!==a[l])return!1;for(const l in a)if(i[l]!==a[l])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=this.mainPlaylistLoader_.getKeyIdSet(i);!a||!a.size||a.forEach(l=>{const u="usable",h=this.keyStatusMap_.has(l)&&this.keyStatusMap_.get(l)===u,f=i.lastExcludeReason_===t&&i.excludeUntil===1/0;h?h&&f&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${l} is ${u}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${l} doesn't exist in the keyStatusMap or is not ${u}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const a=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,l=i.excludeUntil===1/0&&i.lastExcludeReason_===t;a&&l&&(delete i.excludeUntil,Be.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:$R(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 g8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=eb(a),u=S0(a);if(typeof i>"u")return u;i?delete a.disabled:a.disabled=!0;const h={renditionInfo:{id:e,bandwidth:a.attributes.BANDWIDTH,resolution:a.attributes.RESOLUTION,codecs:a.attributes.CODECS},cause:"fast-quality"};return i!==u&&!l&&(i?(t(a),n.trigger({type:"renditionenabled",metadata:h})):n.trigger({type:"renditiondisabled",metadata:h})),i};class y8{constructor(e,t,i){const{playlistController_:a}=e,l=a.fastQualityChange_.bind(a);if(t.attributes){const u=t.attributes.RESOLUTION;this.width=u&&u.width,this.height=u&&u.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=od(a.main(),t),this.playlist=t,this.id=i,this.enabled=g8(e.playlists,t.id,l)}}const b8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=Ed(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!eb(i)).map((i,a)=>new y8(n,i,i.id)):[]}},k_=["seeking","seeked","pause","playing","error"];class v8 extends Be.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=xs("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),a=()=>this.techWaiting_(),l=()=>this.resetTimeUpdate_(),u=this.playlistController_,h=["main","subtitle","audio"],f={};h.forEach(_=>{f[_]={reset:()=>this.resetSegmentDownloads_(_),updateend:()=>this.checkSegmentDownloads_(_)},u[`${_}SegmentLoader_`].on("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].on("playlistupdate",f[_].reset),this.tech_.on(["seeked","seeking"],f[_].reset)});const g=_=>{["main","audio"].forEach(S=>{u[`${S}SegmentLoader_`][_]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),g("off"))},this.clearSeekingAppendCheck_=()=>g("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),g("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",a),this.tech_.on(k_,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(k_,l),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),h.forEach(_=>{u[`${_}SegmentLoader_`].off("appendsdone",f[_].updateend),u[`${_}SegmentLoader_`].off("playlistupdate",f[_].reset),this.tech_.off(["seeked","seeking"],f[_].reset)}),this.checkCurrentTimeTimeout_&&ue.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&ue.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=ue.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=rj(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+Zs>=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(ur([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 R=t.start(0);l=R+(R===t.end(0)?0:Zs)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${vS(t)}. Seeking to ${l}.`),this.tech_.setCurrentTime(l),!0;const u=this.playlistController_.sourceUpdater_,h=this.tech_.buffered(),f=u.audioBuffer?u.audioBuffered():null,g=u.videoBuffer?u.videoBuffered():null,_=this.media(),S=_.partTargetDuration?_.partTargetDuration:(_.targetDuration-Qs)*2,C=[f,g];for(let R=0;R<C.length;R++){if(!C[R])continue;if(Zy(C[R],i)<S)return!1}const D=Qh(h,i);return D.length===0?!1:(l=D.start(0)+Zs,this.logger_(`Buffered region starts (${D.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=ru(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=Qh(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)+Zs;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=ru(e,i-3),u=ru(e,i),h=ru(t,i);h.length&&!u.length&&l.length&&(a={start:l.end(0),end:h.end(0)})}else Qh(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=Qh(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)+Qs);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=tj(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 x8={errorInterval:30,getSource(n){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return n(t)}},ck=function(n,e){let t=0,i=0;const a=ri(x8,e);n.ready(()=>{n.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const l=function(){i&&n.currentTime(i)},u=function(_){_!=null&&(i=n.duration()!==1/0&&n.currentTime()||0,n.one("loadedmetadata",l),n.src(_),n.trigger({type:"usage",name:"vhs-error-reload"}),n.play())},h=function(){if(Date.now()-t<a.errorInterval*1e3){n.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!a.getSource||typeof a.getSource!="function"){Be.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(_){f(),ck(n,_)};n.on("error",h),n.on("dispose",f),n.reloadSourceOnError=g},_8=function(n){ck(this,n)};var dk="3.17.2",w8="7.1.0",T8="1.3.1",S8="7.2.0",k8="4.0.2";const Ii={PlaylistLoader:su,Playlist:Hr,utils:Dj,STANDARD_PLAYLIST_SELECTOR:f_,INITIAL_PLAYLIST_SELECTOR:yR,lastBandwidthSelector:f_,movingAverageBandwidthSelector:mR,comparePlaylistBandwidth:ib,comparePlaylistResolution:pR,xhr:PS()};Object.keys(or).forEach(n=>{Object.defineProperty(Ii,n,{get(){return Be.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),or[n]},set(e){if(Be.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){Be.log.warn(`value of Vhs.${n} must be greater than or equal to 0`);return}or[n]=e}})});const hk="videojs-vhs",fk=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"})},E8=function(n,e){e.representations().forEach(t=>{n.addQualityLevel(t)}),fk(n,e.playlists)};Ii.canPlaySource=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const C8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=gd(Ws(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const a=_u(i.video),l=_u(i.audio),u={};for(const h in n)u[h]={},l&&(u[h].audioContentType=l),a&&(u[h].videoContentType=a),e.contentProtection&&e.contentProtection[h]&&e.contentProtection[h].pssh&&(u[h].pssh=e.contentProtection[h].pssh),typeof n[h]=="string"&&(u[h].url=n[h]);return ri(n,u)},A8=(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},[]),N8=({player:n,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!n.eme.initializeMediaKeys)return Promise.resolve();const a=t?i.concat([t]):i,l=A8(a,Object.keys(e)),u=[],h=[];return l.forEach(f=>{h.push(new Promise((g,_)=>{n.tech_.one("keysessioncreated",g)})),u.push(new Promise((g,_)=>{n.eme.initializeMediaKeys({keySystems:f},S=>{if(S){_(S);return}g()})}))}),Promise.race([Promise.all(u),Promise.race(h)])},D8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=C8(e,t,i);return a?(n.currentSource().keySystems=a,a&&!n.eme?(Be.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},pk=()=>{if(!ue.localStorage)return null;const n=ue.localStorage.getItem(hk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},M8=n=>{if(!ue.localStorage)return!1;let e=pk();e=e?ri(e,n):n;try{ue.localStorage.setItem(hk,JSON.stringify(e))}catch{return!1}return e},j8=n=>n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n,mk=(n,e)=>{n._requestCallbackSet||(n._requestCallbackSet=new Set),n._requestCallbackSet.add(e)},gk=(n,e)=>{n._responseCallbackSet||(n._responseCallbackSet=new Set),n._responseCallbackSet.add(e)},yk=(n,e)=>{n._requestCallbackSet&&(n._requestCallbackSet.delete(e),n._requestCallbackSet.size||delete n._requestCallbackSet)},bk=(n,e)=>{n._responseCallbackSet&&(n._responseCallbackSet.delete(e),n._responseCallbackSet.size||delete n._responseCallbackSet)};Ii.supportsNativeHls=(function(){if(!_t||!_t.createElement)return!1;const n=_t.createElement("video");return Be.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})();Ii.supportsNativeDash=(function(){return!_t||!_t.createElement||!Be.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(_t.createElement("video").canPlayType("application/dash+xml"))})();Ii.supportsTypeNatively=n=>n==="hls"?Ii.supportsNativeHls:n==="dash"?Ii.supportsNativeDash:!1;Ii.isSupported=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ii.xhr.onRequest=function(n){mk(Ii.xhr,n)};Ii.xhr.onResponse=function(n){gk(Ii.xhr,n)};Ii.xhr.offRequest=function(n){yk(Ii.xhr,n)};Ii.xhr.offResponse=function(n){bk(Ii.xhr,n)};const R8=Be.getComponent("Component");class vk extends R8{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=xs("VhsHandler"),t.options_&&t.options_.playerId){const a=Be.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(_t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],a=>{const l=_t.fullscreenElement||_t.webkitFullscreenElement||_t.mozFullScreenElement||_t.msFullscreenElement;l&&l.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=ri(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=pk();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=or.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===or.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=j8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ii,this.options_.sourceType=Uw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new m8(this.options_);const i=ri({liveRangeSafeTimeDelta:Zs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new v8(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const l=Be.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?Ii.movingAverageBandwidthSelector(.55):Ii.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Ii.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=ue.navigator.connection||ue.navigator.mozConnection||ue.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(){Be.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&&M8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{b8(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_=ue.URL.createObjectURL(this.playlistController_.mediaSource),(Be.browser.IS_ANY_SAFARI||Be.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"),N8({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=D8({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=Be.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{E8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{fk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":dk,"mux.js":w8,"mpd-parser":T8,"m3u8-parser":S8,"aes-decrypter":k8}}version(){return this.constructor.version()}canChangeType(){return ak.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_&&ue.URL.revokeObjectURL&&(ue.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Bj({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return HS({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=>{mk(this.xhr,e)},this.xhr.onResponse=e=>{gk(this.xhr,e)},this.xhr.offRequest=e=>{yk(this.xhr,e)},this.xhr.offResponse=e=>{bk(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,a=>{this.player_.trigger(Xi({},a))})}),t.forEach(i=>{this.playbackWatcher_.on(i,a=>{this.player_.trigger(Xi({},a))})})}}const Vf={name:"videojs-http-streaming",VERSION:dk,canHandleSource(n,e={}){const t=ri(Be.options,e);return!t.vhs.experimentalUseMMS&&!nd("avc1.4d400d,mp4a.40.2",!1)?!1:Vf.canPlayType(n.type,t)},handleSource(n,e,t={}){const i=ri(Be.options,t);return e.vhs=new vk(n,e,i),e.vhs.xhr=PS(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=Uw(n);if(!t)return"";const i=Vf.getOverrideNative(e);return!Ii.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(n={}){const{vhs:e={}}=n,t=!(Be.browser.IS_ANY_SAFARI||Be.browser.IS_IOS),{overrideNative:i=t}=e;return i}},O8=()=>nd("avc1.4d400d,mp4a.40.2",!0);O8()&&Be.getTech("Html5").registerSourceHandler(Vf,0);Be.VhsHandler=vk;Be.VhsSourceHandler=Vf;Be.Vhs=Ii;Be.use||Be.registerComponent("Vhs",Ii);Be.options.vhs=Be.options.vhs||{};(!Be.getPlugin||!Be.getPlugin("reloadSourceOnError"))&&Be.registerPlugin("reloadSourceOnError",_8);const L8="",rl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${L8}${e}`};async function gg(n,e){const t=await fetch(rl(n),{...e,credentials:"include",headers:{...e?.headers??{},"Content-Type":e?.headers?.["Content-Type"]??"application/json"}});return t.status===401&&(location.pathname.startsWith("/login")||(location.href="/login")),t}function rb({src:n,muted:e=Sf,className:t}){const i=m.useRef(null),[a,l]=m.useState(!1),[u,h]=m.useState(null);return m.useEffect(()=>{let f=!1,g=null;const _=i.current;if(!_)return;l(!1),h(null),ud(_,{muted:e});const S=()=>{try{_.pause(),_.removeAttribute("src"),_.load()}catch{}};S(),_.src=n,_.load(),_.play().catch(()=>{});let C=Date.now();const D=()=>{C=Date.now()};_.addEventListener("timeupdate",D),g=window.setInterval(()=>{f||!_.paused&&Date.now()-C>12e3&&(S(),_.src=n,_.load(),_.play().catch(()=>{}),C=Date.now())},4e3);const R=()=>{l(!0)};return _.addEventListener("error",R),()=>{f=!0,g&&window.clearInterval(g),g=null,_.removeEventListener("timeupdate",D),_.removeEventListener("error",R),S()}},[n,e]),a?c.jsx("div",{className:"text-xs text-gray-400 italic",children:u==="private"?"Private":u==="offline"?"Offline":"–"}):c.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const f=i.current;f&&(f.muted=!1,f.play().catch(()=>{}))}})}const ps=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",sb=n=>n.startsWith("HOT ")?n.slice(4):n,I8=n=>(n||"").trim().toLowerCase(),B8=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 P8(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 F8(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 E_(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 ef=(...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 U8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function z8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function $8(n){const e=ps(n||""),t=sb(e);if(!t)return null;const a=t.replace(/\.[^.]+$/,"").match(/_(\d{1,2})_(\d{1,2})_(\d{4})__(\d{1,2})-(\d{2})-(\d{2})$/);if(!a)return null;const l=Number(a[1]),u=Number(a[2]),h=Number(a[3]),f=Number(a[4]),g=Number(a[5]),_=Number(a[6]);return[l,u,h,f,g,_].every(S=>Number.isFinite(S))?new Date(h,l-1,u,f,g,_):null}const H8=n=>{const e=ps(n||""),t=sb(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},q8=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 Ta(...n){return n.filter(Boolean).join(" ")}function V8(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 G8(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 K8({job:n,expanded:e,onClose:t,onToggleExpand:i,modelKey:a,modelsByKey:l,isHot:u=!1,isFavorite:h=!1,isLiked:f=!1,isWatching:g=!1,onKeep:_,onDelete:S,onToggleHot:C,onToggleFavorite:D,onToggleLike:R,onToggleWatch:E,onStopJob:B,startMuted:G=HN,startAtSec:Y=0}){const q=m.useMemo(()=>ps(n.output?.trim()||"")||n.id,[n.output,n.id]),se=m.useMemo(()=>ps(n.output?.trim()||""),[n.output]),Q=m.useMemo(()=>ps(n.output?.trim()||""),[n.output]),K=m.useMemo(()=>F8(q8(n)),[n]),O=n,[re,k]=m.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[j,te]=m.useState(()=>n.status==="running"),[V,ne]=m.useState(()=>({h:0,fps:null})),he=n.status==="running",[ae,z]=m.useState(!1),P=he&&ae,Z=m.useMemo(()=>(Q||"").replace(/\.[^.]+$/,""),[Q]),ee=m.useMemo(()=>he?n.id:Z||n.id,[he,n.id,Z]);m.useEffect(()=>{if(he||re>0)return;const L=ps(n.output?.trim()||"");if(!L)return;let $=!0;const xe=new AbortController;return(async()=>{try{const Te=rl(`/api/record/done/meta?file=${encodeURIComponent(L)}`),Ve=await gg(Te,{signal:xe.signal,cache:"no-store"});if(!Ve.ok)return;const qe=await Ve.json(),U=Number(qe?.durationSeconds||qe?.meta?.durationSeconds||0)||0;if(!$||U<=0)return;k(U);const W=et.current;if(W&&!W.isDisposed?.())try{W.__fullDurationSec=U,W.trigger?.("durationchange"),W.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{$=!1,xe.abort()}},[he,re,n.output]);const fe=se.startsWith("HOT "),I=m.useMemo(()=>{const L=(a||"").trim();return L||H8(n.output)},[a,n.output]),pe=m.useMemo(()=>sb(se),[se]),ke=m.useMemo(()=>{const L=Number(re||0)||0;return L>0?P8(L*1e3):"—"},[re]),ye=m.useMemo(()=>{const L=$8(n.output);if(L)return E_(L);const $=O.startedAt??O.endedAt??O.createdAt??O.fileCreatedAt??O.ctime??null,xe=$?new Date($):null;return E_(xe&&Number.isFinite(xe.getTime())?xe:null)},[n.output,O.startedAt,O.endedAt,O.createdAt,O.fileCreatedAt,O.ctime]),me=m.useMemo(()=>I8((a||I||"").trim()),[a,I]),pt=m.useMemo(()=>{const L=l?.[me];return B8(L?.tags)},[l,me]),We=m.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(ee)}&file=preview.webp`),[ee]),_e=m.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(ee)}&play=1&file=index_hq.m3u8`),[ee]),[Ye,wt]=m.useState(We);m.useEffect(()=>{wt(We)},[We]);const je=m.useMemo(()=>ef(V.h,O.videoHeight,O.height,O.meta?.height),[V.h,O.videoHeight,O.height,O.meta?.height]),Se=m.useMemo(()=>ef(V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate),[V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate]),[Je,tt]=m.useState(null),ot=m.useMemo(()=>z8(Je??je),[Je,je]),dt=m.useMemo(()=>U8(Se),[Se]);m.useEffect(()=>{const L=$=>$.key==="Escape"&&t();return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t]);const Ut=m.useMemo(()=>{const L=`/api/preview?id=${encodeURIComponent(ee)}&file=index_hq.m3u8&play=1`;return rl(he?`${L}&t=${Date.now()}`:L)},[ee,he]);m.useEffect(()=>{if(!he){z(!1);return}let L=!0;const $=new AbortController;return z(!1),(async()=>{for(let Te=0;Te<120&&L&&!$.signal.aborted;Te++){try{const Ve=await gg(Ut,{method:"GET",cache:"no-store",signal:$.signal,headers:{"cache-control":"no-cache"}});if(Ve.ok){const qe=await Ve.text(),U=qe.includes("#EXTM3U"),W=/#EXTINF:/i.test(qe)||/\.ts(\?|$)/i.test(qe)||/\.m4s(\?|$)/i.test(qe);if(U&&W){L&&z(!0);return}}}catch{}await new Promise(Ve=>setTimeout(Ve,500))}})(),()=>{L=!1,$.abort()}},[he,Ut]);const Ge=m.useCallback(L=>{const $=new URLSearchParams;return L.file&&$.set("file",L.file),L.id&&$.set("id",L.id),rl(`/api/record/video?${$.toString()}`)},[]),Ie=m.useMemo(()=>{if(he)return{src:"",type:""};if(!j)return{src:"",type:""};const L=ps(n.output?.trim()||"");if(L){const $=L.toLowerCase().split(".").pop(),xe=$==="mp4"?"video/mp4":$==="ts"?"video/mp2t":"application/octet-stream";return{src:Ge({file:L}),type:xe}}return{src:Ge({id:n.id}),type:"video/mp4"}},[he,j,n.output,n.id,Ge]),Ze=m.useRef(null),et=m.useRef(null),ft=m.useRef(null),[mt,de]=m.useState(!1),ze=m.useCallback(()=>{const L=et.current;if(!L||L.isDisposed?.())return;const $=typeof L.videoHeight=="function"?L.videoHeight():0;typeof $=="number"&&$>0&&Number.isFinite($)&&tt($)},[]),Le=m.useCallback(()=>{try{const L=et.current?.tech?.(!0)?.el?.()||et.current?.el?.()?.querySelector?.("video.vjs-tech")||ft.current;if(!L||!(L instanceof HTMLVideoElement))return null;const $=Number(L.videoWidth||0),xe=Number(L.videoHeight||0);if(!Number.isFinite($)||!Number.isFinite(xe)||$<=0||xe<=0)return null;let Te=Mn.current;Te||(Te=document.createElement("canvas"),Mn.current=Te);const qe=Math.min(1,640/$),U=Math.max(1,Math.round($*qe)),W=Math.max(1,Math.round(xe*qe));Te.width!==U&&(Te.width=U),Te.height!==W&&(Te.height=W);const le=Te.getContext("2d",{alpha:!1});return le?(le.drawImage(L,0,0,U,W),Te.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),Ae=m.useMemo(()=>ps(n.output?.trim()||"")||n.id,[n.output,n.id]),Pe=m.useMemo(()=>{const L=Number(Y);return Number.isFinite(L)&&L>=0?L:0},[Y]),Qe=m.useRef("");m.useEffect(()=>{if(he){te(!0);return}const L=ps(n.output?.trim()||"");if(!L){te(!0);return}let $=!0;const xe=new AbortController;return te(!1),(async()=>{for(let Te=0;Te<80&&$&&!xe.signal.aborted;Te++){try{const Ve=rl(`/api/record/done/meta?file=${encodeURIComponent(L)}`),qe=await gg(Ve,{signal:xe.signal,cache:"no-store"});if(qe.ok){const U=await qe.json(),W=!!U?.metaExists,le=Number(U?.durationSeconds||0)||0,be=Number(U?.height||0)||0,Ce=Number(U?.fps||0)||0;if(le>0){k(le);const Oe=et.current;if(Oe&&!Oe.isDisposed?.())try{Oe.__fullDurationSec=le,Oe.trigger?.("durationchange"),Oe.trigger?.("timeupdate")}catch{}}if(be>0&&ne({h:be,fps:Ce>0?Ce:null}),W){te(!0);return}}}catch{}await new Promise(Ve=>setTimeout(Ve,250))}$&&te(!0)})(),()=>{$=!1,xe.abort()}},[he,Ae,n.output]);const[,St]=m.useState(0);m.useEffect(()=>{if(typeof window>"u")return;const L=window.visualViewport;if(!L)return;const $=()=>St(xe=>xe+1);return $(),L.addEventListener("resize",$),L.addEventListener("scroll",$),window.addEventListener("resize",$),window.addEventListener("orientationchange",$),()=>{L.removeEventListener("resize",$),L.removeEventListener("scroll",$),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$)}},[]);const[Ot,Tt]=m.useState(30),[an,Nt]=m.useState(null),Lt=!e,vt=V8("(min-width: 640px)"),It=Lt&&vt,yn=e||It,$n="player_window_v1",kt=420,Bn=280,at=12,N=320,F=200;m.useEffect(()=>{if(!mt)return;const L=et.current;if(!L||L.isDisposed?.())return;const $=L.el();if(!$)return;const xe=$.querySelector(".vjs-control-bar");if(!xe)return;const Te=()=>{const qe=Math.round(xe.getBoundingClientRect().height||0);qe>0&&Tt(qe)};Te();let Ve=null;return typeof ResizeObserver<"u"&&(Ve=new ResizeObserver(Te),Ve.observe(xe)),window.addEventListener("resize",Te),()=>{window.removeEventListener("resize",Te),Ve?.disconnect()}},[mt,e]),m.useEffect(()=>de(!0),[]),m.useEffect(()=>{if(!yn){Nt(null);return}let L=document.getElementById("player-root");L||(L=document.createElement("div"),L.id="player-root");let $=null;if(vt){const xe=Array.from(document.querySelectorAll("dialog[open]"));$=xe.length?xe[xe.length-1]:null}$=$??document.body,$.appendChild(L),L.style.position="relative",L.style.zIndex="2147483647",Nt(L)},[vt,yn]),m.useEffect(()=>{const L=et.current;if(!L||L.isDisposed?.()||he||(G8(L),!ps(n.output?.trim()||"")))return;const xe=Number(re||0)||0;return xe>0&&(L.__fullDurationSec=xe),L.__serverSeekAbs=Te=>{const Ve=Math.max(0,Number(Te)||0);try{L.__origCurrentTime?.(Ve);try{L.trigger?.("timeupdate")}catch{}}catch{try{L.currentTime?.(Ve)}catch{}}},()=>{try{delete L.__serverSeekAbs}catch{}}},[n.output,he]),m.useLayoutEffect(()=>{if(!mt||!Ze.current||et.current||he||!j)return;const L=document.createElement("video");L.className="video-js vjs-big-play-centered w-full h-full",L.setAttribute("playsinline","true"),Ze.current.appendChild(L),ft.current=L;const $=Be(L,{autoplay:!0,muted:G,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=$,$.one("loadedmetadata",()=>{ze()}),$.userActive(!0),$.on("userinactive",()=>$.userActive(!0)),()=>{try{et.current&&(et.current.dispose(),et.current=null)}finally{ft.current&&(ft.current.remove(),ft.current=null)}}},[mt,G,he,j,je,ze]),m.useEffect(()=>{const L=et.current;if(!L||L.isDisposed?.())return;const $=L.el();$&&$.classList.toggle("is-live-download",!!P)},[P]);const ie=m.useCallback(()=>{const L=et.current;if(!(!L||L.isDisposed?.())){try{L.pause(),L.reset?.()}catch{}try{L.src({src:"",type:"video/mp4"}),L.load?.()}catch{}}},[]),Me=m.useCallback(L=>{const $=et.current;if(!$||$.isDisposed?.())return;const xe=Math.max(0,Number(L)||0);try{const Te=Number($.duration?.()??0),Ve=Number.isFinite(Te)&&Te>0?Math.max(0,Te-.05):xe;$.currentTime(Math.min(xe,Ve)),$.trigger?.("timeupdate")}catch{try{$.currentTime(xe)}catch{}}},[]);m.useEffect(()=>{if(!mt)return;if(!he&&!j){ie();return}const L=et.current;if(!L||L.isDisposed?.())return;const $=L.currentTime()||0;if(L.muted(G),!Ie.src){try{L.pause(),L.reset?.(),L.error(null)}catch{}return}L.__timeOffsetSec=0;const xe=Number(re||0)||0;L.__fullDurationSec=xe;const Te=String(L.currentSrc?.()||"");if(Qe.current="",Te&&Te===Ie.src){const qe=L.play?.();qe&&typeof qe.catch=="function"&&qe.catch(()=>{});return}L.src({src:Ie.src,type:Ie.type});const Ve=()=>{const qe=L.play?.();qe&&typeof qe.catch=="function"&&qe.catch(()=>{})};L.one("loadedmetadata",()=>{if(L.isDisposed?.())return;ze();try{const U=Number(re||0)||0;U>0&&(L.__fullDurationSec=U)}catch{}try{L.playbackRate(1)}catch{}const qe=/mpegurl/i.test(Ie.type);if($>0&&!qe)try{const U=Number(L.__timeOffsetSec??0)||0,W=Math.max(0,$-U);L.__setRelativeTime?.(W)}catch{}try{L.trigger?.("timeupdate")}catch{}Ve()}),Ve()},[mt,he,j,Ie.src,Ie.type,G,ze,re,ie]),m.useEffect(()=>{if(!mt||he||!j||!Ie.src)return;const L=et.current;if(!L||L.isDisposed?.())return;if(!(Pe>0)){Qe.current="";return}const $=`${Ae}|${Ie.src}|${Pe.toFixed(3)}`;if(Qe.current===$)return;let xe=!1;const Te=()=>{if(xe)return;const W=et.current;if(!W||W.isDisposed?.())return;const le=String(W.currentSrc?.()||"");if(!le||le!==Ie.src)return;const be=W.tech?.(!0)?.el?.()||W.el?.()?.querySelector?.("video.vjs-tech");if(!((be instanceof HTMLVideoElement?Number(be.readyState||0):0)<1)){Me(Pe),Qe.current=$;try{const Oe=W.play?.();Oe&&typeof Oe.catch=="function"&&Oe.catch(()=>{})}catch{}}};if(Te(),Qe.current===$)return;const Ve=()=>Te();L.one?.("loadedmetadata",Ve),L.one?.("canplay",Ve),L.one?.("durationchange",Ve);const qe=window.setTimeout(Te,0),U=window.setTimeout(Te,120);return()=>{xe=!0,window.clearTimeout(qe),window.clearTimeout(U);try{L.off?.("loadedmetadata",Ve)}catch{}try{L.off?.("canplay",Ve)}catch{}try{L.off?.("durationchange",Ve)}catch{}}},[mt,he,j,Ie.src,Ae,Pe,Me]),m.useEffect(()=>{if(!mt)return;const L=et.current;if(!L||L.isDisposed?.())return;const $=()=>{n.status==="running"&&z(!1)};return L.on("error",$),()=>{try{L.off("error",$)}catch{}}},[mt,n.status]),m.useEffect(()=>{const L=et.current;!L||L.isDisposed?.()||queueMicrotask(()=>L.trigger("resize"))},[e]),m.useEffect(()=>{const L=$=>{const Te=($.detail?.file??"").trim();if(!Te)return;const Ve=ps(n.output?.trim()||"");Ve&&Ve===Te&&ie()};return window.addEventListener("player:release",L),()=>window.removeEventListener("player:release",L)},[n.output,ie]),m.useEffect(()=>{const L=$=>{const Te=($.detail?.file??"").trim();if(!Te)return;const Ve=ps(n.output?.trim()||"");Ve&&Ve===Te&&(ie(),t())};return window.addEventListener("player:close",L),()=>window.removeEventListener("player:close",L)},[n.output,ie,t]);const He=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const L=window.visualViewport;if(L&&Number.isFinite(L.width)&&Number.isFinite(L.height)){const Ve=Math.floor(L.width),qe=Math.floor(L.height),U=Math.floor(L.offsetLeft||0),W=Math.floor(L.offsetTop||0),le=Math.max(0,Math.floor(window.innerHeight-(L.height+L.offsetTop)));return{w:Ve,h:qe,ox:U,oy:W,bottomInset:le}}const $=document.documentElement,xe=$?.clientWidth||window.innerWidth,Te=$?.clientHeight||window.innerHeight;return{w:xe,h:Te,ox:0,oy:0,bottomInset:0}},gt=m.useRef(null);m.useEffect(()=>{if(typeof window>"u")return;const{w:L,h:$}=He();gt.current={w:L,h:$}},[]);const zt=m.useCallback(()=>{const L=n,$=ef(et.current?.videoWidth?.(),L.videoWidth,L.width,L.meta?.width)??0,xe=ef(Je,et.current?.videoHeight?.(),L.videoHeight,L.height,L.meta?.height)??0;return $>0&&xe>0?$/xe:16/9},[n,Je]),Jt=m.useCallback(L=>{if(typeof window>"u")return L;const $=zt(),xe=30,{w:Te,h:Ve}=He(),qe=Te-at*2,U=Math.max(1,Ve-at*2-xe),W=Math.max(1,F-xe);let le=Math.max(N,Math.min(L.w,qe)),be=le/$;be<W&&(be=W,le=be*$),be>U&&(be=U,le=be*$),le>qe&&(le=qe,be=le/$);const Ce=Math.round(be+xe),Oe=Math.max(at,Math.min(L.x,Te-le-at)),ht=Math.max(at,Math.min(L.y,Ve-Ce-at));return{x:Oe,y:ht,w:Math.round(le),h:Ce}},[zt]),un=m.useCallback(()=>{if(typeof window>"u")return{x:at,y:at,w:kt,h:Bn};try{const U=window.localStorage.getItem($n);if(U){const W=JSON.parse(U);if(typeof W.x=="number"&&typeof W.y=="number"&&typeof W.w=="number"&&typeof W.h=="number")return Jt({x:W.x,y:W.y,w:W.w,h:W.h})}}catch{}const{w:L,h:$}=He(),xe=kt,Te=Bn,Ve=Math.max(at,L-xe-at),qe=Math.max(at,$-Te-at);return Jt({x:Ve,y:qe,w:xe,h:Te})},[Jt]),[Xt,pn]=m.useState(()=>un()),fn=It&&Xt.w<380,Kt=m.useCallback(L=>{if(!(typeof window>"u"))try{window.localStorage.setItem($n,JSON.stringify(L))}catch{}},[]),cn=m.useRef(Xt);m.useEffect(()=>{cn.current=Xt},[Xt]),m.useEffect(()=>{It&&pn(un())},[It,un]),m.useEffect(()=>{if(!It)return;const L=()=>{const $=gt.current,{w:xe,h:Te}=He();pn(Ve=>{if(!$)return Jt(Ve);const qe=24,U=Ve.x-at,W=$.w-at-(Ve.x+Ve.w),le=$.h-at-(Ve.y+Ve.h),be=Math.abs(U)<=qe,Ce=Math.abs(W)<=qe,Oe=Math.abs(le)<=qe;let ht=Jt(Ve);return Oe&&(ht={...ht,y:Math.max(at,Te-ht.h-at)}),Ce?ht={...ht,x:Math.max(at,xe-ht.w-at)}:be&&(ht={...ht,x:at}),Jt(ht)}),gt.current={w:xe,h:Te}};return gt.current=(()=>{const{w:$,h:xe}=He();return{w:$,h:xe}})(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[It,Jt]);const dn=m.useRef(null);m.useEffect(()=>{const L=et.current;if(!(!L||L.isDisposed?.()))return dn.current!=null&&cancelAnimationFrame(dn.current),dn.current=requestAnimationFrame(()=>{dn.current=null;try{L.trigger("resize")}catch{}}),()=>{dn.current!=null&&(cancelAnimationFrame(dn.current),dn.current=null)}},[It,Xt.w,Xt.h]);const[ln,qt]=m.useState(!1),[Rt,Dt]=m.useState(!1),[Cn,Mt]=m.useState(null),[Pn,Dn]=m.useState(null),Mn=m.useRef(null),Wt=m.useRef(null),Vn=m.useRef(null),Yn=m.useRef(null),jn=m.useCallback(L=>{const{w:$,h:xe}=He(),Te=at,Ve=$-L.w-at,qe=xe-L.h-at,W=L.x+L.w/2<$/2;return{...L,x:W?Te:Ve,y:qe}},[]),Qn=m.useCallback(L=>{const $=Yn.current;if(!$)return;const xe=L.clientX-$.sx,Te=L.clientY-$.sy,Ve=$.start,qe=Jt({x:Ve.x+xe,y:Ve.y+Te,w:Ve.w,h:Ve.h});Vn.current={x:qe.x,y:qe.y},Mt(jn(qe)),Wt.current==null&&(Wt.current=requestAnimationFrame(()=>{Wt.current=null;const U=Vn.current;U&&pn(W=>({...W,x:U.x,y:U.y}))}))},[Jt,jn]),mn=m.useCallback(()=>{Yn.current&&(Dt(!1),Mt(null),Wt.current!=null&&(cancelAnimationFrame(Wt.current),Wt.current=null),Yn.current=null,window.removeEventListener("pointermove",Qn),window.removeEventListener("pointerup",mn),pn(L=>{const $=jn(Jt(L));return queueMicrotask(()=>Kt($)),$}))},[Qn,jn,Jt,Kt]),Ri=m.useCallback(L=>{if(!It||ln||L.button!==0)return;L.preventDefault(),L.stopPropagation();const $=cn.current;Yn.current={sx:L.clientX,sy:L.clientY,start:$},Dt(!0);const xe=Le();Dn(xe),Mt(jn($)),window.addEventListener("pointermove",Qn),window.addEventListener("pointerup",mn)},[It,ln,Qn,mn,jn,Le]),Zn=m.useRef(null),Kn=m.useRef(null),ni=m.useRef(null),Si=m.useCallback(L=>{const $=ni.current;if(!$)return;const xe=L.clientX-$.sx,Te=L.clientY-$.sy,Ve=$.ratio,qe=$.dir.includes("w"),U=$.dir.includes("e"),W=$.dir.includes("n"),le=$.dir.includes("s");let be=$.start.w,Ce=$.start.h,Oe=$.start.x,ht=$.start.y;const{w:At,h:yt}=He(),rn=24,Yt=$.start.x+$.start.w,Rn=$.start.y+$.start.h,ui=Math.abs(At-at-Yt)<=rn,Kr=Math.abs(yt-at-Rn)<=rn,xn=ci=>{ci=Math.max(N,ci);let Fi=ci/Ve;return Fi<F&&(Fi=F,ci=Fi*Ve),{newW:ci,newH:Fi}},Os=ci=>{ci=Math.max(F,ci);let Fi=ci*Ve;return Fi<N&&(Fi=N,ci=Fi/Ve),{newW:Fi,newH:ci}};if((U||qe)&&(W||le)){if(Math.abs(xe)>=Math.abs(Te)){const Fi=U?$.start.w+xe:$.start.w-xe,{newW:_s,newH:Do}=xn(Fi);be=_s,Ce=Do}else{const Fi=le?$.start.h+Te:$.start.h-Te,{newW:_s,newH:Do}=Os(Fi);be=_s,Ce=Do}qe&&(Oe=$.start.x+($.start.w-be)),W&&(ht=$.start.y+($.start.h-Ce))}else if(U||qe){const ci=U?$.start.w+xe:$.start.w-xe,{newW:Fi,newH:_s}=xn(ci);be=Fi,Ce=_s,qe&&(Oe=$.start.x+($.start.w-be)),ht=Kr?$.start.y+($.start.h-Ce):$.start.y}else if(W||le){const ci=le?$.start.h+Te:$.start.h-Te,{newW:Fi,newH:_s}=Os(ci);be=Fi,Ce=_s,W&&(ht=$.start.y+($.start.h-Ce)),ui?Oe=$.start.x+($.start.w-be):Oe=$.start.x}const Ar=Jt({x:Oe,y:ht,w:be,h:Ce});Kn.current=Ar,Zn.current==null&&(Zn.current=requestAnimationFrame(()=>{Zn.current=null;const ci=Kn.current;ci&&pn(ci)}))},[Jt]),An=m.useCallback(()=>{ni.current&&(qt(!1),Mt(null),Dn(null),Zn.current!=null&&(cancelAnimationFrame(Zn.current),Zn.current=null),ni.current=null,window.removeEventListener("pointermove",Si),window.removeEventListener("pointerup",An),Kt(cn.current))},[Si,Kt]),Fn=m.useCallback(L=>$=>{if(!It||$.button!==0)return;$.preventDefault(),$.stopPropagation();const xe=cn.current;ni.current={dir:L,sx:$.clientX,sy:$.clientY,start:xe,ratio:xe.w/xe.h},qt(!0),window.addEventListener("pointermove",Si),window.addEventListener("pointerup",An)},[It,Si,An]),[Hn,ve]=m.useState(!1),[rt,ct]=m.useState(!1);m.useEffect(()=>{const L=window.matchMedia?.("(hover: hover) and (pointer: fine)"),$=()=>ve(!!L?.matches);return $(),L?.addEventListener?.("change",$),()=>L?.removeEventListener?.("change",$)},[]);const jt=It&&(rt||Rt||ln),[De,bt]=m.useState(!1);if(m.useEffect(()=>{n.status!=="running"&&bt(!1)},[n.id,n.status]),!mt||yn&&!an)return null;const xt="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",Ft=String(n.phase??"").toLowerCase(),$t=Ft==="stopping"||Ft==="remuxing"||Ft==="moving",Vt=!B||!he||$t||De,vn=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:he?c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Vt,title:$t||De?"Stoppe…":"Stop","aria-label":$t||De?"Stoppe…":"Stop",onClick:async L=>{if(L.preventDefault(),L.stopPropagation(),!Vt)try{bt(!0),await B?.(n.id)}finally{bt(!1)}},className:Ta("shadow-none shrink-0",It&&fn&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:$t||De?"Stoppe…":It&&fn?"Stop":"Stoppen"})}),c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,busy:$t||De,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):void 0,order:["watch","favorite","like","details"],className:"gap-1 min-w-0 flex-1"})]}):c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,isHot:u||fe,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):void 0,onToggleHot:C?async L=>{ie(),await new Promise(xe=>setTimeout(xe,150)),await C(L),await new Promise(xe=>setTimeout(xe,0));const $=et.current;if($&&!$.isDisposed?.()){const xe=$.play?.();xe&&typeof xe.catch=="function"&&xe.catch(()=>{})}}:void 0,onKeep:_?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await _(L)}:void 0,onDelete:S?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await S(L)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),qn=e||It,Yi=he?"calc(4px + env(safe-area-inset-bottom))":`calc(${Ot+2}px + env(safe-area-inset-bottom))`,Gn="top-2",ki=e&&vt,Ei=c.jsx("div",{className:Ta("relative overflow-visible",e||It?"flex-1 min-h-0":"aspect-video"),onMouseEnter:()=>{!It||!Hn||ct(!0)},onMouseLeave:()=>{!It||!Hn||ct(!1)},children:c.jsxs("div",{className:Ta("relative w-full h-full",It&&"vjs-mini"),style:{"--vjs-controlbar-h":`${Ot}px`},children:[he?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(rb,{src:_e,muted:G,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:Ze,className:"absolute inset-0"}),c.jsxs("div",{className:Ta("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:Ta("absolute inset-x-2",Gn),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:ki?null:vn}),It?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:Ri,onClick:L=>{L.preventDefault(),L.stopPropagation()},className:Ta(xt,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",jt?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",Rt&&"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:xt,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(jA,{className:"h-5 w-5"}):c.jsx(OA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:xt,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(wf,{className:"h-5 w-5"})})]})]})})]}),c.jsxs("div",{className:Ta("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:Yi},children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white",children:I}),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||q}),u||fe?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:[ot!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:ot}):null,he?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:ke}),K!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:K}):null]})]})]})}),si=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:Ye,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:I}),c.jsx("div",{className:"text-xs text-white/70 break-all",children:pe||q})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[he?c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Vt,title:$t||De?"Stoppe…":"Stop","aria-label":$t||De?"Stoppe…":"Stop",onClick:async L=>{if(L.preventDefault(),L.stopPropagation(),!Vt)try{bt(!0),await B?.(n.id)}finally{bt(!1)}},className:"shadow-none",children:$t||De?"Stoppe…":"Stoppen"}):null,c.jsx(Ds,{job:n,variant:"table",collapseToMenu:!1,busy:$t||De,isHot:u||fe,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?L=>E(L):void 0,onToggleFavorite:D?L=>D(L):void 0,onToggleLike:R?L=>R(L):void 0,onToggleHot:C?async L=>{ie(),await new Promise(xe=>setTimeout(xe,150)),await C(L),await new Promise(xe=>setTimeout(xe,0));const $=et.current;if($&&!$.isDisposed?.()){const xe=$.play?.();xe&&typeof xe.catch=="function"&&xe.catch(()=>{})}}:void 0,onKeep:_?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await _(L)}:void 0,onDelete:S?async L=>{ie(),t(),await new Promise($=>setTimeout($,150)),await S(L)}:void 0,order:he?["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:ot}),c.jsx("div",{className:"text-white/60",children:"FPS"}),c.jsx("div",{className:"font-medium",children:dt}),c.jsx("div",{className:"text-white/60",children:"Laufzeit"}),c.jsx("div",{className:"font-medium",children:ke}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:K}),c.jsx("div",{className:"text-white/60",children:"Datum"}),c.jsx("div",{className:"font-medium",children:ye}),c.jsx("div",{className:"col-span-2",children:pt.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:pt.map(L=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:L},L))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),mi=It&&Rt&&Cn?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:Cn.x-Xt.x,top:Cn.y-Xt.y,width:Cn.w,height:Cn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:Pn||Ye,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:I}),c.jsxs("div",{className:"truncate text-[11px] text-white/75",children:[pe||q,u||fe?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:[ot!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:ot}):null,!he&&ke!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:ke}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,Pi=c.jsx(Ns,{edgeToEdgeMobile:!0,noBodyPadding:!0,className:Ta("relative z-10 flex flex-col shadow-2xl ring-1 ring-black/10 dark:ring-white/10","w-full",qn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":It?"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:[ki?si:null,Ei]})}),{w:Sn,h:Jn,ox:wn,oy:Ci,bottomInset:Oi}=He(),ei={left:wn+16,top:Ci+16,width:Math.max(0,Sn-32),height:Math.max(0,Jn-32)},Li=e?ei:It?{left:Xt.x,top:Xt.y,width:Xt.w,height:Xt.h}:void 0,we=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||It?c.jsxs("div",{className:Ta("fixed z-[2147483647]",!ln&&!Rt&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...Li,willChange:ln?"left, top, width, height":void 0},children:[mi,Pi,It?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:Fn("w")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:Fn("e")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:Fn("n")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:Fn("s")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:Fn("nw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:Fn("ne")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:Fn("sw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:Fn("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(${Oi}px + env(safe-area-inset-bottom))`},children:Pi})]});return yn?yu.createPortal(we,an):we}function xk({jobId:n,thumbTick:e,blur:t=!1,className:i,thumbsWebpUrl:a,thumbsCandidates:l}){const u=t?"blur-md":"",h=0,f=m.useRef(null),g=m.useRef(!0),[_,S]=m.useState(!1),C=m.useRef(!1),[D,R]=m.useState(!1),[E,B]=m.useState(!1),[,G]=m.useState(!0),Y=ae=>{const z=String(ae??"").trim();return z?/^https?:\/\//i.test(z)||z.startsWith("/")?z:`/${z}`:""},q=m.useMemo(()=>{const ae=[a,...Array.isArray(l)?l:[]].map(Y).filter(Boolean);return Array.from(new Set(ae)).join("|")},[a,l]);m.useEffect(()=>{const ae=()=>{const P=!document.hidden;g.current=P,G(P)},z=!document.hidden;return g.current=z,G(z),document.addEventListener("visibilitychange",ae),()=>document.removeEventListener("visibilitychange",ae)},[]),m.useEffect(()=>{const ae=f.current;if(!ae)return;const z=new IntersectionObserver(P=>{const Z=P[0],ee=!!(Z&&(Z.isIntersecting||Z.intersectionRatio>0));ee!==C.current&&(C.current=ee,S(ee))},{root:null,threshold:0,rootMargin:"300px 0px"});return z.observe(ae),()=>z.disconnect()},[]);const se=typeof e=="number"?e:0,Q=m.useRef(0),[K,O]=m.useState(0);m.useEffect(()=>{_&&g.current&&(Q.current=se,O(se))},[se,_]),m.useEffect(()=>{R(!1),B(!1)},[K,n,q]);const re=K||1,k=m.useMemo(()=>`/api/preview?id=${encodeURIComponent(n)}&v=${re}`,[n,re]),j=m.useMemo(()=>`/api/preview/live?id=${encodeURIComponent(n)}&hover=1`,[n]),V=m.useMemo(()=>q?q.split("|"):[],[q])[0]||"",ne=!!V&&!D,he=m.useMemo(()=>{if(ne){const ae=V.includes("?")?"&":"?";return`${V}${ae}v=${encodeURIComponent(String(re))}`}return k},[ne,V,re,k]);return c.jsx(Dw,{content:(ae,{close:z})=>ae&&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% + ${h}px)`},children:c.jsxs("div",{className:"absolute inset-0",children:[c.jsx(rb,{src:j,muted:!0,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:P=>{P.preventDefault(),P.stopPropagation(),z()},children:c.jsx(wf,{className:"h-4 w-4"})})]})})}),children:c.jsx("div",{ref:f,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",i||"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:he,loading:_?"eager":"lazy",fetchPriority:_?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",u].filter(Boolean).join(" "),onLoad:()=>{ne?R(!1):B(!1)},onError:()=>{if(ne){R(!0);return}B(!0)}})})})}function yd({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)),_=h==="sm"?"h-1.5":"h-2",S=Array.isArray(l)&&l.length>0,C=S?l.length:0,D=B=>B===0?"text-left":B===C-1?"text-right":"text-center",R=B=>typeof u!="number"||!Number.isFinite(u)?!1:B<=u,E=i&&!t;return c.jsxs("div",{className:f,children:[n||E?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"}),E?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||E?"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-full rounded-full bg-indigo-600/70 dark:bg-indigo-500/70 animate-pulse`}):c.jsx("div",{className:`${_} 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(${C}, minmax(0, 1fr))`},children:l.map((B,G)=>c.jsx("div",{className:[D(G),R(G)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:B},`${G}-${B}`))}):null]})]})}function W8(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 Gf=n=>{const e=n;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},_k=n=>{const e=n;return e.sourceUrl??e.url??e.roomUrl??""},wk=n=>{const e=n;return String(e.imageUrl??e.image_url??"").trim()},Jl=n=>{const e=n;return String(e.key??e.id??Gf(n))},Hi=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},X8=n=>{const e=String(n??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},Tk=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=>X8(String(a??""))).filter(Boolean)},eu=n=>{if(n.kind==="job"){const t=n.job;return Hi(t.addedAt)||Hi(t.createdAt)||Hi(t.enqueuedAt)||Hi(t.queuedAt)||Hi(t.requestedAt)||Hi(t.startedAt)||0}const e=n.pending;return Hi(e.addedAt)||Hi(e.createdAt)||Hi(e.enqueuedAt)||Hi(e.queuedAt)||Hi(e.requestedAt)||0},Sk=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""}};async function Y8(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 kk(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 Q8({job:n,postworkInfo:e}){const t=String(n?.phase??"").trim(),i=Number(n?.progress??0),a=t.toLowerCase(),l=a==="recording";let u=t?Sk(t)||t:"";a==="postwork"&&(u=kk(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(yd,{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(yd,{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 yg({r:n,nowMs:e,blurPreviews:t,modelsByKey:i,stopRequestedIds:a,postworkInfoOf:l,markStopRequested:u,onOpenPlayer:h,onStopJob:f,onToggleFavorite:g,onToggleLike:_,onToggleWatch:S}){if(n.kind==="pending"){const P=n.pending,Z=Gf(P),ee=_k(P),fe=(P.currentShow||"unknown").toLowerCase();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:Z,children:Z}),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:fe})]})]}),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 I=wk(P);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:I?c.jsx("img",{src:I,alt:Z,className:["h-full w-full object-cover",t?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:pe=>{pe.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…"})})})})()}),ee?c.jsx("a",{href:ee,target:"_blank",rel:"noreferrer",className:"mt-3 block truncate text-xs text-indigo-600 hover:underline dark:text-indigo-400",onClick:I=>I.stopPropagation(),title:ee,children:ee}):null]})]})}const C=n.job,D=cy(C.output),R=ab(C.output||""),E=String(C.phase??"").trim(),B=E.toLowerCase(),G=B==="recording",Y=!!a[C.id],q=String(C.status??"").toLowerCase(),Q=B!==""&&B!=="recording"||q!=="running"||Y;let K=E?Sk(E)||E:"";B==="recording"?K="Recording läuft…":B==="postwork"&&(K=kk(C,l(C)));const O=q||"unknown",re=K||O,k=Number(C.progress??0),j=!G&&Number.isFinite(k)&&k>0&&k<100,te=!G&&!j&&!!E&&(!Number.isFinite(k)||k<=0||k>=100),V=D&&D!=="—"?D.toLowerCase():"",ne=V?i[V]:void 0,he=!!ne?.favorite,ae=ne?.liked===!0,z=!!ne?.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:()=>h(C),role:"button",tabIndex:0,onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&h(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(xk,{jobId:C.id,blur:t,thumbTick:Number(C.previewTick??0),thumbsCandidates:Tk(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:D,children:D}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold","bg-gray-900/5 text-gray-800 dark:bg-white/10 dark:text-gray-200",Q?"ring-1 ring-amber-500/30":"ring-1 ring-emerald-500/25"].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:R||"—"})]}),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:Ek(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:Ak(Ck(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:P=>P.stopPropagation(),title:C.sourceUrl,children:C.sourceUrl}):null]})]}),j||te?c.jsx("div",{className:"mt-3",children:j?c.jsx(yd,{label:re,value:Math.max(0,Math.min(100,k)),showPercent:!0,size:"sm",className:"w-full"}):c.jsx(yd,{label:re,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:P=>P.stopPropagation(),onMouseDown:P=>P.stopPropagation(),children:c.jsx(Ds,{job:C,variant:"table",busy:Q,isFavorite:he,isLiked:ae,isWatching:z,onToggleFavorite:g,onToggleLike:_,onToggleWatch:S,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),c.jsx(en,{size:"sm",variant:"primary",disabled:Q,className:"shrink-0",onClick:P=>{P.stopPropagation(),!Q&&(u(C.id),f(C.id))},children:Q?"Stoppe…":"Stop"})]})]})]})}const ab=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",cy=n=>{const e=ab(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},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`},Ek=(n,e)=>{const t=n,i=Hi(t.startedAtMs)||Hi(n.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const a=n.endedAt?Hi(t.endedAtMs)||Hi(n.endedAt):e;return!Number.isFinite(a)||a<=0?"—":Z8(a-i)},Ck=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},Ak=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]}`},bg=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")},C_=n=>{const e=String(n??"").trim().toLowerCase();return e==="stopped"||e==="finished"||e==="failed"||e==="done"||e==="completed"||e==="canceled"||e==="cancelled"};function A_(){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 J8({jobs:n,pending:e=[],onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,modelsByKey:f={},blurPreviews:g}){const _=n,S=W8("(min-width: 640px)",!0),[C,D]=m.useState(!1),[R,E]=m.useState(!1),[,B]=m.useState(!1),[G,Y]=m.useState(!1),q=m.useRef(null),se=m.useRef(null),Q=m.useRef(null),[K,O]=m.useState(!1),re=m.useCallback(async()=>{try{const _e=await Y8("/api/autostart/state",{cache:"no-store"}),Ye=!!_e?.paused,wt=!!_e?.pausedByUser,je=!!_e?.pausedByDisk;q.current=Ye,se.current=wt,Q.current=je,E(Ye),B(wt),Y(je)}catch{}},[]);m.useEffect(()=>{re();const _e=ll("/api/stream","autostart",Ye=>{const wt=!!Ye?.paused,je=!!Ye?.pausedByUser,Se=!!Ye?.pausedByDisk;q.current===wt&&se.current===je&&Q.current===Se||(q.current=wt,se.current=je,Q.current=Se,E(wt),B(je),Y(Se))});return()=>{_e()}},[re]);const k=m.useCallback(async()=>{if(!(K||R)){O(!0);try{const _e=await fetch("/api/autostart/pause",{method:"POST"});if(!_e.ok)throw new Error(`HTTP ${_e.status}`);await re()}catch{}finally{O(!1)}}},[K,R,re]),j=m.useCallback(async()=>{if(!(K||!R||G)){O(!0);try{const _e=await fetch("/api/autostart/resume",{method:"POST"});if(!_e.ok)throw new Error(`HTTP ${_e.status}`);await re()}catch{}finally{O(!1)}}},[K,R,G,re]),[te,V]=m.useState({}),[ne,he]=m.useState({}),ae=m.useCallback(_e=>{const Ye=Array.isArray(_e)?_e:[_e];V(wt=>{const je={...wt};for(const Se of Ye)Se&&(je[Se]=!0);return je}),he(wt=>{const je={...wt};for(const Se of Ye)Se&&(je[Se]=!0);return je})},[]);m.useEffect(()=>{V(_e=>{const Ye=Object.keys(_e);if(Ye.length===0)return _e;const wt={};for(const je of Ye){const Se=_.find(dt=>dt.id===je);if(!Se)continue;const Je=String(Se.phase??"").trim().toLowerCase();Je!==""&&Je!=="recording"||Se.status!=="running"||(wt[je]=!0)}return wt})},[_]);const[z,P]=m.useState(()=>Date.now()),Z=m.useMemo(()=>_.some(_e=>!_e.endedAt&&_e.status==="running"),[_]),ee=m.useMemo(()=>{const _e=new Map,Ye=tt=>{const ot=tt,dt=ot.postWork;return Hi(dt?.enqueuedAt)||Hi(ot.enqueuedAt)||Hi(ot.queuedAt)||Hi(ot.createdAt)||Hi(ot.addedAt)||Hi(tt.endedAt)||Hi(tt.startedAt)||0},wt=[],je=[];for(const tt of _){const ot=tt?.postWork;if(!ot)continue;const dt=String(ot.state??"").toLowerCase();dt==="running"?wt.push(tt):dt==="queued"&&je.push(tt)}wt.sort((tt,ot)=>Ye(tt)-Ye(ot)),je.sort((tt,ot)=>Ye(tt)-Ye(ot));const Se=wt.length,Je=Se+je.length;for(let tt=0;tt<je.length;tt++){const ot=String(je[tt]?.id??"");ot&&_e.set(ot,{pos:Se+tt+1,total:Je})}return _e},[_]),fe=m.useCallback(_e=>{const Ye=String(_e?.id??"");return Ye?ee.get(Ye):void 0},[ee]);m.useEffect(()=>{if(!Z)return;const _e=window.setInterval(()=>P(Date.now()),1e3);return()=>window.clearInterval(_e)},[Z]);const I=m.useMemo(()=>_.filter(_e=>{if(bg(_e)||_e.endedAt)return!1;const Ye=String(_e.phase??"").trim(),wt=!!te[_e.id],je=Ye.trim().toLowerCase();return!(je!==""&&je!=="recording"||_e.status!=="running"||wt)}).map(_e=>_e.id),[_,te]),pe=m.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:_e=>{if(_e.kind==="job"){const Se=_e.job;return c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:c.jsx(xk,{jobId:Se.id,blur:g,thumbTick:Number(Se.previewTick??0),thumbsCandidates:Tk(Se),className:"w-full h-full"})})}const Ye=_e.pending,wt=Gf(Ye),je=wk(Ye);return je?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:je,alt:wt,className:["h-full w-full object-cover",g?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:Se=>{Se.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:_e=>{if(_e.kind==="job"){const Se=_e.job,Je=ab(Se.output||""),tt=cy(Se.output),ot=String(Se.status??"").toLowerCase(),dt=!!te[Se.id],Ut=!!ne[Se.id],Ge=ot==="stopped"||Ut&&!!Se.endedAt,Ie=Ge?"stopped":ot||"unknown",Ze=!Ge&&dt,et=Ze?"stopping":Ie;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:tt,children:tt}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",ot==="running"?"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":Ge?"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":ot==="failed"?"bg-red-500/15 text-red-900 ring-red-500/30 dark:bg-red-400/10 dark:text-red-200 dark:ring-red-400/25":ot==="finished"?"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":Ze?"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":"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"].join(" "),title:et,children:et})]}),c.jsx("span",{className:"block max-w-[220px] truncate",title:Se.output,children:Je}),Se.sourceUrl?c.jsx("a",{href:Se.sourceUrl,target:"_blank",rel:"noreferrer",title:Se.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:ft=>ft.stopPropagation(),children:Se.sourceUrl}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const Ye=_e.pending,wt=Gf(Ye),je=_k(Ye);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:wt,children:wt}),je?c.jsx("a",{href:je,target:"_blank",rel:"noreferrer",title:je,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:Se=>Se.stopPropagation(),children:je}):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:_e=>{if(_e.kind==="job"){const je=_e.job;return c.jsx(Q8,{job:je,postworkInfo:fe(je)})}const wt=(_e.pending.currentShow||"unknown").toLowerCase();return c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:wt})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:_e=>_e.kind==="job"?Ek(_e.job,z):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:_e=>_e.kind==="job"?c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:Ak(Ck(_e.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:_e=>{if(_e.kind!=="job")return c.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const Ye=_e.job,wt=String(Ye.phase??"").trim(),je=!!te[Ye.id],Se=wt.trim().toLowerCase(),tt=Se!==""&&Se!=="recording"||Ye.status!=="running"||je,ot=cy(Ye.output||""),dt=ot&&ot!=="—"?f[ot.toLowerCase()]:void 0,Ut=!!dt?.favorite,Ge=dt?.liked===!0,Ie=!!dt?.watching;return c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[c.jsx(Ds,{job:Ye,variant:"table",busy:tt,isFavorite:Ut,isLiked:Ge,isWatching:Ie,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const Ze=String(Ye.phase??"").trim(),et=!!te[Ye.id],ft=Ze.trim().toLowerCase(),de=ft!==""&&ft!=="recording"||Ye.status!=="running"||et;return c.jsx(en,{size:"sm",variant:"primary",disabled:de,className:"shrink-0",onClick:ze=>{ze.stopPropagation(),!de&&(ae(Ye.id),i(Ye.id))},children:de?"Stoppe…":"Stop"})})()]})}}],[g,ae,f,z,i,a,l,u,te,ne,fe]),ke=m.useMemo(()=>{const _e=_.filter(Ye=>!(bg(Ye)||C_(Ye?.status)||Ye?.endedAt)).map(Ye=>({kind:"job",job:Ye}));return _e.sort((Ye,wt)=>eu(wt)-eu(Ye)),_e},[_]),ye=m.useMemo(()=>{const _e=_.filter(je=>!(!bg(je)||C_(je?.status))).map(je=>({kind:"job",job:je})),Ye=je=>{const Se=je?.postWork,Je=String(Se?.state??"").toLowerCase();return Je==="running"?0:Je==="queued"?1:2},wt=je=>{const Se=String(je?.id??""),Je=Se?ee.get(Se):void 0;return typeof Je?.pos=="number"&&Number.isFinite(Je.pos)?Je.pos:Number.MAX_SAFE_INTEGER};return _e.sort((je,Se)=>{const Je=je.job,tt=Se.job,ot=Ye(Je)-Ye(tt);if(ot!==0)return ot;const dt=wt(Je),Ut=wt(tt);return dt!==Ut?dt-Ut:eu(je)-eu(Se)}),_e},[_,ee]),me=m.useMemo(()=>{const _e=e.map(Ye=>({kind:"pending",pending:Ye}));return _e.sort((Ye,wt)=>eu(wt)-eu(Ye)),_e},[e]),pt=ke.length+ye.length+me.length,We=m.useCallback(async()=>{if(!C&&I.length!==0){D(!0);try{ae(I),await Promise.allSettled(I.map(_e=>Promise.resolve(i(_e))))}finally{D(!1)}}},[C,I,ae,i]);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:pt})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[c.jsx(en,{size:"sm",variant:R?"secondary":"primary",disabled:K||G,onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),!G&&(R?j():k())},className:"hidden sm:inline-flex",title:G?"Autostart durch Speicherplatz-Notbremse gesperrt":R?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:R?c.jsx(NN,{className:"size-4 shrink-0"}):c.jsx(MN,{className:"size-4 shrink-0"}),children:"Autostart"}),c.jsx(en,{size:"sm",variant:"primary",disabled:C||I.length===0,onClick:_e=>{_e.preventDefault(),_e.stopPropagation(),We()},className:"hidden sm:inline-flex",title:I.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:C?"Stoppe alle…":`Alle stoppen (${I.length})`})]})]})})}),ke.length>0||ye.length>0||me.length>0?c.jsx(c.Fragment,{children:S?c.jsxs("div",{className:"mt-3 space-y-4",children:[ke.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 (",ke.length,")"]}),G?c.jsx(A_,{}):null]}),c.jsx(td,{rows:ke,columns:pe,getRowKey:_e=>_e.kind==="job"?`dl:job:${_e.job.id}`:`dl:pending:${Jl(_e.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:_e=>{_e.kind==="job"&&t(_e.job)}})]}):null,ye.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 (",ye.length,")"]}),c.jsx(td,{rows:ye,columns:pe,getRowKey:_e=>_e.kind==="job"?`pw:job:${_e.job.id}`:`pw:pending:${Jl(_e.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:_e=>{_e.kind==="job"&&t(_e.job)}})]}):null,me.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 (",me.length,")"]}),c.jsx(td,{rows:me,columns:pe,getRowKey:_e=>_e.kind==="job"?`wa:job:${_e.job.id}`:`wa:pending:${Jl(_e.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):c.jsxs("div",{className:"mt-3 grid gap-4",children:[ke.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 (",ke.length,")"]}),G?c.jsx(A_,{}):null]}),ke.map(_e=>c.jsx(yg,{r:_e,nowMs:z,blurPreviews:g,modelsByKey:f,postworkInfoOf:fe,stopRequestedIds:te,markStopRequested:ae,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`dl:${_e.kind==="job"?_e.job.id:Jl(_e.pending)}`))]}):null,ye.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 (",ye.length,")"]}),ye.map(_e=>c.jsx(yg,{r:_e,nowMs:z,blurPreviews:g,modelsByKey:f,postworkInfoOf:fe,stopRequestedIds:te,markStopRequested:ae,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`pw:${_e.kind==="job"?_e.job.id:Jl(_e.pending)}`))]}):null,me.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 (",me.length,")"]}),me.map(_e=>c.jsx(yg,{r:_e,nowMs:z,blurPreviews:g,modelsByKey:f,postworkInfoOf:fe,stopRequestedIds:te,markStopRequested:ae,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`wa:${_e.kind==="job"?_e.job.id:Jl(_e.pending)}`))]}):null]})}):c.jsx(Ns,{grayBody:!0,children:c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"grid h-10 w-10 place-items-center rounded-xl bg-white/70 ring-1 ring-gray-200 dark:bg-white/5 dark:ring-white/10",children:c.jsx("span",{className:"text-lg",children:"⏸️"})}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-white",children:"Keine 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 vg(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 N_=(n,e)=>c.jsx("span",{className:nn("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 e6(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 tf(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 t6(n){return String(n??"").trim().toLowerCase().replace(/^www\./,"")}function n6(n){const t=String(n||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function i6(n){const e=String(n||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function r6(n){const e=n6(n||""),t=i6(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 nf(n){if(n.isUrl&&/^https?:\/\//i.test(String(n.input??"")))return String(n.input);const e=t6(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 D_(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 M_({title:n,active:e,hiddenUntilHover:t,onClick:i,icon:a}){return c.jsx("span",{className:nn(t&&!e?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(en,{variant:e?"soft":"secondary",size:"xs",className:nn("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 j_(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 R_(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 O_(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 L_(){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 I_(){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 s6(){const[n,e]=m.useState([]),t=m.useRef({}),[i,a]=m.useState(!1),[l,u]=m.useState(null),[h,f]=m.useState(""),[g,_]=m.useState(1),S=10,[C,D]=m.useState("gallery"),[R,E]=m.useState([]),[B,G]=m.useState({}),[Y,q]=m.useState(!1),[se,Q]=m.useState({key:"createdAt",direction:"desc"}),K=m.useCallback(async()=>{q(!0);try{const de=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!de.ok)return;const ze=await de.json().catch(()=>null),Le=Array.isArray(ze?.items)?ze.items:Array.isArray(ze)?ze:[],Ae={};for(const Pe of Le){const Qe=r6(Pe.output);if(!Qe||Qe==="—")continue;const St=Qe.trim().toLowerCase();St&&(Ae[St]=(Ae[St]??0)+1)}G(Ae)}finally{q(!1)}},[]),O=m.useMemo(()=>new Set(R.map(de=>de.toLowerCase())),[R]),re=m.useCallback(de=>{const ze=de.toLowerCase();E(Le=>Le.some(Pe=>Pe.toLowerCase()===ze)?Le.filter(Pe=>Pe.toLowerCase()!==ze):[...Le,de])},[]),k=m.useCallback(()=>E([]),[]);m.useEffect(()=>{const de=ze=>{const Le=ze,Ae=Array.isArray(Le.detail?.tags)?Le.detail.tags:[];E(Ae)};return window.addEventListener("models:set-tag-filter",de),()=>window.removeEventListener("models:set-tag-filter",de)},[]),m.useEffect(()=>{try{const de=localStorage.getItem("models_pendingTags");if(!de)return;const ze=JSON.parse(de);Array.isArray(ze)&&E(ze),localStorage.removeItem("models_pendingTags")}catch{}},[]),m.useEffect(()=>{try{const de=localStorage.getItem("models_viewMode");(de==="table"||de==="gallery")&&D(de)}catch{}},[]),m.useEffect(()=>{try{localStorage.setItem("models_viewMode",C)}catch{}},[C]);const[j,te]=m.useState(""),[V,ne]=m.useState(null),[he,ae]=m.useState(null),[z,P]=m.useState(!1),[Z,ee]=m.useState(!1),[fe,I]=m.useState(null),[pe,ke]=m.useState(null),[ye,me]=m.useState("favorite"),[pt,We]=m.useState(!1),[_e,Ye]=m.useState(null);async function wt(){if(fe){We(!0),ke(null),u(null);try{const de=new FormData;de.append("file",fe),de.append("kind",ye);const ze=await fetch("/api/models/import",{method:"POST",body:de});if(!ze.ok)throw new Error(await ze.text());const Le=await ze.json();ke(`✅ Import: ${Le.inserted} neu, ${Le.updated} aktualisiert, ${Le.skipped} übersprungen`),ee(!1),I(null),await Je(),window.dispatchEvent(new Event("models-changed"))}catch(de){Ye(de?.message??String(de))}finally{We(!1)}}}function je(de){const ze=nf(de)??void 0;return{output:`${de.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:ze}}const Se=()=>{Ye(null),ke(null),I(null),me("favorite"),ee(!0)},Je=m.useCallback(async()=>{a(!0),u(null);try{const de=await vg("/api/models",{cache:"no-store"});e(Array.isArray(de)?de:[]),K()}catch(de){u(de?.message??String(de))}finally{a(!1)}},[K]);m.useEffect(()=>{K()},[K]),m.useEffect(()=>{Je()},[Je]),m.useEffect(()=>{const de=ze=>{const Ae=ze?.detail??{};if(Ae?.model){const Pe=Ae.model;e(Qe=>{const St=Qe.findIndex(Tt=>Tt.id===Pe.id);if(St===-1)return[Pe,...Qe];const Ot=Qe.slice();return Ot[St]=Pe,Ot});return}if(Ae?.removed&&Ae?.id){const Pe=String(Ae.id);e(Qe=>Qe.filter(St=>St.id!==Pe));return}Je()};return window.addEventListener("models-changed",de),()=>window.removeEventListener("models-changed",de)},[Je]),m.useEffect(()=>{const de=j.trim();if(!de){ne(null),ae(null);return}const ze=e6(de);if(!ze){ne(null),ae("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const Le=window.setTimeout(async()=>{try{const Ae=await vg("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:ze})});if(!Ae?.isUrl){ne(null),ae("Bitte nur URLs einfügen (keine Modelnamen).");return}ne(Ae),ae(null)}catch(Ae){ne(null),ae(Ae?.message??String(Ae))}},300);return()=>window.clearTimeout(Le)},[j]);const tt=m.useMemo(()=>n.map(de=>({m:de,hay:`${de.modelKey} ${de.host??""} ${de.input??""} ${de.tags??""}`.toLowerCase()})),[n]),ot=m.useDeferredValue(h);async function dt(de,ze){if(u(null),t.current[de])return;t.current[de]=!0;const Le=n.find(Ae=>Ae.id===de)??null;if(Le){const Ae={...Le,...ze};typeof ze?.watched=="boolean"&&(Ae.watching=ze.watched),ze?.favorite===!0&&(Ae.liked=!1),ze?.liked===!0&&(Ae.favorite=!1),e(Pe=>Pe.map(Qe=>Qe.id===de?Ae:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ae}}))}try{const Ae=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:de,...ze})});if(Ae.status===204){e(Qe=>Qe.filter(St=>St.id!==de)),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:de}}));return}if(!Ae.ok){const Qe=await Ae.text().catch(()=>"");throw new Error(Qe||`HTTP ${Ae.status}`)}const Pe=await Ae.json();e(Qe=>{const St=Qe.findIndex(Tt=>Tt.id===Pe.id);if(St===-1)return Qe;const Ot=Qe.slice();return Ot[St]=Pe,Ot}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Pe}}))}catch(Ae){Le&&(e(Pe=>Pe.map(Qe=>Qe.id===de?Le:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Le}}))),u(Ae?.message??String(Ae))}finally{delete t.current[de]}}const Ut=m.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:de=>{const ze=de.liked===!0,Le=de.favorite===!0,Ae=de.watching===!0,Pe=!Ae&&!Le&&!ze;return c.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[c.jsx("span",{className:nn(Pe&&!Ae?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(en,{variant:Ae?"soft":"secondary",size:"xs",className:nn("px-2 py-1 leading-none",!Ae&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:Ae?"Nicht mehr beobachten":"Beobachten",onClick:Qe=>{Qe.stopPropagation(),dt(de.id,{watched:!Ae})},children:c.jsx("span",{className:nn("text-base leading-none",Ae?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),c.jsx(M_,{title:Le?"Favorit entfernen":"Als Favorit markieren",active:Le,hiddenUntilHover:Pe,onClick:Qe=>{Qe.stopPropagation(),Le?dt(de.id,{favorite:!1}):dt(de.id,{favorite:!0,liked:!1})},icon:c.jsx("span",{className:Le?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),c.jsx(M_,{title:ze?"Gefällt mir entfernen":"Gefällt mir",active:ze,hiddenUntilHover:Pe,onClick:Qe=>{Qe.stopPropagation(),ze?dt(de.id,{liked:!1}):dt(de.id,{liked:!0,favorite:!1})},icon:c.jsx("span",{className:ze?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:de=>(de.modelKey||"").toLowerCase(),cell:de=>{const ze=nf(de),Le=D_(de);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:de.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:Ae=>{Ae.stopPropagation(),ze&&window.open(ze,"_blank","noreferrer")},onError:Ae=>{Ae.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(de.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:de.modelKey}),ze?c.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:ze,onClick:Ae=>{Ae.stopPropagation(),window.open(ze,"_blank","noreferrer")},children:"↗"}):null]}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:de.host??"—"}),ze?c.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:ze}):null]})]})})}},{key:"videos",header:"Videos",sortable:!0,sortValue:de=>{const ze=String(de.modelKey||"").trim().toLowerCase(),Le=B[ze];return typeof Le=="number"?Le:0},align:"right",cell:de=>{const ze=String(de.modelKey||"").trim().toLowerCase(),Le=B[ze];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:Y?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:de=>tf(de.tags).length,cell:de=>{const ze=tf(de.tags),Le=ze.slice(0,6),Ae=ze.length-Le.length,Pe=ze.join(", ");return c.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:Pe||void 0,children:[de.hot?N_(!0,"🔥 HOT"):null,de.keep?N_(!0,"📌 Behalten"):null,Le.map(Qe=>c.jsx(ms,{tag:Qe,title:Qe,active:O.has(Qe.toLowerCase()),onClick:re},Qe)),Ae>0?c.jsxs(ms,{title:Pe,children:["+",Ae]}):null,!de.hot&&!de.keep&&ze.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:de=>{const ze=Date.parse(String(de.createdAt??""));return Number.isFinite(ze)?ze:0},widthClassName:"w-[160px]",cell:de=>{const ze=Date.parse(String(de.createdAt??""));if(!Number.isFinite(ze)||ze<=0)return c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"});const Le=new Date(ze);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:de=>c.jsx("div",{className:"flex justify-end w-[92px]",children:c.jsx(Ds,{job:je(de),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[O,re,B,Y]),Ge=m.useMemo(()=>{const de=ot.trim().toLowerCase(),ze=de?tt.filter(Le=>Le.hay.includes(de)).map(Le=>Le.m):n;return O.size===0?ze:ze.filter(Le=>{const Ae=tf(Le.tags);if(Ae.length===0)return!1;const Pe=new Set(Ae.map(Qe=>Qe.toLowerCase()));for(const Qe of O)if(!Pe.has(Qe))return!1;return!0})},[n,tt,ot,O]),Ie=m.useMemo(()=>{if(!se)return Ge;const de=Ut.find(Ae=>Ae.key===se.key);if(!de)return Ge;const ze=se.direction==="asc"?1:-1,Le=Ge.map((Ae,Pe)=>({r:Ae,i:Pe}));return Le.sort((Ae,Pe)=>{let Qe=0;if(de.sortFn)Qe=de.sortFn(Ae.r,Pe.r);else{const St=de.sortValue?de.sortValue(Ae.r):Ae.r?.[de.key],Ot=de.sortValue?de.sortValue(Pe.r):Pe.r?.[de.key],Tt=j_(St),an=j_(Ot);Tt.isNull&&!an.isNull?Qe=1:!Tt.isNull&&an.isNull?Qe=-1:Tt.kind==="number"&&an.kind==="number"?Qe=Tt.value<an.value?-1:Tt.value>an.value?1:0:Qe=String(Tt.value).localeCompare(String(an.value),void 0,{numeric:!0})}return Qe===0?Ae.i-Pe.i:Qe*ze}),Le.map(Ae=>Ae.r)},[Ge,se,Ut]);m.useEffect(()=>{_(1)},[h,R,C,se]);const Ze=Ie.length,et=m.useMemo(()=>Math.max(1,Math.ceil(Ze/S)),[Ze,S]);m.useEffect(()=>{g>et&&_(et)},[g,et]);const ft=m.useMemo(()=>{const de=(g-1)*S;return Ie.slice(de,de+S)},[Ie,g,S]),mt=async()=>{if(V){if(!V.isUrl){ae("Bitte nur URLs einfügen (keine Modelnamen).");return}P(!0),u(null);try{const de=await vg("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});e(ze=>{const Le=ze.filter(Ae=>Ae.id!==de.id);return[de,...Le]}),te(""),ne(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:de}}))}catch(de){u(de?.message??String(de))}finally{P(!1)}}};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(Ns,{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:j,onChange:de=>te(de.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(en,{className:"px-3 py-2 text-sm",onClick:mt,disabled:!V||z,title:V?"In Models speichern":"Bitte gültige URL einfügen",children:"Hinzufügen"}),c.jsx(en,{className:"px-3 py-2 text-sm",onClick:Je,disabled:i,children:"Aktualisieren"})]}),he?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:he}):V?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Gefunden: ",c.jsx("span",{className:"font-medium",children:V.modelKey}),V.host?c.jsxs("span",{className:"opacity-70",children:[" • ",V.host]}):null]}):null,l?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:l}):null]})}),c.jsx(Ns,{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:["(",Ge.length,")"]})]}),c.jsx("div",{className:"sm:hidden shrink-0",children:c.jsx(en,{variant:"secondary",size:"md",onClick:Se,children:"Import"})}),c.jsx("div",{className:"hidden sm:block shrink-0",children:c.jsx(en,{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(Ig,{ariaLabel:"Ansicht umschalten",size:"lg",className:"flex w-full [&>button]:flex-1 [&>button]:min-w-0",value:C,onChange:de=>{(de==="table"||de==="gallery")&&D(de)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(L_,{})},{id:"table",label:"Tabelle",icon:c.jsx(I_,{})}]})}),c.jsx("div",{className:"min-w-0",children:C==="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:R_(se),onChange:de=>{const ze=O_(de.target.value);Q(ze)},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:de=>f(de.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:[C==="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:R_(se),onChange:de=>{const ze=O_(de.target.value);Q(ze)},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(Ig,{ariaLabel:"Ansicht umschalten",size:"lg",value:C,onChange:de=>{(de==="table"||de==="gallery")&&D(de)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(L_,{})},{id:"table",label:"Tabelle",icon:c.jsx(I_,{})}]})}),c.jsx("input",{value:h,onChange:de=>f(de.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
|
||
`})]})]})]}),R.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:[R.map(de=>c.jsx(ms,{tag:de,active:!0,onClick:re,title:de},de)),c.jsx(en,{size:"sm",variant:"soft",className:"text-xs font-medium text-gray-600 hover:underline dark:text-gray-300",onClick:k,children:"Zurücksetzen"})]})]}):null]}),noBodyPadding:!0,children:C==="table"?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"overflow-x-auto",children:c.jsx("div",{className:"min-w-[980px]",children:c.jsx(td,{rows:ft,columns:Ut,getRowKey:de=>de.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:se,onSortChange:de=>Q(de),onRowClick:de=>{const ze=nf(de);ze&&window.open(ze,"_blank","noreferrer")}})})}),c.jsx(kf,{page:g,pageSize:S,totalItems:Ze,onPageChange:_})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"p-2 sm:p-3",children:ft.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:ft.map(de=>{const ze=nf(de),Le=D_(de),Ae=tf(de.tags),Pe=Ae.slice(0,3),Qe=de.liked===!0,St=de.favorite===!0,Ot=de.watching===!0,Tt=!Ot&&!St&&!Qe,an=B[String(de.modelKey||"").trim().toLowerCase()]??0,Nt=String(de.modelKey||"?"),Lt=Nt.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:()=>{ze&&window.open(ze,"_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:de.modelKey,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]",onError:vt=>{vt.currentTarget.style.display="none";const It=vt.currentTarget.nextElementSibling;It&&(It.style.display="flex")}}):null,c.jsx("div",{className:nn("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:Lt<=10?"clamp(1rem, 1.4vw + 0.4rem, 2.1rem)":Lt<=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:Nt,children:Nt}),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:de.modelKey,children:de.modelKey}),de.host?c.jsx("div",{className:"truncate text-[11px] text-white/70 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:de.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:Y?"…":an})]}),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:Ae.length})]})]}),c.jsx("div",{className:nn("absolute left-2 z-10 flex items-center gap-1",de.hot||de.keep?"top-12":"top-2"),onClick:vt=>vt.stopPropagation(),children:c.jsx(Ds,{job:je(de),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:[Ot?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,St?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]}),(de.hot||de.keep)&&c.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-1",children:[de.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,de.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:vt=>vt.stopPropagation(),children:[c.jsx(en,{variant:Ot?"soft":"secondary",size:"xs",className:nn("h-8 min-w-0 px-0 shadow-none",Ot?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Ot?"Nicht mehr beobachten":"Beobachten",onClick:vt=>{vt.stopPropagation(),dt(de.id,{watched:!Ot})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("text-xl leading-none",Ot?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(en,{variant:St?"soft":"secondary",size:"xs",className:nn("h-8 min-w-0 px-0 shadow-none",St?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:St?"Favorit entfernen":"Als Favorit markieren",onClick:vt=>{vt.stopPropagation(),St?dt(de.id,{favorite:!1}):dt(de.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("text-xl leading-none",St?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(en,{variant:Qe?"soft":"secondary",size:"xs",className:nn("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:vt=>{vt.stopPropagation(),Qe?dt(de.id,{liked:!1}):dt(de.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("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(vt=>c.jsx(ms,{tag:vt,title:vt,active:O.has(vt.toLowerCase()),onClick:re},`${de.id}:${vt}`)):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:vt=>vt.stopPropagation(),children:c.jsxs("div",{className:"grid grid-cols-3 gap-1.5 w-full",children:[c.jsx(en,{variant:Ot?"soft":"secondary",size:"xs",className:nn("h-8 min-w-0 px-0 shadow-none",Tt&&!Ot?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",Ot?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Ot?"Nicht mehr beobachten":"Beobachten",onClick:vt=>{vt.stopPropagation(),dt(de.id,{watched:!Ot})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("text-xl leading-none",Ot?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(en,{variant:St?"soft":"secondary",size:"xs",className:nn("h-8 min-w-0 px-0 shadow-none",Tt&&!St?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",St?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:St?"Favorit entfernen":"Als Favorit markieren",onClick:vt=>{vt.stopPropagation(),St?dt(de.id,{favorite:!1}):dt(de.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("text-xl leading-none",St?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(en,{variant:Qe?"soft":"secondary",size:"xs",className:nn("h-8 min-w-0 px-0 shadow-none",Tt&&!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:vt=>{vt.stopPropagation(),Qe?dt(de.id,{liked:!1}):dt(de.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:nn("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(vt=>c.jsx(ms,{tag:vt,title:vt,active:O.has(vt.toLowerCase()),onClick:re},`${de.id}:${vt}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]})]})]},de.id)})})}),c.jsx(kf,{page:g,pageSize:S,totalItems:Ze,onPageChange:_})]})}),c.jsx(Tf,{open:Z,onClose:()=>!pt&&ee(!1),title:"Models importieren",footer:c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"secondary",onClick:()=>ee(!1),disabled:pt,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:wt,isLoading:pt,disabled:!fe||pt,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:ye==="favorite",onChange:()=>me("favorite"),disabled:pt}),"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:ye==="liked",onChange:()=>me("liked"),disabled:pt}),"Gefällt mir (♥)"]})]})]}),c.jsx("input",{type:"file",accept:".csv,text/csv",onChange:de=>{const ze=de.target.files?.[0]??null;Ye(null),I(ze)},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"}),fe?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",c.jsx("span",{className:"font-medium",children:fe.name})]}):null,_e?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:_e}):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 ii(...n){return n.filter(Boolean).join(" ")}function xg(n){const e=String(n?.status??"").toLowerCase();return!!!(n?.endedAt??n?.completedAt)&&(e==="running"||e==="postwork")}const a6=600*1e3,o6=new Map,B_=new Map;function rf(n){return Number.isFinite(n)&&Date.now()-n<=a6}function P_(n){try{if(typeof window>"u")return null;const e=window.sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}function l6(n,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function u6(n){return`md:cb:online:${n}`}function F_(n){return`md:cb:bio:${n}`}const c6=new Intl.NumberFormat("de-DE");function el(n){return n==null||!Number.isFinite(n)?"—":c6.format(n)}function d6(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 _g(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 zc(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 h6(n){return n?n.split(",").map(e=>e.trim()).filter(Boolean):[]}function vo(n){return(n||"").split(/[\\/]/).pop()||""}function f6(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 wo(n){return n.startsWith("HOT ")?n.slice(4):n}function dy(n){return String(n||"").startsWith("HOT ")}function p6(n,e){const t=String(n||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function m6(n){return dy(n)?wo(n):`HOT ${n}`}function g6(n){const e=vo(n||""),t=wo(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 mf(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 U_(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 z_(n){const e=String(n??"").trim();if(!e)return"";const t=mf(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function y6(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 ss(n){return ii("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",n)}const sf=n=>n?"blur-md scale-[1.03] brightness-90":"";function af(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function $_(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 of(n,e,t){return Math.max(e,Math.min(t,n))}const H_=5;function q_(n){if(n<=1)return[1,1];const e=16/9;let t=1,i=n,a=Number.POSITIVE_INFINITY,l=Number.POSITIVE_INFINITY;for(let u=1;u<=n;u++){const h=Math.max(1,Math.ceil(n/u)),f=u*h-n,g=u/h,_=Math.abs(g-e);(f<a||f===a&&_<l||f===a&&_===l&&h<i)&&(a=f,l=_,t=u,i=h)}return[t,i]}function b6(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 v6(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 x6({open:n,modelKey:e,onClose:t,onOpenPlayer:i,cookies:a,runningJobs:l,blurPreviews:u,teaserPlayback:h="hover",teaserAudio:f=!1,onToggleWatch:g,onToggleFavorite:_,onToggleLike:S,onToggleHot:C,onDelete:D,onKeep:R,onStopJob:E}){const[B,G]=m.useState([]),[Y,q]=m.useState(null),[se,Q]=m.useState(null),[K,O]=m.useState(null),[re,k]=m.useState(null),[j,te]=m.useState(!1),[V,ne]=m.useState([]),[he,ae]=m.useState(!1),[z,P]=m.useState([]),[Z,ee]=m.useState(!1),fe=m.useRef(0),[,I]=m.useState(0),[pe,ke]=m.useState(null),[,ye]=m.useState(!1),[me,pt]=m.useState(!1),[We,_e]=m.useState(0),[Ye,wt]=m.useState(1),je=4,Se=b6(e),[Je,tt]=m.useState("info"),ot=m.useRef(null),[dt,Ut]=m.useState({}),[Ge,Ie]=m.useState(null),[Ze,et]=m.useState(null),[ft,mt]=m.useState(null),[de,ze]=m.useState({}),[Le,Ae]=m.useState(null),Pe=m.useCallback(ve=>String(ve??"").toLowerCase(),[]),Qe=m.useMemo(()=>new Set,[]),St=m.useMemo(()=>new Set,[]),Ot=m.useMemo(()=>new Set,[]),Tt=m.useMemo(()=>new Set,[]);m.useEffect(()=>{if(!n||!Se)return;const ve=o6.get(Se),rt=P_(u6(Se)),ct=(ve&&rf(ve.at)?ve:null)||(rt&&rf(rt.at)?rt:null);ct&&(q(ct.room??null),Q(ct.meta??null));const jt=B_.get(Se),De=P_(F_(Se)),bt=(jt&&rf(jt.at)?jt:null)||(De&&rf(De.at)?De:null);bt&&(O(bt.bio??null),k(bt.meta??null))},[n,Se]),m.useEffect(()=>{n&&pt(!1)},[n,Se]);const an=m.useCallback(async()=>{if(!Se)return;ot.current?.abort();const ve=new AbortController;ot.current=ve,te(!0);try{const rt=v6(a),ct=`/api/chaturbate/biocontext?model=${encodeURIComponent(Se)}&refresh=1`,jt=await fetch(ct,{cache:"no-store",signal:ve.signal,headers:rt?{"X-Chaturbate-Cookie":rt}:void 0});if(!jt.ok){const Ft=await jt.text().catch(()=>"");throw new Error(Ft||`HTTP ${jt.status}`)}const De=await jt.json().catch(()=>null),bt={enabled:De?.enabled,fetchedAt:De?.fetchedAt,lastError:De?.lastError},xt=De?.bio??null;k(bt),O(xt);const Et={at:Date.now(),bio:xt,meta:bt};B_.set(Se,Et),l6(F_(Se),Et)}catch(rt){if(rt?.name==="AbortError")return;k({enabled:void 0,fetchedAt:void 0,lastError:rt?.message||"Fetch fehlgeschlagen"})}finally{te(!1)}},[Se,a]);m.useEffect(()=>{n||(ot.current?.abort(),ot.current=null)},[n]);const Nt=m.useCallback(async()=>{try{const rt=await(await fetch("/api/models",{cache:"no-store"})).json().catch(()=>null);G(Array.isArray(rt)?rt:[])}catch{}},[]),Lt=m.useCallback(async()=>{if(Se){ae(!0);try{const ve=`/api/record/done?model=${encodeURIComponent(Se)}&page=${Ye}&pageSize=${je}&sort=completed_desc&includeKeep=1&withCount=1`,ct=await(await fetch(ve,{cache:"no-store"})).json().catch(()=>null),jt=Array.isArray(ct?.items)?ct.items:[],De=Number(ct?.count??jt.length);ne(jt),_e(Number.isFinite(De)?De:jt.length)}catch{}finally{ae(!1)}}},[Se,Ye]),vt=m.useRef(Lt);m.useEffect(()=>{vt.current=Lt},[Lt]),m.useEffect(()=>{if(!n)return;const ve=new EventSource("/api/stream"),rt=()=>{},ct=()=>{vt.current()};return ve.addEventListener("jobs",rt),ve.addEventListener("doneChanged",ct),()=>{ve.removeEventListener("jobs",rt),ve.removeEventListener("doneChanged",ct),ve.close()}},[n]);function It(ve){return{id:`model:${ve}`,output:`${ve}_01_01_2000__00-00-00.mp4`,status:"finished"}}const yn=m.useCallback((ve,rt)=>{const ct=String(ve??"").trim();ct&&ke({src:ct,alt:rt})},[]);m.useEffect(()=>{n||I(0)},[n]);const $n=m.useMemo(()=>Array.isArray(l)?l:z,[l,z]);m.useEffect(()=>{n&&wt(1)},[n,e]),m.useEffect(()=>{n&&Nt()},[n,Nt]),m.useEffect(()=>{!n||!Se||Lt()},[n,Se,Lt]),m.useEffect(()=>{if(!n||Array.isArray(l))return;const ve=new AbortController,rt=++fe.current;return ee(!0),fetch("/api/record/jobs",{cache:"no-store",signal:ve.signal}).then(ct=>ct.json()).then(ct=>{ve.signal.aborted||fe.current===rt&&P(Array.isArray(ct)?ct:[])}).catch(()=>{ve.signal.aborted||fe.current===rt&&P([])}).finally(()=>{ve.signal.aborted||fe.current===rt&&ee(!1)}),()=>{ve.abort()}},[n,l]);const kt=m.useMemo(()=>Se?B.find(ve=>(ve.modelKey||"").toLowerCase()===Se)??null:null,[B,Se]),Bn=m.useMemo(()=>{const ve=kt?.cbOnlineJson;if(!ve||typeof ve!="string")return null;try{return JSON.parse(ve)}catch{return null}},[kt]),at=m.useMemo(()=>{const ve=kt?.cbOnlineFetchedAt,rt=kt?.cbOnlineLastError;return!ve&&!rt?null:{enabled:!0,fetchedAt:ve,lastError:rt}},[kt]),N=Y??Bn,F=se??at,ie=V,Me=m.useMemo(()=>Se?$n.filter(ve=>{const rt=g6(ve.output);return rt!=="—"&&rt.trim().toLowerCase()===Se}):[],[$n,Se]),He=N?.display_name||kt?.modelKey||Se||"Model",gt=N?.image_url_360x270||N?.image_url||"",zt=N?.image_url||gt,Jt=N?.chat_room_url_revshare||N?.chat_room_url||"",un=(N?.current_show||"").trim().toLowerCase(),Xt=un?un==="public"?"Public":un==="private"?"Private":un:"",pn=(K?.location||"").trim(),fn=K?.follower_count,Kt=K?.display_age,cn=(K?.room_status||"").trim(),dn=K?.last_broadcast?zc(K.last_broadcast):"—",ln=mf(K?.about_me),qt=mf(K?.wish_list),Rt=kt?.lastSeenOnline==null?"":kt.lastSeenOnline?"online":"offline",Dt=(cn||un||Rt||"").trim(),Cn=Array.isArray(K?.social_medias)?K.social_medias:[],Mt=Array.isArray(K?.photo_sets)?K.photo_sets:[],Pn=Array.isArray(K?.interested_in)?K.interested_in:[],Dn=m.useMemo(()=>{const ve=h6(kt?.tags),rt=Array.isArray(N?.tags)?N.tags:[],ct=new Map;for(const jt of[...ve,...rt]){const De=String(jt).trim().toLowerCase();De&&(ct.has(De)||ct.set(De,String(jt).trim()))}return Array.from(ct.values()).sort((jt,De)=>jt.localeCompare(De,"de"))},[kt?.tags,N?.tags]),Mn=({icon:ve,label:rt,value:ct})=>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:[ve,rt]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:ct})]}),Wt=m.useCallback(ve=>{const rt=String(ve?.id??""),ct=String(ve.output??"");return rt?`${rt}::${ct}`:ct},[]),Vn=m.useCallback(async ve=>{const rt=ve.output||"",ct=vo(rt);if(!ct){await C?.(ve);return}const jt=m6(ct);ne(De=>De.map(bt=>bt.id&&ve.id&&bt.id===ve.id||bt.output&&ve.output&&bt.output===ve.output?{...bt,output:p6(bt.output||"",jt)}:bt)),await C?.(ve),Lt()},[C,Lt]),Yn=m.useCallback((ve,rt,ct)=>{const jt=ve?.meta,De=typeof jt=="string"?(()=>{try{return JSON.parse(jt)}catch{return null}})():jt,bt=typeof De?.previewSprite?.stepSeconds=="number"&&Number.isFinite(De.previewSprite.stepSeconds)&&De.previewSprite.stepSeconds>0?De.previewSprite.stepSeconds:5,xt=Math.max(0,Math.floor(rt)*bt);i?.(ve,xt)},[i]),jn=m.useCallback(async()=>{Se&&(G(ve=>ve.map(rt=>(rt.modelKey||"").toLowerCase()===Se?{...rt,favorite:!rt.favorite}:rt)),await _?.(It(Se)),Nt())},[Se,_,Nt]),Qn=m.useCallback(async()=>{Se&&(G(ve=>ve.map(rt=>(rt.modelKey||"").toLowerCase()===Se?{...rt,liked:rt.liked!==!0}:rt)),await S?.(It(Se)),Nt())},[Se,S,Nt]),mn=m.useCallback(async()=>{Se&&(G(ve=>ve.map(rt=>(rt.modelKey||"").toLowerCase()===Se?{...rt,watching:!rt.watching}:rt)),await g?.(It(Se)),Nt())},[Se,g,Nt]);m.useEffect(()=>{n||(Ie(null),et(null),mt(null),Ae(null),ze({}),Ut({}))},[n,Se]);const Ri=m.useCallback((ve,rt)=>{const ct=Wt(ve);Ut(jt=>jt[ct]===rt?jt:{...jt,[ct]:rt})},[Wt]),Zn=m.useCallback(ve=>{Ie(ve),h==="hover"&&et(ve)},[h]),Kn=m.useCallback(ve=>{const rt=Wt(ve),ct=ve?.durationSeconds??ve?.meta?.durationSeconds??dt[rt],jt=typeof ct=="number"&&Number.isFinite(ct)?ct>1440*60?ct/1e3:ct:null;return _g(jt)},[dt,Wt]),ni=m.useCallback(ve=>{const rt=ve?.sizeBytes??ve?.size??ve?.meta?.sizeBytes??ve?.meta?.size;return typeof rt=="number"&&Number.isFinite(rt)?rt:null},[]),Si=m.useCallback(ve=>d6(ve??null),[]),An=m.useCallback((ve,rt)=>{ze(ct=>{if(rt===void 0){if(!(ve in ct))return ct;const jt={...ct};return delete jt[ve],jt}return ct[ve]===rt?ct:{...ct,[ve]:rt}})},[]),Fn=m.useCallback(ve=>An(ve,void 0),[An]);m.useEffect(()=>{n&&tt("info")},[n,Se]);const Hn=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:We?el(We):void 0,disabled:he},{id:"running",label:"Running",count:Me.length?el(Me.length):void 0,disabled:Z}];return c.jsxs(Tf,{open:n,onClose:t,title:He,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:gt||void 0,mobileCollapsedImageAlt:He,rightBodyClassName:"pt-0 sm:pt-2",titleRight:Je==="info"?c.jsx(en,{variant:"secondary",className:ii("h-8 px-2 sm:h-9 sm:px-3","whitespace-nowrap"),disabled:j||!e,onClick:()=>{an()},title:"BioContext neu abrufen",children:c.jsxs("span",{className:"inline-flex items-center gap-2",children:[c.jsx(NA,{className:ii("size-4",j?"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:[gt?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>yn(zt,He),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:gt,alt:He,className:ii("h-24 sm:h-52 w-full object-cover transition",sf(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:[Xt?c.jsx("span",{className:ss("bg-emerald-500/10 text-emerald-900 ring-emerald-200 backdrop-blur dark:text-emerald-200 dark:ring-emerald-400/20"),children:Xt}):null,Dt?c.jsx("span",{className:ss(Dt.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:Dt}):null,N?.is_hd?c.jsx("span",{className:ss("bg-indigo-500/10 text-indigo-900 ring-indigo-200 backdrop-blur dark:text-indigo-200 dark:ring-indigo-400/20"),children:"HD"}):null,N?.is_new?c.jsx("span",{className:ss("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:N?.display_name||N?.username||kt?.modelKey||Se||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:N?.username?`@${N.username}`:kt?.modelKey?`@${kt.modelKey}`:""})]}),c.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),mn()},className:ii("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",kt?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:kt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!kt?.watching,"aria-label":kt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(yl,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),jn()},className:ii("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",kt?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:kt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!kt?.favorite,"aria-label":kt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(_f,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(vu,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),Qn()},className:ii("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",kt?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:kt?.liked?"Like entfernen":"Liken","aria-pressed":kt?.liked===!0,"aria-label":kt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(ed,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(bl,{className:ii("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",kt?.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(Mn,{icon:c.jsx(O1,{className:"size-4"}),label:"Viewer",value:el(N?.num_users)}),c.jsx(Mn,{icon:c.jsx(Cm,{className:"size-4"}),label:"Follower",value:el(N?.num_followers??fn)})]}),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(rN,{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:N?.location||pn||"—"})]}),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(JA,{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:N?.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(Em,{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:_g(N?.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(ed,{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:Kt!=null?String(Kt):N?.age!=null?String(N.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(Em,{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:dn})]})]}),F?.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."}):F?.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: ",U_(F.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:z_(F.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"}),Dn.length?c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Dn.map(ve=>c.jsx(ms,{tag:ve},ve))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:c.jsxs("div",{className:ii("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:[gt?c.jsx("button",{type:"button",className:"absolute inset-0 block w-full",onClick:()=>zt?yn(zt,He):void 0,"aria-label":"Bild vergrößern",children:c.jsx("img",{src:zt||gt,alt:He,className:ii("h-full w-full object-cover",sf(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:N?.display_name||N?.username||kt?.modelKey||Se||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:N?.username?`@${N.username}`:kt?.modelKey?`@${kt.modelKey}`:""})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),mn()},className:ii("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",kt?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/30 ring-white/20"),title:kt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!kt?.watching,"aria-label":kt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:ii("absolute inset-0 size-4","text-white/70")}),c.jsx(yl,{className:ii("absolute inset-0 size-4",kt?.watching?"opacity-100":"opacity-0","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),jn()},className:ii("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",kt?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/30 ring-white/20"),title:kt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!kt?.favorite,"aria-label":kt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(_f,{className:ii("absolute inset-0 size-4","text-white/70")}),c.jsx(vu,{className:ii("absolute inset-0 size-4",kt?.favorite?"opacity-100":"opacity-0","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),Qn()},className:ii("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",kt?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/30 ring-white/20"),title:kt?.liked?"Like entfernen":"Liken","aria-pressed":kt?.liked===!0,"aria-label":kt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(ed,{className:ii("absolute inset-0 size-4","text-white/70")}),c.jsx(bl,{className:ii("absolute inset-0 size-4",kt?.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:[Xt?c.jsx("span",{className:ss("bg-white/15 text-white ring-white/20"),children:Xt}):null,Dt?c.jsx("span",{className:ss((Dt||"").toLowerCase()==="online"?"bg-emerald-500/25 text-white ring-emerald-200/30":"bg-white/15 text-white ring-white/20"),children:Dt}):null,N?.is_hd?c.jsx("span",{className:ss("bg-white/15 text-white ring-white/20"),children:"HD"}):null,N?.is_new?c.jsx("span",{className:ss("bg-white/15 text-white ring-white/20"),children:"NEW"}):null]}),Jt?c.jsx("div",{className:"absolute right-3 bottom-3",children:c.jsxs("a",{href:Jt,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(Gh,{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(O1,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:el(N?.num_users)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Cm,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:el(N?.num_followers??fn)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(UA,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:_g(N?.seconds_online)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Em,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:K?.last_broadcast?f6(K.last_broadcast):"—"})]})]}),F?.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."}):F?.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: ",F.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: ",U_(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:z_(re.lastError)})]})]}):null]})]}),Dn.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:["(",Dn.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:[Dn.slice(0,20).map(ve=>c.jsx(ms,{tag:ve},ve)),Dn.length>20?c.jsxs("span",{className:ss("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:["+",Dn.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:[F?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",zc(F.fetchedAt)]}):null,re?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",zc(re.fetchedAt)]}):null,kt?.lastSeenOnlineAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",c.jsx("span",{className:"font-medium",children:kt.lastSeenOnline==null?"—":kt.lastSeenOnline?"online":"offline"})," ","(",zc(kt.lastSeenOnlineAt),")"]}):null]}):"—"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-2",children:Jt?c.jsxs("a",{href:Jt,target:"_blank",rel:"noreferrer",className:ii("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(Gh,{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(Rg,{tabs:Hn,value:Je,onChange:ve=>tt(ve),variant:"pillsBrand",ariaLabel:"Bereich auswählen"})})})})]}),footer:c.jsx("div",{className:"w-full",children:c.jsx(en,{variant:"secondary",className:"w-full sm:w-auto",onClick:t,children:"Schließen"})}),children:[c.jsxs("div",{className:"min-h-0",children:[Je==="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:N?.room_subject?c.jsx("p",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:N.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"}),j?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(XA,{className:"size-4"}),"Über mich"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:ln?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:ln}):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(Cm,{className:"size-4"}),"Wishlist"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:qt?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:qt}):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:K?.real_name?mf(K.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:K?.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:K?.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:K?.sex||"—"})]})]}),Pn.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:Pn.map(ve=>c.jsx("span",{className:ss("bg-sky-500/10 text-sky-900 ring-sky-200 dark:text-sky-200 dark:ring-sky-400/20"),children:ve},ve))})]}):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"}),Cn.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Cn.length," Links"]}):null]}),Cn.length?c.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:Cn.map(ve=>{const rt=y6(ve.link);return c.jsxs("a",{href:rt,target:"_blank",rel:"noreferrer",className:ii("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:ve.title_name,children:[c.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:ve.image_url?c.jsx("img",{src:ve.image_url,alt:"",className:"size-5"}):c.jsx(tN,{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:ve.title_name}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:ve.label_text?ve.label_text:ve.tokens!=null?`${ve.tokens} token(s)`:"Link"})]}),c.jsx(Gh,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},ve.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"}),Mt.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Mt.length," Sets"]}):null]}),Mt.length?c.jsx("div",{className:"mt-2 grid gap-3 sm:grid-cols-2",children:Mt.slice(0,6).map(ve=>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:[ve.cover_url?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>yn(ve.cover_url,ve.name),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:ve.cover_url,alt:ve.name,className:ii("h-28 w-full object-cover transition",sf(u))})}):c.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:c.jsx(aN,{className:"size-6 text-gray-500"})}),c.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[ve.is_video?c.jsx("span",{className:ss("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:ss("bg-gray-500/10 text-gray-900 ring-gray-200 dark:text-gray-200 dark:ring-white/15"),children:"Photos"}),ve.fan_club_only?c.jsx("span",{className:ss("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:ve.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:el(ve.tokens)}),ve.user_can_access===!0?c.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},ve.id))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,Je==="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(kf,{page:Ye,pageSize:je,totalItems:We,onPageChange:ve=>wt(ve),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:he?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):ie.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:ie.map(ve=>{const rt=Wt(ve),jt=!(!!f&&Ge===rt),De=vo(ve.output||""),bt=dy(De),xt=wo(De),Et=Kn(ve),Ft=Si(ni(ve)),$t=$_(ve?.meta),Vt=typeof $t?.videoWidth=="number"&&typeof $t?.videoHeight=="number"&&$t.videoWidth>0&&$t.videoHeight>0?{w:$t.videoWidth,h:$t.videoHeight}:typeof ve?.videoWidth=="number"&&typeof ve?.videoHeight=="number"&&ve.videoWidth>0&&ve.videoHeight>0?{w:ve.videoWidth,h:ve.videoHeight}:null,vn=dd(Vt),qn=Qe.has(rt)||St.has(rt)||Ot.has(rt),Yi=Tt.has(rt),Gn=!!kt?.favorite,ki=kt?.liked===!0,Ei=!!kt?.watching,si=Dn,mi=af(zt,gt),Sn=wo(vo(ve.output||"")).replace(/\.[^.]+$/,"").trim(),Jn=af($t?.previewSprite?.path,$t?.previewSpritePath,Sn?`/api/preview-sprite/${encodeURIComponent(Sn)}`:void 0),wn=Jn?Jn.replace(/\/+$/,""):void 0,Ci=$t?.previewSprite?.stepSeconds??$t?.previewSpriteStepSeconds,Oi=typeof Ci=="number"&&Number.isFinite(Ci)&&Ci>0?Ci:H_,ei=tu($t?.durationSeconds)??tu(ve?.durationSeconds)??tu(dt[rt]),Li=typeof ei=="number"&&ei>0?Math.max(1,Math.min(200,Math.floor(ei/Oi)+1)):void 0,we=$t?.previewSprite?.count??$t?.previewSpriteCount??Li,L=$t?.previewSprite?.cols??$t?.previewSpriteCols,$=$t?.previewSprite?.rows??$t?.previewSpriteRows,xe=typeof we=="number"&&Number.isFinite(we)?Math.max(0,Math.floor(we)):0,[Te,Ve]=xe>1?q_(xe):[0,0],qe=typeof L=="number"&&Number.isFinite(L)?Math.max(0,Math.floor(L)):Te,U=typeof $=="number"&&Number.isFinite($)?Math.max(0,Math.floor($)):Ve,W=(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,le=wn&&W?`${wn}?v=${encodeURIComponent(String(W))}`:wn||void 0,be=!!le&&xe>1,Ce=be&&qe>0&&U>0,Oe=be?xe:0,ht=be?Oi:0,At=be,yt=de[rt],rn=typeof yt=="number"&&Oe>1?of(yt/(Oe-1),0,1):void 0,Yt=Ce&&typeof yt=="number"?(()=>{const xn=of(yt,0,Math.max(0,xe-1)),Os=xn%qe,sa=Math.floor(xn/qe),Ar=qe<=1?0:Os/(qe-1)*100,ci=U<=1?0:sa/(U-1)*100;return{backgroundImage:`url("${le}")`,backgroundRepeat:"no-repeat",backgroundSize:`${qe*100}% ${U*100}%`,backgroundPosition:`${Ar}% ${ci}%`}})():void 0,Rn=ft===rt&&!!mi,ui=!Rn&&!!Yt,Kr=Rn||ui;return Yi?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",qn&&"pointer-events-none opacity-70",Ot.has(rt)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),onClick:()=>i?.(ve),onKeyDown:xn=>{(xn.key==="Enter"||xn.key===" ")&&i?.(ve)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:()=>{Ae(rt),Zn(rt)},onMouseLeave:()=>{Ae(null),Zn(null),Fn(rt),mt(xn=>xn===rt?null:xn)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:ve,getFileName:xn=>wo(vo(xn)),durationSeconds:dt[rt]??ve?.durationSeconds,onDuration:Ri,variant:"fill",showPopover:!1,blur:u,animated:Kr?!1:h==="all"?!0:h==="hover"?Ze===rt:!1,animatedMode:"teaser",animatedTrigger:"always",muted:jt,popoverMuted:jt,scrubProgressRatio:rn,preferScrubProgress:typeof yt=="number"})}),Ce&&le?c.jsx("img",{src:le,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,ui&&Yt?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:Yt})}):null,Rn&&mi?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:mi,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,At&&Le===rt?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:xn=>xn.stopPropagation(),onMouseDown:xn=>xn.stopPropagation(),children:c.jsx(by,{className:"pointer-events-auto px-1",imageCount:Oe,activeIndex:yt,onActiveIndexChange:xn=>An(rt,xn),onIndexClick:xn=>{An(rt,xn),Yn(ve,xn,Oe)},stepSeconds:ht})}):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:[Et,Vt?`${Vt.w}×${Vt.h}`:vn||"",Ft].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Et}),vn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,vn?c.jsx("span",{children:vn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Ft})]})})]})}),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:[bt?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:xt||"—",children:xt||"—"})]})}),c.jsx("div",{className:"mt-2",onClick:xn=>xn.stopPropagation(),onMouseDown:xn=>xn.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(Ds,{job:ve,variant:"table",busy:qn,collapseToMenu:!0,compact:!0,isHot:bt,isFavorite:Gn,isLiked:ki,isWatching:Ei,onToggleWatch:g,onToggleFavorite:_,onToggleLike:S,onToggleHot:async xn=>(await Vn(xn),!0),onKeep:async xn=>{try{return await R?.(xn),!0}catch{return!1}},onDelete:async xn=>{try{return await D?.(xn),!0}catch{return!1}},order:["hot","keep","delete"],className:"w-full gap-1.5"})})}),c.jsx("div",{className:"mt-2",onClick:xn=>xn.stopPropagation(),onMouseDown:xn=>xn.stopPropagation(),children:c.jsx(cd,{rowKey:rt,tags:si,activeTagSet:new Set,lower:Pe,onToggleTagFilter:()=>{}})})]})]},rt)})})})]})}):null,Je==="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"}),Z?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsx("div",{className:"mt-3",children:Z?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):Me.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Kein laufender Job."}):(()=>{const ve=Me[0],rt=Wt(ve),jt=!(!!f&&Ge===rt),De=vo(ve.output||""),bt=dy(De),xt=wo(De)||"—",Et=$_(ve?.meta),Ft=typeof Et?.videoWidth=="number"&&typeof Et?.videoHeight=="number"&&Et.videoWidth>0&&Et.videoHeight>0?{w:Et.videoWidth,h:Et.videoHeight}:typeof ve?.videoWidth=="number"&&typeof ve?.videoHeight=="number"&&ve.videoWidth>0&&ve.videoHeight>0?{w:ve.videoWidth,h:ve.videoHeight}:null,$t=dd(Ft),Vt=Kn(ve),vn=Si(ni(ve)),qn=Dn,Yi=af(zt,gt),ki=wo(vo(ve.output||"")).replace(/\.[^.]+$/,"").trim(),Ei=af(Et?.previewSprite?.path,Et?.previewSpritePath,ki?`/api/preview-sprite/${encodeURIComponent(ki)}`:void 0),si=Ei?Ei.replace(/\/+$/,""):void 0,mi=Et?.previewSprite?.stepSeconds??Et?.previewSpriteStepSeconds,Pi=typeof mi=="number"&&Number.isFinite(mi)&&mi>0?mi:H_,Sn=tu(Et?.durationSeconds)??tu(ve?.durationSeconds)??tu(dt[rt]),Jn=typeof Sn=="number"&&Sn>0?Math.max(1,Math.min(200,Math.floor(Sn/Pi)+1)):void 0,wn=Et?.previewSprite?.count??Et?.previewSpriteCount??Jn,Ci=Et?.previewSprite?.cols??Et?.previewSpriteCols,Oi=Et?.previewSprite?.rows??Et?.previewSpriteRows,ei=typeof wn=="number"&&Number.isFinite(wn)?Math.max(0,Math.floor(wn)):0,[Li,we]=ei>1?q_(ei):[0,0],L=typeof Ci=="number"&&Number.isFinite(Ci)?Math.max(0,Math.floor(Ci)):Li,$=typeof Oi=="number"&&Number.isFinite(Oi)?Math.max(0,Math.floor(Oi)):we,xe=(typeof Et?.updatedAtUnix=="number"&&Number.isFinite(Et.updatedAtUnix)?Et.updatedAtUnix:void 0)??(typeof Et?.fileModUnix=="number"&&Number.isFinite(Et.fileModUnix)?Et.fileModUnix:void 0)??0,Te=si&&xe?`${si}?v=${encodeURIComponent(String(xe))}`:si||void 0,Ve=!!Te&&ei>1,qe=Ve&&L>0&&$>0,U=Ve?ei:0,W=de[rt],le=typeof W=="number"&&U>1?of(W/(U-1),0,1):void 0,be=qe&&typeof W=="number"?(()=>{const yt=of(W,0,Math.max(0,ei-1)),rn=yt%L,Yt=Math.floor(yt/L),Rn=L<=1?0:rn/(L-1)*100,ui=$<=1?0:Yt/($-1)*100;return{backgroundImage:`url("${Te}")`,backgroundRepeat:"no-repeat",backgroundSize:`${L*100}% ${$*100}%`,backgroundPosition:`${Rn}% ${ui}%`}})():void 0,Ce=ft===rt&&!!Yi,ht=Ce||!Ce&&!!be,At=xg(ve);return c.jsx("div",{className:"w-full",children:c.jsxs("div",{className:ii("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:ii("group/thumb relative w-full bg-black/5 dark:bg-white/5","aspect-video sm:aspect-[21/9]",i?"cursor-pointer":""),onClick:()=>i?.(ve),onKeyDown:yt=>{i&&(yt.key==="Enter"||yt.key===" ")&&i(ve)},onMouseEnter:()=>{ye(!0),Ae(rt),Zn(rt)},onMouseLeave:()=>{ye(!1),Ae(null),Zn(null),Fn(rt),mt(yt=>yt===rt?null:yt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[At?null:c.jsx("div",{className:"absolute inset-0",children:c.jsx(xu,{job:ve,getFileName:yt=>wo(vo(yt)),durationSeconds:dt[rt]??ve?.durationSeconds,onDuration:Ri,variant:"fill",showPopover:!1,blur:u,animated:ht?!1:h==="all"?!0:h==="hover"?Ze===rt:!1,animatedMode:"teaser",animatedTrigger:"always",muted:jt,popoverMuted:jt,scrubProgressRatio:le,preferScrubProgress:typeof W=="number"})}),At?c.jsxs("div",{className:"absolute inset-0 z-10",children:[c.jsx(rb,{src:`/api/preview/live?id=${encodeURIComponent(String(ve?.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:[Vt,Ft?`${Ft.w}×${Ft.h}`:$t||"",vn].filter(Boolean).join(" • "),children:c.jsx("span",{children:vn})})})]})}),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:[bt?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:xt,children:xt})]}),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:zc(ve?.startedAt)})," · ","Status:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:String(ve?.status??"running")})]})]}),c.jsx("div",{className:"mt-2",onClick:yt=>yt.stopPropagation(),onMouseDown:yt=>yt.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(en,{variant:"primary",color:"red",size:"sm",rounded:"md",className:"w-full shadow-none",disabled:!E||!xg(ve)||me,title:me?"Stoppe…":"Stop","aria-label":me?"Stoppe…":"Stop",onClick:async yt=>{if(yt.preventDefault(),yt.stopPropagation(),!!E&&xg(ve)&&!me)try{pt(!0),await E(String(ve?.id??""))}finally{pt(!1)}},children:me?"Stoppe…":"Stoppen"})})}),c.jsx("div",{className:"mt-2",onClick:yt=>yt.stopPropagation(),onMouseDown:yt=>yt.stopPropagation(),children:c.jsx(cd,{rowKey:rt,tags:qn,activeTagSet:new Set,lower:Pe,onToggleTagFilter:()=>{}})})]})]})})})()})]})}):null]}),c.jsx(Tf,{open:!!pe,onClose:()=>ke(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(Gh,{className:"size-4"}),"In neuem Tab"]}):null,c.jsx(en,{variant:"secondary",onClick:()=>ke(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:ii("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",sf(u))}):null})})]})}const lf=n=>Math.max(0,Math.min(1,n));function uf(n){return n==="good"?"bg-emerald-500":n==="warn"?"bg-amber-500":"bg-red-500"}function _6(n){return n==null?"–":`${Math.round(n)}ms`}function V_(n){return n==null?"–":`${Math.round(n)}%`}function wg(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 w6(n=1e3){const[e,t]=Zt.useState(null);return Zt.useEffect(()=>{let i=0,a=performance.now(),l=0,u=!0,h=!1;const f=C=>{if(!u||!h)return;l+=1;const D=C-a;if(D>=n){const R=Math.round(l*1e3/D);t(R),l=0,a=C}i=requestAnimationFrame(f)},g=()=>{u&&(document.hidden||h||(h=!0,a=performance.now(),l=0,i=requestAnimationFrame(f)))},_=()=>{h=!1,cancelAnimationFrame(i)},S=()=>{document.hidden?_():g()};return g(),document.addEventListener("visibilitychange",S),()=>{u=!1,document.removeEventListener("visibilitychange",S),_()}},[n]),e}function G_({mode:n="inline",className:e,pollMs:t=1e3}){const i=w6(1e3),[a,l]=Zt.useState(null),[u,h]=Zt.useState(null),[f,g]=Zt.useState(null),[_,S]=Zt.useState(null),[C,D]=Zt.useState(null),R=5*1024*1024*1024,E=8*1024*1024*1024,B=Zt.useRef(!1),G=Zt.useRef(0);Zt.useEffect(()=>{const he=ll("/api/stream","perf",ae=>{const z=Date.now();if(z-G.current<t)return;G.current=z;const P=typeof ae?.cpuPercent=="number"?ae.cpuPercent:null,Z=typeof ae?.diskFreeBytes=="number"?ae.diskFreeBytes:null,ee=typeof ae?.diskTotalBytes=="number"?ae.diskTotalBytes:null,fe=typeof ae?.diskUsedPercent=="number"?ae.diskUsedPercent:null;h(P),g(Z),S(ee),D(fe);const I=typeof ae?.serverMs=="number"?ae.serverMs:null;l(I!=null?Math.max(0,Date.now()-I):null)});return()=>he()},[t]);const Y=a==null?"bad":a<=120?"good":a<=300?"warn":"bad",q=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",se=u==null?"bad":u<=60?"good":u<=85?"warn":"bad",Q=lf((a??999)/500),K=lf((i??0)/60),O=lf((u??0)/100),re=f!=null&&_!=null&&_>0?f/_:null,k=C??(re!=null?(1-re)*100:null),j=lf((k??0)/100);f==null?B.current=!1:B.current?f>=E&&(B.current=!1):f<=R&&(B.current=!0);const te=f==null||B.current||re==null?"bad":re>=.15?"good":re>=.07?"warn":"bad",V=f==null?"Disk: –":`Free: ${wg(f)} / Total: ${wg(_)} · Used: ${V_(k)}`,ne=n==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return c.jsx("div",{className:`${ne} ${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:V,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 ${uf(te)}`,style:{width:`${Math.round(j*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:wg(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 ${uf(Y)}`,style:{width:`${Math.round(Q*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:_6(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 ${uf(q)}`,style:{width:`${Math.round(K*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 ${uf(se)}`,style:{width:`${Math.round(O*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:V_(u)})]})]})})}async function Tg(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 T6(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 K_(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function Nk(n){return String(n||"").replaceAll("\\","/").split("/").pop()||""}function Dk(n){return n.toUpperCase().startsWith("HOT ")?n.slice(4).trim():n}function S6(n){const e=Dk(Nk(n||""));return e?e.replace(/\.[^.]+$/,""):""}const k6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Sg(n){const t=Dk(Nk(n)).replace(/\.[^.]+$/,""),i=t.match(k6);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 E6(n){const e=S6(n);return e?`/generated/meta/${encodeURIComponent(e)}/preview.webp`:null}async function C6(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 A6(){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({}),[_,S]=m.useState({}),[C,D]=m.useState(!1),[R,E]=m.useState(null),[B,G]=m.useState({}),Y=m.useRef(null),q=m.useRef({}),se=m.useCallback((k,j)=>{const te={};for(const ne of Array.isArray(k)?k:[]){const he=String(ne?.modelKey??"").trim().toLowerCase();if(!he)continue;const ae=K_(ne?.tags).map(z=>z.toLowerCase());ae.length&&(te[he]=ae)}const V={};for(const ne of Array.isArray(j)?j:[]){const he=String(ne?.output??"");if(!he)continue;const ae=(Sg(he)||"").trim().toLowerCase();if(!ae)continue;const z=te[ae];if(!(!z||z.length===0))for(const P of z)P&&(V[P]||(V[P]=[]),V[P].push(he))}for(const[ne,he]of Object.entries(V))V[ne]=Array.from(new Set(he));q.current=V},[]),Q=m.useCallback(k=>{const j=String(k||"").trim();if(j){try{localStorage.setItem("finishedDownloads_pendingTags",JSON.stringify([j]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"finished"}})),window.dispatchEvent(new CustomEvent("finished-downloads:tag-filter",{detail:{tags:[j],mode:"replace"}}))}},[]),K=m.useCallback(k=>{const j=String(k||"").trim();if(j){try{localStorage.setItem("models_pendingTags",JSON.stringify([j]))}catch{}window.dispatchEvent(new CustomEvent("app:navigate-tab",{detail:{tab:"models"}})),window.dispatchEvent(new CustomEvent("models:set-tag-filter",{detail:{tags:[j]}}))}},[]),O=m.useCallback(async()=>{Y.current?.abort();const k=new AbortController;Y.current=k,i(!0),l(null);try{const[j,te]=await Promise.all([Tg("/api/models",{cache:"no-store",signal:k.signal}),Tg("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:k.signal})]),V=Array.isArray(te?.items)?te.items:Array.isArray(te)?te:[];se(Array.isArray(j)?j:[],V);const ne=new Map;for(const ee of Array.isArray(j)?j:[])for(const fe of K_(ee?.tags)){const I=fe.toLowerCase();ne.set(I,(ne.get(I)??0)+1)}const he=q.current||{},ae=Array.from(ne.entries()).map(([ee,fe])=>({tag:ee,modelsCount:fe,downloadsCount:(he[ee]||[]).length})).sort((ee,fe)=>ee.tag.localeCompare(fe.tag,void 0,{sensitivity:"base"})),z=new Map;try{const ee=await Tg("/api/generated/coverinfo/list",{cache:"no-store",signal:k.signal});for(const fe of Array.isArray(ee)?ee:[]){const I=String(fe?.category??"").trim().toLowerCase();I&&z.set(I,fe)}}catch{}const P={};for(const ee of ae){const fe=z.get(ee.tag);P[ee.tag]=!!fe?.hasCover}S(P);const Z={};for(const ee of ae){const I=(he[ee.tag]||[])[0]||"";let pe=I?Sg(I):null;if(!pe){const ke=z.get(ee.tag);ke?.hasCover&&ke.model?.trim()&&(pe=ke.model.trim())}pe&&(Z[ee.tag]=pe)}G(Z),g(ee=>{const fe={};for(const I of ae){const pe=ee[I.tag];pe&&P[I.tag]===!0&&(fe[I.tag]=pe)}return fe}),e(ae)}catch(j){if(j?.name==="AbortError")return;l(j?.message??String(j)),e([]),q.current={},G({}),S({}),g({})}finally{Y.current===k&&(Y.current=null,i(!1))}},[se]);m.useEffect(()=>(O(),()=>{Y.current?.abort()}),[O]);const re=m.useCallback(async()=>{if(!C){D(!0),l(null),E({done:0,total:n.length});try{const k=q.current||{},j=await Promise.all(n.map(async V=>{try{const ne=k[V.tag]||[];if(ne.length===0)return{tag:V.tag,ok:!0,status:0,text:"skipped (no candidates)"};const he=ne[Math.floor(Math.random()*ne.length)],ae=E6(he);if(!ae)return{tag:V.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const z=Sg(he);return await C6(V.tag,ae,z,!0),S(P=>({...P,[V.tag]:!0})),G(P=>{const Z={...P};return z?.trim()?Z[V.tag]=z.trim():delete Z[V.tag],Z}),g(P=>{const Z={...P};return delete Z[V.tag],Z}),{tag:V.tag,ok:!0,status:200,text:""}}catch(ne){return{tag:V.tag,ok:!1,status:0,text:ne?.message??String(ne)}}finally{E(ne=>ne&&{...ne,done:Math.min(ne.total,ne.done+1)})}})),te=j.filter(V=>!V.ok);if(te.length){console.warn("Cover renew failed:",te.slice(0,20));const V=te.slice(0,8).map(ne=>`${ne.tag} (ERR)`).join(", ");l(`Covers fehlgeschlagen: ${te.length}/${j.length} — z.B.: ${V}`)}else l(null)}finally{h(Date.now()),D(!1),setTimeout(()=>E(null),400)}}},[n,C]);return c.jsxs(Ns,{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:[R?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: ",R.done,"/",R.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:R.total>0?`${Math.round(R.done/R.total*100)}%`:"0%"}})})]}):null,c.jsx(en,{variant:"secondary",size:"md",onClick:re,disabled:t||C,children:"Cover erneuern"}),c.jsx(en,{variant:"secondary",size:"md",onClick:O,disabled:t||C,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(k=>{const j=B[k.tag]??null,te=_[k.tag]===!0,V=Object.prototype.hasOwnProperty.call(_,k.tag),ne=te?T6(k.tag,u,!1,j):"",he=f[k.tag]==="ok",ae=f[k.tag]==="error";return c.jsxs("button",{type:"button",onClick:()=>Q(k.tag),className:nn("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:V?te?ae?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:z=>{z.preventDefault(),z.stopPropagation(),g(P=>{const Z={...P};return delete Z[k.tag],Z}),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:ne,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:ne,alt:k.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>g(z=>({...z,[k.tag]:"ok"})),onError:()=>{g(z=>({...z,[k.tag]:"error"})),S(z=>({...z,[k.tag]:!1}))}}),he&&j?c.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:c.jsx("div",{className:nn("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:j})}):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"}),j?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:j})]}):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:k.tag}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{role:"button",tabIndex:0,className:nn("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:z=>{z.preventDefault(),z.stopPropagation(),Q(k.tag)},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),z.stopPropagation(),Q(k.tag))},children:[c.jsx("span",{className:"shrink-0",children:k.downloadsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Downloads"})]}),c.jsxs("span",{role:"button",tabIndex:0,className:nn("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:z=>{z.preventDefault(),z.stopPropagation(),K(k.tag)},onKeyDown:z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),z.stopPropagation(),K(k.tag))},children:[c.jsx("span",{className:"shrink-0",children:k.modelsCount}),c.jsx("span",{className:"min-w-0 truncate font-medium",children:"Models"})]})]})]}),c.jsx("span",{"aria-hidden":"true",className:nn("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},k.tag)})})]})}async function $c(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 N6(){try{const e=new URL(window.location.href).searchParams.get("next")||"/";return!e.startsWith("/")||e.startsWith("/login")?"/":e}catch{return"/"}}const ob="recorder_login_state_v1";function D6(){try{const n=sessionStorage.getItem(ob);if(!n)return null;const e=JSON.parse(n);return!e?.ts||Date.now()-e.ts>900*1e3?null:e}catch{return null}}function M6(n){try{sessionStorage.setItem(ob,JSON.stringify(n))}catch{}}function cf(){try{sessionStorage.removeItem(ob)}catch{}}function j6(n){const t=(n??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function R6(n){return(n??[]).join("")}function O6({onLoggedIn:n}){const e=m.useMemo(()=>N6(),[]),[t,i]=m.useState(""),[a,l]=m.useState(""),[u,h]=m.useState(["","","","","",""]),f=m.useRef([]),[g,_]=m.useState(!1),[S,C]=m.useState(null),[D,R]=m.useState("login"),[E,B]=m.useState(null),[G,Y]=m.useState(null),[q,se]=m.useState(null),Q=m.useRef(!1),K=m.useMemo(()=>R6(u),[u]);function O(P){const Z=f.current[P];Z&&Z.focus()}function re(){h(["","","","","",""]),Q.current=!1,window.setTimeout(()=>O(0),0)}function k(P,Z){const ee=(Z??"").replace(/\D/g,"").slice(-1);h(fe=>{const I=[...fe];return I[P]=ee,I})}function j(P,Z){const ee=(Z??"").replace(/\D/g,"");if(!ee){k(P,""),Q.current=!1;return}if(ee.length>1){h(fe=>{const I=[...fe];let pe=P;for(const ke of ee){if(pe>5)break;I[pe]=ke,pe++}return I}),Q.current=!1,window.setTimeout(()=>O(Math.min(5,P+ee.length)),0);return}k(P,ee),Q.current=!1,P<5&&window.setTimeout(()=>O(P+1),0)}function te(P,Z){if(Z.key==="Backspace"){if(u[P]){Z.preventDefault(),k(P,""),Q.current=!1;return}P>0&&(Z.preventDefault(),O(P-1),k(P-1,""),Q.current=!1);return}if(Z.key==="ArrowLeft"){Z.preventDefault(),P>0&&O(P-1);return}if(Z.key==="ArrowRight"){Z.preventDefault(),P<5&&O(P+1);return}}function V(P,Z){const fe=(Z.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);fe&&(Z.preventDefault(),h(I=>{const pe=[...I];let ke=P;for(const ye of fe){if(ke>5)break;pe[ke]=ye,ke++}return pe}),Q.current=!1,window.setTimeout(()=>O(Math.min(5,P+fe.length)),0))}m.useEffect(()=>{const P=D6();P&&(R(P.stage??"login"),i(P.username??""),h(j6(P.code??"")),B(P.setupAuthUrl??null),Y(P.setupSecret??null),se(P.setupInfo??null))},[]),m.useEffect(()=>{M6({stage:D,username:t,code:K,setupAuthUrl:E,setupSecret:G,setupInfo:q,ts:Date.now()})},[D,t,K,E,G,q]),m.useEffect(()=>{Q.current=!1,(D==="verify"||D==="setup")&&window.setTimeout(()=>O(0),0)},[D]),m.useEffect(()=>{let P=!1;return(async()=>{try{const ee=await $c("/api/auth/me",{cache:"no-store"});if(P)return;if(ee?.authenticated){ee?.totpConfigured?(cf(),window.location.assign(e||"/")):(R("setup"),ae());return}if(ee?.pending2fa){R("verify");return}R("login")}catch{}})(),()=>{P=!0}},[e]);const ne=async()=>{_(!0),C(null);try{if((await $c("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:a})}))?.totpRequired){R("verify"),re();return}const Z=await $c("/api/auth/me",{cache:"no-store"});if(Z?.authenticated&&!Z?.totpConfigured){R("setup"),re(),await ae();return}n&&await n(),cf(),window.location.assign(e||"/")}catch(P){C(P?.message??String(P))}finally{_(!1)}},he=async()=>{const P=K.trim();if(/^\d{6}$/.test(P)){_(!0),C(null);try{await $c("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:P})}),n&&await n(),cf(),window.location.assign(e||"/")}catch(Z){Q.current=!1,C(Z?.message??String(Z))}finally{_(!1)}}},ae=async()=>{C(null),se(null);try{const P=await $c("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Z=(P?.otpauth??"").trim();if(!Z)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");B(Z),Y((P?.secret??"").trim()||null),se("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(P){C(P?.message??String(P))}};m.useEffect(()=>{g||D!=="verify"&&D!=="setup"||/^\d{6}$/.test(K)&&(Q.current||(Q.current=!0,he()))},[K,D,g]);const z=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((P,Z)=>c.jsx("input",{ref:ee=>{f.current[Z]=ee},value:P,onChange:ee=>j(Z,ee.target.value),onKeyDown:ee=>te(Z,ee),onPaste:ee=>V(Z,ee),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:Z===0?"one-time-code":"off",enterKeyHint:Z===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 ${Z+1}`},Z))})]});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:[D==="login"?c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&ne()},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:P=>i(P.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:P=>l(P.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(en,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:g||!t.trim()||!a,children:g?"Login…":"Login"})]}):D==="verify"?c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&he()},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."}),z,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(en,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{R("login"),re()},children:"Zurück"}),c.jsx(en,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(K),children:g?"Prüfe…":"Bestätigen"})]})]}):c.jsxs("form",{onSubmit:P=>{P.preventDefault(),!g&&he()},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"}),E?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(E)}`})}):c.jsx("div",{className:"mt-2 text-xs text-gray-600 dark:text-gray-300",children:"QR wird geladen…"}),G?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:G})]}):null,q?c.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:q}):null,c.jsx("div",{className:"mt-3",children:c.jsx(en,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:g,onClick:()=>{ae()},title:"Setup-Infos neu laden",children:E?"QR/Setup erneut laden":"QR/Setup laden"})})]}),z,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(en,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{n&&n(),cf(),window.location.assign(e||"/")},title:"Ohne 2FA fortfahren (nicht empfohlen)",children:"Später"}),c.jsx(en,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(K),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:()=>C(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null]})]})})]})}const kg="record_cookies";function df(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 pr(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 W_={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 ka(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 tl(n){const e=(n??"").trim();if(!e)return null;for(const t of e.split(/\s+/g)){const i=ka(t);if(i)return i}return null}function ld(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 Mk(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 bo(n){const e=ld(n);if(!e)return n;if(e==="chaturbate"){const i=Mk(n);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:n}const t=jk(n);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:n}function L6(n){const e=ld(n);return e?((e==="chaturbate"?Mk(n):jk(n))||"").trim().toLowerCase():""}function jk(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 Ti=n=>(n||"").replaceAll("\\","/").split("/").pop()||"";function I6(n,e){const i=(n||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function B6(n){return n.startsWith("HOT ")?n.slice(4):n}const P6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Hc(n){const t=B6(Ti(n)).replace(/\.[^.]+$/,""),i=t.match(P6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function F6(){const[n,e]=m.useState(!1),[t,i]=m.useState(!1),a=m.useRef(null),l=m.useRef(0),u=m.useCallback(()=>{const we=a.current;we&&(we.focus(),requestAnimationFrame(()=>we.select()))},[]),h=m.useCallback(async()=>{try{const we=await pr("/api/auth/me",{cache:"no-store"});i(!!we?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),f=m.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),ze(null),Ae(!1),Lt("running"),It(null),$n(!1),ft(null),z([]),Z([]),pe(0),fe(1),ot({}),ye(0),Ri({}),Zn.current={},qt.current={},Rt.current=!1,un([]),pn({}),pt(0),he("")}},[]);m.useEffect(()=>{h()},[h]);const g=Ow(),_=m.useRef(g),S=m.useRef(0),C=we=>{const L=(we||"").toLowerCase();return L.includes("altersverifikationsseite erhalten")||L.includes("verify your age")||L.includes("schutzseite von cloudflare erhalten")||L.includes("just a moment")||L.includes("kein room-html")},D=we=>{const L=!!we?.silent,$="Cookies fehlen oder sind abgelaufen",xe="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(!L){ze(`⚠️ ${$}. ${xe}`),Qe(!0);return}const Te=Date.now();Te-S.current>15e3&&(S.current=Te,_.current?.error($,xe))};m.useEffect(()=>{_.current=g},[g]);const[R,E]=m.useState(!1);m.useEffect(()=>{const we=window,L=typeof we.requestIdleCallback=="function"?we.requestIdleCallback(()=>E(!0),{timeout:1500}):window.setTimeout(()=>E(!0),800);return()=>{typeof we.cancelIdleCallback=="function"?we.cancelIdleCallback(L):window.clearTimeout(L)}},[]);const B=8,G="finishedDownloads_sort",[Y,q]=m.useState(()=>{try{return window.localStorage.getItem(G)||"completed_desc"}catch{return"completed_desc"}}),se=m.useRef(null),Q=m.useRef(!1),K=(we,L)=>`${L}::${we}`,O=m.useCallback(async we=>{if(we<1||Q.current)return;const L=K(we,Y),$=se.current;if(!($?.key===L&&Date.now()-$.ts<15e3)){Q.current=!0;try{const xe=await fetch(`/api/record/done?page=${we}&pageSize=${B}&sort=${encodeURIComponent(Y)}`,{cache:"no-store"});if(!xe.ok)return;const Te=await xe.json().catch(()=>null),Ve=Array.isArray(Te?.items)?Te.items:Array.isArray(Te)?Te:[];se.current={key:L,items:Ve,ts:Date.now()}}finally{Q.current=!1}}},[Y]),re=m.useRef(null),k=m.useRef(0),j=m.useCallback((we="unknown")=>{const L=Date.now(),$=700;if(Hn.current!=="finished"||re.current!=null)return;const xe=L-k.current;if(xe<$){re.current=window.setTimeout(()=>{re.current=null,k.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload(cooldown-tail)",reason:we}}))},$-xe);return}re.current=window.setTimeout(()=>{re.current=null,k.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload",reason:we}}))},150)},[]);m.useEffect(()=>()=>{re.current!=null&&(window.clearTimeout(re.current),re.current=null)},[]),m.useEffect(()=>{try{window.localStorage.setItem(G,Y)}catch{}},[Y]);const[te,V]=m.useState(null),[ne,he]=m.useState(""),[ae,z]=m.useState([]),[P,Z]=m.useState([]),[ee,fe]=m.useState(1),[I,pe]=m.useState(0),[ke,ye]=m.useState(0),[me,pt]=m.useState(0),[We,_e]=m.useState(()=>Date.now()),[Ye,wt]=m.useState(()=>Date.now());m.useEffect(()=>{const we=window.setInterval(()=>wt(Date.now()),1e3);return()=>window.clearInterval(we)},[]);const je=we=>(we||"").toLowerCase().trim(),Se=we=>{const L=Math.max(0,Math.floor(we/1e3));if(L<2)return"gerade eben";if(L<60)return`vor ${L} Sekunden`;const $=Math.floor(L/60);if($===1)return"vor 1 Minute";if($<60)return`vor ${$} Minuten`;const xe=Math.floor($/60);return xe===1?"vor 1 Stunde":`vor ${xe} Stunden`},Je=m.useMemo(()=>{const we=Ye-We;return`(zuletzt aktualisiert: ${Se(we)})`},[Ye,We]),[tt,ot]=m.useState({}),dt=m.useCallback(we=>{const L={};for(const $ of Array.isArray(we)?we:[]){const xe=($?.modelKey||"").trim().toLowerCase();if(!xe)continue;const Te=qe=>(qe.favorite?4:0)+(qe.liked===!0?2:0)+(qe.watching?1:0),Ve=L[xe];(!Ve||Te($)>=Te(Ve))&&(L[xe]=$)}return L},[]),Ut=m.useCallback(async()=>{try{const we=await pr("/api/models",{cache:"no-store"});ot(dt(Array.isArray(we)?we:[])),_e(Date.now())}catch{}},[dt]),[Ge,Ie]=m.useState(null),Ze=m.useRef(null),[et,ft]=m.useState(null);m.useEffect(()=>{const we=L=>{const xe=(L.detail?.modelKey??"").trim();if(!xe)return;if(!xe.includes(" ")&&!xe.includes("/")&&!xe.includes("\\")){const W=xe.replace(/^@/,"").trim().toLowerCase();W&&ft(W);return}const Ve=ka(xe);if(!Ve){let W=xe.replace(/^https?:\/\//i,"");W.includes("/")&&(W=W.split("/").filter(Boolean).pop()||W),W.includes(":")&&(W=W.split(":").pop()||W),W=W.trim().toLowerCase(),W&&ft(W);return}const qe=bo(Ve),U=L6(qe);U&&ft(U)};return window.addEventListener("open-model-details",we),()=>window.removeEventListener("open-model-details",we)},[]);const mt=m.useCallback(we=>{const L=Date.now(),$=Ze.current;if(!$){Ze.current={ts:L,list:[we]};return}$.ts=L;const xe=$.list.findIndex(Te=>Te.id===we.id);xe>=0?$.list[xe]=we:$.list.unshift(we)},[]);m.useEffect(()=>{Ut();const we=L=>{const xe=L?.detail??{},Te=xe?.model;if(Te&&typeof Te=="object"){const Ve=String(Te.modelKey??"").toLowerCase().trim();Ve&&ot(qe=>({...qe,[Ve]:Te}));try{mt(Te)}catch{}Ie(qe=>qe?.id===Te.id?Te:qe),_e(Date.now());return}if(xe?.removed){const Ve=String(xe?.id??"").trim(),qe=String(xe?.modelKey??"").toLowerCase().trim();qe&&ot(U=>{const{[qe]:W,...le}=U;return le}),Ve&&Ie(U=>U?.id===Ve?null:U),_e(Date.now());return}Ut()};return window.addEventListener("models-changed",we),()=>window.removeEventListener("models-changed",we)},[Ut,mt]);const[de,ze]=m.useState(null),[Le,Ae]=m.useState(!1),[Pe,Qe]=m.useState(!1),[St,Ot]=m.useState({}),[Tt,an]=m.useState(!1),[Nt,Lt]=m.useState("running"),[vt,It]=m.useState(null),[yn,$n]=m.useState(!1),[kt,Bn]=m.useState(null),[at,N]=m.useState(0),F=m.useCallback(()=>N(we=>we+1),[]),[ie,Me]=m.useState(W_),He=m.useRef(ie);m.useEffect(()=>{He.current=ie},[ie]);const gt=!!ie.autoAddToDownloadList,zt=!!ie.autoStartAddedDownloads,[Jt,un]=m.useState([]),[Xt,pn]=m.useState({}),fn=m.useRef(!1),Kt=m.useRef({}),cn=m.useRef([]),dn=m.useRef(0),ln=m.useRef(0),qt=m.useRef({}),Rt=m.useRef(!1);m.useEffect(()=>{fn.current=Le},[Le]),m.useEffect(()=>{Kt.current=St},[St]),m.useEffect(()=>{cn.current=ae},[ae]);const Dt=m.useRef(null),Cn=m.useRef(""),Mt=4,Pn=m.useRef([]),Dn=m.useRef(0),Mn=m.useRef(new Set),Wt=m.useRef(!1),Vn=m.useCallback(()=>{const we=Dn.current>0;Ae(we),fn.current=we},[]),Yn=m.useCallback(we=>{const L=ka(we.url);if(!L)return!1;const $=bo(L);return Mn.current.has($)||(Mn.current.add($),Pn.current.push({...we,url:$}),Wt.current||(Wt.current=!0,queueMicrotask(()=>{Wt.current=!1,Qn()}))),!0},[]);async function jn(we,L){if(we=bo(we),cn.current.some(xe=>{if(String(xe.status||"").toLowerCase()!=="running"||xe.endedAt)return!1;const Te=ka(String(xe.sourceUrl||""));return(Te?bo(Te):"")===we}))return!0;try{const xe=Kt.current,Te=ld(we);if(!Te)return L||ze("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(Te==="chaturbate"&&!vn(xe))return L||ze('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const Ve=Object.entries(xe).map(([U,W])=>`${U}=${W}`).join("; "),qe=await pr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:we,cookie:Ve})});return qe?.id&&(qt.current[String(qe.id)]=!0),z(U=>[qe,...U]),cn.current=[qe,...cn.current],!0}catch(xe){const Te=xe?.message??String(xe);return C(Te)?(D({silent:L}),!1):(L||ze(Te),!1)}}async function Qn(){for(;Dn.current<Mt&&Pn.current.length>0;){const we=Pn.current.shift();Dn.current++,Vn(),(async()=>{try{if(await jn(we.url,we.silent)&&we.pendingKeyLower){const $=we.pendingKeyLower;pn(xe=>{const Te={...xe||{}};return delete Te[$],An.current=Te,Te})}}finally{Mn.current.delete(we.url),Dn.current=Math.max(0,Dn.current-1),Vn(),Pn.current.length>0&&Qn()}})()}}const[mn,Ri]=m.useState({}),Zn=m.useRef({});m.useEffect(()=>{Zn.current=mn},[mn]);const Kn=m.useCallback(we=>{const L=String(we?.host??"").toLowerCase(),$=String(we?.input??"").toLowerCase();return L.includes("chaturbate")||$.includes("chaturbate.com")},[]),ni=m.useMemo(()=>{const we=new Set;for(const L of Object.values(tt)){if(!Kn(L))continue;const $=je(String(L?.modelKey??""));$&&we.add($)}return Array.from(we)},[tt,Kn]),Si=m.useRef(tt);m.useEffect(()=>{Si.current=tt},[tt]);const An=m.useRef(Xt);m.useEffect(()=>{An.current=Xt},[Xt]);const Fn=m.useRef(ni);m.useEffect(()=>{Fn.current=ni},[ni]);const Hn=m.useRef(Nt);m.useEffect(()=>{Hn.current=Nt},[Nt]);const ve=m.useCallback(async(we,L)=>{const $=ka(we);if(!$)return!1;const xe=bo($),Te=!!L?.silent;Te||ze(null);const Ve=ld(xe);if(!Ve)return Te||ze("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const qe=Kt.current;if(Ve==="chaturbate"&&!vn(qe))return Te||ze('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if(cn.current.some(W=>{if(String(W.status||"").toLowerCase()!=="running"||W.endedAt)return!1;const le=ka(String(W.sourceUrl||""));return(le?bo(le):"")===xe}))return!0;if(Ve==="chaturbate"&&He.current.useChaturbateApi)try{const W=await pr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:xe})}),le=String(W?.modelKey??"").trim().toLowerCase();if(le){if(fn.current)return pn(Oe=>({...Oe||{},[le]:xe})),!0;const be=Zn.current[le],Ce=String(be?.current_show??"");if(be&&Ce&&Ce!=="public")return pn(Oe=>({...Oe||{},[le]:xe})),!0}}catch{}else if(fn.current)return Dt.current=xe,!0;if(fn.current)return!1;Ae(!0),fn.current=!0;try{const W=Object.entries(qe).map(([be,Ce])=>`${be}=${Ce}`).join("; "),le=await pr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:xe,cookie:W})});return le?.id&&(qt.current[String(le.id)]=!0),z(be=>[le,...be]),cn.current=[le,...cn.current],!0}catch(W){const le=W?.message??String(W);return C(le)?(D({silent:Te}),!1):(Te||ze(le),!1)}finally{Ae(!1),fn.current=!1}},[]);m.useEffect(()=>{let we=!1;const L=async()=>{try{const Te=await pr("/api/settings",{cache:"no-store"});!we&&Te&&Me({...W_,...Te})}catch{}},$=()=>{L()},xe=()=>{L()};return window.addEventListener("recorder-settings-updated",$),window.addEventListener("focus",xe),document.addEventListener("visibilitychange",xe),L(),()=>{we=!0,window.removeEventListener("recorder-settings-updated",$),window.removeEventListener("focus",xe),document.removeEventListener("visibilitychange",xe)}},[]);const rt=m.useMemo(()=>Object.entries(St).map(([we,L])=>({name:we,value:L})),[St]),ct=m.useCallback((we,L)=>{Ze.current=null,Ie(null),It(we),$n(!1),Bn(typeof L=="number"&&Number.isFinite(L)&&L>=0?L:null)},[]),jt=ae.filter(we=>{const L=String(we?.status??"").toLowerCase();return L==="running"||L==="postwork"}),De=m.useMemo(()=>{let we=0;for(const L of Object.values(tt)){if(!L?.watching||!Kn(L))continue;const $=je(String(L?.modelKey??""));$&&mn[$]&&we++}return we},[tt,mn,Kn]),{onlineFavCount:bt,onlineLikedCount:xt}=m.useMemo(()=>{let we=0,L=0;for(const $ of Object.values(tt)){const xe=je(String($?.modelKey??""));xe&&mn[xe]&&($?.favorite&&we++,$?.liked===!0&&L++)}return{onlineFavCount:we,onlineLikedCount:L}},[tt,mn]),Et=[{id:"running",label:"Laufende Downloads",count:jt.length},{id:"finished",label:"Abgeschlossene Downloads",count:I},{id:"models",label:"Models",count:ke},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],Ft=m.useMemo(()=>ne.trim().length>0&&!Le,[ne,Le]);m.useEffect(()=>{let we=!1;return(async()=>{try{const $=await pr("/api/cookies",{cache:"no-store"}),xe=df($?.cookies);if(we||Ot(xe),Object.keys(xe).length===0){const Te=localStorage.getItem(kg);if(Te)try{const Ve=JSON.parse(Te),qe=df(Ve);Object.keys(qe).length>0&&(we||Ot(qe),await pr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:qe})}))}catch{}}}catch{const $=localStorage.getItem(kg);if($)try{const xe=JSON.parse($);we||Ot(df(xe))}catch{}}finally{we||an(!0)}})(),()=>{we=!0}},[]),m.useEffect(()=>{Tt&&localStorage.setItem(kg,JSON.stringify(St))},[St,Tt]),m.useEffect(()=>{if(Nt!=="finished")return;j("selectedTab effect");const we=()=>{document.hidden||j("selectedTab visibilitychange")};return document.addEventListener("visibilitychange",we),()=>document.removeEventListener("visibilitychange",we)},[Nt,j]),m.useEffect(()=>{const we=Math.max(1,Math.ceil(I/B));ee>we&&fe(we)},[I,ee]),m.useEffect(()=>{if(!t)return;const we=ll("/api/stream","jobs",L=>{ln.current=Date.now();const $=Array.isArray(L)?L:[];z($),cn.current=$,_e(Date.now())});return()=>we()},[t]),m.useEffect(()=>{if(!t)return;const we={t:0};let L=null;const $=qe=>{const W=Date.now()-we.t,le=()=>{if(we.t=Date.now(),Hn.current==="finished"){j(`done-stream (${qe})`);return}};if(W<800){if(L!=null)return;L=window.setTimeout(()=>{L=null,le()},900);return}le()},xe=ll("/api/stream","doneChanged",qe=>{dn.current=Date.now(),$("doneChanged sse")}),Te=ll("/api/stream","doneMeta",qe=>{dn.current=Date.now(),l.current=Date.now();const U=Number(qe?.count??0),W=Number.isFinite(U)&&U>=0?U:0;pe(W),_e(Date.now())}),Ve=()=>{document.hidden||$("visibilitychange")};return document.addEventListener("visibilitychange",Ve),()=>{document.removeEventListener("visibilitychange",Ve),L!=null&&window.clearTimeout(L),xe(),Te()}},[t,j]),m.useEffect(()=>{if(!t)return;const we=ll("/api/stream","modelsMeta",L=>{const $=Number(L?.count??0),xe=Number.isFinite($)&&$>=0?$:0;ye(xe);const Te=Number(L?.onlineCount);Number.isFinite(Te)&&Te>=0&&pt(Te),_e(Date.now())});return()=>we()},[t]);function $t(we){const L=ka(we);if(!L)return!1;try{return new URL(L).hostname.includes("chaturbate.com")}catch{return!1}}function Vt(we,L){const $=Object.fromEntries(Object.entries(we).map(([xe,Te])=>[xe.trim().toLowerCase(),Te]));for(const xe of L){const Te=$[xe.toLowerCase()];if(Te)return Te}}function vn(we){const L=Vt(we,["cf_clearance"]),$=Vt(we,["sessionid","session_id","sessionId"]);return!!(L&&$)}async function qn(we){try{await pr(`/api/record/stop?id=${encodeURIComponent(we)}`,{method:"POST"})}catch(L){g.error("Stop fehlgeschlagen",L?.message??String(L))}}m.useEffect(()=>{const we=L=>{const xe=Number(L.detail?.delta??0);Number.isFinite(xe)&&xe!==0&&pe(Te=>Math.max(0,Te+xe))};return window.addEventListener("finished-downloads:count-hint",we),()=>window.removeEventListener("finished-downloads:count-hint",we)},[]),m.useEffect(()=>{const we=L=>{const $=L.detail||{};$.tab==="finished"&&Lt("finished"),$.tab==="categories"&&Lt("categories"),$.tab==="models"&&Lt("models"),$.tab==="running"&&Lt("running"),$.tab==="settings"&&Lt("settings")};return window.addEventListener("app:navigate-tab",we),()=>window.removeEventListener("app:navigate-tab",we)},[]),m.useEffect(()=>{if(!vt){Ie(null),V(null);return}const we=(Hc(vt.output||"")||"").trim().toLowerCase();V(we||null);const L=we?tt[we]:void 0;Ie(L??null)},[vt,tt]);async function Yi(){return ve(ne)}const Gn=m.useCallback(async we=>{const L=String(we?.sourceUrl??""),$=tl(L);if(!$)return!1;const xe=ka($);if(!xe)return!1;const Te=bo(xe),Ve=await ve(Te,{silent:!0});return Ve||g.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),Ve},[ve,g]);async function ki(we){const{kind:L,file:$,run:xe,onSuccess:Te,onError:Ve}=we;(L==="delete"||L==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:$,phase:"start"}}));try{const qe=await xe();return(L==="delete"||L==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:$,phase:"success"}})),await Te?.(qe),qe}catch(qe){throw(L==="delete"||L==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:$,phase:"error"}})),await Ve?.(qe),qe}}const Ei=m.useCallback(async we=>{const L=Ti(we.output||"");if(L)try{const $=await ki({kind:"delete",file:L,run:()=>pr(`/api/record/delete?file=${encodeURIComponent(L)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{Z(Te=>{const Ve=Te.filter(Ce=>Ti(Ce.output||"")!==L);if(B-Ve.length<=0)return Ve;const U=K(ee+1,Y),W=se.current;if(!W||W.key!==U||!Array.isArray(W.items)||W.items.length===0)return Ve;const le=[...Ve],be=new Set(le.map(Ce=>String(Ce.id||Ti(Ce.output||"")).trim()));for(;le.length<B&&W.items.length>0;){const Ce=W.items.shift(),Oe=String(Ce.id||Ti(Ce.output||"")).trim();!Oe||be.has(Oe)||(be.add(Oe),le.push(Ce))}return se.current={...W,items:W.items,ts:W.ts},le}),pe(Te=>Math.max(0,Te-1)),z(Te=>Te.filter(Ve=>Ti(Ve.output||"")!==L)),It(Te=>Te&&Ti(Te.output||"")===L?null:Te),O(ee+1)},320)},onError:async()=>{g.error("Löschen fehlgeschlagen",L)}}),xe=typeof $?.undoToken=="string"?$.undoToken:"";return xe?{undoToken:xe}:{}}catch{return}},[ki,g,ee,Y,O]),si=m.useCallback(async we=>{const L=Ti(we.output||"");if(L)try{await ki({kind:"keep",file:L,run:()=>pr(`/api/record/keep?file=${encodeURIComponent(L)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{Z($=>$.filter(xe=>Ti(xe.output||"")!==L)),z($=>$.filter(xe=>Ti(xe.output||"")!==L)),It($=>$&&Ti($.output||"")===L?null:$),pe($=>Math.max(0,$-1)),O(ee+1)},320)},onError:async()=>{g.error("Keep fehlgeschlagen",L)}})}catch{return}},[ki,g,ee,O]),mi=m.useCallback(async we=>{const L=Ti(we.output||"");if(L)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:L}})),await new Promise(qe=>window.setTimeout(qe,60));const $=await pr(`/api/record/toggle-hot?file=${encodeURIComponent(L)}`,{method:"POST"}),xe=Ti($.oldFile||L)||L,Te=Ti($.newFile||"")||"";if(!Te)throw new Error("Backend lieferte keinen neuen Dateinamen zurück");window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:xe,newFile:Te}}));const Ve=qe=>I6(qe||"",Te);return It(qe=>qe&&(qe.id===we.id||Ti(qe.output||"")===xe?{...qe,output:Ve(qe.output||"")}:qe)),Z(qe=>qe.map(U=>U.id===we.id||Ti(U.output||"")===xe?{...U,output:Ve(U.output||"")}:U)),z(qe=>qe.map(U=>U.id===we.id||Ti(U.output||"")===xe?{...U,output:Ve(U.output||"")}:U)),$}catch($){g.error("Umbenennen fehlgeschlagen",$?.message??String($));return}},[g]),Pi=m.useCallback(async we=>{await Ei(we)},[Ei]);async function Sn(we){const L=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(we)});if(L.status===204)return null;if(!L.ok){const $=await L.text().catch(()=>"");throw new Error($||`HTTP ${L.status}`)}return L.json()}const Jn=m.useCallback(we=>{const L=Ze.current;!L||!we||(L.ts=Date.now(),L.list=L.list.filter($=>$.id!==we))},[]),wn=m.useRef({}),Ci=m.useCallback(async we=>{const L=Ti(we.output||""),$=!!(vt&&Ti(vt.output||"")===L),xe=Ce=>{try{const Oe=String(Ce.sourceUrl??Ce.SourceURL??""),ht=tl(Oe);return ht?new URL(ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Te=(Hc(we.output||"")||"").trim().toLowerCase();if(Te){const Ce=Te;if(wn.current[Ce])return;wn.current[Ce]=!0;const Oe=tt[Te]??{id:"",input:"",host:xe(we)||void 0,modelKey:Te,watching:!1,favorite:!1,liked:null,isUrl:!1},ht=!Oe.favorite,At={...Oe,modelKey:Oe.modelKey||Te,favorite:ht,liked:ht?!1:Oe.liked};ot(yt=>({...yt,[Te]:At})),mt(At),$&&Ie(At);try{const yt=await Sn({...At.id?{id:At.id}:{},host:At.host||xe(we)||"",modelKey:Te,favorite:ht,...ht?{liked:!1}:{}});if(!yt){ot(Yt=>{const{[Te]:Rn,...ui}=Yt;return ui}),Oe.id&&Jn(Oe.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Oe.id,modelKey:Te}}));return}const rn=je(yt.modelKey||Te);rn&&ot(Yt=>({...Yt,[rn]:yt})),mt(yt),$&&Ie(yt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:yt}}))}catch(yt){ot(rn=>({...rn,[Te]:Oe})),mt(Oe),$&&Ie(Oe),g.error("Favorit umschalten fehlgeschlagen",yt?.message??String(yt))}finally{delete wn.current[Ce]}return}let Ve=$?Ge:null;if(Ve||(Ve=await Li(we,{ensure:!0})),!Ve)return;const qe=je(Ve.modelKey||Ve.id||"");if(!qe||wn.current[qe])return;wn.current[qe]=!0;const U=Ve,W=!U.favorite,le={...U,favorite:W,liked:W?!1:U.liked},be=je(U.modelKey||"");be&&ot(Ce=>({...Ce,[be]:le})),mt(le),$&&Ie(le);try{const Ce=await Sn({id:U.id,favorite:W,...W?{liked:!1}:{}});if(!Ce){ot(ht=>{const At=je(U.modelKey||"");if(!At)return ht;const{[At]:yt,...rn}=ht;return rn}),Jn(U.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:U.id,modelKey:U.modelKey}}));return}const Oe=je(Ce.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:Ce})),mt(Ce),$&&Ie(Ce),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ce}}))}catch(Ce){const Oe=je(U.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:U})),mt(U),$&&Ie(U),g.error("Favorit umschalten fehlgeschlagen",Ce?.message??String(Ce))}finally{delete wn.current[qe]}},[g,vt,Ge,Li,Sn,mt,Jn,tt]),Oi=m.useCallback(async we=>{const L=Ti(we.output||""),$=!!(vt&&Ti(vt.output||"")===L),xe=Ce=>{try{const Oe=String(Ce.sourceUrl??Ce.SourceURL??""),ht=tl(Oe);return ht?new URL(ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Te=(Hc(we.output||"")||"").trim().toLowerCase();if(Te){const Ce=Te;if(wn.current[Ce])return;wn.current[Ce]=!0;const Oe=tt[Te]??{id:"",input:"",host:xe(we)||void 0,modelKey:Te,watching:!1,favorite:!1,liked:null,isUrl:!1},ht=Oe.liked!==!0,At={...Oe,modelKey:Oe.modelKey||Te,liked:ht,favorite:ht?!1:Oe.favorite};ot(yt=>({...yt,[Te]:At})),mt(At),$&&Ie(At);try{const yt=await Sn({...At.id?{id:At.id}:{},host:At.host||xe(we)||"",modelKey:Te,liked:ht,...ht?{favorite:!1}:{}});if(!yt){ot(Yt=>{const{[Te]:Rn,...ui}=Yt;return ui}),Oe.id&&Jn(Oe.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Oe.id,modelKey:Te}}));return}const rn=je(yt.modelKey||Te);rn&&ot(Yt=>({...Yt,[rn]:yt})),mt(yt),$&&Ie(yt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:yt}}))}catch(yt){ot(rn=>({...rn,[Te]:Oe})),mt(Oe),$&&Ie(Oe),g.error("Like umschalten fehlgeschlagen",yt?.message??String(yt))}finally{delete wn.current[Ce]}return}let Ve=$?Ge:null;if(Ve||(Ve=await Li(we,{ensure:!0})),!Ve)return;const qe=je(Ve.modelKey||Ve.id||"");if(!qe||wn.current[qe])return;wn.current[qe]=!0;const U=Ve,W=U.liked!==!0,le={...U,liked:W,favorite:W?!1:U.favorite},be=je(U.modelKey||"");be&&ot(Ce=>({...Ce,[be]:le})),mt(le),$&&Ie(le);try{const Ce=W?await Sn({id:U.id,liked:!0,favorite:!1}):await Sn({id:U.id,liked:!1});if(!Ce){ot(ht=>{const At=je(U.modelKey||"");if(!At)return ht;const{[At]:yt,...rn}=ht;return rn}),Jn(U.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:U.id,modelKey:U.modelKey}}));return}const Oe=je(Ce.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:Ce})),mt(Ce),$&&Ie(Ce),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ce}}))}catch(Ce){const Oe=je(U.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:U})),mt(U),$&&Ie(U),g.error("Like umschalten fehlgeschlagen",Ce?.message??String(Ce))}finally{delete wn.current[qe]}},[g,vt,Ge,Li,Sn,mt,Jn,tt]),ei=m.useCallback(async we=>{const L=Ti(we.output||""),$=!!(vt&&Ti(vt.output||"")===L),xe=Ce=>{try{const Oe=String(Ce.sourceUrl??Ce.SourceURL??""),ht=tl(Oe);return ht?new URL(ht).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Te=(Hc(we.output||"")||"").trim().toLowerCase();if(Te){const Ce=Te;if(wn.current[Ce])return;wn.current[Ce]=!0;const Oe=tt[Te]??{id:"",input:"",host:xe(we)||void 0,modelKey:Te,watching:!1,favorite:!1,liked:null,isUrl:!1},ht=!Oe.watching,At={...Oe,modelKey:Oe.modelKey||Te,watching:ht};ot(yt=>({...yt,[Te]:At})),mt(At),$&&Ie(At);try{const yt=await Sn({...At.id?{id:At.id}:{},host:At.host||xe(we)||"",modelKey:Te,watched:ht});if(!yt){ot(Yt=>{const{[Te]:Rn,...ui}=Yt;return ui}),Oe.id&&Jn(Oe.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Oe.id,modelKey:Te}}));return}const rn=je(yt.modelKey||Te);rn&&ot(Yt=>({...Yt,[rn]:yt})),mt(yt),$&&Ie(yt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:yt}}))}catch(yt){ot(rn=>({...rn,[Te]:Oe})),mt(Oe),$&&Ie(Oe),g.error("Watched umschalten fehlgeschlagen",yt?.message??String(yt))}finally{delete wn.current[Ce]}return}let Ve=$?Ge:null;if(Ve||(Ve=await Li(we,{ensure:!0})),!Ve)return;const qe=je(Ve.modelKey||Ve.id||"");if(!qe||wn.current[qe])return;wn.current[qe]=!0;const U=Ve,W=!U.watching,le={...U,watching:W},be=je(U.modelKey||"");be&&ot(Ce=>({...Ce,[be]:le})),mt(le),$&&Ie(le);try{const Ce=await Sn({id:U.id,watched:W});if(!Ce){ot(ht=>{const At=je(U.modelKey||"");if(!At)return ht;const{[At]:yt,...rn}=ht;return rn}),Jn(U.id),$&&Ie(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:U.id,modelKey:U.modelKey}}));return}const Oe=je(Ce.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:Ce})),mt(Ce),$&&Ie(Ce),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ce}}))}catch(Ce){const Oe=je(U.modelKey||"");Oe&&ot(ht=>({...ht,[Oe]:U})),mt(U),$&&Ie(U),g.error("Watched umschalten fehlgeschlagen",Ce?.message??String(Ce))}finally{delete wn.current[qe]}},[g,vt,Ge,Li,Sn,mt,Jn,tt]);async function Li(we,L){const $=!!L?.ensure,xe=le=>{const be=Date.now(),Ce=Ze.current;if(!Ce){Ze.current={ts:be,list:[le]};return}Ce.ts=be;const Oe=Ce.list.findIndex(ht=>ht.id===le.id);Oe>=0?Ce.list[Oe]=le:Ce.list.unshift(le)},Te=async le=>{if(!le)return null;const be=le.trim().toLowerCase();if(!be)return null;const Ce=tt[be];if(Ce)return xe(Ce),Ce;if($){let rn;try{const Rn=we.sourceUrl??we.SourceURL??"",ui=tl(Rn);ui&&(rn=new URL(ui).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const Yt=await pr("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:le,...rn?{host:rn}:{}})});return mt(Yt),Yt}const Oe=Date.now(),ht=Ze.current;if(!ht||Oe-ht.ts>3e4){const rn=Object.values(tt);if(rn.length)Ze.current={ts:Oe,list:rn};else{const Yt=await pr("/api/models",{cache:"no-store"});Ze.current={ts:Oe,list:Array.isArray(Yt)?Yt:[]}}}const yt=(Ze.current?.list??[]).find(rn=>(rn.modelKey||"").trim().toLowerCase()===be);return yt||null},Ve=Hc(we.output||"");if(Ve)return Te(Ve);const qe=we.status==="running",U=we.sourceUrl??we.SourceURL??"",W=tl(U);if(qe&&W){const le=await pr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:W})}),be=await pr("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le)});return mt(be),be}return null}return m.useEffect(()=>{if(!gt&&!zt||!navigator.clipboard?.readText)return;let we=!1,L=!1,$=null;const xe=async()=>{if(!(we||L)){L=!0;try{const qe=await navigator.clipboard.readText(),U=tl(qe);if(!U)return;const W=ka(U);if(!W||!ld(W))return;const be=bo(W);if(be===Cn.current)return;Cn.current=be,gt&&he(be),zt&&Yn({url:be,silent:!1})}catch{}finally{L=!1}}},Te=qe=>{we||($=window.setTimeout(async()=>{await xe(),Te(document.hidden?5e3:1500)},qe))},Ve=()=>{xe()};return window.addEventListener("hover",Ve),document.addEventListener("visibilitychange",Ve),Te(0),()=>{we=!0,$&&window.clearTimeout($),window.removeEventListener("hover",Ve),document.removeEventListener("visibilitychange",Ve)}},[gt,zt,Yn]),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(RN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:me})]}),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:De})]}),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:bt})]}),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(EN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:xt})]})]}),c.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:Je})]}),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:Je}),c.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[R?c.jsx(G_,{mode:"inline",className:"flex-1"}):c.jsx("div",{className:"flex-1"}),c.jsx(en,{variant:"secondary",onClick:()=>Qe(!0),className:"px-3 shrink-0",children:"Cookies"}),c.jsx(en,{variant:"secondary",onClick:f,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[R?c.jsx(G_,{mode:"inline"}):null,c.jsx(en,{variant:"secondary",onClick:()=>Qe(!0),className:"h-9 px-3",children:"Cookies"}),c.jsx(en,{variant:"secondary",onClick:f,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:ne,onChange:we=>he(we.target.value),onMouseDown:we=>{we.button===0&&(we.preventDefault(),u())},onFocus:()=>{u()},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(en,{variant:"primary",onClick:Yi,disabled:!Ft,className:"w-full sm:w-auto rounded-lg",children:"Start"})]}),de?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:de}),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:()=>ze(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,$t(ne)&&!vn(St)?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,Le?c.jsx("div",{className:"pt-1",children:c.jsx(yd,{label:"Starte Download…",indeterminate:!0})}):null,c.jsx("div",{className:"hidden sm:block pt-2",children:c.jsx(Rg,{tabs:Et,value:Nt,onChange:Lt,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(Rg,{tabs:Et,value:Nt,onChange:Lt,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:[Nt==="running"?c.jsx(J8,{jobs:jt,modelsByKey:tt,pending:Jt,onOpenPlayer:ct,onStopJob:qn,onToggleFavorite:Ci,onToggleLike:Oi,onToggleWatch:ei,onAddToDownloads:Gn,blurPreviews:!!ie.blurPreviews}):null,Nt==="finished"?c.jsx(N3,{jobs:ae,modelsByKey:tt,doneJobs:P,doneTotal:I,page:ee,pageSize:B,onPageChange:fe,onOpenPlayer:ct,onDeleteJob:Ei,onToggleHot:mi,onToggleFavorite:Ci,onToggleLike:Oi,onToggleWatch:ei,onKeepJob:si,blurPreviews:!!ie.blurPreviews,teaserPlayback:ie.teaserPlayback??"hover",teaserAudio:!!ie.teaserAudio,assetNonce:at,sortMode:Y,onSortModeChange:we=>{q(we),fe(1)},loadMode:"paged"}):null,Nt==="models"?c.jsx(s6,{}):null,Nt==="categories"?c.jsx(A6,{}):null,Nt==="settings"?c.jsx(PN,{onAssetsGenerated:F}):null]}),c.jsx(pA,{open:Pe,onClose:()=>Qe(!1),initialCookies:rt,onApply:we=>{const L=df(Object.fromEntries(we.map($=>[$.name,$.value])));Ot(L),pr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:L})}).catch(()=>{})}}),c.jsx(x6,{open:!!et,modelKey:et,onClose:()=>ft(null),onOpenPlayer:ct,runningJobs:jt,cookies:St,blurPreviews:ie.blurPreviews,teaserPlayback:ie.teaserPlayback??"hover",teaserAudio:!!ie.teaserAudio,onToggleHot:mi,onDelete:Pi,onKeep:si,onToggleFavorite:Ci,onToggleLike:Oi,onToggleWatch:ei,onStopJob:qn}),vt?c.jsx(K8,{job:vt,modelKey:te??void 0,modelsByKey:tt,expanded:yn,onToggleExpand:()=>$n(we=>!we),onClose:()=>{It(null),Bn(null)},startAtSec:kt??void 0,isHot:Ti(vt.output||"").startsWith("HOT "),isFavorite:!!Ge?.favorite,isLiked:Ge?.liked===!0,isWatching:!!Ge?.watching,onKeep:si,onDelete:Pi,onToggleHot:mi,onToggleFavorite:Ci,onToggleLike:Oi,onStopJob:qn,onToggleWatch:ei},[String(vt?.id??""),Ti(vt.output||""),String(at)].join("::")):null]})]}):c.jsx(O6,{onLoggedIn:h}):c.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}Y_.createRoot(document.getElementById("root")).render(c.jsx(m.StrictMode,{children:c.jsx(w3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:c.jsx(F6,{})})}));
|