450 lines
1.3 MiB
450 lines
1.3 MiB
function XE(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 pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nu(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function YE(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 m0={exports:{}},jc={};var t1;function QE(){if(t1)return jc;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 jc.Fragment=e,jc.jsx=t,jc.jsxs=t,jc}var n1;function ZE(){return n1||(n1=1,m0.exports=QE()),m0.exports}var c=ZE(),p0={exports:{}},mn={};var i1;function JE(){if(i1)return mn;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 M(I){return I===null||typeof I!="object"?null:(I=C&&I[C]||I["@@iterator"],typeof I=="function"?I:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,B={};function G(I,pe,we){this.props=I,this.context=pe,this.refs=B,this.updater=we||L}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 Q(){}Q.prototype=G.prototype;function H(I,pe,we){this.props=I,this.context=pe,this.refs=B,this.updater=we||L}var se=H.prototype=new Q;se.constructor=H,E(se,G.prototype),se.isPureReactComponent=!0;var Y=Array.isArray;function W(){}var O={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function k(I,pe,we){var ve=we.ref;return{$$typeof:n,type:I,key:pe,ref:ve!==void 0?ve:null,props:we}}function j(I,pe){return k(I.type,pe,I.props)}function Z(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function V(I){var pe={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(we){return pe[we]})}var te=/\/+/g;function me(I,pe){return typeof I=="object"&&I!==null&&I.key!=null?V(""+I.key):pe.toString(36)}function le(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(W,W):(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 q(I,pe,we,ve,ge){var ht=typeof I;(ht==="undefined"||ht==="boolean")&&(I=null);var Ge=!1;if(I===null)Ge=!0;else switch(ht){case"bigint":case"string":case"number":Ge=!0;break;case"object":switch(I.$$typeof){case n:case e:Ge=!0;break;case _:return Ge=I._init,q(Ge(I._payload),pe,we,ve,ge)}}if(Ge)return ge=ge(I),Ge=ve===""?"."+me(I,0):ve,Y(ge)?(we="",Ge!=null&&(we=Ge.replace(te,"$&/")+"/"),q(ge,pe,we,"",function(ut){return ut})):ge!=null&&(Z(ge)&&(ge=j(ge,we+(ge.key==null||I&&I.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+Ge)),pe.push(ge)),1;Ge=0;var Te=ve===""?".":ve+":";if(Y(I))for(var Le=0;Le<I.length;Le++)ve=I[Le],ht=Te+me(ve,Le),Ge+=q(ve,pe,we,ht,ge);else if(Le=M(I),typeof Le=="function")for(I=Le.call(I),Le=0;!(ve=I.next()).done;)ve=ve.value,ht=Te+me(ve,Le++),Ge+=q(ve,pe,we,ht,ge);else if(ht==="object"){if(typeof I.then=="function")return q(le(I),pe,we,ve,ge);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 Ge}function F(I,pe,we){if(I==null)return I;var ve=[],ge=0;return q(I,ve,"","",function(ht){return pe.call(we,ht,ge++)}),ve}function ee(I){if(I._status===-1){var pe=I._result;pe=pe(),pe.then(function(we){(I._status===0||I._status===-1)&&(I._status=1,I._result=we)},function(we){(I._status===0||I._status===-1)&&(I._status=2,I._result=we)}),I._status===-1&&(I._status=0,I._result=pe)}if(I._status===1)return I._result.default;throw I._result}var ie=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)},de={map:F,forEach:function(I,pe,we){F(I,function(){pe.apply(this,arguments)},we)},count:function(I){var pe=0;return F(I,function(){pe++}),pe},toArray:function(I){return F(I,function(pe){return pe})||[]},only:function(I){if(!Z(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return mn.Activity=S,mn.Children=de,mn.Component=G,mn.Fragment=t,mn.Profiler=a,mn.PureComponent=H,mn.StrictMode=i,mn.Suspense=f,mn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,mn.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},mn.cache=function(I){return function(){return I.apply(null,arguments)}},mn.cacheSignal=function(){return null},mn.cloneElement=function(I,pe,we){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var ve=E({},I.props),ge=I.key;if(pe!=null)for(ht in pe.key!==void 0&&(ge=""+pe.key),pe)!ae.call(pe,ht)||ht==="key"||ht==="__self"||ht==="__source"||ht==="ref"&&pe.ref===void 0||(ve[ht]=pe[ht]);var ht=arguments.length-2;if(ht===1)ve.children=we;else if(1<ht){for(var Ge=Array(ht),Te=0;Te<ht;Te++)Ge[Te]=arguments[Te+2];ve.children=Ge}return k(I.type,ge,ve)},mn.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},mn.createElement=function(I,pe,we){var ve,ge={},ht=null;if(pe!=null)for(ve in pe.key!==void 0&&(ht=""+pe.key),pe)ae.call(pe,ve)&&ve!=="key"&&ve!=="__self"&&ve!=="__source"&&(ge[ve]=pe[ve]);var Ge=arguments.length-2;if(Ge===1)ge.children=we;else if(1<Ge){for(var Te=Array(Ge),Le=0;Le<Ge;Le++)Te[Le]=arguments[Le+2];ge.children=Te}if(I&&I.defaultProps)for(ve in Ge=I.defaultProps,Ge)ge[ve]===void 0&&(ge[ve]=Ge[ve]);return k(I,ht,ge)},mn.createRef=function(){return{current:null}},mn.forwardRef=function(I){return{$$typeof:h,render:I}},mn.isValidElement=Z,mn.lazy=function(I){return{$$typeof:_,_payload:{_status:-1,_result:I},_init:ee}},mn.memo=function(I,pe){return{$$typeof:g,type:I,compare:pe===void 0?null:pe}},mn.startTransition=function(I){var pe=O.T,we={};O.T=we;try{var ve=I(),ge=O.S;ge!==null&&ge(we,ve),typeof ve=="object"&&ve!==null&&typeof ve.then=="function"&&ve.then(W,ie)}catch(ht){ie(ht)}finally{pe!==null&&we.types!==null&&(pe.types=we.types),O.T=pe}},mn.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},mn.use=function(I){return O.H.use(I)},mn.useActionState=function(I,pe,we){return O.H.useActionState(I,pe,we)},mn.useCallback=function(I,pe){return O.H.useCallback(I,pe)},mn.useContext=function(I){return O.H.useContext(I)},mn.useDebugValue=function(){},mn.useDeferredValue=function(I,pe){return O.H.useDeferredValue(I,pe)},mn.useEffect=function(I,pe){return O.H.useEffect(I,pe)},mn.useEffectEvent=function(I){return O.H.useEffectEvent(I)},mn.useId=function(){return O.H.useId()},mn.useImperativeHandle=function(I,pe,we){return O.H.useImperativeHandle(I,pe,we)},mn.useInsertionEffect=function(I,pe){return O.H.useInsertionEffect(I,pe)},mn.useLayoutEffect=function(I,pe){return O.H.useLayoutEffect(I,pe)},mn.useMemo=function(I,pe){return O.H.useMemo(I,pe)},mn.useOptimistic=function(I,pe){return O.H.useOptimistic(I,pe)},mn.useReducer=function(I,pe,we){return O.H.useReducer(I,pe,we)},mn.useRef=function(I){return O.H.useRef(I)},mn.useState=function(I){return O.H.useState(I)},mn.useSyncExternalStore=function(I,pe,we){return O.H.useSyncExternalStore(I,pe,we)},mn.useTransition=function(){return O.H.useTransition()},mn.version="19.2.3",mn}var r1;function Gf(){return r1||(r1=1,p0.exports=JE()),p0.exports}var p=Gf();const tn=Nu(p),s1=XE({__proto__:null,default:tn},[p]);var g0={exports:{}},Rc={},y0={exports:{}},b0={};var a1;function eC(){return a1||(a1=1,(function(n){function e(q,F){var ee=q.length;q.push(F);e:for(;0<ee;){var ie=ee-1>>>1,de=q[ie];if(0<a(de,F))q[ie]=F,q[ee]=de,ee=ie;else break e}}function t(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var F=q[0],ee=q.pop();if(ee!==F){q[0]=ee;e:for(var ie=0,de=q.length,I=de>>>1;ie<I;){var pe=2*(ie+1)-1,we=q[pe],ve=pe+1,ge=q[ve];if(0>a(we,ee))ve<de&&0>a(ge,we)?(q[ie]=ge,q[ve]=ee,ie=ve):(q[ie]=we,q[pe]=ee,ie=pe);else if(ve<de&&0>a(ge,ee))q[ie]=ge,q[ve]=ee,ie=ve;else break e}}return F}function a(q,F){var ee=q.sortIndex-F.sortIndex;return ee!==0?ee:q.id-F.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;n.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();n.unstable_now=function(){return u.now()-h}}var f=[],g=[],_=1,S=null,C=3,M=!1,L=!1,E=!1,B=!1,G=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function se(q){for(var F=t(g);F!==null;){if(F.callback===null)i(g);else if(F.startTime<=q)i(g),F.sortIndex=F.expirationTime,e(f,F);else break;F=t(g)}}function Y(q){if(E=!1,se(q),!L)if(t(f)!==null)L=!0,W||(W=!0,V());else{var F=t(g);F!==null&&le(Y,F.startTime-q)}}var W=!1,O=-1,ae=5,k=-1;function j(){return B?!0:!(n.unstable_now()-k<ae)}function Z(){if(B=!1,W){var q=n.unstable_now();k=q;var F=!0;try{e:{L=!1,E&&(E=!1,Q(O),O=-1),M=!0;var ee=C;try{t:{for(se(q),S=t(f);S!==null&&!(S.expirationTime>q&&j());){var ie=S.callback;if(typeof ie=="function"){S.callback=null,C=S.priorityLevel;var de=ie(S.expirationTime<=q);if(q=n.unstable_now(),typeof de=="function"){S.callback=de,se(q),F=!0;break t}S===t(f)&&i(f),se(q)}else i(f);S=t(f)}if(S!==null)F=!0;else{var I=t(g);I!==null&&le(Y,I.startTime-q),F=!1}}break e}finally{S=null,C=ee,M=!1}F=void 0}}finally{F?V():W=!1}}}var V;if(typeof H=="function")V=function(){H(Z)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,me=te.port2;te.port1.onmessage=Z,V=function(){me.postMessage(null)}}else V=function(){G(Z,0)};function le(q,F){O=G(function(){q(n.unstable_now())},F)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(q){q.callback=null},n.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<q?Math.floor(1e3/q):5},n.unstable_getCurrentPriorityLevel=function(){return C},n.unstable_next=function(q){switch(C){case 1:case 2:case 3:var F=3;break;default:F=C}var ee=C;C=F;try{return q()}finally{C=ee}},n.unstable_requestPaint=function(){B=!0},n.unstable_runWithPriority=function(q,F){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ee=C;C=q;try{return F()}finally{C=ee}},n.unstable_scheduleCallback=function(q,F,ee){var ie=n.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ie+ee:ie):ee=ie,q){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=ee+de,q={id:_++,callback:F,priorityLevel:q,startTime:ee,expirationTime:de,sortIndex:-1},ee>ie?(q.sortIndex=ee,e(g,q),t(f)===null&&q===t(g)&&(E?(Q(O),O=-1):E=!0,le(Y,ee-ie))):(q.sortIndex=de,e(f,q),L||M||(L=!0,W||(W=!0,V()))),q},n.unstable_shouldYield=j,n.unstable_wrapCallback=function(q){var F=C;return function(){var ee=C;C=F;try{return q.apply(this,arguments)}finally{C=ee}}}})(b0)),b0}var o1;function tC(){return o1||(o1=1,y0.exports=eC()),y0.exports}var v0={exports:{}},vr={};var l1;function nC(){if(l1)return vr;l1=1;var n=Gf();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 vr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,vr.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,_)},vr.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()}},vr.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))},vr.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},vr.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,M=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:M}):_==="script"&&i.d.X(f,{crossOrigin:S,integrity:C,fetchPriority:M,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},vr.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)},vr.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})}},vr.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)},vr.requestFormReset=function(f){i.d.r(f)},vr.unstable_batchedUpdates=function(f,g){return f(g)},vr.useFormState=function(f,g,_){return u.H.useFormState(f,g,_)},vr.useFormStatus=function(){return u.H.useHostTransitionStatus()},vr.version="19.2.3",vr}var u1;function Y_(){if(u1)return v0.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(),v0.exports=nC(),v0.exports}var c1;function iC(){if(c1)return Rc;c1=1;var n=tC(),e=Gf(),t=Y_();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 D=!1,$=y.child;$;){if($===o){D=!0,o=y,d=b;break}if($===d){D=!0,d=y,o=b;break}$=$.sibling}if(!D){for($=b.child;$;){if($===o){D=!0,o=b,d=y;break}if($===d){D=!0,d=b,o=y;break}$=$.sibling}if(!D)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"),M=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),H=Symbol.for("react.context"),se=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),j=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function V(r){return r===null||typeof r!="object"?null:(r=Z&&r[Z]||r["@@iterator"],typeof r=="function"?r:null)}var te=Symbol.for("react.client.reference");function me(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===te?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 Y:return"Suspense";case W:return"SuspenseList";case k:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case L:return"Portal";case H:return r.displayName||"Context";case Q: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:me(r.type)||"Memo";case ae:s=r._payload,r=r._init;try{return me(r(s))}catch{}}return null}var le=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},ie=[],de=-1;function I(r){return{current:r}}function pe(r){0>de||(r.current=ie[de],ie[de]=null,de--)}function we(r,s){de++,ie[de]=r.current,r.current=s}var ve=I(null),ge=I(null),ht=I(null),Ge=I(null);function Te(r,s){switch(we(ht,s),we(ge,r),we(ve,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(ve),we(ve,r)}function Le(){pe(ve),pe(ge),pe(ht)}function ut(r){r.memoizedState!==null&&we(Ge,r);var s=ve.current,o=kx(s,r.type);s!==o&&(we(ge,r),we(ve,o))}function Oe(r){ge.current===r&&(pe(ve),pe(ge)),Ge.current===r&&(pe(Ge),Ac._currentValue=ee)}var _e,Ke;function Je(r){if(_e===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);_e=s&&s[1]||"",Ke=-1<o.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+_e+r+Ke}var bt=!1;function ft(r,s){if(!r||bt)return"";bt=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(s){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(Ye){var $e=Ye}Reflect.construct(r,[],ct)}else{try{ct.call()}catch(Ye){$e=Ye}r.call(ct.prototype)}}else{try{throw Error()}catch(Ye){$e=Ye}(ct=r())&&typeof ct.catch=="function"&&ct.catch(function(){})}}catch(Ye){if(Ye&&$e&&typeof Ye.stack=="string")return[Ye.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(),D=b[0],$=b[1];if(D&&$){var be=D.split(`
|
||
`),Ue=$.split(`
|
||
`);for(y=d=0;d<be.length&&!be[d].includes("DetermineComponentFrameRoot");)d++;for(;y<Ue.length&&!Ue[y].includes("DetermineComponentFrameRoot");)y++;if(d===be.length||y===Ue.length)for(d=be.length-1,y=Ue.length-1;1<=d&&0<=y&&be[d]!==Ue[y];)y--;for(;1<=d&&0<=y;d--,y--)if(be[d]!==Ue[y]){if(d!==1||y!==1)do if(d--,y--,0>y||be[d]!==Ue[y]){var at=`
|
||
`+be[d].replace(" at new "," at ");return r.displayName&&at.includes("<anonymous>")&&(at=at.replace("<anonymous>",r.displayName)),at}while(1<=d&&0<=y);break}}}finally{bt=!1,Error.prepareStackTrace=o}return(o=r?r.displayName||r.name:"")?Je(o):""}function kt(r,s){switch(r.tag){case 26:case 27:case 5:return Je(r.type);case 16:return Je("Lazy");case 13:return r.child!==s&&s!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return ft(r.type,!1);case 11:return ft(r.type.render,!1);case 1:return ft(r.type,!0);case 31:return Je("Activity");default:return""}}function Pe(r){try{var s="",o=null;do s+=kt(r,o),o=r,r=r.return;while(r);return s}catch(d){return`
|
||
Error generating stack: `+d.message+`
|
||
`+d.stack}}var Xe=Object.prototype.hasOwnProperty,st=n.unstable_scheduleCallback,Ze=n.unstable_cancelCallback,nt=n.unstable_shouldYield,wt=n.unstable_requestPaint,fe=n.unstable_now,He=n.unstable_getCurrentPriorityLevel,Ce=n.unstable_ImmediatePriority,De=n.unstable_UserBlockingPriority,Ie=n.unstable_NormalPriority,Qe=n.unstable_LowPriority,Et=n.unstable_IdlePriority,It=n.log,vt=n.unstable_setDisableYieldValue,Yt=null,Ft=null;function zt(r){if(typeof It=="function"&&vt(r),Ft&&typeof Ft.setStrictMode=="function")try{Ft.setStrictMode(Yt,r)}catch{}}var At=Math.clz32?Math.clz32:dn,Nt=Math.log,ln=Math.LN2;function dn(r){return r>>>=0,r===0?32:31-(Nt(r)/ln|0)|0}var yt=256,Fn=262144,ot=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 P(r,s,o){var d=r.pendingLanes;if(d===0)return 0;var y=0,b=r.suspendedLanes,D=r.pingedLanes;r=r.warmLanes;var $=d&134217727;return $!==0?(d=$&~b,d!==0?y=N(d):(D&=$,D!==0?y=N(D):o||(o=$&~r,o!==0&&(y=N(o))))):($=d&~b,$!==0?y=N($):D!==0?y=N(D):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 ne(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function je(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 qe(){var r=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),r}function dt(r){for(var s=[],o=0;31>o;o++)s.push(r);return s}function $t(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Zt(r,s,o,d,y,b){var D=r.pendingLanes;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=o,r.entangledLanes&=o,r.errorRecoveryDisabledLanes&=o,r.shellSuspendCounter=0;var $=r.entanglements,be=r.expirationTimes,Ue=r.hiddenUpdates;for(o=D&~o;0<o;){var at=31-At(o),ct=1<<at;$[at]=0,be[at]=-1;var $e=Ue[at];if($e!==null)for(Ue[at]=null,at=0;at<$e.length;at++){var Ye=$e[at];Ye!==null&&(Ye.lane&=-536870913)}o&=~ct}d!==0&&hn(r,d,0),b!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=b&~(D&~s))}function hn(r,s,o){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-At(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|o&261930}function Qt(r,s){var o=r.entangledLanes|=s;for(r=r.entanglements;o;){var d=31-At(o),y=1<<d;y&s|r[d]&s&&(r[d]|=s),o&=~y}}function vn(r,s){var o=s&-s;return o=(o&42)!==0?1:Tn(o),(o&(r.suspendedLanes|s))!==0?0:o}function Tn(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 Wt(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function gn(){var r=F.p;return r!==0?r:(r=window.event,r===void 0?32:Wx(r.type))}function sn(r,s){var o=F.p;try{return F.p=r,s()}finally{F.p=o}}var an=Math.random().toString(36).slice(2),Bt="__reactFiber$"+an,Dt="__reactProps$"+an,jt="__reactContainer$"+an,Dn="__reactEvents$"+an,Mt="__reactListeners$"+an,Hn="__reactHandles$"+an,In="__reactResources$"+an,Sn="__reactMarker$"+an;function Xt(r){delete r[Bt],delete r[Dt],delete r[Dn],delete r[Mt],delete r[Hn]}function Un(r){var s=r[Bt];if(s)return s;for(var o=r.parentNode;o;){if(s=o[jt]||o[Bt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(r=jx(r);r!==null;){if(o=r[Bt])return o;r=jx(r)}return s}r=o,o=r.parentNode}return null}function Yn(r){if(r=r[Bt]||r[jt]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Cn(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function ti(r){var s=r[In];return s||(s=r[In]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function wn(r){r[Sn]=!0}var ui=new Set,ri={};function Qn(r,s){Zn(r,s),Zn(r+"Capture",s)}function Zn(r,s){for(ri[r]=s,r=0;r<s.length;r++)ui.add(s[r])}var xi=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]*$"),Mn={},jn={};function qn(r){return Xe.call(jn,r)?!0:Xe.call(Mn,r)?!1:xi.test(r)?jn[r]=!0:(Mn[r]=!0,!1)}function xe(r,s,o){if(qn(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 it(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 mt(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 Rt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ne(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function pt(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(D){o=""+D,b.call(this,D)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(D){o=""+D},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function xt(r){if(!r._valueTracker){var s=Ne(r)?"checked":"value";r._valueTracker=pt(r,s,""+r[s])}}function St(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var o=s.getValue(),d="";return r&&(d=Ne(r)?r.checked?"true":"false":r.value),r=d,r!==o?(s.setValue(r),!0):!1}function Pt(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 Ht=/[\n"\\]/g;function Gt(r){return r.replace(Ht,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function xn(r,s,o,d,y,b,D,$){r.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?r.type=D:r.removeAttribute("type"),s!=null?D==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Rt(s)):r.value!==""+Rt(s)&&(r.value=""+Rt(s)):D!=="submit"&&D!=="reset"||r.removeAttribute("value"),s!=null?Bi(r,D,Rt(s)):o!=null?Bi(r,D,Rt(o)):d!=null&&r.removeAttribute("value"),y==null&&b!=null&&(r.defaultChecked=!!b),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?r.name=""+Rt($):r.removeAttribute("name")}function zn(r,s,o,d,y,b,D,$){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(r.type=b),s!=null||o!=null){if(!(b!=="submit"&&b!=="reset"||s!=null)){xt(r);return}o=o!=null?""+Rt(o):"",s=s!=null?""+Rt(s):o,$||s===r.value||(r.value=s),r.defaultValue=s}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=$?r.checked:!!d,r.defaultChecked=!!d,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(r.name=D),xt(r)}function Bi(r,s,o){s==="number"&&Pt(r.ownerDocument)===r||r.defaultValue===""+o||(r.defaultValue=""+o)}function $n(r,s,o,d){if(r=r.options,s){s={};for(var y=0;y<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=""+Rt(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 Vi(r,s,o){if(s!=null&&(s=""+Rt(s),s!==r.value&&(r.value=s),o==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=o!=null?""+Rt(o):""}function Si(r,s,o,d){if(s==null){if(d!=null){if(o!=null)throw Error(i(92));if(le(d)){if(1<d.length)throw Error(i(93));d=d[0]}o=d}o==null&&(o=""),s=o}o=Rt(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 pi=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 Ri(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||pi.has(s)?s==="float"?r.cssFloat=o:r[s]=(""+o).trim():r[s]=o+"px"}function Vn(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&&Ri(r,y,d)}else for(var b in s)s.hasOwnProperty(b)&&Ri(r,b,s[b])}function Gn(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 Kn=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"]]),An=/^[\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 An.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Jn(){}var Gi=null;function _i(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var R=null,U=null;function ue(r){var s=Yn(r);if(s&&(r=s.stateNode)){var o=r[Dt]||null;e:switch(r=s.stateNode,s.type){case"input":if(xn(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="'+Gt(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var d=o[s];if(d!==r&&d.form===r.form){var y=d[Dt]||null;if(!y)throw Error(i(90));xn(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&&St(d)}break e;case"textarea":Vi(r,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&$n(r,!!o.multiple,s,!1)}}}var Se=!1;function Ee(r,s,o){if(Se)return r(s,o);Se=!0;try{var d=r(s);return d}finally{if(Se=!1,(R!==null||U!==null)&&(_h(),R&&(s=R,r=U,U=R=null,ue(s),r)))for(s=0;s<r.length;s++)ue(r[s])}}function Ve(r,s){var o=r.stateNode;if(o===null)return null;var d=o[Dt]||null;if(d===null)return null;o=d[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(o&&typeof o!="function")throw Error(i(231,s,typeof o));return o}var z=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K=!1;if(z)try{var re={};Object.defineProperty(re,"passive",{get:function(){K=!0}}),window.addEventListener("test",re,re),window.removeEventListener("test",re,re)}catch{K=!1}var ye=null,ze=null,Me=null;function et(){if(Me)return Me;var r,s=ze,o=s.length,d,y="value"in ye?ye.value:ye.textContent,b=y.length;for(r=0;r<o&&s[r]===y[r];r++);var D=o-r;for(d=1;d<=D&&s[o-d]===y[b-d];d++);return Me=y.slice(r,1<d?1-d:void 0)}function gt(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 Tt(){return!0}function Vt(){return!1}function Ut(r){function s(o,d,y,b,D){this._reactName=o,this._targetInst=y,this.type=d,this.nativeEvent=b,this.target=D,this.currentTarget=null;for(var $ in r)r.hasOwnProperty($)&&(o=r[$],this[$]=o?o(b):b[$]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Tt:Vt,this.isPropagationStopped=Vt,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=Tt)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Tt)},persist:function(){},isPersistent:Tt}),s}var un={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ci=Ut(un),Pi=S({},un,{view:0,detail:0}),yn=Ut(Pi),Os,sa,Nr,ci=S({},Pi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bu,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!==Nr&&(Nr&&r.type==="mousemove"?(Os=r.screenX-Nr.screenX,sa=r.screenY-Nr.screenY):sa=Os=0,Nr=r),Os)},movementY:function(r){return"movementY"in r?r.movementY:sa}}),Fi=Ut(ci),_s=S({},ci,{dataTransfer:0}),Do=Ut(_s),km=S({},Pi,{relatedTarget:0}),Oa=Ut(km),Mo=S({},un,{animationName:0,elapsedTime:0,pseudoElement:0}),jo=Ut(Mo),_l=S({},un,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Wr=Ut(_l),ws=S({},un,{data:0}),Ro=Ut(ws),Ed={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Em={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"},Cm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Am(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=Cm[r])?!!s[r]:!1}function Bu(){return Am}var Cd=S({},Pi,{key:function(r){if(r.key){var s=Ed[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=gt(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Em[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bu,charCode:function(r){return r.type==="keypress"?gt(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?gt(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Ad=Ut(Cd),wl=S({},ci,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),La=Ut(wl),Tl=S({},Pi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bu}),aa=Ut(Tl),Nm=S({},un,{propertyName:0,elapsedTime:0,pseudoElement:0}),Nd=Ut(Nm),Dd=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}),Md=Ut(Dd),Dm=S({},un,{newState:0,oldState:0}),Mm=Ut(Dm),jm=[9,13,27,32],Ia=z&&"CompositionEvent"in window,Oo=null;z&&"documentMode"in document&&(Oo=document.documentMode);var jd=z&&"TextEvent"in window&&!Oo,Rd=z&&(!Ia||Oo&&8<Oo&&11>=Oo),Od=" ",Pu=!1;function Sl(r,s){switch(r){case"keyup":return jm.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ld(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ba=!1;function Rm(r,s){switch(r){case"compositionend":return Ld(s);case"keypress":return s.which!==32?null:(Pu=!0,Od);case"textInput":return r=s.data,r===Od&&Pu?null:r;default:return null}}function Fu(r,s){if(Ba)return r==="compositionend"||!Ia&&Sl(r,s)?(r=et(),Me=ze=ye=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 Rd&&s.locale!=="ko"?null:s.data;default:return null}}var Om={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 Uu(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Om[r.type]:s==="textarea"}function Id(r,s,o,d){R?U?U.push(d):U=[d]:R=d,s=Ah(s,"onChange"),0<s.length&&(o=new Ci("onChange","change",null,o,d),r.push({event:o,listeners:s}))}var Lo=null,Pa=null;function Lm(r){bx(r,0)}function Io(r){var s=Cn(r);if(St(s))return r}function zu(r,s){if(r==="change")return s}var Hu=!1;if(z){var $u;if(z){var qu="oninput"in document;if(!qu){var Bo=document.createElement("div");Bo.setAttribute("oninput","return;"),qu=typeof Bo.oninput=="function"}$u=qu}else $u=!1;Hu=$u&&(!document.documentMode||9<document.documentMode)}function Bd(){Lo&&(Lo.detachEvent("onpropertychange",Pd),Pa=Lo=null)}function Pd(r){if(r.propertyName==="value"&&Io(Pa)){var s=[];Id(s,Pa,r,_i(r)),Ee(Lm,s)}}function Im(r,s,o){r==="focusin"?(Bd(),Lo=s,Pa=o,Lo.attachEvent("onpropertychange",Pd)):r==="focusout"&&Bd()}function Bm(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Io(Pa)}function Fd(r,s){if(r==="click")return Io(s)}function Pm(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 yr=typeof Object.is=="function"?Object.is:Po;function Ls(r,s){if(yr(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(!Xe.call(s,y)||!yr(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 kl(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Pt(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=Pt(r.document)}return s}function Vu(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 Fm=z&&"documentMode"in document&&11>=document.documentMode,Ua=null,Gu=null,za=null,El=!1;function Ku(r,s,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;El||Ua==null||Ua!==Pt(d)||(d=Ua,"selectionStart"in d&&Vu(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=Ah(Gu,"onSelect"),0<d.length&&(s=new Ci("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={},Wu={};z&&(Wu=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 Wu)return Fo[r]=s[o];return r}var Ud=Ts("animationend"),Ha=Ts("animationiteration"),zd=Ts("animationstart"),Hd=Ts("transitionrun"),$d=Ts("transitionstart"),Um=Ts("transitioncancel"),qd=Ts("transitionend"),Xu=new Map,Yu="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(" ");Yu.push("scrollEnd");function Xr(r,s){Xu.set(r,s),Qn(s,[r])}var $a=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)},Dr=[],qa=0,Qu=0;function Cl(){for(var r=qa,s=Qu=qa=0;s<r;){var o=Dr[s];Dr[s++]=null;var d=Dr[s];Dr[s++]=null;var y=Dr[s];Dr[s++]=null;var b=Dr[s];if(Dr[s++]=null,d!==null&&y!==null){var D=d.pending;D===null?y.next=y:(y.next=D.next,D.next=y),d.pending=y}b!==0&&Vd(o,y,b)}}function Al(r,s,o,d){Dr[qa++]=r,Dr[qa++]=s,Dr[qa++]=o,Dr[qa++]=d,Qu|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Zu(r,s,o,d){return Al(r,s,o,d),Nl(r)}function ua(r,s){return Al(r,null,null,s),Nl(r)}function Vd(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-At(o),r=b.hiddenUpdates,d=r[y],d===null?r[y]=[s]:d.push(s),s.lane=o|536870912),b):null}function Nl(r){if(50<_c)throw _c=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 zm(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 zm(r,s,o,d)}function Ju(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 Gd(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 ec(r,s,o,d,y,b){var D=0;if(d=r,typeof r=="function")Ju(r)&&(D=1);else if(typeof r=="string")D=BE(r,o,ve.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:D=8,y|=24;break;case G:return r=Ui(12,o,s,y|2),r.elementType=G,r.lanes=b,r;case Y:return r=Ui(13,o,s,y),r.elementType=Y,r.lanes=b,r;case W:return r=Ui(19,o,s,y),r.elementType=W,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case H:D=10;break e;case Q:D=9;break e;case se:D=11;break e;case O:D=14;break e;case ae:D=16,d=null;break e}D=29,o=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=Ui(D,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 tc(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 Mr(r,s){if(typeof r=="object"&&r!==null){var o=zo.get(r);return o!==void 0?o:(s={value:r,source:s,stack:Pe(s)},zo.set(r,s),s)}return{value:r,source:s,stack:Pe(s)}}var Ka=[],Wa=0,Dl=null,Ho=0,br=[],jr=0,Ps=null,Yr=1,hr="";function kn(r,s){Ka[Wa++]=Ho,Ka[Wa++]=Dl,Dl=r,Ho=s}function Fs(r,s,o){br[jr++]=Yr,br[jr++]=hr,br[jr++]=Ps,Ps=r;var d=Yr;r=hr;var y=32-At(d)-1;d&=~(1<<y),o+=1;var b=32-At(s)+y;if(30<b){var D=y-y%5;b=(d&(1<<D)-1).toString(32),d>>=D,y-=D,Yr=1<<32-At(s)+y|o<<y|d,hr=b+r}else Yr=1<<b|o<<y|d,hr=r}function ir(r){r.return!==null&&(kn(r,1),Fs(r,1,0))}function Rr(r){for(;r===Dl;)Dl=Ka[--Wa],Ka[Wa]=null,Ho=Ka[--Wa],Ka[Wa]=null;for(;r===Ps;)Ps=br[--jr],br[jr]=null,hr=br[--jr],br[jr]=null,Yr=br[--jr],br[jr]=null}function Kd(r,s){br[jr++]=Yr,br[jr++]=hr,br[jr++]=Ps,Yr=s.id,hr=s.overflow,Ps=r}var Zi=null,gi=null,Rn=!1,Us=null,Or=!1,nc=Error(i(519));function zs(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw x(Mr(s,r)),nc}function Wd(r){var s=r.stateNode,o=r.type,d=r.memoizedProps;switch(s[Bt]=r,s[Dt]=d,o){case"dialog":Ln("cancel",s),Ln("close",s);break;case"iframe":case"object":case"embed":Ln("load",s);break;case"video":case"audio":for(o=0;o<Tc.length;o++)Ln(Tc[o],s);break;case"source":Ln("error",s);break;case"img":case"image":case"link":Ln("error",s),Ln("load",s);break;case"details":Ln("toggle",s);break;case"input":Ln("invalid",s),zn(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Ln("invalid",s);break;case"textarea":Ln("invalid",s),Si(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&&(Ln("beforetoggle",s),Ln("toggle",s)),d.onScroll!=null&&Ln("scroll",s),d.onScrollEnd!=null&&Ln("scrollend",s),d.onClick!=null&&(s.onclick=Jn),s=!0):s=!1,s||zs(r,!0)}function ic(r){for(Zi=r.return;Zi;)switch(Zi.tag){case 5:case 31:case 13:Or=!1;return;case 27:case 3:Or=!0;return;default:Zi=Zi.return}}function m(r){if(r!==Zi)return!1;if(!Rn)return ic(r),Rn=!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),ic(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=r0,r0=null,gi=r):gi=s):gi=Zi?cs(r.stateNode.nextSibling):null;return!0}function v(){gi=Zi=null,Rn=!1}function w(){var r=Us;return r!==null&&(Pr===null?Pr=r:Pr.push.apply(Pr,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){we(T,s._currentValue),s._currentValue=o}function oe(r){r._currentValue=T.current,pe(T)}function he(r,s,o){for(;r!==null;){var d=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,d!==null&&(d.childLanes|=s)):d!==null&&(d.childLanes&s)!==s&&(d.childLanes|=s),r===o)break;r=r.return}}function Ae(r,s,o,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var b=y.dependencies;if(b!==null){var D=y.child;b=b.firstContext;e:for(;b!==null;){var $=b;b=y;for(var be=0;be<s.length;be++)if($.context===s[be]){b.lanes|=o,$=b.alternate,$!==null&&($.lanes|=o),he(b.return,o,r),d||(D=null);break e}b=$.next}}else if(y.tag===18){if(D=y.return,D===null)throw Error(i(341));D.lanes|=o,b=D.alternate,b!==null&&(b.lanes|=o),he(D,o,r),D=null}else D=y.child;if(D!==null)D.return=y;else for(D=y;D!==null;){if(D===r){D=null;break}if(y=D.sibling,y!==null){y.return=D.return,D=y;break}D=D.return}y=D}}function We(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 D=y.alternate;if(D===null)throw Error(i(387));if(D=D.memoizedProps,D!==null){var $=y.type;yr(y.pendingProps.value,D.value)||(r!==null?r.push($):r=[$])}}else if(y===Ge.current){if(D=y.alternate,D===null)throw Error(i(387));D.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(Ac):r=[Ac])}y=y.return}r!==null&&Ae(s,r,o,d),s.flags|=262144}function Ct(r){for(r=r.firstContext;r!==null;){if(!yr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function rt(r){A=r,X=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Ot(r){return Ki(A,r)}function fn(r,s){return A===null&&rt(r),Ki(r,s)}function Ki(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 Tr=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()})}},Hs=n.unstable_scheduleCallback,$o=n.unstable_NormalPriority,wi={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ca(){return{controller:new Tr,data:new Map,refCount:0}}function ks(r){r.refCount--,r.refCount===0&&Hs($o,function(){r.controller.abort()})}var $s=null,ai=0,ls=0,ar=null;function Ik(r,s){if($s===null){var o=$s=[];ai=0,ls=qp(),ar={status:"pending",value:void 0,then:function(d){o.push(d)}}}return ai++,s.then(lb,lb),s}function lb(){if(--ai===0&&$s!==null){ar!==null&&(ar.status="fulfilled");var r=$s;$s=null,ls=0,ar=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Bk(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=q.S;q.S=function(r,s){Gv=fe(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Ik(r,s),ub!==null&&ub(r,s)};var qo=I(null);function Hm(){var r=qo.current;return r!==null?r:yi.pooledCache}function Xd(r,s){s===null?we(qo,qo.current):we(qo,s.pool)}function cb(){var r=Hm();return r===null?null:{parent:wi._currentValue,pool:r}}var Ml=Error(i(460)),$m=Error(i(474)),Yd=Error(i(542)),Qd={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(Jn,Jn),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,mb(r),r;default:if(typeof s.status=="string")s.then(Jn,Jn);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,mb(r),r}throw Go=s,Ml}}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,Ml):o}}var Go=null;function fb(){if(Go===null)throw Error(i(459));var r=Go;return Go=null,r}function mb(r){if(r===Ml||r===Yd)throw Error(i(483))}var jl=null,rc=0;function Zd(r){var s=rc;return rc+=1,jl===null&&(jl=[]),hb(jl,r,s)}function sc(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function Jd(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 pb(r){function s(Re,ke){if(r){var Fe=Re.deletions;Fe===null?(Re.deletions=[ke],Re.flags|=16):Fe.push(ke)}}function o(Re,ke){if(!r)return null;for(;ke!==null;)s(Re,ke),ke=ke.sibling;return null}function d(Re){for(var ke=new Map;Re!==null;)Re.key!==null?ke.set(Re.key,Re):ke.set(Re.index,Re),Re=Re.sibling;return ke}function y(Re,ke){return Re=Ss(Re,ke),Re.index=0,Re.sibling=null,Re}function b(Re,ke,Fe){return Re.index=Fe,r?(Fe=Re.alternate,Fe!==null?(Fe=Fe.index,Fe<ke?(Re.flags|=67108866,ke):Fe):(Re.flags|=67108866,ke)):(Re.flags|=1048576,ke)}function D(Re){return r&&Re.alternate===null&&(Re.flags|=67108866),Re}function $(Re,ke,Fe,lt){return ke===null||ke.tag!==6?(ke=Uo(Fe,Re.mode,lt),ke.return=Re,ke):(ke=y(ke,Fe),ke.return=Re,ke)}function be(Re,ke,Fe,lt){var Jt=Fe.type;return Jt===E?at(Re,ke,Fe.props.children,lt,Fe.key):ke!==null&&(ke.elementType===Jt||typeof Jt=="object"&&Jt!==null&&Jt.$$typeof===ae&&Vo(Jt)===ke.type)?(ke=y(ke,Fe.props),sc(ke,Fe),ke.return=Re,ke):(ke=ec(Fe.type,Fe.key,Fe.props,null,Re.mode,lt),sc(ke,Fe),ke.return=Re,ke)}function Ue(Re,ke,Fe,lt){return ke===null||ke.tag!==4||ke.stateNode.containerInfo!==Fe.containerInfo||ke.stateNode.implementation!==Fe.implementation?(ke=Ga(Fe,Re.mode,lt),ke.return=Re,ke):(ke=y(ke,Fe.children||[]),ke.return=Re,ke)}function at(Re,ke,Fe,lt,Jt){return ke===null||ke.tag!==7?(ke=Bs(Fe,Re.mode,lt,Jt),ke.return=Re,ke):(ke=y(ke,Fe),ke.return=Re,ke)}function ct(Re,ke,Fe){if(typeof ke=="string"&&ke!==""||typeof ke=="number"||typeof ke=="bigint")return ke=Uo(""+ke,Re.mode,Fe),ke.return=Re,ke;if(typeof ke=="object"&&ke!==null){switch(ke.$$typeof){case M:return Fe=ec(ke.type,ke.key,ke.props,null,Re.mode,Fe),sc(Fe,ke),Fe.return=Re,Fe;case L:return ke=Ga(ke,Re.mode,Fe),ke.return=Re,ke;case ae:return ke=Vo(ke),ct(Re,ke,Fe)}if(le(ke)||V(ke))return ke=Bs(ke,Re.mode,Fe,null),ke.return=Re,ke;if(typeof ke.then=="function")return ct(Re,Zd(ke),Fe);if(ke.$$typeof===H)return ct(Re,fn(Re,ke),Fe);Jd(Re,ke)}return null}function $e(Re,ke,Fe,lt){var Jt=ke!==null?ke.key:null;if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint")return Jt!==null?null:$(Re,ke,""+Fe,lt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case M:return Fe.key===Jt?be(Re,ke,Fe,lt):null;case L:return Fe.key===Jt?Ue(Re,ke,Fe,lt):null;case ae:return Fe=Vo(Fe),$e(Re,ke,Fe,lt)}if(le(Fe)||V(Fe))return Jt!==null?null:at(Re,ke,Fe,lt,null);if(typeof Fe.then=="function")return $e(Re,ke,Zd(Fe),lt);if(Fe.$$typeof===H)return $e(Re,ke,fn(Re,Fe),lt);Jd(Re,Fe)}return null}function Ye(Re,ke,Fe,lt,Jt){if(typeof lt=="string"&<!==""||typeof lt=="number"||typeof lt=="bigint")return Re=Re.get(Fe)||null,$(ke,Re,""+lt,Jt);if(typeof lt=="object"&<!==null){switch(lt.$$typeof){case M:return Re=Re.get(lt.key===null?Fe:lt.key)||null,be(ke,Re,lt,Jt);case L:return Re=Re.get(lt.key===null?Fe:lt.key)||null,Ue(ke,Re,lt,Jt);case ae:return lt=Vo(lt),Ye(Re,ke,Fe,lt,Jt)}if(le(lt)||V(lt))return Re=Re.get(Fe)||null,at(ke,Re,lt,Jt,null);if(typeof lt.then=="function")return Ye(Re,ke,Fe,Zd(lt),Jt);if(lt.$$typeof===H)return Ye(Re,ke,Fe,fn(ke,lt),Jt);Jd(ke,lt)}return null}function qt(Re,ke,Fe,lt){for(var Jt=null,Wn=null,Kt=ke,_n=ke=0,Pn=null;Kt!==null&&_n<Fe.length;_n++){Kt.index>_n?(Pn=Kt,Kt=null):Pn=Kt.sibling;var Xn=$e(Re,Kt,Fe[_n],lt);if(Xn===null){Kt===null&&(Kt=Pn);break}r&&Kt&&Xn.alternate===null&&s(Re,Kt),ke=b(Xn,ke,_n),Wn===null?Jt=Xn:Wn.sibling=Xn,Wn=Xn,Kt=Pn}if(_n===Fe.length)return o(Re,Kt),Rn&&kn(Re,_n),Jt;if(Kt===null){for(;_n<Fe.length;_n++)Kt=ct(Re,Fe[_n],lt),Kt!==null&&(ke=b(Kt,ke,_n),Wn===null?Jt=Kt:Wn.sibling=Kt,Wn=Kt);return Rn&&kn(Re,_n),Jt}for(Kt=d(Kt);_n<Fe.length;_n++)Pn=Ye(Kt,Re,_n,Fe[_n],lt),Pn!==null&&(r&&Pn.alternate!==null&&Kt.delete(Pn.key===null?_n:Pn.key),ke=b(Pn,ke,_n),Wn===null?Jt=Pn:Wn.sibling=Pn,Wn=Pn);return r&&Kt.forEach(function(fo){return s(Re,fo)}),Rn&&kn(Re,_n),Jt}function on(Re,ke,Fe,lt){if(Fe==null)throw Error(i(151));for(var Jt=null,Wn=null,Kt=ke,_n=ke=0,Pn=null,Xn=Fe.next();Kt!==null&&!Xn.done;_n++,Xn=Fe.next()){Kt.index>_n?(Pn=Kt,Kt=null):Pn=Kt.sibling;var fo=$e(Re,Kt,Xn.value,lt);if(fo===null){Kt===null&&(Kt=Pn);break}r&&Kt&&fo.alternate===null&&s(Re,Kt),ke=b(fo,ke,_n),Wn===null?Jt=fo:Wn.sibling=fo,Wn=fo,Kt=Pn}if(Xn.done)return o(Re,Kt),Rn&&kn(Re,_n),Jt;if(Kt===null){for(;!Xn.done;_n++,Xn=Fe.next())Xn=ct(Re,Xn.value,lt),Xn!==null&&(ke=b(Xn,ke,_n),Wn===null?Jt=Xn:Wn.sibling=Xn,Wn=Xn);return Rn&&kn(Re,_n),Jt}for(Kt=d(Kt);!Xn.done;_n++,Xn=Fe.next())Xn=Ye(Kt,Re,_n,Xn.value,lt),Xn!==null&&(r&&Xn.alternate!==null&&Kt.delete(Xn.key===null?_n:Xn.key),ke=b(Xn,ke,_n),Wn===null?Jt=Xn:Wn.sibling=Xn,Wn=Xn);return r&&Kt.forEach(function(WE){return s(Re,WE)}),Rn&&kn(Re,_n),Jt}function fi(Re,ke,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 M:e:{for(var Jt=Fe.key;ke!==null;){if(ke.key===Jt){if(Jt=Fe.type,Jt===E){if(ke.tag===7){o(Re,ke.sibling),lt=y(ke,Fe.props.children),lt.return=Re,Re=lt;break e}}else if(ke.elementType===Jt||typeof Jt=="object"&&Jt!==null&&Jt.$$typeof===ae&&Vo(Jt)===ke.type){o(Re,ke.sibling),lt=y(ke,Fe.props),sc(lt,Fe),lt.return=Re,Re=lt;break e}o(Re,ke);break}else s(Re,ke);ke=ke.sibling}Fe.type===E?(lt=Bs(Fe.props.children,Re.mode,lt,Fe.key),lt.return=Re,Re=lt):(lt=ec(Fe.type,Fe.key,Fe.props,null,Re.mode,lt),sc(lt,Fe),lt.return=Re,Re=lt)}return D(Re);case L:e:{for(Jt=Fe.key;ke!==null;){if(ke.key===Jt)if(ke.tag===4&&ke.stateNode.containerInfo===Fe.containerInfo&&ke.stateNode.implementation===Fe.implementation){o(Re,ke.sibling),lt=y(ke,Fe.children||[]),lt.return=Re,Re=lt;break e}else{o(Re,ke);break}else s(Re,ke);ke=ke.sibling}lt=Ga(Fe,Re.mode,lt),lt.return=Re,Re=lt}return D(Re);case ae:return Fe=Vo(Fe),fi(Re,ke,Fe,lt)}if(le(Fe))return qt(Re,ke,Fe,lt);if(V(Fe)){if(Jt=V(Fe),typeof Jt!="function")throw Error(i(150));return Fe=Jt.call(Fe),on(Re,ke,Fe,lt)}if(typeof Fe.then=="function")return fi(Re,ke,Zd(Fe),lt);if(Fe.$$typeof===H)return fi(Re,ke,fn(Re,Fe),lt);Jd(Re,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,ke!==null&&ke.tag===6?(o(Re,ke.sibling),lt=y(ke,Fe),lt.return=Re,Re=lt):(o(Re,ke),lt=Uo(Fe,Re.mode,lt),lt.return=Re,Re=lt),D(Re)):o(Re,ke)}return function(Re,ke,Fe,lt){try{rc=0;var Jt=fi(Re,ke,Fe,lt);return jl=null,Jt}catch(Kt){if(Kt===Ml||Kt===Yd)throw Kt;var Wn=Ui(29,Kt,null,Re.mode);return Wn.lanes=lt,Wn.return=Re,Wn}}}var Ko=pb(!0),gb=pb(!1),Xa=!1;function qm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vm(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,(ei&2)!==0){var y=d.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),d.pending=s,s=Nl(r),Vd(r,null,o),s}return Al(r,d,s,o),Nl(r)}function ac(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,Qt(r,o)}}function Gm(r,s){var o=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var y=null,b=null;if(o=o.firstBaseUpdate,o!==null){do{var D={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};b===null?y=b=D:b=b.next=D,o=o.next}while(o!==null);b===null?y=b=s:b=b.next=s}else y=b=s;o={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:b,shared:d.shared,callbacks:d.callbacks},r.updateQueue=o;return}r=o.lastBaseUpdate,r===null?o.firstBaseUpdate=s:r.next=s,o.lastBaseUpdate=s}var Km=!1;function oc(){if(Km){var r=ar;if(r!==null)throw r}}function lc(r,s,o,d){Km=!1;var y=r.updateQueue;Xa=!1;var b=y.firstBaseUpdate,D=y.lastBaseUpdate,$=y.shared.pending;if($!==null){y.shared.pending=null;var be=$,Ue=be.next;be.next=null,D===null?b=Ue:D.next=Ue,D=be;var at=r.alternate;at!==null&&(at=at.updateQueue,$=at.lastBaseUpdate,$!==D&&($===null?at.firstBaseUpdate=Ue:$.next=Ue,at.lastBaseUpdate=be))}if(b!==null){var ct=y.baseState;D=0,at=Ue=be=null,$=b;do{var $e=$.lane&-536870913,Ye=$e!==$.lane;if(Ye?(Bn&$e)===$e:(d&$e)===$e){$e!==0&&$e===ls&&(Km=!0),at!==null&&(at=at.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var qt=r,on=$;$e=s;var fi=o;switch(on.tag){case 1:if(qt=on.payload,typeof qt=="function"){ct=qt.call(fi,ct,$e);break e}ct=qt;break e;case 3:qt.flags=qt.flags&-65537|128;case 0:if(qt=on.payload,$e=typeof qt=="function"?qt.call(fi,ct,$e):qt,$e==null)break e;ct=S({},ct,$e);break e;case 2:Xa=!0}}$e=$.callback,$e!==null&&(r.flags|=64,Ye&&(r.flags|=8192),Ye=y.callbacks,Ye===null?y.callbacks=[$e]:Ye.push($e))}else Ye={lane:$e,tag:$.tag,payload:$.payload,callback:$.callback,next:null},at===null?(Ue=at=Ye,be=ct):at=at.next=Ye,D|=$e;if($=$.next,$===null){if($=y.shared.pending,$===null)break;Ye=$,$=Ye.next,Ye.next=null,y.lastBaseUpdate=Ye,y.shared.pending=null}}while(!0);at===null&&(be=ct),y.baseState=be,y.firstBaseUpdate=Ue,y.lastBaseUpdate=at,b===null&&(y.shared.lanes=0),no|=D,r.lanes=D,r.memoizedState=ct}}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 Rl=I(null),eh=I(0);function vb(r,s){r=va,we(eh,r),we(Rl,s),va=r|s.baseLanes}function Wm(){we(eh,va),we(Rl,Rl.current)}function Xm(){va=eh.current,pe(Rl),pe(eh)}var Qr=I(null),us=null;function Za(r){var s=r.alternate;we(Wi,Wi.current&1),we(Qr,r),us===null&&(s===null||Rl.current!==null||s.memoizedState!==null)&&(us=r)}function Ym(r){we(Wi,Wi.current),we(Qr,r),us===null&&(us=r)}function xb(r){r.tag===22?(we(Wi,Wi.current),we(Qr,r),us===null&&(us=r)):Ja()}function Ja(){we(Wi,Wi.current),we(Qr,Qr.current)}function Zr(r){pe(Qr),us===r&&(us=null),pe(Wi)}var Wi=I(0);function th(r){for(var s=r;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||n0(o)||i0(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,bn=null,di=null,Ji=null,nh=!1,Ol=!1,Wo=!1,ih=0,uc=0,Ll=null,Pk=0;function zi(){throw Error(i(321))}function Qm(r,s){if(s===null)return!1;for(var o=0;o<s.length&&o<r.length;o++)if(!yr(r[o],s[o]))return!1;return!0}function Zm(r,s,o,d,y,b){return da=b,bn=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,q.H=r===null||r.memoizedState===null?iv:fp,Wo=!1,b=o(d,y),Wo=!1,Ol&&(b=wb(s,o,d,y)),_b(r),b}function _b(r){q.H=hc;var s=di!==null&&di.next!==null;if(da=0,Ji=di=bn=null,nh=!1,uc=0,Ll=null,s)throw Error(i(300));r===null||er||(r=r.dependencies,r!==null&&Ct(r)&&(er=!0))}function wb(r,s,o,d){bn=r;var y=0;do{if(Ol&&(Ll=null),uc=0,Ol=!1,25<=y)throw Error(i(301));if(y+=1,Ji=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)}q.H=rv,b=s(o,d)}while(Ol);return b}function Fk(){var r=q.H,s=r.useState()[0];return s=typeof s.then=="function"?cc(s):s,r=r.useState()[0],(di!==null?di.memoizedState:null)!==r&&(bn.flags|=1024),s}function Jm(){var r=ih!==0;return ih=0,r}function ep(r,s,o){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~o}function tp(r){if(nh){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}nh=!1}da=0,Ji=di=bn=null,Ol=!1,uc=ih=0,Ll=null}function Sr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ji===null?bn.memoizedState=Ji=r:Ji=Ji.next=r,Ji}function Xi(){if(di===null){var r=bn.alternate;r=r!==null?r.memoizedState:null}else r=di.next;var s=Ji===null?bn.memoizedState:Ji.next;if(s!==null)Ji=s,di=r;else{if(r===null)throw bn.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},Ji===null?bn.memoizedState=Ji=r:Ji=Ji.next=r}return Ji}function rh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cc(r){var s=uc;return uc+=1,Ll===null&&(Ll=[]),r=hb(Ll,r,s),s=bn,(Ji===null?s.memoizedState:Ji.next)===null&&(s=s.alternate,q.H=s===null||s.memoizedState===null?iv:fp),r}function sh(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return cc(r);if(r.$$typeof===H)return Ot(r)}throw Error(i(438,String(r)))}function np(r){var s=null,o=bn.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var d=bn.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=rh(),bn.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 ah(r){var s=Xi();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 D=y.next;y.next=b.next,b.next=D}s.baseQueue=y=b,d.pending=null}if(b=r.baseState,y===null)r.memoizedState=b;else{s=y.next;var $=D=null,be=null,Ue=s,at=!1;do{var ct=Ue.lane&-536870913;if(ct!==Ue.lane?(Bn&ct)===ct:(da&ct)===ct){var $e=Ue.revertLane;if($e===0)be!==null&&(be=be.next={lane:0,revertLane:0,gesture:null,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null}),ct===ls&&(at=!0);else if((da&$e)===$e){Ue=Ue.next,$e===ls&&(at=!0);continue}else ct={lane:0,revertLane:Ue.revertLane,gesture:null,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null},be===null?($=be=ct,D=b):be=be.next=ct,bn.lanes|=$e,no|=$e;ct=Ue.action,Wo&&o(b,ct),b=Ue.hasEagerState?Ue.eagerState:o(b,ct)}else $e={lane:ct,revertLane:Ue.revertLane,gesture:Ue.gesture,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null},be===null?($=be=$e,D=b):be=be.next=$e,bn.lanes|=ct,no|=ct;Ue=Ue.next}while(Ue!==null&&Ue!==s);if(be===null?D=b:be.next=$,!yr(b,r.memoizedState)&&(er=!0,at&&(o=ar,o!==null)))throw o;r.memoizedState=b,r.baseState=D,r.baseQueue=be,d.lastRenderedState=b}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function rp(r){var s=Xi(),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 D=y=y.next;do b=r(b,D.action),D=D.next;while(D!==y);yr(b,s.memoizedState)||(er=!0),s.memoizedState=b,s.baseQueue===null&&(s.baseState=b),o.lastRenderedState=b}return[b,d]}function Tb(r,s,o){var d=bn,y=Xi(),b=Rn;if(b){if(o===void 0)throw Error(i(407));o=o()}else o=s();var D=!yr((di||y).memoizedState,o);if(D&&(y.memoizedState=o,er=!0),y=y.queue,op(Eb.bind(null,d,y,r),[r]),y.getSnapshot!==s||D||Ji!==null&&Ji.memoizedState.tag&1){if(d.flags|=2048,Il(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=bn.updateQueue,s===null?(s=rh(),bn.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!yr(r,o)}catch{return!0}}function Ab(r){var s=ua(r,2);s!==null&&Fr(s,r,2)}function sp(r){var s=Sr();if(typeof r=="function"){var o=r;if(r=o(),Wo){zt(!0);try{o()}finally{zt(!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 Uk(r,s,o,d,y){if(uh(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(D){b.listeners.push(D)}};q.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=q.T,D={};q.T=D;try{var $=o(y,d),be=q.S;be!==null&&be(D,$),Mb(r,s,$)}catch(Ue){ap(r,s,Ue)}finally{b!==null&&D.types!==null&&(b.types=D.types),q.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(Rn){var o=yi.formState;if(o!==null){e:{var d=bn;if(Rn){if(gi){t:{for(var y=gi,b=Or;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=Sr(),o.memoizedState=o.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ob,lastRenderedState:s},o.queue=d,o=ev.bind(null,bn,d),d.dispatch=o,d=sp(!1),b=hp.bind(null,bn,!1,d.queue),d=Sr(),y={state:s,dispatch:null,action:r,pending:null},d.queue=y,o=Uk.bind(null,bn,y,b,o),y.dispatch=o,d.memoizedState=r,[s,o,!1]}function Ib(r){var s=Xi();return Bb(s,di,r)}function Bb(r,s,o){if(s=ip(r,s,Ob)[0],r=ah(ha)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=cc(s)}catch(D){throw D===Ml?Yd:D}else d=s;s=Xi();var y=s.queue,b=y.dispatch;return o!==s.memoizedState&&(bn.flags|=2048,Il(9,{destroy:void 0},zk.bind(null,y,o),null)),[d,b,r]}function zk(r,s){r.action=s}function Pb(r){var s=Xi(),o=di;if(o!==null)return Bb(s,o,r);Xi(),s=s.memoizedState,o=Xi();var d=o.queue.dispatch;return o.memoizedState=r,[s,d,!1]}function Il(r,s,o,d){return r={tag:r,create:o,deps:d,inst:s,next:null},s=bn.updateQueue,s===null&&(s=rh(),bn.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 Xi().memoizedState}function oh(r,s,o,d){var y=Sr();bn.flags|=r,y.memoizedState=Il(1|s,{destroy:void 0},o,d===void 0?null:d)}function lh(r,s,o,d){var y=Xi();d=d===void 0?null:d;var b=y.memoizedState.inst;di!==null&&d!==null&&Qm(d,di.memoizedState.deps)?y.memoizedState=Il(s,b,o,d):(bn.flags|=r,y.memoizedState=Il(1|s,b,o,d))}function Ub(r,s){oh(8390656,8,r,s)}function op(r,s){lh(2048,8,r,s)}function Hk(r){bn.flags|=4;var s=bn.updateQueue;if(s===null)s=rh(),bn.updateQueue=s,s.events=[r];else{var o=s.events;o===null?s.events=[r]:o.push(r)}}function zb(r){var s=Xi().memoizedState;return Hk({ref:s,nextImpl:r}),function(){if((ei&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function Hb(r,s){return lh(4,2,r,s)}function $b(r,s){return lh(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,lh(4,4,qb.bind(null,s,r),o)}function lp(){}function Gb(r,s){var o=Xi();s=s===void 0?null:s;var d=o.memoizedState;return s!==null&&Qm(s,d[1])?d[0]:(o.memoizedState=[r,s],r)}function Kb(r,s){var o=Xi();s=s===void 0?null:s;var d=o.memoizedState;if(s!==null&&Qm(s,d[1]))return d[0];if(d=r(),Wo){zt(!0);try{r()}finally{zt(!1)}}return o.memoizedState=[d,s],d}function up(r,s,o){return o===void 0||(da&1073741824)!==0&&(Bn&261930)===0?r.memoizedState=s:(r.memoizedState=o,r=Wv(),bn.lanes|=r,no|=r,o)}function Wb(r,s,o,d){return yr(o,s)?o:Rl.current!==null?(r=up(r,o,d),yr(r,s)||(er=!0),r):(da&42)===0||(da&1073741824)!==0&&(Bn&261930)===0?(er=!0,r.memoizedState=o):(r=Wv(),bn.lanes|=r,no|=r,s)}function Xb(r,s,o,d,y){var b=F.p;F.p=b!==0&&8>b?b:8;var D=q.T,$={};q.T=$,hp(r,!1,s,o);try{var be=y(),Ue=q.S;if(Ue!==null&&Ue($,be),be!==null&&typeof be=="object"&&typeof be.then=="function"){var at=Bk(be,d);dc(r,s,at,ts(r))}else dc(r,s,d,ts(r))}catch(ct){dc(r,s,{then:function(){},status:"rejected",reason:ct},ts())}finally{F.p=b,D!==null&&$.types!==null&&(D.types=$.types),q.T=D}}function $k(){}function cp(r,s,o,d){if(r.tag!==5)throw Error(i(476));var y=Yb(r).queue;Xb(r,y,s,ee,o===null?$k:function(){return Qb(r),o(d)})}function Yb(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:ee,baseState:ee,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:ee},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),dc(r,s.next.queue,{},ts())}function dp(){return Ot(Ac)}function Zb(){return Xi().memoizedState}function Jb(){return Xi().memoizedState}function qk(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&&(Fr(d,s,o),ac(d,s,o)),s={cache:ca()},r.payload=s;return}s=s.return}}function Vk(r,s,o){var d=ts();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},uh(r)?tv(s,o):(o=Zu(r,s,o,d),o!==null&&(Fr(o,r,d),nv(o,s,d)))}function ev(r,s,o){var d=ts();dc(r,s,o,d)}function dc(r,s,o,d){var y={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(uh(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 D=s.lastRenderedState,$=b(D,o);if(y.hasEagerState=!0,y.eagerState=$,yr($,D))return Al(r,s,y,0),yi===null&&Cl(),!1}catch{}if(o=Zu(r,s,y,d),o!==null)return Fr(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},uh(r)){if(s)throw Error(i(479))}else s=Zu(r,o,d,2),s!==null&&Fr(s,r,2)}function uh(r){var s=r.alternate;return r===bn||s!==null&&s===bn}function tv(r,s){Ol=nh=!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,Qt(r,o)}}var hc={readContext:Ot,use:sh,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};hc.useEffectEvent=zi;var iv={readContext:Ot,use:sh,useCallback:function(r,s){return Sr().memoizedState=[r,s===void 0?null:s],r},useContext:Ot,useEffect:Ub,useImperativeHandle:function(r,s,o){o=o!=null?o.concat([r]):null,oh(4194308,4,qb.bind(null,s,r),o)},useLayoutEffect:function(r,s){return oh(4194308,4,r,s)},useInsertionEffect:function(r,s){oh(4,2,r,s)},useMemo:function(r,s){var o=Sr();s=s===void 0?null:s;var d=r();if(Wo){zt(!0);try{r()}finally{zt(!1)}}return o.memoizedState=[d,s],d},useReducer:function(r,s,o){var d=Sr();if(o!==void 0){var y=o(s);if(Wo){zt(!0);try{o(s)}finally{zt(!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=Vk.bind(null,bn,r),[d.memoizedState,r]},useRef:function(r){var s=Sr();return r={current:r},s.memoizedState=r},useState:function(r){r=sp(r);var s=r.queue,o=ev.bind(null,bn,s);return s.dispatch=o,[r.memoizedState,o]},useDebugValue:lp,useDeferredValue:function(r,s){var o=Sr();return up(o,r,s)},useTransition:function(){var r=sp(!1);return r=Xb.bind(null,bn,r.queue,!0,!1),Sr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,o){var d=bn,y=Sr();if(Rn){if(o===void 0)throw Error(i(407));o=o()}else{if(o=s(),yi===null)throw Error(i(349));(Bn&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,Il(9,{destroy:void 0},kb.bind(null,d,b,o,s),null),o},useId:function(){var r=Sr(),s=yi.identifierPrefix;if(Rn){var o=hr,d=Yr;o=(d&~(1<<32-At(d)-1)).toString(32)+o,s="_"+s+"R_"+o,o=ih++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=Pk++,s="_"+s+"r_"+o.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:dp,useFormState:Lb,useActionState:Lb,useOptimistic:function(r){var s=Sr();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,bn,!0,o),o.dispatch=s,[r,s]},useMemoCache:np,useCacheRefresh:function(){return Sr().memoizedState=qk.bind(null,bn)},useEffectEvent:function(r){var s=Sr(),o={impl:r};return s.memoizedState=o,function(){if((ei&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}},fp={readContext:Ot,use:sh,useCallback:Gb,useContext:Ot,useEffect:op,useImperativeHandle:Vb,useInsertionEffect:Hb,useLayoutEffect:$b,useMemo:Kb,useReducer:ah,useRef:Fb,useState:function(){return ah(ha)},useDebugValue:lp,useDeferredValue:function(r,s){var o=Xi();return Wb(o,di.memoizedState,r,s)},useTransition:function(){var r=ah(ha)[0],s=Xi().memoizedState;return[typeof r=="boolean"?r:cc(r),s]},useSyncExternalStore:Tb,useId:Zb,useHostTransitionStatus:dp,useFormState:Ib,useActionState:Ib,useOptimistic:function(r,s){var o=Xi();return Nb(o,di,r,s)},useMemoCache:np,useCacheRefresh:Jb};fp.useEffectEvent=zb;var rv={readContext:Ot,use:sh,useCallback:Gb,useContext:Ot,useEffect:op,useImperativeHandle:Vb,useInsertionEffect:Hb,useLayoutEffect:$b,useMemo:Kb,useReducer:rp,useRef:Fb,useState:function(){return rp(ha)},useDebugValue:lp,useDeferredValue:function(r,s){var o=Xi();return di===null?up(o,r,s):Wb(o,di.memoizedState,r,s)},useTransition:function(){var r=rp(ha)[0],s=Xi().memoizedState;return[typeof r=="boolean"?r:cc(r),s]},useSyncExternalStore:Tb,useId:Zb,useHostTransitionStatus:dp,useFormState:Pb,useActionState:Pb,useOptimistic:function(r,s){var o=Xi();return di!==null?Nb(o,di,r,s):(o.baseState=r,[r,o.queue.dispatch])},useMemoCache:np,useCacheRefresh:Jb};rv.useEffectEvent=zb;function mp(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 pp={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&&(Fr(s,r,d),ac(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&&(Fr(s,r,d),ac(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&&(Fr(s,r,o),ac(s,r,o))}};function sv(r,s,o,d,y,b,D){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,b,D):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&&pp.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){$a(r)}function lv(r){console.error(r)}function uv(r){$a(r)}function ch(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(){ch(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 D=o.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(r.callback=function(){cv(s,o,d),typeof y!="function"&&(io===null?io=new Set([this]):io.add(this));var $=d.stack;this.componentDidCatch(d.value,{componentStack:$!==null?$:""})})}function Gk(r,s,o,d,y){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=o.alternate,s!==null&&We(s,o,y,!0),o=Qr.current,o!==null){switch(o.tag){case 31:case 13:return us===null?wh():o.alternate===null&&Hi===0&&(Hi=3),o.flags&=-257,o.flags|=65536,o.lanes=y,d===Qd?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===Qd?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),wh(),!1}if(Rn)return s=Qr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=y,d!==nc&&(r=Error(i(422),{cause:d}),x(Mr(r,o)))):(d!==nc&&(s=Error(i(423),{cause:d}),x(Mr(s,o))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Mr(d,o),y=gp(r.stateNode,d,y),Gm(r,y),Hi!==4&&(Hi=2)),!1;var b=Error(i(520),{cause:d});if(b=Mr(b,o),xc===null?xc=[b]:xc.push(b),Hi!==4&&(Hi=2),s===null)return!0;d=Mr(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),Gm(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),Gm(o,y),!1}o=o.return}while(o!==null);return!1}var yp=Error(i(461)),er=!1;function fr(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 D={};for(var $ in d)$!=="ref"&&(D[$]=d[$])}else D=d;return rt(s),d=Zm(r,s,o,D,b,y),$=Jm(),r!==null&&!er?(ep(r,s,y),fa(r,s,y)):(Rn&&$&&ir(s),s.flags|=1,fr(r,s,d,y),s.child)}function mv(r,s,o,d,y){if(r===null){var b=o.type;return typeof b=="function"&&!Ju(b)&&b.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=b,pv(r,s,b,d,y)):(r=ec(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 D=b.memoizedProps;if(o=o.compare,o=o!==null?o:Ls,o(D,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 pv(r,s,o,d,y){if(r!==null){var b=r.memoizedProps;if(Ls(b,d)&&r.ref===s.ref)if(er=!1,s.pendingProps=d=b,kp(r,y))(r.flags&131072)!==0&&(er=!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&&Xd(s,b!==null?b.cachePool:null),b!==null?vb(s,b):Wm(),xb(s);else return d=s.lanes=536870912,yv(r,s,b!==null?b.baseLanes|o:o,o,d)}else b!==null?(Xd(s,b.cachePool),vb(s,b),Ja(),s.memoizedState=null):(r!==null&&Xd(s,null),Wm(),Ja());return fr(r,s,y,o),s.child}function fc(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=Hm();return b=b===null?null:{parent:wi._currentValue,pool:b},s.memoizedState={baseLanes:o,cachePool:b},r!==null&&Xd(s,null),Wm(),xb(s),r!==null&&We(r,s,d,!0),s.childLanes=y,null}function dh(r,s){return s=fh({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=dh(s,s.pendingProps),r.flags|=2,Zr(s),s.memoizedState=null,r}function Kk(r,s,o){var d=s.pendingProps,y=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Rn){if(d.mode==="hidden")return r=dh(s,d),s.lanes=536870912,fc(null,r);if(Ym(s),(r=gi)?(r=Dx(r,Or),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ps!==null?{id:Yr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},o=tc(r),o.return=s,s.child=o,Zi=s,gi=null)):r=null,r===null)throw zs(s);return s.lanes=536870912,null}return dh(s,d)}var b=r.memoizedState;if(b!==null){var D=b.dehydrated;if(Ym(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(er||We(r,s,o,!1),y=(o&r.childLanes)!==0,er||y){if(d=yi,d!==null&&(D=vn(d,o),D!==0&&D!==b.retryLane))throw b.retryLane=D,ua(r,D),Fr(d,r,D),yp;wh(),s=bv(r,s,o)}else r=b.treeContext,gi=cs(D.nextSibling),Zi=s,Rn=!0,Us=null,Or=!1,r!==null&&Kd(s,r),s=dh(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 hh(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 rt(s),o=Zm(r,s,o,d,void 0,y),d=Jm(),r!==null&&!er?(ep(r,s,y),fa(r,s,y)):(Rn&&d&&ir(s),s.flags|=1,fr(r,s,o,y),s.child)}function vv(r,s,o,d,y,b){return rt(s),s.updateQueue=null,o=wb(s,d,o,y),_b(r),d=Jm(),r!==null&&!er?(ep(r,s,b),fa(r,s,b)):(Rn&&d&&ir(s),s.flags|=1,fr(r,s,o,b),s.child)}function xv(r,s,o,d,y){if(rt(s),s.stateNode===null){var b=Va,D=o.contextType;typeof D=="object"&&D!==null&&(b=Ot(D)),b=new o(d,b),s.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=pp,s.stateNode=b,b._reactInternals=s,b=s.stateNode,b.props=d,b.state=s.memoizedState,b.refs={},qm(s),D=o.contextType,b.context=typeof D=="object"&&D!==null?Ot(D):Va,b.state=s.memoizedState,D=o.getDerivedStateFromProps,typeof D=="function"&&(mp(s,o,D,d),b.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(D=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),D!==b.state&&pp.enqueueReplaceState(b,b.state,null),lc(s,d,b,y),oc(),b.state=s.memoizedState),typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){b=s.stateNode;var $=s.memoizedProps,be=Xo(o,$);b.props=be;var Ue=b.context,at=o.contextType;D=Va,typeof at=="object"&&at!==null&&(D=Ot(at));var ct=o.getDerivedStateFromProps;at=typeof ct=="function"||typeof b.getSnapshotBeforeUpdate=="function",$=s.pendingProps!==$,at||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||($||Ue!==D)&&av(s,b,d,D),Xa=!1;var $e=s.memoizedState;b.state=$e,lc(s,d,b,y),oc(),Ue=s.memoizedState,$||$e!==Ue||Xa?(typeof ct=="function"&&(mp(s,o,ct,d),Ue=s.memoizedState),(be=Xa||sv(s,o,be,d,$e,Ue,D))?(at||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=D,d=be):(typeof b.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{b=s.stateNode,Vm(r,s),D=s.memoizedProps,at=Xo(o,D),b.props=at,ct=s.pendingProps,$e=b.context,Ue=o.contextType,be=Va,typeof Ue=="object"&&Ue!==null&&(be=Ot(Ue)),$=o.getDerivedStateFromProps,(Ue=typeof $=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(D!==ct||$e!==be)&&av(s,b,d,be),Xa=!1,$e=s.memoizedState,b.state=$e,lc(s,d,b,y),oc();var Ye=s.memoizedState;D!==ct||$e!==Ye||Xa||r!==null&&r.dependencies!==null&&Ct(r.dependencies)?(typeof $=="function"&&(mp(s,o,$,d),Ye=s.memoizedState),(at=Xa||sv(s,o,at,d,$e,Ye,be)||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,Ye,be),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,Ye,be)),typeof b.componentDidUpdate=="function"&&(s.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof b.componentDidUpdate!="function"||D===r.memoizedProps&&$e===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||D===r.memoizedProps&&$e===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=Ye),b.props=d,b.state=Ye,b.context=be,d=at):(typeof b.componentDidUpdate!="function"||D===r.memoizedProps&&$e===r.memoizedState||(s.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||D===r.memoizedProps&&$e===r.memoizedState||(s.flags|=1024),d=!1)}return b=d,hh(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)):fr(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,fr(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,D;if((D=b)||(D=r!==null&&r.memoizedState===null?!1:(Wi.current&2)!==0),D&&(y=!0,s.flags&=-129),D=(s.flags&32)!==0,s.flags&=-33,r===null){if(Rn){if(y?Za(s):Ja(),(r=gi)?(r=Dx(r,Or),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:Ps!==null?{id:Yr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},o=tc(r),o.return=s,s.child=o,Zi=s,gi=null)):r=null,r===null)throw zs(s);return i0(r)?s.lanes=32:s.lanes=536870912,null}var $=d.children;return d=d.fallback,y?(Ja(),y=s.mode,$=fh({mode:"hidden",children:$},y),d=Bs(d,y,o,null),$.return=s,d.return=s,$.sibling=d,s.child=$,d=s.child,d.memoizedState=xp(o),d.childLanes=_p(r,D,o),s.memoizedState=vp,fc(null,d)):(Za(s),wp(s,$))}var be=r.memoizedState;if(be!==null&&($=be.dehydrated,$!==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(),$=d.fallback,y=s.mode,d=fh({mode:"visible",children:d.children},y),$=Bs($,y,o,null),$.flags|=2,d.return=s,$.return=s,d.sibling=$,s.child=d,Ko(s,r.child,null,o),d=s.child,d.memoizedState=xp(o),d.childLanes=_p(r,D,o),s.memoizedState=vp,s=fc(null,d));else if(Za(s),i0($)){if(D=$.nextSibling&&$.nextSibling.dataset,D)var Ue=D.dgst;D=Ue,d=Error(i(419)),d.stack="",d.digest=D,x({value:d,source:null,stack:null}),s=Tp(r,s,o)}else if(er||We(r,s,o,!1),D=(o&r.childLanes)!==0,er||D){if(D=yi,D!==null&&(d=vn(D,o),d!==0&&d!==be.retryLane))throw be.retryLane=d,ua(r,d),Fr(D,r,d),yp;n0($)||wh(),s=Tp(r,s,o)}else n0($)?(s.flags|=192,s.child=r.child,s=null):(r=be.treeContext,gi=cs($.nextSibling),Zi=s,Rn=!0,Us=null,Or=!1,r!==null&&Kd(s,r),s=wp(s,d.children),s.flags|=4096);return s}return y?(Ja(),$=d.fallback,y=s.mode,be=r.child,Ue=be.sibling,d=Ss(be,{mode:"hidden",children:d.children}),d.subtreeFlags=be.subtreeFlags&65011712,Ue!==null?$=Ss(Ue,$):($=Bs($,y,o,null),$.flags|=2),$.return=s,d.return=s,d.sibling=$,s.child=d,fc(null,d),d=s.child,$=r.child.memoizedState,$===null?$=xp(o):(y=$.cachePool,y!==null?(be=wi._currentValue,y=y.parent!==be?{parent:be,pool:be}:y):y=cb(),$={baseLanes:$.baseLanes|o,cachePool:y}),d.memoizedState=$,d.childLanes=_p(r,D,o),s.memoizedState=vp,fc(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&&(D=s.deletions,D===null?(s.deletions=[r],s.flags|=16):D.push(r)),s.child=o,s.memoizedState=null,o)}function wp(r,s){return s=fh({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function fh(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),he(r.return,s,o)}function Sp(r,s,o,d,y,b){var D=r.memoizedState;D===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:y,treeForkCount:b}:(D.isBackwards=s,D.rendering=null,D.renderingStartTime=0,D.last=d,D.tail=o,D.tailMode=y,D.treeForkCount=b)}function Sv(r,s,o){var d=s.pendingProps,y=d.revealOrder,b=d.tail;d=d.children;var D=Wi.current,$=(D&2)!==0;if($?(D=D&1|2,s.flags|=128):D&=1,we(Wi,D),fr(r,s,d,o),d=Rn?Ho:0,!$&&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&&th(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&&th(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(We(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 Wk(r,s,o){switch(s.tag){case 3:Te(s,s.stateNode.containerInfo),J(s,wi,r.memoizedState.cache),v();break;case 27:case 5:ut(s);break;case 4:Te(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,Ym(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||(We(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),we(Wi,Wi.current),d)break;return null;case 22:return s.lanes=0,gv(r,s,o,s.pendingProps);case 24:J(s,wi,r.memoizedState.cache)}return fa(r,s,o)}function kv(r,s,o){if(r!==null)if(r.memoizedProps!==s.pendingProps)er=!0;else{if(!kp(r,o)&&(s.flags&128)===0)return er=!1,Wk(r,s,o);er=(r.flags&131072)!==0}else er=!1,Rn&&(s.flags&1048576)!==0&&Fs(s,Ho,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")Ju(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=mv(null,s,r,d,o);break e}}throw s=me(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(Te(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var b=s.memoizedState;y=b.element,Vm(r,s),lc(s,d,null,o);var D=s.memoizedState;if(d=D.cache,J(s,wi,d),d!==b.cache&&Ae(s,[wi],o,!0),oc(),d=D.element,b.isDehydrated)if(b={element:d,isDehydrated:!1,cache:D.cache},s.updateQueue.baseState=b,s.memoizedState=b,s.flags&256){s=_v(r,s,d,o);break e}else if(d!==y){y=Mr(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),Zi=s,Rn=!0,Us=null,Or=!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}fr(r,s,d,o)}s=s.child}return s;case 26:return hh(r,s),r===null?(o=Ix(s.type,null,s.pendingProps,null))?s.memoizedState=o:Rn||(o=s.type,r=s.pendingProps,d=Nh(ht.current).createElement(o),d[Bt]=s,d[Dt]=r,mr(d,o,r),wn(d),s.stateNode=d):s.memoizedState=Ix(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return ut(s),r===null&&Rn&&(d=s.stateNode=Rx(s.type,s.pendingProps,ht.current),Zi=s,Or=!0,y=gi,oo(s.type)?(r0=y,gi=cs(d.firstChild)):gi=y),fr(r,s,s.pendingProps.children,o),hh(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Rn&&((y=d=gi)&&(d=SE(d,s.type,s.pendingProps,Or),d!==null?(s.stateNode=d,Zi=s,gi=cs(d.firstChild),Or=!1,y=!0):y=!1),y||zs(s)),ut(s),y=s.type,b=s.pendingProps,D=r!==null?r.memoizedProps:null,d=b.children,Jp(y,b)?d=null:D!==null&&Jp(y,D)&&(s.flags|=32),s.memoizedState!==null&&(y=Zm(r,s,Fk,null,null,o),Ac._currentValue=y),hh(r,s),fr(r,s,d,o),s.child;case 6:return r===null&&Rn&&((r=o=gi)&&(o=kE(o,s.pendingProps,Or),o!==null?(s.stateNode=o,Zi=s,gi=null,r=!0):r=!1),r||zs(s)),null;case 13:return wv(r,s,o);case 4:return Te(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Ko(s,null,d,o):fr(r,s,d,o),s.child;case 11:return fv(r,s,s.type,s.pendingProps,o);case 7:return fr(r,s,s.pendingProps,o),s.child;case 8:return fr(r,s,s.pendingProps.children,o),s.child;case 12:return fr(r,s,s.pendingProps.children,o),s.child;case 10:return d=s.pendingProps,J(s,s.type,d.value),fr(r,s,d.children,o),s.child;case 9:return y=s.type._context,d=s.pendingProps.children,rt(s),y=Ot(y),d=d(y),s.flags|=1,fr(r,s,d,o),s.child;case 14:return mv(r,s,s.type,s.pendingProps,o);case 15:return pv(r,s,s.type,s.pendingProps,o);case 19:return Sv(r,s,o);case 31:return Kk(r,s,o);case 22:return gv(r,s,o,s.pendingProps);case 24:return rt(s),d=Ot(wi),r===null?(y=Hm(),y===null&&(y=yi,b=ca(),y.pooledCache=b,b.refCount++,b!==null&&(y.pooledCacheLanes|=o),y=b),s.memoizedState={parent:d,cache:y},qm(s),J(s,wi,y)):((r.lanes&o)!==0&&(Vm(r,s),lc(s,null,null,o),oc()),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,wi,d)):(d=b.cache,J(s,wi,d),d!==y.cache&&Ae(s,[wi],o,!0))),fr(r,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function ma(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=Qd,$m}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=Qd,$m}function mh(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?qe():536870912,r.lanes|=s,Ul|=s)}function mc(r,s){if(!Rn)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 ki(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 Xk(r,s,o){var d=s.pendingProps;switch(Rr(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ki(s),null;case 1:return ki(s),null;case 3:return o=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),oe(wi),Le(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(r===null||r.child===null)&&(m(s)?ma(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,w())),ki(s),null;case 26:var y=s.type,b=s.memoizedState;return r===null?(ma(s),b!==null?(ki(s),Ev(s,b)):(ki(s),Ep(s,y,null,d,o))):b?b!==r.memoizedState?(ma(s),ki(s),Ev(s,b)):(ki(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&ma(s),ki(s),Ep(s,y,r,d,o)),null;case 27:if(Oe(s),o=ht.current,y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ma(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return ki(s),null}r=ve.current,m(s)?Wd(s):(r=Rx(y,d,o),s.stateNode=r,ma(s))}return ki(s),null;case 5:if(Oe(s),y=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&ma(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return ki(s),null}if(b=ve.current,m(s))Wd(s);else{var D=Nh(ht.current);switch(b){case 1:b=D.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:b=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":b=D.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":b=D.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":b=D.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?D.createElement("select",{is:d.is}):D.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?D.createElement(y,{is:d.is}):D.createElement(y)}}b[Bt]=s,b[Dt]=d;e:for(D=s.child;D!==null;){if(D.tag===5||D.tag===6)b.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===s)break e;for(;D.sibling===null;){if(D.return===null||D.return===s)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}s.stateNode=b;e:switch(mr(b,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ma(s)}}return ki(s),Ep(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,o),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&ma(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=ht.current,m(s)){if(r=s.stateNode,o=s.memoizedProps,d=null,y=Zi,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[Bt]=s,r=!!(r.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||wx(r.nodeValue,o)),r||zs(s,!0)}else r=Nh(r).createTextNode(d),r[Bt]=s,s.stateNode=r}return ki(s),null;case 31:if(o=s.memoizedState,r===null||r.memoizedState!==null){if(d=m(s),o!==null){if(r===null){if(!d)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Bt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),r=!1}else o=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=o),r=!0;if(!r)return s.flags&256?(Zr(s),s):(Zr(s),null);if((s.flags&128)!==0)throw Error(i(558))}return ki(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=m(s),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(i(318));if(y=s.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(i(317));y[Bt]=s}else v(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;ki(s),y=!1}else y=w(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(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),ki(s),null);case 4:return Le(),r===null&&Wp(s.stateNode.containerInfo),ki(s),null;case 10:return oe(s.type),ki(s),null;case 19:if(pe(Wi),d=s.memoizedState,d===null)return ki(s),null;if(y=(s.flags&128)!==0,b=d.rendering,b===null)if(y)mc(d,!1);else{if(Hi!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(b=th(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;)Gd(o,r),o=o.sibling;return we(Wi,Wi.current&1|2),Rn&&kn(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&fe()>vh&&(s.flags|=128,y=!0,mc(d,!1),s.lanes=4194304)}else{if(!y)if(r=th(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&&!Rn)return ki(s),null}else 2*fe()-d.renderingStartTime>vh&&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=fe(),r.sibling=null,o=Wi.current,we(Wi,y?o&1|2:o&1),Rn&&kn(s,d.treeForkCount),r):(ki(s),null);case 22:case 23:return Zr(s),Xm(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(o&536870912)!==0&&(s.flags&128)===0&&(ki(s),s.subtreeFlags&6&&(s.flags|=8192)):ki(s),o=s.updateQueue,o!==null&&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(wi),ki(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Yk(r,s){switch(Rr(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return oe(wi),Le(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return Oe(s),null;case 31:if(s.memoizedState!==null){if(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(Wi),null;case 4:return Le(),null;case 10:return oe(s.type),null;case 22:case 23:return Zr(s),Xm(),r!==null&&pe(qo),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return oe(wi),null;case 25:return null;default:return null}}function Cv(r,s){switch(Rr(s),s.tag){case 3:oe(wi),Le();break;case 26:case 27:case 5:Oe(s);break;case 4:Le();break;case 31:s.memoizedState!==null&&Zr(s);break;case 13:Zr(s);break;case 19:pe(Wi);break;case 10:oe(s.type);break;case 22:case 23:Zr(s),Xm(),r!==null&&pe(qo);break;case 24:oe(wi)}}function pc(r,s){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var y=d.next;o=y;do{if((o.tag&r)===r){d=void 0;var b=o.create,D=o.inst;d=b(),D.destroy=d}o=o.next}while(o!==y)}}catch($){li(s,s.return,$)}}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 D=d.inst,$=D.destroy;if($!==void 0){D.destroy=void 0,y=s;var be=o,Ue=$;try{Ue()}catch(at){li(y,be,at)}}}d=d.next}while(d!==b)}}catch(at){li(s,s.return,at)}}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 gc(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;bE(d,r.type,o,s),d[Dt]=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=Jn));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 ph(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(ph(r,s,o),r=r.sibling;r!==null;)ph(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]);mr(s,d,o),s[Bt]=r,s[Dt]=o}catch(b){li(r,r.return,b)}}var pa=!1,tr=!1,Dp=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,or=null;function Qk(r,s){if(r=r.containerInfo,Qp=Ih,r=kl(r),Vu(r)){if("selectionStart"in r)var o={start:r.selectionStart,end:r.selectionEnd};else e:{o=(o=r.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var y=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var D=0,$=-1,be=-1,Ue=0,at=0,ct=r,$e=null;t:for(;;){for(var Ye;ct!==o||y!==0&&ct.nodeType!==3||($=D+y),ct!==b||d!==0&&ct.nodeType!==3||(be=D+d),ct.nodeType===3&&(D+=ct.nodeValue.length),(Ye=ct.firstChild)!==null;)$e=ct,ct=Ye;for(;;){if(ct===r)break t;if($e===o&&++Ue===y&&($=D),$e===b&&++at===d&&(be=D),(Ye=ct.nextSibling)!==null)break;ct=$e,$e=ct.parentNode}ct=Ye}o=$===-1||be===-1?null:{start:$,end:be}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zp={focusedElem:r,selectionRange:o},Ih=!1,or=s;or!==null;)if(s=or,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,or=r;else for(;or!==null;){switch(s=or,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 qt=Xo(o.type,y);r=d.getSnapshotBeforeUpdate(qt,b),d.__reactInternalSnapshotBeforeUpdate=r}catch(on){li(o,o.return,on)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,o=r.nodeType,o===9)t0(r);else if(o===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":t0(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,or=r;break}or=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&&pc(5,o);break;case 1:if(ya(r,o),d&4)if(r=o.stateNode,s===null)try{r.componentDidMount()}catch(D){li(o,o.return,D)}else{var y=Xo(o.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(y,s,r.__reactInternalSnapshotBeforeUpdate)}catch(D){li(o,o.return,D)}}d&64&&Av(o),d&512&&gc(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(D){li(o,o.return,D)}}break;case 27:s===null&&d&4&&jv(o);case 26:case 5:ya(r,o),s===null&&d&4&&Dv(o),d&512&&gc(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=aE.bind(null,o),EE(r,o))));break;case 22:if(d=o.memoizedState!==null||pa,!d){s=s!==null&&s.memoizedState!==null||tr,y=pa;var b=tr;pa=d,(tr=s)&&!b?ba(r,o,(o.subtreeFlags&8772)!==0):ya(r,o),pa=y,tr=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&&Xt(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,Lr=!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(Ft&&typeof Ft.onCommitFiberUnmount=="function")try{Ft.onCommitFiberUnmount(Yt,o)}catch{}switch(o.tag){case 26:tr||qs(o,s),ga(r,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:tr||qs(o,s);var d=Ni,y=Lr;oo(o.type)&&(Ni=o.stateNode,Lr=!1),ga(r,s,o),kc(o.stateNode),Ni=d,Lr=y;break;case 5:tr||qs(o,s);case 6:if(d=Ni,y=Lr,Ni=null,ga(r,s,o),Ni=d,Lr=y,Ni!==null)if(Lr)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&&(Lr?(r=Ni,Ax(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,o.stateNode),Wl(r)):Ax(Ni,o.stateNode));break;case 4:d=Ni,y=Lr,Ni=o.stateNode.containerInfo,Lr=!0,ga(r,s,o),Ni=d,Lr=y;break;case 0:case 11:case 14:case 15:eo(2,o,s),tr||eo(4,o,s),ga(r,s,o);break;case 1:tr||(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:tr=(d=tr)||o.memoizedState!==null,ga(r,s,o),tr=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{Wl(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{Wl(r)}catch(o){li(s,s.return,o)}}function Zk(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 gh(r,s){var o=Zk(r);s.forEach(function(d){if(!o.has(d)){o.add(d);var y=oE.bind(null,r,d);d.then(y,y)}})}function Ir(r,s){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var y=o[d],b=r,D=s,$=D;e:for(;$!==null;){switch($.tag){case 27:if(oo($.type)){Ni=$.stateNode,Lr=!1;break e}break;case 5:Ni=$.stateNode,Lr=!1;break e;case 3:case 4:Ni=$.stateNode.containerInfo,Lr=!0;break e}$=$.return}if(Ni===null)throw Error(i(160));Iv(b,D,y),Ni=null,Lr=!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:Ir(s,r),Br(r),d&4&&(eo(3,r,r.return),pc(3,r),eo(5,r,r.return));break;case 1:Ir(s,r),Br(r),d&512&&(tr||o===null||qs(o,o.return)),d&64&&pa&&(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(Ir(s,r),Br(r),d&512&&(tr||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[Sn]||b[Bt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=y.createElement(d),y.head.insertBefore(b,y.querySelector("head > title"))),mr(b,d,o),b[Bt]=r,wn(b),d=b;break e;case"link":var D=Fx("link","href",y).get(d+(o.href||""));if(D){for(var $=0;$<D.length;$++)if(b=D[$],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)){D.splice($,1);break t}}b=y.createElement(d),mr(b,d,o),y.head.appendChild(b);break;case"meta":if(D=Fx("meta","content",y).get(d+(o.content||""))){for($=0;$<D.length;$++)if(b=D[$],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)){D.splice($,1);break t}}b=y.createElement(d),mr(b,d,o),y.head.appendChild(b);break;default:throw Error(i(468,d))}b[Bt]=r,wn(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:Ir(s,r),Br(r),d&512&&(tr||o===null||qs(o,o.return)),o!==null&&d&4&&Cp(r,r.memoizedProps,o.memoizedProps);break;case 5:if(Ir(s,r),Br(r),d&512&&(tr||o===null||qs(o,o.return)),r.flags&32){y=r.stateNode;try{si(y,"")}catch(qt){li(r,r.return,qt)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,Cp(r,y,o!==null?o.memoizedProps:y)),d&1024&&(Dp=!0);break;case 6:if(Ir(s,r),Br(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,o=r.stateNode;try{o.nodeValue=d}catch(qt){li(r,r.return,qt)}}break;case 3:if(jh=null,y=Es,Es=Dh(s.containerInfo),Ir(s,r),Es=y,Br(r),d&4&&o!==null&&o.memoizedState.isDehydrated)try{Wl(s.containerInfo)}catch(qt){li(r,r.return,qt)}Dp&&(Dp=!1,Uv(r));break;case 4:d=Es,Es=Dh(r.stateNode.containerInfo),Ir(s,r),Br(r),Es=d;break;case 12:Ir(s,r),Br(r);break;case 31:Ir(s,r),Br(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,gh(r,d)));break;case 13:Ir(s,r),Br(r),r.child.flags&8192&&r.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(bh=fe()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,gh(r,d)));break;case 22:y=r.memoizedState!==null;var be=o!==null&&o.memoizedState!==null,Ue=pa,at=tr;if(pa=Ue||y,tr=at||be,Ir(s,r),tr=at,pa=Ue,Br(r),d&8192)e:for(s=r.stateNode,s._visibility=y?s._visibility&-2:s._visibility|1,y&&(o===null||be||pa||tr||Yo(r)),o=null,s=r;;){if(s.tag===5||s.tag===26){if(o===null){be=o=s;try{if(b=be.stateNode,y)D=b.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{$=be.stateNode;var ct=be.memoizedProps.style,$e=ct!=null&&ct.hasOwnProperty("display")?ct.display:null;$.style.display=$e==null||typeof $e=="boolean"?"":(""+$e).trim()}}catch(qt){li(be,be.return,qt)}}}else if(s.tag===6){if(o===null){be=s;try{be.stateNode.nodeValue=y?"":be.memoizedProps}catch(qt){li(be,be.return,qt)}}}else if(s.tag===18){if(o===null){be=s;try{var Ye=be.stateNode;y?Nx(Ye,!0):Nx(be.stateNode,!1)}catch(qt){li(be,be.return,qt)}}}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,gh(r,o))));break;case 19:Ir(s,r),Br(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,gh(r,d)));break;case 30:break;case 21:break;default:Ir(s,r),Br(r)}}function Br(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);ph(r,b,y);break;case 5:var D=o.stateNode;o.flags&32&&(si(D,""),o.flags&=-33);var $=Ap(r);ph(r,$,D);break;case 3:case 4:var be=o.stateNode.containerInfo,Ue=Ap(r);Np(r,Ue,be);break;default:throw Error(i(161))}}catch(at){li(r,r.return,at)}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:kc(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,D=b.flags;switch(b.tag){case 0:case 11:case 15:ba(y,b,o),pc(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 $=d.stateNode;try{var be=y.shared.hiddenCallbacks;if(be!==null)for(y.shared.hiddenCallbacks=null,y=0;y<be.length;y++)yb(be[y],$)}catch(Ue){li(d,d.return,Ue)}}o&&D&64&&Av(b),gc(b,b.return);break;case 27:jv(b);case 26:case 5:ba(y,b,o),o&&d===null&&D&4&&Dv(b),gc(b,b.return);break;case 12:ba(y,b,o);break;case 31:ba(y,b,o),o&&D&4&&Bv(y,b);break;case 13:ba(y,b,o),o&&D&4&&Pv(y,b);break;case 22:b.memoizedState===null&&ba(y,b,o),gc(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&&pc(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,D=b.id,$=b.onPostCommit;typeof $=="function"&&$(D,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(be){li(s,s.return,be)}}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,D=s.alternate,s.memoizedState!==null?b._visibility&2?Cs(r,s,o,d):yc(r,s):b._visibility&2?Cs(r,s,o,d):(b._visibility|=2,Bl(r,s,o,d,(s.subtreeFlags&10256)!==0||!1)),y&2048&&Mp(D,s);break;case 24:Cs(r,s,o,d),y&2048&&jp(s.alternate,s);break;default:Cs(r,s,o,d)}}function Bl(r,s,o,d,y){for(y=y&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var b=r,D=s,$=o,be=d,Ue=D.flags;switch(D.tag){case 0:case 11:case 15:Bl(b,D,$,be,y),pc(8,D);break;case 23:break;case 22:var at=D.stateNode;D.memoizedState!==null?at._visibility&2?Bl(b,D,$,be,y):yc(b,D):(at._visibility|=2,Bl(b,D,$,be,y)),y&&Ue&2048&&Mp(D.alternate,D);break;case 24:Bl(b,D,$,be,y),y&&Ue&2048&&jp(D.alternate,D);break;default:Bl(b,D,$,be,y)}s=s.sibling}}function yc(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:yc(o,d),y&2048&&Mp(d.alternate,d);break;case 24:yc(o,d),y&2048&&jp(d.alternate,d);break;default:yc(o,d)}s=s.sibling}}var bc=8192;function Pl(r,s,o){if(r.subtreeFlags&bc)for(r=r.child;r!==null;)Hv(r,s,o),r=r.sibling}function Hv(r,s,o){switch(r.tag){case 26:Pl(r,s,o),r.flags&bc&&r.memoizedState!==null&&PE(o,Es,r.memoizedState,r.memoizedProps);break;case 5:Pl(r,s,o);break;case 3:case 4:var d=Es;Es=Dh(r.stateNode.containerInfo),Pl(r,s,o),Es=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=bc,bc=16777216,Pl(r,s,o),bc=d):Pl(r,s,o));break;default:Pl(r,s,o)}}function $v(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 vc(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];or=d,Vv(d,r)}$v(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:vc(r),r.flags&2048&&eo(9,r,r.return);break;case 3:vc(r);break;case 12:vc(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,yh(r)):vc(r);break;default:vc(r)}}function yh(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];or=d,Vv(d,r)}$v(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:eo(8,s,s.return),yh(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,yh(s));break;default:yh(s)}r=r.sibling}}function Vv(r,s){for(;or!==null;){var o=or;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,or=d;else e:for(o=r;or!==null;){d=or;var y=d.sibling,b=d.return;if(Lv(d),d===o){or=null;break e}if(y!==null){y.return=b,or=y;break e}or=b}}}var Jk={getCacheForType:function(r){var s=Ot(wi),o=s.data.get(r);return o===void 0&&(o=r(),s.data.set(r,o)),o},cacheSignal:function(){return Ot(wi).controller.signal}},eE=typeof WeakMap=="function"?WeakMap:Map,ei=0,yi=null,On=null,Bn=0,oi=0,Jr=null,to=!1,Fl=!1,Rp=!1,va=0,Hi=0,no=0,Qo=0,Op=0,es=0,Ul=0,xc=null,Pr=null,Lp=!1,bh=0,Gv=0,vh=1/0,xh=null,io=null,rr=0,ro=null,zl=null,xa=0,Ip=0,Bp=null,Kv=null,_c=0,Pp=null;function ts(){return(ei&2)!==0&&Bn!==0?Bn&-Bn:q.T!==null?qp():gn()}function Wv(){if(es===0)if((Bn&536870912)===0||Rn){var r=Fn;Fn<<=1,(Fn&3932160)===0&&(Fn=262144),es=r}else es=536870912;return r=Qr.current,r!==null&&(r.flags|=32),es}function Fr(r,s,o){(r===yi&&(oi===2||oi===9)||r.cancelPendingCommit!==null)&&(Hl(r,0),so(r,Bn,es,!1)),$t(r,o),((ei&2)===0||r!==yi)&&(r===yi&&((ei&2)===0&&(Qo|=o),Hi===4&&so(r,Bn,es,!1)),Vs(r))}function Xv(r,s,o){if((ei&6)!==0)throw Error(i(327));var d=!o&&(s&127)===0&&(s&r.expiredLanes)===0||ne(r,s),y=d?iE(r,s):Up(r,s,!0),b=d;do{if(y===0){Fl&&!d&&so(r,s,0,!1);break}else{if(o=r.current.alternate,b&&!tE(o)){y=Up(r,s,!1),b=!1;continue}if(y===2){if(b=s,r.errorRecoveryDisabledLanes&b)var D=0;else D=r.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){s=D;e:{var $=r;y=xc;var be=$.current.memoizedState.isDehydrated;if(be&&(Hl($,D).flags|=256),D=Up($,D,!1),D!==2){if(Rp&&!be){$.errorRecoveryDisabledLanes|=b,Qo|=b,y=4;break e}b=Pr,Pr=y,b!==null&&(Pr===null?Pr=b:Pr.push.apply(Pr,b))}y=D}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:Pr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(y=bh+300-fe(),10<y)){if(so(d,s,es,!to),P(d,0,!0)!==0)break e;xa=s,d.timeoutHandle=Ex(Yv.bind(null,d,o,Pr,xh,Lp,s,es,Qo,Ul,to,b,"Throttled",-0,0),y);break e}Yv(d,o,Pr,xh,Lp,s,es,Qo,Ul,to,b,null,-0,0)}}break}while(!0);Vs(r)}function Yv(r,s,o,d,y,b,D,$,be,Ue,at,ct,$e,Ye){if(r.timeoutHandle=-1,ct=s.subtreeFlags,ct&8192||(ct&16785408)===16785408){ct={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Hv(s,b,ct);var qt=(b&62914560)===b?bh-fe():(b&4194048)===b?Gv-fe():0;if(qt=FE(ct,qt),qt!==null){xa=b,r.cancelPendingCommit=qt(rx.bind(null,r,s,b,o,d,y,D,$,be,at,ct,null,$e,Ye)),so(r,b,D,!Ue);return}}rx(r,s,b,o,d,y,D,$,be)}function tE(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(!yr(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-At(y),D=1<<b;d[b]=-1,y&=~D}o!==0&&hn(r,o,s)}function _h(){return(ei&6)===0?(wc(0),!1):!0}function Fp(){if(On!==null){if(oi===0)var r=On.return;else r=On,X=A=null,tp(r),jl=null,rc=0,r=On;for(;r!==null;)Cv(r.alternate,r),r=r.return;On=null}}function Hl(r,s){var o=r.timeoutHandle;o!==-1&&(r.timeoutHandle=-1,_E(o)),o=r.cancelPendingCommit,o!==null&&(r.cancelPendingCommit=null,o()),xa=0,Fp(),yi=r,On=o=Ss(r.current,null),Bn=s,oi=0,Jr=null,to=!1,Fl=ne(r,s),Rp=!1,Ul=es=Op=Qo=no=Hi=0,Pr=xc=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-At(d),b=1<<y;s|=r[y],d&=~b}return va=s,Cl(),o}function Qv(r,s){bn=null,q.H=hc,s===Ml||s===Yd?(s=fb(),oi=3):s===$m?(s=fb(),oi=4):oi=s===yp?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Jr=s,On===null&&(Hi=1,ch(r,Mr(s,r.current)))}function Zv(){var r=Qr.current;return r===null?!0:(Bn&4194048)===Bn?us===null:(Bn&62914560)===Bn||(Bn&536870912)!==0?r===us:!1}function Jv(){var r=q.H;return q.H=hc,r===null?hc:r}function ex(){var r=q.A;return q.A=Jk,r}function wh(){Hi=4,to||(Bn&4194048)!==Bn&&Qr.current!==null||(Fl=!0),(no&134217727)===0&&(Qo&134217727)===0||yi===null||so(yi,Bn,es,!1)}function Up(r,s,o){var d=ei;ei|=2;var y=Jv(),b=ex();(yi!==r||Bn!==s)&&(xh=null,Hl(r,s)),s=!1;var D=Hi;e:do try{if(oi!==0&&On!==null){var $=On,be=Jr;switch(oi){case 8:Fp(),D=6;break e;case 3:case 2:case 9:case 6:Qr.current===null&&(s=!0);var Ue=oi;if(oi=0,Jr=null,$l(r,$,be,Ue),o&&Fl){D=0;break e}break;default:Ue=oi,oi=0,Jr=null,$l(r,$,be,Ue)}}nE(),D=Hi;break}catch(at){Qv(r,at)}while(!0);return s&&r.shellSuspendCounter++,X=A=null,ei=d,q.H=y,q.A=b,On===null&&(yi=null,Bn=0,Cl()),D}function nE(){for(;On!==null;)tx(On)}function iE(r,s){var o=ei;ei|=2;var d=Jv(),y=ex();yi!==r||Bn!==s?(xh=null,vh=fe()+500,Hl(r,s)):Fl=ne(r,s);e:do try{if(oi!==0&&On!==null){s=On;var b=Jr;t:switch(oi){case 1:oi=0,Jr=null,$l(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,$l(r,s,b,7));break;case 5:var D=null;switch(On.tag){case 26:D=On.memoizedState;case 5:case 27:var $=On;if(D?zx(D):$.stateNode.complete){oi=0,Jr=null;var be=$.sibling;if(be!==null)On=be;else{var Ue=$.return;Ue!==null?(On=Ue,Th(Ue)):On=null}break t}}oi=0,Jr=null,$l(r,s,b,5);break;case 6:oi=0,Jr=null,$l(r,s,b,6);break;case 8:Fp(),Hi=6;break e;default:throw Error(i(462))}}rE();break}catch(at){Qv(r,at)}while(!0);return X=A=null,q.H=d,q.A=y,ei=o,On!==null?0:(yi=null,Bn=0,Cl(),Hi)}function rE(){for(;On!==null&&!nt();)tx(On)}function tx(r){var s=kv(r.alternate,r,va);r.memoizedProps=r.pendingProps,s===null?Th(r):On=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,Bn);break;case 11:s=vv(o,s,s.pendingProps,s.type.render,s.ref,Bn);break;case 5:tp(s);default:Cv(o,s),s=On=Gd(s,va),s=kv(o,s,va)}r.memoizedProps=r.pendingProps,s===null?Th(r):On=s}function $l(r,s,o,d){X=A=null,tp(s),jl=null,rc=0;var y=s.return;try{if(Gk(r,y,s,o,Bn)){Hi=1,ch(r,Mr(o,r.current)),On=null;return}}catch(b){if(y!==null)throw On=y,b;Hi=1,ch(r,Mr(o,r.current)),On=null;return}s.flags&32768?(Rn||d===1?r=!0:Fl||(Bn&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)):Th(s)}function Th(r){var s=r;do{if((s.flags&32768)!==0){ix(s,to);return}r=s.return;var o=Xk(s.alternate,s,va);if(o!==null){On=o;return}if(s=s.sibling,s!==null){On=s;return}On=s=r}while(s!==null);Hi===0&&(Hi=5)}function ix(r,s){do{var o=Yk(r.alternate,r);if(o!==null){o.flags&=32767,On=o;return}if(o=r.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(r=r.sibling,r!==null)){On=r;return}On=r=o}while(r!==null);Hi=6,On=null}function rx(r,s,o,d,y,b,D,$,be){r.cancelPendingCommit=null;do Sh();while(rr!==0);if((ei&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(b=s.lanes|s.childLanes,b|=Qu,Zt(r,o,b,D,$,be),r===yi&&(On=yi=null,Bn=0),zl=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,lE(Ie,function(){return ux(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,y=F.p,F.p=2,D=ei,ei|=4;try{Qk(r,s,o)}finally{ei=D,F.p=y,q.T=d}}rr=1,sx(),ax(),ox()}}function sx(){if(rr===1){rr=0;var r=ro,s=zl,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=q.T,q.T=null;var d=F.p;F.p=2;var y=ei;ei|=4;try{Fv(s,r);var b=Zp,D=kl(r.containerInfo),$=b.focusedElem,be=b.selectionRange;if(D!==$&&$&&$.ownerDocument&&oa($.ownerDocument.documentElement,$)){if(be!==null&&Vu($)){var Ue=be.start,at=be.end;if(at===void 0&&(at=Ue),"selectionStart"in $)$.selectionStart=Ue,$.selectionEnd=Math.min(at,$.value.length);else{var ct=$.ownerDocument||document,$e=ct&&ct.defaultView||window;if($e.getSelection){var Ye=$e.getSelection(),qt=$.textContent.length,on=Math.min(be.start,qt),fi=be.end===void 0?on:Math.min(be.end,qt);!Ye.extend&&on>fi&&(D=fi,fi=on,on=D);var Re=Ai($,on),ke=Ai($,fi);if(Re&&ke&&(Ye.rangeCount!==1||Ye.anchorNode!==Re.node||Ye.anchorOffset!==Re.offset||Ye.focusNode!==ke.node||Ye.focusOffset!==ke.offset)){var Fe=ct.createRange();Fe.setStart(Re.node,Re.offset),Ye.removeAllRanges(),on>fi?(Ye.addRange(Fe),Ye.extend(ke.node,ke.offset)):(Fe.setEnd(ke.node,ke.offset),Ye.addRange(Fe))}}}}for(ct=[],Ye=$;Ye=Ye.parentNode;)Ye.nodeType===1&&ct.push({element:Ye,left:Ye.scrollLeft,top:Ye.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<ct.length;$++){var lt=ct[$];lt.element.scrollLeft=lt.left,lt.element.scrollTop=lt.top}}Ih=!!Qp,Zp=Qp=null}finally{ei=y,F.p=d,q.T=o}}r.current=s,rr=2}}function ax(){if(rr===2){rr=0;var r=ro,s=zl,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=q.T,q.T=null;var d=F.p;F.p=2;var y=ei;ei|=4;try{Ov(r,s.alternate,s)}finally{ei=y,F.p=d,q.T=o}}rr=3}}function ox(){if(rr===4||rr===3){rr=0,wt();var r=ro,s=zl,o=xa,d=Kv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?rr=5:(rr=0,zl=ro=null,lx(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(io=null),Wt(o),s=s.stateNode,Ft&&typeof Ft.onCommitFiberRoot=="function")try{Ft.onCommitFiberRoot(Yt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=q.T,y=F.p,F.p=2,q.T=null;try{for(var b=r.onRecoverableError,D=0;D<d.length;D++){var $=d[D];b($.value,{componentStack:$.stack})}}finally{q.T=s,F.p=y}}(xa&3)!==0&&Sh(),Vs(r),y=r.pendingLanes,(o&261930)!==0&&(y&42)!==0?r===Pp?_c++:(_c=0,Pp=r):_c=0,wc(0)}}function lx(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,ks(s)))}function Sh(){return sx(),ax(),ox(),ux()}function ux(){if(rr!==5)return!1;var r=ro,s=Ip;Ip=0;var o=Wt(xa),d=q.T,y=F.p;try{F.p=32>o?32:o,q.T=null,o=Bp,Bp=null;var b=ro,D=xa;if(rr=0,zl=ro=null,xa=0,(ei&6)!==0)throw Error(i(331));var $=ei;if(ei|=4,qv(b.current),zv(b,b.current,D,o),ei=$,wc(0,!1),Ft&&typeof Ft.onPostCommitFiberRoot=="function")try{Ft.onPostCommitFiberRoot(Yt,b)}catch{}return!0}finally{F.p=y,q.T=d,lx(r,s)}}function cx(r,s,o){s=Mr(o,s),s=gp(r.stateNode,s,2),r=Qa(r,s,2),r!==null&&($t(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=Mr(o,r),o=dv(2),d=Qa(s,o,2),d!==null&&(hv(o,d,s,r),$t(d,2),Vs(d));break}}s=s.return}}function zp(r,s,o){var d=r.pingCache;if(d===null){d=r.pingCache=new eE;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=sE.bind(null,r,s,o),s.then(r,r))}function sE(r,s,o){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&o,r.warmLanes&=~o,yi===r&&(Bn&o)===o&&(Hi===4||Hi===3&&(Bn&62914560)===Bn&&300>fe()-bh?(ei&2)===0&&Hl(r,0):Op|=o,Ul===Bn&&(Ul=0)),Vs(r)}function dx(r,s){s===0&&(s=qe()),r=ua(r,s),r!==null&&($t(r,s),Vs(r))}function aE(r){var s=r.memoizedState,o=0;s!==null&&(o=s.retryLane),dx(r,o)}function oE(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 lE(r,s){return st(r,s)}var kh=null,ql=null,Hp=!1,Eh=!1,$p=!1,ao=0;function Vs(r){r!==ql&&r.next===null&&(ql===null?kh=ql=r:ql=ql.next=r),Eh=!0,Hp||(Hp=!0,cE())}function wc(r,s){if(!$p&&Eh){$p=!0;do for(var o=!1,d=kh;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var b=0;else{var D=d.suspendedLanes,$=d.pingedLanes;b=(1<<31-At(42|r)+1)-1,b&=y&~(D&~$),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(o=!0,px(d,b))}else b=Bn,b=P(d,d===yi?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||ne(d,b)||(o=!0,px(d,b));d=d.next}while(o);$p=!1}}function uE(){hx()}function hx(){Eh=Hp=!1;var r=0;ao!==0&&xE()&&(r=ao);for(var s=fe(),o=null,d=kh;d!==null;){var y=d.next,b=fx(d,s);b===0?(d.next=null,o===null?kh=y:o.next=y,y===null&&(ql=o)):(o=d,(r!==0||(b&3)!==0)&&(Eh=!0)),d=y}rr!==0&&rr!==5||wc(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 D=31-At(b),$=1<<D,be=y[D];be===-1?(($&o)===0||($&d)!==0)&&(y[D]=je($,s)):be<=s&&(r.expiredLanes|=$),b&=~$}if(s=yi,o=Bn,o=P(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&&Ze(d),r.callbackNode=null,r.callbackPriority=0;if((o&3)===0||ne(r,o)){if(s=o&-o,s===r.callbackPriority)return s;switch(d!==null&&Ze(d),Wt(o)){case 2:case 8:o=De;break;case 32:o=Ie;break;case 268435456:o=Et;break;default:o=Ie}return d=mx.bind(null,r),o=st(o,d),r.callbackPriority=s,r.callbackNode=o,s}return d!==null&&d!==null&&Ze(d),r.callbackPriority=2,r.callbackNode=null,2}function mx(r,s){if(rr!==0&&rr!==5)return r.callbackNode=null,r.callbackPriority=0,null;var o=r.callbackNode;if(Sh()&&r.callbackNode!==o)return null;var d=Bn;return d=P(r,r===yi?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Xv(r,d,s),fx(r,fe()),r.callbackNode!=null&&r.callbackNode===o?mx.bind(null,r):null)}function px(r,s){if(Sh())return null;Xv(r,s,!0)}function cE(){wE(function(){(ei&6)!==0?st(Ce,uE):hx()})}function qp(){if(ao===0){var r=ls;r===0&&(r=yt,yt<<=1,(yt&261888)===0&&(yt=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 dE(r,s,o,d,y){if(s==="submit"&&o&&o.stateNode===y){var b=gx((y[Dt]||null).action),D=d.submitter;D&&(s=(s=D[Dt]||null)?gx(s.formAction):D.getAttribute("formAction"),s!==null&&(b=s,D=null));var $=new Ci("action","action",null,d,y);r.push({event:$,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ao!==0){var be=D?yx(y,D):new FormData(y);cp(o,{pending:!0,data:be,method:y.method,action:b},null,be)}}else typeof b=="function"&&($.preventDefault(),be=D?yx(y,D):new FormData(y),cp(o,{pending:!0,data:be,method:y.method,action:b},b,be))},currentTarget:y}]})}}for(var Vp=0;Vp<Yu.length;Vp++){var Gp=Yu[Vp],hE=Gp.toLowerCase(),fE=Gp[0].toUpperCase()+Gp.slice(1);Xr(hE,"on"+fE)}Xr(Ud,"onAnimationEnd"),Xr(Ha,"onAnimationIteration"),Xr(zd,"onAnimationStart"),Xr("dblclick","onDoubleClick"),Xr("focusin","onFocus"),Xr("focusout","onBlur"),Xr(Hd,"onTransitionRun"),Xr($d,"onTransitionStart"),Xr(Um,"onTransitionCancel"),Xr(qd,"onTransitionEnd"),Zn("onMouseEnter",["mouseout","mouseover"]),Zn("onMouseLeave",["mouseout","mouseover"]),Zn("onPointerEnter",["pointerout","pointerover"]),Zn("onPointerLeave",["pointerout","pointerover"]),Qn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Qn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Qn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Qn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Qn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tc="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(" "),mE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tc));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 D=d.length-1;0<=D;D--){var $=d[D],be=$.instance,Ue=$.currentTarget;if($=$.listener,be!==b&&y.isPropagationStopped())break e;b=$,y.currentTarget=Ue;try{b(y)}catch(at){$a(at)}y.currentTarget=null,b=be}else for(D=0;D<d.length;D++){if($=d[D],be=$.instance,Ue=$.currentTarget,$=$.listener,be!==b&&y.isPropagationStopped())break e;b=$,y.currentTarget=Ue;try{b(y)}catch(at){$a(at)}y.currentTarget=null,b=be}}}}function Ln(r,s){var o=s[Dn];o===void 0&&(o=s[Dn]=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 Ch="_reactListening"+Math.random().toString(36).slice(2);function Wp(r){if(!r[Ch]){r[Ch]=!0,ui.forEach(function(o){o!=="selectionchange"&&(mE.has(o)||Kp(o,!1,r),Kp(o,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Ch]||(s[Ch]=!0,Kp("selectionchange",!1,s))}}function vx(r,s,o,d){switch(Wx(s)){case 2:var y=HE;break;case 8:y=$E;break;default:y=u0}o=y.bind(null,s,o,r),y=void 0,!K||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 D=d.tag;if(D===3||D===4){var $=d.stateNode.containerInfo;if($===y)break;if(D===4)for(D=d.return;D!==null;){var be=D.tag;if((be===3||be===4)&&D.stateNode.containerInfo===y)return;D=D.return}for(;$!==null;){if(D=Un($),D===null)return;if(be=D.tag,be===5||be===6||be===26||be===27){d=b=D;continue e}$=$.parentNode}}d=d.return}Ee(function(){var Ue=b,at=_i(o),ct=[];e:{var $e=Xu.get(r);if($e!==void 0){var Ye=Ci,qt=r;switch(r){case"keypress":if(gt(o)===0)break e;case"keydown":case"keyup":Ye=Ad;break;case"focusin":qt="focus",Ye=Oa;break;case"focusout":qt="blur",Ye=Oa;break;case"beforeblur":case"afterblur":Ye=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":Ye=Fi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=Do;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=aa;break;case Ud:case Ha:case zd:Ye=jo;break;case qd:Ye=Nd;break;case"scroll":case"scrollend":Ye=yn;break;case"wheel":Ye=Md;break;case"copy":case"cut":case"paste":Ye=Wr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=La;break;case"toggle":case"beforetoggle":Ye=Mm}var on=(s&4)!==0,fi=!on&&(r==="scroll"||r==="scrollend"),Re=on?$e!==null?$e+"Capture":null:$e;on=[];for(var ke=Ue,Fe;ke!==null;){var lt=ke;if(Fe=lt.stateNode,lt=lt.tag,lt!==5&<!==26&<!==27||Fe===null||Re===null||(lt=Ve(ke,Re),lt!=null&&on.push(Sc(ke,lt,Fe))),fi)break;ke=ke.return}0<on.length&&($e=new Ye($e,qt,null,o,at),ct.push({event:$e,listeners:on}))}}if((s&7)===0){e:{if($e=r==="mouseover"||r==="pointerover",Ye=r==="mouseout"||r==="pointerout",$e&&o!==Gi&&(qt=o.relatedTarget||o.fromElement)&&(Un(qt)||qt[jt]))break e;if((Ye||$e)&&($e=at.window===at?at:($e=at.ownerDocument)?$e.defaultView||$e.parentWindow:window,Ye?(qt=o.relatedTarget||o.toElement,Ye=Ue,qt=qt?Un(qt):null,qt!==null&&(fi=l(qt),on=qt.tag,qt!==fi||on!==5&&on!==27&&on!==6)&&(qt=null)):(Ye=null,qt=Ue),Ye!==qt)){if(on=Fi,lt="onMouseLeave",Re="onMouseEnter",ke="mouse",(r==="pointerout"||r==="pointerover")&&(on=La,lt="onPointerLeave",Re="onPointerEnter",ke="pointer"),fi=Ye==null?$e:Cn(Ye),Fe=qt==null?$e:Cn(qt),$e=new on(lt,ke+"leave",Ye,o,at),$e.target=fi,$e.relatedTarget=Fe,lt=null,Un(at)===Ue&&(on=new on(Re,ke+"enter",qt,o,at),on.target=Fe,on.relatedTarget=fi,lt=on),fi=lt,Ye&&qt)t:{for(on=pE,Re=Ye,ke=qt,Fe=0,lt=Re;lt;lt=on(lt))Fe++;lt=0;for(var Jt=ke;Jt;Jt=on(Jt))lt++;for(;0<Fe-lt;)Re=on(Re),Fe--;for(;0<lt-Fe;)ke=on(ke),lt--;for(;Fe--;){if(Re===ke||ke!==null&&Re===ke.alternate){on=Re;break t}Re=on(Re),ke=on(ke)}on=null}else on=null;Ye!==null&&xx(ct,$e,Ye,on,!1),qt!==null&&fi!==null&&xx(ct,fi,qt,on,!0)}}e:{if($e=Ue?Cn(Ue):window,Ye=$e.nodeName&&$e.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&$e.type==="file")var Wn=zu;else if(Uu($e))if(Hu)Wn=Pm;else{Wn=Bm;var Kt=Im}else Ye=$e.nodeName,!Ye||Ye.toLowerCase()!=="input"||$e.type!=="checkbox"&&$e.type!=="radio"?Ue&&Gn(Ue.elementType)&&(Wn=zu):Wn=Fd;if(Wn&&(Wn=Wn(r,Ue))){Id(ct,Wn,o,at);break e}Kt&&Kt(r,$e,Ue),r==="focusout"&&Ue&&$e.type==="number"&&Ue.memoizedProps.value!=null&&Bi($e,"number",$e.value)}switch(Kt=Ue?Cn(Ue):window,r){case"focusin":(Uu(Kt)||Kt.contentEditable==="true")&&(Ua=Kt,Gu=Ue,za=null);break;case"focusout":za=Gu=Ua=null;break;case"mousedown":El=!0;break;case"contextmenu":case"mouseup":case"dragend":El=!1,Ku(ct,o,at);break;case"selectionchange":if(Fm)break;case"keydown":case"keyup":Ku(ct,o,at)}var _n;if(Ia)e:{switch(r){case"compositionstart":var Pn="onCompositionStart";break e;case"compositionend":Pn="onCompositionEnd";break e;case"compositionupdate":Pn="onCompositionUpdate";break e}Pn=void 0}else Ba?Sl(r,o)&&(Pn="onCompositionEnd"):r==="keydown"&&o.keyCode===229&&(Pn="onCompositionStart");Pn&&(Rd&&o.locale!=="ko"&&(Ba||Pn!=="onCompositionStart"?Pn==="onCompositionEnd"&&Ba&&(_n=et()):(ye=at,ze="value"in ye?ye.value:ye.textContent,Ba=!0)),Kt=Ah(Ue,Pn),0<Kt.length&&(Pn=new Ro(Pn,r,null,o,at),ct.push({event:Pn,listeners:Kt}),_n?Pn.data=_n:(_n=Ld(o),_n!==null&&(Pn.data=_n)))),(_n=jd?Rm(r,o):Fu(r,o))&&(Pn=Ah(Ue,"onBeforeInput"),0<Pn.length&&(Kt=new Ro("onBeforeInput","beforeinput",null,o,at),ct.push({event:Kt,listeners:Pn}),Kt.data=_n)),dE(ct,r,Ue,o,at)}bx(ct,s)})}function Sc(r,s,o){return{instance:r,listener:s,currentTarget:o}}function Ah(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=Ve(r,o),y!=null&&d.unshift(Sc(r,y,b)),y=Ve(r,s),y!=null&&d.push(Sc(r,y,b))),r.tag===3)return d;r=r.return}return[]}function pE(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,D=[];o!==null&&o!==d;){var $=o,be=$.alternate,Ue=$.stateNode;if($=$.tag,be!==null&&be===d)break;$!==5&&$!==26&&$!==27||Ue===null||(be=Ue,y?(Ue=Ve(o,b),Ue!=null&&D.unshift(Sc(o,Ue,be))):y||(Ue=Ve(o,b),Ue!=null&&D.push(Sc(o,Ue,be)))),o=o.return}D.length!==0&&r.push({event:s,listeners:D})}var gE=/\r\n?/g,yE=/\u0000|\uFFFD/g;function _x(r){return(typeof r=="string"?r:""+r).replace(gE,`
|
||
`).replace(yE,"")}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":it(r,"class",d);break;case"tabIndex":it(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":it(r,o,d);break;case"style":Vn(r,d,b);break;case"data":if(s!=="object"){it(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=Jn);break;case"onScroll":d!=null&&Ln("scroll",r);break;case"onScrollEnd":d!=null&&Ln("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":Ln("beforetoggle",r),Ln("toggle",r),xe(r,"popover",d);break;case"xlinkActuate":mt(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":mt(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":mt(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":mt(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":mt(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":mt(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":mt(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":mt(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":mt(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":xe(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=Kn.get(o)||o,xe(r,o,d))}}function Yp(r,s,o,d,y,b){switch(o){case"style":Vn(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&&Ln("scroll",r);break;case"onScrollEnd":d!=null&&Ln("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ri.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[Dt]||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,""):xe(r,o,d)}}}function mr(r,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ln("error",r),Ln("load",r);var d=!1,y=!1,b;for(b in o)if(o.hasOwnProperty(b)){var D=o[b];if(D!=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,D,o,null)}}y&&hi(r,s,"srcSet",o.srcSet,o,null),d&&hi(r,s,"src",o.src,o,null);return;case"input":Ln("invalid",r);var $=b=D=y=null,be=null,Ue=null;for(d in o)if(o.hasOwnProperty(d)){var at=o[d];if(at!=null)switch(d){case"name":y=at;break;case"type":D=at;break;case"checked":be=at;break;case"defaultChecked":Ue=at;break;case"value":b=at;break;case"defaultValue":$=at;break;case"children":case"dangerouslySetInnerHTML":if(at!=null)throw Error(i(137,s));break;default:hi(r,s,d,at,o,null)}}zn(r,b,$,be,Ue,D,y,!1);return;case"select":Ln("invalid",r),d=D=b=null;for(y in o)if(o.hasOwnProperty(y)&&($=o[y],$!=null))switch(y){case"value":b=$;break;case"defaultValue":D=$;break;case"multiple":d=$;default:hi(r,s,y,$,o,null)}s=b,o=D,r.multiple=!!d,s!=null?$n(r,!!d,s,!1):o!=null&&$n(r,!!d,o,!0);return;case"textarea":Ln("invalid",r),b=y=d=null;for(D in o)if(o.hasOwnProperty(D)&&($=o[D],$!=null))switch(D){case"value":d=$;break;case"defaultValue":y=$;break;case"children":b=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(i(91));break;default:hi(r,s,D,$,o,null)}Si(r,d,y,b);return;case"option":for(be in o)o.hasOwnProperty(be)&&(d=o[be],d!=null)&&(be==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":hi(r,s,be,d,o,null));return;case"dialog":Ln("beforetoggle",r),Ln("toggle",r),Ln("cancel",r),Ln("close",r);break;case"iframe":case"object":Ln("load",r);break;case"video":case"audio":for(d=0;d<Tc.length;d++)Ln(Tc[d],r);break;case"image":Ln("error",r),Ln("load",r);break;case"details":Ln("toggle",r);break;case"embed":case"source":case"link":Ln("error",r),Ln("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(Gn(s)){for(at in o)o.hasOwnProperty(at)&&(d=o[at],d!==void 0&&Yp(r,s,at,d,o,void 0));return}}for($ in o)o.hasOwnProperty($)&&(d=o[$],d!=null&&hi(r,s,$,d,o,null))}function bE(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,D=null,$=null,be=null,Ue=null,at=null;for(Ye in o){var ct=o[Ye];if(o.hasOwnProperty(Ye)&&ct!=null)switch(Ye){case"checked":break;case"value":break;case"defaultValue":be=ct;default:d.hasOwnProperty(Ye)||hi(r,s,Ye,null,d,ct)}}for(var $e in d){var Ye=d[$e];if(ct=o[$e],d.hasOwnProperty($e)&&(Ye!=null||ct!=null))switch($e){case"type":b=Ye;break;case"name":y=Ye;break;case"checked":Ue=Ye;break;case"defaultChecked":at=Ye;break;case"value":D=Ye;break;case"defaultValue":$=Ye;break;case"children":case"dangerouslySetInnerHTML":if(Ye!=null)throw Error(i(137,s));break;default:Ye!==ct&&hi(r,s,$e,Ye,d,ct)}}xn(r,D,$,be,Ue,at,b,y);return;case"select":Ye=D=$=$e=null;for(b in o)if(be=o[b],o.hasOwnProperty(b)&&be!=null)switch(b){case"value":break;case"multiple":Ye=be;default:d.hasOwnProperty(b)||hi(r,s,b,null,d,be)}for(y in d)if(b=d[y],be=o[y],d.hasOwnProperty(y)&&(b!=null||be!=null))switch(y){case"value":$e=b;break;case"defaultValue":$=b;break;case"multiple":D=b;default:b!==be&&hi(r,s,y,b,d,be)}s=$,o=D,d=Ye,$e!=null?$n(r,!!o,$e,!1):!!d!=!!o&&(s!=null?$n(r,!!o,s,!0):$n(r,!!o,o?[]:"",!1));return;case"textarea":Ye=$e=null;for($ in o)if(y=o[$],o.hasOwnProperty($)&&y!=null&&!d.hasOwnProperty($))switch($){case"value":break;case"children":break;default:hi(r,s,$,null,d,y)}for(D in d)if(y=d[D],b=o[D],d.hasOwnProperty(D)&&(y!=null||b!=null))switch(D){case"value":$e=y;break;case"defaultValue":Ye=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(i(91));break;default:y!==b&&hi(r,s,D,y,d,b)}Vi(r,$e,Ye);return;case"option":for(var qt in o)$e=o[qt],o.hasOwnProperty(qt)&&$e!=null&&!d.hasOwnProperty(qt)&&(qt==="selected"?r.selected=!1:hi(r,s,qt,null,d,$e));for(be in d)$e=d[be],Ye=o[be],d.hasOwnProperty(be)&&$e!==Ye&&($e!=null||Ye!=null)&&(be==="selected"?r.selected=$e&&typeof $e!="function"&&typeof $e!="symbol":hi(r,s,be,$e,d,Ye));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var on in o)$e=o[on],o.hasOwnProperty(on)&&$e!=null&&!d.hasOwnProperty(on)&&hi(r,s,on,null,d,$e);for(Ue in d)if($e=d[Ue],Ye=o[Ue],d.hasOwnProperty(Ue)&&$e!==Ye&&($e!=null||Ye!=null))switch(Ue){case"children":case"dangerouslySetInnerHTML":if($e!=null)throw Error(i(137,s));break;default:hi(r,s,Ue,$e,d,Ye)}return;default:if(Gn(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(at in d)$e=d[at],Ye=o[at],!d.hasOwnProperty(at)||$e===Ye||$e===void 0&&Ye===void 0||Yp(r,s,at,$e,d,Ye);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(ct in d)$e=d[ct],Ye=o[ct],!d.hasOwnProperty(ct)||$e===Ye||$e==null&&Ye==null||hi(r,s,ct,$e,d,Ye)}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 vE(){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,D=y.initiatorType,$=y.duration;if(b&&$&&Tx(D)){for(D=0,$=y.responseEnd,d+=1;d<o.length;d++){var be=o[d],Ue=be.startTime;if(Ue>$)break;var at=be.transferSize,ct=be.initiatorType;at&&Tx(ct)&&(be=be.responseEnd,D+=at*(be<$?1:($-Ue)/(be-Ue)))}if(--d,s+=8*(b+D)/(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 Nh(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 e0=null;function xE(){var r=window.event;return r&&r.type==="popstate"?r===e0?!1:(e0=r,!0):(e0=null,!1)}var Ex=typeof setTimeout=="function"?setTimeout:void 0,_E=typeof clearTimeout=="function"?clearTimeout:void 0,Cx=typeof Promise=="function"?Promise:void 0,wE=typeof queueMicrotask=="function"?queueMicrotask:typeof Cx<"u"?function(r){return Cx.resolve(null).then(r).catch(TE)}:Ex;function TE(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),Wl(s);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")kc(r.ownerDocument.documentElement);else if(o==="head"){o=r.ownerDocument.head,kc(o);for(var b=o.firstChild;b;){var D=b.nextSibling,$=b.nodeName;b[Sn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&b.rel.toLowerCase()==="stylesheet"||o.removeChild(b),b=D}}else o==="body"&&kc(r.ownerDocument.body);o=y}while(o);Wl(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 t0(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":t0(o),Xt(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}r.removeChild(o)}}function SE(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[Sn])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 kE(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 n0(r){return r.data==="$?"||r.data==="$~"}function i0(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function EE(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 r0=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=Nh(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 kc(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Xt(r)}var ds=new Map,Ox=new Set;function Dh(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var _a=F.d;F.d={f:CE,r:AE,D:NE,C:DE,L:ME,m:jE,X:OE,S:RE,M:LE};function CE(){var r=_a.f(),s=_h();return r||s}function AE(r){var s=Yn(r);s!==null&&s.tag===5&&s.type==="form"?Qb(s):_a.r(r)}var Vl=typeof document>"u"?null:document;function Lx(r,s,o){var d=Vl;if(d&&typeof s=="string"&&s){var y=Gt(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"),mr(s,"link",r),wn(s),d.head.appendChild(s)))}}function NE(r){_a.D(r),Lx("dns-prefetch",r,null)}function DE(r,s){_a.C(r,s),Lx("preconnect",r,s)}function ME(r,s,o){_a.L(r,s,o);var d=Vl;if(d&&r&&s){var y='link[rel="preload"][as="'+Gt(s)+'"]';s==="image"&&o&&o.imageSrcSet?(y+='[imagesrcset="'+Gt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(y+='[imagesizes="'+Gt(o.imageSizes)+'"]')):y+='[href="'+Gt(r)+'"]';var b=y;switch(s){case"style":b=Gl(r);break;case"script":b=Kl(r)}ds.has(b)||(r=S({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:r,as:s},o),ds.set(b,r),d.querySelector(y)!==null||s==="style"&&d.querySelector(Ec(b))||s==="script"&&d.querySelector(Cc(b))||(s=d.createElement("link"),mr(s,"link",r),wn(s),d.head.appendChild(s)))}}function jE(r,s){_a.m(r,s);var o=Vl;if(o&&r){var d=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+Gt(d)+'"][href="'+Gt(r)+'"]',b=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Kl(r)}if(!ds.has(b)&&(r=S({rel:"modulepreload",href:r},s),ds.set(b,r),o.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Cc(b)))return}d=o.createElement("link"),mr(d,"link",r),wn(d),o.head.appendChild(d)}}}function RE(r,s,o){_a.S(r,s,o);var d=Vl;if(d&&r){var y=ti(d).hoistableStyles,b=Gl(r);s=s||"default";var D=y.get(b);if(!D){var $={loading:0,preload:null};if(D=d.querySelector(Ec(b)))$.loading=5;else{r=S({rel:"stylesheet",href:r,"data-precedence":s},o),(o=ds.get(b))&&s0(r,o);var be=D=d.createElement("link");wn(be),mr(be,"link",r),be._p=new Promise(function(Ue,at){be.onload=Ue,be.onerror=at}),be.addEventListener("load",function(){$.loading|=1}),be.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Mh(D,s,d)}D={type:"stylesheet",instance:D,count:1,state:$},y.set(b,D)}}}function OE(r,s){_a.X(r,s);var o=Vl;if(o&&r){var d=ti(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Cc(y)),b||(r=S({src:r,async:!0},s),(s=ds.get(y))&&a0(r,s),b=o.createElement("script"),wn(b),mr(b,"link",r),o.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(y,b))}}function LE(r,s){_a.M(r,s);var o=Vl;if(o&&r){var d=ti(o).hoistableScripts,y=Kl(r),b=d.get(y);b||(b=o.querySelector(Cc(y)),b||(r=S({src:r,async:!0,type:"module"},s),(s=ds.get(y))&&a0(r,s),b=o.createElement("script"),wn(b),mr(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=ht.current)?Dh(y):null;if(!y)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=Gl(o.href),o=ti(y).hoistableStyles,d=o.get(s),d||(d={type:"style",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){r=Gl(o.href);var b=ti(y).hoistableStyles,D=b.get(r);if(D||(y=y.ownerDocument||y,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,D),(b=y.querySelector(Ec(r)))&&!b._p&&(D.instance=b,D.state.loading=5),ds.has(r)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ds.set(r,o),b||IE(y,r,o,D.state))),s&&d===null)throw Error(i(528,""));return D}if(s&&d!==null)throw Error(i(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Kl(o),o=ti(y).hoistableScripts,d=o.get(s),d||(d={type:"script",instance:null,count:0,state:null},o.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Gl(r){return'href="'+Gt(r)+'"'}function Ec(r){return'link[rel="stylesheet"]['+r+"]"}function Bx(r){return S({},r,{"data-precedence":r.precedence,precedence:null})}function IE(r,s,o,d){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?d.loading=1:(s=r.createElement("link"),d.preload=s,s.addEventListener("load",function(){return d.loading|=1}),s.addEventListener("error",function(){return d.loading|=2}),mr(s,"link",o),wn(s),r.head.appendChild(s))}function Kl(r){return'[src="'+Gt(r)+'"]'}function Cc(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~="'+Gt(o.href)+'"]');if(d)return s.instance=d,wn(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"),wn(d),mr(d,"style",y),Mh(d,o.precedence,r),s.instance=d;case"stylesheet":y=Gl(o.href);var b=r.querySelector(Ec(y));if(b)return s.state.loading|=4,s.instance=b,wn(b),b;d=Bx(o),(y=ds.get(y))&&s0(d,y),b=(r.ownerDocument||r).createElement("link"),wn(b);var D=b;return D._p=new Promise(function($,be){D.onload=$,D.onerror=be}),mr(b,"link",d),s.state.loading|=4,Mh(b,o.precedence,r),s.instance=b;case"script":return b=Kl(o.src),(y=r.querySelector(Cc(b)))?(s.instance=y,wn(y),y):(d=o,(y=ds.get(b))&&(d=S({},o),a0(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),wn(y),mr(y,"link",d),r.head.appendChild(y),s.instance=y);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(d=s.instance,s.state.loading|=4,Mh(d,o.precedence,r));return s.instance}function Mh(r,s,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,b=y,D=0;D<d.length;D++){var $=d[D];if($.dataset.precedence===s)b=$;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 s0(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function a0(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var jh=null;function Fx(r,s,o){if(jh===null){var d=new Map,y=jh=new Map;y.set(o,d)}else y=jh,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[Sn]||b[Bt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var D=b.getAttribute(s)||"";D=r+D;var $=d.get(D);$?$.push(b):d.set(D,[b])}}return d}function Ux(r,s,o){r=r.ownerDocument||r,r.head.insertBefore(o,s==="title"?r.querySelector("head > title"):null)}function BE(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 PE(r,s,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var y=Gl(d.href),b=s.querySelector(Ec(y));if(b){s=b._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Rh.bind(r),s.then(r,r)),o.state.loading|=4,o.instance=b,wn(b);return}b=s.ownerDocument||s,d=Bx(d),(y=ds.get(y))&&s0(d,y),b=b.createElement("link"),wn(b);var D=b;D._p=new Promise(function($,be){D.onload=$,D.onerror=be}),mr(b,"link",d),o.instance=b}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(r.count++,o=Rh.bind(r),s.addEventListener("load",o),s.addEventListener("error",o))}}var o0=0;function FE(r,s){return r.stylesheets&&r.count===0&&Lh(r,r.stylesheets),0<r.count||0<r.imgCount?function(o){var d=setTimeout(function(){if(r.stylesheets&&Lh(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+s);0<r.imgBytes&&o0===0&&(o0=62500*vE());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Lh(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>o0?50:800)+s);return r.unsuspend=o,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Rh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lh(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Oh=null;function Lh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Oh=new Map,s.forEach(UE,r),Oh=null,Rh.call(r))}function UE(r,s){if(!(s.state.loading&4)){var o=Oh.get(r);if(o)var d=o.get(null);else{o=new Map,Oh.set(r,o);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<y.length;b++){var D=y[b];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(o.set(D.dataset.precedence,D),d=D)}d&&o.set(null,d)}y=s.instance,D=y.getAttribute("data-precedence"),b=o.get(D)||d,b===d&&o.set(null,y),o.set(D,y),this.count++,d=Rh.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 Ac={$$typeof:H,Provider:null,Consumer:null,_currentValue:ee,_currentValue2:ee,_threadCount:0};function zE(r,s,o,d,y,b,D,$,be){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=dt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dt(0),this.hiddenUpdates=dt(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=b,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=be,this.incompleteTransitions=new Map}function Hx(r,s,o,d,y,b,D,$,be,Ue,at,ct){return r=new zE(r,s,o,D,be,Ue,at,ct,$),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},qm(b),r}function $x(r){return r?(r=Va,r):Va}function qx(r,s,o,d,y,b){y=$x(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&&(Fr(o,r,s),ac(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 l0(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&&Fr(s,r,67108864),l0(r,67108864)}}function Kx(r){if(r.tag===13||r.tag===31){var s=ts();s=Tn(s);var o=ua(r,s);o!==null&&Fr(o,r,s),l0(r,s)}}var Ih=!0;function HE(r,s,o,d){var y=q.T;q.T=null;var b=F.p;try{F.p=2,u0(r,s,o,d)}finally{F.p=b,q.T=y}}function $E(r,s,o,d){var y=q.T;q.T=null;var b=F.p;try{F.p=8,u0(r,s,o,d)}finally{F.p=b,q.T=y}}function u0(r,s,o,d){if(Ih){var y=c0(d);if(y===null)Xp(r,s,d,Bh,o),Xx(r,d);else if(VE(y,r,s,o,d))d.stopPropagation();else if(Xx(r,d),s&4&&-1<qE.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 D=N(b.pendingLanes);if(D!==0){var $=b;for($.pendingLanes|=2,$.entangledLanes|=2;D;){var be=1<<31-At(D);$.entanglements[1]|=be,D&=~be}Vs(b),(ei&6)===0&&(vh=fe()+500,wc(0))}}break;case 31:case 13:$=ua(b,2),$!==null&&Fr($,b,2),_h(),l0(b,2)}if(b=c0(d),b===null&&Xp(r,s,d,Bh,o),b===y)break;y=b}y!==null&&d.stopPropagation()}else Xp(r,s,d,null,o)}}function c0(r){return r=_i(r),d0(r)}var Bh=null;function d0(r){if(Bh=null,r=Un(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 Bh=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(He()){case Ce:return 2;case De:return 8;case Ie:case Qe:return 32;case Et:return 268435456;default:return 32}default:return 32}}var h0=!1,lo=null,uo=null,co=null,Nc=new Map,Dc=new Map,ho=[],qE="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":Nc.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dc.delete(s.pointerId)}}function Mc(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 VE(r,s,o,d,y){switch(s){case"focusin":return lo=Mc(lo,r,s,o,d,y),!0;case"dragenter":return uo=Mc(uo,r,s,o,d,y),!0;case"mouseover":return co=Mc(co,r,s,o,d,y),!0;case"pointerover":var b=y.pointerId;return Nc.set(b,Mc(Nc.get(b)||null,r,s,o,d,y)),!0;case"gotpointercapture":return b=y.pointerId,Dc.set(b,Mc(Dc.get(b)||null,r,s,o,d,y)),!0}return!1}function Yx(r){var s=Un(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,sn(r.priority,function(){Kx(o)});return}}else if(s===31){if(s=h(o),s!==null){r.blockedOn=s,sn(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 Ph(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var o=c0(r.nativeEvent);if(o===null){o=r.nativeEvent;var d=new o.constructor(o.type,o);Gi=d,o.target.dispatchEvent(d),Gi=null}else return s=Yn(o),s!==null&&Gx(s),r.blockedOn=o,!1;s.shift()}return!0}function Qx(r,s,o){Ph(r)&&o.delete(s)}function GE(){h0=!1,lo!==null&&Ph(lo)&&(lo=null),uo!==null&&Ph(uo)&&(uo=null),co!==null&&Ph(co)&&(co=null),Nc.forEach(Qx),Dc.forEach(Qx)}function Fh(r,s){r.blockedOn===s&&(r.blockedOn=null,h0||(h0=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,GE)))}var Uh=null;function Zx(r){Uh!==r&&(Uh=r,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Uh===r&&(Uh=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(d0(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 Wl(r){function s(be){return Fh(be,r)}lo!==null&&Fh(lo,r),uo!==null&&Fh(uo,r),co!==null&&Fh(co,r),Nc.forEach(s),Dc.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],D=y[Dt]||null;if(typeof b=="function")D||Zx(o);else if(D){var $=null;if(b&&b.hasAttribute("formAction")){if(y=b,D=b[Dt]||null)$=D.formAction;else if(d0(y)!==null)continue}else $=D.action;typeof $=="function"?o[d+1]=$:(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(D){return y=D})},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 f0(r){this._internalRoot=r}zh.prototype.render=f0.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)},zh.prototype.unmount=f0.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),_h(),s[jt]=null}};function zh(r){this._internalRoot=r}zh.prototype.unstable_scheduleHydration=function(r){if(r){var s=gn();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"));F.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=g(s),r=r!==null?_(r):null,r=r===null?null:r.stateNode,r};var KE={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hh.isDisabled&&Hh.supportsFiber)try{Yt=Hh.inject(KE),Ft=Hh}catch{}}return Rc.createRoot=function(r,s){if(!a(r))throw Error(i(299));var o=!1,d="",y=ov,b=lv,D=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&&(D=s.onRecoverableError)),s=Hx(r,1,!1,null,null,o,d,null,y,b,D,Jx),r[jt]=s.current,Wp(r),new f0(s)},Rc.hydrateRoot=function(r,s,o){if(!a(r))throw Error(i(299));var d=!1,y="",b=ov,D=lv,$=uv,be=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(y=o.identifierPrefix),o.onUncaughtError!==void 0&&(b=o.onUncaughtError),o.onCaughtError!==void 0&&(D=o.onCaughtError),o.onRecoverableError!==void 0&&($=o.onRecoverableError),o.formState!==void 0&&(be=o.formState)),s=Hx(r,1,!0,s,o??null,d,y,be,b,D,$,Jx),s.context=$x(null),o=s.current,d=ts(),d=Tn(d),y=Ya(d),y.callback=null,Qa(o,y,d),o=d,s.current.lanes=o,$t(s,o),Vs(s),r[jt]=s.current,Wp(r),new zh(s)},Rc.version="19.2.3",Rc}var d1;function rC(){if(d1)return g0.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(),g0.exports=iC(),g0.exports}var Q_=rC();function sC(...n){return n.filter(Boolean).join(" ")}const aC="inline-flex items-center justify-center font-semibold focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",oC={sm:"rounded-sm",md:"rounded-md",full:"rounded-full"},lC={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"},uC={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 cC(){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:sC(aC,oC[a],lC[i],uC[t][e],C,g),...S,children:[h?c.jsx("span",{className:"-ml-0.5",children:c.jsx(cC,{})}):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 Z_(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=Z_(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function rn(){for(var n,e,t=0,i="",a=arguments.length;t<a;t++)(n=arguments[t])&&(e=Z_(n))&&(i&&(i+=" "),i+=e);return i}var gu=Y_(),dC=Object.defineProperty,hC=(n,e,t)=>e in n?dC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,x0=(n,e,t)=>(hC(n,typeof e!="symbol"?e+"":e,t),t);let fC=class{constructor(){x0(this,"current",this.detect()),x0(this,"handoffState","pending"),x0(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 fC;function yd(n){var e;return ea.isServer?null:n==null?document:(e=n?.ownerDocument)!=null?e:document}function kg(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 J_(n){var e,t;return(t=(e=kg(n))==null?void 0:e.activeElement)!=null?t:null}function mC(n){return J_(n)===n}function Kf(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 Kf(()=>{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 Wf(){let[n]=p.useState(Ra);return p.useEffect(()=>()=>n.dispose(),[n]),n}let Vr=(n,e)=>{ea.isServer?p.useEffect(n,e):p.useLayoutEffect(n,e)};function xl(n){let e=p.useRef(n);return Vr(()=>{e.current=n},[n]),e}let vi=function(n){let e=xl(n);return tn.useCallback((...t)=>e.current(...t),[e])};function bd(n){return p.useMemo(()=>n,Object.values(n))}let pC=p.createContext(void 0);function gC(){return p.useContext(pC)}function Eg(...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 gf=(n=>(n[n.None=0]="None",n[n.RenderStrategy=1]="RenderStrategy",n[n.Static=2]="Static",n))(gf||{}),So=(n=>(n[n.Unmount=0]="Unmount",n[n.Hidden=1]="Hidden",n))(So||{});function vs(){let n=bC();return p.useCallback(e=>yC({mergeRefs:n,...e}),[n])}function yC({ourProps:n,theirProps:e,slot:t,defaultTag:i,features:a,visible:l=!0,name:u,mergeRefs:h}){h=h??vC;let f=ew(e,n);if(l)return $h(f,t,i,u,h);let g=a??0;if(g&2){let{static:_=!1,...S}=f;if(_)return $h(S,t,i,u,h)}if(g&1){let{unmount:_=!0,...S}=f;return Ma(_?0:1,{0(){return null},1(){return $h({...S,hidden:!0,style:{display:"none"}},t,i,u,h)}})}return $h(f,t,i,u,h)}function $h(n,e={},t,i,a){let{as:l=t,children:u,refName:h="ref",...f}=_0(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,M=[];for(let[L,E]of Object.entries(e))typeof E=="boolean"&&(C=!0),E===!0&&M.push(L.replace(/([A-Z])/g,B=>`-${B.toLowerCase()}`));if(C){S["data-headlessui-state"]=M.join(" ");for(let L of M)S[`data-${L}`]=""}}if(Xc(l)&&(Object.keys(nl(f)).length>0||Object.keys(nl(S)).length>0))if(!p.isValidElement(_)||Array.isArray(_)&&_.length>1||_C(_)){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,M=C?.className,L=typeof M=="function"?(...G)=>Eg(M(...G),f.className):Eg(M,f.className),E=L?{className:L}:{},B=ew(_.props,nl(_0(f,["ref"])));for(let G in S)G in B&&delete S[G];return p.cloneElement(_,Object.assign({},B,S,g,{ref:a(xC(_),g.ref)},E))}return p.createElement(l,Object.assign({},_0(f,["ref"]),!Xc(l)&&g,!Xc(l)&&S),_)}function bC(){let n=p.useRef([]),e=p.useCallback(t=>{for(let i of n.current)i!=null&&(typeof i=="function"?i(t):i.current=t)},[]);return(...t)=>{if(!t.every(i=>i==null))return n.current=t,e}}function vC(...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 ew(...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 Kr(n){var e;return Object.assign(p.forwardRef(n),{displayName:(e=n.displayName)!=null?e:n.name})}function nl(n){let e=Object.assign({},n);for(let t in e)e[t]===void 0&&delete e[t];return e}function _0(n,e=[]){let t=Object.assign({},n);for(let i of e)i in t&&delete t[i];return t}function xC(n){return tn.version.split(".")[0]>="19"?n.props.ref:n.ref}function Xc(n){return n===p.Fragment||n===Symbol.for("react.fragment")}function _C(n){return Xc(n.type)}let wC="span";var yf=(n=>(n[n.None=1]="None",n[n.Focusable=2]="Focusable",n[n.Hidden=4]="Hidden",n))(yf||{});function TC(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:wC,name:"Hidden"})}let Cg=Kr(TC);function SC(n){return typeof n!="object"||n===null?!1:"nodeType"in n}function Eo(n){return SC(n)&&"tagName"in n}function pl(n){return Eo(n)&&"accessKey"in n}function ko(n){return Eo(n)&&"tabIndex"in n}function kC(n){return Eo(n)&&"style"in n}function EC(n){return pl(n)&&n.nodeName==="IFRAME"}function CC(n){return pl(n)&&n.nodeName==="INPUT"}let tw=Symbol();function AC(n,e=!0){return Object.assign(n,{[tw]:e})}function ra(...n){let e=p.useRef(n);p.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?.[tw])?void 0:t}let dy=p.createContext(null);dy.displayName="DescriptionContext";function nw(){let n=p.useContext(dy);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,nw),e}return n}function NC(){let[n,e]=p.useState([]);return[n.length>0?n.join(" "):void 0,p.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=p.useMemo(()=>({register:i,slot:t.slot,name:t.name,props:t.props,value:t.value}),[i,t.slot,t.name,t.props,t.value]);return tn.createElement(dy.Provider,{value:a},t.children)},[e])]}let DC="p";function MC(n,e){let t=p.useId(),i=gC(),{id:a=`headlessui-description-${t}`,...l}=n,u=nw(),h=ra(e);Vr(()=>u.register(a),[a,u.register]);let f=bd({...u.slot,disabled:i||!1}),g={ref:h,...u.props,id:a};return vs()({ourProps:g,theirProps:l,slot:f,defaultTag:DC,name:u.name||"Description"})}let jC=Kr(MC),RC=Object.assign(jC,{});var iw=(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))(iw||{});let OC=p.createContext(()=>{});function LC({value:n,children:e}){return tn.createElement(OC.Provider,{value:n},e)}let rw=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 IC=Object.defineProperty,BC=(n,e,t)=>e in n?IC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,PC=(n,e,t)=>(BC(n,e+"",t),t),sw=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},hs=(n,e,t)=>(sw(n,e,"read from private field"),t?t.call(n):e.get(n)),w0=(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)=>(sw(n,e,"write to private field"),e.set(n,t),t),Ks,$c,qc;let FC=class{constructor(e){w0(this,Ks,{}),w0(this,$c,new rw(()=>new Set)),w0(this,qc,new Set),PC(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,qc).add(i),this.disposables.add(()=>{hs(this,qc).delete(i)})}on(e,t){return ea.isServer?()=>{}:(hs(this,$c).get(e).add(t),this.disposables.add(()=>{hs(this,$c).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,qc)){let a=i.selector(hs(this,Ks));aw(i.current,a)||(i.current=a,i.callback(a))}for(let i of hs(this,$c).get(e.type))i(hs(this,Ks),e)}}};Ks=new WeakMap,$c=new WeakMap,qc=new WeakMap;function aw(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:T0(n[Symbol.iterator](),e[Symbol.iterator]()):n instanceof Map&&e instanceof Map||n instanceof Set&&e instanceof Set?n.size!==e.size?!1:T0(n.entries(),e.entries()):f1(n)&&f1(e)?T0(Object.entries(n)[Symbol.iterator](),Object.entries(e)[Symbol.iterator]()):!1}function T0(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 UC=Object.defineProperty,zC=(n,e,t)=>e in n?UC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,m1=(n,e,t)=>(zC(n,typeof e!="symbol"?e+"":e,t),t),HC=(n=>(n[n.Push=0]="Push",n[n.Pop=1]="Pop",n))(HC||{});let $C={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}}},qC=class ow extends FC{constructor(){super(...arguments),m1(this,"actions",{push:e=>this.send({type:0,id:e}),pop:e=>this.send({type:1,id:e})}),m1(this,"selectors",{isTop:(e,t)=>e.stack[e.stack.length-1]===t,inStack:(e,t)=>e.stack.includes(t)})}static new(){return new ow({stack:[]})}reduce(e,t){return Ma(t.type,$C,e,t)}};const lw=new rw(()=>qC.new());var S0={exports:{}},k0={};var p1;function VC(){if(p1)return k0;p1=1;var n=Gf();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 k0.useSyncExternalStoreWithSelector=function(f,g,_,S,C){var M=a(null);if(M.current===null){var L={hasValue:!1,value:null};M.current=L}else L=M.current;M=u(function(){function B(Y){if(!G){if(G=!0,Q=Y,Y=S(Y),C!==void 0&&L.hasValue){var W=L.value;if(C(W,Y))return H=W}return H=Y}if(W=H,t(Q,Y))return W;var O=S(Y);return C!==void 0&&C(W,O)?(Q=Y,W):(Q=Y,H=O)}var G=!1,Q,H,se=_===void 0?null:_;return[function(){return B(g())},se===null?void 0:function(){return B(se())}]},[g,_,S,C]);var E=i(f,M[0],M[1]);return l(function(){L.hasValue=!0,L.value=E},[E]),h(E),E},k0}var g1;function GC(){return g1||(g1=1,S0.exports=VC()),S0.exports}var KC=GC();function uw(n,e,t=aw){return KC.useSyncExternalStoreWithSelector(vi(i=>n.subscribe(WC,i)),vi(()=>n.state),vi(()=>n.state),vi(e),t)}function WC(n){return n}function vd(n,e){let t=p.useId(),i=lw.get(e),[a,l]=uw(i,p.useCallback(u=>[i.selectors.isTop(u,t),i.selectors.inStack(u,t)],[i,t]));return Vr(()=>{if(n)return i.actions.push(t),()=>i.actions.pop(t)},[i,n,t]),n?l?a:!0:!1}let Ag=new Map,Yc=new Map;function y1(n){var e;let t=(e=Yc.get(n))!=null?e:0;return Yc.set(n,t+1),t!==0?()=>b1(n):(Ag.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=Yc.get(n))!=null?e:1;if(t===1?Yc.delete(n):Yc.set(n,t-1),t!==1)return;let i=Ag.get(n);i&&(i["aria-hidden"]===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",i["aria-hidden"]),n.inert=i.inert,Ag.delete(n))}function XC(n,{allowed:e,disallowed:t}={}){let i=vd(n,"inert-others");Vr(()=>{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=yd(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 YC(n,e,t){let i=xl(a=>{let l=a.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&t()});p.useEffect(()=>{if(!n)return;let a=e===null?null:pl(e)?e:e.current;if(!a)return;let l=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 bf=["[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(","),QC=["[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||{}),Ng=(n=>(n[n.Error=0]="Error",n[n.Overflow=1]="Overflow",n[n.Success=2]="Success",n[n.Underflow=3]="Underflow",n))(Ng||{}),ZC=(n=>(n[n.Previous=-1]="Previous",n[n.Next=1]="Next",n))(ZC||{});function JC(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(bf)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}function e5(n=document.body){return n==null?[]:Array.from(n.querySelectorAll(QC)).sort((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER)))}var cw=(n=>(n[n.Strict=0]="Strict",n[n.Loose=1]="Loose",n))(cw||{});function t5(n,e=0){var t;return n===((t=yd(n))==null?void 0:t.body)?!1:Ma(e,{0(){return n.matches(bf)},1(){let i=n;for(;i!==null;){if(i.matches(bf))return!0;i=i.parentElement}return!1}})}var n5=(n=>(n[n.Keyboard=0]="Keyboard",n[n.Mouse=1]="Mouse",n))(n5||{});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 i5=["textarea","input"].join(",");function r5(n){var e,t;return(t=(e=n?.matches)==null?void 0:e.call(n,i5))!=null?t:!1}function s5(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 Qc(n,e,{sorted:t=!0,relativeTo:i=null,skipElements:a=[]}={}){let l=Array.isArray(n)?n.length>0?kg(n[0]):document:kg(n),u=Array.isArray(n)?t?s5(n):n:e&64?e5(n):JC(n);a.length>0&&u.length>1&&(u=u.filter(M=>!a.some(L=>L!=null&&"current"in L?L?.current===M:L===M))),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 M=f+_;if(e&16)M=(M+S)%S;else{if(M<0)return 3;if(M>=S)return 1}C=u[M],C?.focus(g),_+=h}while(C!==J_(C));return e&6&&r5(C)&&C.select(),2}function dw(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function a5(){return/Android/gi.test(window.navigator.userAgent)}function v1(){return dw()||a5()}function qh(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return document.addEventListener(e,l,i),()=>document.removeEventListener(e,l,i)},[n,e,i])}function hw(n,e,t,i){let a=xl(t);p.useEffect(()=>{if(!n)return;function l(u){a.current(u)}return window.addEventListener(e,l,i),()=>window.removeEventListener(e,l,i)},[n,e,i])}const x1=30;function o5(n,e,t){let i=xl(t),a=p.useCallback(function(h,f){if(h.defaultPrevented)return;let g=f(h);if(g===null||!g.getRootNode().contains(g)||!g.isConnected)return;let _=(function S(C){return typeof C=="function"?S(C()):Array.isArray(C)||C instanceof Set?C:[C]})(e);for(let S of _)if(S!==null&&(S.contains(g)||h.composed&&h.composedPath().includes(S)))return;return!t5(g,cw.Loose)&&g.tabIndex!==-1&&h.preventDefault(),i.current(h,g)},[i,e]),l=p.useRef(null);qh(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),qh(n,"pointerup",h=>{if(v1()||!l.current)return;let f=l.current;return l.current=null,a(h,()=>f)},!0);let u=p.useRef({x:0,y:0});qh(n,"touchstart",h=>{u.current.x=h.touches[0].clientX,u.current.y=h.touches[0].clientY},!0),qh(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),hw(n,"blur",h=>a(h,()=>EC(window.document.activeElement)?window.document.activeElement:null),!0)}function hy(...n){return p.useMemo(()=>yd(...n),[...n])}function fw(n,e,t,i){let a=xl(t);p.useEffect(()=>{n=n??window;function l(u){a.current(u)}return n.addEventListener(e,l,i),()=>n.removeEventListener(e,l,i)},[n,e,i])}function l5(n){return p.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)}function u5(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 c5(){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 d5(){return dw()?{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)&&kC(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(CC(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 h5(){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=u5(()=>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=[d5(),c5(),h5()];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 f5(n,e,t=()=>({containers:[]})){let i=l5(ol),a=e?i.get(e):void 0,l=a?a.count>0:!1;return Vr(()=>{if(!(!e||!n))return ol.dispatch("PUSH",e,t),()=>ol.dispatch("POP",e,t)},[n,e]),l}function m5(n,e,t=()=>[document.body]){let i=vd(n,"scroll-lock");f5(i,e,a=>{var l;return{containers:[...(l=a.containers)!=null?l:[],t]}})}function p5(n=0){let[e,t]=p.useState(n),i=p.useCallback(f=>t(f),[]),a=p.useCallback(f=>t(g=>g|f),[]),l=p.useCallback(f=>(e&f)===f,[e]),u=p.useCallback(f=>t(g=>g&~f),[]),h=p.useCallback(f=>t(g=>g^f),[]);return{flags:e,setFlag:i,addFlag:a,hasFlag:l,removeFlag:u,toggleFlag:h}}var g5={},w1,T1;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((w1=process==null?void 0:g5)==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 y5=(n=>(n[n.None=0]="None",n[n.Closed=1]="Closed",n[n.Enter=2]="Enter",n[n.Leave=4]="Leave",n))(y5||{});function b5(n){let e={};for(let t in n)n[t]===!0&&(e[`data-${t}`]="");return e}function v5(n,e,t,i){let[a,l]=p.useState(t),{hasFlag:u,addFlag:h,removeFlag:f}=p5(n&&a?3:0),g=p.useRef(!1),_=p.useRef(!1),S=Wf();return Vr(()=>{var C;if(n){if(t&&l(!0),!e){t&&h(3);return}return(C=i?.start)==null||C.call(i,t),x5(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 M;_.current&&T5(e)||(g.current=!1,f(7),t||l(!1),(M=i?.end)==null||M.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 x5(n,{prepare:e,run:t,done:i,inFlight:a}){let l=Ra();return w5(n,{prepare:e,inFlight:a}),l.nextFrame(()=>{t(),l.requestAnimationFrame(()=>{l.add(_5(n,i))})}),l.dispose}function _5(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 w5(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 T5(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 fy(n,e){let t=p.useRef([]),i=vi(n);p.useEffect(()=>{let a=[...t.current];for(let[l,u]of e.entries())if(t.current[l]!==u){let h=i(e,a);return t.current=e,h}},[i,...e])}let Xf=p.createContext(null);Xf.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 Yf(){return p.useContext(Xf)}function S5({value:n,children:e}){return tn.createElement(Xf.Provider,{value:n},e)}function k5({children:n}){return tn.createElement(Xf.Provider,{value:null},n)}function E5(n){function e(){document.readyState!=="loading"&&(n(),document.removeEventListener("DOMContentLoaded",e))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",e),e())}let To=[];E5(()=>{function n(e){if(!ko(e.target)||e.target===document.body||To[0]===e.target)return;let t=e.target;t=t.closest(bf),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 mw(n){let e=vi(n),t=p.useRef(!1);p.useEffect(()=>(t.current=!1,()=>{t.current=!0,Kf(()=>{t.current&&e()})}),[e])}let pw=p.createContext(!1);function C5(){return p.useContext(pw)}function S1(n){return tn.createElement(pw.Provider,{value:n.force},n.children)}function A5(n){let e=C5(),t=p.useContext(yw),[i,a]=p.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 p.useEffect(()=>{i!==null&&(n!=null&&n.body.contains(i)||n==null||n.body.appendChild(i))},[i,n]),p.useEffect(()=>{e||t!==null&&a(t.current)},[t,a,e]),i}let gw=p.Fragment,N5=Kr(function(n,e){let{ownerDocument:t=null,...i}=n,a=p.useRef(null),l=ra(AC(C=>{a.current=C}),e),u=hy(a.current),h=t??u,f=A5(h),g=p.useContext(Dg),_=Wf(),S=vs();return mw(()=>{var C;f&&f.childNodes.length<=0&&((C=f.parentElement)==null||C.removeChild(f))}),f?gu.createPortal(tn.createElement("div",{"data-headlessui-portal":"",ref:C=>{_.dispose(),g&&C&&_.add(g.register(C))}},S({ourProps:{ref:l},theirProps:i,slot:{},defaultTag:gw,name:"Portal"})),f):null});function D5(n,e){let t=ra(e),{enabled:i=!0,ownerDocument:a,...l}=n,u=vs();return i?tn.createElement(N5,{...l,ownerDocument:a,ref:t}):u({ourProps:{ref:t},theirProps:l,slot:{},defaultTag:gw,name:"Portal"})}let M5=p.Fragment,yw=p.createContext(null);function j5(n,e){let{target:t,...i}=n,a={ref:ra(e)},l=vs();return tn.createElement(yw.Provider,{value:t},l({ourProps:a,theirProps:i,defaultTag:M5,name:"Popover.Group"}))}let Dg=p.createContext(null);function R5(){let n=p.useContext(Dg),e=p.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=p.useMemo(()=>({register:t,unregister:i,portals:e}),[t,i,e]);return[e,p.useMemo(()=>function({children:l}){return tn.createElement(Dg.Provider,{value:a},l)},[a])]}let O5=Kr(D5),bw=Kr(j5),L5=Object.assign(O5,{Group:bw});function I5(n,e=typeof document<"u"?document.defaultView:null,t){let i=vd(n,"escape");fw(e,"keydown",a=>{i&&(a.defaultPrevented||a.key===iw.Escape&&t(a))})}function B5(){var n;let[e]=p.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,i]=p.useState((n=e?.matches)!=null?n:!1);return Vr(()=>{if(!e)return;function a(l){i(l.matches)}return e.addEventListener("change",a),()=>e.removeEventListener("change",a)},[e]),t}function P5({defaultContainers:n=[],portals:e,mainTreeNode:t}={}){let i=vi(()=>{var a,l;let u=yd(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 vw=p.createContext(null);function k1({children:n,node:e}){let[t,i]=p.useState(null),a=xw(e??t);return tn.createElement(vw.Provider,{value:a},n,a===null&&tn.createElement(Cg,{features:yf.Hidden,ref:l=>{var u,h;if(l){for(let f of(h=(u=yd(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 xw(n=null){var e;return(e=p.useContext(vw))!=null?e:n}function F5(){let n=typeof document>"u";return"useSyncExternalStore"in s1?(e=>e.useSyncExternalStore)(s1)(()=>()=>{},()=>!1,()=>!n):!1}function Qf(){let n=F5(),[e,t]=p.useState(ea.isHandoffComplete);return e&&ea.isHandoffComplete===!1&&t(!1),p.useEffect(()=>{e!==!0&&t(!0)},[e]),p.useEffect(()=>ea.handoff(),[]),n?!1:e}function my(){let n=p.useRef(!1);return Vr(()=>(n.current=!0,()=>{n.current=!1}),[]),n}var Vc=(n=>(n[n.Forwards=0]="Forwards",n[n.Backwards=1]="Backwards",n))(Vc||{});function U5(){let n=p.useRef(0);return hw(!0,"keydown",e=>{e.key==="Tab"&&(n.current=e.shiftKey?1:0)},!0),n}function _w(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 z5="div";var sl=(n=>(n[n.None=0]="None",n[n.InitialFocus=1]="InitialFocus",n[n.TabLock=2]="TabLock",n[n.FocusLock=4]="FocusLock",n[n.RestoreFocus=8]="RestoreFocus",n[n.AutoFocus=16]="AutoFocus",n))(sl||{});function H5(n,e){let t=p.useRef(null),i=ra(t,e),{initialFocus:a,initialFocusFallback:l,containers:u,features:h=15,...f}=n;Qf()||(h=0);let g=hy(t.current);G5(h,{ownerDocument:g});let _=K5(h,{ownerDocument:g,container:t,initialFocus:a,initialFocusFallback:l});W5(h,{ownerDocument:g,container:t,containers:u,previousActiveElement:_});let S=U5(),C=vi(Q=>{if(!pl(t.current))return;let H=t.current;(se=>se())(()=>{Ma(S.current,{[Vc.Forwards]:()=>{Qc(H,Ea.First,{skipElements:[Q.relatedTarget,l]})},[Vc.Backwards]:()=>{Qc(H,Ea.Last,{skipElements:[Q.relatedTarget,l]})}})})}),M=vd(!!(h&2),"focus-trap#tab-lock"),L=Wf(),E=p.useRef(!1),B={ref:i,onKeyDown(Q){Q.key=="Tab"&&(E.current=!0,L.requestAnimationFrame(()=>{E.current=!1}))},onBlur(Q){if(!(h&4))return;let H=_w(u);pl(t.current)&&H.add(t.current);let se=Q.relatedTarget;ko(se)&&se.dataset.headlessuiFocusGuard!=="true"&&(ww(H,se)||(E.current?Qc(t.current,Ma(S.current,{[Vc.Forwards]:()=>Ea.Next,[Vc.Backwards]:()=>Ea.Previous})|Ea.WrapAround,{relativeTo:Q.target}):ko(Q.target)&&Na(Q.target)))}},G=vs();return tn.createElement(tn.Fragment,null,M&&tn.createElement(Cg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:yf.Focusable}),G({ourProps:B,theirProps:f,defaultTag:z5,name:"FocusTrap"}),M&&tn.createElement(Cg,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:C,features:yf.Focusable}))}let $5=Kr(H5),q5=Object.assign($5,{features:sl});function V5(n=!0){let e=p.useRef(To.slice());return fy(([t],[i])=>{i===!0&&t===!1&&Kf(()=>{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 G5(n,{ownerDocument:e}){let t=!!(n&8),i=V5(t);fy(()=>{t||mC(e?.body)&&Na(i())},[t]),mw(()=>{t&&Na(i())})}function K5(n,{ownerDocument:e,container:t,initialFocus:i,initialFocusFallback:a}){let l=p.useRef(null),u=vd(!!(n&1),"focus-trap#initial-focus"),h=my();return fy(()=>{if(n===0)return;if(!u){a!=null&&a.current&&Na(a.current);return}let f=t.current;f&&Kf(()=>{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(Qc(f,Ea.First|Ea.AutoFocus)!==Ng.Error)return}else if(Qc(f,Ea.First)!==Ng.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 W5(n,{ownerDocument:e,container:t,containers:i,previousActiveElement:a}){let l=my(),u=!!(n&4);fw(e?.defaultView,"focus",h=>{if(!u||!l.current)return;let f=_w(i);pl(t.current)&&f.add(t.current);let g=a.current;if(!g)return;let _=h.target;pl(_)?ww(f,_)?(a.current=_,Na(_)):(h.preventDefault(),h.stopPropagation(),Na(g)):Na(a.current)},!0)}function ww(n,e){for(let t of n)if(t.contains(e))return!0;return!1}function Tw(n){var e;return!!(n.enter||n.enterFrom||n.enterTo||n.leave||n.leaveFrom||n.leaveTo)||!Xc((e=n.as)!=null?e:kw)||tn.Children.count(n.children)===1}let Zf=p.createContext(null);Zf.displayName="TransitionContext";var X5=(n=>(n.Visible="visible",n.Hidden="hidden",n))(X5||{});function Y5(){let n=p.useContext(Zf);if(n===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return n}function Q5(){let n=p.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}let Jf=p.createContext(null);Jf.displayName="NestingContext";function em(n){return"children"in n?em(n.children):n.current.filter(({el:e})=>e.current!==null).filter(({state:e})=>e==="visible").length>0}function Sw(n,e){let t=xl(n),i=p.useRef([]),a=my(),l=Wf(),u=vi((M,L=So.Hidden)=>{let E=i.current.findIndex(({el:B})=>B===M);E!==-1&&(Ma(L,{[So.Unmount](){i.current.splice(E,1)},[So.Hidden](){i.current[E].state="hidden"}}),l.microTask(()=>{var B;!em(i)&&a.current&&((B=t.current)==null||B.call(t))}))}),h=vi(M=>{let L=i.current.find(({el:E})=>E===M);return L?L.state!=="visible"&&(L.state="visible"):i.current.push({el:M,state:"visible"}),()=>u(M,So.Unmount)}),f=p.useRef([]),g=p.useRef(Promise.resolve()),_=p.useRef({enter:[],leave:[]}),S=vi((M,L,E)=>{f.current.splice(0),e&&(e.chains.current[L]=e.chains.current[L].filter(([B])=>B!==M)),e?.chains.current[L].push([M,new Promise(B=>{f.current.push(B)})]),e?.chains.current[L].push([M,new Promise(B=>{Promise.all(_.current[L].map(([G,Q])=>Q)).then(()=>B())})]),L==="enter"?g.current=g.current.then(()=>e?.wait.current).then(()=>E(L)):E(L)}),C=vi((M,L,E)=>{Promise.all(_.current[L].splice(0).map(([B,G])=>G)).then(()=>{var B;(B=f.current.shift())==null||B()}).then(()=>E(L))});return p.useMemo(()=>({children:i,register:h,unregister:u,onStart:S,onStop:C,wait:g,chains:_}),[h,u,i,S,C,_,g])}let kw=p.Fragment,Ew=gf.RenderStrategy;function Z5(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:M,leaveFrom:L,leaveTo:E,...B}=n,[G,Q]=p.useState(null),H=p.useRef(null),se=Tw(n),Y=ra(...se?[H,e,Q]:e===null?[]:[e]),W=(t=B.unmount)==null||t?So.Unmount:So.Hidden,{show:O,appear:ae,initial:k}=Y5(),[j,Z]=p.useState(O?"visible":"hidden"),V=Q5(),{register:te,unregister:me}=V;Vr(()=>te(H),[te,H]),Vr(()=>{if(W===So.Hidden&&H.current){if(O&&j!=="visible"){Z("visible");return}return Ma(j,{hidden:()=>me(H),visible:()=>te(H)})}},[j,H,te,me,O,W]);let le=Qf();Vr(()=>{if(se&&le&&j==="visible"&&H.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[H,j,le,se]);let q=k&&!ae,F=ae&&O&&k,ee=p.useRef(!1),ie=Sw(()=>{ee.current||(Z("hidden"),me(H))},V),de=vi(Ge=>{ee.current=!0;let Te=Ge?"enter":"leave";ie.onStart(H,Te,Le=>{Le==="enter"?l?.():Le==="leave"&&h?.()})}),I=vi(Ge=>{let Te=Ge?"enter":"leave";ee.current=!1,ie.onStop(H,Te,Le=>{Le==="enter"?u?.():Le==="leave"&&f?.()}),Te==="leave"&&!em(ie)&&(Z("hidden"),me(H))});p.useEffect(()=>{se&&a||(de(O),I(O))},[O,se,a]);let pe=!(!a||!se||!le||q),[,we]=v5(pe,G,O,{start:de,end:I}),ve=nl({ref:Y,className:((i=Eg(B.className,F&&g,F&&_,we.enter&&g,we.enter&&we.closed&&_,we.enter&&!we.closed&&S,we.leave&&M,we.leave&&!we.closed&&L,we.leave&&we.closed&&E,!we.transition&&O&&C))==null?void 0:i.trim())||void 0,...b5(we)}),ge=0;j==="visible"&&(ge|=As.Open),j==="hidden"&&(ge|=As.Closed),O&&j==="hidden"&&(ge|=As.Opening),!O&&j==="visible"&&(ge|=As.Closing);let ht=vs();return tn.createElement(Jf.Provider,{value:ie},tn.createElement(S5,{value:ge},ht({ourProps:ve,theirProps:B,defaultTag:kw,features:Ew,visible:j==="visible",name:"Transition.Child"})))}function J5(n,e){let{show:t,appear:i=!1,unmount:a=!0,...l}=n,u=p.useRef(null),h=Tw(n),f=ra(...h?[u,e]:e===null?[]:[e]);Qf();let g=Yf();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]=p.useState(t?"visible":"hidden"),C=Sw(()=>{t||S("hidden")}),[M,L]=p.useState(!0),E=p.useRef([t]);Vr(()=>{M!==!1&&E.current[E.current.length-1]!==t&&(E.current.push(t),L(!1))},[E,t]);let B=p.useMemo(()=>({show:t,appear:i,initial:M}),[t,i,M]);Vr(()=>{t?S("visible"):!em(C)&&u.current!==null&&S("hidden")},[t,C]);let G={unmount:a},Q=vi(()=>{var Y;M&&L(!1),(Y=n.beforeEnter)==null||Y.call(n)}),H=vi(()=>{var Y;M&&L(!1),(Y=n.beforeLeave)==null||Y.call(n)}),se=vs();return tn.createElement(Jf.Provider,{value:C},tn.createElement(Zf.Provider,{value:B},se({ourProps:{...G,as:p.Fragment,children:tn.createElement(Cw,{ref:f,...G,...l,beforeEnter:Q,beforeLeave:H})},theirProps:{},defaultTag:p.Fragment,features:Ew,visible:_==="visible",name:"Transition"})))}function eA(n,e){let t=p.useContext(Zf)!==null,i=Yf()!==null;return tn.createElement(tn.Fragment,null,!t&&i?tn.createElement(Mg,{ref:e,...n}):tn.createElement(Cw,{ref:e,...n}))}let Mg=Kr(J5),Cw=Kr(Z5),py=Kr(eA),Zc=Object.assign(Mg,{Child:py,Root:Mg});var tA=(n=>(n[n.Open=0]="Open",n[n.Closed=1]="Closed",n))(tA||{}),nA=(n=>(n[n.SetTitleId=0]="SetTitleId",n))(nA||{});let iA={0(n,e){return n.titleId===e.id?n:{...n,titleId:e.id}}},gy=p.createContext(null);gy.displayName="DialogContext";function tm(n){let e=p.useContext(gy);if(e===null){let t=new Error(`<${n} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,tm),t}return e}function rA(n,e){return Ma(e.type,iA,n,e)}let E1=Kr(function(n,e){let t=p.useId(),{id:i=`headlessui-dialog-${t}`,open:a,onClose:l,initialFocus:u,role:h="dialog",autoFocus:f=!0,__demoMode:g=!1,unmount:_=!1,...S}=n,C=p.useRef(!1);h=(function(){return h==="dialog"||h==="alertdialog"?h:(C.current||(C.current=!0,console.warn(`Invalid role [${h}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let M=Yf();a===void 0&&M!==null&&(a=(M&As.Open)===As.Open);let L=p.useRef(null),E=ra(L,e),B=hy(L.current),G=a?0:1,[Q,H]=p.useReducer(rA,{titleId:null,descriptionId:null,panelRef:p.createRef()}),se=vi(()=>l(!1)),Y=vi(we=>H({type:0,id:we})),W=Qf()?G===0:!1,[O,ae]=R5(),k={get current(){var we;return(we=Q.panelRef.current)!=null?we:L.current}},j=xw(),{resolveContainers:Z}=P5({mainTreeNode:j,portals:O,defaultContainers:[k]}),V=M!==null?(M&As.Closing)===As.Closing:!1;XC(g||V?!1:W,{allowed:vi(()=>{var we,ve;return[(ve=(we=L.current)==null?void 0:we.closest("[data-headlessui-portal]"))!=null?ve:null]}),disallowed:vi(()=>{var we;return[(we=j?.closest("body > *:not(#headlessui-portal-root)"))!=null?we:null]})});let te=lw.get(null);Vr(()=>{if(W)return te.actions.push(i),()=>te.actions.pop(i)},[te,i,W]);let me=uw(te,p.useCallback(we=>te.selectors.isTop(we,i),[te,i]));o5(me,Z,we=>{we.preventDefault(),se()}),I5(me,B?.defaultView,we=>{we.preventDefault(),we.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),se()}),m5(g||V?!1:W,B,Z),YC(W,L,se);let[le,q]=NC(),F=p.useMemo(()=>[{dialogState:G,close:se,setTitleId:Y,unmount:_},Q],[G,se,Y,_,Q]),ee=bd({open:G===0}),ie={ref:E,id:i,role:h,tabIndex:-1,"aria-modal":g?void 0:G===0?!0:void 0,"aria-labelledby":Q.titleId,"aria-describedby":le,unmount:_},de=!B5(),I=sl.None;W&&!g&&(I|=sl.RestoreFocus,I|=sl.TabLock,f&&(I|=sl.AutoFocus),de&&(I|=sl.InitialFocus));let pe=vs();return tn.createElement(k5,null,tn.createElement(S1,{force:!0},tn.createElement(L5,null,tn.createElement(gy.Provider,{value:F},tn.createElement(bw,{target:L},tn.createElement(S1,{force:!1},tn.createElement(q,{slot:ee},tn.createElement(ae,null,tn.createElement(q5,{initialFocus:u,initialFocusFallback:L,containers:Z,features:I},tn.createElement(LC,{value:se},pe({ourProps:ie,theirProps:S,slot:ee,defaultTag:sA,features:aA,visible:G===0,name:"Dialog"})))))))))))}),sA="div",aA=gf.RenderStrategy|gf.Static;function oA(n,e){let{transition:t=!1,open:i,...a}=n,l=Yf(),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?tn.createElement(k1,null,tn.createElement(Zc,{show:i,transition:t,unmount:a.unmount},tn.createElement(E1,{ref:e,...a}))):tn.createElement(k1,null,tn.createElement(E1,{ref:e,open:i,...a}))}let lA="div";function uA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-panel-${t}`,transition:a=!1,...l}=n,[{dialogState:u,unmount:h},f]=tm("Dialog.Panel"),g=ra(e,f.panelRef),_=bd({open:u===0}),S=vi(B=>{B.stopPropagation()}),C={ref:g,id:i,onClick:S},M=a?py:p.Fragment,L=a?{unmount:h}:{},E=vs();return tn.createElement(M,{...L},E({ourProps:C,theirProps:l,slot:_,defaultTag:lA,name:"Dialog.Panel"}))}let cA="div";function dA(n,e){let{transition:t=!1,...i}=n,[{dialogState:a,unmount:l}]=tm("Dialog.Backdrop"),u=bd({open:a===0}),h={ref:e,"aria-hidden":!0},f=t?py:p.Fragment,g=t?{unmount:l}:{},_=vs();return tn.createElement(f,{...g},_({ourProps:h,theirProps:i,slot:u,defaultTag:cA,name:"Dialog.Backdrop"}))}let hA="h2";function fA(n,e){let t=p.useId(),{id:i=`headlessui-dialog-title-${t}`,...a}=n,[{dialogState:l,setTitleId:u}]=tm("Dialog.Title"),h=ra(e);p.useEffect(()=>(u(i),()=>u(null)),[i,u]);let f=bd({open:l===0}),g={ref:h,id:i};return vs()({ourProps:g,theirProps:a,slot:f,defaultTag:hA,name:"Dialog.Title"})}let mA=Kr(oA),pA=Kr(uA);Kr(dA);let gA=Kr(fA),su=Object.assign(mA,{Panel:pA,Title:gA,Description:RC});function yA({open:n,onClose:e,onApply:t,initialCookies:i}){const[a,l]=p.useState(""),[u,h]=p.useState(""),[f,g]=p.useState([]),_=p.useRef(!1);p.useEffect(()=>{n&&!_.current&&(l(""),h(""),g(i??[])),_.current=n},[n,i]);function S(){const L=a.trim(),E=u.trim();!L||!E||(g(B=>[...B.filter(Q=>Q.name!==L),{name:L,value:E}]),l(""),h(""))}function C(L){g(E=>E.filter(B=>B.name!==L))}function M(){t(f),e()}return c.jsxs(su,{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(su.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(su.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:L=>l(L.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:L=>h(L.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(L=>c.jsxs("tr",{children:[c.jsx("td",{className:"px-3 py-2 font-mono",children:L.name}),c.jsx("td",{className:"px-3 py-2 truncate max-w-[240px]",children:L.value}),c.jsx("td",{className:"px-3 py-2 text-right",children:c.jsx("button",{onClick:()=>C(L.name),className:"text-xs text-red-600 hover:underline dark:text-red-400",children:"Entfernen"})})]},L.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:M,children:"Übernehmen"})]})]})})]})}function bA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const vA=p.forwardRef(bA);function jg({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=rn("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=>rn(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,M)=>M.count===void 0?null:c.jsx("span",{className:g(C),children:M.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 M=C.id===h.id,L=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!L&&t(C.id),disabled:L,"aria-current":M?"page":void 0,className:rn(M?"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",L&&"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:rn(M?"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}),_(M,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",M=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(L=>{const E=L.id===h.id,B=!!L.disabled;return c.jsxs("button",{type:"button",onClick:()=>!B&&t(L.id),disabled:B,"aria-current":E?"page":void 0,className:rn(E?C:M,"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:L.label}),L.count!==void 0?c.jsx("span",{className:rn(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:L.count}):null]},L.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 M=C.id===h.id,L=!!C.disabled;return c.jsx("button",{type:"button",onClick:()=>!L&&t(C.id),disabled:L,"aria-current":M?"page":void 0,className:rn(M?"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",L&&"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,M)=>{const L=C.id===h.id,E=!!C.disabled;return c.jsxs("button",{type:"button",onClick:()=>!E&&t(C.id),disabled:E,"aria-current":L?"page":void 0,className:rn(L?"text-gray-900 dark:text-white":"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-white",M===0?"rounded-l-lg":"",M===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:rn(L?"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 M=C.id===h.id,L=!!C.disabled;return c.jsx("li",{children:c.jsx("button",{type:"button",onClick:()=>!L&&t(C.id),disabled:L,"aria-current":M?"page":void 0,className:rn(M?"text-indigo-600 dark:text-indigo-400":"hover:text-gray-700 dark:hover:text-white",L&&"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(vA,{"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:rn("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:rn("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:rn("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 Rg({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=L=>{a||e(L.target.checked)},M=rn("absolute inset-0 size-full appearance-none focus:outline-hidden",a&&"cursor-not-allowed");return g==="short"?c.jsxs("div",{className:rn("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:rn("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:rn("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:M})]}):c.jsxs("div",{className:rn("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:rn("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:rn("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:rn("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:rn("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:M})]})}function Sa({label:n,description:e,labelPosition:t="left",id:i,className:a,...l}){const u=p.useId(),h=i??`sw-${u}`,f=`${h}-label`,g=`${h}-desc`;return t==="right"?c.jsxs("div",{className:rn("flex items-center justify-between gap-3",a),children:[c.jsx(Rg,{...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:rn("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(Rg,{...l,id:h,ariaLabelledby:f,ariaDescribedby:e?g:void 0})]})}const yu=new Map;let C1=!1;function xA(){C1||(C1=!0,document.addEventListener("visibilitychange",()=>{if(document.hidden)for(const n of yu.values())n.es&&(n.es.close(),n.es=null,n.dispatchers.clear());else for(const n of yu.values())n.refs>0&&!n.es&&Aw(n)}))}function Aw(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 _A(n){n.es&&(n.es.close(),n.es=null,n.dispatchers.clear())}function wA(n){let e=yu.get(n);return e||(e={url:n,es:null,refs:0,listeners:new Map,dispatchers:new Map},yu.set(n,e)),e}function nm(n,e,t){xA();const i=wA(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 Aw(i);return()=>{const l=yu.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&&(_A(l),yu.delete(n))}}async function TA(n,e){const t=await fetch(n,{cache:"no-store",...e,headers:{"Content-Type":"application/json",...e?.headers||{}}});let i=null;try{i=await t.json()}catch{}if(!t.ok){const a=i&&(i.error||i.message)||t.statusText;throw new Error(a)}return i}function A1({startUrl:n,stopUrl:e,sseUrl:t,onTrigger:i,title:a="Task",description:l="Startet eine Hintergrundaufgabe. Fortschritt & Abbrechen oben in der Taskliste.",startLabel:u="Start",startingLabel:h="Starte…",disabled:f=!1,busy:g=!1,onFinished:_,onStart:S,onProgress:C,onDone:M,onCancelled:L,onError:E}){const[B,G]=p.useState(null),[Q,H]=p.useState(!1),[se,Y]=p.useState(null),W=p.useRef(null),O=p.useRef(!1),ae=p.useRef(!1),k=p.useRef(!1),j=p.useRef(!1),Z=p.useRef(""),V=p.useRef(C),te=p.useRef(E);p.useEffect(()=>{V.current=C},[C]),p.useEffect(()=>{te.current=E},[E]);async function me(){if(e&&!k.current){k.current=!0;try{await fetch(e,{method:"DELETE",cache:"no-store"})}catch{}finally{k.current=!1}}}function le(){if(W.current)return W.current;const ie=new AbortController;W.current=ie;const de=()=>{ae.current=!0,me()};return ie.signal.addEventListener("abort",de,{once:!0}),ie}function q(ie){O.current||(O.current=!0,S?.(ie))}p.useEffect(()=>{const ie=j.current,de=!!B?.running;if(j.current=de,ie&&!de){const I=String(B?.error??"").trim();W.current=null,O.current=!1,ae.current||I==="abgebrochen"?(ae.current=!1,L?.()):I||M?.(),_?.()}},[B?.running,B?.error,_,M,L]),p.useEffect(()=>{if(!t)return;const ie=nm(t,"state",de=>{if(G(de),de?.running){const pe=le();q(pe),V.current?.({done:de?.done??0,total:de?.total??0,currentFile:de?.currentFile??""})}const I=String(de?.error??"").trim();I&&I!=="abgebrochen"&&I!==Z.current&&(Z.current=I,te.current?.(I))});return()=>ie()},[t]);async function F(){if(g||B?.running)return;if(Y(null),H(!0),ae.current=!1,Z.current="",i){try{await i()}catch(de){const I=de?.message??String(de);Y(I),E?.(I)}finally{H(!1)}return}if(!n){const de="Task ist nicht konfiguriert (startUrl fehlt).";Y(de),E?.(de),H(!1);return}const ie=le();try{const de=await TA(n,{method:"POST"});G(de),q(ie),de?.running&&C?.({done:de?.done??0,total:de?.total??0,currentFile:de?.currentFile??""})}catch(de){W.current=null,O.current=!1;const I=de?.message??String(de);Y(I),E?.(I)}finally{H(!1)}}const ee=!!B?.running;return c.jsxs("div",{className:"flex items-center justify-between gap-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:a}),c.jsx("div",{className:"mt-0.5 text-xs text-gray-600 dark:text-gray-300",children:l}),se?c.jsx("div",{className:"mt-2 text-xs text-red-700 dark:text-red-200",children:se}):null]}),c.jsx("div",{className:"shrink-0",children:c.jsx(en,{variant:"primary",onClick:F,disabled:f||g||Q||ee,children:Q||g?h:u})})]})}function SA(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 kA({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=SA(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 EA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}const CA=p.forwardRef(EA);function AA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"}))}const N1=p.forwardRef(AA);function NA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 DA=p.forwardRef(NA);function MA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 Vh=p.forwardRef(MA);function jA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 RA=p.forwardRef(jA);function OA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 LA=p.forwardRef(OA);function IA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 3.75V16.5L12 14.25 7.5 16.5V3.75m9 0H18A2.25 2.25 0 0 1 20.25 6v12A2.25 2.25 0 0 1 18 20.25H6A2.25 2.25 0 0 1 3.75 18V6A2.25 2.25 0 0 1 6 3.75h1.5m9 0h-9"}))}const D1=p.forwardRef(IA);function BA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 E0=p.forwardRef(BA);function PA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const FA=p.forwardRef(PA);function UA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const zA=p.forwardRef(UA);function HA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 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=p.forwardRef(HA);function qA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 VA=p.forwardRef(qA);function GA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const vf=p.forwardRef(GA);function KA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.362 5.214A8.252 8.252 0 0 1 12 21 8.25 8.25 0 0 1 6.038 7.047 8.287 8.287 0 0 0 9 9.601a8.983 8.983 0 0 1 3.361-6.867 8.21 8.21 0 0 0 3 2.48Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18a3.75 3.75 0 0 0 .495-7.468 5.99 5.99 0 0 0-1.925 3.547 5.975 5.975 0 0 1-2.133-1.001A3.75 3.75 0 0 0 12 18Z"}))}const M1=p.forwardRef(KA);function WA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"}))}const Jc=p.forwardRef(WA);function XA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 YA=p.forwardRef(XA);function QA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 ZA=p.forwardRef(QA);function JA({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 eN=p.forwardRef(JA);function tN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 nN=p.forwardRef(tN);function iN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}const j1=p.forwardRef(iN);function rN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const sN=p.forwardRef(rN);function aN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 oN=p.forwardRef(aN);function lN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6.878V6a2.25 2.25 0 0 1 2.25-2.25h7.5A2.25 2.25 0 0 1 18 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 0 0 4.5 9v.878m13.5-3A2.25 2.25 0 0 1 19.5 9v.878m0 0a2.246 2.246 0 0 0-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0 1 21 12v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6c0-.98.626-1.813 1.5-2.122"}))}const uN=p.forwardRef(lN);function cN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"}))}const C0=p.forwardRef(cN);function dN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 hN=p.forwardRef(dN);function fN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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 xf=p.forwardRef(fN);function mN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.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=p.forwardRef(mN);function gN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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=p.forwardRef(gN);function yN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"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=p.forwardRef(yN);function bN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const vN=p.forwardRef(bN);function xN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const _f=p.forwardRef(xN);function pr(...n){return n.filter(Boolean).join(" ")}function wf({open:n,onClose:e,title:t,titleRight:i,children:a,footer:l,icon:u,width:h="max-w-lg",layout:f="single",left:g,leftWidthClass:_="lg:w-80",scroll:S,bodyClassName:C,leftClassName:M,rightClassName:L,rightHeader:E,rightBodyClassName:B,mobileCollapsedImageSrc:G,mobileCollapsedImageAlt:Q}){const H=S??(f==="split"?"right":"body"),se=p.useRef(null),[Y,W]=p.useState(!1);return p.useEffect(()=>{if(!n)return;const O=document.documentElement,ae=document.body,k=O.style.overflow,j=ae.style.overflow,Z=ae.style.paddingRight,V=window.innerWidth-O.clientWidth;return O.style.overflow="hidden",ae.style.overflow="hidden",V>0&&(ae.style.paddingRight=`${V}px`),()=>{O.style.overflow=k,ae.style.overflow=j,ae.style.paddingRight=Z}},[n]),p.useEffect(()=>{n&&W(!1)},[n]),p.useEffect(()=>{if(!n)return;const O=se.current;if(!O)return;const ae=72,k=()=>{const j=O.scrollTop||0;W(Z=>{const V=j>ae;return Z===V?Z:V})};return k(),O.addEventListener("scroll",k,{passive:!0}),()=>O.removeEventListener("scroll",k)},[n]),c.jsx(Zc,{show:n,as:p.Fragment,children:c.jsxs(su,{open:n,as:"div",className:"relative z-50",onClose:e,children:[c.jsx(Zc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:c.jsx("div",{className:"fixed inset-0 bg-gray-500/75 dark:bg-gray-900/50"})}),c.jsx("div",{className:"fixed inset-0 z-50 overflow-hidden px-4 py-6 sm:px-6",children:c.jsx("div",{className:"min-h-full flex items-start justify-center sm:items-center",children:c.jsx(Zc.Child,{as:p.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",enterTo:"opacity-100 translate-y-0 sm:scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 translate-y-0 sm:scale-100",leaveTo:"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",children:c.jsxs(su.Panel,{className:pr("relative w-full rounded-lg bg-white text-left shadow-xl transition-all","max-h-[calc(100vh-3rem)] sm:max-h-[calc(100vh-4rem)]","flex flex-col min-h-0","dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",h),children:[u?c.jsx("div",{className:"mx-auto mb-4 mt-6 flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-500/10",children:u}):null,c.jsxs("div",{className:pr("shrink-0 px-4 pt-4 sm:px-6 sm:pt-6 items-start justify-between gap-3",f==="split"?"hidden lg:flex":"flex"),children:[c.jsx("div",{className:"min-w-0 flex-1",children:t?c.jsx(su.Title,{className:"hidden sm:block text-base font-semibold text-gray-900 dark:text-white truncate",children:t}):null}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[i?c.jsx("div",{className:"hidden sm:block",children:i}):null,c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(_f,{className:"size-5"})})]})]}),f==="single"?c.jsx("div",{className:pr("flex-1 min-h-0 h-full",H==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden",L),children:a}):c.jsxs("div",{className:pr("px-2 pb-4 pt-3 sm:px-4 sm:pb-6 sm:pt-4","flex-1 min-h-0","overflow-hidden","flex flex-col",C),children:[c.jsxs("div",{ref:se,className:pr("lg:hidden flex-1 min-h-0 relative",H==="right"||H==="body"?"overflow-y-auto overscroll-contain":"overflow-hidden"),children:[c.jsxs("div",{className:pr("sticky top-0 z-50","bg-white/95 backdrop-blur dark:bg-gray-800/95","border-b border-gray-200/70 dark:border-white/10"),children:[c.jsxs("div",{className:pr("flex items-center justify-between gap-3 px-3",Y?"py-2":"py-3"),children:[c.jsxs("div",{className:"min-w-0 flex items-center gap-2 flex-1",children:[G?c.jsx("img",{src:G,alt:Q||t||"",className:pr("shrink-0 rounded-lg object-cover ring-1 ring-black/5 dark:ring-white/10",Y?"size-8":"size-10"),loading:"lazy",decoding:"async"}):null,c.jsx("div",{className:"min-w-0 flex-1",children:t?c.jsx("div",{className:pr("truncate font-semibold text-gray-900 dark:text-white",Y?"text-sm":"text-base"),children:t}):null})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[i?c.jsx("div",{children:i}):null,c.jsx("button",{type:"button",onClick:e,className:pr("inline-flex shrink-0 items-center justify-center rounded-lg p-1.5","text-gray-500 hover:text-gray-900 hover:bg-black/5","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600","dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10 dark:focus-visible:outline-indigo-500"),"aria-label":"Schließen",title:"Schließen",children:c.jsx(_f,{className:"size-5"})})]})]}),E?c.jsx("div",{children:E}):null]}),g?c.jsx("div",{className:pr("lg:hidden px-2 pb-2",M),children:g}):null,c.jsx("div",{className:pr("px-2 pt-0 min-h-0",L),children:c.jsx("div",{className:pr("min-h-0",B),children:a})})]}),c.jsxs("div",{className:"hidden lg:flex flex-1 min-h-0 gap-3",children:[c.jsx("div",{className:pr("min-h-0",_,"shrink-0","overflow-hidden",M),children:g}),c.jsxs("div",{className:pr("flex-1 min-h-0 flex flex-col",L),children:[E?c.jsx("div",{className:"shrink-0",children:E}):null,c.jsx("div",{className:pr("flex-1 min-h-0",H==="right"?"overflow-y-auto overscroll-contain":"overflow-hidden",B),children:a})]})]})]}),l?c.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-gray-200/70 dark:border-white/10 flex justify-end gap-3",children:l}):null]})})})})]})})}function Nw(n,e){const t=Number(n);return Number.isFinite(t)&&t>0?Math.floor(t):e}function _N(n){const e=(n.user||"").trim()||"postgres",t=(n.host||"").trim()||"127.0.0.1",i=Nw(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 wN({open:n,onClose:e,initialUrl:t,initialHasPassword:i,onApply:a}){const[l,u]=p.useState("127.0.0.1"),[h,f]=p.useState(5432),[g,_]=p.useState("nsfwapp"),[S,C]=p.useState("postgres"),[M,L]=p.useState(""),[E,B]=p.useState("disable"),G=p.useMemo(()=>_N({user:S,host:l,port:h,db:g,sslmode:E}),[S,l,h,g,E]),Q=c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"secondary",onClick:e,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:()=>{a({databaseUrl:G,dbPassword:M}),e()},children:"Übernehmen"})]});return c.jsx(wf,{open:n,onClose:e,title:"Postgres URL erstellen",width:"max-w-2xl",footer:Q,children:c.jsxs("div",{className:"px-4 pb-4 sm:px-6 sm:pb-6 space-y-4",children:[c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:["Passwort wird ",c.jsx("span",{className:"font-semibold",children:"verschlüsselt"})," gespeichert (nicht in der URL).",t?c.jsx(c.Fragment,{children:c.jsxs("div",{className:"mt-1",children:["Aktuelle URL: ",c.jsx("code",{className:"break-all",children:t})]})}):null,i?c.jsx("div",{className:"mt-1",children:"Passwort: ✅ gespeichert"}):null]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Host"}),c.jsx("input",{value:l,onChange:H=>u(H.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"127.0.0.1"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Port"}),c.jsx("input",{type:"number",min:1,max:65535,value:h,onChange:H=>f(Nw(H.target.value,5432)),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Datenbank"}),c.jsx("input",{value:g,onChange:H=>_(H.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"nsfwapp"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"User"}),c.jsx("input",{value:S,onChange:H=>C(H.target.value),className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"postgres"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"Passwort"}),c.jsx("input",{value:M,onChange:H=>L(H.target.value),type:"password",className:`sm:col-span-9 rounded-lg px-3 py-2 text-sm bg-white text-gray-900 ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10`,placeholder:"••••••••"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-12 sm:items-center",children:[c.jsx("label",{className:"text-sm font-medium text-gray-900 dark:text-gray-200 sm:col-span-3",children:"SSL"}),c.jsxs("select",{value:E,onChange:H=>B(H.target.value),className:`sm:col-span-9 h-10 rounded-lg px-3 text-sm bg-white text-gray-900 ring-1 ring-gray-200 shadow-sm\r
|
||
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]`,children:[c.jsx("option",{value:"disable",children:"disable"}),c.jsx("option",{value:"require",children:"require"}),c.jsx("option",{value:"verify-full",children:"verify-full"})]})]}),c.jsxs("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 text-xs text-gray-700 dark:border-white/10 dark:bg-white/5 dark:text-gray-200",children:[c.jsx("div",{className:"font-semibold mb-1",children:"Vorschau"}),c.jsx("code",{className:"break-all",children:G})]})]})})}function TN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 0 1 .208 1.04l-9 13.5a.75.75 0 0 1-1.154.114l-6-6a.75.75 0 0 1 1.06-1.06l5.353 5.353 8.493-12.74a.75.75 0 0 1 1.04-.207Z",clipRule:"evenodd"}))}const Dw=p.forwardRef(TN);function SN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),p.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const gl=p.forwardRef(SN);function kN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M12.963 2.286a.75.75 0 0 0-1.071-.136 9.742 9.742 0 0 0-3.539 6.176 7.547 7.547 0 0 1-1.705-1.715.75.75 0 0 0-1.152-.082A9 9 0 1 0 15.68 4.534a7.46 7.46 0 0 1-2.717-2.248ZM15.75 14.25a3.75 3.75 0 1 1-7.313-1.172c.628.465 1.35.81 2.133 1a5.99 5.99 0 0 1 1.925-3.546 3.75 3.75 0 0 1 3.255 3.718Z",clipRule:"evenodd"}))}const Og=p.forwardRef(kN);function EN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{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 CN=p.forwardRef(EN);function AN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"m11.645 20.91-.007-.003-.022-.012a15.247 15.247 0 0 1-.383-.218 25.18 25.18 0 0 1-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0 1 12 5.052 5.5 5.5 0 0 1 16.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 0 1-4.244 3.17 15.247 15.247 0 0 1-.383.219l-.022.012-.007.004-.003.001a.752.752 0 0 1-.704 0l-.003-.001Z"}))}const yl=p.forwardRef(AN);function NN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{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 DN=p.forwardRef(NN);function MN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{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 jN=p.forwardRef(MN);function RN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.636 4.575a.75.75 0 0 1 0 1.061 9 9 0 0 0 0 12.728.75.75 0 1 1-1.06 1.06c-4.101-4.1-4.101-10.748 0-14.849a.75.75 0 0 1 1.06 0Zm12.728 0a.75.75 0 0 1 1.06 0c4.101 4.1 4.101 10.75 0 14.85a.75.75 0 1 1-1.06-1.061 9 9 0 0 0 0-12.728.75.75 0 0 1 0-1.06ZM7.757 6.697a.75.75 0 0 1 0 1.06 6 6 0 0 0 0 8.486.75.75 0 0 1-1.06 1.06 7.5 7.5 0 0 1 0-10.606.75.75 0 0 1 1.06 0Zm8.486 0a.75.75 0 0 1 1.06 0 7.5 7.5 0 0 1 0 10.606.75.75 0 0 1-1.06-1.06 6 6 0 0 0 0-8.486.75.75 0 0 1 0-1.06ZM9.879 8.818a.75.75 0 0 1 0 1.06 3 3 0 0 0 0 4.243.75.75 0 1 1-1.061 1.061 4.5 4.5 0 0 1 0-6.364.75.75 0 0 1 1.06 0Zm4.242 0a.75.75 0 0 1 1.061 0 4.5 4.5 0 0 1 0 6.364.75.75 0 0 1-1.06-1.06 3 3 0 0 0 0-4.243.75.75 0 0 1 0-1.061ZM10.875 12a1.125 1.125 0 1 1 2.25 0 1.125 1.125 0 0 1-2.25 0Z",clipRule:"evenodd"}))}const ON=p.forwardRef(RN);function LN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.006 5.404.434c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.434 2.082-5.005Z",clipRule:"evenodd"}))}const bu=p.forwardRef(LN);function IN({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.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 BN=p.forwardRef(IN),Yi={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 PN(n,e=52){const t=String(n??"").trim();return t?t.length<=e?t:"…"+t.slice(-(e-1)):""}function FN({onAssetsGenerated:n}){const[e,t]=p.useState(Yi),[i,a]=p.useState(!1),[l,u]=p.useState(0),h=p.useRef(null),[f,g]=p.useState(!1),[_,S]=p.useState(null),[C,M]=p.useState(null),[L,E]=p.useState(null),[B,G]=p.useState(null),Q=p.useRef(null),[H,se]=p.useState(!1),[Y,W]=p.useState(""),O=Date.now(),ae=l>O,j=i?"saving":ae?"success":!!L&&!i&&!ae?"error":"idle",Z=j==="saving"?{text:"Speichern…",color:"blue",icon:null,isLoading:!0}:j==="success"?{text:"Gespeichert",color:"emerald",icon:c.jsx(Dw,{className:"size-4"}),isLoading:!1}:j==="error"?{text:"Fehler",color:"red",icon:c.jsx(BN,{className:"size-4"}),isLoading:!1}:{text:"Speichern",color:"indigo",icon:null,isLoading:!1},[V,te]=p.useState({id:"generate-assets",status:"idle",title:"Assets generieren",text:"",cancellable:!0,fading:!1}),[me,le]=p.useState({id:"cleanup",status:"idle",title:"Aufräumen",text:"",cancellable:!1,fading:!1}),q=Number(e.lowDiskPauseBelowGB??Yi.lowDiskPauseBelowGB??5),F=B?.pauseGB??q,ee=B?.resumeGB??q+3;p.useEffect(()=>()=>{h.current!=null&&(window.clearTimeout(h.current),h.current=null)},[]),p.useEffect(()=>{let ve=!0;return fetch("/api/settings",{cache:"no-store"}).then(async ge=>{if(!ge.ok)throw new Error(await ge.text());return ge.json()}).then(ge=>{ve&&t({databaseUrl:String(ge.databaseUrl??""),hasDbPassword:!!(ge.hasDbPassword??!1),recordDir:(ge.recordDir||Yi.recordDir).toString(),doneDir:(ge.doneDir||Yi.doneDir).toString(),ffmpegPath:String(ge.ffmpegPath??Yi.ffmpegPath??""),autoAddToDownloadList:ge.autoAddToDownloadList??Yi.autoAddToDownloadList,autoStartAddedDownloads:ge.autoStartAddedDownloads??Yi.autoStartAddedDownloads,useChaturbateApi:ge.useChaturbateApi??Yi.useChaturbateApi,useMyFreeCamsWatcher:ge.useMyFreeCamsWatcher??Yi.useMyFreeCamsWatcher,autoDeleteSmallDownloads:ge.autoDeleteSmallDownloads??Yi.autoDeleteSmallDownloads,autoDeleteSmallDownloadsBelowMB:ge.autoDeleteSmallDownloadsBelowMB??Yi.autoDeleteSmallDownloadsBelowMB,blurPreviews:ge.blurPreviews??Yi.blurPreviews,teaserPlayback:ge.teaserPlayback??Yi.teaserPlayback,teaserAudio:ge.teaserAudio??Yi.teaserAudio,lowDiskPauseBelowGB:ge.lowDiskPauseBelowGB??Yi.lowDiskPauseBelowGB,enableNotifications:ge.enableNotifications??Yi.enableNotifications})}).catch(()=>{}),()=>{ve=!1}},[]),p.useEffect(()=>{let ve=!0;const ge=async()=>{try{const Ge=await fetch("/api/status/disk",{cache:"no-store"});if(!Ge.ok)return;const Te=await Ge.json();ve&&G(Te)}catch{}};ge();const ht=window.setInterval(ge,5e3);return()=>{ve=!1,window.clearInterval(ht)}},[]);async function ie(ve){E(null),M(null),S(ve);try{window.focus();const ge=await fetch(`/api/settings/browse?target=${ve}`,{cache:"no-store"});if(ge.status===204)return;if(!ge.ok){const Te=await ge.text().catch(()=>"");throw new Error(Te||`HTTP ${ge.status}`)}const Ge=((await ge.json()).path??"").trim();if(!Ge)return;t(Te=>ve==="record"?{...Te,recordDir:Ge}:ve==="done"?{...Te,doneDir:Ge}:{...Te,ffmpegPath:Ge})}catch(ge){E(ge?.message??String(ge))}finally{S(null)}}async function de(){E(null),M(null);const ve=e.recordDir.trim(),ge=e.doneDir.trim(),ht=(e.ffmpegPath??"").trim(),Ge=String(e.databaseUrl??"").trim();if(!ve||!ge){E("Bitte Aufnahme-Ordner und Ziel-Ordner angeben.");return}const Te=!!e.autoAddToDownloadList,Le=Te?!!e.autoStartAddedDownloads:!1,ut=!!e.useChaturbateApi,Oe=!!e.useMyFreeCamsWatcher,_e=!!e.autoDeleteSmallDownloads,Ke=Math.max(0,Math.min(1e5,Math.floor(Number(e.autoDeleteSmallDownloadsBelowMB??Yi.autoDeleteSmallDownloadsBelowMB)))),Je=!!e.blurPreviews,bt=e.teaserPlayback==="still"||e.teaserPlayback==="all"||e.teaserPlayback==="hover"?e.teaserPlayback:Yi.teaserPlayback,ft=!!e.teaserAudio,kt=Math.max(1,Math.floor(Number(e.lowDiskPauseBelowGB??Yi.lowDiskPauseBelowGB))),Pe=!!e.enableNotifications;a(!0);try{const Xe=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({databaseUrl:Ge,dbPassword:Y||void 0,recordDir:ve,doneDir:ge,ffmpegPath:ht,autoAddToDownloadList:Te,autoStartAddedDownloads:Le,useChaturbateApi:ut,useMyFreeCamsWatcher:Oe,autoDeleteSmallDownloads:_e,autoDeleteSmallDownloadsBelowMB:Ke,blurPreviews:Je,teaserPlayback:bt,teaserAudio:ft,lowDiskPauseBelowGB:kt,enableNotifications:Pe})});if(!Xe.ok){const Ze=await Xe.text().catch(()=>"");throw new Error(Ze||`HTTP ${Xe.status}`)}M("✅ Gespeichert.");const st=Date.now()+2500;u(st),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(Xe){u(0),h.current!=null&&(window.clearTimeout(h.current),h.current=null),E(Xe?.message??String(Xe))}finally{a(!1)}}function I(ve,ge=3500,ht=500){window.setTimeout(()=>{ve(Ge=>({...Ge,fading:!0})),window.setTimeout(()=>{ve(Ge=>({...Ge,status:"idle",text:"",err:void 0,done:0,total:0,fading:!1}))},ht)},ge)}async function pe(){E(null),M(null);const ve=Number(e.autoDeleteSmallDownloadsBelowMB??Yi.autoDeleteSmallDownloadsBelowMB??0),ge=(e.doneDir||Yi.doneDir).trim();if(!ge){E("doneDir ist leer.");return}if(!ve||ve<=0){E("Mindestgröße ist 0 – es würde nichts gelöscht.");return}if(window.confirm(`Aufräumen:
|
||
• Löscht Dateien in "${ge}" < ${ve} MB (Ordner "keep" wird übersprungen)
|
||
• Entfernt verwaiste Previews/Thumbs/Generated-Assets ohne passende Datei
|
||
|
||
Fortfahren?`)){g(!0),le(Ge=>({...Ge,status:"running",title:"Aufräumen",text:"Räume auf…",err:void 0,done:0,total:1,fading:!1}));try{const Ge=await fetch("/api/settings/cleanup",{method:"POST",headers:{"Content-Type":"application/json"},cache:"no-store"});if(!Ge.ok){const Ke=await Ge.text().catch(()=>"");throw new Error(Ke||`HTTP ${Ge.status}`)}const Te=await Ge.json(),Le=Number(Te.scannedFiles??0),ut=Number(Te.orphanIdsRemoved??0),Oe=Number(Te.generatedOrphansRemoved??0),_e=ut+Oe;le(Ke=>({...Ke,status:"done",done:1,total:1,title:"Aufräumen",text:`geprüft: ${Le} · Orphans: ${_e}`})),I(le)}catch(Ge){const Te=Ge?.message??String(Ge);E(Te),le(Le=>({...Le,status:"error",text:"Fehler beim Aufräumen.",err:Te})),I(le)}finally{g(!1)}}}async function we(){const ve=Q.current;if(Q.current=null,te(ge=>({...ge,status:"cancelled",text:"Abgebrochen."})),ve){ve.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:L?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:L}):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:Z.color,onClick:de,disabled:i,className:"shrink-0",size:"md",isLoading:Z.isLoading,leadingIcon:Z.icon,children:Z.text})]})]}),grayBody:!0,children:c.jsxs("div",{className:"space-y-4",children:[c.jsx(kA,{tasks:[V,me],onCancel:ve=>{ve==="generate-assets"&&we()}}),j!=="success"?c.jsxs("div",{className:"sm:hidden",children:[L&&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:L}),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",sseUrl:"/api/tasks/assets/stream",onFinished:n,onStart:ve=>{Q.current=ve,te(ge=>({...ge,status:"running",title:"Assets generieren",text:"",done:0,total:0,err:void 0,fading:!1}))},onProgress:ve=>{const ge=PN(ve.currentFile);te(ht=>({...ht,status:"running",title:"Assets generieren",text:ge||"",done:ve.done,total:ve.total}))},onDone:()=>{Q.current=null,te(ve=>({...ve,status:"done",title:"Assets generieren"})),I(te)},onCancelled:()=>{Q.current=null,te(ve=>({...ve,status:"cancelled",title:"Assets generieren",text:"Abgebrochen."})),I(te)},onError:ve=>{Q.current=null,te(ge=>({...ge,status:"error",title:"Assets generieren",text:"Fehler beim Generieren.",err:ve})),I(te)}}),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:ve=>{E(ve)}})]})]}),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:ve=>t(ge=>({...ge,databaseUrl:ve.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(wN,{open:H,onClose:()=>se(!1),initialUrl:String(e.databaseUrl??""),initialHasPassword:!!e.hasDbPassword,onApply:({databaseUrl:ve,dbPassword:ge})=>{t(ht=>({...ht,databaseUrl:ve})),W(ge||"")}}),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:ve=>t(ge=>({...ge,recordDir:ve.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:()=>ie("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:ve=>t(ge=>({...ge,doneDir:ve.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:()=>ie("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:ve=>t(ge=>({...ge,ffmpegPath:ve.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:()=>ie("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:ve=>t(ge=>({...ge,autoAddToDownloadList:ve,autoStartAddedDownloads:ve?ge.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:ve=>t(ge=>({...ge,autoStartAddedDownloads:ve})),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:ve=>t(ge=>({...ge,useChaturbateApi:ve})),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:ve=>t(ge=>({...ge,useMyFreeCamsWatcher:ve})),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:ve=>t(ge=>({...ge,autoDeleteSmallDownloads:ve,autoDeleteSmallDownloadsBelowMB:ge.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:ve=>t(ge=>({...ge,autoDeleteSmallDownloadsBelowMB:Number(ve.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:ve=>t(ge=>({...ge,blurPreviews:ve})),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:ve=>t(ge=>({...ge,teaserPlayback:ve.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:ve=>t(ge=>({...ge,teaserAudio:ve})),label:"Teaser mit Ton",description:"Wenn aktiv, werden Vorschau/Teaser nicht stumm geschaltet."}),c.jsx(Sa,{checked:!!e.enableNotifications,onChange:ve=>t(ge=>({...ge,enableNotifications:ve})),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:F})," GB"," · ","Resume ab"," ",c.jsx("span",{className:"tabular-nums",children:ee})," ","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 A0(...n){return n.filter(Boolean).join(" ")}const UN={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 Lg({items:n,value:e,onChange:t,size:i="md",className:a,ariaLabel:l="Optionen"}){const u=UN[i];return c.jsx("span",{className:A0("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:A0("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:A0("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 zN(...n){return n.filter(Boolean).join(" ")}function HN(){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=p.forwardRef(function({children:e,enabled:t=!0,disabled:i=!1,onTap:a,onSwipeLeft:l,onSwipeRight:u,className:h,thresholdPx:f=140,thresholdRatio:g=.28,ignoreFromBottomPx:_=72,ignoreSelector:S="[data-swipe-ignore]",snapMs:C=180,commitMs:M=180,tapIgnoreSelector:L="button,a,input,textarea,select,video[controls],video[controls] *,[data-tap-ignore]",onDoubleTap:E,hotTargetSelector:B="[data-hot-target]",doubleTapMs:G=360,doubleTapMaxMovePx:Q=48},H){const se=p.useRef(null),Y=p.useRef(!1),W=p.useRef(0),O=p.useRef(null),ae=p.useRef(0),k=p.useRef(null),j=p.useRef(null),Z=p.useRef(null),V=p.useRef({id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1}),[te,me]=p.useState(0),[le,q]=p.useState(null),[F,ee]=p.useState(0),ie=p.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),W.current=0,se.current&&(se.current.style.touchAction="pan-y"),ee(C),me(0),q(null),window.setTimeout(()=>ee(0),C)},[C]),de=p.useCallback(async(Oe,_e)=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),se.current&&(se.current.style.touchAction="pan-y");const Je=se.current?.offsetWidth||360;ee(M),q(Oe==="right"?"right":"left");const bt=Oe==="right"?Je+40:-(Je+40);W.current=bt,me(bt);let ft;_e?ft=Promise.resolve(Oe==="right"?u():l()).catch(()=>!1):ft=Promise.resolve(!0);const kt=new Promise(Xe=>{window.setTimeout(Xe,M)}),[,Pe]=await Promise.all([kt,ft]);return Pe===!1?(ee(C),q(null),me(0),window.setTimeout(()=>ee(0),C),!1):!0},[M,l,u,C]),I=p.useCallback(()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]),pe=p.useCallback(()=>{O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),W.current=0,ee(0),me(0),q(null);try{const Oe=se.current;Oe&&(Oe.style.touchAction="pan-y")}catch{}},[]),we=p.useCallback((Oe,_e)=>{const Ke=k.current,Je=se.current;if(!Ke||!Je)return;const bt=HN();if(!bt)return;let ft=typeof Oe=="number"?Oe:window.innerWidth/2,kt=typeof _e=="number"?_e:window.innerHeight/2;const Pe=B?k.current?.querySelector(B)??Je.querySelector(B):null;let Xe=ft,st=kt;if(Pe){const Yt=Pe.getBoundingClientRect();Xe=Yt.left+Yt.width/2,st=Yt.top+Yt.height/2}const Ze=Xe-ft,nt=st-kt,wt=document.createElement("div");wt.style.position="absolute",wt.style.left=`${ft}px`,wt.style.top=`${kt}px`,wt.style.transform="translate(-50%, -50%)",wt.style.pointerEvents="none",wt.style.willChange="transform, opacity",wt.style.zIndex="2147483647",wt.style.lineHeight="1",wt.style.userSelect="none",wt.style.filter="drop-shadow(0 10px 16px rgba(0,0,0,0.22))";const fe=document.createElement("div");fe.style.width="30px",fe.style.height="30px",fe.style.color="#f59e0b",fe.style.display="block",wt.appendChild(fe),bt.appendChild(wt);const He=Q_.createRoot(fe);He.render(c.jsx(Og,{className:"w-full h-full","aria-hidden":"true"})),wt.getBoundingClientRect();const Ce=200,De=500,Ie=400,Qe=Ce+De+Ie,Et=Ce/Qe,It=(Ce+De)/Qe,vt=wt.animate([{transform:"translate(-50%, -50%) scale(0.15)",opacity:0,offset:0},{transform:"translate(-50%, -50%) scale(1.25)",opacity:1,offset:Et*.55},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:Et},{transform:"translate(-50%, -50%) scale(1.00)",opacity:1,offset:It},{transform:`translate(calc(-50% + ${Ze}px), calc(-50% + ${nt}px)) scale(0.85)`,opacity:.95,offset:It+(1-It)*.75},{transform:`translate(calc(-50% + ${Ze}px), calc(-50% + ${nt}px)) scale(0.55)`,opacity:0,offset:1}],{duration:Qe,easing:"cubic-bezier(0.2, 0.9, 0.2, 1)",fill:"forwards"});Pe&&window.setTimeout(()=>{try{Pe.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{}},Ce+De+Math.round(Ie*.75)),vt.onfinish=()=>{try{He.unmount()}catch{}wt.remove()}},[B]);p.useEffect(()=>()=>{j.current!=null&&window.clearTimeout(j.current)},[]),p.useImperativeHandle(H,()=>({swipeLeft:Oe=>de("left",Oe?.runAction??!0),swipeRight:Oe=>de("right",Oe?.runAction??!0),reset:()=>ie()}),[de,ie]);const ve=Math.abs(te),ge=te===0?null:te>0?"right":"left",ht=ae.current||Math.min(f,(se.current?.offsetWidth||360)*g),Ge=Math.max(0,Math.min(1,ve/Math.max(1,ht))),Te=Math.max(0,Math.min(1,ve/Math.max(1,ht*1.35))),Le=Math.max(-6,Math.min(6,te/28)),ut=te===0?1:.995;return c.jsx("div",{ref:k,className:zN("relative isolate overflow-visible rounded-lg",h),children:c.jsx("div",{ref:se,className:"relative",style:{transform:te!==0?`translate3d(${te}px,0,0) rotate(${Le}deg) scale(${ut})`:void 0,transition:F?`transform ${F}ms ease`:void 0,touchAction:"pan-y",willChange:te!==0?"transform":void 0,borderRadius:te!==0?"12px":void 0,filter:te!==0?`saturate(${1+Ge*.08}) brightness(${1+Ge*.02})`:void 0},onPointerDown:Oe=>{if(!t||i)return;const _e=Oe.target;let Ke=!!(L&&_e?.closest?.(L));if(S&&_e?.closest?.(S))return;let Je=!1;const bt=Oe.currentTarget,kt=Array.from(bt.querySelectorAll("video")).find(nt=>nt.controls);if(kt){const nt=kt.getBoundingClientRect();if(Oe.clientX>=nt.left&&Oe.clientX<=nt.right&&Oe.clientY>=nt.top&&Oe.clientY<=nt.bottom)if(nt.bottom-Oe.clientY<=72)Je=!0,Ke=!0;else{const De=Oe.clientX-nt.left,Ie=nt.right-Oe.clientX;De<=64||Ie<=64||(Je=!0,Ke=!0)}}const Xe=Oe.currentTarget.getBoundingClientRect().bottom-Oe.clientY;_&&Xe<=_&&(Je=!0),V.current={id:Oe.pointerId,x:Oe.clientX,y:Oe.clientY,dragging:!1,captured:!1,tapIgnored:Ke,noSwipe:Je};const Ze=se.current?.offsetWidth||360;ae.current=Math.min(f,Ze*g),W.current=0},onPointerMove:Oe=>{if(!t||i||V.current.id!==Oe.pointerId||V.current.noSwipe)return;const _e=Oe.clientX-V.current.x,Ke=Oe.clientY-V.current.y;if(!V.current.dragging){if(Math.abs(Ke)>Math.abs(_e)&&Math.abs(Ke)>8){V.current.id=null;return}if(Math.abs(_e)<12)return;V.current.dragging=!0,Oe.currentTarget.style.touchAction="none",ee(0);try{Oe.currentTarget.setPointerCapture(Oe.pointerId),V.current.captured=!0}catch{V.current.captured=!1}}const Je=(Pe,Xe)=>{const st=Xe*.9,Ze=Math.abs(Pe);if(Ze<=st)return Pe;const nt=Ze-st,wt=st+nt*.25;return Math.sign(Pe)*wt},bt=se.current?.offsetWidth||360;W.current=Je(_e,bt),O.current==null&&(O.current=requestAnimationFrame(()=>{O.current=null,me(W.current)}));const ft=ae.current,kt=_e>ft?"right":_e<-ft?"left":null;q(Pe=>{if(Pe===kt)return Pe;if(kt)try{navigator.vibrate?.(10)}catch{}return kt})},onPointerUp:Oe=>{if(!t||i||V.current.id!==Oe.pointerId)return;const _e=ae.current||Math.min(f,(se.current?.offsetWidth||360)*g),Ke=V.current.dragging,Je=V.current.captured,bt=V.current.tapIgnored;if(V.current.id=null,V.current.dragging=!1,V.current.captured=!1,Je)try{Oe.currentTarget.releasePointerCapture(Oe.pointerId)}catch{}if(Oe.currentTarget.style.touchAction="pan-y",!Ke){const kt=Date.now(),Pe=Z.current,Xe=Pe&&Math.hypot(Oe.clientX-Pe.x,Oe.clientY-Pe.y)<=Q;if(!!E&&Pe&&kt-Pe.t<=G&&Xe){if(Z.current=null,I(),Y.current)return;Y.current=!0;try{we(Oe.clientX,Oe.clientY)}catch{}requestAnimationFrame(()=>{(async()=>{try{await E?.()}finally{Y.current=!1}})()});return}if(bt){Z.current={t:kt,x:Oe.clientX,y:Oe.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null},E?G:0);return}pe(),Z.current={t:kt,x:Oe.clientX,y:Oe.clientY},I(),j.current=window.setTimeout(()=>{j.current=null,Z.current=null,a?.()},E?G:0);return}const ft=W.current;O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),ft>_e?de("right",!0):ft<-_e?de("left",!0):ie(),W.current=0},onPointerCancel:Oe=>{if(!(!t||i)){if(V.current.captured&&V.current.id!=null)try{Oe.currentTarget.releasePointerCapture(V.current.id)}catch{}V.current={id:null,x:0,y:0,dragging:!1,captured:!1,tapIgnored:!1,noSwipe:!1},O.current!=null&&(cancelAnimationFrame(O.current),O.current=null),W.current=0;try{Oe.currentTarget.style.touchAction="pan-y"}catch{}ie()}},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:te===0?0:.12+Te*.18,background:ge==="right"?"linear-gradient(90deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 45%, rgba(0,0,0,0) 100%)":ge==="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:le?1:0,boxShadow:le==="right"?"inset 0 0 0 1px rgba(16,185,129,0.45), inset 0 0 32px rgba(16,185,129,0.10)":le==="left"?"inset 0 0 0 1px rgba(244,63,94,0.45), inset 0 0 32px rgba(244,63,94,0.10)":"none"}})]})})})});function Mw({children:n,content:e}){const t=p.useRef(null),i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null),f=p.useRef(null),g=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},_=()=>{g(),f.current=window.setTimeout(()=>{l(!1),f.current=null},150)},S=()=>{g(),l(!0)},C=()=>{_()},M=()=>{g(),l(!1)},L=()=>{const B=t.current,G=i.current;if(!B||!G)return;const Q=8,H=8,se=B.getBoundingClientRect(),Y=G.getBoundingClientRect();let W=se.bottom+Q;if(W+Y.height>window.innerHeight-H){const k=se.top-Y.height-Q;k>=H?W=k:W=Math.max(H,window.innerHeight-Y.height-H)}let ae=se.left;ae+Y.width>window.innerWidth-H&&(ae=window.innerWidth-Y.width-H),ae=Math.max(H,ae),h({left:ae,top:W})};p.useLayoutEffect(()=>{if(!a)return;const B=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(B)},[a]),p.useEffect(()=>{if(!a)return;const B=()=>requestAnimationFrame(()=>L());return window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[a]),p.useEffect(()=>()=>g(),[]);const E=()=>typeof e=="function"?e(a,{close:M}):e;return c.jsxs(c.Fragment,{children:[c.jsx("div",{ref:t,className:"inline-flex",onMouseEnter:S,onMouseLeave:C,children:n}),a&&gu.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 Tf=!0,qN=!1;function ld(n,e){if(!n)return;const t=e?.muted??Tf;n.muted=t,n.defaultMuted=t,n.playsInline=!0,n.setAttribute("playsinline",""),n.setAttribute("webkit-playsinline","")}function L1(n){return(n||"").split(/[\\/]/).pop()||""}function vu({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:M=12,variant:L="thumb",className:E,showPopover:B=!0,blur:G=!1,inlineVideo:Q=!1,inlineNonce:H=0,inlineControls:se=!1,inlineLoop:Y=!0,assetNonce:W=0,muted:O=Tf,popoverMuted:ae=Tf,noGenerateTeaser:k,alwaysLoadStill:j=!1,teaserPreloadEnabled:Z=!1,teaserPreloadRootMargin:V="700px 0px",scrubProgressRatio:te,preferScrubProgress:me=!1}){const le=L1(n.output||"")||e(n.output||""),q=G?"blur-md":"",F=p.useMemo(()=>{const Ne=n?.meta;if(!Ne)return null;if(typeof Ne=="string")try{return JSON.parse(Ne)}catch{return null}return Ne},[n]),[ee,ie]=p.useState(null),de=p.useRef(new Set),I=p.useMemo(()=>!F&&!ee?null:F?ee?{...F,...ee}:F:ee,[F,ee]),pe=p.useMemo(()=>{let Ne=I?.previewClips;if(typeof Ne=="string"){const xt=Ne.trim();if(xt.length>0)try{const St=JSON.parse(xt);return Array.isArray(St)&&St.length>0,!0}catch{return!0}}if(Array.isArray(Ne)&&Ne.length>0)return!0;const pt=I?.preview?.clips;return!!(Array.isArray(pt)&&pt.length>0)},[I]),[we,ve]=p.useState(0),ge=p.useMemo(()=>{let Ne=I?.previewClips;if(typeof Ne=="string")try{Ne=JSON.parse(Ne)}catch{Ne=null}!Array.isArray(Ne)&&Array.isArray(I?.preview?.clips)&&(Ne=I.preview.clips);const pt=Ne;if(!Array.isArray(pt)||pt.length===0)return null;let xt=0;const St=[];for(const Pt of pt){const Ht=Number(Pt?.startSeconds),Gt=Number(Pt?.durationSeconds);if(!Number.isFinite(Ht)||Ht<0||!Number.isFinite(Gt)||Gt<=0)continue;const xn=xt,zn=xt+Gt;St.push({start:Ht,dur:Gt,cumStart:xn,cumEnd:zn}),xt=zn}return St.length?St:null},[I]),ht=p.useMemo(()=>ge?ge.map(Ne=>`${Ne.start.toFixed(3)}:${Ne.dur.toFixed(3)}`).join("|"):"",[ge]),Ge=(typeof F?.videoWidth=="number"&&Number.isFinite(F.videoWidth)&&F.videoWidth>0?F.videoWidth:void 0)??(typeof n.videoWidth=="number"&&Number.isFinite(n.videoWidth)&&n.videoWidth>0?n.videoWidth:void 0),Te=(typeof F?.videoHeight=="number"&&Number.isFinite(F.videoHeight)&&F.videoHeight>0?F.videoHeight:void 0)??(typeof n.videoHeight=="number"&&Number.isFinite(n.videoHeight)&&n.videoHeight>0?n.videoHeight:void 0),Le=(typeof F?.fileSize=="number"&&Number.isFinite(F.fileSize)&&F.fileSize>0?F.fileSize:void 0)??(typeof n.sizeBytes=="number"&&Number.isFinite(n.sizeBytes)&&n.sizeBytes>0?n.sizeBytes:void 0),ut=(typeof F?.fps=="number"&&Number.isFinite(F.fps)&&F.fps>0?F.fps:void 0)??(typeof n.fps=="number"&&Number.isFinite(n.fps)&&n.fps>0?n.fps:void 0),Oe=(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),_e=typeof Oe=="number"&&Number.isFinite(Oe)&&Oe>0?Oe>1440*60?Oe/1e3:Oe:void 0,Ke=typeof _e=="number"&&Number.isFinite(_e)&&_e>0,Je=typeof Ge=="number"&&typeof Te=="number"&&Number.isFinite(Ge)&&Number.isFinite(Te)&&Ge>0&&Te>0,bt={muted:O,playsInline:!0,preload:"metadata"},[ft,kt]=p.useState(!0),[Pe,Xe]=p.useState(!0),[st,Ze]=p.useState(!1),[nt,wt]=p.useState(!1),[fe,He]=p.useState(!0),Ce=p.useRef(""),De=p.useRef(""),Ie=p.useRef(null),[Qe,Et]=p.useState(!1),[It,vt]=p.useState(!1),[Yt,Ft]=p.useState(!1),[zt,At]=p.useState(0),[Nt,ln]=p.useState(!1),dn=Q===!0||Q==="always"?"always":Q==="hover"?"hover":"never",yt=dn==="hover"||l&&(u==="clips"||u==="teaser")&&h==="hover",Fn=Ne=>Ne.startsWith("HOT ")?Ne.slice(4):Ne,ot=p.useMemo(()=>{const Ne=L1(n.output||"")||e(n.output||"");if(!Ne)return"";const pt=Ne.replace(/\.[^.]+$/,"");return Fn(pt).trim()},[n.output,e]),N=p.useMemo(()=>le?`/api/record/video?file=${encodeURIComponent(le)}`:"",[le]),P=L==="fill"?"w-full h-full":"w-20 h-16",ne=p.useRef(null),je=p.useRef(null),qe=p.useRef(null),dt=p.useRef({inline:null,teaser:null,clips:null}),$t=(Ne,pt)=>{pt&&dt.current[Ne]!==pt&&(dt.current[Ne]=pt,ve(xt=>xt+1))},[Zt,hn]=p.useState(0),[,Qt]=p.useState(0),vn=Ne=>Ne<0?0:Ne>1?1:Ne,Tn=(Ne,pt,xt=C,St=!1)=>{if(!Ne)return{ratio:0,globalSec:0,vvDur:0};const Pt=Number(Ne.duration);if(!(Number.isFinite(Pt)&&Pt>0))return{ratio:0,globalSec:0,vvDur:0};const Gt=Number(Ne.currentTime);if(!Number.isFinite(Gt)||Gt<0)return{ratio:0,globalSec:0,vvDur:Pt};const xn=ge;let zn=0;if(St&&Array.isArray(xn)&&xn.length>0){const $n=xn[xn.length-1];if(Gt>=$n.cumEnd)zn=typeof pt=="number"&&Number.isFinite(pt)&&pt>0?pt:$n.start+$n.dur;else{let Vi=0,Si=xn.length-1,si=0;for(;Vi<=Si;){const Vn=Vi+Si>>1,Gn=xn[Vn];if(Gt<Gn.cumStart)Si=Vn-1;else if(Gt>=Gn.cumEnd)Vi=Vn+1;else{si=Vn;break}}return zn=xn[si].start,{ratio:xn.length>0?vn(si/xn.length):0,globalSec:Math.max(0,zn),vvDur:Pt}}}return Number.isFinite(xt)&&xt>0?zn=Math.floor(Gt/xt)*xt:zn=Gt,{ratio:vn(Math.min(zn,Pt)/Pt),globalSec:Math.max(0,zn),vvDur:Pt}},Wt=Ne=>{if(Ne){try{Ne.pause()}catch{}try{Ne.removeAttribute("src"),Ne.src="",Ne.load()}catch{}}};p.useEffect(()=>{wt(!1),He(!0),ie(null),Ce.current="",De.current="",Ze(!1)},[ot,W,k]),p.useEffect(()=>{const Ne=pt=>{const xt=String(pt?.detail?.file??"");!xt||xt!==le||(Wt(ne.current),Wt(je.current),Wt(qe.current))};return window.addEventListener("player:release",Ne),window.addEventListener("player:close",Ne),()=>{window.removeEventListener("player:release",Ne),window.removeEventListener("player:close",Ne)}},[le]),p.useEffect(()=>{const Ne=Ie.current;if(!Ne)return;const pt=new IntersectionObserver(xt=>{const St=!!xt[0]?.isIntersecting;Et(St),St&&Ft(!0)},{threshold:.01,rootMargin:"0px"});return pt.observe(Ne),()=>pt.disconnect()},[]),p.useEffect(()=>{const Ne=Ie.current;if(!Ne)return;if(!Z){vt(Qe);return}let pt=!0;const xt=new IntersectionObserver(St=>{St[0]?.isIntersecting&&(vt(!0),pt&&(pt=!1,xt.disconnect()))},{threshold:0,rootMargin:V});return xt.observe(Ne),()=>xt.disconnect()},[Z,V,Qe]),p.useEffect(()=>{if(!l||u!=="frames"||!Qe||document.hidden)return;const Ne=window.setInterval(()=>At(pt=>pt+1),f);return()=>window.clearInterval(Ne)},[l,u,Qe,f]);const gn=p.useMemo(()=>{if(!l||u!=="frames"||!Ke)return null;const Ne=_e,pt=Math.max(.25,g??3);if(_){const Pt=Math.max(4,Math.min(S??16,Math.floor(Ne))),Ht=zt%Pt,Gt=Math.max(.1,Ne-pt),xn=Math.min(.25,Gt*.02),zn=Ht/Pt*Gt+xn;return Math.min(Ne-.05,Math.max(.05,zn))}const xt=Math.max(Ne-.1,pt),St=zt*pt%xt;return Math.min(Ne-.05,Math.max(.05,St))},[l,u,Ke,_e,zt,g,_,S]),sn=W??0,an=p.useMemo(()=>ot?gn==null?`/api/preview?id=${encodeURIComponent(ot)}&v=${sn}`:`/api/preview?id=${encodeURIComponent(ot)}&t=${gn}&v=${sn}`:"",[ot,gn,sn]),Bt=p.useMemo(()=>{if(!ot)return"";const Ne=k?"&noGenerate=1":"";return`/api/generated/teaser?id=${encodeURIComponent(ot)}${Ne}&v=${sn}`},[ot,sn,k]),Dt=dn!=="never"&&Qe&&Pe&&(dn==="always"||dn==="hover"&&Nt),jt=l&&Qe&&!document.hidden&&Pe&&!Dt&&(h==="always"||Nt)&&(u==="teaser"&&fe&&!!Bt||u==="clips"&&Ke),Dn=Ke&&typeof _e=="number"?_e:void 0,Mt=j||Qe||Yt||yt&&Nt,Hn=It||Qe||Yt||yt&&Nt;p.useEffect(()=>{let Ne=!1;if(i&&Ke){const pt=Number(_e),xt=`${le}|dur|${pt}`;Ce.current!==xt&&(Ce.current=xt,i(n,pt),Ne=!0)}if(a&&Je){const pt=Number(Ge),xt=Number(Te),St=`${le}|res|${pt}x${xt}`;De.current!==St&&(De.current=St,a(n,pt,xt),Ne=!0)}Ne&&Ze(!0)},[le,n,i,a,Ke,Je,_e,Ge,Te]),p.useEffect(()=>{if(!ot||!le||!l||u!=="teaser"||!Hn||pe||de.current.has(le))return;let Ne=!1;const pt=new AbortController,xt=async St=>{try{const Pt=await fetch(St,{signal:pt.signal,cache:"no-store",credentials:"include"});return Pt.ok?await Pt.json():null}catch{return null}};return(async()=>{const St=await xt(`/api/record/done/meta?file=${encodeURIComponent(le)}`);Ne||(de.current.add(le),St&&ie(St))})(),()=>{Ne=!0,pt.abort()}},[ot,le,l,u,Hn,pe]);const In=Ne=>{Ze(!0);const pt=Ne.currentTarget;if(i&&!Ke){const xt=Number(pt.duration);if(Number.isFinite(xt)&&xt>0){const St=`${le}|dur|${xt}`;Ce.current!==St&&(Ce.current=St,i(n,xt))}}if(a&&!Je){const xt=Number(pt.videoWidth),St=Number(pt.videoHeight);if(Number.isFinite(xt)&&Number.isFinite(St)&&xt>0&&St>0){const Pt=`${le}|res|${xt}x${St}`;De.current!==Pt&&(De.current=Pt,a(n,xt,St))}}};if(p.useEffect(()=>{kt(!0),Xe(!0),dt.current.inline=null,dt.current.teaser=null,dt.current.clips=null},[ot,W]),!N)return c.jsx("div",{className:[P,"rounded bg-gray-100 dark:bg-white/5"].join(" ")});const Sn=Hn,Xt=l&&u==="teaser"&&fe&&!!Bt&&!Dt&&Hn,Un=Dt?ne:!Dt&&jt&&u==="teaser"?je:!Dt&&jt&&u==="clips"?qe:null,Yn=!!Un&&Qe,Cn=Dt?"inline":jt&&u==="teaser"?"teaser":"clips",ti=l&&u==="frames"&&Ke&&typeof gn=="number"&&Number.isFinite(gn)&&gn>=0,wn=ti?vn(gn/_e):0,ui=!Dt&&me&&typeof te=="number"&&Number.isFinite(te),ri=ui?vn(te):Yn?Zt:ti?wn:0,Zn=!Dt&&(ui||(Yn||ti)),xi=p.useMemo(()=>{if(!Ke)return null;const Ne=_e;if(!(Ne>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 St=xt.map(Pt=>({start:Number(Pt?.startSeconds),dur:Number(Pt?.durationSeconds)})).filter(Pt=>Number.isFinite(Pt.start)&&Pt.start>=0&&Number.isFinite(Pt.dur)&&Pt.dur>0);return St.length?St.map(Pt=>{const Ht=vn(Pt.start/Ne),Gt=vn(Pt.dur/Ne);return{left:Ht,width:Gt,start:Pt.start,dur:Pt.dur}}):null},[I,Ke,_e]),Mn=p.useMemo(()=>{if(!l)return[];if(u!=="clips")return[];if(!Ke)return[];const Ne=_e,pt=Math.max(.25,C),xt=Math.max(8,Math.min(M??S??12,Math.floor(Ne))),St=Math.max(.1,Ne-pt),Pt=Math.min(.25,St*.02),Ht=[];for(let Gt=0;Gt<xt;Gt++){const xn=Gt/xt*St+Pt;Ht.push(Math.min(Ne-.05,Math.max(.05,xn)))}return Ht},[l,u,Ke,_e,S,C,M]),jn=p.useMemo(()=>Mn.map(Ne=>Ne.toFixed(2)).join(","),[Mn]),qn=p.useRef(0),xe=p.useRef(0);p.useEffect(()=>{const Ne=je.current;if(!Ne)return;if(!(jt&&u==="teaser")){try{Ne.pause()}catch{}return}ld(Ne,{muted:O});const xt=Ne.play?.();xt&&typeof xt.catch=="function"&&xt.catch(()=>{})},[jt,u,Bt,O]),p.useEffect(()=>{if(!Yn){hn(0),Qt(0);return}const Ne=Un?.current??null;if(!Ne){hn(0),Qt(0);return}let pt=!1,xt=null;const St=()=>{if(pt||!Ne.isConnected)return;const Gt=Cn==="teaser"&&Array.isArray(ge)&&ge.length>0,xn=Tn(Ne,Dn,C,Gt);hn(xn.ratio),Qt(xn.globalSec)};St(),xt=window.setInterval(St,100);const Pt=()=>St(),Ht=()=>St();return Ne.addEventListener("loadedmetadata",Pt),Ne.addEventListener("durationchange",Pt),Ne.addEventListener("timeupdate",Ht),()=>{pt=!0,xt!=null&&window.clearInterval(xt),Ne.removeEventListener("loadedmetadata",Pt),Ne.removeEventListener("durationchange",Pt),Ne.removeEventListener("timeupdate",Ht)}},[Yn,Un,Dn,ht,Cn,ge,we]),p.useEffect(()=>{Dt&&ld(ne.current,{muted:O})},[Dt,O]),p.useEffect(()=>{const Ne=qe.current;if(!Ne)return;if(!(jt&&u==="clips")){jt||Ne.pause();return}if(!Mn.length)return;qn.current=qn.current%Mn.length,xe.current=Mn[qn.current];const pt=()=>{try{Ne.currentTime=xe.current}catch{}const Pt=Ne.play();Pt&&typeof Pt.catch=="function"&&Pt.catch(()=>{})},xt=()=>pt(),St=()=>{if(Mn.length&&Ne.currentTime-xe.current>=C){qn.current=(qn.current+1)%Mn.length,xe.current=Mn[qn.current];try{Ne.currentTime=xe.current+.01}catch{}}};return Ne.addEventListener("loadedmetadata",xt),Ne.addEventListener("timeupdate",St),Ne.readyState>=1&&pt(),()=>{Ne.removeEventListener("loadedmetadata",xt),Ne.removeEventListener("timeupdate",St),Ne.pause()}},[jt,u,jn,C,Mn]);const it=(It||Qe)&&(i||a)&&!st&&!Dt&&(i&&!Ke||a&&!Je),mt=!!xi&&(Cn==="teaser"||!Dt&&ui&&u==="teaser"),Rt=c.jsxs("div",{ref:Ie,className:["group bg-gray-100 dark:bg-white/5 overflow-hidden relative",P,E??""].join(" "),onMouseEnter:yt?()=>ln(!0):void 0,onMouseLeave:yt?()=>ln(!1):void 0,onFocus:yt?()=>ln(!0):void 0,onBlur:yt?()=>ln(!1):void 0,"data-duration":Ke?String(_e):void 0,"data-res":Je?`${Ge}x${Te}`:void 0,"data-size":typeof Le=="number"?String(Le):void 0,"data-fps":typeof ut=="number"?String(ut):void 0,children:[Mt&&an&&ft?c.jsx("img",{src:an,loading:j?"eager":"lazy",decoding:"async",alt:le,className:["absolute inset-0 w-full h-full object-cover",q].filter(Boolean).join(" "),onError:()=>kt(!1)}):c.jsx("div",{className:"absolute inset-0 bg-black/10 dark:bg-white/10"}),Dt?p.createElement("video",{...bt,ref:Ne=>{ne.current=Ne,$t("inline",Ne)},key:`inline-${ot}-${H}`,src:N,className:["absolute inset-0 w-full h-full object-cover",q,se?"pointer-events-auto":"pointer-events-none"].filter(Boolean).join(" "),autoPlay:!0,muted:O,controls:se,loop:Y,poster:Sn&&an||void 0,onLoadedMetadata:In,onError:()=>Xe(!1)}):null,!Dt&&Xt&&!(jt&&u==="teaser")?c.jsx("video",{src:Bt,className:"hidden",muted:!0,playsInline:!0,preload:"auto",onLoadedData:()=>wt(!0),onCanPlay:()=>wt(!0),onError:()=>{He(!1),wt(!1)}},`teaser-prewarm-${ot}`):null,!Dt&&jt&&u==="teaser"?c.jsx("video",{ref:Ne=>{je.current=Ne,$t("teaser",Ne)},src:Bt,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q,nt?"opacity-100":"opacity-0","transition-opacity duration-150"].filter(Boolean).join(" "),muted:O,playsInline:!0,autoPlay:!0,loop:!0,preload:nt?"auto":"metadata",poster:Sn&&an||void 0,onLoadedData:()=>wt(!0),onPlaying:()=>wt(!0),onError:()=>{He(!1),wt(!1)}},`teaser-mp4-${ot}`):null,!Dt&&jt&&u==="clips"?c.jsx("video",{ref:Ne=>{qe.current=Ne,$t("clips",Ne)},src:N,className:["absolute inset-0 w-full h-full object-cover pointer-events-none",q].filter(Boolean).join(" "),muted:O,playsInline:!0,preload:"metadata",poster:Sn&&an||void 0,onError:()=>Xe(!1)},`clips-${ot}-${jn}`):null,Zn?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:[mt?c.jsx("div",{className:"absolute inset-0",children:xi.map((Ne,pt)=>c.jsx("div",{className:"absolute top-0 bottom-0 bg-white/15 dark:bg-white/20",style:{left:`${Ne.left*100}%`,width:`${Ne.width*100}%`}},`seg-${pt}-${Ne.left.toFixed(6)}-${Ne.width.toFixed(6)}`))}):null,c.jsx("div",{className:["absolute inset-0 origin-left",Cn==="teaser"?"":"transition-transform duration-150 ease-out"].join(" "),style:{transform:`scaleX(${vn(ri)})`,background:"rgba(99,102,241,0.95)"}})]}):null,it?c.jsx("video",{src:N,preload:"metadata",muted:O,playsInline:!0,className:"hidden",onLoadedMetadata:In}):null]});return B?c.jsx(Mw,{content:Ne=>Ne&&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",q].filter(Boolean).join(" "),muted:ae,playsInline:!0,preload:"metadata",controls:!0,autoPlay:!0,loop:!0,onClick:pt=>pt.stopPropagation(),onMouseDown:pt=>pt.stopPropagation()})})}),children:Rt}):Rt}function Nn(...n){return n.filter(Boolean).join(" ")}const VN=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",GN=n=>n.startsWith("HOT ")?n.slice(4):n,KN=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function WN(n){const t=GN(VN(n||"")).replace(/\.[^.]+$/,""),i=t.match(KN);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:M,onDelete:L,onToggleWatch:E,onAddToDownloads:B,order:G,className:Q}){const H=e==="overlay"?l?"p-1.5":"p-2":"p-1.5",se=l?"size-4":"size-5",Y="h-full w-full",W=e==="table"?`inline-flex items-center justify-center rounded-md ${H} hover:bg-gray-100/70 dark:hover:bg-white/5 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500/60 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`:`inline-flex items-center justify-center rounded-md bg-white/75 ${H} text-gray-900 backdrop-blur ring-1 ring-black/10 hover:bg-white/90 dark:bg-black/40 dark:text-white dark:ring-white/10 dark:hover:bg-black/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/60 dark:focus-visible:ring-white/40 disabled:opacity-50 disabled:cursor-not-allowed transition-transform active:scale-95`,O=e==="table"?{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-500 dark:text-gray-300",keep:"text-emerald-600 dark:text-emerald-300",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-300"}:{favOn:"text-amber-600 dark:text-amber-300",likeOn:"text-rose-600 dark:text-rose-300",hotOn:"text-amber-600 dark:text-amber-300",off:"text-gray-800/90 dark:text-white/90",keep:"text-emerald-600 dark:text-emerald-200",del:"text-red-600 dark:text-red-300",watchOn:"text-sky-600 dark:text-sky-200"},ae=G??["watch","favorite","like","hot","keep","delete","details"],k=ot=>ae.includes(ot),j=String(n?.sourceUrl??"").trim(),Z=WN(n.output||""),V=Z?`Mehr zu ${Z} anzeigen`:"Mehr anzeigen",te=k("favorite"),me=k("like"),le=k("hot"),q=k("watch"),F=k("keep"),ee=k("delete"),ie=k("details")&&!!Z,de=k("add"),[I,pe]=p.useState("idle"),we=p.useRef(null);p.useEffect(()=>()=>{we.current&&window.clearTimeout(we.current)},[]);const ve=()=>{pe("ok"),we.current&&window.clearTimeout(we.current),we.current=window.setTimeout(()=>pe("idle"),800)},ge=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?ve():pe("idle"),N}catch{return pe("idle"),!1}},[ht,Ge]=p.useState(0),[Te,Le]=p.useState(4),ut=ot=>N=>{N.preventDefault(),N.stopPropagation(),!(a||!ot)&&Promise.resolve(ot(n)).catch(()=>{})},Oe=ie?c.jsxs("button",{type:"button",className:Nn(W),title:V,"aria-label":V,disabled:a,onClick:ot=>{ot.preventDefault(),ot.stopPropagation(),!a&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(j1,{className:Nn(Y,O.off)})}),c.jsx("span",{className:"sr-only",children:V})]}):null,_e=de?c.jsxs("button",{type:"button",className:Nn(W),title:j?"URL zu Downloads hinzufügen":"Keine URL vorhanden","aria-label":"Zu Downloads hinzufügen",disabled:a||I==="busy"||!B&&!j,onClick:async ot=>{ot.preventDefault(),ot.stopPropagation(),await ge()},children:[c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:I==="ok"?c.jsx(Dw,{className:Nn(Y,"text-emerald-600 dark:text-emerald-300")}):c.jsx(N1,{className:Nn(Y,O.off)})}),c.jsx("span",{className:"sr-only",children:"Zu Downloads"})]}):null,Ke=te?c.jsx("button",{type:"button",className:W,title:h?"Favorit entfernen":"Als Favorit markieren","aria-label":h?"Favorit entfernen":"Als Favorit markieren","aria-pressed":h,disabled:a||!_,onClick:ut(_),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 motion-reduce:transition-none",h?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Y,O.off)}),c.jsx(bu,{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",Y,O.favOn)})]})}):null,Je=me?c.jsx("button",{type:"button",className:W,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:ut(S),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(Jc,{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",Y,O.off)}),c.jsx(yl,{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",Y,O.likeOn)})]})}):null,bt=le?c.jsx("button",{type:"button","data-hot-target":!0,className:W,title:u?"HOT entfernen":"Als HOT markieren","aria-label":u?"HOT entfernen":"Als HOT markieren","aria-pressed":u,disabled:a||!C,onClick:ut(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",Y,O.off)}),c.jsx(Og,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",u?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Y,O.hotOn)})]})}):null,ft=q?c.jsx("button",{type:"button",className:W,title:g?"Watched entfernen":"Als Watched markieren","aria-label":g?"Watched entfernen":"Als Watched markieren","aria-pressed":g,disabled:a||!E,onClick:ut(E),children:c.jsxs("span",{className:Nn("relative inline-block",se),children:[c.jsx(vf,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0",Y,O.off)}),c.jsx(gl,{className:Nn("absolute inset-0 transition-all duration-200 ease-out",g?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12",Y,O.watchOn)})]})}):null,kt=F?c.jsx("button",{type:"button",className:W,title:"Behalten (nach keep verschieben)","aria-label":"Behalten",disabled:a||!M,onClick:ut(M),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(D1,{className:Nn(Y,O.keep)})})}):null,Pe=ee?c.jsx("button",{type:"button",className:W,title:"Löschen","aria-label":"Löschen",disabled:a||!L,onClick:ut(L),children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx(R1,{className:Nn(Y,O.del)})})}):null,Xe={details:Oe,add:_e,favorite:Ke,like:Je,watch:ft,hot:bt,keep:kt,delete:Pe},st=t,Ze=ae.filter(ot=>!!Xe[ot]),nt=st&&typeof i!="number",He=(l?16:20)+(e==="overlay"?l?6:8:6)*2,Ce=l?2:3,De=p.useMemo(()=>{if(!nt)return i??Ce;const ot=ht||0;if(ot<=0)return Math.min(Ze.length,Ce);for(let N=Ze.length;N>=0;N--)if(N*He+He+(N>0?N*Te:0)<=ot)return N;return 0},[nt,i,Ce,ht,Ze.length,He,Te]),Ie=st?Ze.slice(0,De):Ze,Qe=st?Ze.slice(De):[],[Et,It]=p.useState(!1),vt=p.useRef(null);p.useLayoutEffect(()=>{const ot=vt.current;if(!ot||typeof window>"u")return;const N=()=>{const ne=vt.current;if(!ne)return;const je=Math.floor(ne.getBoundingClientRect().width||0);je>0&&Ge(je);const qe=window.getComputedStyle(ne),dt=qe.columnGap||qe.gap||"0",$t=parseFloat(dt);Number.isFinite($t)&&$t>=0&&Le($t)};N();const P=new ResizeObserver(()=>N());return P.observe(ot),window.addEventListener("resize",N),()=>{window.removeEventListener("resize",N),P.disconnect()}},[]);const Yt=p.useRef(null),Ft=p.useRef(null),zt=208,At=4,Nt=8,[ln,dn]=p.useState(null);p.useEffect(()=>{if(!Et)return;const ot=P=>{P.key==="Escape"&&It(!1)},N=P=>{const ne=vt.current,je=Ft.current,qe=P.target;ne&&ne.contains(qe)||je&&je.contains(qe)||It(!1)};return window.addEventListener("keydown",ot),window.addEventListener("mousedown",N),()=>{window.removeEventListener("keydown",ot),window.removeEventListener("mousedown",N)}},[Et]),p.useLayoutEffect(()=>{if(!Et){dn(null);return}const ot=()=>{const N=Yt.current;if(!N)return;const P=N.getBoundingClientRect(),ne=window.innerWidth,je=window.innerHeight;let qe=P.right-zt;qe=Math.max(Nt,Math.min(qe,ne-zt-Nt));let dt=P.bottom+At;dt=Math.max(Nt,Math.min(dt,je-Nt));const $t=Math.max(120,je-dt-Nt);dn({top:dt,left:qe,maxH:$t})};return ot(),window.addEventListener("resize",ot),window.addEventListener("scroll",ot,!0),()=>{window.removeEventListener("resize",ot),window.removeEventListener("scroll",ot,!0)}},[Et]);const yt=()=>{Z&&window.dispatchEvent(new CustomEvent("open-model-details",{detail:{modelKey:Z}}))},Fn=ot=>ot==="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(),It(!1),yt()},children:[c.jsx(j1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Details"})]},"details"):ot==="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(),It(!1),await ge()},children:[c.jsx(N1,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:"Zu Downloads"})]},"add"):ot==="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(),It(!1),await _?.(n)},children:[h?c.jsx(bu,{className:Nn("size-4",O.favOn)}):c.jsx(xf,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:h?"Favorit entfernen":"Als Favorit markieren"})]},"favorite"):ot==="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(),It(!1),await S?.(n)},children:[f?c.jsx(yl,{className:Nn("size-4",O.favOn)}):c.jsx(Jc,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:f?"Gefällt mir entfernen":"Gefällt mir"})]},"like"):ot==="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(),It(!1),await E?.(n)},children:[g?c.jsx(gl,{className:Nn("size-4",O.favOn)}):c.jsx(vf,{className:Nn("size-4",O.off)}),c.jsx("span",{className:"truncate",children:g?"Watched entfernen":"Watched"})]},"watch"):ot==="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(),It(!1),await C?.(n)},children:[u?c.jsx(Og,{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"):ot==="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||!M,onClick:async N=>{N.preventDefault(),N.stopPropagation(),It(!1),await M?.(n)},children:[c.jsx(D1,{className:Nn("size-4",O.keep)}),c.jsx("span",{className:"truncate",children:"Behalten"})]},"keep"):ot==="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||!L,onClick:async N=>{N.preventDefault(),N.stopPropagation(),It(!1),await L?.(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:vt,className:Nn("relative flex items-center flex-nowrap",Q??"gap-2"),children:[Ie.map(ot=>{const N=Xe[ot];return N?c.jsx(p.Fragment,{children:N},ot):null}),st&&Qe.length>0?c.jsxs("div",{className:"relative",children:[c.jsx("button",{ref:Yt,type:"button",className:W,"aria-label":"Mehr",title:"Mehr","aria-haspopup":"menu","aria-expanded":Et,disabled:a,onClick:ot=>{ot.preventDefault(),ot.stopPropagation(),!a&&It(N=>!N)},children:c.jsx("span",{className:Nn("inline-flex items-center justify-center",se),children:c.jsx($A,{className:Nn(Y,O.off)})})}),Et&&ln&&typeof document<"u"?gu.createPortal(c.jsx("div",{ref:Ft,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:ln.top,left:ln.left,width:zt,maxHeight:ln.maxH},onClick:ot=>ot.stopPropagation(),children:Qe.map(Fn)}),document.body):null]}):null]})}function ps({tag:n,children:e,title:t,active:i,onClick:a,maxWidthClassName:l="max-w-[11rem]",className:u,stopPropagation:h=!0}){const f=n??(typeof e=="string"||typeof e=="number"?String(e):""),g=rn("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=rn(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),M=E=>E.stopPropagation(),L=h?{onPointerDown:M,onMouseDown:M}:{};return a?c.jsx("button",{type:"button",className:C,title:t??f,"aria-pressed":!!i,...L,onClick:E=>{h&&(E.preventDefault(),E.stopPropagation()),f&&a(f)},children:e??n}):c.jsx("span",{className:C,title:t??f,...L,onClick:h?M:void 0,children:e??n})}function ud({rowKey:n,tags:e,activeTagSet:t,lower:i,onToggleTagFilter:a,maxVisible:l,maxWidthClassName:u,gapPx:h=6,className:f}){const[g,_]=p.useState(!1),S=p.useRef(null),C=p.useRef(null),M=p.useRef(null);p.useEffect(()=>_(!1),[n]),p.useEffect(()=>{if(!g)return;const O=ae=>{ae.key==="Escape"&&_(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[g]);const L=p.useMemo(()=>typeof l=="number"&&l>0?l:Number.POSITIVE_INFINITY,[l]),E=p.useMemo(()=>[...e].sort((O,ae)=>O.localeCompare(ae,void 0,{sensitivity:"base"})),[e]),[B,G]=p.useState(()=>{const O=Math.min(E.length,L);return Math.min(O,6)}),Q=p.useCallback(()=>{const O=S.current,ae=C.current;if(!O||!ae)return;const k=Math.floor(O.getBoundingClientRect().width);if(k<=0)return;const j=Math.min(E.length,L);if(j<=0){G(0);return}const V=Array.from(ae.children).map(F=>F.offsetWidth).slice(0,j),te=M.current?.offsetWidth??0,me=2,le=F=>{let ee=0,ie=0;for(let de=0;de<V.length;de++){const I=V[de]+(ie>0?h:0);if(ee+I<=F-me)ee+=I,ie++;else break}return ie};let q=le(k);if(q<j){const F=te>0?te+h:0,ee=Math.max(0,k-F);q=le(ee),q=Math.max(0,q)}G(Math.max(0,Math.min(q,j)))},[E,L,h]);p.useLayoutEffect(()=>{Q()},[Q,E.join("\0"),u,L]),p.useEffect(()=>{const O=S.current;if(!O)return;const ae=new ResizeObserver(()=>Q());return ae.observe(O),()=>ae.disconnect()},[Q]);const H=Math.min(E.length,L),se=E.slice(0,Math.min(B,H)),Y=O=>O.stopPropagation(),W=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:Y,onMouseDown:Y,onPointerDown:Y,children:[c.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:c.jsx("div",{className:"flex flex-nowrap items-center gap-1.5",children:se.length>0?se.map(O=>c.jsx(ps,{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:"—"})})}),W>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:["+",W]}):null]}),g?c.jsxs("div",{className:["absolute inset-0 z-30","bg-white/60 dark:bg-gray-950","px-3 py-3","pointer-events-auto"].join(" "),onClick:Y,onMouseDown:Y,onPointerDown:Y,role:"dialog","aria-label":"Tags",children:[c.jsx("button",{type:"button",className:`\r
|
||
absolute right-2 top-2 z-10\r
|
||
rounded-md bg-gray-100/80 px-2 py-1 text-xs font-semibold text-gray-700\r
|
||
hover:bg-gray-200/80\r
|
||
dark:bg-white/10 dark:text-gray-200 dark:hover:bg-white/20\r
|
||
`,onClick:()=>_(!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(ps,{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,H).map(O=>c.jsx(ps,{tag:O,active:t.has(i(O)),onClick:a,maxWidthClassName:u},O))}),c.jsx("button",{ref:M,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 XN(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 yy({imageCount:n,activeIndex:e,onActiveIndexChange:t,onIndexClick:i,className:a,stepSeconds:l=0}){const u=p.useRef(null),h=p.useRef(null),f=p.useRef(void 0),g=p.useCallback(()=>{h.current=null,t(f.current)},[t]),_=p.useCallback(Y=>{f.current=Y,h.current==null&&(h.current=window.requestAnimationFrame(g))},[g]);p.useEffect(()=>()=>{h.current!=null&&(window.cancelAnimationFrame(h.current),h.current=null)},[]);const S=p.useCallback(Y=>{if(!u.current||n<1)return;const W=u.current.getBoundingClientRect();if(W.width<=0)return;const O=Y-W.left,ae=I1(O/W.width,0,.999999);return I1(Math.floor(ae*n),0,n-1)},[n]),C=p.useCallback(Y=>{const W=S(Y.clientX);_(W)},[S,_]),M=p.useCallback(Y=>{const W=S(Y.clientX);_(W)},[S,_]),L=p.useCallback(()=>{_(void 0)},[_]),E=p.useCallback(Y=>{Y.stopPropagation();const W=S(Y.clientX);_(W);try{Y.currentTarget.setPointerCapture?.(Y.pointerId)}catch{}},[S,_]),B=p.useCallback(Y=>{if(Y.stopPropagation(),!i)return;const W=S(Y.clientX);typeof W=="number"&&i(W)},[S,i]);if(!n||n<1)return null;const G=typeof e=="number"?(e+.5)/n*100:void 0,Q=typeof e=="number"?l>0?XN(e*l):`${e+1}/${n}`:"",H=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:M,onPointerLeave:L,onPointerDown:E,onMouseDown:Y=>Y.stopPropagation(),onClick:B,title:H?Q:`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",H?"opacity-100":"opacity-0","[text-shadow:_0_1px_2px_rgba(0,0,0,0.9)]"].join(" "),style:se,children:Q})]})}const jw=/^HOT[ \u00A0]+/i,Rw=n=>String(n||"").replaceAll(" "," "),au=n=>jw.test(Rw(n)),$r=n=>Rw(n).replace(jw,"");function cd(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 YN=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 QN(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function N0(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 ZN=5;function JN(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 e3({blurred:n,animateUnblurOnMount:e,children:t}){const[i,a]=p.useState(!e);p.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 t3({animateOnMount:n,children:e}){const[t,i]=p.useState(!n);return p.useEffect(()=>{if(!n)return;const a=requestAnimationFrame(()=>{i(!0)});return()=>cancelAnimationFrame(a)},[n]),c.jsx("div",{className:"will-change-[transform,opacity] transition-[transform,opacity] duration-160 ease-out motion-reduce:transition-none",style:{transform:t?"translateY(0px) scale(1) translateZ(0)":"translateY(-15px) scale(0.97) translateZ(0)",opacity:t?1:.92,transformOrigin:"top center"},children:e})}function n3({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:M,assetNonce:L,handleScrubberClickIndex:E,keyFor:B,baseName:G,modelNameFromOutput:Q,runtimeOf:H,sizeBytesOf:se,formatBytes:Y,lower:W,onHoverPreviewKeyChange:O,onOpenPlayer:ae,openPlayer:k,startInlineAt:j,startInline:Z,tryAutoplayInline:V,registerTeaserHost:te,handleDuration:me,deleteVideo:le,keepVideo:q,modelsByKey:F,activeTagSet:ee,onToggleTagFilter:ie,onToggleHot:de,onToggleFavorite:I,onToggleLike:pe,onToggleWatch:we,enqueueDeleteVideo:ve,enqueueKeepVideo:ge,enqueueToggleHot:ht}){const Ge=p.useCallback(Ce=>{const De=Ce?.meta;if(!De)return null;if(typeof De=="string")try{return JSON.parse(De)}catch{return null}return De},[]),Te=p.useCallback(Ce=>{const De=Ge(Ce),Ie=(typeof De?.videoWidth=="number"&&Number.isFinite(De.videoWidth)?De.videoWidth:0)||(typeof Ce.videoWidth=="number"&&Number.isFinite(Ce.videoWidth)?Ce.videoWidth:0),Qe=(typeof De?.videoHeight=="number"&&Number.isFinite(De.videoHeight)?De.videoHeight:0)||(typeof Ce.videoHeight=="number"&&Number.isFinite(Ce.videoHeight)?Ce.videoHeight:0);return Ie>0&&Qe>0?{w:Ie,h:Qe}:null},[Ge]),Le=p.useCallback(Ce=>{const De=Ge(Ce);let Ie=De?.previewSprite??De?.preview?.sprite??De?.sprite??Ce?.previewSprite??Ce?.preview?.sprite??null;if(typeof Ie=="string")try{Ie=JSON.parse(Ie)}catch{Ie=null}const Qe=Number(Ie?.count??Ie?.frames??Ie?.imageCount),Et=Number(Ie?.stepSeconds??Ie?.step??Ie?.intervalSeconds);if(Number.isFinite(Qe)&&Qe>=2)return{count:Math.max(2,Math.floor(Qe)),stepSeconds:Number.isFinite(Et)&&Et>0?Et:5};const It=B(Ce),vt=h[It]??(typeof Ce?.durationSeconds=="number"?Ce.durationSeconds:void 0);return typeof vt=="number"&&Number.isFinite(vt)&&vt>1?{count:Math.max(2,Math.min(240,Math.floor(vt/5)+1)),stepSeconds:5}:null},[Ge,B,h]),[ut,Oe]=p.useState({}),[_e,Ke]=p.useState({}),[Je,bt]=p.useState(null),ft=p.useCallback((Ce,De)=>{Oe(Ie=>{if(De===void 0){if(!(Ce in Ie))return Ie;const Qe={...Ie};return delete Qe[Ce],Qe}return Ie[Ce]===De?Ie:{...Ie,[Ce]:De}})},[]),kt=p.useCallback(Ce=>{ft(Ce,void 0)},[ft]),Pe=p.useCallback((Ce,De)=>{Ke(Ie=>{if(De===void 0){if(!(Ce in Ie))return Ie;const Qe={...Ie};return delete Qe[Ce],Qe}return Ie[Ce]===De?Ie:{...Ie,[Ce]:De}})},[]),Xe=(Ce,De)=>{const Ie=B(Ce),Qe=g?.key===Ie,Et=De?.disableInline?!1:Qe,vt=!(!De?.forceStill&&!!a&&(Et||l===Ie)),Yt=Et?g?.nonce??0:0,Ft=!!De?.forceLoadStill,zt=De?.forceStill?!1:De?.mobileStackTopOnlyVideo?i!=="still":i==="all"?!0:i==="hover"?f===Ie:!1,At=_.has(Ie)||S.has(Ie)||C.has(Ie),Nt=Q(Ce.output),ln=G(Ce.output||""),dn=$r(ln.replace(/\.[^.]+$/,"")).trim(),yt=W(Nt),Fn=F[yt],ot=Ge(Ce),N=Le(Ce),P=ut[Ie],ne=_e[Ie]===!0,je=QN(ot?.previewSprite?.path,ot?.previewSpritePath,Fn?.previewScrubberPath,dn?`/api/preview-sprite/${encodeURIComponent(dn)}`:void 0),qe=je?je.replace(/\/+$/,""):void 0,dt=ot?.previewSprite?.stepSeconds??ot?.previewSpriteStepSeconds,$t=typeof dt=="number"&&Number.isFinite(dt)&&dt>0?dt:N?.stepSeconds&&N.stepSeconds>0?N.stepSeconds:ZN,Zt=N0(ot?.durationSeconds)??N0(Ce?.durationSeconds)??N0(h[Ie]),hn=typeof Zt=="number"&&Zt>0?Math.max(1,Math.min(200,Math.floor(Zt/$t)+1)):void 0,Qt=ot?.previewSprite?.count??ot?.previewSpriteCount??Fn?.previewScrubberCount??hn,vn=ot?.previewSprite?.cols??ot?.previewSpriteCols,Tn=ot?.previewSprite?.rows??ot?.previewSpriteRows,Wt=typeof Qt=="number"&&Number.isFinite(Qt)?Math.max(0,Math.floor(Qt)):0,[gn,sn]=Wt>1?JN(Wt):[0,0],an=Number(vn),Bt=Number(Tn),Dt=Number.isFinite(an)&&Number.isFinite(Bt)&&an>0&&Bt>0&&!(Wt>1&&an===1&&Bt===1)&&(Wt<=1||an*Bt>=Wt),jt=Dt?Math.floor(an):gn,Dn=Dt?Math.floor(Bt):sn,Mt=(typeof ot?.updatedAtUnix=="number"&&Number.isFinite(ot.updatedAtUnix)?ot.updatedAtUnix:void 0)??(typeof ot?.fileModUnix=="number"&&Number.isFinite(ot.fileModUnix)?ot.fileModUnix:void 0)??L??0,Hn=qe&&Mt?`${qe}?v=${encodeURIComponent(String(Mt))}`:qe||void 0,In=!!Hn&&Wt>1,Sn=In&&jt>0&&Dn>0,Xt=In?Wt:0,Un=In?$t:0,Yn=typeof P=="number"&&Xt>1?B1(P/(Xt-1),0,1):void 0,Cn=Sn&&typeof P=="number"?(()=>{const mt=B1(P,0,Math.max(0,Wt-1)),Rt=mt%jt,Ne=Math.floor(mt/jt),pt=jt<=1?0:Rt/(jt-1)*100,xt=Dn<=1?0:Ne/(Dn-1)*100;return{backgroundImage:`url("${Hn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${jt*100}% ${Dn*100}%`,backgroundPosition:`${pt}% ${xt}%`}})():void 0,ti=au(ln),wn=!!Fn?.favorite,ui=Fn?.liked===!0,ri=!!Fn?.watching,Qn=YN(Fn?.tags),Zn=H(Ce),xi=Y(se(Ce)),Mn=Te(Ce),jn=cd(Mn),qn=`inline-prev-${encodeURIComponent(Ie)}`,xe=["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",At&&"pointer-events-none opacity-70",_.has(Ie)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",S.has(Ie)&&"ring-1 ring-emerald-300 bg-emerald-50/60 dark:bg-emerald-500/10 dark:ring-emerald-500/30",C.has(Ie)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),it=c.jsx("div",{role:"button",tabIndex:0,className:xe,onClick:e?void 0:()=>k(Ce),onKeyDown:mt=>{(mt.key==="Enter"||mt.key===" ")&&(mt.preventDefault(),ae(Ce))},children:c.jsx(e3,{blurred:De?.blur,animateUnblurOnMount:De?.animateUnblurOnMount,children:c.jsxs(Ns,{noBodyPadding:!0,className:"overflow-hidden bg-transparent",children:[c.jsx("div",{id:qn,ref:De?.disableInline||De?.isDecorative?void 0:te(Ie),className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:e||De?.disablePreviewHover?void 0:()=>{bt(Ie),O?.(Ie)},onMouseLeave:()=>{!e&&!De?.disablePreviewHover&&O?.(null),bt(mt=>mt===Ie?null:mt),kt(Ie),Pe(Ie,!1)},onClick:mt=>{mt.preventDefault(),mt.stopPropagation(),!(e||De?.disableInline)&&Z(Ie)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[Et?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 "+(Et?"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:[Zn,Mn?`${Mn.w}×${Mn.h}`:jn||"",xi].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Zn}),jn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,jn?c.jsx("span",{children:jn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:xi})]})}),c.jsx(vu,{job:Ce,getFileName:mt=>$r(G(mt)),className:"h-full w-full",variant:"fill",durationSeconds:h[Ie]??Ce?.durationSeconds,onDuration:me,showPopover:!1,blur:Et?!1:!!u,animated:zt,animatedMode:"teaser",animatedTrigger:"always",inlineVideo:!De?.disableInline&&Et?"always":!1,inlineNonce:Yt,inlineControls:Et,inlineLoop:!1,muted:vt,popoverMuted:vt,assetNonce:L??0,alwaysLoadStill:Ft,teaserPreloadEnabled:De?.mobileStackTopOnlyVideo||De?.preloadTeaserWhenStill?!0:!e,teaserPreloadRootMargin:De?.preloadTeaserWhenStill?"1200px 0px":e?"900px 0px":"700px 0px",scrubProgressRatio:Yn,preferScrubProgress:ne&&typeof P=="number"}),Sn&&Hn?c.jsx("img",{src:Hn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Sn&&Cn&&!Et?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:Cn})}):null,!De?.isDecorative&&!De?.disableScrubber&&!Et&&Xt>1&&Je===Ie?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(),onMouseEnter:()=>Pe(Ie,!0),onMouseLeave:()=>{Pe(Ie,!1),ft(Ie,void 0)},children:c.jsx(yy,{className:"pointer-events-auto px-1",imageCount:Xt,activeIndex:P,onActiveIndexChange:mt=>ft(Ie,mt),onIndexClick:mt=>{if(e||De?.disableInline){E(Ce,mt,Xt);return}const Rt=Un>0?mt*Un:0;if(j){j(Ie,Rt,qn),requestAnimationFrame(()=>{V(qn)||requestAnimationFrame(()=>V(qn))});return}Z(Ie),requestAnimationFrame(()=>{V(qn)||requestAnimationFrame(()=>V(qn))})},stepSeconds:Un})}):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:Nt}),c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[ti?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(ln)||"—"})]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 pt-0.5",children:[ri?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,ui?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,wn?c.jsx(bu,{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:Ce,variant:"table",busy:At,collapseToMenu:!0,compact:!1,isHot:ti,isFavorite:wn,isLiked:ui,isWatching:ri,onToggleWatch:we,onToggleFavorite:I,onToggleLike:pe,onToggleHot:de,onKeep:q,onDelete:le,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(ud,{rowKey:Ie,tags:Qn,activeTagSet:ee,lower:W,onToggleTagFilter:ie})})]})]})})});return{k:Ie,j:Ce,busy:At,isHot:ti,inlineDomId:qn,cardInner:it}},st=3,Ze=e?n.slice(0,st):[],wt=e?n.slice(st,st+4):[],fe=15,He=Math.min(Ze.length,st)-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:He>0?`${He}px`:void 0},children:(()=>{const Ce=Ze,De=Ce[0],Ie=Ce.slice(1);return c.jsxs(c.Fragment,{children:[Ie.map((Qe,Et)=>{const It=Et+1,{k:vt,cardInner:Yt}=Xe(Qe,{forceStill:!0,disableInline:!0,disablePreviewHover:!0,isDecorative:!0,forceLoadStill:!0,blur:!0,preloadTeaserWhenStill:!0}),Ft=It,zt=-(Ft*fe),At=1-Ft*.03,Nt=1-Ft*.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-Ft,transform:`translateY(${zt}px) scale(${At}) translateZ(0)`,opacity:Nt,transformOrigin:"top center"},"aria-hidden":"true",children:c.jsxs("div",{className:"relative",children:[Yt,c.jsx("div",{className:"absolute inset-0 rounded-lg bg-white/8 dark:bg-black/8"})]})},vt)}).reverse(),De?(()=>{const Qe=De,{k:Et,busy:It,isHot:vt,cardInner:Yt,inlineDomId:Ft}=Xe(Qe,{forceLoadStill:!0,mobileStackTopOnlyVideo:!0,disableScrubber:!0,animateUnblurOnMount:!0});return c.jsx("div",{className:"relative touch-pan-y",style:{zIndex:30},children:c.jsx(t3,{animateOnMount:!0,children:c.jsx($N,{ref:zt=>{zt?M.current.set(Et,zt):M.current.delete(Et)},enabled:!0,disabled:It,ignoreFromBottomPx:110,doubleTapMs:360,doubleTapMaxMovePx:48,onDoubleTap:async()=>{if(!vt){if(ht){ht(Qe);return}await de?.(Qe)}},onTap:()=>{Z(Et),requestAnimationFrame(()=>{V(Ft)||requestAnimationFrame(()=>V(Ft))})},onSwipeLeft:()=>ve?ve(Qe):le(Qe),onSwipeRight:()=>ge?ge(Qe):q(Qe),children:Yt})})},Et)})():null]})})()}),wt.length>0?c.jsx("div",{className:"sr-only","aria-hidden":"true",children:wt.map(Ce=>{const De=B(Ce);return c.jsx("div",{className:"relative aspect-video",children:c.jsx(vu,{job:Ce,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:L??0,alwaysLoadStill:!0})},`preload-still-${De}`)})}):null]})}):c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(Ce=>{const{k:De,cardInner:Ie}=Xe(Ce);return c.jsx(p.Fragment,{children:Ie},De)})}),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 i3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const r3=p.forwardRef(i3);function s3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M11.78 5.22a.75.75 0 0 1 0 1.06L8.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06l-4.25-4.25a.75.75 0 0 1 0-1.06l4.25-4.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const a3=p.forwardRef(s3);function o3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{fillRule:"evenodd",d:"M8.22 5.22a.75.75 0 0 1 1.06 0l4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06-1.06L11.94 10 8.22 6.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const l3=p.forwardRef(o3);function u3({title:n,titleId:e,...t},i){return p.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:i,"aria-labelledby":e},t),n?p.createElement("title",{id:e},n):null,p.createElement("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"}))}const P1=p.forwardRef(u3);function Ur(...n){return n.filter(Boolean).join(" ")}function F1(n){return n==="center"?"text-center":n==="right"?"text-right":"text-left"}function c3(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 ed({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:M,rowClassName:L,onRowClick:E,onRowContextMenu:B,sort:G,onSortChange:Q,defaultSort:H=null}){const se=_?"py-2":"py-4",Y=_?"py-3":"py-3.5",W=G!==void 0,[O,ae]=p.useState(H),k=W?G:O,j=p.useCallback(V=>{W||ae(V),Q?.(V)},[W,Q]),Z=p.useMemo(()=>{if(!k)return e;const V=n.find(le=>le.key===k.key);if(!V)return e;const te=k.direction==="asc"?1:-1,me=e.map((le,q)=>({r:le,i:q}));return me.sort((le,q)=>{let F=0;if(V.sortFn)F=V.sortFn(le.r,q.r);else{const ee=V.sortValue?V.sortValue(le.r):le.r?.[V.key],ie=V.sortValue?V.sortValue(q.r):q.r?.[V.key],de=z1(ee),I=z1(ie);de.isNull&&!I.isNull?F=1:!de.isNull&&I.isNull?F=-1:de.kind==="number"&&I.kind==="number"?F=de.value<I.value?-1:de.value>I.value?1:0:F=String(de.value).localeCompare(String(I.value),void 0,{numeric:!0})}return F===0?le.i-q.i:F*te}),me.map(le=>le.r)},[e,n,k]);return c.jsxs("div",{className:Ur(u?"":"px-4 sm:px-6 lg:px-8",M),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:Ur(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:Ur("inline-block min-w-full align-middle",u?"":"sm:px-6 lg:px-8"),children:c.jsx("div",{className:Ur(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:Ur(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,te)=>{const me=U1(te,n.length),le=!!k&&k.key===V.key,q=le?k.direction:void 0,F=V.sortable&&!V.srOnlyHeader?le?q==="asc"?"ascending":"descending":"none":void 0,ee=()=>{if(!(!V.sortable||V.srOnlyHeader))return j(le?q==="asc"?{key:V.key,direction:"desc"}:null:{key:V.key,direction:"asc"})};return c.jsx("th",{scope:"col","aria-sort":F,className:Ur(Y,me,"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:ee,className:Ur("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",c3(V.align)),children:[c.jsx("span",{children:V.header}),c.jsx("span",{className:Ur("flex-none rounded-sm text-gray-400 dark:text-gray-500",le?"bg-gray-100 text-gray-900 dark:bg-gray-800 dark:text-white":"invisible group-hover:visible group-focus-visible:visible"),children:c.jsx(r3,{"aria-hidden":"true",className:Ur("size-5 transition-transform",le&&q==="asc"&&"rotate-180")})})]}):V.header},V.key)})})}),c.jsx("tbody",{className:Ur("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:Ur(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:"Lädt…"})}):Z.length===0?c.jsx("tr",{children:c.jsx("td",{colSpan:n.length,className:Ur(se,"px-2 text-sm text-gray-500 dark:text-gray-400"),children:C})}):Z.map((V,te)=>{const me=t?t(V,te):String(te);return c.jsx("tr",{className:Ur(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",L?.(V,te)),onClick:()=>E?.(V),onContextMenu:B?le=>{le.preventDefault(),B(V,le)}:void 0,children:n.map((le,q)=>{const F=U1(q,n.length),ee=le.cell?.(V,te)??le.accessor?.(V)??V?.[le.key];return c.jsx("td",{className:Ur(se,F,"text-sm whitespace-nowrap",F1(le.align),le.className,le.key===n[0]?.key?"font-medium text-gray-900 dark:text-white":"text-gray-500 dark:text-gray-400"),children:ee},le.key)})},me)})})]})})})})})})]})}function d3({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:M,setHoverTeaserKey:L,teaserPlayback:E="hover",teaserKey:B,registerTeaserHost:G,handleDuration:Q,handleResolution:H,blurPreviews:se,assetNonce:Y,deletingKeys:W,keepingKeys:O,removingKeys:ae,modelsByKey:k,activeTagSet:j,onToggleTagFilter:Z,onOpenPlayer:V,onSortModeChange:te,page:me,onPageChange:le,onToggleHot:q,onToggleFavorite:F,onToggleLike:ee,onToggleWatch:ie,deleteVideo:de,keepVideo:I,enqueueDeleteVideo:pe,enqueueKeepVideo:we,enqueueToggleHot:ve}){const[ge,ht]=p.useState(null),Ge=p.useCallback(Pe=>{const Xe=Pe?.durationSeconds;if(typeof Xe=="number"&&Number.isFinite(Xe)&&Xe>0)return Xe;const st=Date.parse(String(Pe?.startedAt||"")),Ze=Date.parse(String(Pe?.endedAt||""));if(Number.isFinite(st)&&Number.isFinite(Ze)&&Ze>st){const nt=(Ze-st)/1e3;if(nt>=1&&nt<=1440*60)return nt}return Number.POSITIVE_INFINITY},[]),Te=p.useCallback(Pe=>{const Xe=String(Pe??"").trim();if(!Xe)return[];const st=Xe.split(/[\n,;|]+/g).map(wt=>wt.trim()).filter(Boolean),Ze=new Set,nt=[];for(const wt of st){const fe=wt.toLowerCase();Ze.has(fe)||(Ze.add(fe),nt.push(wt))}return nt.sort((wt,fe)=>wt.localeCompare(fe,void 0,{sensitivity:"base"})),nt},[]),Le=p.useCallback(Pe=>{const Xe=Pe?.meta;if(!Xe)return null;if(typeof Xe=="string")try{return JSON.parse(Xe)}catch{return null}return Xe},[]),ut=p.useCallback(Pe=>{const Xe=Le(Pe);let st=Xe?.previewSprite??Xe?.preview?.sprite??null;if(typeof st=="string")try{st=JSON.parse(st)}catch{st=null}const Ze=Number(st?.count),nt=Number(st?.stepSeconds);return!Number.isFinite(Ze)||Ze<2?null:{count:Math.max(2,Math.floor(Ze)),stepSeconds:Number.isFinite(nt)&&nt>0?nt:5}},[Le]),[Oe,_e]=p.useState({}),Ke=p.useCallback((Pe,Xe)=>{_e(st=>st[Pe]===Xe?st:{...st,[Pe]:Xe})},[]),Je=p.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[140px]",cell:Pe=>{const Xe=t(Pe),Ze=!(!!C&&M===Xe),nt=ut(Pe),wt=Oe[Xe],fe=i(Pe.output||""),He=$r(fe.replace(/\.[^.]+$/,"")).trim(),Ce=nt&&typeof wt=="number"?Math.max(0,wt*nt.stepSeconds):void 0,De=He&&typeof Ce=="number"?`/api/preview?id=${encodeURIComponent(He)}&t=${Ce.toFixed(3)}&v=${Y??0}`:"";return c.jsxs("div",{ref:G(Xe),className:"group relative py-1",onClick:Ie=>Ie.stopPropagation(),onMouseDown:Ie=>Ie.stopPropagation(),onMouseEnter:()=>{S&&L(Xe)},onMouseLeave:()=>{S&&L(null),Ke(Xe,void 0)},children:[c.jsx(vu,{job:Pe,getFileName:i,durationSeconds:_[Xe],muted:Ze,popoverMuted:Ze,onDuration:Q,onResolution:H,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===Xe:!1,animatedMode:"teaser",animatedTrigger:"always",assetNonce:Y}),nt&&typeof wt=="number"&&De?c.jsx("img",{src:De,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:Pe=>{const Xe=i(Pe.output||""),st=au(Xe),Ze=l(Pe.output),nt=$r(Xe);return`${Ze} ${st?"HOT":""} ${nt}`.trim()},cell:Pe=>{const Xe=i(Pe.output||""),st=au(Xe),Ze=$r(Xe),nt=l(Pe.output),wt=a(l(Pe.output)),fe=Te(k[wt]?.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:nt}),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:Ze,children:Ze||"—"}),(()=>{const He=t(Pe),Ce=g[He]??null,De=cd(Ce);return De?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:Ce?`${Ce.w}×${Ce.h}`:"Auflösung",children:De}):null})(),st?c.jsx("span",{className:"shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[11px] font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null]}),fe.length>0?c.jsx("div",{className:"mt-1",onClick:He=>He.stopPropagation(),onMouseDown:He=>He.stopPropagation(),children:c.jsx(ud,{rowKey:t(Pe),tags:fe,activeTagSet:j,lower:a,onToggleTagFilter:Z,maxWidthClassName:"max-w-[11rem]"})}):null]})]})}},{key:"completedAt",header:"Fertiggestellt am",sortable:!0,widthClassName:"w-[150px]",sortValue:Pe=>{const Xe=Date.parse(String(Pe.endedAt||""));return Number.isFinite(Xe)?Xe:Number.NEGATIVE_INFINITY},cell:Pe=>{const Xe=Date.parse(String(Pe.endedAt||""));if(!Number.isFinite(Xe))return c.jsx("span",{className:"text-xs text-gray-400",children:"—"});const st=new Date(Xe),Ze=st.toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",year:"numeric"}),nt=st.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"});return c.jsxs("time",{dateTime:st.toISOString(),title:`${Ze} ${nt}`,className:"tabular-nums whitespace-nowrap text-sm text-gray-900 dark:text-white",children:[c.jsx("span",{className:"font-medium",children:Ze}),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:nt})]})}},{key:"runtime",header:"Dauer",align:"right",sortable:!0,sortValue:Pe=>Ge(Pe),cell:Pe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:u(Pe)})},{key:"size",header:"Größe",align:"right",sortable:!0,sortValue:Pe=>{const Xe=h(Pe);return typeof Xe=="number"?Xe:Number.NEGATIVE_INFINITY},cell:Pe=>c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:f(h(Pe))})},{key:"actions",header:"Aktionen",align:"right",srOnlyHeader:!0,cell:Pe=>{const Xe=t(Pe),st=W.has(Xe)||O.has(Xe)||ae.has(Xe),Ze=i(Pe.output||""),nt=au(Ze),wt=a(l(Pe.output)),fe=k[wt],He=!!fe?.favorite,Ce=fe?.liked===!0,De=!!fe?.watching;return c.jsx(Ds,{job:Pe,variant:"table",busy:st,isHot:nt,isFavorite:He,isLiked:Ce,isWatching:De,onToggleWatch:ie,onToggleFavorite:F,onToggleLike:ee,onToggleHot:q?async Ie=>{if(!(ve&&ve(Ie)))return q(Ie)}:void 0,onKeep:async Ie=>we&&we(Ie)?!0:I(Ie),onDelete:async Ie=>pe&&pe(Ie)?!0:de(Ie),order:["watch","favorite","like","hot","details","add","keep","delete"],className:"flex items-center justify-end gap-1"})}}],[t,i,_,C,M,G,S,L,Q,H,se,E,B,Y,a,l,k,j,Z,g,W,O,ae,ut,Oe,Ke,ie,F,ee,q,I,de,h,f,u,Te,Ge]),bt=p.useCallback(Pe=>{if(!Pe)return"completed_desc";const Xe=Pe,st=String(Xe.key??Xe.columnKey??Xe.id??""),Ze=String(Xe.dir??Xe.direction??Xe.order??"").toLowerCase(),nt=Ze==="asc"||Ze==="1"||Ze==="true";return st==="completedAt"?nt?"completed_asc":"completed_desc":st==="runtime"?nt?"duration_asc":"duration_desc":st==="size"?nt?"size_asc":"size_desc":st==="Model"||st==="video"?nt?"file_asc":"file_desc":nt?"completed_asc":"completed_desc"},[]),ft=p.useCallback(Pe=>{ht(Pe),te(bt(Pe)),me!==1&&le(1)},[te,bt,me,le]),kt=p.useCallback(Pe=>{const Xe=t(Pe);return["transition-all duration-300",(W.has(Xe)||ae.has(Xe))&&"bg-red-50/60 dark:bg-red-500/10 pointer-events-none",W.has(Xe)&&"animate-pulse",(O.has(Xe)||ae.has(Xe))&&"pointer-events-none",O.has(Xe)&&"bg-emerald-50/60 dark:bg-emerald-500/10 animate-pulse",ae.has(Xe)&&"opacity-0"].filter(Boolean).join(" ")},[t,W,O,ae]);return c.jsxs("div",{className:"relative",children:[c.jsx(ed,{rows:n,columns:Je,getRowKey:Pe=>t(Pe),striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,sort:ge,onSortChange:ft,onRowClick:V,rowClassName:kt}),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 H1(...n){for(const e of n)if(typeof e=="string"){const t=e.trim();if(t)return t}}function h3(n){if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return null}return typeof n=="object"?n:null}function D0(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function $1(n,e,t){return Math.max(e,Math.min(t,n))}const f3=5;function m3(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:M,sizeBytesOf:L,formatBytes:E,deletingKeys:B,keepingKeys:G,removingKeys:Q,deletedKeys:H,registerTeaserHost:se,onHoverPreviewKeyChange:Y,onOpenPlayer:W,deleteVideo:O,keepVideo:ae,onToggleHot:k,lower:j,modelsByKey:Z,activeTagSet:V,onToggleTagFilter:te,onToggleFavorite:me,onToggleLike:le,onToggleWatch:q,enqueueDeleteVideo:F,enqueueKeepVideo:ee,enqueueToggleHot:ie}){const de=a==="hover"||a==="all",I=p.useCallback(_e=>Ke=>{if(!de){se(_e)(null);return}se(_e)(Ke)},[se,de]),pe=_e=>{const Ke=String(_e??"").trim();if(!Ke)return[];const Je=Ke.split(/[\n,;|]+/g).map(kt=>kt.trim()).filter(Boolean),bt=new Set,ft=[];for(const kt of Je){const Pe=kt.toLowerCase();bt.has(Pe)||(bt.add(Pe),ft.push(kt))}return ft},we=p.useCallback(_e=>{const Ke=(typeof _e?.meta?.videoWidth=="number"&&Number.isFinite(_e.meta.videoWidth)?_e.meta.videoWidth:0)||(typeof _e?.videoWidth=="number"&&Number.isFinite(_e.videoWidth)?_e.videoWidth:0),Je=(typeof _e?.meta?.videoHeight=="number"&&Number.isFinite(_e.meta.videoHeight)?_e.meta.videoHeight:0)||(typeof _e?.videoHeight=="number"&&Number.isFinite(_e.videoHeight)?_e.videoHeight:0);return Ke>0&&Je>0?{w:Ke,h:Je}:null},[]),[ve,ge]=p.useState(null),[ht,Ge]=p.useState({}),[Te,Le]=p.useState(null),ut=p.useCallback((_e,Ke)=>{Ge(Je=>{if(Ke===void 0){if(!(_e in Je))return Je;const bt={...Je};return delete bt[_e],bt}return Je[_e]===Ke?Je:{...Je,[_e]:Ke}})},[]),Oe=p.useCallback(_e=>{ut(_e,void 0)},[ut]);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(_e=>{const Ke=_(_e),bt=!(!!l&&u===Ke),ft=C(_e.output),kt=j(ft),Pe=Z[kt],Xe=!!Pe?.favorite,st=Pe?.liked===!0,Ze=!!Pe?.watching,nt=pe(Pe?.tags),wt=S(_e.output||""),fe=au(wt),He=$r(wt),Ce=M(_e),De=E(L(_e)),Ie=we(_e),Qe=cd(Ie),Et=B.has(Ke)||G.has(Ke)||Q.has(Ke),It=H.has(Ke),vt=H1(Pe?.image,Pe?.imageUrl,_e?.meta?.modelImage,_e?.meta?.modelImageUrl),Ft=$r(S(_e.output||"")).replace(/\.[^.]+$/,"").trim(),zt=h3(_e?.meta),At=H1(zt?.previewSprite?.path,zt?.previewSpritePath,Pe?.previewScrubberPath,Ft?`/api/preview-sprite/${encodeURIComponent(Ft)}`:void 0),Nt=At?At.replace(/\/+$/,""):void 0,ln=zt?.previewSprite?.stepSeconds??zt?.previewSpriteStepSeconds,dn=typeof ln=="number"&&Number.isFinite(ln)&&ln>0?ln:f3,yt=D0(zt?.durationSeconds)??D0(_e?.durationSeconds)??D0(i[Ke]),Fn=typeof yt=="number"&&yt>0?Math.max(1,Math.min(200,Math.floor(yt/dn)+1)):void 0,ot=zt?.previewSprite?.count??zt?.previewSpriteCount??Pe?.previewScrubberCount??Fn,N=zt?.previewSprite?.cols??zt?.previewSpriteCols,P=zt?.previewSprite?.rows??zt?.previewSpriteRows,ne=typeof ot=="number"&&Number.isFinite(ot)?Math.max(0,Math.floor(ot)):0,[je,qe]=ne>1?m3(ne):[0,0],dt=typeof N=="number"&&Number.isFinite(N)?Math.max(0,Math.floor(N)):je,$t=typeof P=="number"&&Number.isFinite(P)?Math.max(0,Math.floor(P)):qe,Zt=(typeof zt?.updatedAtUnix=="number"&&Number.isFinite(zt.updatedAtUnix)?zt.updatedAtUnix:void 0)??(typeof zt?.fileModUnix=="number"&&Number.isFinite(zt.fileModUnix)?zt.fileModUnix:void 0)??0,hn=Nt&&Zt?`${Nt}?v=${encodeURIComponent(String(Zt))}`:Nt||void 0,Qt=!!hn&&ne>1,vn=Qt&&dt>0&&$t>0,Tn=Qt?ne:0,Wt=Qt?dn:0,gn=Qt,sn=ht[Ke],an=typeof sn=="number"&&Tn>1?$1(sn/(Tn-1),0,1):void 0,Bt=vn&&typeof sn=="number"?(()=>{const Mt=$1(sn,0,Math.max(0,ne-1)),Hn=Mt%dt,In=Math.floor(Mt/dt),Sn=dt<=1?0:Hn/(dt-1)*100,Xt=$t<=1?0:In/($t-1)*100;return{backgroundImage:`url("${hn}")`,backgroundRepeat:"no-repeat",backgroundSize:`${dt*100}% ${$t*100}%`,backgroundPosition:`${Sn}% ${Xt}%`}})():void 0,Dt=ve===Ke&&!!vt,jt=!Dt&&!!Bt,Dn=Dt||jt;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",Et&&"pointer-events-none opacity-70",B.has(Ke)&&"ring-1 ring-red-300 bg-red-50/60 dark:bg-red-500/10 dark:ring-red-500/30",Q.has(Ke)&&"opacity-0 translate-y-2 scale-[0.98]",It&&"hidden"].filter(Boolean).join(" "),onClick:()=>W(_e),onKeyDown:Mt=>{(Mt.key==="Enter"||Mt.key===" ")&&W(_e)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",ref:I(Ke),onMouseEnter:()=>{Le(Ke),Y?.(Ke)},onMouseLeave:()=>{Le(Mt=>Mt===Ke?null:Mt),Y?.(null),Oe(Ke),ge(Mt=>Mt===Ke?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(vu,{job:_e,getFileName:Mt=>$r(S(Mt)),durationSeconds:i[Ke]??_e?.durationSeconds,onDuration:f,variant:"fill",showPopover:!1,blur:t,animated:Dn?!1:a==="all"?!0:a==="hover"?h===Ke:!1,animatedMode:"teaser",animatedTrigger:"always",muted:bt,popoverMuted:bt,scrubProgressRatio:an,preferScrubProgress:typeof sn=="number"})}),vn&&hn?c.jsx("img",{src:hn,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,jt&&Bt?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:Bt})}):null,Dt&&vt?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:vt,alt:ft?`${ft} 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,gn&&Te===Ke?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(yy,{className:"pointer-events-auto px-1",imageCount:Tn,activeIndex:sn,onActiveIndexChange:Mt=>ut(Ke,Mt),onIndexClick:Mt=>{ut(Ke,Mt),g(_e,Mt,Tn)},stepSeconds:Wt})}):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:[Ce,Ie?`${Ie.w}×${Ie.h}`:Qe||"",De].filter(Boolean).join(" • "),children:[c.jsx("span",{children:Ce}),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:De})]})})]})}),c.jsxs("div",{className:"relative min-h-[118px] px-4 py-3 rounded-b-lg border-t border-black/5 dark:border-white/10 bg-white dark:bg-gray-900",children:[c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"mt-0.5 flex items-start gap-2 min-w-0",children:[fe?c.jsx("span",{className:"shrink-0 self-start rounded bg-amber-500/15 px-1.5 py-0.5 text-[11px] leading-none font-semibold text-amber-800 dark:text-amber-300",children:"HOT"}):null,c.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-gray-900 dark:text-white",title:$r(He)||"—",children:$r(He)||"—"})]})}),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",vt?"cursor-zoom-in hover:text-gray-700 dark:hover:text-gray-200":""].filter(Boolean).join(" "),title:vt?`${ft} (Hover: Model-Preview)`:ft,onMouseEnter:Mt=>{Mt.stopPropagation(),vt&&ge(Ke)},onMouseLeave:Mt=>{Mt.stopPropagation(),ge(Hn=>Hn===Ke?null:Hn)},onMouseDown:Mt=>Mt.stopPropagation(),onClick:Mt=>Mt.stopPropagation(),children:ft||"—"})}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[Ze?c.jsx(gl,{className:"size-4 text-sky-600 dark:text-sky-300"}):null,st?c.jsx(yl,{className:"size-4 text-rose-600 dark:text-rose-300"}):null,Xe?c.jsx(bu,{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:_e,variant:"table",busy:Et,collapseToMenu:!0,compact:!0,isHot:fe,isFavorite:Xe,isLiked:st,isWatching:Ze,onToggleWatch:q,onToggleFavorite:me,onToggleLike:le,onToggleHot:async Mt=>{if(!(ie&&ie(Mt)))return k(Mt)},onKeep:async Mt=>ee&&ee(Mt)?!0:ae(Mt),onDelete:async Mt=>F&&F(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(ud,{rowKey:Ke,tags:nt,activeTagSet:V,lower:j,onToggleTagFilter:te})})]})]},Ke)})}),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 M0(n,e){const t=[];for(let i=n;i<=e;i++)t.push(i);return t}function g3(n,e,t,i){if(n<=1)return[1];const a=1,l=n,u=M0(a,Math.min(t,l)),h=M0(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(...M0(f,g)),g<l-t?_.push("ellipsis"):l-t>t&&_.push(l-t),_.push(...h);const S=new Set;return _.filter(C=>{const M=String(C);return S.has(M)?!1:(S.add(M),!0)})}function y3({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:rn("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 Sf({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 M=t===0?0:(C-1)*e+1,L=Math.min(C*e,t),E=g3(S,C,l,a),B=G=>i(q1(G,1,S));return c.jsxs("div",{className:rn("flex items-center justify-between bg-transparent dark:border-white/10",h),children:[c.jsxs("div",{className:"flex flex-1 justify-between sm:hidden",children:[c.jsx("button",{type:"button",onClick:()=>B(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:M})," to"," ",c.jsx("span",{className:"font-medium",children:L})," 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(a3,{"aria-hidden":"true",className:"size-5"})]}),E.map((G,Q)=>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-${Q}`):c.jsx(y3,{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(l3,{"aria-hidden":"true",className:"size-5"})]})]})})]})]})}const Ow=p.createContext(null),j0=220;function b3(n){switch(n){case"success":return{Icon:FA,cls:"text-emerald-600 dark:text-emerald-400"};case"error":return{Icon:vN,cls:"text-rose-600 dark:text-rose-400"};case"warning":return{Icon:VA,cls:"text-amber-600 dark:text-amber-400"};default:return{Icon:ZA,cls:"text-sky-600 dark:text-sky-400"}}}function v3(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 x3(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 _3(n){switch(n){case"success":return"Erfolg";case"error":return"Fehler";case"warning":return"Hinweis";default:return"Info"}}function w3(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function T3({children:n,maxToasts:e=3,defaultDurationMs:t=3500,position:i="bottom-right"}){const[a,l]=p.useState([]),[u,h]=p.useState(!0),f=p.useRef({}),g=p.useRef({}),_=p.useRef({}),S=p.useRef({}),C=p.useRef({}),M=p.useCallback(k=>{const j=f.current[k];j&&(window.clearTimeout(j),delete f.current[k]);const Z=g.current[k];Z&&(window.clearTimeout(Z),delete g.current[k]),delete _.current[k],delete S.current[k],delete C.current[k]},[]),L=p.useCallback(async()=>{try{const k=await fetch("/api/settings",{cache:"no-store"});if(!k.ok)return;const j=await k.json();h(!!(j?.enableNotifications??!0))}catch{}},[]);p.useEffect(()=>{L();const k=()=>L();return window.addEventListener("recorder-settings-updated",k),()=>window.removeEventListener("recorder-settings-updated",k)},[L]),p.useEffect(()=>{u||(l(j=>j.map(Z=>Z.type==="error"?Z:{...Z,open:!1})),a.filter(j=>j.type!=="error").map(j=>j.id).forEach(j=>{M(j),g.current[j]=window.setTimeout(()=>{l(Z=>Z.filter(V=>V.id!==j)),delete g.current[j]},j0)}))},[u]);const E=p.useCallback(k=>{l(j=>j.map(Z=>Z.id===k?{...Z,open:!1}:Z)),M(k),g.current[k]=window.setTimeout(()=>{l(j=>j.filter(Z=>Z.id!==k)),delete g.current[k]},j0)},[M]),B=p.useCallback(()=>{l(k=>k.map(j=>({...j,open:!1}))),Object.keys(f.current).forEach(k=>{window.clearTimeout(f.current[k]),delete f.current[k]}),Object.keys(g.current).forEach(k=>{window.clearTimeout(g.current[k]),delete g.current[k]}),window.setTimeout(()=>l([]),j0)},[]),G=p.useCallback((k,j)=>{if(!j||j<=0)return;const Z=f.current[k];Z&&(window.clearTimeout(Z),delete f.current[k]),_.current[k]=Date.now(),S.current[k]=j,C.current[k]=!1,f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]),Q=p.useCallback(k=>{if(!u&&k.type!=="error")return"";const j=w3(),Z=k.durationMs??t;return l(V=>{const te=[{...k,id:j,durationMs:Z,open:!0},...V],me=Math.max(1,e),le=te.slice(0,me);return te.slice(me).forEach(F=>M(F.id)),le}),Z&&Z>0&&G(j,Z),j},[t,e,u,M,G]),H=p.useCallback(k=>{if(C.current[k])return;const j=f.current[k];if(!j)return;window.clearTimeout(j),delete f.current[k];const Z=_.current[k]??Date.now(),V=S.current[k]??0,te=Date.now()-Z,me=Math.max(0,V-te);S.current[k]=me,C.current[k]=!0},[]),se=p.useCallback(k=>{if(!C.current[k])return;const j=S.current[k]??0;if(j<=0){E(k);return}C.current[k]=!1,_.current[k]=Date.now(),f.current[k]=window.setTimeout(()=>{E(k),delete f.current[k],delete _.current[k],delete S.current[k],delete C.current[k]},j)},[E]);p.useEffect(()=>()=>{Object.values(f.current).forEach(k=>window.clearTimeout(k)),Object.values(g.current).forEach(k=>window.clearTimeout(k))},[]);const Y=p.useMemo(()=>({push:Q,remove:E,clear:B}),[Q,E,B]),W=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",ae=i.startsWith("top")?"top-0 bottom-auto":"bottom-0 top-auto";return c.jsxs(Ow.Provider,{value:Y,children:[n,c.jsx("style",{children:`
|
||
@keyframes toast-progress {
|
||
from { transform: scaleX(1); }
|
||
to { transform: scaleX(0); }
|
||
}
|
||
|
||
.toast-progress-bar {
|
||
animation-name: toast-progress;
|
||
animation-timing-function: linear;
|
||
animation-fill-mode: forwards;
|
||
transform-origin: left center;
|
||
will-change: transform;
|
||
}
|
||
`}),c.jsx("div",{"aria-live":"assertive",className:["pointer-events-none fixed z-[80] inset-x-0",ae].join(" "),children:c.jsx("div",{className:["flex w-full px-3 py-4 sm:px-6 sm:py-6",W].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:Z}=b3(k.type),V=x3(k.type),te=(k.title||"").trim()||_3(k.type),me=(k.message||"").trim(),le=(k.imageUrl||"").trim(),q=(k.imageAlt||te).trim(),F=typeof k.onClick=="function";return c.jsx(Zc,{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:F?"button":"status",className:["pointer-events-auto relative w-[22rem] max-w-[calc(100vw-1.5rem)] overflow-hidden rounded-xl","border bg-white dark:bg-slate-900","shadow-sm","ring-1 ring-black/5 dark:ring-white/5",F?"cursor-pointer transition-[box-shadow,transform,background-color] duration-150 hover:bg-gray-50 dark:hover:bg-slate-800/90 hover:shadow-lg hover:ring-black/10 dark:hover:ring-white/10 active:scale-[0.998]":"",v3(k.type)].join(" "),onMouseEnter:()=>H(k.id),onMouseLeave:()=>se(k.id),onFocus:()=>H(k.id),onBlur:()=>se(k.id),onClick:()=>{k.onClick&&(k.onClick(),k.closeOnClick!==!1&&E(k.id))},onKeyDown:ee=>{k.onClick&&(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),k.onClick(),k.closeOnClick!==!1&&E(k.id))},tabIndex:F?0:void 0,"aria-label":F?`${te} öffnen`:void 0,children:le?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:le,alt:q,loading:"lazy",referrerPolicy:"no-referrer",className:["h-full min-h-[72px] w-16 sm:w-[72px]","object-cover object-center","rounded-l-xl","border-r border-black/5 dark:border-white/10","bg-gray-100 dark:bg-white/5"].join(" ")})}),c.jsxs("div",{className:"min-w-0 flex-1 py-3 pl-3 pr-2 sm:py-3.5 sm:pl-3.5 sm:pr-3",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:te}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:ee=>{ee.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",Z].join(" "),"aria-hidden":"true"})})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-gray-900 dark:text-white",children:te}),me?c.jsx("p",{className:"mt-0.5 text-sm leading-5 text-gray-600 dark:text-gray-300 break-words",children:me}):null]})]}),c.jsxs("button",{type:"button",onClick:ee=>{ee.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 S3(){const n=p.useContext(Ow);if(!n)throw new Error("useToast must be used within <ToastProvider>");return n}function Lw(){const{push:n,remove:e,clear:t}=S3(),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 k3(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=k3(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 by=n=>(n||"").replaceAll("\\","/"),sr=n=>{const t=by(n).split("/");return t[t.length-1]||""},bi=n=>{const e=n?.id;return e!=null&&String(e).trim()!==""?String(e):sr(n.output||"")||String(n?.output||"")},E3=n=>{const e=by(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 R0(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]=p.useState(!1);return p.useEffect(()=>{const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}const Oc=n=>{const e=sr(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(),C3=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},O0=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 A3(n){return n instanceof Error?n.message||String(n):String(n??"")}function Y1(n){const e=A3(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 L0(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 N3(){const n=p.useRef([]),e=p.useRef(!1),t=p.useRef(!1),i=p.useRef(new Set),a=p.useCallback(()=>{if(t.current)return;t.current=!0;const f=()=>{t.current=!1,l()};typeof window<"u"&&"requestIdleCallback"in window?window.requestIdleCallback(f,{timeout:250}):setTimeout(f,0)},[]),l=p.useCallback(async()=>{if(!e.current){e.current=!0;try{for(;n.current.length>0;){const f=n.current.shift();if(f){try{await f.run()}finally{i.current.delete(f.id)}await new Promise(g=>setTimeout(g,0))}}}finally{e.current=!1,n.current.length>0&&a()}}},[a]),u=p.useCallback((f,g)=>!f||i.current.has(f)?!1:(i.current.add(f),n.current.push({id:f,run:g}),a(),!0),[a]),h=p.useCallback(f=>i.current.has(f),[]);return{enqueue:u,isQueued:h}}function D3({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:M,pageSize:L,onPageChange:E,assetNonce:B,sortMode:G,onSortModeChange:Q,modelsByKey:H,loadMode:se="paged"}){const Y=se==="all",W=i??"hover",O=W1("(hover: hover) and (pointer: fine)"),ae=Lw(),k=N3(),j=p.useRef(new Map),[Z,V]=p.useState(null),[te,me]=p.useState(null),le=p.useRef(null),q=p.useRef(new WeakMap),[F,ee]=p.useState(()=>new Set),[ie,de]=p.useState(()=>new Set),[I,pe]=p.useState(!1),we=p.useRef(!1),ve=p.useRef(!1),ge=p.useRef(0),ht="finishedDownloads_lastUndo_v1",[Ge,Te]=p.useState(()=>{if(typeof window>"u")return null;try{const z=localStorage.getItem(ht);if(!z)return null;const K=JSON.parse(z);if(!K||K.v!==1||!K.action)return null;const re=Date.now()-Number(K.ts||0);return!Number.isFinite(re)||re<0||re>1800*1e3?(localStorage.removeItem(ht),null):K.action}catch{return null}}),[Le,ut]=p.useState(!1);p.useEffect(()=>{try{if(!Ge){localStorage.removeItem(ht);return}const z={v:1,action:Ge,ts:Date.now()};localStorage.setItem(ht,JSON.stringify(z))}catch{}},[Ge]);const[Oe,_e]=p.useState({}),[Ke,Je]=p.useState(null),[bt,ft]=p.useState(null),[kt,Pe]=p.useState(0),Xe=p.useRef(null),st=p.useRef({pending:0,t:0,timer:0}),Ze=p.useCallback(z=>{!z||!Number.isFinite(z)||(st.current.pending+=z,!st.current.timer&&(st.current.timer=window.setTimeout(()=>{st.current.timer=0;const K=st.current.pending;st.current.pending=0,K&&window.dispatchEvent(new CustomEvent("finished-downloads:count-hint",{detail:{delta:K}}))},120)))},[]),nt="finishedDownloads_view",wt="finishedDownloads_includeKeep_v2",fe="finishedDownloads_mobileOptionsOpen_v1",[He,Ce]=p.useState("table"),[De,Ie]=p.useState(!1),[Qe,Et]=p.useState(!1),It=p.useRef(new Map),[vt,Yt]=p.useState([]),Ft=p.useMemo(()=>new Set(vt.map(ns)),[vt]),zt=p.useMemo(()=>{const z={},K={};for(const[re,ye]of Object.entries(H??{})){const ze=ns(re),Me=C3(ye?.tags);z[ze]=Me,K[ze]=new Set(Me.map(ns))}return{tagsByModelKey:z,tagSetByModelKey:K}},[H]),[At,Nt]=p.useState(""),ln=p.useDeferredValue(At),dn=p.useMemo(()=>ns(ln).split(/\s+/g).map(z=>z.trim()).filter(Boolean),[ln]),yt=p.useCallback(()=>Nt(""),[]),Fn=p.useCallback(z=>{const K=ns(z);Yt(re=>re.some(ze=>ns(ze)===K)?re.filter(ze=>ns(ze)!==K):[...re,z])},[]),N=Ft.size>0||dn.some(z=>z.length>=2),P=N||Y,ne=p.useCallback(async z=>{const K=Ke==null;K&&pe(!0);try{const re=await fetch(`/api/record/done?all=1&sort=${encodeURIComponent(G)}&withCount=1${De?"&includeKeep=1":""}`,{cache:"no-store",signal:z});if(!re.ok)return;const ye=await re.json().catch(()=>null),ze=Array.isArray(ye?.items)?ye.items:[],Me=Number(ye?.count??ye?.totalCount??ze.length);Je(ze),ft(Number.isFinite(Me)?Me:ze.length)}finally{K&&pe(!1)}},[G,De]),je=p.useCallback(()=>Yt([]),[]);p.useEffect(()=>{try{const z=localStorage.getItem("finishedDownloads_pendingTags");if(!z)return;const K=JSON.parse(z),re=Array.isArray(K)?K.map(ye=>String(ye||"").trim()).filter(Boolean):[];if(re.length===0)return;gu.flushSync(()=>Yt(re)),M!==1&&E(1)}catch{}finally{try{localStorage.removeItem("finishedDownloads_pendingTags")}catch{}}},[]);const qe=p.useCallback(()=>{Xe.current==null&&(Xe.current=window.setTimeout(()=>{Xe.current=null,Pe(z=>z+1)},80))},[M,L,G,De]);p.useEffect(()=>{if(!P)return;const z=new AbortController,K=window.setTimeout(()=>{ne(z.signal).catch(()=>{})},250);return()=>{window.clearTimeout(K),z.abort()}},[P,ne]),p.useEffect(()=>{if(kt===0)return;const z=new AbortController;let K=!0,re=!1;const ye=++ge.current,ze=()=>{re||(re=!0,ge.current===ye&&(we.current=!1,ve.current&&(ve.current=!1,qe())))};return ge.current===ye&&(we.current=!0),P?((async()=>{try{await ne(z.signal),K&&(gn.current=0)}catch{}finally{K&&ze()}})(),()=>{K=!1,z.abort(),ze()}):(pe(!0),(async()=>{try{const Me=await fetch(`/api/record/done?page=${M}&pageSize=${L}&sort=${encodeURIComponent(G)}&withCount=1${De?"&includeKeep=1":""}`,{cache:"no-store",signal:z.signal});if(!K||z.signal.aborted)return;const et=Me.ok;if(Me.ok){const gt=await Me.json().catch(()=>null);if(!K||z.signal.aborted)return;const Tt=Array.isArray(gt?.items)?gt.items:Array.isArray(gt)?gt:[];Je(Tt);const Vt=Number(gt?.count??gt?.totalCount??Tt.length),Ut=Number.isFinite(Vt)&&Vt>=0?Vt:0;ft(Ut);const un=Math.max(1,Math.ceil(Ut/L));if(M>un){E(un),Je(null);return}}if(et)gn.current=0;else if(K&&!z.signal.aborted&&gn.current<2){gn.current+=1;const gt=gn.current;window.setTimeout(()=>{z.signal.aborted||Pe(Tt=>Tt+1)},400*gt)}}catch{}finally{K&&(pe(!1),ze())}})(),()=>{K=!1,z.abort(),ze()})},[kt,P,ne,M,L,G,De,E]),p.useEffect(()=>{P||(Je(null),ft(null))},[M,L,G,De,P]),p.useEffect(()=>{if(!De){N||(Je(null),ft(null));return}if(N)return;const z=new AbortController;return(async()=>{try{const K=await fetch(`/api/record/done?page=${M}&pageSize=${L}&sort=${encodeURIComponent(G)}&withCount=1&includeKeep=1`,{cache:"no-store",signal:z.signal});if(!K.ok)return;const re=await K.json().catch(()=>null),ye=Array.isArray(re?.items)?re.items:[],ze=Number(re?.count??re?.totalCount??ye.length);Je(ye),ft(Number.isFinite(ze)?ze:ye.length)}catch{}})(),()=>z.abort()},[De,N,M,L,G]),p.useEffect(()=>{try{const z=localStorage.getItem(nt);Ce(z==="table"||z==="cards"||z==="gallery"?z:window.matchMedia("(max-width: 639px)").matches?"cards":"table")}catch{Ce("table")}},[]),p.useEffect(()=>{try{localStorage.setItem(nt,He)}catch{}},[He]),p.useEffect(()=>{try{const z=localStorage.getItem(wt);Ie(z==="1"||z==="true"||z==="yes")}catch{Ie(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(wt,De?"1":"0")}catch{}},[De]),p.useEffect(()=>{try{const z=localStorage.getItem(fe);Et(z==="1"||z==="true"||z==="yes")}catch{Et(!1)}},[]),p.useEffect(()=>{try{localStorage.setItem(fe,Qe?"1":"0")}catch{}},[Qe]);const[dt,$t]=p.useState({}),Zt=p.useRef({}),hn=p.useRef(null),[Qt,vn]=p.useState({}),Tn=p.useRef({}),Wt=p.useRef(null),gn=p.useRef(0);p.useEffect(()=>{Tn.current=Qt},[Qt]);const sn=p.useCallback(()=>{Wt.current==null&&(Wt.current=window.setTimeout(()=>{Wt.current=null,vn({...Tn.current})},200))},[]);p.useEffect(()=>()=>{Wt.current!=null&&(window.clearTimeout(Wt.current),Wt.current=null)},[]),p.useEffect(()=>{Zt.current=dt},[dt]);const an=p.useCallback(()=>{hn.current==null&&(hn.current=window.setTimeout(()=>{hn.current=null,$t({...Zt.current})},200))},[]);p.useEffect(()=>()=>{hn.current!=null&&(window.clearTimeout(hn.current),hn.current=null)},[]);const[Bt,Dt]=p.useState(null),jt=!a,Dn=p.useCallback(z=>{const re=document.getElementById(z)?.querySelector("video");if(!re)return!1;ld(re,{muted:jt});const ye=re.play?.();return ye&&typeof ye.catch=="function"&&ye.catch(()=>{}),!0},[jt]),Mt=p.useCallback(z=>{Dt(K=>K?.key===z?{key:z,nonce:K.nonce+1}:{key:z,nonce:1})},[]),Hn=p.useCallback((z,K,re)=>{const ye=Number.isFinite(K)&&K>0?K:0;Dt(Me=>Me?.key===z?{key:z,nonce:Me.nonce+1}:{key:z,nonce:1});const ze=Me=>{const gt=document.getElementById(re)?.querySelector("video");if(!gt){Me>0&&requestAnimationFrame(()=>ze(Me-1));return}ld(gt,{muted:jt});const Tt=()=>{try{const Ci=Number(gt.duration),Pi=Number.isFinite(Ci)&&Ci>0?Math.max(0,Ci-.05):ye;gt.currentTime=Math.max(0,Math.min(ye,Pi))}catch{}const un=gt.play?.();un&&typeof un.catch=="function"&&un.catch(()=>{})};if(gt.readyState>=1){Tt();return}const Vt=()=>{gt.removeEventListener("loadedmetadata",Vt),Tt()};gt.addEventListener("loadedmetadata",Vt,{once:!0});const Ut=gt.play?.();Ut&&typeof Ut.catch=="function"&&Ut.catch(()=>{})};requestAnimationFrame(()=>ze(8))},[jt]),In=p.useCallback(z=>{Dt(null),l(z)},[l]),Sn=p.useCallback((z,K)=>{const re=Number.isFinite(K)&&K>=0?K:0;Dt(null),l(z,re)},[l]),Xt=p.useCallback((z,K,re)=>{const ye=Number.isFinite(K)?Math.floor(K):0,ze=Number.isFinite(re)?Math.floor(re):0;if(ze<=0){In(z);return}const Me=bi(z),et=dt[Me]??z?.durationSeconds??0;if(!Number.isFinite(et)||et<=0){In(z);return}const gt=Math.max(0,Math.min(ye,ze-1)),Tt=et/ze,Vt=gt*Tt;Sn(z,Vt)},[dt,bi,In,Sn]),Un=p.useCallback((z,K)=>{de(re=>{const ye=new Set(re);return K?ye.add(z):ye.delete(z),ye})},[]),Yn=p.useCallback(z=>{ee(K=>{const re=new Set(K);return re.add(z),re})},[]),[Cn,ti]=p.useState(()=>new Set),wn=p.useCallback((z,K)=>{ti(re=>{const ye=new Set(re);return K?ye.add(z):ye.delete(z),ye})},[]),[ui,ri]=p.useState(()=>new Set),Qn=p.useRef(new Map);p.useEffect(()=>()=>{for(const z of Qn.current.values())window.clearTimeout(z);Qn.current.clear()},[]);const Zn=p.useCallback((z,K)=>{ri(re=>{const ye=new Set(re);return K?ye.add(z):ye.delete(z),ye})},[]),xi=p.useCallback(z=>{const K=Qn.current.get(z);K!=null&&(window.clearTimeout(K),Qn.current.delete(z))},[]),Mn=p.useCallback(z=>{xi(z),ee(K=>{const re=new Set(K);return re.delete(z),re}),ri(K=>{const re=new Set(K);return re.delete(z),re}),de(K=>{const re=new Set(K);return re.delete(z),re}),ti(K=>{const re=new Set(K);return re.delete(z),re})},[xi]),jn=p.useCallback(z=>{Zn(z,!0),xi(z);const K=window.setTimeout(()=>{Qn.current.delete(z),Yn(z),Zn(z,!1)},320);Qn.current.set(z,K)},[Yn,Zn,xi]),qn=p.useCallback(async(z,K)=>{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),K?.close&&window.dispatchEvent(new CustomEvent("player:close",{detail:{file:z}})),await new Promise(re=>requestAnimationFrame(()=>re())),window.dispatchEvent(new CustomEvent("player:release",{detail:{file:z}})),await new Promise(re=>window.setTimeout(re,260))},[]),xe=p.useCallback(async(z,K,re)=>{const ye=Math.max(1,re?.attempts??4),ze=Math.max(50,re?.baseDelayMs??220);let Me;for(let et=1;et<=ye;et++)try{return await qn(z,{close:re?.close??!0}),et>1?await X1(ze*et):await X1(80),await K()}catch(gt){if(Me=gt,!Y1(gt)||et>=ye)throw gt;continue}throw Me instanceof Error?Me:new Error(String(Me??"Unbekannter Fehler"))},[qn]),it=p.useCallback(async z=>{const{file:K,rowKey:re,setBusy:ye,isBusyNow:ze,optimisticRemove:Me,alreadyRemoved:et,run:gt,onSuccess:Tt,onError:Vt,labels:Ut}=z;if(!K)return ae.error(Ut.invalidTitle,Ut.invalidBody),{ok:!1};if(ze?.())return{ok:!1};ye?.(!0);try{Me&&!et&&jn(re);const un=await gt();return await Tt?.(un),{ok:!0,result:un}}catch(un){if(Me&&Mn(re),await Vt?.(un),Y1(un))ae.error(Ut.inUseTitle,`${K} wird noch verwendet (Player/Preview). Bitte kurz warten und erneut versuchen.`);else{const Ci=un?.message?` — ${String(un.message)}`:"";ae.error(Ut.failTitle,`${Ut.failPrefix??K}${Ci}`)}return{ok:!1}}finally{ye?.(!1)}},[ae,jn,Mn]),mt=p.useCallback(async(z,K)=>{const re=sr(z.output||""),ye=bi(z);return(await it({kind:"delete",job:z,file:re,rowKey:ye,setBusy:Me=>Un(ye,Me),isBusyNow:()=>ie.has(ye),optimisticRemove:!0,alreadyRemoved:K?.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:re},run:async()=>u?await xe(re,async()=>await u(z),{close:!0,attempts:4,baseDelayMs:220}):await(await xe(re,async()=>await L0(`/api/record/delete?file=${encodeURIComponent(re)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Me=>{if(u){const Tt=typeof Me?.undoToken=="string"?Me.undoToken:"";Te(Tt?{kind:"delete",undoToken:Tt,originalFile:re,rowKey:ye}:null);return}const et=Me?.from==="keep"?"keep":"done",gt=typeof Me?.undoToken=="string"?Me.undoToken:"";Te(gt?{kind:"delete",undoToken:gt,originalFile:re,rowKey:ye,from:et}:null),qe(),Ze(-1)}})).ok},[sr,bi,ie,Un,u,xe,it,qe,Ze]),Rt=p.useCallback(async(z,K)=>{const re=sr(z.output||""),ye=bi(z);return(await it({kind:"keep",job:z,file:re,rowKey:ye,setBusy:Me=>wn(ye,Me),isBusyNow:()=>Cn.has(ye)||ie.has(ye),optimisticRemove:!0,alreadyRemoved:K?.alreadyRemoved,labels:{invalidTitle:"Keep nicht möglich",invalidBody:"Kein Dateiname gefunden – kann nicht behalten.",inUseTitle:"Keep fehlgeschlagen",failTitle:"Keep fehlgeschlagen",failPrefix:re},run:async()=>S?await xe(re,async()=>await S(z),{close:!0,attempts:4,baseDelayMs:220}):await(await xe(re,async()=>await L0(`/api/record/keep?file=${encodeURIComponent(re)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null),onSuccess:async Me=>{const et=typeof Me?.newFile=="string"&&Me.newFile?Me.newFile:re;Te({kind:"keep",keptFile:et,originalFile:re,rowKey:ye}),qe(),Ze(De?0:-1)}})).ok},[sr,bi,wn,Cn,ie,xe,it,qe,Ze,De]),Ne=p.useCallback((z,K)=>{!z||!K||z===K||_e(re=>{const ye={...re};for(const[ze,Me]of Object.entries(ye))(ze===z||ze===K||Me===z||Me===K)&&delete ye[ze];return ye[z]=K,ye})},[]),pt=p.useCallback((z,K)=>{!z&&!K||_e(re=>{const ye={...re};for(const[ze,Me]of Object.entries(ye))(ze===z||ze===K||Me===z||Me===K)&&delete ye[ze];return ye})},[]),xt=p.useCallback(async()=>{if(!Ge||Le)return;ut(!0);const z=K=>{ee(re=>{const ye=new Set(re);return ye.delete(K),ye}),de(re=>{const ye=new Set(re);return ye.delete(K),ye}),ti(re=>{const ye=new Set(re);return ye.delete(K),ye}),ri(re=>{const ye=new Set(re);return ye.delete(K),ye})};try{if(Ge.kind==="delete"){const K=await fetch(`/api/record/restore?token=${encodeURIComponent(Ge.undoToken)}`,{method:"POST"});if(!K.ok){const Me=await K.text().catch(()=>"");throw new Error(Me||`HTTP ${K.status}`)}const re=await K.json().catch(()=>null),ye=String(re?.restoredFile||Ge.originalFile);Ge.rowKey&&z(Ge.rowKey),z(Ge.originalFile),z(ye);const ze=Ge.from==="keep"&&!De?0:1;Ze(ze),qe(),Te(null);return}if(Ge.kind==="keep"){const K=await fetch(`/api/record/unkeep?file=${encodeURIComponent(Ge.keptFile)}`,{method:"POST"});if(!K.ok){const ze=await K.text().catch(()=>"");throw new Error(ze||`HTTP ${K.status}`)}const re=await K.json().catch(()=>null),ye=String(re?.newFile||Ge.originalFile);Ge.rowKey&&z(Ge.rowKey),z(Ge.originalFile),z(ye),Ze(1),qe(),Te(null);return}if(Ge.kind==="hot"){const K=await fetch(`/api/record/toggle-hot?file=${encodeURIComponent(Ge.currentFile)}`,{method:"POST"});if(!K.ok){const Me=await K.text().catch(()=>"");throw new Error(Me||`HTTP ${K.status}`)}const re=await K.json().catch(()=>null),ye=String(re?.oldFile||Ge.currentFile),ze=String(re?.newFile||"");ze&&Ne(ye,ze),qe(),Te(null);return}}catch(K){ae.error("Undo fehlgeschlagen",String(K?.message||K))}finally{ut(!1)}},[Ge,Le,ae,qe,De,Ze,Ne]),[St,Pt]=p.useState(()=>new Set),Ht=p.useCallback((z,K)=>{Pt(re=>{const ye=new Set(re);return K?ye.add(z):ye.delete(z),ye})},[]),Gt=p.useCallback(async z=>{const K=sr(z.output||""),re=bi(z),ye=et=>au(et)?$r(et):`HOT ${et}`,ze=K,Me=ye(ze);await it({kind:"rename",job:z,file:K,rowKey:re,setBusy:et=>Ht(re,et),isBusyNow:()=>St.has(re),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:ze},run:async()=>(Ne(ze,Me),h?await h(z):await(await xe(ze,async()=>await L0(`/api/record/toggle-hot?file=${encodeURIComponent(ze)}`,{method:"POST"}),{close:!0,attempts:4,baseDelayMs:220})).json().catch(()=>null)),onSuccess:async et=>{const gt=typeof et?.oldFile=="string"&&et.oldFile?et.oldFile:ze,Tt=typeof et?.newFile=="string"&&et.newFile?et.newFile:Me;gt&&Tt&>!==Tt&&Ne(gt,Tt),Te({kind:"hot",currentFile:Tt}),(!h||G==="file_asc"||G==="file_desc")&&qe()},onError:async()=>{pt(ze,Me),Te(null)}})},[sr,bi,St,Ht,it,Ne,pt,h,xe,qe,G]),xn=p.useCallback(z=>{const K=bi(z),re=sr(z.output||"");if(!K||!re||ie.has(K)||Cn.has(K))return!1;Un(K,!0),jn(K);const ye=`delete:${K}`,ze=k.enqueue(ye,async()=>{await mt(z,{alreadyRemoved:!0})});return ze||Mn(K),ze},[k,bi,sr,ie,Cn,Un,mt]),zn=p.useCallback(z=>{const K=bi(z),re=sr(z.output||"");if(!K||!re||Cn.has(K)||ie.has(K))return!1;wn(K,!0),jn(K);const ye=`keep:${K}`,ze=k.enqueue(ye,async()=>{await Rt(z,{alreadyRemoved:!0})});return ze||Mn(K),ze},[k,bi,sr,Cn,ie,wn,Rt]),Bi=p.useCallback(z=>{const K=bi(z);if(!K||St.has(K))return!1;const re=`hot:${K}`;return k.enqueue(re,async()=>{await Gt(z)})},[k,bi,Gt,St]),$n=p.useCallback(z=>{const K=by(z.output||""),re=sr(K),ye=Oe[re];if(!ye)return z;const ze=K.lastIndexOf("/"),Me=ze>=0?K.slice(0,ze+1):"";return{...z,output:Me+ye}},[Oe]),Vi=Ke??e,Si=bt??C,pi=p.useMemo(()=>{const z=new Map;for(const re of Vi){const ye=$n(re);z.set(bi(ye),ye)}for(const re of n){const ye=$n(re),ze=bi(ye);z.has(ze)&&z.set(ze,{...z.get(ze),...ye})}return Array.from(z.values()).filter(re=>F.has(bi(re))||E3(re.output)?!1:re.status==="finished"||re.status==="failed"||re.status==="stopped")},[n,Vi,F,$n]),Ri=p.useRef(new Map);p.useEffect(()=>{const z=new Map;for(const K of pi){const re=sr(K.output||"");re&&z.set(re,bi(K))}Ri.current=z},[pi]),p.useEffect(()=>{const z=K=>{const re=K.detail;if(!re?.file)return;const ye=Ri.current.get(re.file)||re.file;if(re.phase==="start"){Un(ye,!0),jn(ye);return}if(re.phase==="error"){Mn(ye),It.current.get(ye)?.reset();return}if(re.phase==="success"){Un(ye,!1);return}};return window.addEventListener("finished-downloads:delete",z),()=>window.removeEventListener("finished-downloads:delete",z)},[jn,Un,qe,Mn]),p.useEffect(()=>{const z=()=>{if(we.current){ve.current||(ve.current=!0);return}Xe.current==null&&qe()};return window.addEventListener("finished-downloads:reload",z),()=>window.removeEventListener("finished-downloads:reload",z)},[qe]),p.useEffect(()=>{const z=K=>{const re=K.detail,ye=String(re?.oldFile??"").trim(),ze=String(re?.newFile??"").trim();!ye||!ze||ye===ze||Ne(ye,ze)};return window.addEventListener("finished-downloads:rename",z),()=>window.removeEventListener("finished-downloads:rename",z)},[Ne]);const Vn=p.useMemo(()=>{const z=pi.filter(re=>!F.has(bi(re))),K=dn.length?z.filter(re=>{const ye=sr(re.output||""),ze=Oc(re.output),Me=ns(ze),et=zt.tagsByModelKey[Me]??[],gt=ns([ye,$r(ye),ze,re.id,et.join(" ")].join(" "));for(const Tt of dn)if(!gt.includes(Tt))return!1;return!0}):z;return Ft.size===0?K:K.filter(re=>{const ye=ns(Oc(re.output)),ze=zt.tagSetByModelKey[ye];if(!ze||ze.size===0)return!1;for(const Me of Ft)if(!ze.has(Me))return!1;return!0})},[pi,F,Ft,zt,dn]),Gn=P?Vn.length:Si,Kn=p.useMemo(()=>{if(!P)return Vn;const z=(M-1)*L,K=z+L;return Vn.slice(Math.max(0,z),Math.max(0,K))},[P,Vn,M,L]),An=!P&&Gn===0,Oi=N&&Vn.length===0,Jn=Y&&Vn.length===0,Gi=I&&(An||Jn||Oi);p.useEffect(()=>{if(!N)return;const z=Math.max(1,Math.ceil(Vn.length/L));M>z&&E(z)},[N,Vn.length,M,L,E]),p.useEffect(()=>{if(!(W==="hover"&&!O&&(He==="cards"||He==="gallery"||He==="table"))){V(null),le.current?.disconnect(),le.current=null;return}if(He==="cards"&&Bt?.key){V(Bt.key);return}le.current?.disconnect();const K=new IntersectionObserver(re=>{let ye=null,ze=0;for(const Me of re){if(!Me.isIntersecting)continue;const et=q.current.get(Me.target);et&&Me.intersectionRatio>ze&&(ze=Me.intersectionRatio,ye=et)}ye&&V(Me=>Me===ye?Me:ye)},{threshold:[0,.15,.3,.5,.7,.9],rootMargin:"0px"});le.current=K;for(const[re,ye]of j.current)q.current.set(ye,re),K.observe(ye);return()=>{K.disconnect(),le.current===K&&(le.current=null)}},[He,W,O,Bt?.key]);const _i=z=>{const K=bi(z),re=dt[K]??z?.durationSeconds;if(typeof re=="number"&&Number.isFinite(re)&&re>0)return K1(re*1e3);const ye=Date.parse(String(z.startedAt||"")),ze=Date.parse(String(z.endedAt||""));return Number.isFinite(ye)&&Number.isFinite(ze)&&ze>ye?K1(ze-ye):"—"},R=p.useCallback(z=>K=>{const re=j.current.get(z);re&&le.current&&le.current.unobserve(re),K?(j.current.set(z,K),q.current.set(K,z),le.current?.observe(K)):j.current.delete(z)},[]),U=p.useCallback((z,K)=>{if(!Number.isFinite(K)||K<=0)return;const re=bi(z),ye=Zt.current[re];typeof ye=="number"&&Math.abs(ye-K)<.5||(Zt.current={...Zt.current,[re]:K},an())},[an]),ue=p.useCallback((z,K,re)=>{if(!Number.isFinite(K)||!Number.isFinite(re)||K<=0||re<=0)return;const ye=bi(z),ze=Tn.current[ye];ze&&ze.w===K&&ze.h===re||(Tn.current={...Tn.current,[ye]:{w:K,h:re}},sn())},[sn]),Se=W1("(max-width: 639px)"),Ee="mt-10",Ve="mb-2";return p.useEffect(()=>{if(!Se||He!=="cards")return;const z=Kn[0];if(!z){V(null);return}const K=bi(z);V(ye=>ye===K?ye:null);const re=window.setTimeout(()=>{V(ye=>ye===K?ye:K)},140);return()=>window.clearTimeout(re)},[Se,He,Kn,bi]),p.useEffect(()=>{Se||(It.current=new Map)},[Se]),p.useEffect(()=>{An&&M!==1&&E(1)},[An,M,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:Gn})]}),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:Gn})]}),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:At,onChange:z=>Nt(z.target.value),placeholder:"Suchen…",className:`\r
|
||
h-9 w-full max-w-[420px] rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900 shadow-sm\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:border-white/10 dark:bg-gray-900 dark:text-gray-100 dark:[color-scheme:dark]\r
|
||
`}),(At||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:yt,children:"Leeren"}):null]}),c.jsx("div",{className:"hidden sm:block",children:c.jsx(Sa,{label:"Behaltene Downloads anzeigen",checked:De,onChange:z=>{M!==1&&E(1),Ie(z)}})}),He!=="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:z=>{const K=z.target.value;Q(K),M!==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:!Ge||Le,onClick:xt,title:Ge?`Letzte Aktion rückgängig machen (${Ge.kind})`:"Keine Aktion zum Rückgängig machen",children:"Undo"}),c.jsx(Lg,{value:He,onChange:z=>Ce(z),size:Se?"sm":"md",ariaLabel:"Ansicht",items:[{id:"table",icon:c.jsx(pN,{className:Se?"size-4":"size-5"}),label:Se?void 0:"Tabelle",srLabel:"Tabelle"},{id:"cards",icon:c.jsx(uN,{className:Se?"size-4":"size-5"}),label:Se?void 0:"Cards",srLabel:"Cards"},{id:"gallery",icon:c.jsx(hN,{className:Se?"size-4":"size-5"}),label:Se?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:()=>Et(z=>!z),"aria-expanded":Qe,"aria-controls":"finished-mobile-options","aria-label":"Filter & Optionen",children:[c.jsx(CA,{className:"size-5"}),N||De?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]})]})]}),vt.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:[vt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:Fn},z)),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:je,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:At,onChange:z=>Nt(z.target.value),placeholder:"Suchen…",className:`\r
|
||
h-10 w-full rounded-md border border-gray-200 bg-white px-3 text-sm text-gray-900\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:border-white/10 dark:bg-gray-950/60 dark:text-gray-100 dark:[color-scheme:dark]\r
|
||
`}),(At||"").trim()!==""?c.jsx(en,{size:"sm",variant:"soft",onClick:yt,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(Rg,{checked:De,onChange:z=>{M!==1&&E(1),Ie(z)},ariaLabel:"Behaltene Downloads anzeigen",size:"default"})]})}),He!=="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:z=>{const K=z.target.value;Q(K),M!==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]})}),vt.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:[vt.map(z=>c.jsx(ps,{tag:z,active:!0,onClick:Fn},z)),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:je,children:"Zurücksetzen"})]})]})}):null]})]})}),Gi?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…"})]})}):An||Jn?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."}),vt.length>0||(At||"").trim()!==""?c.jsxs("div",{className:"mt-2 flex flex-wrap gap-3",children:[vt.length>0?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:je,children:"Tag-Filter zurücksetzen"}):null,(At||"").trim()!==""?c.jsx("button",{type:"button",className:"text-sm font-medium text-gray-700 hover:underline dark:text-gray-200",onClick:yt,children:"Suche zurücksetzen"}):null]}):null]}):c.jsxs(c.Fragment,{children:[He==="cards"&&c.jsx("div",{className:Se?`${Ee} ${Ve}`:"",children:c.jsx(n3,{rows:Kn,isSmall:Se,isLoading:I,blurPreviews:t,durations:dt,teaserKey:Z,teaserPlayback:W,teaserAudio:a,hoverTeaserKey:te,inlinePlay:Bt,deletingKeys:ie,keepingKeys:Cn,removingKeys:ui,swipeRefs:It,keyFor:bi,baseName:sr,modelNameFromOutput:Oc,runtimeOf:_i,sizeBytesOf:O0,formatBytes:R0,lower:ns,onOpenPlayer:l,openPlayer:In,onOpenPlayerAt:Sn,handleScrubberClickIndex:Xt,startInlineAt:Hn,startInline:Mt,tryAutoplayInline:Dn,registerTeaserHost:R,handleDuration:U,deleteVideo:mt,keepVideo:Rt,releasePlayingFile:qn,modelsByKey:H,onToggleHot:Gt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Ft,onToggleTagFilter:Fn,onHoverPreviewKeyChange:me,assetNonce:B??0,enqueueDeleteVideo:xn,enqueueKeepVideo:zn,enqueueToggleHot:Bi})}),He==="table"&&c.jsx(d3,{rows:Kn,isLoading:I,keyFor:bi,baseName:sr,lower:ns,modelNameFromOutput:Oc,runtimeOf:_i,sizeBytesOf:O0,formatBytes:R0,resolutions:Qt,durations:dt,canHover:O,teaserAudio:a,hoverTeaserKey:te,setHoverTeaserKey:me,teaserPlayback:W,teaserKey:Z,registerTeaserHost:R,handleDuration:U,handleResolution:ue,blurPreviews:t,assetNonce:B,deletingKeys:ie,keepingKeys:Cn,removingKeys:ui,modelsByKey:H,activeTagSet:Ft,onToggleTagFilter:Fn,onOpenPlayer:l,handleScrubberClickIndex:Xt,onSortModeChange:Q,page:M,onPageChange:E,onToggleHot:Gt,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,deleteVideo:mt,keepVideo:Rt,enqueueDeleteVideo:xn,enqueueKeepVideo:zn,enqueueToggleHot:Bi}),He==="gallery"&&c.jsx(p3,{rows:Kn,isLoading:I,blurPreviews:t,durations:dt,handleDuration:U,teaserKey:Z,teaserPlayback:W,teaserAudio:a,hoverTeaserKey:te,keyFor:bi,baseName:sr,modelNameFromOutput:Oc,runtimeOf:_i,sizeBytesOf:O0,formatBytes:R0,deletingKeys:ie,keepingKeys:Cn,removingKeys:ui,deletedKeys:F,registerTeaserHost:R,onOpenPlayer:l,handleScrubberClickIndex:Xt,deleteVideo:mt,keepVideo:Rt,onToggleHot:Gt,lower:ns,modelsByKey:H,onToggleFavorite:f,onToggleLike:g,onToggleWatch:_,activeTagSet:Ft,onToggleTagFilter:Fn,onHoverPreviewKeyChange:me,enqueueDeleteVideo:xn,enqueueKeepVideo:zn,enqueueToggleHot:Bi}),c.jsx(Sf,{page:M,pageSize:L,totalItems:Gn,onPageChange:z=>{gu.flushSync(()=>{Dt(null),V(null),me(null)});for(const K of Kn){const re=sr(K.output||"");re&&(window.dispatchEvent(new CustomEvent("player:release",{detail:{file:re}})),window.dispatchEvent(new CustomEvent("player:close",{detail:{file:re}})))}window.scrollTo({top:0,behavior:"auto"}),E(z)},showSummary:!1,prevLabel:"Zurück",nextLabel:"Weiter",className:"mt-4"})]})]})}var I0,Q1;function im(){if(Q1)return I0;Q1=1;var n;return typeof window<"u"?n=window:typeof pf<"u"?n=pf:typeof self<"u"?n=self:n={},I0=n,I0}var M3=im();const ce=Nu(M3),j3={},R3=Object.freeze(Object.defineProperty({__proto__:null,default:j3},Symbol.toStringTag,{value:"Module"})),O3=YE(R3);var B0,Z1;function Iw(){if(Z1)return B0;Z1=1;var n=typeof pf<"u"?pf:typeof window<"u"?window:{},e=O3,t;return typeof document<"u"?t=document:(t=n["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=n["__GLOBAL_DOCUMENT_CACHE@4"]=e)),B0=t,B0}var L3=Iw();const _t=Nu(L3);var Gh={exports:{}},P0={exports:{}},J1;function I3(){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})(P0)),P0.exports}var F0,e2;function B3(){if(e2)return F0;e2=1,F0=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 F0}var U0,t2;function P3(){if(t2)return U0;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 U0=i,U0}var z0,n2;function F3(){if(n2)return z0;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 z0=n,z0}var H0,i2;function U3(){if(i2)return H0;i2=1;var n=im(),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 H0=e,H0}var r2;function z3(){if(r2)return Gh.exports;r2=1;var n=im(),e=I3(),t=B3(),i=P3(),a=F3();g.httpHandler=U3(),g.requestInterceptorsStorage=new i,g.responseInterceptorsStorage=new i,g.retryManager=new a;var l=function(L){var E={};return L&&L.trim().split(`
|
||
`).forEach(function(B){var G=B.indexOf(":"),Q=B.slice(0,G).trim().toLowerCase(),H=B.slice(G+1).trim();typeof E[Q]>"u"?E[Q]=H:Array.isArray(E[Q])?E[Q].push(H):E[Q]=[E[Q],H]}),E};Gh.exports=g,Gh.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(M){g[M==="delete"?"del":M]=function(L,E,B){return E=f(L,E,B),E.method=M.toUpperCase(),_(E)}});function u(M,L){for(var E=0;E<M.length;E++)L(M[E])}function h(M){for(var L in M)if(M.hasOwnProperty(L))return!1;return!0}function f(M,L,E){var B=M;return t(L)?(E=L,typeof M=="string"&&(B={uri:M})):B=e({},L,{uri:M}),B.callback=E,B}function g(M,L,E){return L=f(M,L,E),_(L)}function _(M){if(typeof M.callback>"u")throw new Error("callback argument missing");if(M.requestType&&g.requestInterceptorsStorage.getIsEnabled()){var L={uri:M.uri||M.url,headers:M.headers||{},body:M.body,metadata:M.metadata||{},retry:M.retry,timeout:M.timeout},E=g.requestInterceptorsStorage.execute(M.requestType,L);M.uri=E.uri,M.headers=E.headers,M.body=E.body,M.metadata=E.metadata,M.retry=E.retry,M.timeout=E.timeout}var B=!1,G=function(ee,ie,de){B||(B=!0,M.callback(ee,ie,de))};function Q(){W.readyState===4&&!g.responseInterceptorsStorage.getIsEnabled()&&setTimeout(Y,0)}function H(){var F=void 0;if(W.response?F=W.response:F=W.responseText||S(W),me)try{F=JSON.parse(F)}catch{}return F}function se(F){if(clearTimeout(le),clearTimeout(M.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!ae&&g.retryManager.getIsEnabled()&&M.retry&&M.retry.shouldRetry()){M.retryTimeout=setTimeout(function(){M.retry.moveToNextAttempt(),M.xhr=W,_(M)},M.retry.getCurrentFuzzedDelay());return}if(M.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var ee={headers:q.headers||{},body:q.body,responseUrl:W.responseURL,responseType:W.responseType},ie=g.responseInterceptorsStorage.execute(M.requestType,ee);q.body=ie.body,q.headers=ie.headers}return G(F,q)}function Y(){if(!ae){var F;clearTimeout(le),clearTimeout(M.retryTimeout),M.useXDR&&W.status===void 0?F=200:F=W.status===1223?204:W.status;var ee=q,ie=null;if(F!==0?(ee={body:H(),statusCode:F,method:j,headers:{},url:k,rawRequest:W},W.getAllResponseHeaders&&(ee.headers=l(W.getAllResponseHeaders()))):ie=new Error("Internal XMLHttpRequest Error"),M.requestType&&g.responseInterceptorsStorage.getIsEnabled()){var de={headers:ee.headers||{},body:ee.body,responseUrl:W.responseURL,responseType:W.responseType},I=g.responseInterceptorsStorage.execute(M.requestType,de);ee.body=I.body,ee.headers=I.headers}return G(ie,ee,ee.body)}}var W=M.xhr||null;W||(M.cors||M.useXDR?W=new g.XDomainRequest:W=new g.XMLHttpRequest);var O,ae,k=W.url=M.uri||M.url,j=W.method=M.method||"GET",Z=M.body||M.data,V=W.headers=M.headers||{},te=!!M.sync,me=!1,le,q={body:void 0,headers:{},statusCode:0,method:j,url:k,rawRequest:W};if("json"in M&&M.json!==!1&&(me=!0,V.accept||V.Accept||(V.Accept="application/json"),j!=="GET"&&j!=="HEAD"&&(V["content-type"]||V["Content-Type"]||(V["Content-Type"]="application/json"),Z=JSON.stringify(M.json===!0?Z:M.json))),W.onreadystatechange=Q,W.onload=Y,W.onerror=se,W.onprogress=function(){},W.onabort=function(){ae=!0,clearTimeout(M.retryTimeout)},W.ontimeout=se,W.open(j,k,!te,M.username,M.password),te||(W.withCredentials=!!M.withCredentials),!te&&M.timeout>0&&(le=setTimeout(function(){if(!ae){ae=!0,W.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",se(F)}},M.timeout)),W.setRequestHeader)for(O in V)V.hasOwnProperty(O)&&W.setRequestHeader(O,V[O]);else if(M.headers&&!h(M.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in M&&(W.responseType=M.responseType),"beforeSend"in M&&typeof M.beforeSend=="function"&&M.beforeSend(W),W.send(Z||null),W}function S(M){try{if(M.responseType==="document")return M.responseXML;var L=M.responseXML&&M.responseXML.documentElement.nodeName==="parsererror";if(M.responseType===""&&!L)return M.responseXML}catch{}return null}function C(){}return Gh.exports}var H3=z3();const Bw=Nu(H3);var $0={exports:{}},q0,s2;function $3(){if(s2)return q0;s2=1;var n=Iw(),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,te,me,le){return(V|0)*3600+(te|0)*60+(me|0)+(le|0)/1e3}var Z=k.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return Z?Z[3]?j(Z[1],Z[2],Z[3].replace(":",""),Z[4]):Z[1]>59?j(Z[1],Z[2],0,Z[4]):j(0,Z[1],Z[2],Z[4]):null}function a(){this.values=e(null)}a.prototype={set:function(k,j){!this.get(k)&&j!==""&&(this.values[k]=j)},get:function(k,j,Z){return Z?this.has(k)?this.values[k]:j[Z]:this.has(k)?this.values[k]:j},has:function(k){return k in this.values},alt:function(k,j,Z){for(var V=0;V<Z.length;++V)if(j===Z[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,Z,V){var te=V?k.split(V):[k];for(var me in te)if(typeof te[me]=="string"){var le=te[me].split(Z);if(le.length===2){var q=le[0].trim(),F=le[1].trim();j(q,F)}}}function u(k,j,Z){var V=k;function te(){var q=i(k);if(q===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+V);return k=k.replace(/^[^\sa-zA-Z-]+/,""),q}function me(q,F){var ee=new a;l(q,function(ie,de){switch(ie){case"region":for(var I=Z.length-1;I>=0;I--)if(Z[I].id===de){ee.set(ie,Z[I].region);break}break;case"vertical":ee.alt(ie,de,["rl","lr"]);break;case"line":var pe=de.split(","),we=pe[0];ee.integer(ie,we),ee.percent(ie,we)&&ee.set("snapToLines",!1),ee.alt(ie,we,["auto"]),pe.length===2&&ee.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=de.split(","),ee.percent(ie,pe[0]),pe.length===2&&ee.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":ee.percent(ie,de);break;case"align":ee.alt(ie,de,["start","center","end","left","right"]);break}},/:/,/\s/),F.region=ee.get("region",null),F.vertical=ee.get("vertical","");try{F.line=ee.get("line","auto")}catch{}F.lineAlign=ee.get("lineAlign","start"),F.snapToLines=ee.get("snapToLines",!0),F.size=ee.get("size",100);try{F.align=ee.get("align","center")}catch{F.align=ee.get("align","middle")}try{F.position=ee.get("position","auto")}catch{F.position=ee.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},F.align)}F.positionAlign=ee.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},F.align)}function le(){k=k.replace(/^\s+/,"")}if(le(),j.startTime=te(),le(),k.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+V);k=k.substr(3),le(),j.endTime=te(),le(),me(k,j)}var h=n.createElement&&n.createElement("textarea"),f={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},g={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},_={v:"title",lang:"lang"},S={rt:"ruby"};function C(k,j){function Z(){if(!j)return null;function we(ge){return j=j.substr(ge.length),ge}var ve=j.match(/^([^<]*)(<[^>]*>?)?/);return we(ve[1]?ve[1]:ve[2])}function V(we){return h.innerHTML=we,we=h.textContent,h.textContent="",we}function te(we,ve){return!S[ve.localName]||S[ve.localName]===we.localName}function me(we,ve){var ge=f[we];if(!ge)return null;var ht=k.document.createElement(ge),Ge=_[we];return Ge&&ve&&(ht[Ge]=ve.trim()),ht}for(var le=k.document.createElement("div"),q=le,F,ee=[];(F=Z())!==null;){if(F[0]==="<"){if(F[1]==="/"){ee.length&&ee[ee.length-1]===F.substr(2).replace(">","")&&(ee.pop(),q=q.parentNode);continue}var ie=i(F.substr(1,F.length-2)),de;if(ie){de=k.document.createProcessingInstruction("timestamp",ie),q.appendChild(de);continue}var I=F.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!I||(de=me(I[1],I[3]),!de)||!te(q,de))continue;if(I[2]){var pe=I[2].split(".");pe.forEach(function(we){var ve=/^bg_/.test(we),ge=ve?we.slice(3):we;if(g.hasOwnProperty(ge)){var ht=ve?"background-color":"color",Ge=g[ge];de.style[ht]=Ge}}),de.className=pe.join(" ")}ee.push(I[1]),q.appendChild(de),q=de;continue}q.appendChild(k.document.createTextNode(V(F)))}return le}var M=[[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 L(k){for(var j=0;j<M.length;j++){var Z=M[j];if(k>=Z[0]&&k<=Z[1])return!0}return!1}function E(k){var j=[],Z="",V;if(!k||!k.childNodes)return"ltr";function te(q,F){for(var ee=F.childNodes.length-1;ee>=0;ee--)q.push(F.childNodes[ee])}function me(q){if(!q||!q.length)return null;var F=q.pop(),ee=F.textContent||F.innerText;if(ee){var ie=ee.match(/^.*(\n|\r)/);return ie?(q.length=0,ie[0]):ee}if(F.tagName==="ruby")return me(q);if(F.childNodes)return te(q,F),me(q)}for(te(j,k);Z=me(j);)for(var le=0;le<Z.length;le++)if(V=Z.charCodeAt(le),L(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,Z=j.textTrackList,V=0,te=0;te<Z.length&&Z[te]!==j;te++)Z[te].mode==="showing"&&V++;return++V*-1}function G(){}G.prototype.applyStyles=function(k,j){j=j||this.div;for(var Z in k)k.hasOwnProperty(Z)&&(j.style[Z]=k[Z])},G.prototype.formatStyle=function(k,j){return k===0?0:k+j};function Q(k,j,Z){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:Z.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(V),this.div.appendChild(this.cueDiv);var te=0;switch(j.positionAlign){case"start":case"line-left":te=j.position;break;case"center":te=j.position-j.size/2;break;case"end":case"line-right":te=j.position-j.size;break}j.vertical===""?this.applyStyles({left:this.formatStyle(te,"%"),width:this.formatStyle(j.size,"%")}):this.applyStyles({top:this.formatStyle(te,"%"),height:this.formatStyle(j.size,"%")}),this.move=function(me){this.applyStyles({top:this.formatStyle(me.top,"px"),bottom:this.formatStyle(me.bottom,"px"),left:this.formatStyle(me.left,"px"),right:this.formatStyle(me.right,"px"),height:this.formatStyle(me.height,"px"),width:this.formatStyle(me.width,"px")})}}Q.prototype=e(G.prototype),Q.prototype.constructor=Q;function H(k){var j,Z,V,te;if(k.div){Z=k.div.offsetHeight,V=k.div.offsetWidth,te=k.div.offsetTop;var me=(me=k.div.childNodes)&&(me=me[0])&&me.getClientRects&&me.getClientRects();k=k.div.getBoundingClientRect(),j=me?Math.max(me[0]&&me[0].height||0,k.height/me.length):0}this.left=k.left,this.right=k.right,this.top=k.top||te,this.height=k.height||Z,this.bottom=k.bottom||te+(k.height||Z),this.width=k.width||V,this.lineHeight=j!==void 0?j:k.lineHeight}H.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}},H.prototype.overlaps=function(k){return this.left<k.right&&this.right>k.left&&this.top<k.bottom&&this.bottom>k.top},H.prototype.overlapsAny=function(k){for(var j=0;j<k.length;j++)if(this.overlaps(k[j]))return!0;return!1},H.prototype.within=function(k){return this.top>=k.top&&this.bottom<=k.bottom&&this.left>=k.left&&this.right<=k.right},H.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}},H.prototype.intersectPercentage=function(k){var j=Math.max(0,Math.min(this.right,k.right)-Math.max(this.left,k.left)),Z=Math.max(0,Math.min(this.bottom,k.bottom)-Math.max(this.top,k.top)),V=j*Z;return V/(this.height*this.width)},H.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}},H.getSimpleBoxPosition=function(k){var j=k.div?k.div.offsetHeight:k.tagName?k.offsetHeight:0,Z=k.div?k.div.offsetWidth:k.tagName?k.offsetWidth:0,V=k.div?k.div.offsetTop:k.tagName?k.offsetTop:0;k=k.div?k.div.getBoundingClientRect():k.tagName?k.getBoundingClientRect():k;var te={left:k.left,right:k.right,top:k.top||V,height:k.height||j,bottom:k.bottom||V+(k.height||j),width:k.width||Z};return te};function se(k,j,Z,V){function te(ge,ht){for(var Ge,Te=new H(ge),Le=1,ut=0;ut<ht.length;ut++){for(;ge.overlapsOppositeAxis(Z,ht[ut])||ge.within(Z)&&ge.overlapsAny(V);)ge.move(ht[ut]);if(ge.within(Z))return ge;var Oe=ge.intersectPercentage(Z);Le>Oe&&(Ge=new H(ge),Le=Oe),ge=new H(Te)}return Ge||Te}var me=new H(j),le=j.cue,q=B(le),F=[];if(le.snapToLines){var ee;switch(le.vertical){case"":F=["+y","-y"],ee="height";break;case"rl":F=["+x","-x"],ee="width";break;case"lr":F=["-x","+x"],ee="width";break}var ie=me.lineHeight,de=ie*Math.round(q),I=Z[ee]+ie,pe=F[0];Math.abs(de)>I&&(de=de<0?-1:1,de*=Math.ceil(I/ie)*ie),q<0&&(de+=le.vertical===""?Z.height:Z.width,F=F.reverse()),me.move(pe,de)}else{var we=me.lineHeight/Z.height*100;switch(le.lineAlign){case"center":q-=we/2;break;case"end":q-=we;break}switch(le.vertical){case"":j.applyStyles({top:j.formatStyle(q,"%")});break;case"rl":j.applyStyles({left:j.formatStyle(q,"%")});break;case"lr":j.applyStyles({right:j.formatStyle(q,"%")});break}F=["+y","-x","+x","-y"],me=new H(j)}var ve=te(me,F);j.move(ve.toCSSCompatValues(Z))}function Y(){}Y.StringDecoder=function(){return{decode:function(k){if(!k)return"";if(typeof k!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(k))}}},Y.convertCueToDOMTree=function(k,j){return!k||!j?null:C(k,j)};var W=.05,O="sans-serif",ae="1.5%";return Y.processCues=function(k,j,Z){if(!k||!j||!Z)return null;for(;Z.firstChild;)Z.removeChild(Z.firstChild);var V=k.document.createElement("div");V.style.position="absolute",V.style.left="0",V.style.right="0",V.style.top="0",V.style.bottom="0",V.style.margin=ae,Z.appendChild(V);function te(ie){for(var de=0;de<ie.length;de++)if(ie[de].hasBeenReset||!ie[de].displayState)return!0;return!1}if(!te(j)){for(var me=0;me<j.length;me++)V.appendChild(j[me].displayState);return}var le=[],q=H.getSimpleBoxPosition(V),F=Math.round(q.height*W*100)/100,ee={font:F+"px "+O};(function(){for(var ie,de,I=0;I<j.length;I++)de=j[I],ie=new Q(k,de,ee),V.appendChild(ie.div),se(k,ie,q,le),de.displayState=ie.div,le.push(H.getSimpleBoxPosition(ie))})()},Y.Parser=function(k,j,Z){Z||(Z=j,j={}),j||(j={}),this.window=k,this.vttjs=j,this.state="INITIAL",this.buffer="",this.decoder=Z||new TextDecoder("utf8"),this.regionList=[]},Y.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 Z(){for(var ie=j.buffer,de=0;de<ie.length&&ie[de]!=="\r"&&ie[de]!==`
|
||
`;)++de;var I=ie.substr(0,de);return ie[de]==="\r"&&++de,ie[de]===`
|
||
`&&++de,j.buffer=ie.substr(de),I}function V(ie){var de=new a;if(l(ie,function(pe,we){switch(pe){case"id":de.set(pe,we);break;case"width":de.percent(pe,we);break;case"lines":de.integer(pe,we);break;case"regionanchor":case"viewportanchor":var ve=we.split(",");if(ve.length!==2)break;var ge=new a;if(ge.percent("x",ve[0]),ge.percent("y",ve[1]),!ge.has("x")||!ge.has("y"))break;de.set(pe+"X",ge.get("x")),de.set(pe+"Y",ge.get("y"));break;case"scroll":de.alt(pe,we,["up"]);break}},/=/,/\s/),de.has("id")){var I=new(j.vttjs.VTTRegion||j.window.VTTRegion);I.width=de.get("width",100),I.lines=de.get("lines",3),I.regionAnchorX=de.get("regionanchorX",0),I.regionAnchorY=de.get("regionanchorY",100),I.viewportAnchorX=de.get("viewportanchorX",0),I.viewportAnchorY=de.get("viewportanchorY",100),I.scroll=de.get("scroll",""),j.onregion&&j.onregion(I),j.regionList.push({id:de.get("id"),region:I})}}function te(ie){var de=new a;l(ie,function(I,pe){switch(I){case"MPEGT":de.integer(I+"S",pe);break;case"LOCA":de.set(I+"L",i(pe));break}},/[^\d]:/,/,/),j.ontimestampmap&&j.ontimestampmap({MPEGTS:de.get("MPEGTS"),LOCAL:de.get("LOCAL")})}function me(ie){ie.match(/X-TIMESTAMP-MAP/)?l(ie,function(de,I){de==="X-TIMESTAMP-MAP"&&te(I)},/=/):l(ie,function(de,I){de==="Region"&&V(I)},/:/)}try{var le;if(j.state==="INITIAL"){if(!/\r\n|\n/.test(j.buffer))return this;le=Z();var q=le.match(/^WEBVTT([ \t].*)?$/);if(!q||!q[0])throw new t(t.Errors.BadSignature);j.state="HEADER"}for(var F=!1;j.buffer;){if(!/\r\n|\n/.test(j.buffer))return this;switch(F?F=!1:le=Z(),j.state){case"HEADER":/:/.test(le)?me(le):le||(j.state="ID");continue;case"NOTE":le||(j.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(le)){j.state="NOTE";break}if(!le)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",le.indexOf("-->")===-1){j.cue.id=le;continue}case"CUE":try{u(le,j.cue,j.regionList)}catch(ie){j.reportOrThrowError(ie),j.cue=null,j.state="BADCUE";continue}j.state="CUETEXT";continue;case"CUETEXT":var ee=le.indexOf("-->")!==-1;if(!le||ee&&(F=!0)){j.oncue&&j.oncue(j.cue),j.cue=null,j.state="ID";continue}j.cue.text&&(j.cue.text+=`
|
||
`),j.cue.text+=le.replace(/\u2028/g,`
|
||
`).replace(/u2029/g,`
|
||
`);continue;case"BADCUE":le||(j.state="ID");continue}}}catch(ie){j.reportOrThrowError(ie),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}},q0=Y,q0}var V0,a2;function q3(){if(a2)return V0;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,M=f,L=null,E="",B=!0,G="auto",Q="start",H="auto",se="auto",Y=100,W="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 M},set:function(O){M=""+O,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return L},set:function(O){L=O,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return E},set:function(O){var ae=i(O);if(ae===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");E=ae,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 Q},set:function(O){var ae=a(O);ae?(Q=ae,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return H},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");H=O,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return se},set:function(O){var ae=a(O);ae?(se=ae,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return Y},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");Y=O,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return W},set:function(O){var ae=a(O);if(!ae)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");W=ae,this.hasBeenReset=!0}}}),this.displayState=void 0}return l.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},V0=l,V0}var G0,o2;function V3(){if(o2)return G0;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 G0=i,G0}var l2;function G3(){if(l2)return $0.exports;l2=1;var n=im(),e=$0.exports={WebVTT:$3(),VTTCue:q3(),VTTRegion:V3()};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(),$0.exports}var K3=G3();const u2=Nu(K3);function Qi(){return Qi=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},Qi.apply(null,arguments)}var c2="https://example.com",rm=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=ce.location&&ce.location.href||"");var i=/^\/\//.test(e),a=!ce.location&&!/\/\//i.test(e);e=new ce.URL(e,ce.location||c2);var l=new URL(t,e);return a?l.href.slice(c2.length):i?l.href.slice(l.protocol.length):l.href},vy=(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})(),W3=function(e){return ce.atob?ce.atob(e):Buffer.from(e,"base64").toString("binary")};function Pw(n){for(var e=W3(n),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class X3 extends vy{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 Y3=" ",K0=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},Q3=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},kr=function(n){const e={};if(!n)return e;const t=n.split(Q3());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 Z3 extends vy{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=Qi(K0(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=kr(t[1]);u.URI&&(i.uri=u.URI),u.BYTERANGE&&(i.byterange=K0(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=kr(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=kr(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=kr(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=kr(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=kr(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(Y3)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(l),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=kr(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=K0(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=kr(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=kr(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=kr(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=kr(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=kr(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=kr(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=kr(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=kr(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 J3=n=>n.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),mo=function(n){const e={};return Object.keys(n).forEach(function(t){e[J3(t)]=n[t]}),e},W0=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 eD extends vy{constructor(e={}){super(),this.lineStream=new X3,this.parseStream=new Z3,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,M=0;const L={};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 Q in t.manifest.definitions)if(E.uri&&(E.uri=E.uri.replace(`{$${Q}}`,t.manifest.definitions[Q])),E.attributes)for(const H in E.attributes)typeof E.attributes[H]=="string"&&(E.attributes[H]=E.attributes[H].replace(`{$${Q}}`,t.manifest.definitions[Q]))}({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 Q={};"length"in E&&(a.byterange=Q,Q.length=E.length,"offset"in E||(E.offset=C)),"offset"in E&&(a.byterange=Q,Q.offset=E.offset),C=Q.offset+Q.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:Pw(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={}),Qi(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 Q=this.manifest.mediaGroups[E.attributes.TYPE];Q[E.attributes["GROUP-ID"]]=Q[E.attributes["GROUP-ID"]]||{},B=Q[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:Q}=this;this.lastProgramDateTime=new Date(E.dateTimeString).getTime(),Q===null&&this.manifest.segments.reduceRight((H,se)=>(se.programDateTime=H-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,W0.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=mo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",E.attributes,["SKIPPED-SEGMENTS"])},part(){h=!0;const Q=this.manifest.segments.length,H=mo(E.attributes);a.parts=a.parts||[],a.parts.push(H),H.byterange&&(H.byterange.hasOwnProperty("offset")||(H.byterange.offset=M),M=H.byterange.offset+H.byterange.length);const se=a.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${se} for segment #${Q}`,E.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Y,W)=>{Y.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${W} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Q=this.manifest.serverControl=mo(E.attributes);Q.hasOwnProperty("canBlockReload")||(Q.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),W0.call(this,this.manifest),Q.canSkipDateranges&&!Q.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 Q=this.manifest.segments.length,H=mo(E.attributes),se=H.type&&H.type==="PART";a.preloadHints=a.preloadHints||[],a.preloadHints.push(H),H.byterange&&(H.byterange.hasOwnProperty("offset")||(H.byterange.offset=se?M:0,se&&(M=H.byterange.offset+H.byterange.length)));const Y=a.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Y} for segment #${Q}`,E.attributes,["TYPE","URI"]),!!H.type)for(let W=0;W<a.preloadHints.length-1;W++){const O=a.preloadHints[W];O.type&&O.type===H.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${Y} for segment #${Q} has the same TYPE ${H.type} as preload hint #${W}`})}},"rendition-report"(){const Q=mo(E.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(Q);const H=this.manifest.renditionReports.length-1,se=["LAST-MSN","URI"];h&&se.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${H}`,E.attributes,se)},"part-inf"(){this.manifest.partInf=mo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",E.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),W0.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(mo(E.attributes));const Q=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${Q}`,E.attributes,["ID","START-DATE"]);const H=this.manifest.dateRanges[Q];H.endDate&&H.startDate&&new Date(H.endDate)<new Date(H.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),H.duration&&H.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),H.plannedDuration&&H.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const se=!!H.endOnNext;if(se&&!H.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),se&&(H.duration||H.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),H.duration&&H.endDate){const W=H.startDate.getTime()+H.duration*1e3;this.manifest.dateRanges[Q].endDate=new Date(W)}if(!L[H.id])L[H.id]=H;else{for(const W in L[H.id])if(H[W]&&JSON.stringify(L[H.id][W])!==JSON.stringify(H[W])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const Y=this.manifest.dateRanges.findIndex(W=>W.id===H.id);this.manifest.dateRanges[Y]=Qi(this.manifest.dateRanges[Y],H),L[H.id]=Qi(L[H.id],H),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=mo(E.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",E.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Q=(H,se)=>{if(H in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${H}`});return}this.manifest.definitions[H]=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 H=this.params.get(E.attributes.QUERYPARAM);if(!H){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${E.attributes.QUERYPARAM}`});return}Q(E.attributes.QUERYPARAM,decodeURIComponent(H));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}Q(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}Q(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),M=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 cl={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^/},tD=["video","audio","text"],h2=["Video","Audio","Text"],Fw=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;tD.forEach(function(u){var h=cl[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},nD=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},Uw=function(e){return e===void 0&&(e=""),cl.audio.test(e.trim().toLowerCase())},iD=function(e){return e===void 0&&(e=""),cl.text.test(e.trim().toLowerCase())},xu=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(l){return Fw(l.trim())}),i="video";t.length===1&&Uw(t[0])?i="audio":t.length===1&&iD(t[0])&&(i="application");var a="mp4";return t.every(function(l){return cl.mp4.test(l)})?a="mp4":t.every(function(l){return cl.webm.test(l)})?a="webm":t.every(function(l){return cl.ogg.test(l)})&&(a="ogg"),i+"/"+a+';codecs="'+e+'"'}},td=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),ce.MediaSource&&ce.MediaSource.isTypeSupported&&ce.MediaSource.isTypeSupported(xu(e))||t&&ce.ManagedMediaSource&&ce.ManagedMediaSource.isTypeSupported&&ce.ManagedMediaSource.isTypeSupported(xu(e))||!1},X0=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(cl["muxer"+a].test(t))return!0}return!1})},f2="mp4a.40.2",rD="avc1.4d400d",sD=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,aD=/^application\/dash\+xml/i,zw=function(e){return sD.test(e)?"hls":aD.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},oD=function(e){return e.toString(2).length},lD=function(e){return Math.ceil(oD(e)/8)},Hw=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},uD=function(e){return Hw(e)},nn=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!uD(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))},gr=ce.BigInt||Number,Ig=[gr("0x1"),gr("0x100"),gr("0x10000"),gr("0x1000000"),gr("0x100000000"),gr("0x10000000000"),gr("0x1000000000000"),gr("0x100000000000000"),gr("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 cD=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=nn(e);var f=h?"reduce":"reduceRight",g=e[f]?e[f]:Array.prototype[f],_=g.call(e,function(C,M,L){var E=h?L:Math.abs(L+1-e.length);return C+gr(M)*Ig[E]},gr(0));if(l){var S=Ig[e.length]/gr(2)-gr(1);_=gr(_),_>S&&(_-=S,_-=S,_-=gr(2))}return Number(_)},dD=function(e,t){var i={},a=i.le,l=a===void 0?!1:a;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=gr(e);for(var u=lD(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/Ig[f]&gr(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},hD=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 nn(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=nn(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=nn(e),t=nn(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})},fD=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)}})},Lc={},wa={},Zo={},m2;function sm(){if(m2)return Zo;m2=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 p2;function qw(){if(p2)return wa;p2=1;var n=sm(),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,P){return N.hasOwnProperty(P)||(N[P]=!0),N}function u(N){if(!N)return[];var P=a(N);return Object.keys(P.reduce(l,{}))}function h(N){return function(P){return N&&N.indexOf(P)!==-1}}function f(N,P){for(var ne in N)Object.prototype.hasOwnProperty.call(N,ne)&&(P[ne]=N[ne])}function g(N,P){var ne=N.prototype;if(!(ne instanceof P)){let qe=function(){};var je=qe;qe.prototype=P.prototype,qe=new qe,f(ne,qe),N.prototype=ne=qe}ne.constructor!=N&&(typeof N!="function"&&console.error("unknown Class:"+N),ne.constructor=N)}var _={},S=_.ELEMENT_NODE=1,C=_.ATTRIBUTE_NODE=2,M=_.TEXT_NODE=3,L=_.CDATA_SECTION_NODE=4,E=_.ENTITY_REFERENCE_NODE=5,B=_.ENTITY_NODE=6,G=_.PROCESSING_INSTRUCTION_NODE=7,Q=_.COMMENT_NODE=8,H=_.DOCUMENT_NODE=9,se=_.DOCUMENT_TYPE_NODE=10,Y=_.DOCUMENT_FRAGMENT_NODE=11,W=_.NOTATION_NODE=12,O={},ae={};O.INDEX_SIZE_ERR=(ae[1]="Index size error",1),O.DOMSTRING_SIZE_ERR=(ae[2]="DOMString size error",2);var k=O.HIERARCHY_REQUEST_ERR=(ae[3]="Hierarchy request error",3);O.WRONG_DOCUMENT_ERR=(ae[4]="Wrong document",4),O.INVALID_CHARACTER_ERR=(ae[5]="Invalid character",5),O.NO_DATA_ALLOWED_ERR=(ae[6]="No data allowed",6),O.NO_MODIFICATION_ALLOWED_ERR=(ae[7]="No modification allowed",7);var j=O.NOT_FOUND_ERR=(ae[8]="Not found",8);O.NOT_SUPPORTED_ERR=(ae[9]="Not supported",9);var Z=O.INUSE_ATTRIBUTE_ERR=(ae[10]="Attribute in use",10);O.INVALID_STATE_ERR=(ae[11]="Invalid state",11),O.SYNTAX_ERR=(ae[12]="Syntax error",12),O.INVALID_MODIFICATION_ERR=(ae[13]="Invalid modification",13),O.NAMESPACE_ERR=(ae[14]="Invalid namespace",14),O.INVALID_ACCESS_ERR=(ae[15]="Invalid access",15);function V(N,P){if(P instanceof Error)var ne=P;else ne=this,Error.call(this,ae[N]),this.message=ae[N],Error.captureStackTrace&&Error.captureStackTrace(this,V);return ne.code=N,P&&(this.message=this.message+": "+P),ne}V.prototype=Error.prototype,f(O,V);function te(){}te.prototype={length:0,item:function(N){return N>=0&&N<this.length?this[N]:null},toString:function(N,P){for(var ne=[],je=0;je<this.length;je++)ln(this[je],ne,N,P);return ne.join("")},filter:function(N){return Array.prototype.filter.call(this,N)},indexOf:function(N){return Array.prototype.indexOf.call(this,N)}};function me(N,P){this._node=N,this._refresh=P,le(this)}function le(N){var P=N._node._inc||N._node.ownerDocument._inc;if(N._inc!==P){var ne=N._refresh(N._node);if(Fn(N,"length",ne.length),!N.$$length||ne.length<N.$$length)for(var je=ne.length;je in N;je++)Object.prototype.hasOwnProperty.call(N,je)&&delete N[je];f(ne,N),N._inc=P}}me.prototype.item=function(N){return le(this),this[N]||null},g(me,te);function q(){}function F(N,P){for(var ne=N.length;ne--;)if(N[ne]===P)return ne}function ee(N,P,ne,je){if(je?P[F(P,je)]=ne:P[P.length++]=ne,N){ne.ownerElement=N;var qe=N.ownerDocument;qe&&(je&&ht(qe,N,je),ge(qe,N,ne))}}function ie(N,P,ne){var je=F(P,ne);if(je>=0){for(var qe=P.length-1;je<qe;)P[je]=P[++je];if(P.length=qe,N){var dt=N.ownerDocument;dt&&(ht(dt,N,ne),ne.ownerElement=null)}}else throw new V(j,new Error(N.tagName+"@"+ne))}q.prototype={length:0,item:te.prototype.item,getNamedItem:function(N){for(var P=this.length;P--;){var ne=this[P];if(ne.nodeName==N)return ne}},setNamedItem:function(N){var P=N.ownerElement;if(P&&P!=this._ownerElement)throw new V(Z);var ne=this.getNamedItem(N.nodeName);return ee(this._ownerElement,this,N,ne),ne},setNamedItemNS:function(N){var P=N.ownerElement,ne;if(P&&P!=this._ownerElement)throw new V(Z);return ne=this.getNamedItemNS(N.namespaceURI,N.localName),ee(this._ownerElement,this,N,ne),ne},removeNamedItem:function(N){var P=this.getNamedItem(N);return ie(this._ownerElement,this,P),P},removeNamedItemNS:function(N,P){var ne=this.getNamedItemNS(N,P);return ie(this._ownerElement,this,ne),ne},getNamedItemNS:function(N,P){for(var ne=this.length;ne--;){var je=this[ne];if(je.localName==P&&je.namespaceURI==N)return je}return null}};function de(){}de.prototype={hasFeature:function(N,P){return!0},createDocument:function(N,P,ne){var je=new ve;if(je.implementation=this,je.childNodes=new te,je.doctype=ne||null,ne&&je.appendChild(ne),P){var qe=je.createElementNS(N,P);je.appendChild(qe)}return je},createDocumentType:function(N,P,ne){var je=new Ie;return je.name=N,je.nodeName=N,je.publicId=P||"",je.systemId=ne||"",je}};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,P){return Xe(this,N,P)},replaceChild:function(N,P){Xe(this,N,P,Pe),P&&this.removeChild(P)},removeChild:function(N){return Te(this,N)},appendChild:function(N){return this.insertBefore(N,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(N){return yt(this.ownerDocument||this,this,N)},normalize:function(){for(var N=this.firstChild;N;){var P=N.nextSibling;P&&P.nodeType==M&&N.nodeType==M?(this.removeChild(P),N.appendData(P.data)):(N.normalize(),N=P)}},isSupported:function(N,P){return this.ownerDocument.implementation.hasFeature(N,P)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(N){for(var P=this;P;){var ne=P._nsMap;if(ne){for(var je in ne)if(Object.prototype.hasOwnProperty.call(ne,je)&&ne[je]===N)return je}P=P.nodeType==C?P.ownerDocument:P.parentNode}return null},lookupNamespaceURI:function(N){for(var P=this;P;){var ne=P._nsMap;if(ne&&Object.prototype.hasOwnProperty.call(ne,N))return ne[N];P=P.nodeType==C?P.ownerDocument:P.parentNode}return null},isDefaultNamespace:function(N){var P=this.lookupPrefix(N);return P==null}};function pe(N){return N=="<"&&"<"||N==">"&&">"||N=="&"&&"&"||N=='"'&&"""||"&#"+N.charCodeAt()+";"}f(_,I),f(_,I.prototype);function we(N,P){if(P(N))return!0;if(N=N.firstChild)do if(we(N,P))return!0;while(N=N.nextSibling)}function ve(){this.ownerDocument=this}function ge(N,P,ne){N&&N._inc++;var je=ne.namespaceURI;je===t.XMLNS&&(P._nsMap[ne.prefix?ne.localName:""]=ne.value)}function ht(N,P,ne,je){N&&N._inc++;var qe=ne.namespaceURI;qe===t.XMLNS&&delete P._nsMap[ne.prefix?ne.localName:""]}function Ge(N,P,ne){if(N&&N._inc){N._inc++;var je=P.childNodes;if(ne)je[je.length++]=ne;else{for(var qe=P.firstChild,dt=0;qe;)je[dt++]=qe,qe=qe.nextSibling;je.length=dt,delete je[je.length]}}}function Te(N,P){var ne=P.previousSibling,je=P.nextSibling;return ne?ne.nextSibling=je:N.firstChild=je,je?je.previousSibling=ne:N.lastChild=ne,P.parentNode=null,P.previousSibling=null,P.nextSibling=null,Ge(N.ownerDocument,N),P}function Le(N){return N&&(N.nodeType===I.DOCUMENT_NODE||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.ELEMENT_NODE)}function ut(N){return N&&(_e(N)||Ke(N)||Oe(N)||N.nodeType===I.DOCUMENT_FRAGMENT_NODE||N.nodeType===I.COMMENT_NODE||N.nodeType===I.PROCESSING_INSTRUCTION_NODE)}function Oe(N){return N&&N.nodeType===I.DOCUMENT_TYPE_NODE}function _e(N){return N&&N.nodeType===I.ELEMENT_NODE}function Ke(N){return N&&N.nodeType===I.TEXT_NODE}function Je(N,P){var ne=N.childNodes||[];if(e(ne,_e)||Oe(P))return!1;var je=e(ne,Oe);return!(P&&je&&ne.indexOf(je)>ne.indexOf(P))}function bt(N,P){var ne=N.childNodes||[];function je(dt){return _e(dt)&&dt!==P}if(e(ne,je))return!1;var qe=e(ne,Oe);return!(P&&qe&&ne.indexOf(qe)>ne.indexOf(P))}function ft(N,P,ne){if(!Le(N))throw new V(k,"Unexpected parent node type "+N.nodeType);if(ne&&ne.parentNode!==N)throw new V(j,"child not in parent");if(!ut(P)||Oe(P)&&N.nodeType!==I.DOCUMENT_NODE)throw new V(k,"Unexpected node type "+P.nodeType+" for parent node type "+N.nodeType)}function kt(N,P,ne){var je=N.childNodes||[],qe=P.childNodes||[];if(P.nodeType===I.DOCUMENT_FRAGMENT_NODE){var dt=qe.filter(_e);if(dt.length>1||e(qe,Ke))throw new V(k,"More than one element or text in fragment");if(dt.length===1&&!Je(N,ne))throw new V(k,"Element in fragment can not be inserted before doctype")}if(_e(P)&&!Je(N,ne))throw new V(k,"Only one element can be added and only after doctype");if(Oe(P)){if(e(je,Oe))throw new V(k,"Only one doctype is allowed");var $t=e(je,_e);if(ne&&je.indexOf($t)<je.indexOf(ne))throw new V(k,"Doctype can only be inserted before an element");if(!ne&&$t)throw new V(k,"Doctype can not be appended since element is present")}}function Pe(N,P,ne){var je=N.childNodes||[],qe=P.childNodes||[];if(P.nodeType===I.DOCUMENT_FRAGMENT_NODE){var dt=qe.filter(_e);if(dt.length>1||e(qe,Ke))throw new V(k,"More than one element or text in fragment");if(dt.length===1&&!bt(N,ne))throw new V(k,"Element in fragment can not be inserted before doctype")}if(_e(P)&&!bt(N,ne))throw new V(k,"Only one element can be added and only after doctype");if(Oe(P)){let hn=function(Qt){return Oe(Qt)&&Qt!==ne};var Zt=hn;if(e(je,hn))throw new V(k,"Only one doctype is allowed");var $t=e(je,_e);if(ne&&je.indexOf($t)<je.indexOf(ne))throw new V(k,"Doctype can only be inserted before an element")}}function Xe(N,P,ne,je){ft(N,P,ne),N.nodeType===I.DOCUMENT_NODE&&(je||kt)(N,P,ne);var qe=P.parentNode;if(qe&&qe.removeChild(P),P.nodeType===Y){var dt=P.firstChild;if(dt==null)return P;var $t=P.lastChild}else dt=$t=P;var Zt=ne?ne.previousSibling:N.lastChild;dt.previousSibling=Zt,$t.nextSibling=ne,Zt?Zt.nextSibling=dt:N.firstChild=dt,ne==null?N.lastChild=$t:ne.previousSibling=$t;do{dt.parentNode=N;var hn=N.ownerDocument||N;st(dt,hn)}while(dt!==$t&&(dt=dt.nextSibling));return Ge(N.ownerDocument||N,N),P.nodeType==Y&&(P.firstChild=P.lastChild=null),P}function st(N,P){if(N.ownerDocument!==P){if(N.ownerDocument=P,N.nodeType===S&&N.attributes)for(var ne=0;ne<N.attributes.length;ne++){var je=N.attributes.item(ne);je&&(je.ownerDocument=P)}for(var qe=N.firstChild;qe;)st(qe,P),qe=qe.nextSibling}}function Ze(N,P){P.parentNode&&P.parentNode.removeChild(P),P.parentNode=N,P.previousSibling=N.lastChild,P.nextSibling=null,P.previousSibling?P.previousSibling.nextSibling=P:N.firstChild=P,N.lastChild=P,Ge(N.ownerDocument,N,P);var ne=N.ownerDocument||N;return st(P,ne),P}ve.prototype={nodeName:"#document",nodeType:H,doctype:null,documentElement:null,_inc:1,insertBefore:function(N,P){if(N.nodeType==Y){for(var ne=N.firstChild;ne;){var je=ne.nextSibling;this.insertBefore(ne,P),ne=je}return N}return Xe(this,N,P),st(N,this),this.documentElement===null&&N.nodeType===S&&(this.documentElement=N),N},removeChild:function(N){return this.documentElement==N&&(this.documentElement=null),Te(this,N)},replaceChild:function(N,P){Xe(this,N,P,Pe),st(N,this),P&&this.removeChild(P),_e(N)&&(this.documentElement=N)},importNode:function(N,P){return dn(this,N,P)},getElementById:function(N){var P=null;return we(this.documentElement,function(ne){if(ne.nodeType==S&&ne.getAttribute("id")==N)return P=ne,!0}),P},getElementsByClassName:function(N){var P=u(N);return new me(this,function(ne){var je=[];return P.length>0&&we(ne.documentElement,function(qe){if(qe!==ne&&qe.nodeType===S){var dt=qe.getAttribute("class");if(dt){var $t=N===dt;if(!$t){var Zt=u(dt);$t=P.every(h(Zt))}$t&&je.push(qe)}}}),je})},createElement:function(N){var P=new nt;P.ownerDocument=this,P.nodeName=N,P.tagName=N,P.localName=N,P.childNodes=new te;var ne=P.attributes=new q;return ne._ownerElement=P,P},createDocumentFragment:function(){var N=new vt;return N.ownerDocument=this,N.childNodes=new te,N},createTextNode:function(N){var P=new He;return P.ownerDocument=this,P.appendData(N),P},createComment:function(N){var P=new Ce;return P.ownerDocument=this,P.appendData(N),P},createCDATASection:function(N){var P=new De;return P.ownerDocument=this,P.appendData(N),P},createProcessingInstruction:function(N,P){var ne=new Yt;return ne.ownerDocument=this,ne.tagName=ne.nodeName=ne.target=N,ne.nodeValue=ne.data=P,ne},createAttribute:function(N){var P=new wt;return P.ownerDocument=this,P.name=N,P.nodeName=N,P.localName=N,P.specified=!0,P},createEntityReference:function(N){var P=new It;return P.ownerDocument=this,P.nodeName=N,P},createElementNS:function(N,P){var ne=new nt,je=P.split(":"),qe=ne.attributes=new q;return ne.childNodes=new te,ne.ownerDocument=this,ne.nodeName=P,ne.tagName=P,ne.namespaceURI=N,je.length==2?(ne.prefix=je[0],ne.localName=je[1]):ne.localName=P,qe._ownerElement=ne,ne},createAttributeNS:function(N,P){var ne=new wt,je=P.split(":");return ne.ownerDocument=this,ne.nodeName=P,ne.name=P,ne.namespaceURI=N,ne.specified=!0,je.length==2?(ne.prefix=je[0],ne.localName=je[1]):ne.localName=P,ne}},g(ve,I);function nt(){this._nsMap={}}nt.prototype={nodeType:S,hasAttribute:function(N){return this.getAttributeNode(N)!=null},getAttribute:function(N){var P=this.getAttributeNode(N);return P&&P.value||""},getAttributeNode:function(N){return this.attributes.getNamedItem(N)},setAttribute:function(N,P){var ne=this.ownerDocument.createAttribute(N);ne.value=ne.nodeValue=""+P,this.setAttributeNode(ne)},removeAttribute:function(N){var P=this.getAttributeNode(N);P&&this.removeAttributeNode(P)},appendChild:function(N){return N.nodeType===Y?this.insertBefore(N,null):Ze(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,P){var ne=this.getAttributeNodeNS(N,P);ne&&this.removeAttributeNode(ne)},hasAttributeNS:function(N,P){return this.getAttributeNodeNS(N,P)!=null},getAttributeNS:function(N,P){var ne=this.getAttributeNodeNS(N,P);return ne&&ne.value||""},setAttributeNS:function(N,P,ne){var je=this.ownerDocument.createAttributeNS(N,P);je.value=je.nodeValue=""+ne,this.setAttributeNode(je)},getAttributeNodeNS:function(N,P){return this.attributes.getNamedItemNS(N,P)},getElementsByTagName:function(N){return new me(this,function(P){var ne=[];return we(P,function(je){je!==P&&je.nodeType==S&&(N==="*"||je.tagName==N)&&ne.push(je)}),ne})},getElementsByTagNameNS:function(N,P){return new me(this,function(ne){var je=[];return we(ne,function(qe){qe!==ne&&qe.nodeType===S&&(N==="*"||qe.namespaceURI===N)&&(P==="*"||qe.localName==P)&&je.push(qe)}),je})}},ve.prototype.getElementsByTagName=nt.prototype.getElementsByTagName,ve.prototype.getElementsByTagNameNS=nt.prototype.getElementsByTagNameNS,g(nt,I);function wt(){}wt.prototype.nodeType=C,g(wt,I);function fe(){}fe.prototype={data:"",substringData:function(N,P){return this.data.substring(N,N+P)},appendData:function(N){N=this.data+N,this.nodeValue=this.data=N,this.length=N.length},insertData:function(N,P){this.replaceData(N,0,P)},appendChild:function(N){throw new Error(ae[k])},deleteData:function(N,P){this.replaceData(N,P,"")},replaceData:function(N,P,ne){var je=this.data.substring(0,N),qe=this.data.substring(N+P);ne=je+ne+qe,this.nodeValue=this.data=ne,this.length=ne.length}},g(fe,I);function He(){}He.prototype={nodeName:"#text",nodeType:M,splitText:function(N){var P=this.data,ne=P.substring(N);P=P.substring(0,N),this.data=this.nodeValue=P,this.length=P.length;var je=this.ownerDocument.createTextNode(ne);return this.parentNode&&this.parentNode.insertBefore(je,this.nextSibling),je}},g(He,fe);function Ce(){}Ce.prototype={nodeName:"#comment",nodeType:Q},g(Ce,fe);function De(){}De.prototype={nodeName:"#cdata-section",nodeType:L},g(De,fe);function Ie(){}Ie.prototype.nodeType=se,g(Ie,I);function Qe(){}Qe.prototype.nodeType=W,g(Qe,I);function Et(){}Et.prototype.nodeType=B,g(Et,I);function It(){}It.prototype.nodeType=E,g(It,I);function vt(){}vt.prototype.nodeName="#document-fragment",vt.prototype.nodeType=Y,g(vt,I);function Yt(){}Yt.prototype.nodeType=G,g(Yt,I);function Ft(){}Ft.prototype.serializeToString=function(N,P,ne){return zt.call(N,P,ne)},I.prototype.toString=zt;function zt(N,P){var ne=[],je=this.nodeType==9&&this.documentElement||this,qe=je.prefix,dt=je.namespaceURI;if(dt&&qe==null){var qe=je.lookupPrefix(dt);if(qe==null)var $t=[{namespace:dt,prefix:null}]}return ln(this,ne,N,P,$t),ne.join("")}function At(N,P,ne){var je=N.prefix||"",qe=N.namespaceURI;if(!qe||je==="xml"&&qe===t.XML||qe===t.XMLNS)return!1;for(var dt=ne.length;dt--;){var $t=ne[dt];if($t.prefix===je)return $t.namespace!==qe}return!0}function Nt(N,P,ne){N.push(" ",P,'="',ne.replace(/[<>&"\t\n\r]/g,pe),'"')}function ln(N,P,ne,je,qe){if(qe||(qe=[]),je)if(N=je(N),N){if(typeof N=="string"){P.push(N);return}}else return;switch(N.nodeType){case S:var dt=N.attributes,$t=dt.length,Dt=N.firstChild,Zt=N.tagName;ne=t.isHTML(N.namespaceURI)||ne;var hn=Zt;if(!ne&&!N.prefix&&N.namespaceURI){for(var Qt,vn=0;vn<dt.length;vn++)if(dt.item(vn).name==="xmlns"){Qt=dt.item(vn).value;break}if(!Qt)for(var Tn=qe.length-1;Tn>=0;Tn--){var Wt=qe[Tn];if(Wt.prefix===""&&Wt.namespace===N.namespaceURI){Qt=Wt.namespace;break}}if(Qt!==N.namespaceURI)for(var Tn=qe.length-1;Tn>=0;Tn--){var Wt=qe[Tn];if(Wt.namespace===N.namespaceURI){Wt.prefix&&(hn=Wt.prefix+":"+Zt);break}}}P.push("<",hn);for(var gn=0;gn<$t;gn++){var sn=dt.item(gn);sn.prefix=="xmlns"?qe.push({prefix:sn.localName,namespace:sn.value}):sn.nodeName=="xmlns"&&qe.push({prefix:"",namespace:sn.value})}for(var gn=0;gn<$t;gn++){var sn=dt.item(gn);if(At(sn,ne,qe)){var an=sn.prefix||"",Bt=sn.namespaceURI;Nt(P,an?"xmlns:"+an:"xmlns",Bt),qe.push({prefix:an,namespace:Bt})}ln(sn,P,ne,je,qe)}if(Zt===hn&&At(N,ne,qe)){var an=N.prefix||"",Bt=N.namespaceURI;Nt(P,an?"xmlns:"+an:"xmlns",Bt),qe.push({prefix:an,namespace:Bt})}if(Dt||ne&&!/^(?:meta|link|img|br|hr|input)$/i.test(Zt)){if(P.push(">"),ne&&/^script$/i.test(Zt))for(;Dt;)Dt.data?P.push(Dt.data):ln(Dt,P,ne,je,qe.slice()),Dt=Dt.nextSibling;else for(;Dt;)ln(Dt,P,ne,je,qe.slice()),Dt=Dt.nextSibling;P.push("</",hn,">")}else P.push("/>");return;case H:case Y:for(var Dt=N.firstChild;Dt;)ln(Dt,P,ne,je,qe.slice()),Dt=Dt.nextSibling;return;case C:return Nt(P,N.name,N.value);case M:return P.push(N.data.replace(/[<&>]/g,pe));case L:return P.push("<![CDATA[",N.data,"]]>");case Q:return P.push("<!--",N.data,"-->");case se:var jt=N.publicId,Dn=N.systemId;if(P.push("<!DOCTYPE ",N.name),jt)P.push(" PUBLIC ",jt),Dn&&Dn!="."&&P.push(" ",Dn),P.push(">");else if(Dn&&Dn!=".")P.push(" SYSTEM ",Dn,">");else{var Mt=N.internalSubset;Mt&&P.push(" [",Mt,"]"),P.push(">")}return;case G:return P.push("<?",N.target," ",N.data,"?>");case E:return P.push("&",N.nodeName,";");default:P.push("??",N.nodeName)}}function dn(N,P,ne){var je;switch(P.nodeType){case S:je=P.cloneNode(!1),je.ownerDocument=N;case Y:break;case C:ne=!0;break}if(je||(je=P.cloneNode(!1)),je.ownerDocument=N,je.parentNode=null,ne)for(var qe=P.firstChild;qe;)je.appendChild(dn(N,qe,ne)),qe=qe.nextSibling;return je}function yt(N,P,ne){var je=new P.constructor;for(var qe in P)if(Object.prototype.hasOwnProperty.call(P,qe)){var dt=P[qe];typeof dt!="object"&&dt!=je[qe]&&(je[qe]=dt)}switch(P.childNodes&&(je.childNodes=new te),je.ownerDocument=N,je.nodeType){case S:var $t=P.attributes,Zt=je.attributes=new q,hn=$t.length;Zt._ownerElement=je;for(var Qt=0;Qt<hn;Qt++)je.setAttributeNode(yt(N,$t.item(Qt),!0));break;case C:ne=!0}if(ne)for(var vn=P.firstChild;vn;)je.appendChild(yt(N,vn,ne)),vn=vn.nextSibling;return je}function Fn(N,P,ne){N[P]=ne}try{if(Object.defineProperty){let N=function(P){switch(P.nodeType){case S:case Y:var ne=[];for(P=P.firstChild;P;)P.nodeType!==7&&P.nodeType!==8&&ne.push(N(P)),P=P.nextSibling;return ne.join("");default:return P.nodeValue}};var ot=N;Object.defineProperty(me.prototype,"length",{get:function(){return le(this),this.$$length}}),Object.defineProperty(I.prototype,"textContent",{get:function(){return N(this)},set:function(P){switch(this.nodeType){case S:case Y:for(;this.firstChild;)this.removeChild(this.firstChild);(P||String(P))&&this.appendChild(this.ownerDocument.createTextNode(P));break;default:this.data=P,this.value=P,this.nodeValue=P}}}),Fn=function(P,ne,je){P["$$"+ne]=je}}}catch{}return wa.DocumentType=Ie,wa.DOMException=V,wa.DOMImplementation=de,wa.Element=nt,wa.Node=I,wa.NodeList=te,wa.XMLSerializer=Ft,wa}var Ic={},Y0={},g2;function mD(){return g2||(g2=1,(function(n){var e=sm().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})(Y0)),Y0}var Kh={},y2;function pD(){if(y2)return Kh;y2=1;var n=sm().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 M(){}M.prototype={parse:function(k,j,Z){var V=this.domBuilder;V.startDocument(),se(j,j={}),L(k,j,Z,V,this.errorHandler),V.endDocument()}};function L(k,j,Z,V,te){function me(Ze){if(Ze>65535){Ze-=65536;var nt=55296+(Ze>>10),wt=56320+(Ze&1023);return String.fromCharCode(nt,wt)}else return String.fromCharCode(Ze)}function le(Ze){var nt=Ze.slice(1,-1);return Object.hasOwnProperty.call(Z,nt)?Z[nt]:nt.charAt(0)==="#"?me(parseInt(nt.substr(1).replace("x","0x"))):(te.error("entity not found:"+Ze),Ze)}function q(Ze){if(Ze>ve){var nt=k.substring(ve,Ze).replace(/&#?\w+;/g,le);I&&F(ve),V.characters(nt,0,Ze-ve),ve=Ze}}function F(Ze,nt){for(;Ze>=ie&&(nt=de.exec(k));)ee=nt.index,ie=ee+nt[0].length,I.lineNumber++;I.columnNumber=Ze-ee+1}for(var ee=0,ie=0,de=/.*(?:\r\n?|\n)|.*$/g,I=V.locator,pe=[{currentNSMap:j}],we={},ve=0;;){try{var ge=k.indexOf("<",ve);if(ge<0){if(!k.substr(ve).match(/^\s*$/)){var ht=V.doc,Ge=ht.createTextNode(k.substr(ve));ht.appendChild(Ge),V.currentElement=Ge}return}switch(ge>ve&&q(ge),k.charAt(ge+1)){case"/":var ft=k.indexOf(">",ge+3),Te=k.substring(ge+2,ft).replace(/[ \t\n\r]+$/g,""),Le=pe.pop();ft<0?(Te=k.substring(ge+2).replace(/[\s<].*/,""),te.error("end tag name: "+Te+" is not complete:"+Le.tagName),ft=ge+1+Te.length):Te.match(/\s</)&&(Te=Te.replace(/[\s<].*/,""),te.error("end tag name: "+Te+" maybe not complete"),ft=ge+1+Te.length);var ut=Le.localNSMap,Oe=Le.tagName==Te,_e=Oe||Le.tagName&&Le.tagName.toLowerCase()==Te.toLowerCase();if(_e){if(V.endElement(Le.uri,Le.localName,Te),ut)for(var Ke in ut)Object.prototype.hasOwnProperty.call(ut,Ke)&&V.endPrefixMapping(Ke);Oe||te.fatalError("end tag name: "+Te+" is not match the current start tagName:"+Le.tagName)}else pe.push(Le);ft++;break;case"?":I&&F(ge),ft=W(k,ge,V);break;case"!":I&&F(ge),ft=Y(k,ge,V,te);break;default:I&&F(ge);var Je=new O,bt=pe[pe.length-1].currentNSMap,ft=B(k,ge,Je,bt,le,te),kt=Je.length;if(!Je.closed&&H(k,ft,Je.tagName,we)&&(Je.closed=!0,Z.nbsp||te.warning("unclosed xml attribute")),I&&kt){for(var Pe=E(I,{}),Xe=0;Xe<kt;Xe++){var st=Je[Xe];F(st.offset),st.locator=E(I,{})}V.locator=Pe,G(Je,V,bt)&&pe.push(Je),V.locator=I}else G(Je,V,bt)&&pe.push(Je);n.isHTML(Je.uri)&&!Je.closed?ft=Q(k,ft,Je.tagName,le,V):ft++}}catch(Ze){if(Ze instanceof C)throw Ze;te.error("element parse error: "+Ze),ft=-1}ft>ve?ve=ft:q(Math.max(ge,ve)+1)}}function E(k,j){return j.lineNumber=k.lineNumber,j.columnNumber=k.columnNumber,j}function B(k,j,Z,V,te,me){function le(I,pe,we){Z.attributeNames.hasOwnProperty(I)&&me.fatalError("Attribute "+I+" redefined"),Z.addValue(I,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,te),we)}for(var q,F,ee=++j,ie=a;;){var de=k.charAt(ee);switch(de){case"=":if(ie===l)q=k.slice(j,ee),ie=h;else if(ie===u)ie=h;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ie===h||ie===l)if(ie===l&&(me.warning('attribute value must after "="'),q=k.slice(j,ee)),j=ee+1,ee=k.indexOf(de,j),ee>0)F=k.slice(j,ee),le(q,F,j-1),ie=g;else throw new Error("attribute value no end '"+de+"' match");else if(ie==f)F=k.slice(j,ee),le(q,F,j),me.warning('attribute "'+q+'" missed start quot('+de+")!!"),j=ee+1,ie=g;else throw new Error('attribute value must after "="');break;case"/":switch(ie){case a:Z.setTagName(k.slice(j,ee));case g:case _:case S:ie=S,Z.closed=!0;case f:case l:break;case u:Z.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return me.error("unexpected end of input"),ie==a&&Z.setTagName(k.slice(j,ee)),ee;case">":switch(ie){case a:Z.setTagName(k.slice(j,ee));case g:case _:case S:break;case f:case l:F=k.slice(j,ee),F.slice(-1)==="/"&&(Z.closed=!0,F=F.slice(0,-1));case u:ie===u&&(F=q),ie==f?(me.warning('attribute "'+F+'" missed quot(")!'),le(q,F,j)):((!n.isHTML(V[""])||!F.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+F+'" missed value!! "'+F+'" instead!!'),le(F,F,j));break;case h:throw new Error("attribute value missed!!")}return ee;case"":de=" ";default:if(de<=" ")switch(ie){case a:Z.setTagName(k.slice(j,ee)),ie=_;break;case l:q=k.slice(j,ee),ie=u;break;case f:var F=k.slice(j,ee);me.warning('attribute "'+F+'" missed quot(")!!'),le(q,F,j);case g:ie=_;break}else switch(ie){case u:Z.tagName,(!n.isHTML(V[""])||!q.match(/^(?:disabled|checked|selected)$/i))&&me.warning('attribute "'+q+'" missed value!! "'+q+'" instead2!!'),le(q,q,j),j=ee,ie=l;break;case g:me.warning('attribute space is required"'+q+'"!!');case _:ie=l,j=ee;break;case h:ie=f,j=ee;break;case S:throw new Error("elements closed character '/' and '>' must be connected to")}}ee++}}function G(k,j,Z){for(var V=k.tagName,te=null,de=k.length;de--;){var me=k[de],le=me.qName,q=me.value,I=le.indexOf(":");if(I>0)var F=me.prefix=le.slice(0,I),ee=le.slice(I+1),ie=F==="xmlns"&ⅇelse ee=le,F=null,ie=le==="xmlns"&&"";me.localName=ee,ie!==!1&&(te==null&&(te={},se(Z,Z={})),Z[ie]=te[ie]=q,me.uri=n.XMLNS,j.startPrefixMapping(ie,q))}for(var de=k.length;de--;){me=k[de];var F=me.prefix;F&&(F==="xml"&&(me.uri=n.XML),F!=="xmlns"&&(me.uri=Z[F||""]))}var I=V.indexOf(":");I>0?(F=k.prefix=V.slice(0,I),ee=k.localName=V.slice(I+1)):(F=null,ee=k.localName=V);var pe=k.uri=Z[F||""];if(j.startElement(pe,ee,V,k),k.closed){if(j.endElement(pe,ee,V),te)for(F in te)Object.prototype.hasOwnProperty.call(te,F)&&j.endPrefixMapping(F)}else return k.currentNSMap=Z,k.localNSMap=te,!0}function Q(k,j,Z,V,te){if(/^(?:script|textarea)$/i.test(Z)){var me=k.indexOf("</"+Z+">",j),le=k.substring(j+1,me);if(/[&<]/.test(le))return/^script$/i.test(Z)?(te.characters(le,0,le.length),me):(le=le.replace(/&#?\w+;/g,V),te.characters(le,0,le.length),me)}return j+1}function H(k,j,Z,V){var te=V[Z];return te==null&&(te=k.lastIndexOf("</"+Z+">"),te<j&&(te=k.lastIndexOf("</"+Z)),V[Z]=te),te<j}function se(k,j){for(var Z in k)Object.prototype.hasOwnProperty.call(k,Z)&&(j[Z]=k[Z])}function Y(k,j,Z,V){var te=k.charAt(j+2);switch(te){case"-":if(k.charAt(j+3)==="-"){var me=k.indexOf("-->",j+4);return me>j?(Z.comment(k,j+4,me-j-4),me+3):(V.error("Unclosed comment"),-1)}else return-1;default:if(k.substr(j+3,6)=="CDATA["){var me=k.indexOf("]]>",j+9);return Z.startCDATA(),Z.characters(k,j+9,me-j-9),Z.endCDATA(),me+3}var le=ae(k,j),q=le.length;if(q>1&&/!doctype/i.test(le[0][0])){var F=le[1][0],ee=!1,ie=!1;q>3&&(/^public$/i.test(le[2][0])?(ee=le[3][0],ie=q>4&&le[4][0]):/^system$/i.test(le[2][0])&&(ie=le[3][0]));var de=le[q-1];return Z.startDTD(F,ee,ie),Z.endDTD(),de.index+de[0].length}}return-1}function W(k,j,Z){var V=k.indexOf("?>",j);if(V){var te=k.substring(j,V).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return te?(te[0].length,Z.processingInstruction(te[1],te[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,Z){if(!i.test(k))throw new Error("invalid attribute:"+k);this.attributeNames[k]=this.length,this[this.length++]={qName:k,value:j,offset:Z}},length:0,getLocalName:function(k){return this[k].localName},getLocator:function(k){return this[k].locator},getQName:function(k){return this[k].qName},getURI:function(k){return this[k].uri},getValue:function(k){return this[k].value}};function ae(k,j){var Z,V=[],te=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(te.lastIndex=j,te.exec(k);Z=te.exec(k);)if(V.push(Z),Z[1])return V}return Kh.XMLReader=M,Kh.ParseError=C,Kh}var b2;function gD(){if(b2)return Ic;b2=1;var n=sm(),e=qw(),t=mD(),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 Q=this.options,H=new h,se=Q.domBuilder||new S,Y=Q.errorHandler,W=Q.locator,O=Q.xmlns||{},ae=/\/x?html?$/.test(G),k=ae?t.HTML_ENTITIES:t.XML_ENTITIES;W&&se.setDocumentLocator(W),H.errorHandler=_(Y,se,W),H.domBuilder=Q.domBuilder||se,ae&&(O[""]=l.HTML),O.xml=O.xml||l.XML;var j=Q.normalizeLineEndings||f;return B&&typeof B=="string"?H.parse(j(B),O,k):H.errorHandler.error("invalid doc source"),se.doc};function _(B,G,Q){if(!B){if(G instanceof S)return G;B=G}var H={},se=B instanceof Function;Q=Q||{};function Y(W){var O=B[W];!O&&se&&(O=B.length==2?function(ae){B(W,ae)}:B),H[W]=O&&function(ae){O("[xmldom "+W+"] "+ae+M(Q))}||function(){}}return Y("warning"),Y("error"),Y("fatalError"),H}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,Q,H){var se=this.doc,Y=se.createElementNS(B,Q||G),W=H.length;E(this,Y),this.currentElement=Y,this.locator&&C(this.locator,Y);for(var O=0;O<W;O++){var B=H.getURI(O),ae=H.getValue(O),Q=H.getQName(O),k=se.createAttributeNS(B,Q);this.locator&&C(H.getLocator(O),k),k.value=k.nodeValue=ae,Y.setAttributeNode(k)}},endElement:function(B,G,Q){var H=this.currentElement;H.tagName,this.currentElement=H.parentNode},startPrefixMapping:function(B,G){},endPrefixMapping:function(B){},processingInstruction:function(B,G){var Q=this.doc.createProcessingInstruction(B,G);this.locator&&C(this.locator,Q),E(this,Q)},ignorableWhitespace:function(B,G,Q){},characters:function(B,G,Q){if(B=L.apply(this,arguments),B){if(this.cdata)var H=this.doc.createCDATASection(B);else var H=this.doc.createTextNode(B);this.currentElement?this.currentElement.appendChild(H):/^\s*$/.test(B)&&this.doc.appendChild(H),this.locator&&C(this.locator,H)}},skippedEntity:function(B){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(B){(this.locator=B)&&(B.lineNumber=0)},comment:function(B,G,Q){B=L.apply(this,arguments);var H=this.doc.createComment(B);this.locator&&C(this.locator,H),E(this,H)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(B,G,Q){var H=this.doc.implementation;if(H&&H.createDocumentType){var se=H.createDocumentType(B,G,Q);this.locator&&C(this.locator,se),E(this,se),this.doc.doctype=se}},warning:function(B){console.warn("[xmldom warning] "+B,M(this.locator))},error:function(B){console.error("[xmldom error] "+B,M(this.locator))},fatalError:function(B){throw new u(B,this.locator)}};function M(B){if(B)return`
|
||
@`+(B.systemId||"")+"#[line:"+B.lineNumber+",col:"+B.columnNumber+"]"}function L(B,G,Q){return typeof B=="string"?B.substr(G,Q):B.length>=G+Q||G?new java.lang.String(B,G,Q)+"":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 Ic.__DOMHandler=S,Ic.normalizeLineEndings=f,Ic.DOMParser=g,Ic}var v2;function yD(){if(v2)return Lc;v2=1;var n=qw();return Lc.DOMImplementation=n.DOMImplementation,Lc.XMLSerializer=n.XMLSerializer,Lc.DOMParser=gD().DOMParser,Lc}var bD=yD();const x2=n=>!!n&&typeof n=="object",cr=(...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]=cr(e[i],t[i]):e[i]=t[i]}),e),{}),Vw=n=>Object.keys(n).map(e=>n[e]),vD=(n,e)=>{const t=[];for(let i=n;i<e;i++)t.push(i);return t},_u=n=>n.reduce((e,t)=>e.concat(t),[]),Gw=n=>{if(!n.length)return[];const e=[];for(let t=0;t<n.length;t++)e.push(n[t]);return e},xD=(n,e)=>n.reduce((t,i,a)=>(i[e]&&t.push(a),t),[]),_D=(n,e)=>Vw(n.reduce((t,i)=>(i.forEach(a=>{t[e(a)]=a}),t),{}));var wu={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 dd=({baseUrl:n="",source:e="",range:t="",indexRange:i=""})=>{const a={uri:e,resolvedUri:rm(n||"",e)};if(t||i){const u=(t||i).split("-");let h=ce.BigInt?ce.BigInt(u[0]):parseInt(u[0],10),f=ce.BigInt?ce.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=ce.BigInt(f)-ce.BigInt(h)+ce.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},wD=n=>{let e;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ce.BigInt(n.offset)+ce.BigInt(n.length)-ce.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),TD={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,M=_+h-S,L=Math.ceil(M*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(L,B)}}},SD=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}},xy=n=>{const{type:e,duration:t,timescale:i=1,periodDuration:a,sourceDuration:l}=n,{start:u,end:h}=TD[e](n),f=vD(u,h).map(SD(n));if(e==="static"){const g=f.length-1,_=typeof a=="number"?a:l;f[g].duration=_-t/i*g}return f},Kw=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(wu.NO_BASE_URL);const g=dd({baseUrl:e,source:t.sourceURL,range:t.range}),_=dd({baseUrl:e,source:e,indexRange:a});if(_.map=g,f){const S=xy(n);S.length&&(_.duration=S[0].duration,_.timeline=S[0].timeline)}else i&&(_.duration=i,_.timeline=l);return _.presentationTime=u||l,_.number=h,[_]},_y=(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 M=C,L=n.mediaSequence||0,E;typeof e.firstOffset=="bigint"?E=ce.BigInt(h)+e.firstOffset:E=h+e.firstOffset;for(let B=0;B<g.length;B++){const G=e.references[B],Q=G.referencedSize,H=G.subsegmentDuration;let se;typeof E=="bigint"?se=E+ce.BigInt(Q)-ce.BigInt(1):se=E+Q-1;const Y=`${E}-${se}`,O=Kw({baseUrl:t,timescale:f,timeline:l,periodStart:C,presentationTime:M,number:L,duration:H,sourceDuration:a,indexRange:Y,type:S})[0];i&&(O.map=i),_.push(O),typeof E=="bigint"?E+=ce.BigInt(Q):E+=Q,M+=H/f,L++}return n.segments=_,n},kD=["AUDIO","SUBTITLES"],ED=1/60,Ww=n=>_D(n,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),CD=(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 fD(n,kD,(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})},AD=({oldPlaylists:n,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:f}){return f===i.timeline});const a=CD(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)<ED});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})})},ND=({oldManifest:n,newManifest:e})=>{const t=n.playlists.concat(w2(n)),i=e.playlists.concat(w2(e));return e.timelineStarts=Ww([n.timelineStarts,e.timelineStarts]),AD({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},am=n=>n&&n.uri+"-"+wD(n.byterange),Q0=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=Vw(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=xD(i.segments||[],"discontinuity"),i))},wy=(n,e)=>{const t=am(n.sidx),i=t&&e[t]&&e[t].sidx;return i&&_y(n,i,n.sidx.resolvedUri),n},DD=(n,e={})=>{if(!Object.keys(e).length)return n;for(const t in n)n[t]=wy(n[t],e);return n},MD=({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},jD=({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},RD=(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 _=wy(MD(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},OD=(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(wy(jD(i),e)),t},{}),LD=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),{}),ID=({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},BD=({attributes:n})=>n.mimeType==="video/mp4"||n.mimeType==="video/webm"||n.contentType==="video",PD=({attributes:n})=>n.mimeType==="audio/mp4"||n.mimeType==="audio/webm"||n.contentType==="audio",FD=({attributes:n})=>n.mimeType==="text/vtt"||n.contentType==="text",UD=(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)},[]):[],zD=({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,_=Q0(n.filter(BD)).map(ID),S=Q0(n.filter(PD)),C=Q0(n.filter(FD)),M=n.map(se=>se.attributes.captionServices).filter(Boolean),L={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:u,playlists:DD(_,i)};g>=0&&(L.minimumUpdatePeriod=g*1e3),e&&(L.locations=e),t&&(L.contentSteering=t),h==="dynamic"&&(L.suggestedPresentationDelay=f),l&&l.length>0&&(L.eventStream=l);const E=L.playlists.length===0,B=S.length?RD(S,i,E):null,G=C.length?OD(C,i):null,Q=_.concat(S2(B),S2(G)),H=Q.map(({timelineStarts:se})=>se);return L.timelineStarts=Ww(H),UD(Q,L.timelineStarts),B&&(L.mediaGroups.AUDIO.audio=B),G&&(L.mediaGroups.SUBTITLES.subs=G),M.length&&(L.mediaGroups["CLOSED-CAPTIONS"].cc=LD(M)),a?ND({oldManifest:a,newManifest:L}):L},HD=(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)},Xw=(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],M=C.d,L=C.r||0,E=C.t||0;_<0&&(_=E),E&&E>_&&(_=E);let B;if(L<0){const H=S+1;H===e.length?t==="dynamic"&&i>0&&a.indexOf("$Number$")>0?B=HD(n,_,M):B=(l*u-_)/M:B=(e[H].t-_)/M}else B=L+1;const G=h+g.length+B;let Q=h+g.length;for(;Q<G;)g.push({number:Q,duration:M/u,time:_,timeline:f}),_+=M,Q++}return g},$D=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,qD=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,qD(e)),VD=(n,e)=>!n.duration&&!e?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodStart}]:n.duration?xy(n):Xw(n,e),GD=(n,e)=>{const t={RepresentationID:n.id,Bandwidth:n.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=n,a=dd({baseUrl:n.baseUrl,source:k2(i.sourceURL,t),range:i.range});return VD(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:rm(n.baseUrl||"",h),map:a,number:u.number,presentationTime:_}})},KD=(n,e)=>{const{baseUrl:t,initialization:i={}}=n,a=dd({baseUrl:t,source:i.sourceURL,range:i.range}),l=dd({baseUrl:t,source:e.media,range:e.mediaRange});return l.map=a,l},WD=(n,e)=>{const{duration:t,segmentUrls:i=[],periodStart:a}=n;if(!t&&!e||t&&e)throw new Error(wu.SEGMENT_TIME_UNSPECIFIED);const l=i.map(f=>KD(n,f));let u;return t&&(u=xy(n)),e&&(u=Xw(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)},XD=({attributes:n,segmentInfo:e})=>{let t,i;e.template?(i=GD,t=cr(n,e.template)):e.base?(i=Kw,t=cr(n,e.base)):e.list&&(i=WD,t=cr(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},YD=n=>n.map(XD),Mi=(n,e)=>Gw(n.childNodes).filter(({tagName:t})=>t===e),xd=n=>n.textContent.trim(),QD=n=>parseFloat(n.split("/").reduce((e,t)=>e/t)),Xl=n=>{const h=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(n);if(!h)return 0;const[f,g,_,S,C,M]=h.slice(1);return parseFloat(f||0)*31536e3+parseFloat(g||0)*2592e3+parseFloat(_||0)*86400+parseFloat(S||0)*3600+parseFloat(C||0)*60+parseFloat(M||0)},ZD=n=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)),E2={mediaPresentationDuration(n){return Xl(n)},availabilityStartTime(n){return ZD(n)/1e3},minimumUpdatePeriod(n){return Xl(n)},suggestedPresentationDelay(n){return Xl(n)},type(n){return n},timeShiftBufferDepth(n){return Xl(n)},start(n){return Xl(n)},width(n){return parseInt(n,10)},height(n){return parseInt(n,10)},bandwidth(n){return parseInt(n,10)},frameRate(n){return QD(n)},startNumber(n){return parseInt(n,10)},timescale(n){return parseInt(n,10)},presentationTimeOffset(n){return parseInt(n,10)},duration(n){const e=parseInt(n,10);return isNaN(e)?Xl(n):e},d(n){return parseInt(n,10)},t(n){return parseInt(n,10)},r(n){return parseInt(n,10)},presentationTime(n){return parseInt(n,10)},DEFAULT(n){return n}},nr=n=>n&&n.attributes?Gw(n.attributes).reduce((e,t)=>{const i=E2[t.name]||E2.DEFAULT;return e[t.name]=i(t.value),e},{}):{},JD={"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"},om=(n,e)=>e.length?_u(n.map(function(t){return e.map(function(i){const a=xd(i),l=rm(t.baseUrl,a),u=cr(nr(i),{baseUrl:l});return l!==a&&!u.serviceLocation&&t.serviceLocation&&(u.serviceLocation=t.serviceLocation),u})})):n,Ty=n=>{const e=Mi(n,"SegmentTemplate")[0],t=Mi(n,"SegmentList")[0],i=t&&Mi(t,"SegmentURL").map(S=>cr({tag:"SegmentURL"},nr(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&&nr(e);g&&f?g.initialization=f&&nr(f):g&&g.initialization&&(g.initialization={sourceURL:g.initialization});const _={template:g,segmentTimeline:u&&Mi(u,"S").map(S=>nr(S)),list:t&&cr(nr(t),{segmentUrls:i,initialization:nr(f)}),base:a&&cr(nr(a),{initialization:nr(f)})};return Object.keys(_).forEach(S=>{_[S]||delete _[S]}),_},e4=(n,e,t)=>i=>{const a=Mi(i,"BaseURL"),l=om(e,a),u=cr(n,nr(i)),h=Ty(i);return l.map(f=>({segmentInfo:cr(t,h),attributes:cr(u,f)}))},t4=n=>n.reduce((e,t)=>{const i=nr(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const a=JD[i.schemeIdUri];if(a){e[a]={attributes:i};const l=Mi(t,"cenc:pssh")[0];if(l){const u=xd(l);e[a].pssh=u&&Pw(u)}}return e},{}),n4=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})},i4=n=>_u(Mi(n.node,"EventStream").map(e=>{const t=nr(e),i=t.schemeIdUri;return Mi(e,"Event").map(a=>{const l=nr(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:xd(a)||l.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),r4=(n,e,t)=>i=>{const a=nr(i),l=om(e,Mi(i,"BaseURL")),u=Mi(i,"Role")[0],h={role:nr(u)};let f=cr(n,a,h);const g=Mi(i,"Accessibility")[0],_=n4(nr(g));_&&(f=cr(f,{captionServices:_}));const S=Mi(i,"Label")[0];if(S&&S.childNodes.length){const B=S.childNodes[0].nodeValue.trim();f=cr(f,{label:B})}const C=t4(Mi(i,"ContentProtection"));Object.keys(C).length&&(f=cr(f,{contentProtection:C}));const M=Ty(i),L=Mi(i,"Representation"),E=cr(t,M);return _u(L.map(e4(f,l,E)))},s4=(n,e)=>(t,i)=>{const a=om(e,Mi(t.node,"BaseURL")),l=cr(n,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(l.periodDuration=t.attributes.duration);const u=Mi(t.node,"AdaptationSet"),h=Ty(t.node);return _u(u.map(r4(l,a,h)))},a4=(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=cr({serverURL:xd(n[0])},nr(n[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},o4=({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,l4=(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(wu.INVALID_NUMBER_OF_PERIOD);const h=Mi(n,"Location"),f=nr(n),g=om([{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(xd));const S=[];return u.forEach((C,M)=>{const L=nr(C),E=S[M-1];L.start=o4({attributes:L,priorPeriodAttributes:E?E.attributes:null,mpdType:f.type}),S.push({node:C,attributes:L})}),{locations:f.locations,contentSteeringInfo:a4(_,l),representationInfo:_u(S.map(s4(f,g))),eventStream:_u(S.map(i4))}},Yw=n=>{if(n==="")throw new Error(wu.DASH_EMPTY_MANIFEST);const e=new bD.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(wu.DASH_INVALID_XML);return i},u4=n=>{const e=Mi(n,"UTCTiming")[0];if(!e)return null;const t=nr(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(wu.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},c4=(n,e={})=>{const t=l4(Yw(n),e),i=YD(t.representationInfo);return zD({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},d4=n=>u4(Yw(n));var Z0,C2;function h4(){if(C2)return Z0;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 Z0={getUint64:e,MAX_UINT32:n},Z0}var J0,A2;function f4(){if(A2)return J0;A2=1;var n=h4().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 J0=e,J0}var m4=f4();const p4=Nu(m4);var g4=nn([73,68,51]),y4=function(e,t){t===void 0&&(t=0),e=nn(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},Gc=function n(e,t){return t===void 0&&(t=0),e=nn(e),e.length-t<10||!Di(e,g4,{offset:t})?t:(t+=y4(e,t),n(e,t))},N2=function(e){return typeof e=="string"?$w(e):e},b4=function(e){return Array.isArray(e)?e.map(function(t){return N2(t)}):[N2(e)]},v4=function n(e,t,i){i===void 0&&(i=!1),t=b4(t),e=nn(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},Wh={EBML:nn([26,69,223,163]),DocType:nn([66,130]),Segment:nn([24,83,128,103]),SegmentInfo:nn([21,73,169,102]),Tracks:nn([22,84,174,107]),Track:nn([174]),TrackNumber:nn([215]),DefaultDuration:nn([35,227,131]),TrackEntry:nn([174]),TrackType:nn([131]),FlagDefault:nn([136]),CodecID:nn([134]),CodecPrivate:nn([99,162]),VideoTrack:nn([224]),AudioTrack:nn([225]),Cluster:nn([31,67,182,117]),Timestamp:nn([231]),TimestampScale:nn([42,215,177]),BlockGroup:nn([160]),BlockDuration:nn([155]),Block:nn([161]),SimpleBlock:nn([163])},Bg=[128,64,32,16,8,4,2,1],x4=function(e){for(var t=1,i=0;i<Bg.length&&!(e&Bg[i]);i++)t++;return t},kf=function(e,t,i,a){i===void 0&&(i=!0),a===void 0&&(a=!1);var l=x4(e[t]),u=e.subarray(t,t+l);return i&&(u=Array.prototype.slice.call(e,t,t+l),u[0]^=Bg[l-1]),{length:l,value:cD(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"?dD(e):e},_4=function(e){return Array.isArray(e)?e.map(function(t){return D2(t)}):[D2(e)]},w4=function n(e,t,i){if(i>=t.length)return t.length;var a=kf(t,i,!1);if(Di(e.bytes,a.bytes))return i;var l=kf(t,i+a.length);return n(e,t,i+l.length+l.value+a.length)},M2=function n(e,t){t=_4(t),e=nn(e);var i=[];if(!t.length)return i;for(var a=0;a<e.length;){var l=kf(e,a,!1),u=kf(e,a+l.length),h=a+l.length+u.length;u.value===127&&(u.value=w4(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},T4=nn([0,0,0,1]),S4=nn([0,0,1]),k4=nn([0,0,3]),E4=function(e){for(var t=[],i=1;i<e.length-2;)Di(e.subarray(i,i+3),k4)&&(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},Qw=function(e,t,i,a){e=nn(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),T4)?f=4:Di(e.subarray(l),S4)&&(f=3),!f){l++;continue}if(h++,u)return E4(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)},C4=function(e,t,i){return Qw(e,"h264",t,i)},A4=function(e,t,i){return Qw(e,"h265",t,i)},Er={webm:nn([119,101,98,109]),matroska:nn([109,97,116,114,111,115,107,97]),flac:nn([102,76,97,67]),ogg:nn([79,103,103,83]),ac3:nn([11,119]),riff:nn([82,73,70,70]),avi:nn([65,86,73]),wav:nn([87,65,86,69]),"3gp":nn([102,116,121,112,51,103]),mp4:nn([102,116,121,112]),fmp4:nn([115,116,121,112]),mov:nn([102,116,121,112,113,116]),moov:nn([109,111,111,118]),moof:nn([109,111,111,102])},Tu={aac:function(e){var t=Gc(e);return Di(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Gc(e);return Di(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=M2(e,[Wh.EBML,Wh.DocType])[0];return Di(t,Er.webm)},mkv:function(e){var t=M2(e,[Wh.EBML,Wh.DocType])[0];return Di(t,Er.matroska)},mp4:function(e){if(Tu["3gp"](e)||Tu.mov(e))return!1;if(Di(e,Er.mp4,{offset:4})||Di(e,Er.fmp4,{offset:4})||Di(e,Er.moof,{offset:4})||Di(e,Er.moov,{offset:4}))return!0},mov:function(e){return Di(e,Er.mov,{offset:4})},"3gp":function(e){return Di(e,Er["3gp"],{offset:4})},ac3:function(e){var t=Gc(e);return Di(e,Er.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=Gc(e);return Di(e,Er.flac,{offset:t})},ogg:function(e){return Di(e,Er.ogg)},avi:function(e){return Di(e,Er.riff)&&Di(e,Er.avi,{offset:8})},wav:function(e){return Di(e,Er.riff)&&Di(e,Er.wav,{offset:8})},h264:function(e){return C4(e,7,3).length},h265:function(e){return A4(e,[32,33],3).length}},Pg=Object.keys(Tu).filter(function(n){return n!=="ts"&&n!=="h264"&&n!=="h265"}).concat(["ts","h264","h265"]);Pg.forEach(function(n){var e=Tu[n];Tu[n]=function(t){return e(nn(t))}});var N4=Tu,Sy=function(e){e=nn(e);for(var t=0;t<Pg.length;t++){var i=Pg[t];if(N4[i](e))return i}return""},D4=function(e){return v4(e,["moof"]).length>0},eg,j2;function M4(){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 ll=M4();var Fg="8.23.4";const Ca={},Co=function(n,e){return Ca[n]=Ca[n]||[],e&&(Ca[n]=Ca[n].concat(e)),Ca[n]},j4=function(n,e){Co(n,e)},Zw=function(n,e){const t=Co(n).indexOf(e);return t<=-1?!1:(Ca[n]=Ca[n].slice(),Ca[n].splice(t,1),!0)},R4=function(n,e){Co(n,[].concat(e).map(t=>{const i=(...a)=>(Zw(n,i),t(...a));return i}))},Ef={prefixed:!0},df=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],R2=df[0];let Kc;for(let n=0;n<df.length;n++)if(df[n][1]in _t){Kc=df[n];break}if(Kc){for(let n=0;n<Kc.length;n++)Ef[R2[n]]=Kc[n];Ef.prefixed=Kc[0]!==R2[0]}let zr=[];const O4=(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+":"),zr){zr.push([].concat(l));const _=zr.length-1e3;zr.splice(0,_>0?_:0)}if(!ce.console)return;let g=ce.console[i];!g&&i==="debug"&&(g=ce.console.info||ce.console.log),!(!g||!u||!h.test(i))&&g[Array.isArray(l)?"apply":"call"](ce.console,l)};function Ug(n,e=":",t=""){let i="info",a;function l(...u){a("log",i,u)}return a=O4(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 Ug(S,g,_)},l.createNewLogger=(u,h,f)=>Ug(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=()=>zr?[].concat(zr):[],l.history.filter=u=>(zr||[]).filter(h=>new RegExp(`.*${u}.*`).test(h[0])),l.history.clear=()=>{zr&&(zr.length=0)},l.history.disable=()=>{zr!==null&&(zr.length=0,zr=null)},l.history.enable=()=>{zr===null&&(zr=[])},l.error=(...u)=>a("error",i,u),l.warn=(...u)=>a("warn",i,u),l.debug=(...u)=>a("debug",i,u),l}const En=Ug("VIDEOJS"),Jw=En.createLogger,L4=Object.prototype.toString,eT=function(n){return ta(n)?Object.keys(n):[]};function ou(n,e){eT(n).forEach(t=>e(n[t],t))}function tT(n,e,t=0){return eT(n).reduce((i,a)=>e(i,n[a],a),t)}function ta(n){return!!n&&typeof n=="object"}function Su(n){return ta(n)&&L4.call(n)==="[object Object]"&&n.constructor===Object}function mi(...n){const e={};return n.forEach(t=>{t&&ou(t,(i,a)=>{if(!Su(i)){e[a]=i;return}Su(e[a])||(e[a]={}),e[a]=mi(e[a],i)})}),e}function nT(n={}){const e=[];for(const t in n)if(n.hasOwnProperty(t)){const i=n[t];e.push(i)}return e}function lm(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 I4=Object.freeze({__proto__:null,each:ou,reduce:tT,isObject:ta,isPlain:Su,merge:mi,values:nT,defineLazyProperty:lm});let ky=!1,iT=null,js=!1,rT,sT=!1,lu=!1,uu=!1,na=!1,Ey=null,um=null;const B4=!!(ce.cast&&ce.cast.framework&&ce.cast.framework.CastReceiverContext);let aT=null,Cf=!1,cm=!1,Af=!1,dm=!1,Nf=!1,Df=!1,Mf=!1;const hd=!!(Du()&&("ontouchstart"in ce||ce.navigator.maxTouchPoints||ce.DocumentTouch&&ce.document instanceof ce.DocumentTouch)),po=ce.navigator&&ce.navigator.userAgentData;po&&po.platform&&po.brands&&(js=po.platform==="Android",lu=!!po.brands.find(n=>n.brand==="Microsoft Edge"),uu=!!po.brands.find(n=>n.brand==="Chromium"),na=!lu&&uu,Ey=um=(po.brands.find(n=>n.brand==="Chromium")||{}).version||null,cm=po.platform==="Windows");if(!uu){const n=ce.navigator&&ce.navigator.userAgent||"";ky=/iPod/i.test(n),iT=(function(){const e=n.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),js=/Android/i.test(n),rT=(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})(),sT=/Firefox/i.test(n),lu=/Edg/i.test(n),uu=/Chrome/i.test(n)||/CriOS/i.test(n),na=!lu&&uu,Ey=um=(function(){const e=n.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),aT=(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})(),Nf=/Tizen/i.test(n),Df=/Web0S/i.test(n),Mf=Nf||Df,Cf=/Safari/i.test(n)&&!na&&!js&&!lu&&!Mf,cm=/Windows/i.test(n),Af=/iPad/i.test(n)||Cf&&hd&&!/iPhone/i.test(n),dm=/iPhone/i.test(n)&&!Af}const xr=dm||Af||ky,hm=(Cf||xr)&&!na;var oT=Object.freeze({__proto__:null,get IS_IPOD(){return ky},get IOS_VERSION(){return iT},get IS_ANDROID(){return js},get ANDROID_VERSION(){return rT},get IS_FIREFOX(){return sT},get IS_EDGE(){return lu},get IS_CHROMIUM(){return uu},get IS_CHROME(){return na},get CHROMIUM_VERSION(){return Ey},get CHROME_VERSION(){return um},IS_CHROMECAST_RECEIVER:B4,get IE_VERSION(){return aT},get IS_SAFARI(){return Cf},get IS_WINDOWS(){return cm},get IS_IPAD(){return Af},get IS_IPHONE(){return dm},get IS_TIZEN(){return Nf},get IS_WEBOS(){return Df},get IS_SMART_TV(){return Mf},TOUCH_ENABLED:hd,IS_IOS:xr,IS_ANY_SAFARI:hm});function O2(n){return typeof n=="string"&&!!n.trim()}function P4(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Du(){return _t===ce.document}function Mu(n){return ta(n)&&n.nodeType===1}function lT(){try{return ce.parent!==ce.self}catch{return!0}}function uT(n){return function(e,t){if(!O2(e))return _t[n](null);O2(t)&&(t=_t.querySelector(t));const i=Mu(t)?t:_t;return i[n]&&i[n](e)}}function cn(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&&Cy(a,i),a}function No(n,e){return typeof n.textContent>"u"?n.innerText=e:n.textContent=e,n}function zg(n,e){e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}function nd(n,e){return P4(e),n.classList.contains(e)}function dl(n,...e){return n.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),n}function fm(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 cT(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 dT(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 hT(n,e){return n.getAttribute(e)}function ku(n,e,t){n.setAttribute(e,t)}function mm(n,e){n.removeAttribute(e)}function fT(){_t.body.focus(),_t.onselectstart=function(){return!1}}function mT(){_t.onselectstart=function(){return!0}}function Eu(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(Cu(n,"height"))),t.width||(t.width=parseFloat(Cu(n,"width"))),t}}function fd(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[Ef.fullscreenElement];)i+=n.offsetLeft,a+=n.offsetTop,n=n.offsetParent;return{left:i,top:a,width:e,height:t}}function pm(n,e){const t={x:0,y:0};if(xr){let _=n;for(;_&&_.nodeName.toLowerCase()!=="html";){const S=Cu(_,"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&&ce.WebKitCSSMatrix){const C=ce.getComputedStyle(_.assignedSlot.parentElement).transform,M=new ce.WebKitCSSMatrix(C);t.x+=M.m41,t.y+=M.m42}_=_.parentNode||_.host}}const i={},a=fd(e.target),l=fd(n),u=l.width,h=l.height;let f=e.offsetY-(l.top-a.top),g=e.offsetX-(l.left-a.left);return e.changedTouches&&(g=e.changedTouches[0].pageX-l.left,f=e.changedTouches[0].pageY+l.top,xr&&(g-=t.x,f-=t.y)),i.y=1-Math.max(0,Math.min(1,f/h)),i.x=Math.max(0,Math.min(1,g/u)),i}function pT(n){return ta(n)&&n.nodeType===3}function gm(n){for(;n.firstChild;)n.removeChild(n.firstChild);return n}function gT(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(e=>{if(typeof e=="function"&&(e=e()),Mu(e)||pT(e))return e;if(typeof e=="string"&&/\S/.test(e))return _t.createTextNode(e)}).filter(e=>e)}function Cy(n,e){return gT(e).forEach(t=>n.appendChild(t)),n}function yT(n,e){return Cy(gm(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=uT("querySelector"),bT=uT("querySelectorAll");function Cu(n,e){if(!n||!e)return"";if(typeof ce.getComputedStyle=="function"){let t;try{t=ce.getComputedStyle(n)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function vT(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 xT=Object.freeze({__proto__:null,isReal:Du,isEl:Mu,isInFrame:lT,createEl:cn,textContent:No,prependTo:zg,hasClass:nd,addClass:dl,removeClass:fm,toggleClass:cT,setAttributes:dT,getAttributes:xo,getAttribute:hT,setAttribute:ku,removeAttribute:mm,blockTextSelection:fT,unblockTextSelection:mT,getBoundingClientRect:Eu,findPosition:fd,getPointerPosition:pm,isTextNode:pT,emptyEl:gm,normalizeContent:gT,appendContent:Cy,insertContent:yT,isSingleLeftClick:md,$:Ao,$$:bT,computedStyle:Cu,copyStyleSheetsToWindow:vT});let _T=!1,Hg;const F4=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{$g(1);break}}else _T||$g(1)};function $g(n,e){Du()&&(e&&(Hg=e),ce.setTimeout(F4,n))}function qg(){_T=!0,ce.removeEventListener("load",qg)}Du()&&(_t.readyState==="complete"?qg():ce.addEventListener("load",qg));const wT=function(n){const e=_t.createElement("style");return e.className=n,e},TT=function(n,e){n.styleSheet?n.styleSheet.cssText=e:n.textContent=e};var Ar=new WeakMap;const U4=3;let z4=U4;function ys(){return z4++}function L2(n,e){if(!Ar.has(n))return;const t=Ar.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&&Ar.delete(n)}function Ay(n,e,t,i){t.forEach(function(a){n(e,a,i)})}function ym(n){if(n.fixed_)return n;function e(){return!0}function t(){return!1}if(!n||!n.isPropagationStopped||!n.isImmediatePropagationStopped){const i=n||ce.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 Xh;const H4=function(){if(typeof Xh!="boolean"){Xh=!1;try{const n=Object.defineProperty({},"passive",{get(){Xh=!0}});ce.addEventListener("test",null,n),ce.removeEventListener("test",null,n)}catch{}}return Xh},$4=["touchstart","touchmove"];function as(n,e,t){if(Array.isArray(e))return Ay(as,n,e,t);Ar.has(n)||Ar.set(n,{});const i=Ar.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=ym(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;H4()&&$4.indexOf(e)>-1&&(a={passive:!0}),n.addEventListener(e,i.dispatcher,a)}else n.attachEvent&&n.attachEvent("on"+e,i.dispatcher)}function _r(n,e,t){if(!Ar.has(n))return;const i=Ar.get(n);if(!i.handlers)return;if(Array.isArray(e))return Ay(_r,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 ju(n,e,t){const i=Ar.has(n)?Ar.get(n):{},a=n.parentNode||n.ownerDocument;if(typeof e=="string"?e={type:e,target:n}:e.target||(e.target=n),e=ym(e),i.dispatcher&&i.dispatcher.call(n,e,t),a&&!e.isPropagationStopped()&&e.bubbles===!0)ju.call(null,a,e,t);else if(!a&&!e.defaultPrevented&&e.target&&e.target[e.type]){Ar.has(e.target)||Ar.set(e.target,{});const l=Ar.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 bm(n,e,t){if(Array.isArray(e))return Ay(bm,n,e,t);const i=function(){_r(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),as(n,e,i)}function Ny(n,e,t){const i=function(){_r(n,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||ys(),as(n,e,i)}var q4=Object.freeze({__proto__:null,fixEvent:ym,on:as,off:_r,trigger:ju,one:bm,any:Ny});const bs=30,Ti=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=ce.performance.now();return function(...a){const l=ce.performance.now();l-t>=e&&(n(...a),t=l)}},ST=function(n,e,t,i=ce){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 V4=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:bs,bind_:Ti,throttle:ia,debounce:ST});let Bc;class os{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},as(this,e,t),this.addEventListener=i}off(e,t){_r(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},bm(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Ny(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=ym(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ju(this,e)}queueTrigger(e){Bc||(Bc=new Map);const t=e.type||e;let i=Bc.get(this);i||(i=new Map,Bc.set(this,i));const a=i.get(t);i.delete(t),ce.clearTimeout(a);const l=ce.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Bc.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 vm=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"),G4=(n,e)=>{Da(n)?e():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(e))},Vg=n=>typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length,jf=(n,e,t)=>{if(!n||!n.nodeName&&!Da(n))throw new Error(`Invalid target for ${vm(e)}#${t}; must be a DOM node or evented object.`)},kT=(n,e,t)=>{if(!Vg(n))throw new Error(`Invalid event type for ${vm(e)}#${t}; must be a non-empty string or array.`)},ET=(n,e,t)=>{if(typeof n!="function")throw new Error(`Invalid listener for ${vm(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]),jf(a,n,t),kT(l,n,t),ET(u,n,t),u=Ti(n,u),{isTargetingSelf:i,target:a,type:l,listener:u}},Jo=(n,e,t,i)=>{jf(n,n,e),n.nodeName?q4[e](n,t,i):n[e](t,i)},K4={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||Vg(n))_r(this.eventBusEl_,n,e);else{const i=n,a=e;jf(i,this,"off"),kT(a,this,"off"),ET(t,this,"off"),t=Ti(this,t),this.off("dispose",t),i.nodeName?(_r(i,a,t),_r(i,"dispose",t)):Da(i)&&(i.off(a,t),i.off("dispose",t))}},trigger(n,e){jf(this.eventBusEl_,this,"trigger");const t=n&&typeof n!="string"?n.type:n;if(!Vg(t))throw new Error(`Invalid event type for ${vm(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ju(this.eventBusEl_,n,e)}};function Dy(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_=cn("span",{className:"vjs-event-bus"});return Object.assign(n,K4),n.eventedCallbacks&&n.eventedCallbacks.forEach(i=>{i()}),n.on("dispose",()=>{n.off(),[n,n.el_,n.eventBusEl_].forEach(function(i){i&&Ar.has(i)&&Ar.delete(i)}),ce.setTimeout(()=>{n.eventBusEl_=null},0)}),n}const W4={state:{},setState(n){typeof n=="function"&&(n=n());let e;return ou(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 CT(n,e){return Object.assign(n,W4),n.state=Object.assign({},n.state,e),typeof n.handleStateChanged=="function"&&Da(n)&&n.on("statechanged",n.handleStateChanged),n}const id=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())},AT=function(n,e){return qi(n)===qi(e)};var X4=Object.freeze({__proto__:null,toLowerCase:id,toTitleCase:qi,titleCaseEquals:AT});class tt{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=mi({},this.options_),t=this.options_=mi(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&&(Dy(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),CT(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_=mi(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return cn(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 M=C;return typeof C>"u"&&(M=_),M})),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=cn("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=tt.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_[id(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_:Mu(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_[id(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=tt.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=tt.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 bT(e,t||this.contentEl())}hasClass(e){return nd(this.el_,e)}addClass(...e){dl(this.el_,...e)}removeClass(...e){fm(this.el_,...e)}toggleClass(e,t){cT(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 hT(this.el_,e)}setAttribute(e,t){ku(this.el_,e,t)}removeAttribute(e){mm(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=Cu(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=ce.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&&ce.performance.now()-e<a&&(h.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ti(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=Ti(this,e),this.clearTimersOnDispose_(),i=ce.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),ce.clearTimeout(e)),e}setInterval(e,t){e=Ti(this,e),this.clearTimersOnDispose_();const i=ce.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),ce.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ti(this,e),t=ce.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=Ti(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),ce.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=ce.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"||ce.getComputedStyle(l).height==="0px"||ce.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||ce.innerWidth)||u.y<0||u.y>(_t.documentElement.clientHeight||ce.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=tt.getComponent("Tech"),a=i&&i.isTech(t),l=tt===t||tt.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),tt.components_||(tt.components_={});const u=tt.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 tt.components_[e]=t,tt.components_[id(e)]=t,t}static getComponent(e){if(!(!e||!tt.components_))return tt.components_[e]}}tt.registerComponent("Component",tt);function Y4(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 Y4(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)},ce.Symbol&&ce.Symbol.iterator&&(e[ce.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 NT=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 My=NT;function DT(n){My=n}function MT(){My=NT}function bl(n,e=n){return My(n,e)}var Q4=Object.freeze({__proto__:null,createTimeRanges:Ms,createTimeRange:Ms,setFormatTime:DT,resetFormatTime:MT,formatTime:bl});function jT(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 Ii(n){if(n instanceof Ii)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=Ii.defaultMessages[this.code]||"")}Ii.prototype.code=0;Ii.prototype.message="";Ii.prototype.status=null;Ii.prototype.metadata=null;Ii.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ii.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Ii.MEDIA_ERR_CUSTOM=0;Ii.prototype.MEDIA_ERR_CUSTOM=0;Ii.MEDIA_ERR_ABORTED=1;Ii.prototype.MEDIA_ERR_ABORTED=1;Ii.MEDIA_ERR_NETWORK=2;Ii.prototype.MEDIA_ERR_NETWORK=2;Ii.MEDIA_ERR_DECODE=3;Ii.prototype.MEDIA_ERR_DECODE=3;Ii.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ii.MEDIA_ERR_ENCRYPTED=5;Ii.prototype.MEDIA_ERR_ENCRYPTED=5;function rd(n){return n!=null&&typeof n.then=="function"}function Ys(n){rd(n)&&n.then(null,e=>{})}const Gg=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}})})},Z4=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=Gg(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(Gg))},J4=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 Kg={textTracksToJson:Z4,jsonToTextTracks:J4,trackToJson:Gg};const ig="vjs-modal-dialog";class Ru extends tt{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_=cn("div",{className:`${ig}-content`},{role:"document"}),this.descEl_=cn("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(),yT(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"),gm(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 ce.HTMLAnchorElement||t instanceof ce.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof ce.HTMLInputElement||t instanceof ce.HTMLSelectElement||t instanceof ce.HTMLTextAreaElement||t instanceof ce.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof ce.HTMLIFrameElement||t instanceof ce.HTMLObjectElement||t instanceof ce.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ru.prototype.options_={pauseOnOpen:!0,temporary:!0};tt.registerComponent("ModalDialog",Ru);class vl 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}}vl.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const n in vl.prototype.allowedEvents_)vl.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 RT extends vl{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 OT extends vl{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 jy extends vl{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class eM{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 Rf{constructor(e){Rf.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 tM={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},nM={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},iM={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},B2={disabled:"disabled",hidden:"hidden",showing:"showing"};class Ry 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 Oy=function(n){return new URL(n,_t.baseURI)},LT=function(n){return new URL(n,_t.baseURI).href},Ly=function(n){if(typeof n=="string"){const t=n.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},xm=function(n,e=ce.location){return Oy(n).origin!==e.origin};var rM=Object.freeze({__proto__:null,parseUrl:Oy,getAbsoluteURL:LT,getFileExtension:Ly,isCrossOrigin:xm});const P2=function(n,e){const t=new ce.WebVTT.Parser(ce,ce.vttjs,ce.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&&(ce.console&&ce.console.groupCollapsed&&ce.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(a=>En.error(a)),ce.console&&ce.console.groupEnd&&ce.console.groupEnd()),t.flush()},F2=function(n,e){const t={uri:n},i=xm(n);i&&(t.cors=i);const a=e.tech_.crossOrigin()==="use-credentials";a&&(t.withCredentials=a),Bw(t,Ti(this,function(l,u,h){if(l)return En.error(l,u);e.loaded_=!0,typeof ce.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 _d extends Ry{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=mi(e,{kind:iM[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 Rf(this.cues_),u=new Rf(this.activeCues_);let h=!1;this.timeupdateHandler=Ti(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 M=this.cues[S];M.startTime<=g&&M.endTime>=g&&_.push(M)}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 ce.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 Kg.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}}}}_d.prototype.allowedEvents_={cuechange:"cuechange"};class IT extends Ry{constructor(e={}){const t=mi(e,{kind:nM[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 BT extends Ry{constructor(e={}){const t=mi(e,{kind:tM[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 _d(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:RT,TrackClass:IT,capitalName:"Audio"},video:{ListClass:OT,TrackClass:BT,capitalName:"Video"},text:{ListClass:jy,TrackClass:_d,capitalName:"Text"}};Object.keys(gs).forEach(function(n){gs[n].getterName=`${n}Tracks`,gs[n].privateName=`${n}Tracks_`});const Au={remoteText:{ListClass:jy,TrackClass:_d,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:eM,TrackClass:ja,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},Cr=Object.assign({},gs,Au);Au.names=Object.keys(Au);gs.names=Object.keys(gs);Cr.names=[].concat(Au.names).concat(gs.names);function sM(n,e,t,i,a={}){const l=n.textTracks();a.kind=e,t&&(a.label=t),i&&(a.language=i),a.tech=n;const u=new Cr.text.TrackClass(a);return l.addTrack(u),u}class pn extends tt{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),Cr.names.forEach(i=>{const a=Cr[i];e&&e[a.getterName]&&(this[a.privateName]=e[a.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new Cr.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ti(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 jT(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(gs.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let a=i.length;for(;a--;){const l=i[a];t==="text"&&this.removeRemoteTextTrack(l),i.removeTrack(l)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ii(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ms(0,0):Ms()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){gs.names.forEach(e=>{const t=gs[e],i=()=>{this.trigger(`${e}trackchange`)},a=this[t.getterName]();a.addEventListener("removetrack",i),a.addEventListener("addtrack",i),this.on("dispose",()=>{a.removeEventListener("removetrack",i),a.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!ce.WebVTT)if(_t.body.contains(this.el())){if(!this.options_["vtt.js"]&&Su(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}),ce.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 sM(this,e,t,i)}createRemoteTextTrack(e){const t=mi(e,{tech:this});return new Au.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 pn.canPlayType(e.type)}static isTech(e){return e.prototype instanceof pn||e instanceof pn||e===pn}static registerTech(e,t){if(pn.techs_||(pn.techs_={}),!pn.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!pn.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!pn.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=qi(e),pn.techs_[e]=t,pn.techs_[id(e)]=t,e!=="Tech"&&pn.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(pn.techs_&&pn.techs_[e])return pn.techs_[e];if(e=qi(e),ce&&ce.videojs&&ce.videojs[e])return En.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),ce.videojs[e]}}}Cr.names.forEach(function(n){const e=Cr[n];pn.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});pn.prototype.featuresVolumeControl=!0;pn.prototype.featuresMuteControl=!0;pn.prototype.featuresFullscreenResize=!1;pn.prototype.featuresPlaybackRate=!1;pn.prototype.featuresProgressEvents=!1;pn.prototype.featuresSourceset=!1;pn.prototype.featuresTimeupdateEvents=!1;pn.prototype.featuresNativeTextTracks=!1;pn.prototype.featuresVideoFrameCallback=!1;pn.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)}};tt.registerComponent("Tech",pn);pn.registerTech("Tech",pn);pn.defaultTechOrder_=[];const hl={},Of={},Lf={};function aM(n,e){hl[n]=hl[n]||[],hl[n].push(e)}function oM(n,e,t){n.setTimeout(()=>il(e,hl[e.type],t,n),1)}function lM(n,e){n.forEach(t=>t.setTech&&t.setTech(e))}function uM(n,e,t){return n.reduceRight(Iy(t),e[t]())}function cM(n,e,t,i){return e[t](n.reduce(Iy(t),i))}function U2(n,e,t,i=null){const a="call"+qi(t),l=n.reduce(Iy(a),i),u=l===Lf,h=u?null:e[t](l);return fM(n,t,h,u),h}const dM={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},hM={setCurrentTime:1,setMuted:1,setVolume:1},z2={play:1,pause:1};function Iy(n){return(e,t)=>e===Lf?Lf:t[n]?t[n](e):e}function fM(n,e,t,i){for(let a=n.length-1;a>=0;a--){const l=n[a];l[e]&&l[e](i,t)}}function mM(n){Of.hasOwnProperty(n.id())&&delete Of[n.id()]}function pM(n,e){const t=Of[n.id()];let i=null;if(t==null)return i=e(n),Of[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,hl[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:hl[_.type],t,i,a,l)})}else h.length?il(n,h,t,i,a,l):l?t(n,a):il(n,hl["*"],t,i,a,!0)}const gM={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"},If=function(n=""){const e=Ly(n);return gM[e.toLowerCase()]||""},yM=(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 If(e)},PT=function(n){if(Array.isArray(n)){let e=[];n.forEach(function(t){t=PT(t),Array.isArray(t)?e=e.concat(t):ta(t)&&e.push(t)}),n=e}else typeof n=="string"&&n.trim()?n=[H2({src:n})]:ta(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?n=[H2(n)]:n=[];return n};function H2(n){if(!n.type){const e=If(n.src);e&&(n.type=e)}return n}var bM=`<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 $2=Nf?10009:Df?461:8,Yl={codes:{play:415,pause:19,ff:417,rw:412,back:$2},names:{415:"play",19:"pause",417:"ff",412:"rw",[$2]:"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 vM 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(Yl.isEventKey(t,"play")||Yl.isEventKey(t,"pause")||Yl.isEventKey(t,"ff")||Yl.isEventKey(t,"rw")){t.preventDefault();const i=Yl.getEventName(t);this.performMediaAction_(i)}else Yl.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+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 xM extends tt{constructor(e,t,i){const a=mi({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=pn.getTech(h);if(h||(f=tt.getComponent(h)),f&&f.isSupported()){e.loadTech_(h);break}}else e.src(t.playerOptions.sources)}}tt.registerComponent("MediaLoader",xM);class _m extends tt{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=cn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(cn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(a),a}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=cn("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)}}tt.registerComponent("ClickableComponent",_m);class Wg extends _m{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 cn("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(cn("picture",{className:"vjs-poster",tabIndex:-1},{},cn("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())}}Wg.prototype.crossorigin=Wg.prototype.crossOrigin;tt.registerComponent("PosterImage",Wg);const fs="#222",V2="#ccc",_M={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 wM extends tt{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(Ti(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",l),e.on("playerresize",l);const u=ce.screen.orientation||ce,h=ce.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 ce.WebVTT=="function"&&ce.WebVTT.processCues(ce,[],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)),!ce.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"),Mf?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()||!ce.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=ce.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=_M[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof ce.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])}ce.WebVTT.processCues(ce,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;dl(u,"vjs-text-track-cue","vjs-text-track-cue-"+(a.language?a.language:i)),a.language&&ku(u,"lang",a.language)}this.player_.textTrackSettings&&this.updateDisplayState(a)}}}tt.registerComponent("TextTrackDisplay",wM);class TM extends tt{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=cn("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"])}}tt.registerComponent("LoadingSpinner",TM);class wr extends _m{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const a=cn(e,t,i);return this.player_.options_.experimentalSvgIcons||a.appendChild(cn("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.`),tt.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)}}tt.registerComponent("Button",wr);class FT extends wr{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();rd(t)?t.then(l,()=>{}):this.setTimeout(l,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}FT.prototype.controlText_="Play Video";tt.registerComponent("BigPlayButton",FT);class SM extends wr{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}tt.registerComponent("CloseButton",SM);class UT extends wr{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?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))}}UT.prototype.controlText_="Play";tt.registerComponent("PlayToggle",UT);class Ou extends tt{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=cn("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=cn("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=bl(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,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){}}Ou.prototype.labelText_="Time";Ou.prototype.controlText_="Time";tt.registerComponent("TimeDisplay",Ou);class By extends Ou{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)}}By.prototype.labelText_="Current Time";By.prototype.controlText_="Current Time";tt.registerComponent("CurrentTimeDisplay",By);class Py extends Ou{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)}}Py.prototype.labelText_="Duration";Py.prototype.controlText_="Duration";tt.registerComponent("DurationDisplay",Py);class kM extends tt{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}}tt.registerComponent("TimeDivider",kM);class Fy extends Ou{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(cn("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)}}Fy.prototype.labelText_="Remaining Time";Fy.prototype.controlText_="Remaining Time";tt.registerComponent("RemainingTimeDisplay",Fy);class EM extends tt{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_=cn("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(cn("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()}}tt.registerComponent("LiveDisplay",EM);class zT extends wr{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=cn("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()}}zT.prototype.controlText_="Seek to live, currently playing live";tt.registerComponent("SeekToLive",zT);function wd(n,e,t){return n=Number(n),Math.min(t,Math.max(e,isNaN(n)?e:n))}var CM=Object.freeze({__proto__:null,clamp:wd});class Uy extends tt{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(),fT(),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;mT(),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(wd(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=pm(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")}}tt.registerComponent("Slider",Uy);const og=(n,e)=>wd(n/e*100,0,100).toFixed(2)+"%";class AM extends tt{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=cn("span",{className:"vjs-control-text"}),i=cn("span",{textContent:this.localize("Loaded")}),a=_t.createTextNode(": ");return this.percentageEl_=cn("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(cn()),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})}}tt.registerComponent("LoadProgressBar",AM);class NM extends tt{constructor(e,t){super(e,t),this.update=ia(Ti(this,this.update),bs)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const a=fd(this.el_),l=Eu(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?"":"-")+bl(f,h)}else l=bl(i,u);this.update(e,t,l),a&&a()})}}tt.registerComponent("TimeTooltip",NM);class zy extends tt{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ia(Ti(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)}}zy.prototype.options_={children:[]};!xr&&!js&&zy.prototype.options_.children.push("timeTooltip");tt.registerComponent("PlayProgressBar",zy);class HT extends tt{constructor(e,t){super(e,t),this.update=ia(Ti(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`})}}HT.prototype.options_={children:["timeTooltip"]};tt.registerComponent("MouseTimeDisplay",HT);class wm extends Uy{constructor(e,t){t=mi(wm.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(xr||js)||e.options_.disableSeekWhileScrubbingOnSTV;(!xr&&!js||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ti(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}",[bl(i,l),bl(l,l)],"{1} of {2}")),this.currentTime_=i,this.duration_=l),this.bar&&this.bar.update(Eu(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()}}wm.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};tt.registerComponent("SeekBar",wm);class $T extends tt{constructor(e,t){super(e,t),this.handleMouseMove=ia(Ti(this,this.handleMouseMove),bs),this.throttledHandleMouseSeek=ia(Ti(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=fd(l);let h=pm(l,e).x;h=wd(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"]};tt.registerComponent("ProgressControl",$T);class qT extends wr{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){_t.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in ce?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()}}qT.prototype.controlText_="Picture-in-Picture";tt.registerComponent("PictureInPictureToggle",qT);class VT extends wr{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()}}VT.prototype.controlText_="Fullscreen";tt.registerComponent("FullscreenToggle",VT);const DM=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 MM extends tt{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}}tt.registerComponent("VolumeLevel",MM);class jM extends tt{constructor(e,t){super(e,t),this.update=ia(Ti(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=Eu(this.el_),u=Eu(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()})}}tt.registerComponent("VolumeLevelTooltip",jM);class GT extends tt{constructor(e,t){super(e,t),this.update=ia(Ti(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`})}}GT.prototype.options_={children:["volumeLevelTooltip"]};tt.registerComponent("MouseVolumeLevelDisplay",GT);class Tm extends Uy{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=Eu(i),l=this.vertical();let u=pm(i,e);u=l?u.y:u.x,u=wd(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)})}}Tm.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!xr&&!js&&Tm.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Tm.prototype.playerEvent="volumechange";tt.registerComponent("VolumeBar",Tm);class KT extends tt{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Su(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),DM(this,e),this.throttledHandleMouseMove=ia(Ti(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)}}KT.prototype.options_={children:["volumeBar"]};tt.registerComponent("VolumeControl",KT);const RM=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 WT extends wr{constructor(e,t){super(e,t),RM(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const a=i<.1?.1:i;this.player_.volume(a),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),xr&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),fm(this.el_,[0,1,2,3].reduce((i,a)=>i+`${a?" ":""}vjs-vol-${a}`,"")),dl(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}WT.prototype.controlText_="Mute";tt.registerComponent("MuteToggle",WT);class XT extends tt{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Su(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"),_r(_t,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}XT.prototype.options_={children:["muteToggle","volumeControl"]};tt.registerComponent("VolumePanel",XT);class YT extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()?i.seekableEnd():this.player_.duration();let l;t+this.skipTime<=a?l=t+this.skipTime:l=a,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}YT.prototype.controlText_="Skip Forward";tt.registerComponent("SkipForward",YT);class QT extends wr{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,a=i&&i.isLive()&&i.seekableStart();let l;a&&t-this.skipTime<=a?l=a:t>=this.skipTime?l=t-this.skipTime:l=0,this.player_.currentTime(l)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}QT.prototype.controlText_="Skip Backward";tt.registerComponent("SkipBackward",QT);class ZT extends tt{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 tt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof tt&&(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_=cn(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())}}tt.registerComponent("Menu",ZT);class Hy extends tt{constructor(e,t={}){super(e,t),this.menuButton_=new wr(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=wr.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const a=l=>this.handleClick(l);this.handleMenuKeyUp_=l=>this.handleMenuKeyUp(l),this.on(this.menuButton_,"tap",a),this.on(this.menuButton_,"click",a),this.on(this.menuButton_,"keydown",l=>this.handleKeyDown(l)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),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 ZT(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=cn("li",{className:"vjs-menu-title",textContent:qi(this.options_.title),tabIndex:-1}),i=new tt(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=wr.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"),_r(_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"),xr&&lT())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()}}tt.registerComponent("MenuButton",Hy);class $y extends Hy{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const a=Ti(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)})}}tt.registerComponent("TrackButton",$y);class Td extends _m{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=cn("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))}}tt.registerComponent("MenuItem",Td);class Sd extends Td{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 ce.Event!="object")try{h=new ce.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()}}tt.registerComponent("TextTrackMenuItem",Sd);class JT extends Sd{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()}}tt.registerComponent("OffTextTrackMenuItem",JT);class Lu extends $y{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Sd){let i;this.label_&&(i=`${this.label_} off`),e.push(new JT(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}}tt.registerComponent("TextTrackButton",Lu);class eS extends Td{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)}}tt.registerComponent("ChaptersTrackMenuItem",eS);class qy extends Lu{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 eS(this.player_,{track:this.track_,cue:l});e.push(u)}return e}}qy.prototype.kind_="chapters";qy.prototype.controlText_="Chapters";tt.registerComponent("ChaptersButton",qy);class Vy extends Lu{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const a=e.textTracks(),l=Ti(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()}`}}Vy.prototype.kind_="descriptions";Vy.prototype.controlText_="Descriptions";tt.registerComponent("DescriptionsButton",Vy);class Gy extends Lu{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()}`}}Gy.prototype.kind_="subtitles";Gy.prototype.controlText_="Subtitles";tt.registerComponent("SubtitlesButton",Gy);class Ky extends Sd{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()}}tt.registerComponent("CaptionSettingsMenuItem",Ky);class Wy extends Lu{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 Ky(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Wy.prototype.kind_="captions";Wy.prototype.controlText_="Captions";tt.registerComponent("CaptionsButton",Wy);class tS extends Sd{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(cn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(cn("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),a}}tt.registerComponent("SubsCapsMenuItem",tS);class Xy extends Lu{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 Ky(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,tS),e}}Xy.prototype.kinds_=["captions","subtitles"];Xy.prototype.controlText_="Subtitles";tt.registerComponent("SubsCapsButton",Xy);class nS extends Td{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(cn("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),l.appendChild(cn("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)}}tt.registerComponent("AudioTrackMenuItem",nS);class iS extends $y{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 nS(this.player_,{track:a,selectable:!0,multiSelectable:!1}))}return e}}iS.prototype.controlText_="Audio Track";tt.registerComponent("AudioTrackButton",iS);class Yy extends Td{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)}}Yy.prototype.contentElType="button";tt.registerComponent("PlaybackRateMenuItem",Yy);class rS 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_=cn("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 Yy(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")}}rS.prototype.controlText_="Playback Rate";tt.registerComponent("PlaybackRateMenuButton",rS);class sS extends tt{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}tt.registerComponent("Spacer",sS);class OM extends sS{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}tt.registerComponent("CustomControlSpacer",OM);class aS extends tt{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}aS.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};tt.registerComponent("ControlBar",aS);class oS extends Ru{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):""}}oS.prototype.options_=Object.assign({},Ru.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});tt.registerComponent("ErrorDisplay",oS);class lS extends tt{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(),cn("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=cn("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return a.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),a}))}}tt.registerComponent("TextTrackSelect",lS);class fl extends tt{constructor(e,t={}){super(e,t);const i=cn("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=cn("span",{className:h});const C=cn("label",{id:f,className:"vjs-label",textContent:this.localize(u.label)});C.setAttribute("for",_),g.appendChild(C)}const S=new lS(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 cn("fieldset",{className:this.options_.className})}}tt.registerComponent("TextTrackFieldset",fl);class uS extends tt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(u)}createEl(){return cn("div",{className:"vjs-track-settings-colors"})}}tt.registerComponent("TextTrackSettingsColors",uS);class cS extends tt{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,a=new fl(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a);const l=new fl(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(l);const u=new fl(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(u)}createEl(){return cn("div",{className:"vjs-track-settings-font"})}}tt.registerComponent("TextTrackSettingsFont",cS);class dS extends tt{constructor(e,t={}){super(e,t);const i=new wr(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const a=this.localize("Done"),l=new wr(e,{controlText:a,className:"vjs-done-button"});l.el().classList.remove("vjs-control","vjs-button"),l.el().textContent=a,this.addChild(l)}createEl(){return cn("div",{className:"vjs-track-settings-controls"})}}tt.registerComponent("TrackSettingsControls",dS);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 hS(n,e){if(e&&(n=e(n)),n&&n!=="none")return n}function LM(n,e){const t=n.options[n.options.selectedIndex].value;return hS(t,e)}function IM(n,e,t){if(e){for(let i=0;i<n.options.length;i++)if(hS(n.options[i].value,t)===e){n.selectedIndex=i;break}}}class BM extends Ru{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=cn("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 uS(e,{textTrackComponentid:this.id_,selectConfigs:_o,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new cS(e,{textTrackComponentid:this.id_,selectConfigs:_o,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const a=new dS(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()}),ou(_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 tT(_o,(e,t,i)=>{const a=LM(this.$(t.selector),t.parser);return a!==void 0&&(e[i]=a),e},{})}setValues(e){ou(_o,(t,i)=>{IM(this.$(t.selector),e[i],t.parser)})}setDefaults(){ou(_o,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(ce.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?ce.localStorage.setItem(lg,JSON.stringify(e)):ce.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()}}tt.registerComponent("TextTrackSettings",BM);class PM extends tt{constructor(e,t){let i=t.ResizeObserver||ce.ResizeObserver;t.ResizeObserver===null&&(i=!1);const a=mi({createEl:!i,reportTouchActivity:!1},t);super(e,a),this.ResizeObserver=t.ResizeObserver||ce.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=ST(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const l=this.debouncedHandler_;let u=this.unloadListener_=function(){_r(this,"resize",l),_r(this,"unload",u),u=null};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()}}tt.registerComponent("ResizeManager",PM);const FM={trackingThreshold:20,liveTolerance:15};class UM extends tt{constructor(e,t){const i=mi(FM,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(ce.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()}}tt.registerComponent("LiveTracker",UM);class zM extends tt{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:cn("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${ys()}`}),description:cn("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${ys()}`})},cn("div",{className:"vjs-title-bar"},{},nT(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];gm(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}}tt.registerComponent("TitleBar",zM);const HM={initialDisplay:4e3,position:[],takeFocus:!1};class $M extends wr{constructor(e,t){t=mi(HM,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=cn("button",{},{type:"button",class:this.buildCSSClass()},cn("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()}}tt.registerComponent("TransientButton",$M);const Xg=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},qM=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="",ce.Element.prototype.appendChild.call(this,t),this.innerHTML}}),fS=(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},VM=n=>fS([n.el(),ce.HTMLMediaElement.prototype,ce.Element.prototype,qM],"innerHTML"),n_=function(n){const e=n.el();if(e.resetSourceWatch_)return;const t={},i=VM(n),a=l=>(...u)=>{const h=l.apply(e,u);return Xg(n),h};["append","appendChild","insertAdjacentHTML"].forEach(l=>{e[l]&&(t[l]=e[l],e[l]=a(t[l]))}),Object.defineProperty(e,"innerHTML",mi(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_)},GM=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?LT(ce.Element.prototype.getAttribute.call(this,"src")):""},set(n){return ce.Element.prototype.setAttribute.call(this,"src",n),n}}),KM=n=>fS([n.el(),ce.HTMLMediaElement.prototype,GM],"src"),WM=function(n){if(!n.featuresSourceset)return;const e=n.el();if(e.resetSourceset_)return;const t=KM(n),i=e.setAttribute,a=e.load;Object.defineProperty(e,"src",mi(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 Xg(n)||(n.triggerSourceset(""),n_(n)),l},e.currentSrc?n.triggerSourceset(e.currentSrc):Xg(n)||n_(n),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=a,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Lt extends pn{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")&&xm(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_(),(hd||dm)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Lt.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){WM(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[Au.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),Lt.disposeMediaElement(e),e=i}else{e=_t.createElement("video");const i=this.options_.tag&&xo(this.options_.tag),a=mi({},i);(!hd||this.options_.nativeControlsForTouch!==!0)&&delete a.controls,dT(e,Object.assign(a,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&ku(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?ku(e,a,a):mm(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&&hm?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=cn("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(){Lt.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),ce.performance&&(e.creationTime=ce.performance.now()),e}}lm(Lt,"TEST_VID",function(){if(!Du())return;const n=_t.createElement("video"),e=_t.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",n.appendChild(e),n});Lt.isSupported=function(){try{Lt.TEST_VID.volume=.5}catch{return!1}return!!(Lt.TEST_VID&&Lt.TEST_VID.canPlayType)};Lt.canPlayType=function(n){return Lt.TEST_VID.canPlayType(n)};Lt.canPlaySource=function(n,e){return Lt.canPlayType(n.type)};Lt.canControlVolume=function(){try{const n=Lt.TEST_VID.volume;Lt.TEST_VID.volume=n/2+.1;const e=n!==Lt.TEST_VID.volume;return e&&xr?(ce.setTimeout(()=>{Lt&&Lt.prototype&&(Lt.prototype.featuresVolumeControl=n!==Lt.TEST_VID.volume)}),!1):e}catch{return!1}};Lt.canMuteVolume=function(){try{const n=Lt.TEST_VID.muted;return Lt.TEST_VID.muted=!n,Lt.TEST_VID.muted?ku(Lt.TEST_VID,"muted","muted"):mm(Lt.TEST_VID,"muted","muted"),n!==Lt.TEST_VID.muted}catch{return!1}};Lt.canControlPlaybackRate=function(){if(js&&na&&um<58)return!1;try{const n=Lt.TEST_VID.playbackRate;return Lt.TEST_VID.playbackRate=n/2+.1,n!==Lt.TEST_VID.playbackRate}catch{return!1}};Lt.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};Lt.supportsNativeTextTracks=function(){return hm||xr&&na};Lt.supportsNativeVideoTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.videoTracks)};Lt.supportsNativeAudioTracks=function(){return!!(Lt.TEST_VID&&Lt.TEST_VID.audioTracks)};Lt.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]){lm(Lt.prototype,n,()=>Lt[e](),!0)});Lt.prototype.featuresVolumeControl=Lt.canControlVolume();Lt.prototype.movingMediaElementInDOM=!xr;Lt.prototype.featuresFullscreenResize=!0;Lt.prototype.featuresProgressEvents=!0;Lt.prototype.featuresTimeupdateEvents=!0;Lt.prototype.featuresVideoFrameCallback=!!(Lt.TEST_VID&&Lt.TEST_VID.requestVideoFrameCallback);Lt.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{}})()}};Lt.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){Lt.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){Lt.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){Lt.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(n){Lt.prototype["set"+qi(n)]=function(e){this.el_[n]=e}});["pause","load","play"].forEach(function(n){Lt.prototype[n]=function(){return this.el_[n]()}});pn.withSourceHandlers(Lt);Lt.nativeSourceHandler={};Lt.nativeSourceHandler.canPlayType=function(n){try{return Lt.TEST_VID.canPlayType(n)}catch{return""}};Lt.nativeSourceHandler.canHandleSource=function(n,e){if(n.type)return Lt.nativeSourceHandler.canPlayType(n.type);if(n.src){const t=Ly(n.src);return Lt.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Lt.nativeSourceHandler.handleSource=function(n,e,t){e.setSrc(n.src)};Lt.nativeSourceHandler.dispose=function(){};Lt.registerSourceHandler(Lt.nativeSourceHandler);pn.registerTech("Html5",Lt);const mS=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],dg={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Yg=["tiny","xsmall","small","medium","large","xlarge","huge"],hf={};Yg.forEach(n=>{const e=n.charAt(0)==="x"?`x-${n.substring(1)}`:n;hf[n]=`vjs-layout-${e}`});const XM={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};let ji=class tu extends tt{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${ys()}`,t=Object.assign(tu.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=Jw(this.id_),this.fsApi_=Ef,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_=tu.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(),Dy(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=mi(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 ce.DOMParser().parseFromString(bM,"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 vM(this),this.addClass("vjs-spatial-navigation-enabled")),hd&&this.addClass("vjs-touch-enabled"),xr||this.addClass("vjs-workinghover"),tu.players[this.id_]=this;const l=Fg.split(".")[0];this.addClass(`vjs-v${l}`),this.userActive(!0),this.reportUserActivity(),this.one("play",u=>this.listenForUserActivity_(u)),this.on("keydown",u=>this.handleKeyDown(u)),this.on("languagechange",u=>this.handleLanguagechange(u)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),_r(_t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),_r(_t,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),tu.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),mM(this),Cr.names.forEach(e=>{const t=Cr[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const a=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:a||(t=this.el_=super.createEl("div"));const l=xo(e);if(a){for(t=this.el_=e,e=this.tag=_t.createElement("video");t.children.length;)e.appendChild(t.firstChild);nd(t,"video-js")||dl(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(f=>{try{e[f]=t[f]}catch{}})}e.setAttribute("tabindex","-1"),l.tabindex="-1",na&&cm&&(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=>oT[f]).map(f=>"vjs-device-"+f.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...u),ce.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=wT("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);dl(g,"vjs-hidden"),g.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),zg(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),G4(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(ce.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),TT(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&&(pn.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let l=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(l=!1);const u={source:t,autoplay:l,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${a}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Cr.names.forEach(f=>{const g=Cr[f];u[g.getterName]=this[g.privateName]}),Object.assign(u,this.options_[i]),Object.assign(u,this.options_[a]),Object.assign(u,this.options_[e.toLowerCase()]),this.tag&&(u.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(u.startTime=this.cache_.currentTime);const h=pn.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(Ti(this,this.handleTechReady_),!0),Kg.jsonToTextTracks(this.textTracksJson_||[],this.tech_),mS.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)&&zg(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Cr.names.forEach(e=>{const t=Cr[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Kg.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":Fg}}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(rd(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(),rd(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!rd(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=yM(this,t)),this.cache_.source=mi({},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 hM)return cM(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 dM)return uM(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=!!(hm||xr);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=u=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const a=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),a===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(a)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ms(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Ms(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ms(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return jT(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",dl(_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,_r(_t,"keydown",this.boundFullWindowOnEscKey_),_t.documentElement.style.overflow=this.docOrigOverflow,fm(_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&&ce.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(cn("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),ce.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(vT(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(ce.documentPictureInPicture&&ce.documentPictureInPicture.window)return ce.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=tt.getComponent("FullscreenToggle");_t[this.fsApi_.fullscreenEnabled]!==!1&&u.prototype.handleClick.call(this,e)}else a.call(this,e)?(e.preventDefault(),e.stopPropagation(),tt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):l.call(this,e)&&(e.preventDefault(),e.stopPropagation(),tt.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=pn.getTech(l);if(u||(u=tt.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,pn.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=PT(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]),oM(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}lM(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?AT(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 Ii(e),this.addClass("vjs-error"),En.error(`(CODE:${this.error_.code} ${Ii.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=Ti(this,this.reportUserActivity),l=function(S){(S.screenX!==t||S.screenY!==i)&&(t=S.screenX,i=S.screenY,a())},u=function(){a(),this.clearInterval(e),e=this.setInterval(a,250)},h=function(S){a(),this.clearInterval(e)};this.on("mousedown",u),this.on("mousemove",l),this.on("mouseup",h),this.on("mouseleave",h);const f=this.getChild("controlBar");f&&!xr&&!js&&(f.on("mouseenter",function(S){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),f.on("mouseleave",function(S){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",a),this.on("keyup",a);let g;const _=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(g);const S=this.options_.inactivityTimeout;S<=0||(g=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},S))};this.setInterval(_,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(a=>{a!==t&&a.el_&&!a.hasClass("vjs-hidden")&&(a.hide(),this.audioOnlyCache_.hiddenChildren.push(a))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Da(this)&&this.trigger("languagechange"))}languages(){return mi(tu.prototype.options_.languages,this.languages_)}toJSON(){const e=mi(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let a=t[i];a=mi(a),a.player=void 0,e.tracks[i]=a}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Ru(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<Yg.length;i++){const a=Yg[i],l=this.breakpoints_[a];if(t<=l){if(e===a)return;e&&this.removeClass(hf[e]),this.addClass(hf[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({},XM,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 hf[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=mi(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:If(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:If(a.poster)}]),a}return mi(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=xo(e),a=i["data-setup"];if(nd(e,"vjs-fill")&&(i.fill=!0),nd(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=()=>{};Cr.names.forEach(function(n){const e=Cr[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 Pc=ce.navigator;ji.prototype.options_={techOrder:pn.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Pc&&(Pc.languages&&Pc.languages[0]||Pc.userLanguage||Pc.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};mS.forEach(function(n){ji.prototype[`handleTech${qi(n)}_`]=function(){return this.trigger(n)}});tt.registerComponent("Player",ji);const Bf="plugin",cu="activePlugins_",nu={},Pf=n=>nu.hasOwnProperty(n),ff=n=>Pf(n)?nu[n]:void 0,pS=(n,e)=>{n[cu]=n[cu]||{},n[cu][e]=!0},Ff=(n,e,t)=>{const i=(t?"before":"")+"pluginsetup";n.trigger(i,e),n.trigger(i+":"+e.name,e)},YM=function(n,e){const t=function(){Ff(this,{name:n,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return pS(this,n),Ff(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){Ff(this,{name:n,plugin:e,instance:null},!0);const i=new e(this,...t);return this[n]=()=>i,Ff(this,i.getEventHash()),i});class Gr{constructor(e){if(this.constructor===Gr)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Dy(this),delete this.trigger,CT(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 ju(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[cu][e]=!1,this.player=this.state=null,t[e]=i_(e,nu[e])}static isBasic(e){const t=typeof e=="string"?ff(e):e;return typeof t=="function"&&!Gr.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(Pf(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 nu[e]=t,e!==Bf&&(Gr.isBasic(t)?ji.prototype[e]=YM(e,t):ji.prototype[e]=i_(e,t)),t}static deregisterPlugin(e){if(e===Bf)throw new Error("Cannot de-register base plugin.");Pf(e)&&(delete nu[e],delete ji.prototype[e])}static getPlugins(e=Object.keys(nu)){let t;return e.forEach(i=>{const a=ff(i);a&&(t=t||{},t[i]=a)}),t}static getPluginVersion(e){const t=ff(e);return t&&t.VERSION||""}}Gr.getPlugin=ff;Gr.BASE_PLUGIN_NAME=Bf;Gr.registerPlugin(Bf,Gr);ji.prototype.usingPlugin=function(n){return!!this[cu]&&this[cu][n]===!0};ji.prototype.hasPlugin=function(n){return!!Pf(n)};function QM(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 QM(`${e} is deprecated and will be removed in ${n}.0; please use ${t} instead.`,i)}var ZM={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 gS=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("#"+gS(n)):n;if(!Mu(a))throw new TypeError("The element or ID supplied is not valid. (videojs)");const u=("getRootNode"in a?a.getRootNode()instanceof ce.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,mi(e));if(!ta(g)||Array.isArray(g)){En.error("please return an object in beforesetup hooks");return}e=mi(e,g)});const h=tt.getComponent("Player");return i=new h(a,e,t),Co("setup").forEach(f=>f(i)),i}Be.hooks_=Ca;Be.hooks=Co;Be.hook=j4;Be.hookOnce=R4;Be.removeHook=Zw;if(ce.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Du()){let n=Ao(".vjs-styles-defaults");if(!n){n=wT("vjs-styles-defaults");const e=Ao("head");e&&e.insertBefore(n,e.firstChild),TT(n,`
|
||
.video-js {
|
||
width: 300px;
|
||
height: 150px;
|
||
}
|
||
|
||
.vjs-fluid:not(.vjs-audio-only-mode) {
|
||
padding-top: 56.25%
|
||
}
|
||
`)}}$g(1,Be);Be.VERSION=Fg;Be.options=ji.prototype.options_;Be.getPlayers=()=>ji.players;Be.getPlayer=n=>{const e=ji.players;let t;if(typeof n=="string"){const i=gS(n),a=e[i];if(a)return a;t=Ao("#"+i)}else t=n;if(Mu(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=tt.getComponent;Be.registerComponent=(n,e)=>(pn.isTech(e)&&En.warn(`The ${n} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),tt.registerComponent.call(tt,n,e));Be.getTech=pn.getTech;Be.registerTech=pn.registerTech;Be.use=aM;Object.defineProperty(Be,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(Be.middleware,"TERMINATOR",{value:Lf,writeable:!1,enumerable:!0});Be.browser=oT;Be.obj=I4;Be.mergeOptions=Rs(9,"videojs.mergeOptions","videojs.obj.merge",mi);Be.defineLazyProperty=Rs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",lm);Be.bind=Rs(9,"videojs.bind","native Function.prototype.bind",Ti);Be.registerPlugin=Gr.registerPlugin;Be.deregisterPlugin=Gr.deregisterPlugin;Be.plugin=(n,e)=>(En.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Gr.registerPlugin(n,e));Be.getPlugins=Gr.getPlugins;Be.getPlugin=Gr.getPlugin;Be.getPluginVersion=Gr.getPluginVersion;Be.addLanguage=function(n,e){return n=(""+n).toLowerCase(),Be.options.languages=mi(Be.options.languages,{[n]:e}),Be.options.languages[n]};Be.log=En;Be.createLogger=Jw;Be.time=Q4;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",bl);Be.setFormatTime=Rs(9,"videojs.setFormatTime","videojs.time.setFormatTime",DT);Be.resetFormatTime=Rs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",MT);Be.parseUrl=Rs(9,"videojs.parseUrl","videojs.url.parseUrl",Oy);Be.isCrossOrigin=Rs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",xm);Be.EventTarget=os;Be.any=Ny;Be.on=as;Be.one=bm;Be.off=_r;Be.trigger=ju;Be.xhr=Bw;Be.TrackList=vl;Be.TextTrack=_d;Be.TextTrackList=jy;Be.AudioTrack=IT;Be.AudioTrackList=RT;Be.VideoTrack=BT;Be.VideoTrackList=OT;["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`),xT[n].apply(null,arguments)}});Be.computedStyle=Rs(9,"videojs.computedStyle","videojs.dom.computedStyle",Cu);Be.dom=xT;Be.fn=V4;Be.num=CM;Be.str=X4;Be.url=rM;Be.Error=ZM;class JM{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 Uf 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 JM(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}}Uf.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const n in Uf.prototype.allowedEvents_)Uf.prototype["on"+n]=null;var yS="4.1.0";const ej=function(n,e){const t=n.qualityLevels,i=new Uf,a=function(){i.dispose(),n.qualityLevels=t,n.off("dispose",a)};return n.on("dispose",a),n.qualityLevels=()=>i,n.qualityLevels.VERSION=yS,i},bS=function(n){return ej(this,Be.obj.merge({},n))};Be.registerPlugin("qualityLevels",bS);bS.VERSION=yS;const Hr=rm,zf=(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 ii(...n){const e=Be.obj||Be;return(e.merge||e.mergeOptions).apply(e,n)}function dr(...n){const e=Be.time||Be;return(e.createTimeRanges||e.createTimeRanges).apply(e,n)}function tj(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,vS=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 dr(t)},iu=function(n,e){return vS(n,function(t,i){return t-Zs<=e&&i+Zs>=e})},Yh=function(n,e){return vS(n,function(t){return t-Qs>=e})},nj=function(n){if(n.length<2)return dr();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 dr(e)},ij=function(n,e){let t=null,i=null,a=0;const l=[],u=[];if(!n||!n.length||!e||!e.length)return dr();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 dr(u)},xS=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(", ")},rj=function(n,e,t=1){return((n.length?n.end(n.length-1):0)-e)/t},ul=n=>{const e=[];for(let t=0;t<n.length;t++)e.push({start:n.start(t),end:n.end(t)});return e},sj=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)},Qy=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},Zy=(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},Qg=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),[]),_S=n=>{const e=n.segments&&n.segments.length&&n.segments[n.segments.length-1];return e&&e.parts||[]},wS=({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},TS=(n,e)=>{if(e.endList)return 0;if(n&&n.suggestedPresentationDelay)return n.suggestedPresentationDelay;const t=_S(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},aj=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+=Zy(n,a),typeof a.start<"u")return{result:t+a.start,precise:!0}}return{result:t,precise:!1}},oj=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+=Zy(n,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},SS=function(n,e,t){if(typeof e>"u"&&(e=n.mediaSequence+n.segments.length),e<n.mediaSequence)return 0;const i=aj(n,e);if(i.precise)return i.result;const a=oj(n,e);return a.precise?a.result:i.result+t},kS=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 ce.Infinity}return SS(n,e,t)},sd=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},ES=function(n,e,t,i){if(!n||!n.segments)return null;if(n.endList)return kS(n);if(e===null)return null;e=e||0;let a=SS(n,n.mediaSequence+n.segments.length,e);return t&&(i=typeof i=="number"?i:TS(null,n),a-=i),Math.max(0,a)},lj=function(n,e,t){const a=e||0;let l=ES(n,e,!0,t);return l===null?dr():(l<a&&(l=a),dr(a,l))},uj=function({playlist:n,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:a,exactManifestTimings:l}){let u=e-a;const h=Qg(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-sd({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,M=S&&u+Qs>=0;if(!((C||M)&&g!==h.length-1)){if(l){if(u>0)continue}else if(u-Qs>=0)continue;return{partIndex:_.partIndex,segmentIndex:_.segmentIndex,startTime:a+sd({defaultDuration:n.targetDuration,durationList:h,startIndex:f,endIndex:g})}}}return{segmentIndex:h[h.length-1].segmentIndex,partIndex:h[h.length-1].partIndex,startTime:e}},CS=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},Jy=function(n){return n.excludeUntil&&n.excludeUntil===1/0},Sm=function(n){const e=CS(n);return!n.disabled&&!e},cj=function(n){return n.disabled},dj=function(n){for(let e=0;e<n.segments.length;e++)if(n.segments[e].key)return!0;return!1},AS=function(n,e){return e.attributes&&e.attributes[n]},hj=function(n,e,t,i=0){return AS("BANDWIDTH",t)?(n*t.attributes.BANDWIDTH-i*8)/e:NaN},Zg=(n,e)=>{if(n.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(i=>Sm(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},eb=(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},kd=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=>Uw(l))||r_(n,l=>eb(t,l))))return!1}return!0};var qr={liveEdgeDelay:TS,duration:kS,seekable:lj,getMediaInfoForTime:uj,isEnabled:Sm,isDisabled:cj,isExcluded:CS,isIncompatible:Jy,playlistEnd:ES,isAes:dj,hasAttribute:AS,estimateSegmentRequestTime:hj,isLowestEnabledRendition:Zg,isAudioOnly:kd,playlistMatch:eb,segmentDurationWithParts:Zy};const{log:NS}=Be,du=(n,e)=>`${n}-${e}`,DS=(n,e,t)=>`placeholder-uri-${n}-${e}-${t}`,fj=({onwarn:n,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:a=[],llhls:l})=>{const u=new eD;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=_S(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}`}),NS.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},Iu=(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)}})},MS=({playlist:n,uri:e,id:t})=>{n.id=t,n.playlistErrors_=0,e&&(n.uri=e),n.attributes=n.attributes||{}},mj=n=>{let e=n.playlists.length;for(;e--;){const t=n.playlists[e];MS({playlist:t,id:du(e,t.uri)}),t.resolvedUri=Hr(n.uri,t.uri),n.playlists[t.id]=t,n.playlists[t.uri]=t,t.attributes.BANDWIDTH||NS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},pj=n=>{Iu(n,e=>{e.uri&&(e.resolvedUri=Hr(n.uri,e.uri))})},gj=(n,e)=>{const t=du(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:ce.location.href,resolvedUri:ce.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},jS=(n,e,t=DS)=>{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=kd(n);Iu(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=[Qi({},a)]}a.playlists.forEach(function(f,g){const _=t(l,u,h,f),S=du(g,_);f.uri?f.resolvedUri=f.resolvedUri||Hr(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})}),mj(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 RS=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=Qi({},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},yj=xs("CodecUtils"),OS=function(n){const e=n.attributes||{};if(e.CODECS)return Ws(e.CODECS)},LS=(n,e)=>{const t=e.attributes||{};return n&&n.mediaGroups&&n.mediaGroups.AUDIO&&t.AUDIO&&n.mediaGroups.AUDIO[t.AUDIO]},bj=(n,e)=>{if(!LS(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},pd=function(n){const e={};return n.forEach(({mediaType:t,type:i,details:a})=>{e[t]=e[t]||[],e[t].push(Fw(`${i}${a}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){yj(`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},ad=function(n,e){const t=e.attributes||{},i=pd(OS(e)||[]);if(LS(n,e)&&!i.audio&&!bj(n,e)){const a=pd(nD(n,t.AUDIO)||[]);a.audio&&(i.audio=a.audio)}return i},{EventTarget:vj}=Be,xj=(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=wS(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 ce.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},_j=(n,e)=>{if(!n)return e;const t=ii(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]=ii(n.parts[i],e.parts[i]));return!n.skipped&&e.skipped&&(t.skipped=!1),n.preload&&!e.preload&&(t.preload=!1),t},wj=(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(_j(f,g))):(u&&!g.map&&(g.map=u),l.push(g))}return l},IS=(n,e)=>{!n.resolvedUri&&n.uri&&(n.resolvedUri=Hr(e,n.uri)),n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=Hr(e,n.key.uri)),n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=Hr(e,n.map.uri)),n.map&&n.map.key&&!n.map.key.resolvedUri&&(n.map.key.resolvedUri=Hr(e,n.map.key.uri)),n.parts&&n.parts.length&&n.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Hr(e,t.uri))}),n.preloadHints&&n.preloadHints.length&&n.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Hr(e,t.uri))})},BS=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},PS=(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,Jg=(n,e,t=PS)=>{const i=ii(n,{}),a=i.playlists[e.id];if(!a||t(a,e))return null;e.segments=BS(e);const l=ii(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=wj(a.segments,e.segments,e.mediaSequence-a.mediaSequence)}l.segments.forEach(u=>{IS(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,Iu(n,(u,h,f,g)=>{if(u.playlists)for(let _=0;_<u.playlists.length;_++)e.id===u.playlists[_].id&&(u.playlists[_]=l)}),i},ey=(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 ru extends vj{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=Hr(this.main.uri,e.uri);this.llhls&&(t=xj(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=fj({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=OS(i)||[];return!!pd(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(),MS({playlist:u,uri:i,id:a});const h=Jg(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_(ey(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(),ce.clearTimeout(this.mediaUpdateTimeout),ce.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(ce.clearTimeout(this.finalRenditionTimeout),t){const h=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=ce.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_(ey(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=zf(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&&(ce.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&&(ce.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=ce.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&&(ce.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=ce.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=ce.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=zf(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,jS(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=BS(i),i.segments.forEach(a=>{IS(a,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||ce.location.href;this.main=gj(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),_=du(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,M=S.resolvedUri;delete i.playlists[C],delete i.playlists[M]});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=du(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]=Qi({},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 M=a.playlists[S.id],L=DS(l,t,h),E=du(t,L);if(M&&!a.playlists[E]){const B=this.createClonePlaylist_(M,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),ii(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 ty=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)},Tj=(n,e)=>{if(!n||!n.size)return;let t=e;return n.forEach(i=>{t=i(t)}),t},Sj=(n,e,t,i)=>{!n||!n.size||n.forEach(a=>{a(e,t,i)})},FS=function(){const n=function e(t,i){t=ii({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=Tj(l,t);l.delete(a);const g=h(f||t,function(S,C){return Sj(u,g,S,C),ty(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},kj=function(n){let e;const t=n.offset;return typeof n.offset=="bigint"||typeof n.length=="bigint"?e=ce.BigInt(n.offset)+ce.BigInt(n.length)-ce.BigInt(1):e=n.offset+n.length-1,"bytes="+t+"-"+e},ny=function(n){const e={};return n.byterange&&(e.Range=kj(n.byterange)),e},Ej=function(n,e){return n.start(e)+"-"+n.end(e)},Cj=function(n,e){const t=n.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Aj=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},US=function(n){const e={};return Object.keys(n).forEach(t=>{const i=n[t];Hw(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(",")},zS=function(n){return n.resolvedUri},HS=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(Cj).join(""),l=e.slice(u*t,u*t+t).map(Aj).join(""),i+=a+" "+l+`
|
||
`;return i},Nj=({bytes:n})=>HS(n),Dj=n=>{let e="",t;for(t=0;t<n.length;t++)e+=Ej(n,t)+" ";return e};var Mj=Object.freeze({__proto__:null,createTransferableMessage:US,initSegmentId:Hf,segmentKeyId:zS,hexDump:HS,tagDump:Nj,textRanges:Dj});const $S=.25,jj=(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)},Rj=n=>n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds,Oj=(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?Rj(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:qr.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Lj=(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"}},Ij=(n,e)=>{let t,i;try{t=new Date(n),i=new Date(e)}catch{}const a=t.getTime();return(i.getTime()-a)/1e3},Bj=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},Pj=({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=Lj(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=jj(e,i.segment);return l&&(a.programDateTime=l.toISOString()),t(null,a)},qS=({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(!Bj(e))return u({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const h=Oj(n,e);if(!h)return u({message:`${n} was not found in the stream`});const f=h.segment,g=Ij(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",()=>{qS({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()},Fj=(n,e,t,i)=>{let a=[],l,u=!1;const h=function(S,C,M,L){return C.abort(),u=!0,t(S,C,M,L)},f=function(S,C){if(u)return;if(S)return S.metadata=ml({requestType:i,request:C,error:S}),h(S,C,"",a);const M=C.responseText.substring(a&&a.byteLength||0,C.responseText.length);if(a=hD(a,$w(M,!0)),l=l||Gc(a),a.length<10||l&&a.length<l+2)return fg(C,()=>h(S,C,"",a));const L=Sy(a);return L==="ts"&&a.length<188?fg(C,()=>h(S,C,"",a)):!L&&a.length<376?fg(C,()=>h(S,C,"",a)):h(null,C,L,a)},_=e({uri:n,beforeSend(S){S.overrideMimeType("text/plain; charset=x-user-defined"),S.addEventListener("progress",function({total:C,loaded:M}){return ty(S,null,{statusCode:S.status},f)})}},function(S,C){return ty(_,S,C,f)});return _},{EventTarget:Uj}=Be,l_=function(n,e){if(!PS(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},zj=(n,e,t,i)=>{const a=i.attributes.NAME||t;return`placeholder-uri-${n}-${e}-${a}`},Hj=({mainXml:n,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:a})=>{const l=c4(n,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:a});return jS(l,e,zj),l},$j=(n,e)=>{Iu(n,(t,i,a,l)=>{(!e.mediaGroups[i][a]||!(l in e.mediaGroups[i][a]))&&delete n.mediaGroups[i][a][l]})},qj=(n,e,t)=>{let i=!0,a=ii(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=am(u.sidx);t&&t[f]&&t[f].sidx&&_y(u,t[f].sidx,u.sidx.resolvedUri)}const h=Jg(a,u,l_);h&&(a=h,i=!1)}return Iu(e,(l,u,h,f)=>{if(l.playlists&&l.playlists.length){const g=l.playlists[0].id,_=Jg(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},Vj=(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=am(l);if(!e[u])break;const h=e[u].sidxInfo;Vj(h,l)&&(t[u]=e[u])}}return t},Gj=(n,e)=>{let i=u_(n.playlists,e);return Iu(n,(a,l,u,h)=>{if(a.playlists&&a.playlists.length){const f=a.playlists;i=ii(i,u_(f,e))}}),i};class iy extends Uj{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&&am(e.sidx);if(!e.sidx||!a||this.mainPlaylistLoader_.sidxMapping_[a]){ce.clearTimeout(this.mediaRequest_),this.mediaRequest_=ce.setTimeout(()=>i(!1),0);return}const l=zf(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(nn(g.response).subarray(8))}catch(M){M.metadata=ml({requestType:S,request:g,parseFailure:!0}),this.requestErrored_(M,g,t);return}return _[a]={sidxInfo:e.sidx,sidx:C},_y(e,C,e.sidx.resolvedUri),i(!0)},h="dash-sidx";this.request=Fj(l,this.vhs_.xhr,(f,g,_,S)=>{if(f)return u(f,g);if(!_||_!=="mp4"){const L=_||"unknown";return u({status:g.status,message:`Unsupported ${L} container type for sidx segment at URL: ${l}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},g)}const{offset:C,length:M}=e.sidx.byterange;if(S.length>=M+C)return u(f,{response:S.subarray(C,C+M),status:g.status,uri:g.uri});this.request=this.vhs_.xhr({uri:l,responseType:"arraybuffer",requestType:"dash-sidx",headers:ny({byterange:e.sidx.byterange})},u)},h)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},ce.clearTimeout(this.minimumUpdatePeriodTimeout_),ce.clearTimeout(this.mediaRequest_),ce.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,ce.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(),ce.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(ce.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,ce.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=ce.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_){ce.clearTimeout(this.mediaRequest_),this.mediaRequest_=ce.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=zf(this.mainPlaylistLoader_.srcUrl,a),l){this.handleMain_(),this.syncClientServerClock_(()=>e(a,l));return}return e(a,l)})}syncClientServerClock_(e){const t=d4(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:Hr(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_(){ce.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=Hj({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=qj(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_&&(ce.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_=ce.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_=Gj(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=ce.setTimeout(()=>{this.trigger("mediaupdatetimeout"),a()},ey(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 ur={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 Kj=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},VS=function(n){return n.on=n.addEventListener,n.off=n.removeEventListener,n},Wj=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())}},GS=function(n){return function(){const e=Wj(n),t=VS(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}},KS=function(n){return`var browserWorkerPolyFill = ${VS.toString()};
|
||
browserWorkerPolyFill(self);
|
||
`+n},WS=function(n){return n.toString().replace(/^function.+?{/,"").slice(0,-1)},Xj=KS(WS(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 m={};this.on=function(v,w){m[v]||(m[v]=[]),m[v]=m[v].concat(w)},this.off=function(v,w){var x;return m[v]?(x=m[v].indexOf(w),m[v]=m[v].slice(),m[v].splice(x,1),x>-1):!1},this.trigger=function(v){var w,x,T,A;if(w=m[v],!!w)if(arguments.length===2)for(T=w.length,x=0;x<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(){m={}}}};e.prototype.pipe=function(m){return this.on("data",function(v){m.push(v)}),this.on("done",function(v){m.flush(v)}),this.on("partialdone",function(v){m.partialFlush(v)}),this.on("endedtimeline",function(v){m.endTimeline(v)}),this.on("reset",function(v){m.reset(v)}),m},e.prototype.push=function(m){this.trigger("data",m)},e.prototype.flush=function(m){this.trigger("done",m)},e.prototype.partialFlush=function(m){this.trigger("partialdone",m)},e.prototype.endTimeline=function(m){this.trigger("endedtimeline",m)},e.prototype.reset=function(m){this.trigger("reset",m)};var t=e,i=Math.pow(2,32),a=function(m){var v=new DataView(m.buffer,m.byteOffset,m.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,M,L,E,B,G,Q,H,se,Y,W,O,ae,k,j,Z,V,te,me,le,q,F,ee,ie,de,I,pe,we,ve,ge,ht;(function(){var m;if(te={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(m in te)te.hasOwnProperty(m)&&(te[m]=[m.charCodeAt(0),m.charCodeAt(1),m.charCodeAt(2),m.charCodeAt(3)]);me=new Uint8Array([105,115,111,109]),q=new Uint8Array([97,118,99,49]),le=new Uint8Array([0,0,0,1]),F=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),ee=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]),ie={video:F,audio:ee},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]),we=new Uint8Array([0,0,0,0,0,0,0,0]),ve=we,ge=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ht=we,de=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),h=function(m){var v=[],w=0,x,T,A;for(x=1;x<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(m,4),x=0,w=8;x<v.length;x++)T.set(v[x],w),w+=v[x].byteLength;return T},f=function(){return h(te.dinf,h(te.dref,pe))},g=function(m){return h(te.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,m.audioobjecttype<<3|m.samplingfrequencyindex>>>1,m.samplingfrequencyindex<<7|m.channelcount<<3,6,1,2]))},_=function(){return h(te.ftyp,me,le,me,q)},W=function(m){return h(te.hdlr,ie[m])},S=function(m){return h(te.mdat,m)},Y=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,m.duration>>>24&255,m.duration>>>16&255,m.duration>>>8&255,m.duration&255,85,196,0,0]);return m.samplerate&&(v[12]=m.samplerate>>>24&255,v[13]=m.samplerate>>>16&255,v[14]=m.samplerate>>>8&255,v[15]=m.samplerate&255),h(te.mdhd,v)},se=function(m){return h(te.mdia,Y(m),W(m.type),M(m))},C=function(m){return h(te.mfhd,new Uint8Array([0,0,0,0,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255]))},M=function(m){return h(te.minf,m.type==="video"?h(te.vmhd,de):h(te.smhd,I),f(),ae(m))},L=function(m,v){for(var w=[],x=v.length;x--;)w[x]=j(v[x]);return h.apply(null,[te.moof,C(m)].concat(w))},E=function(m){for(var v=m.length,w=[];v--;)w[v]=Q(m[v]);return h.apply(null,[te.moov,G(4294967295)].concat(w).concat(B(m)))},B=function(m){for(var v=m.length,w=[];v--;)w[v]=Z(m[v]);return h.apply(null,[te.mvex].concat(w))},G=function(m){var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(m&4278190080)>>24,(m&16711680)>>16,(m&65280)>>8,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return h(te.mvhd,v)},O=function(m){var v=m.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(te.sdtp,w)},ae=function(m){return h(te.stbl,k(m),h(te.stts,ht),h(te.stsc,ve),h(te.stsz,ge),h(te.stco,we))},(function(){var m,v;k=function(w){return h(te.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),w.type==="video"?m(w):v(w))},m=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=[te.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(te.avcC,new Uint8Array([1,w.profileIdc,w.profileCompatibility,w.levelIdc,255].concat([x.length],A,[T.length],X))),h(te.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],w.sarRatio){var he=w.sarRatio[0],Ae=w.sarRatio[1];oe.push(h(te.pasp,new Uint8Array([(he&4278190080)>>24,(he&16711680)>>16,(he&65280)>>8,he&255,(Ae&4278190080)>>24,(Ae&16711680)>>16,(Ae&65280)>>8,Ae&255])))}return h.apply(null,oe)},v=function(w){return h(te.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))}})(),H=function(m){var v=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,0,(m.duration&4278190080)>>24,(m.duration&16711680)>>16,(m.duration&65280)>>8,m.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(m.width&65280)>>8,m.width&255,0,0,(m.height&65280)>>8,m.height&255,0,0]);return h(te.tkhd,v)},j=function(m){var v,w,x,T,A,X,J;return v=h(te.tfhd,new Uint8Array([0,0,0,58,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),X=Math.floor(m.baseMediaDecodeTime/u),J=Math.floor(m.baseMediaDecodeTime%u),w=h(te.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,m.type==="audio"?(x=V(m,A),h(te.traf,v,w,x)):(T=O(m),x=V(m,T.length+A),h(te.traf,v,w,x,T))},Q=function(m){return m.duration=m.duration||4294967295,h(te.trak,H(m),se(m))},Z=function(m){var v=new Uint8Array([0,0,0,0,(m.id&4278190080)>>24,(m.id&16711680)>>16,(m.id&65280)>>8,m.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return m.type!=="video"&&(v[v.length-1]=0),h(te.trex,v)},(function(){var m,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,he,Ae;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,Ae=0;Ae<oe.length;Ae++)he=oe[Ae],X[A++]=(he.duration&4278190080)>>>24,X[A++]=(he.duration&16711680)>>>16,X[A++]=(he.duration&65280)>>>8,X[A++]=he.duration&255,X[A++]=(he.size&4278190080)>>>24,X[A++]=(he.size&16711680)>>>16,X[A++]=(he.size&65280)>>>8,X[A++]=he.size&255,X[A++]=he.flags.isLeading<<2|he.flags.dependsOn,X[A++]=he.flags.isDependedOn<<6|he.flags.hasRedundancy<<4|he.flags.paddingValue<<1|he.flags.isNonSyncSample,X[A++]=he.flags.degradationPriority&61440,X[A++]=he.flags.degradationPriority&15,X[A++]=(he.compositionTimeOffset&4278190080)>>>24,X[A++]=(he.compositionTimeOffset&16711680)>>>16,X[A++]=(he.compositionTimeOffset&65280)>>>8,X[A++]=he.compositionTimeOffset&255;return h(te.trun,X)},m=function(x,T){var A,X,J,oe,he,Ae;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,Ae=0;Ae<oe.length;Ae++)he=oe[Ae],A[X++]=(he.duration&4278190080)>>>24,A[X++]=(he.duration&16711680)>>>16,A[X++]=(he.duration&65280)>>>8,A[X++]=he.duration&255,A[X++]=(he.size&4278190080)>>>24,A[X++]=(he.size&16711680)>>>16,A[X++]=(he.size&65280)>>>8,A[X++]=he.size&255;return h(te.trun,A)},V=function(x,T){return x.type==="audio"?m(x,T):v(x,T)}})();var Ge={ftyp:_,mdat:S,moof:L,moov:E,initSegment:function(m){var v=_(),w=E(m),x;return x=new Uint8Array(v.byteLength+w.byteLength),x.set(v),x.set(w,v.byteLength),x}},Te=function(m){var v,w,x=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,x.byteLength=0,v=0;v<m.length;v++)w=m[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},Le=function(m){var v,w,x=[],T=[];for(x.byteLength=0,x.nalCount=0,x.duration=0,x.pts=m[0].pts,x.dts=m[0].dts,T.byteLength=0,T.nalCount=0,T.duration=0,T.pts=m[0].pts,T.dts=m[0].dts,v=0;v<m.length;v++)w=m[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},ut=function(m){var v;return!m[0][0].keyFrame&&m.length>1&&(v=m.shift(),m.byteLength-=v.byteLength,m.nalCount-=v.nalCount,m[0][0].dts=v.dts,m[0][0].pts=v.pts,m[0][0].duration+=v.duration),m},Oe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},_e=function(m,v){var w=Oe();return w.dataOffset=v,w.compositionTimeOffset=m.pts-m.dts,w.duration=m.duration,w.size=4*m.length,w.size+=m.byteLength,m.keyFrame&&(w.flags.dependsOn=2,w.flags.isNonSyncSample=0),w},Ke=function(m,v){var w,x,T,A,X,J=v||0,oe=[];for(w=0;w<m.length;w++)for(A=m[w],x=0;x<A.length;x++)X=A[x],T=_e(X,J),J+=T.size,oe.push(T);return oe},Je=function(m){var v,w,x,T,A,X,J=0,oe=m.byteLength,he=m.nalCount,Ae=oe+4*he,We=new Uint8Array(Ae),Ct=new DataView(We.buffer);for(v=0;v<m.length;v++)for(T=m[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,We.set(X.data,J),J+=X.data.byteLength;return We},bt=function(m,v){var w,x=v||0,T=[];return w=_e(m,x),T.push(w),T},ft=function(m){var v,w,x=0,T=m.byteLength,A=m.length,X=T+4*A,J=new Uint8Array(X),oe=new DataView(J.buffer);for(v=0;v<m.length;v++)w=m[v],oe.setUint32(x,w.data.byteLength),x+=4,J.set(w.data,x),x+=w.data.byteLength;return J},kt={groupNalsIntoFrames:Te,groupFramesIntoGops:Le,extendFirstKeyFrame:ut,generateSampleTable:Ke,concatenateNalData:Je,generateSampleTableForFrame:bt,concatenateNalDataForFrame:ft},Pe=[33,16,5,32,164,27],Xe=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],st=function(m){for(var v=[];m--;)v.push(0);return v},Ze=function(m){return Object.keys(m).reduce(function(v,w){return v[w]=new Uint8Array(m[w].reduce(function(x,T){return x.concat(T)},[])),v},{})},nt,wt=function(){if(!nt){var m={96e3:[Pe,[227,64],st(154),[56]],88200:[Pe,[231],st(170),[56]],64e3:[Pe,[248,192],st(240),[56]],48e3:[Pe,[255,192],st(268),[55,148,128],st(54),[112]],44100:[Pe,[255,192],st(268),[55,163,128],st(84),[112]],32e3:[Pe,[255,192],st(268),[55,234],st(226),[112]],24e3:[Pe,[255,192],st(268),[55,255,128],st(268),[111,112],st(126),[224]],16e3:[Pe,[255,192],st(268),[55,255,128],st(268),[111,255],st(269),[223,108],st(195),[1,192]],12e3:[Xe,st(268),[3,127,248],st(268),[6,255,240],st(268),[13,255,224],st(268),[27,253,128],st(259),[56]],11025:[Xe,st(268),[3,127,248],st(268),[6,255,240],st(268),[13,255,224],st(268),[27,255,192],st(268),[55,175,128],st(108),[112]],8e3:[Xe,st(268),[3,121,16],st(47),[7]]};nt=Ze(m)}return nt},fe=9e4,He,Ce,De,Ie,Qe,Et,It;He=function(m){return m*fe},Ce=function(m,v){return m*v},De=function(m){return m/fe},Ie=function(m,v){return m/v},Qe=function(m,v){return He(Ie(m,v))},Et=function(m,v){return Ce(De(m),v)},It=function(m,v,w){return De(w?m:m-v)};var vt={ONE_SECOND_IN_TS:fe,secondsToVideoTs:He,secondsToAudioTs:Ce,videoTsToSeconds:De,audioTsToSeconds:Ie,audioTsToVideoTs:Qe,videoTsToAudioTs:Et,metadataTsToSeconds:It},Yt=wt,Ft=vt,zt=function(m){var v,w,x=0;for(v=0;v<m.length;v++)w=m[v],x+=w.data.byteLength;return x},At=function(m,v,w,x){var T,A=0,X=0,J=0,oe=0,he,Ae,We;if(v.length&&(T=Ft.audioTsToVideoTs(m.baseMediaDecodeTime,m.samplerate),A=Math.ceil(Ft.ONE_SECOND_IN_TS/(m.samplerate/1024)),w&&x&&(X=T-Math.max(w,x),J=Math.floor(X/A),oe=J*A),!(J<1||oe>Ft.ONE_SECOND_IN_TS/2))){for(he=Yt()[m.samplerate],he||(he=v[0].data),Ae=0;Ae<J;Ae++)We=v[0],v.splice(0,0,{data:he,dts:We.dts-A,pts:We.pts-A});return m.baseMediaDecodeTime-=Math.floor(Ft.videoTsToAudioTs(oe,m.samplerate)),oe}},Nt=function(m,v,w){return v.minSegmentDts>=w?m:(v.minSegmentDts=1/0,m.filter(function(x){return x.dts>=w?(v.minSegmentDts=Math.min(v.minSegmentDts,x.dts),v.minSegmentPts=v.minSegmentDts,!0):!1}))},ln=function(m){var v,w,x=[];for(v=0;v<m.length;v++)w=m[v],x.push({size:w.data.byteLength,duration:1024});return x},dn=function(m){var v,w,x=0,T=new Uint8Array(zt(m));for(v=0;v<m.length;v++)w=m[v],T.set(w.data,x),x+=w.data.byteLength;return T},yt={prefixWithSilence:At,trimAdtsFramesByEarliestDts:Nt,generateSampleTable:ln,concatenateFrameData:dn},Fn=vt.ONE_SECOND_IN_TS,ot=function(m,v){typeof v.pts=="number"&&(m.timelineStartInfo.pts===void 0&&(m.timelineStartInfo.pts=v.pts),m.minSegmentPts===void 0?m.minSegmentPts=v.pts:m.minSegmentPts=Math.min(m.minSegmentPts,v.pts),m.maxSegmentPts===void 0?m.maxSegmentPts=v.pts:m.maxSegmentPts=Math.max(m.maxSegmentPts,v.pts)),typeof v.dts=="number"&&(m.timelineStartInfo.dts===void 0&&(m.timelineStartInfo.dts=v.dts),m.minSegmentDts===void 0?m.minSegmentDts=v.dts:m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.maxSegmentDts===void 0?m.maxSegmentDts=v.dts:m.maxSegmentDts=Math.max(m.maxSegmentDts,v.dts))},N=function(m){delete m.minSegmentDts,delete m.maxSegmentDts,delete m.minSegmentPts,delete m.maxSegmentPts},P=function(m,v){var w,x,T=m.minSegmentDts;return v||(T-=m.timelineStartInfo.dts),w=m.timelineStartInfo.baseMediaDecodeTime,w+=T,w=Math.max(0,w),m.type==="audio"&&(x=m.samplerate/Fn,w*=x,w=Math.floor(w)),w},ne={clearDtsInfo:N,calculateTrackBaseMediaDecodeTime:P,collectDtsInfo:ot},je=4,qe=128,dt=function(m){for(var v=0,w={payloadType:-1,payloadSize:0},x=0,T=0;v<m.byteLength&&m[v]!==qe;){for(;m[v]===255;)x+=255,v++;for(x+=m[v++];m[v]===255;)T+=255,v++;if(T+=m[v++],!w.payload&&x===je){var A=String.fromCharCode(m[v+3],m[v+4],m[v+5],m[v+6]);if(A==="GA94"){w.payloadType=x,w.payloadSize=T,w.payload=m.subarray(v,v+T);break}else w.payload=void 0}v+=T,x=0,T=0}return w},$t=function(m){return m.payload[0]!==181||(m.payload[1]<<8|m.payload[2])!==49||String.fromCharCode(m.payload[3],m.payload[4],m.payload[5],m.payload[6])!=="GA94"||m.payload[7]!==3?null:m.payload.subarray(8,m.payload.length-1)},Zt=function(m,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:m},v[A+2]&4&&(X.ccData=v[A+3]<<8|v[A+4],w.push(X));return w},hn=function(m){for(var v=m.byteLength,w=[],x=1,T,A;x<v-2;)m[x]===0&&m[x+1]===0&&m[x+2]===3?(w.push(x+2),x+=2):x++;if(w.length===0)return m;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]=m[X];return A},Qt={parseSei:dt,parseUserData:$t,parseCaptionPackets:Zt,discardEmulationPreventionBytes:hn,USER_DATA_REGISTERED_ITU_T_T35:je},vn=t,Tn=Qt,Wt=function(m){m=m||{},Wt.prototype.init.call(this),this.parse708captions_=typeof m.parse708captions=="boolean"?m.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Xt(0,0),new Xt(0,1),new Xt(1,0),new Xt(1,1)],this.parse708captions_&&(this.cc708Stream_=new jt({captionServices:m.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")))};Wt.prototype=new vn,Wt.prototype.push=function(m){var v,w,x;if(m.nalUnitType==="sei_rbsp"&&(v=Tn.parseSei(m.escapedRBSP),!!v.payload&&v.payloadType===Tn.USER_DATA_REGISTERED_ITU_T_T35&&(w=Tn.parseUserData(v),!!w))){if(m.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(m.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}x=Tn.parseCaptionPackets(m.pts,w),this.captionPackets_=this.captionPackets_.concat(x),this.latestDts_!==m.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=m.dts}},Wt.prototype.flushCCStreams=function(m){this.ccStreams_.forEach(function(v){return m==="flush"?v.flush():v.partialFlush()},this)},Wt.prototype.flushStream=function(m){if(!this.captionPackets_.length){this.flushCCStreams(m);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(m)},Wt.prototype.flush=function(){return this.flushStream("flush")},Wt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Wt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(m){m.reset()})},Wt.prototype.dispatchCea608Packet=function(m){this.setsTextOrXDSActive(m)?this.activeCea608Channel_[m.type]=null:this.setsChannel1Active(m)?this.activeCea608Channel_[m.type]=0:this.setsChannel2Active(m)&&(this.activeCea608Channel_[m.type]=1),this.activeCea608Channel_[m.type]!==null&&this.ccStreams_[(m.type<<1)+this.activeCea608Channel_[m.type]].push(m)},Wt.prototype.setsChannel1Active=function(m){return(m.ccData&30720)===4096},Wt.prototype.setsChannel2Active=function(m){return(m.ccData&30720)===6144},Wt.prototype.setsTextOrXDSActive=function(m){return(m.ccData&28928)===256||(m.ccData&30974)===4138||(m.ccData&30974)===6186},Wt.prototype.dispatchCea708Packet=function(m){this.parse708captions_&&this.cc708Stream_.push(m)};var gn={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},sn=function(m){var v=gn[m]||m;return m&4096&&m===v?"":String.fromCharCode(v)},an=function(m){return 32<=m&&m<=127||160<=m&&m<=255},Bt=function(m){this.windowNum=m,this.reset()};Bt.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},Bt.prototype.getText=function(){return this.rows.join(`
|
||
`)},Bt.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Bt.prototype.newLine=function(m){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(m),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Bt.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Bt.prototype.addText=function(m){this.rows[this.rowIdx]+=m},Bt.prototype.backspace=function(){if(!this.isEmpty()){var m=this.rows[this.rowIdx];this.rows[this.rowIdx]=m.substr(0,m.length-1)}};var Dt=function(m,v,w){this.serviceNum=m,this.text="",this.currentWindow=new Bt(-1),this.windows=[],this.stream=w,typeof v=="string"&&this.createTextDecoder(v)};Dt.prototype.init=function(m,v){this.startPts=m;for(var w=0;w<8;w++)this.windows[w]=new Bt(w),typeof v=="function"&&(this.windows[w].beforeRowOverflow=v)},Dt.prototype.setCurrentWindow=function(m){this.currentWindow=this.windows[m]},Dt.prototype.createTextDecoder=function(m){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(m)}catch(v){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+m+" encoding. "+v})}};var jt=function(m){m=m||{},jt.prototype.init.call(this);var v=this,w=m.captionServices||{},x={},T;Object.keys(w).forEach(A=>{T=w[A],/^SERVICE/.test(A)&&(x[A]=T.encoding)}),this.serviceEncodings=x,this.current708Packet=null,this.services={},this.push=function(A){A.type===3?(v.new708Packet(),v.add708Bytes(A)):(v.current708Packet===null&&v.new708Packet(),v.add708Bytes(A))}};jt.prototype=new vn,jt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},jt.prototype.add708Bytes=function(m){var v=m.ccData,w=v>>>8,x=v&255;this.current708Packet.ptsVals.push(m.pts),this.current708Packet.data.push(w),this.current708Packet.data.push(x)},jt.prototype.push708Packet=function(){var m=this.current708Packet,v=m.data,w=null,x=null,T=0,A=v[T++];for(m.seq=A>>6,m.sizeCode=A&63;T<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)},jt.prototype.pushServiceBlock=function(m,v,w){var x,T=v,A=this.current708Packet.data,X=this.services[m];for(X||(X=this.initService(m,T));T<v+w&&T<A.length;T++)x=A[T],an(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++},jt.prototype.extendedCommands=function(m,v){var w=this.current708Packet.data,x=w[++m];return an(x)&&(m=this.handleText(m,v,{isExtended:!0})),m},jt.prototype.getPts=function(m){return this.current708Packet.ptsVals[Math.floor(m/2)]},jt.prototype.initService=function(m,v){var x="SERVICE"+m,w=this,x,T;return x in this.serviceEncodings&&(T=this.serviceEncodings[x]),this.services[m]=new Dt(m,T,w),this.services[m].init(this.getPts(v),function(A){w.flushDisplayed(A,w.services[m])}),this.services[m]},jt.prototype.handleText=function(m,v,w){var x=w&&w.isExtended,T=w&&w.isMultiByte,A=this.current708Packet.data,X=x?4096:0,J=A[m],oe=A[m+1],he=v.currentWindow,Ae,We;function Ct(rt){return rt.map(Ot=>("0"+(Ot&255).toString(16)).slice(-2)).join("")}if(T?(We=[J,oe],m++):We=[J],v.textDecoder_&&!x)Ae=v.textDecoder_.decode(new Uint8Array(We));else if(T){const rt=Ct(We);Ae=String.fromCharCode(parseInt(rt,16))}else Ae=sn(X|J);return he.pendingNewLine&&!he.isEmpty()&&he.newLine(this.getPts(m)),he.pendingNewLine=!1,he.addText(Ae),m},jt.prototype.multiByteCharacter=function(m,v){var w=this.current708Packet.data,x=w[m+1],T=w[m+2];return an(x)&&an(T)&&(m=this.handleText(++m,v,{isMultiByte:!0})),m},jt.prototype.setCurrentWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;return v.setCurrentWindow(T),m},jt.prototype.defineWindow=function(m,v){var w=this.current708Packet.data,x=w[m],T=x&7;v.setCurrentWindow(T);var A=v.currentWindow;return x=w[++m],A.visible=(x&32)>>5,A.rowLock=(x&16)>>4,A.columnLock=(x&8)>>3,A.priority=x&7,x=w[++m],A.relativePositioning=(x&128)>>7,A.anchorVertical=x&127,x=w[++m],A.anchorHorizontal=x,x=w[++m],A.anchorPoint=(x&240)>>4,A.rowCount=x&15,x=w[++m],A.columnCount=x&63,x=w[++m],A.windowStyle=(x&56)>>3,A.penStyle=x&7,A.virtualRowCount=A.rowCount+1,m},jt.prototype.setWindowAttributes=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.winAttr;return x=w[++m],T.fillOpacity=(x&192)>>6,T.fillRed=(x&48)>>4,T.fillGreen=(x&12)>>2,T.fillBlue=x&3,x=w[++m],T.borderType=(x&192)>>6,T.borderRed=(x&48)>>4,T.borderGreen=(x&12)>>2,T.borderBlue=x&3,x=w[++m],T.borderType+=(x&128)>>5,T.wordWrap=(x&64)>>6,T.printDirection=(x&48)>>4,T.scrollDirection=(x&12)>>2,T.justify=x&3,x=w[++m],T.effectSpeed=(x&240)>>4,T.effectDirection=(x&12)>>2,T.displayEffect=x&3,m},jt.prototype.flushDisplayed=function(m,v){for(var w=[],x=0;x<8;x++)v.windows[x].visible&&!v.windows[x].isEmpty()&&w.push(v.windows[x].getText());v.endPts=m,v.text=w.join(`
|
||
|
||
`),this.pushCaption(v),v.startPts=m},jt.prototype.pushCaption=function(m){m.text!==""&&(this.trigger("data",{startPts:m.startPts,endPts:m.endPts,text:m.text,stream:"cc708_"+m.serviceNum}),m.text="",m.startPts=m.endPts)},jt.prototype.displayWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=1);return m},jt.prototype.hideWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible=0);return m},jt.prototype.toggleWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&(v.windows[A].visible^=1);return m},jt.prototype.clearWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].clearText();return m},jt.prototype.deleteWindows=function(m,v){var w=this.current708Packet.data,x=w[++m],T=this.getPts(m);this.flushDisplayed(T,v);for(var A=0;A<8;A++)x&1<<A&&v.windows[A].reset();return m},jt.prototype.setPenAttributes=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penAttr;return x=w[++m],T.textTag=(x&240)>>4,T.offset=(x&12)>>2,T.penSize=x&3,x=w[++m],T.italics=(x&128)>>7,T.underline=(x&64)>>6,T.edgeType=(x&56)>>3,T.fontStyle=x&7,m},jt.prototype.setPenColor=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penColor;return x=w[++m],T.fgOpacity=(x&192)>>6,T.fgRed=(x&48)>>4,T.fgGreen=(x&12)>>2,T.fgBlue=x&3,x=w[++m],T.bgOpacity=(x&192)>>6,T.bgRed=(x&48)>>4,T.bgGreen=(x&12)>>2,T.bgBlue=x&3,x=w[++m],T.edgeRed=(x&48)>>4,T.edgeGreen=(x&12)>>2,T.edgeBlue=x&3,m},jt.prototype.setPenLocation=function(m,v){var w=this.current708Packet.data,x=w[m],T=v.currentWindow.penLoc;return v.currentWindow.pendingNewLine=!0,x=w[++m],T.row=x&15,x=w[++m],T.column=x&63,m},jt.prototype.reset=function(m,v){var w=this.getPts(m);return this.flushDisplayed(w,v),this.initService(v.serviceNum,m)};var Dn={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(m){return m===null?"":(m=Dn[m]||m,String.fromCharCode(m))},Hn=14,In=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Sn=function(){for(var m=[],v=Hn+1;v--;)m.push({text:"",indent:0,offset:0});return m},Xt=function(m,v){Xt.prototype.init.call(this),this.field_=m||0,this.dataChannel_=v||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(w){var x,T,A,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_=Sn();else if(x===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Sn();else if(x===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(w.pts),this.displayed_=Sn()),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 he=X&3;this.nonDisplayed_[this.row_].offset=he,this.column_+=he}else if(this.isPAC(A,X)){var oe=In.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 he=(x&14)>>1;this.column_=he*4,this.nonDisplayed_[this.row_].indent+=he}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)}};Xt.prototype=new vn,Xt.prototype.flushDisplayed=function(m){const v=x=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+x+"."})},w=[];this.displayed_.forEach((x,T)=>{if(x&&x.text&&x.text.length){try{x.text=x.text.trim()}catch{v(T)}x.text.length&&w.push({text:x.text,line:T+1,position:10+Math.min(70,x.indent*10)+x.offset*2.5})}else x==null&&v(T)}),w.length&&this.trigger("data",{startPts:this.startPts_,endPts:m,content:w,stream:this.name_})},Xt.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Sn(),this.nonDisplayed_=Sn(),this.lastControlCode_=null,this.column_=0,this.row_=Hn,this.rollUpRows_=2,this.formatting_=[]},Xt.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},Xt.prototype.isSpecialCharacter=function(m,v){return m===this.EXT_&&v>=48&&v<=63},Xt.prototype.isExtCharacter=function(m,v){return(m===this.EXT_+1||m===this.EXT_+2)&&v>=32&&v<=63},Xt.prototype.isMidRowCode=function(m,v){return m===this.EXT_&&v>=32&&v<=47},Xt.prototype.isOffsetControlCode=function(m,v){return m===this.OFFSET_&&v>=33&&v<=35},Xt.prototype.isPAC=function(m,v){return m>=this.BASE_&&m<this.BASE_+8&&v>=64&&v<=127},Xt.prototype.isColorPAC=function(m){return m>=64&&m<=79||m>=96&&m<=127},Xt.prototype.isNormalChar=function(m){return m>=32&&m<=127},Xt.prototype.setRollUp=function(m,v){if(this.mode_!=="rollUp"&&(this.row_=Hn,this.mode_="rollUp",this.flushDisplayed(m),this.nonDisplayed_=Sn(),this.displayed_=Sn()),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},Xt.prototype.addFormatting=function(m,v){this.formatting_=this.formatting_.concat(v);var w=v.reduce(function(x,T){return x+"<"+T+">"},"");this[this.mode_](m,w)},Xt.prototype.clearFormatting=function(m){if(this.formatting_.length){var v=this.formatting_.reverse().reduce(function(w,x){return w+"</"+x+">"},"");this.formatting_=[],this[this.mode_](m,v)}},Xt.prototype.popOn=function(m,v){var w=this.nonDisplayed_[this.row_].text;w+=v,this.nonDisplayed_[this.row_].text=w},Xt.prototype.rollUp=function(m,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w},Xt.prototype.shiftRowsUp_=function(){var m;for(m=0;m<this.topRow_;m++)this.displayed_[m]={text:"",indent:0,offset:0};for(m=this.row_+1;m<Hn+1;m++)this.displayed_[m]={text:"",indent:0,offset:0};for(m=this.topRow_;m<this.row_;m++)this.displayed_[m]=this.displayed_[m+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Xt.prototype.paintOn=function(m,v){var w=this.displayed_[this.row_].text;w+=v,this.displayed_[this.row_].text=w};var Un={CaptionStream:Wt,Cea608Stream:Xt,Cea708Stream:jt},Yn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Cn=t,ti=8589934592,wn=4294967296,ui="shared",ri=function(m,v){var w=1;for(m>v&&(w=-1);Math.abs(v-m)>wn;)m+=w*ti;return m},Qn=function(m){var v,w;Qn.prototype.init.call(this),this.type_=m||ui,this.push=function(x){if(x.type==="metadata"){this.trigger("data",x);return}this.type_!==ui&&x.type!==this.type_||(w===void 0&&(w=x.dts),x.dts=ri(x.dts,w),x.pts=ri(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")}};Qn.prototype=new Cn;var Zn={TimestampRolloverStream:Qn,handleRollover:ri},xi=(m,v,w)=>{if(!m)return-1;for(var x=w;x<m.length;x++)if(m[x]===v)return x;return-1},Mn={typedArrayIndexOf:xi},jn=Mn.typedArrayIndexOf,qn={Utf8:3},xe=function(m,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+m[x].toString(16)).slice(-2);return T},it=function(m,v,w){return decodeURIComponent(xe(m,v,w))},mt=function(m,v,w){return unescape(xe(m,v,w))},Rt=function(m){return m[0]<<21|m[1]<<14|m[2]<<7|m[3]},Ne={APIC:function(m){var v=1,w,x,T="-->";m.data[0]===qn.Utf8&&(w=jn(m.data,0,v),!(w<0)&&(m.mimeType=mt(m.data,v,w),v=w+1,m.pictureType=m.data[v],v++,x=jn(m.data,0,v),!(x<0)&&(m.description=it(m.data,v,x),v=x+1,m.mimeType===T?m.url=mt(m.data,v,m.data.length):m.pictureData=m.data.subarray(v,m.data.length))))},"T*":function(m){m.data[0]===qn.Utf8&&(m.value=it(m.data,1,m.data.length).replace(/\0*$/,""),m.values=m.value.split("\0"))},TXXX:function(m){var v;m.data[0]===qn.Utf8&&(v=jn(m.data,0,1),v!==-1&&(m.description=it(m.data,1,v),m.value=it(m.data,v+1,m.data.length).replace(/\0*$/,""),m.data=m.value))},"W*":function(m){m.url=mt(m.data,0,m.data.length).replace(/\0.*$/,"")},WXXX:function(m){var v;m.data[0]===qn.Utf8&&(v=jn(m.data,0,1),v!==-1&&(m.description=it(m.data,1,v),m.url=mt(m.data,v+1,m.data.length).replace(/\0.*$/,"")))},PRIV:function(m){var v;for(v=0;v<m.data.length;v++)if(m.data[v]===0){m.owner=mt(m.data,0,v);break}m.privateData=m.data.subarray(v+1),m.data=m.privateData}},pt=function(m){var v,w,x=10,T=0,A=[];if(!(m.length<10||m[0]!==73||m[1]!==68||m[2]!==51)){T=Rt(m.subarray(6,10)),T+=10;var X=m[5]&64;X&&(x+=4,x+=Rt(m.subarray(10,14)),T-=Rt(m.subarray(16,20)));do{if(v=Rt(m.subarray(x+4,x+8)),v<1)break;w=String.fromCharCode(m[x],m[x+1],m[x+2],m[x+3]);var J={id:w,data:m.subarray(x+10,x+v+10)};J.key=J.id,Ne[J.id]?Ne[J.id](J):J.id[0]==="T"?Ne["T*"](J):J.id[0]==="W"&&Ne["W*"](J),A.push(J),x+=10,x+=v}while(x<T);return A}},xt={parseId3Frames:pt,parseSyncSafeInteger:Rt,frameParsers:Ne},St=t,Pt=Yn,Ht=xt,Gt;Gt=function(m){var v={descriptor:m&&m.descriptor},w=0,x=[],T=0,A;if(Gt.prototype.init.call(this),this.dispatchType=Pt.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,he,Ae,We,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=Ht.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},We=0;We<w;)J.data.set(x[0].data.subarray(0,w-We),We),We+=x[0].data.byteLength,T-=x[0].data.byteLength,x.shift();oe=10,J.data[5]&64&&(oe+=4,oe+=Ht.parseSyncSafeInteger(J.data.subarray(10,14)),w-=Ht.parseSyncSafeInteger(J.data.subarray(16,20)));do{if(he=Ht.parseSyncSafeInteger(J.data.subarray(oe+4,oe+8)),he<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]),Ae={id:Ct,data:J.data.subarray(oe+10,oe+he+10)},Ae.key=Ae.id,Ht.frameParsers[Ae.id]?Ht.frameParsers[Ae.id](Ae):Ae.id[0]==="T"?Ht.frameParsers["T*"](Ae):Ae.id[0]==="W"&&Ht.frameParsers["W*"](Ae),Ae.owner==="com.apple.streaming.transportStreamTimestamp"){var rt=Ae.data,Ot=(rt[3]&1)<<30|rt[4]<<22|rt[5]<<14|rt[6]<<6|rt[7]>>>2;Ot*=4,Ot+=rt[7]&3,Ae.timeStamp=Ot,J.pts===void 0&&J.dts===void 0&&(J.pts=Ae.timeStamp,J.dts=Ae.timeStamp),this.trigger("timestamp",Ae)}J.frames.push(Ae),oe+=10,oe+=he}while(oe<w);this.trigger("data",J)}}}},Gt.prototype=new St;var xn=Gt,zn=t,Bi=Un,$n=Yn,Vi=Zn.TimestampRolloverStream,Si,si,pi,Ri=188,Vn=71;Si=function(){var m=new Uint8Array(Ri),v=0;Si.prototype.init.call(this),this.push=function(w){var x=0,T=Ri,A;for(v?(A=new Uint8Array(w.byteLength+v),A.set(m.subarray(0,v)),A.set(w,v),v=0):A=w;T<A.byteLength;){if(A[x]===Vn&&A[T]===Vn){this.trigger("data",A.subarray(x,T)),x+=Ri,T+=Ri;continue}x++,T++}x<A.byteLength&&(m.set(A.subarray(x),0),v=A.byteLength-x)},this.flush=function(){v===Ri&&m[0]===Vn&&(this.trigger("data",m),v=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){v=0,this.trigger("reset")}},Si.prototype=new zn,si=function(){var m,v,w,x;si.prototype.init.call(this),x=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,m=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,he;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],he=12+oe;he<J;){var Ae=T[he],We=(T[he+1]&31)<<8|T[he+2];Ae===$n.H264_STREAM_TYPE&&x.programMapTable.video===null?x.programMapTable.video=We:Ae===$n.ADTS_STREAM_TYPE&&x.programMapTable.audio===null?x.programMapTable.audio=We:Ae===$n.METADATA_STREAM_TYPE&&(x.programMapTable["timed-metadata"][We]=Ae),he+=((T[he+3]&15)<<8|T[he+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",m(T.subarray(X),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",m(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=$n.H264_STREAM_TYPE:X.pid===this.programMapTable.audio?X.streamType=$n.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 zn,si.STREAM_TYPES={h264:27,adts:15},pi=function(){var m=this,v=!1,w={data:[],size:0},x={data:[],size:0},T={data:[],size:0},A,X=function(oe,he){var Ae;const We=oe[0]<<16|oe[1]<<8|oe[2];he.data=new Uint8Array,We===1&&(he.packetLength=6+(oe[4]<<8|oe[5]),he.dataAlignmentIndicator=(oe[6]&4)!==0,Ae=oe[7],Ae&192&&(he.pts=(oe[9]&14)<<27|(oe[10]&255)<<20|(oe[11]&254)<<12|(oe[12]&255)<<5|(oe[13]&254)>>>3,he.pts*=4,he.pts+=(oe[13]&6)>>>1,he.dts=he.pts,Ae&64&&(he.dts=(oe[14]&14)<<27|(oe[15]&255)<<20|(oe[16]&254)<<12|(oe[17]&255)<<5|(oe[18]&254)>>>3,he.dts*=4,he.dts+=(oe[18]&6)>>>1)),he.data=oe.subarray(9+oe[8]))},J=function(oe,he,Ae){var We=new Uint8Array(oe.size),Ct={type:he},rt=0,Ot=0,fn=!1,Ki;if(!(!oe.data.length||oe.size<9)){for(Ct.trackId=oe.data[0].pid,rt=0;rt<oe.data.length;rt++)Ki=oe.data[rt],We.set(Ki.data,Ot),Ot+=Ki.data.byteLength;X(We,Ct),fn=he==="video"||Ct.packetLength<=oe.size,(Ae||fn)&&(oe.size=0,oe.data.length=0),fn&&m.trigger("data",Ct)}};pi.prototype.init.call(this),this.push=function(oe){({pat:function(){},pes:function(){var he,Ae;switch(oe.streamType){case $n.H264_STREAM_TYPE:he=w,Ae="video";break;case $n.ADTS_STREAM_TYPE:he=x,Ae="audio";break;case $n.METADATA_STREAM_TYPE:he=T,Ae="timed-metadata";break;default:return}oe.payloadUnitStartIndicator&&J(he,Ae,!0),he.data.push(oe),he.size+=oe.data.byteLength},pmt:function(){var he={type:"metadata",tracks:[]};A=oe.programMapTable,A.video!==null&&he.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.video,codec:"avc",type:"video"}),A.audio!==null&&he.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+A.audio,codec:"adts",type:"audio"}),v=!0,m.trigger("data",he)}})[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"}),m.trigger("data",oe)}v=!1,this.flushStreams_(),this.trigger("done")}},pi.prototype=new zn;var Gn={PAT_PID:0,MP2T_PACKET_LENGTH:Ri,TransportPacketStream:Si,TransportParseStream:si,ElementaryStream:pi,TimestampRolloverStream:Vi,CaptionStream:Bi.CaptionStream,Cea608Stream:Bi.Cea608Stream,Cea708Stream:Bi.Cea708Stream,MetadataStream:xn};for(var Kn in $n)$n.hasOwnProperty(Kn)&&(Gn[Kn]=$n[Kn]);var An=Gn,Oi=t,Jn=vt.ONE_SECOND_IN_TS,Gi,_i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Gi=function(m){var v,w=0;Gi.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,he;if(m||(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 Ae;T+7<v.length;){if(v[T]!==255||(v[T+1]&246)!==240){typeof Ae!="number"&&(Ae=T),T++;continue}if(typeof Ae=="number"&&(this.skipWarn_(Ae,T),Ae=null),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,he=oe*Jn/_i[(v[T+2]&60)>>>2],v.byteLength-T<A)break;this.trigger("data",{pts:x.pts+w*he,dts:x.dts+w*he,sampleCount:oe,audioobjecttype:(v[T+2]>>>6&3)+1,channelcount:(v[T+2]&1)<<2|(v[T+3]&192)>>>6,samplerate:_i[(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 Ae=="number"&&(this.skipWarn_(Ae,T),Ae=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")}},Gi.prototype=new Oi;var R=Gi,U;U=function(m){var v=m.byteLength,w=0,x=0;this.length=function(){return 8*v},this.bitsAvailable=function(){return 8*v+x},this.loadWord=function(){var T=m.byteLength-v,A=new Uint8Array(4),X=Math.min(4,v);if(X===0)throw new Error("no bytes available");A.set(m.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 ue=U,Se=t,Ee=ue,Ve,z,K;z=function(){var m=0,v,w;z.prototype.init.call(this),this.push=function(x){var T;w?(T=new Uint8Array(w.byteLength+x.data.byteLength),T.set(w),T.set(x.data,w.byteLength),w=T):w=x.data;for(var A=w.byteLength;m<A-3;m++)if(w[m+2]===1){v=m+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}m+3!==v-2&&this.trigger("data",w.subarray(m+3,v-2));do v++;while(w[v]!==1&&v<A);m=v-2,v+=3;break;case 1:if(w[v-1]!==0||w[v-2]!==0){v+=3;break}this.trigger("data",w.subarray(m+3,v-2)),m=v-2,v+=3;break;default:v+=3;break}w=w.subarray(m),v-=m,m=0},this.reset=function(){w=null,m=0,this.trigger("reset")},this.flush=function(){w&&w.byteLength>3&&this.trigger("data",w.subarray(m+3)),w=null,m=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},z.prototype=new Se,K={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ve=function(){var m=new z,v,w,x,T,A,X,J;Ve.prototype.init.call(this),v=this,this.push=function(oe){oe.type==="video"&&(w=oe.trackId,x=oe.pts,T=oe.dts,m.push(oe))},m.on("data",function(oe){var he={trackId:w,pts:x,dts:T,data:oe,nalUnitTypeCode:oe[0]&31};switch(he.nalUnitTypeCode){case 5:he.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:he.nalUnitType="sei_rbsp",he.escapedRBSP=A(oe.subarray(1));break;case 7:he.nalUnitType="seq_parameter_set_rbsp",he.escapedRBSP=A(oe.subarray(1)),he.config=X(he.escapedRBSP);break;case 8:he.nalUnitType="pic_parameter_set_rbsp";break;case 9:he.nalUnitType="access_unit_delimiter_rbsp";break}v.trigger("data",he)}),m.on("done",function(){v.trigger("done")}),m.on("partialdone",function(){v.trigger("partialdone")}),m.on("reset",function(){v.trigger("reset")}),m.on("endedtimeline",function(){v.trigger("endedtimeline")}),this.flush=function(){m.flush()},this.partialFlush=function(){m.partialFlush()},this.reset=function(){m.reset()},this.endTimeline=function(){m.endTimeline()},J=function(oe,he){var Ae=8,We=8,Ct,rt;for(Ct=0;Ct<oe;Ct++)We!==0&&(rt=he.readExpGolomb(),We=(Ae+rt+256)%256),Ae=We===0?Ae:We},A=function(oe){for(var he=oe.byteLength,Ae=[],We=1,Ct,rt;We<he-2;)oe[We]===0&&oe[We+1]===0&&oe[We+2]===3?(Ae.push(We+2),We+=2):We++;if(Ae.length===0)return oe;Ct=he-Ae.length,rt=new Uint8Array(Ct);var Ot=0;for(We=0;We<Ct;Ot++,We++)Ot===Ae[0]&&(Ot++,Ae.shift()),rt[We]=oe[Ot];return rt},X=function(oe){var he=0,Ae=0,We=0,Ct=0,rt,Ot,fn,Ki,Tr,Hs,$o,wi,ca,ks,$s,ai=[1,1],ls,ar;if(rt=new Ee(oe),Ot=rt.readUnsignedByte(),Ki=rt.readUnsignedByte(),fn=rt.readUnsignedByte(),rt.skipUnsignedExpGolomb(),K[Ot]&&(Tr=rt.readUnsignedExpGolomb(),Tr===3&&rt.skipBits(1),rt.skipUnsignedExpGolomb(),rt.skipUnsignedExpGolomb(),rt.skipBits(1),rt.readBoolean()))for($s=Tr!==3?8:12,ar=0;ar<$s;ar++)rt.readBoolean()&&(ar<6?J(16,rt):J(64,rt));if(rt.skipUnsignedExpGolomb(),Hs=rt.readUnsignedExpGolomb(),Hs===0)rt.readUnsignedExpGolomb();else if(Hs===1)for(rt.skipBits(1),rt.skipExpGolomb(),rt.skipExpGolomb(),$o=rt.readUnsignedExpGolomb(),ar=0;ar<$o;ar++)rt.skipExpGolomb();if(rt.skipUnsignedExpGolomb(),rt.skipBits(1),wi=rt.readUnsignedExpGolomb(),ca=rt.readUnsignedExpGolomb(),ks=rt.readBits(1),ks===0&&rt.skipBits(1),rt.skipBits(1),rt.readBoolean()&&(he=rt.readUnsignedExpGolomb(),Ae=rt.readUnsignedExpGolomb(),We=rt.readUnsignedExpGolomb(),Ct=rt.readUnsignedExpGolomb()),rt.readBoolean()&&rt.readBoolean()){switch(ls=rt.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=[rt.readUnsignedByte()<<8|rt.readUnsignedByte(),rt.readUnsignedByte()<<8|rt.readUnsignedByte()];break}}ai&&ai[0]/ai[1]}return{profileIdc:Ot,levelIdc:fn,profileCompatibility:Ki,width:(wi+1)*16-he*2-Ae*2,height:(2-ks)*(ca+1)*16-We*2-Ct*2,sarRatio:ai}}},Ve.prototype=new Se;var re={H264Stream:Ve},ye=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ze=function(m,v){var w=m[v+6]<<21|m[v+7]<<14|m[v+8]<<7|m[v+9],x=m[v+5],T=(x&16)>>4;return w=w>=0?w:0,T?w+20:w+10},Me=function(m,v){return m.length-v<10||m[v]!==73||m[v+1]!==68||m[v+2]!==51?v:(v+=ze(m,v),Me(m,v))},et=function(m){var v=Me(m,0);return m.length>=v+2&&(m[v]&255)===255&&(m[v+1]&240)===240&&(m[v+1]&22)===16},gt=function(m){return m[0]<<21|m[1]<<14|m[2]<<7|m[3]},Tt=function(m,v,w){var x,T="";for(x=v;x<w;x++)T+="%"+("00"+m[x].toString(16)).slice(-2);return T},Vt=function(m,v,w){return unescape(Tt(m,v,w))},Ut=function(m,v){var w=(m[v+5]&224)>>5,x=m[v+4]<<3,T=m[v+3]&6144;return T|x|w},un=function(m,v){return m[v]===73&&m[v+1]===68&&m[v+2]===51?"timed-metadata":m[v]&!0&&(m[v+1]&240)===240?"audio":null},Ci=function(m){for(var v=0;v+5<m.length;){if(m[v]!==255||(m[v+1]&246)!==240){v++;continue}return ye[(m[v+2]&60)>>>2]}return null},Pi=function(m){var v,w,x,T;v=10,m[5]&64&&(v+=4,v+=gt(m.subarray(10,14)));do{if(w=gt(m.subarray(v+4,v+8)),w<1)return null;if(T=String.fromCharCode(m[v],m[v+1],m[v+2],m[v+3]),T==="PRIV"){x=m.subarray(v+10,v+w+10);for(var A=0;A<x.byteLength;A++)if(x[A]===0){var X=Vt(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<m.byteLength);return null},yn={isLikelyAacData:et,parseId3TagSize:ze,parseAdtsSize:Ut,parseType:un,parseSampleRate:Ci,parseAacTimestamp:Pi},Os=t,sa=yn,Nr;Nr=function(){var m=new Uint8Array,v=0;Nr.prototype.init.call(this),this.setTimestamp=function(w){v=w},this.push=function(w){var x=0,T=0,A,X,J,oe;for(m.length?(oe=m.length,m=new Uint8Array(w.byteLength+oe),m.set(m.subarray(0,oe)),m.set(w,oe)):m=w;m.length-T>=3;){if(m[T]===73&&m[T+1]===68&&m[T+2]===51){if(m.length-T<10||(x=sa.parseId3TagSize(m,T),T+x>m.length))break;X={type:"timed-metadata",data:m.subarray(T,T+x)},this.trigger("data",X),T+=x;continue}else if((m[T]&255)===255&&(m[T+1]&240)===240){if(m.length-T<7||(x=sa.parseAdtsSize(m,T),T+x>m.length))break;J={type:"audio",data:m.subarray(T,T+x),pts:v,dts:v},this.trigger("data",J),T+=x;continue}T++}A=m.length-T,A>0?m=m.subarray(T):m=new Uint8Array},this.reset=function(){m=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){m=new Uint8Array,this.trigger("endedtimeline")}},Nr.prototype=new Os;var ci=Nr,Fi=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],_s=Fi,Do=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],km=Do,Oa=t,Mo=Ge,jo=kt,_l=yt,Wr=ne,ws=An,Ro=vt,Ed=R,Em=re.H264Stream,Cm=ci,Am=yn.isLikelyAacData,Bu=vt.ONE_SECOND_IN_TS,Cd=_s,Ad=km,wl,La,Tl,aa,Nm=function(m,v){v.stream=m,this.trigger("log",v)},Nd=function(m,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",Nm.bind(m,T))}},Dd=function(m,v){var w;if(m.length!==v.length)return!1;for(w=0;w<m.length;w++)if(m[w]!==v[w])return!1;return!0},Md=function(m,v,w,x,T,A){var X=w-v,J=x-v,oe=T-w;return{start:{dts:m,pts:m+X},end:{dts:m+J,pts:m+oe},prependedContentDuration:A,baseMediaDecodeTime:m}};La=function(m,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(m,J),m&&Cd.forEach(function(oe){m[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,he,Ae,We,Ct,rt;if(w.length===0){this.trigger("done","AudioSegmentStream");return}J=_l.trimAdtsFramesByEarliestDts(w,m,T),m.baseMediaDecodeTime=Wr.calculateTrackBaseMediaDecodeTime(m,v.keepOriginalTimestamps),rt=_l.prefixWithSilence(m,J,A,X),m.samples=_l.generateSampleTable(J),he=Mo.mdat(_l.concatenateFrameData(J)),w=[],oe=Mo.moof(x,[m]),Ae=new Uint8Array(oe.byteLength+he.byteLength),x++,Ae.set(oe),Ae.set(he,oe.byteLength),Wr.clearDtsInfo(m),We=Math.ceil(Bu*1024/m.samplerate),J.length&&(Ct=J.length*We,this.trigger("segmentTimingInfo",Md(Ro.audioTsToVideoTs(m.baseMediaDecodeTime,m.samplerate),J[0].dts,J[0].pts,J[0].dts+Ct,J[0].pts+Ct,rt||0)),this.trigger("timingInfo",{start:J[0].pts,end:J[0].pts+Ct})),this.trigger("data",{track:m,boxes:Ae}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Wr.clearDtsInfo(m),w=[],this.trigger("reset")}},La.prototype=new Oa,wl=function(m,v){var w,x=[],T=[],A,X;v=v||{},w=v.firstSequenceNumber||0,wl.prototype.init.call(this),delete m.minPTS,this.gopCache_=[],this.push=function(J){Wr.collectDtsInfo(m,J),J.nalUnitType==="seq_parameter_set_rbsp"&&!A&&(A=J.config,m.sps=[J.data],Ad.forEach(function(oe){m[oe]=A[oe]},this)),J.nalUnitType==="pic_parameter_set_rbsp"&&!X&&(X=J.data,m.pps=[J.data]),x.push(J)},this.flush=function(){for(var J,oe,he,Ae,We,Ct,rt=0,Ot,fn;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),he=jo.groupFramesIntoGops(J),he[0][0].keyFrame||(oe=this.getGopForFusion_(x[0],m),oe?(rt=oe.duration,he.unshift(oe),he.byteLength+=oe.byteLength,he.nalCount+=oe.nalCount,he.pts=oe.pts,he.dts=oe.dts,he.duration+=oe.duration):he=jo.extendFirstKeyFrame(he)),T.length){var Ki;if(v.alignGopsAtEnd?Ki=this.alignGopsAtEnd_(he):Ki=this.alignGopsAtStart_(he),!Ki){this.gopCache_.unshift({gop:he.pop(),pps:m.pps,sps:m.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Wr.clearDtsInfo(m),he=Ki}Wr.collectDtsInfo(m,he),m.samples=jo.generateSampleTable(he),We=Mo.mdat(jo.concatenateNalData(he)),m.baseMediaDecodeTime=Wr.calculateTrackBaseMediaDecodeTime(m,v.keepOriginalTimestamps),this.trigger("processedGopsInfo",he.map(function(Tr){return{pts:Tr.pts,dts:Tr.dts,byteLength:Tr.byteLength}})),Ot=he[0],fn=he[he.length-1],this.trigger("segmentTimingInfo",Md(m.baseMediaDecodeTime,Ot.dts,Ot.pts,fn.dts+fn.duration,fn.pts+fn.duration,rt)),this.trigger("timingInfo",{start:he[0].pts,end:he[he.length-1].pts+he[he.length-1].duration}),this.gopCache_.unshift({gop:he.pop(),pps:m.pps,sps:m.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),x=[],this.trigger("baseMediaDecodeTime",m.baseMediaDecodeTime),this.trigger("timelineStartInfo",m.timelineStartInfo),Ae=Mo.moof(w,[m]),Ct=new Uint8Array(Ae.byteLength+We.byteLength),w++,Ct.set(Ae),Ct.set(We,Ae.byteLength),this.trigger("data",{track:m,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(m),A=void 0,X=void 0},this.getGopForFusion_=function(J){var oe=45e3,he=1/0,Ae,We,Ct,rt,Ot;for(Ot=0;Ot<this.gopCache_.length;Ot++)rt=this.gopCache_[Ot],Ct=rt.gop,!(!(m.pps&&Dd(m.pps[0],rt.pps[0]))||!(m.sps&&Dd(m.sps[0],rt.sps[0])))&&(Ct.dts<m.timelineStartInfo.dts||(Ae=J.dts-Ct.dts-Ct.duration,Ae>=-1e4&&Ae<=oe&&(!We||he>Ae)&&(We=rt,he=Ae)));return We?We.gop:null},this.alignGopsAtStart_=function(J){var oe,he,Ae,We,Ct,rt,Ot,fn;for(Ct=J.byteLength,rt=J.nalCount,Ot=J.duration,oe=he=0;oe<T.length&&he<J.length&&(Ae=T[oe],We=J[he],Ae.pts!==We.pts);){if(We.pts>Ae.pts){oe++;continue}he++,Ct-=We.byteLength,rt-=We.nalCount,Ot-=We.duration}return he===0?J:he===J.length?null:(fn=J.slice(he),fn.byteLength=Ct,fn.duration=Ot,fn.nalCount=rt,fn.pts=fn[0].pts,fn.dts=fn[0].dts,fn)},this.alignGopsAtEnd_=function(J){var oe,he,Ae,We,Ct,rt;for(oe=T.length-1,he=J.length-1,Ct=null,rt=!1;oe>=0&&he>=0;){if(Ae=T[oe],We=J[he],Ae.pts===We.pts){rt=!0;break}if(Ae.pts>We.pts){oe--;continue}oe===T.length-1&&(Ct=he),he--}if(!rt&&Ct===null)return null;var Ot;if(rt?Ot=he:Ot=Ct,Ot===0)return J;var fn=J.slice(Ot),Ki=fn.reduce(function(Tr,Hs){return Tr.byteLength+=Hs.byteLength,Tr.duration+=Hs.duration,Tr.nalCount+=Hs.nalCount,Tr},{byteLength:0,duration:0,nalCount:0});return fn.byteLength=Ki.byteLength,fn.duration=Ki.duration,fn.nalCount=Ki.nalCount,fn.pts=fn[0].pts,fn.dts=fn[0].dts,fn},this.alignGopsWith=function(J){T=J}},wl.prototype=new Oa,aa=function(m,v){this.numberOfTracks=0,this.metadataStream=v,m=m||{},typeof m.remux<"u"?this.remuxTracks=!!m.remux:this.remuxTracks=!0,typeof m.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=m.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,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(m){var v=0,w={captions:[],captionStreams:{},metadata:[],info:{}},x,T,A,X=0,J;if(this.pendingTracks.length<this.numberOfTracks){if(m!=="VideoSegmentStream"&&m!=="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,Ad.forEach(function(oe){w.info[oe]=this.videoTrack[oe]},this)):this.audioTrack&&(X=this.audioTrack.timelineStartInfo.pts,Cd.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(m){this.remuxTracks=m},Tl=function(m){var v=this,w=!0,x,T;Tl.prototype.init.call(this),m=m||{},this.baseMediaDecodeTime=m.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new ws.MetadataStream,A.aacStream=new Cm,A.audioTimestampRolloverStream=new ws.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new ws.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Ed,A.coalesceStream=new aa(m,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(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,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x}))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Nd(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 Ed,A.h264Stream=new Em,A.captionStream=new ws.CaptionStream(m),A.coalesceStream=new aa(m,A.metadataStream),A.headOfPipeline=A.packetStream,A.packetStream.pipe(A.parseStream).pipe(A.elementaryStream).pipe(A.timestampRolloverStream),A.timestampRolloverStream.pipe(A.h264Stream),A.timestampRolloverStream.pipe(A.adtsStream),A.timestampRolloverStream.pipe(A.metadataStream).pipe(A.coalesceStream),A.h264Stream.pipe(A.captionStream).pipe(A.coalesceStream),A.elementaryStream.on("data",function(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 wl(x,m),A.videoSegmentStream.on("log",v.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(oe){T&&!m.keepOriginalTimestamps&&(T.timelineStartInfo=oe,A.audioSegmentStream.setEarliestDts(oe.dts-v.baseMediaDecodeTime))}),A.videoSegmentStream.on("processedGopsInfo",v.trigger.bind(v,"gopInfo")),A.videoSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"videoSegmentTimingInfo")),A.videoSegmentStream.on("baseMediaDecodeTime",function(oe){T&&A.audioSegmentStream.setVideoBaseMediaDecodeTime(oe)}),A.videoSegmentStream.on("timingInfo",v.trigger.bind(v,"videoTimingInfo")),A.h264Stream.pipe(A.videoSegmentStream).pipe(A.coalesceStream)),T&&!A.audioSegmentStream&&(A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new La(T,m),A.audioSegmentStream.on("log",v.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",v.trigger.bind(v,"audioTimingInfo")),A.audioSegmentStream.on("segmentTimingInfo",v.trigger.bind(v,"audioSegmentTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream)),v.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!x})}}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("id3Frame",function(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")),Nd(this,A)},this.setBaseMediaDecodeTime=function(A){var X=this.transmuxPipeline_;m.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_;m.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=Am(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()}},Tl.prototype=new Oa;var Dm={Transmuxer:Tl},Mm=function(m){return m>>>0},jm=function(m){return("00"+m.toString(16)).slice(-2)},Ia={toUnsigned:Mm,toHexString:jm},Oo=function(m){var v="";return v+=String.fromCharCode(m[0]),v+=String.fromCharCode(m[1]),v+=String.fromCharCode(m[2]),v+=String.fromCharCode(m[3]),v},jd=Oo,Rd=Ia.toUnsigned,Od=jd,Pu=function(m,v){var w=[],x,T,A,X,J;if(!v.length)return null;for(x=0;x<m.byteLength;)T=Rd(m[x]<<24|m[x+1]<<16|m[x+2]<<8|m[x+3]),A=Od(m.subarray(x+4,x+8)),X=T>1?x+T:m.byteLength,A===v[0]&&(v.length===1?w.push(m.subarray(x+8,X)):(J=Pu(m.subarray(x+8,X),v.slice(1)),J.length&&(w=w.concat(J)))),x=X;return w},Sl=Pu,Ld=Ia.toUnsigned,Ba=l.getUint64,Rm=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4))};return v.version===1?v.baseMediaDecodeTime=Ba(m.subarray(4)):v.baseMediaDecodeTime=Ld(m[4]<<24|m[5]<<16|m[6]<<8|m[7]),v},Fu=Rm,Om=function(m){var v=new DataView(m.buffer,m.byteOffset,m.byteLength),w={version:m[0],flags:new Uint8Array(m.subarray(1,4)),trackId:v.getUint32(4)},x=w.flags[2]&1,T=w.flags[2]&2,A=w.flags[2]&8,X=w.flags[2]&16,J=w.flags[2]&32,oe=w.flags[0]&65536,he=w.flags[0]&131072,Ae;return Ae=8,x&&(Ae+=4,w.baseDataOffset=v.getUint32(12),Ae+=4),T&&(w.sampleDescriptionIndex=v.getUint32(Ae),Ae+=4),A&&(w.defaultSampleDuration=v.getUint32(Ae),Ae+=4),X&&(w.defaultSampleSize=v.getUint32(Ae),Ae+=4),J&&(w.defaultSampleFlags=v.getUint32(Ae)),oe&&(w.durationIsEmpty=!0),!x&&he&&(w.baseDataOffsetIsMoof=!0),w},Uu=Om,Id=function(m){return{isLeading:(m[0]&12)>>>2,dependsOn:m[0]&3,isDependedOn:(m[1]&192)>>>6,hasRedundancy:(m[1]&48)>>>4,paddingValue:(m[1]&14)>>>1,isNonSyncSample:m[1]&1,degradationPriority:m[2]<<8|m[3]}},Lo=Id,Pa=Lo,Lm=function(m){var v={version:m[0],flags:new Uint8Array(m.subarray(1,4)),samples:[]},w=new DataView(m.buffer,m.byteOffset,m.byteLength),x=v.flags[2]&1,T=v.flags[2]&4,A=v.flags[1]&1,X=v.flags[1]&2,J=v.flags[1]&4,oe=v.flags[1]&8,he=w.getUint32(4),Ae=8,We;for(x&&(v.dataOffset=w.getInt32(Ae),Ae+=4),T&&he&&(We={flags:Pa(m.subarray(Ae,Ae+4))},Ae+=4,A&&(We.duration=w.getUint32(Ae),Ae+=4),X&&(We.size=w.getUint32(Ae),Ae+=4),oe&&(v.version===1?We.compositionTimeOffset=w.getInt32(Ae):We.compositionTimeOffset=w.getUint32(Ae),Ae+=4),v.samples.push(We),he--);he--;)We={},A&&(We.duration=w.getUint32(Ae),Ae+=4),X&&(We.size=w.getUint32(Ae),Ae+=4),J&&(We.flags=Pa(m.subarray(Ae,Ae+4)),Ae+=4),oe&&(v.version===1?We.compositionTimeOffset=w.getInt32(Ae):We.compositionTimeOffset=w.getUint32(Ae),Ae+=4),v.samples.push(We);return v},Io=Lm,zu={tfdt:Fu,trun:Io},Hu={parseTfdt:zu.tfdt,parseTrun:zu.trun},$u=function(m){for(var v=0,w=String.fromCharCode(m[v]),x="";w!=="\0";)x+=w,v++,w=String.fromCharCode(m[v]);return x+=w,x},qu={uint8ToCString:$u},Bo=qu.uint8ToCString,Bd=l.getUint64,Pd=function(m){var v=4,w=m[0],x,T,A,X,J,oe,he,Ae;if(w===0){x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length;var We=new DataView(m.buffer);A=We.getUint32(v),v+=4,J=We.getUint32(v),v+=4,oe=We.getUint32(v),v+=4,he=We.getUint32(v),v+=4}else if(w===1){var We=new DataView(m.buffer);A=We.getUint32(v),v+=4,X=Bd(m.subarray(v)),v+=8,oe=We.getUint32(v),v+=4,he=We.getUint32(v),v+=4,x=Bo(m.subarray(v)),v+=x.length,T=Bo(m.subarray(v)),v+=T.length}Ae=new Uint8Array(m.subarray(v,m.byteLength));var Ct={scheme_id_uri:x,value:T,timescale:A||1,presentation_time:X,presentation_time_delta:J,event_duration:oe,id:he,message_data:Ae};return Bm(w,Ct)?Ct:void 0},Im=function(m,v,w,x){return m||m===0?m/v:x+w/v},Bm=function(m,v){var w=v.scheme_id_uri!=="\0",x=m===0&&Fd(v.presentation_time_delta)&&w,T=m===1&&Fd(v.presentation_time)&&w;return!(m>1)&&x||T},Fd=function(m){return m!==void 0||m!==null},Pm={parseEmsgBox:Pd,scaleTime:Im},Po;typeof window<"u"?Po=window:typeof n<"u"?Po=n:typeof self<"u"?Po=self:Po={};var yr=Po,Ls=Ia.toUnsigned,Fa=Ia.toHexString,Ai=Sl,oa=jd,kl=Pm,Vu=Uu,Fm=Io,Ua=Fu,Gu=l.getUint64,za,El,Ku,Is,la,Fo,Wu,Ts=yr,Ud=xt.parseId3Frames;za=function(m){var v={},w=Ai(m,["moov","trak"]);return w.reduce(function(x,T){var A,X,J,oe,he;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]),he=Ai(T,["mdia","mdhd"])[0],!he)?null:(X=he[0],J=X===0?12:20,x[oe]=Ls(he[J]<<24|he[J+1]<<16|he[J+2]<<8|he[J+3]),x)},v)},El=function(m,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=m[J]||9e4,he=Ai(A,["tfdt"])[0],Ae=new DataView(he.buffer,he.byteOffset,he.byteLength),We;he[0]===1?We=Gu(he.subarray(4,12)):We=Ae.getUint32(4);let Ct;return typeof We=="bigint"?Ct=We/Ts.BigInt(oe):typeof We=="number"&&!isNaN(We)&&(Ct=We/oe),Ct<Number.MAX_SAFE_INTEGER&&(Ct=Number(Ct)),Ct<T&&(T=Ct),T},1/0);return typeof x=="bigint"||isFinite(x)?x:0},Ku=function(m,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 he=Vu(X);A=he.trackId}if(oe){var Ae=Ua(oe);x=Ae.baseMediaDecodeTime}if(J){var We=Fm(J);We.samples&&We.samples.length&&(T=We.samples[0].compositionTimeOffset||0)}}var Ct=m[A]||9e4;typeof x=="bigint"&&(T=Ts.BigInt(T),Ct=Ts.BigInt(Ct));var rt=(x+T)/Ct;return typeof rt=="bigint"&&rt<Number.MAX_SAFE_INTEGER&&(rt=Number(rt)),rt},Is=function(m){var v=Ai(m,["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)),he=A[J],Ae,We,Ct;oe==="vide"&&(Ae=new DataView(he.buffer,he.byteOffset,he.byteLength),We=Ae.getUint8(0),Ct=We===0?Ae.getUint32(12):Ae.getUint32(20),w.push(Ct))})}),w},Fo=function(m){var v=m[0],w=v===0?12:20;return Ls(m[w]<<24|m[w+1]<<16|m[w+2]<<8|m[w+3])},la=function(m){var v=Ai(m,["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 he=oa(oe.subarray(8,12));he==="vide"?T.type="video":he==="soun"?T.type="audio":T.type=he}var Ae=Ai(x,["mdia","minf","stbl","stsd"])[0];if(Ae){var We=Ae.subarray(8);T.codec=oa(We.subarray(4,8));var Ct=Ai(We,[T.codec])[0],rt,Ot;Ct&&(/^[asm]vc[1-9]$/i.test(T.codec)?(rt=Ct.subarray(78),Ot=oa(rt.subarray(4,8)),Ot==="avcC"&&rt.length>11?(T.codec+=".",T.codec+=Fa(rt[9]),T.codec+=Fa(rt[10]),T.codec+=Fa(rt[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(rt=Ct.subarray(28),Ot=oa(rt.subarray(4,8)),Ot==="esds"&&rt.length>20&&rt[19]!==0?(T.codec+="."+Fa(rt[19]),T.codec+="."+Fa(rt[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var fn=Ai(x,["mdia","mdhd"])[0];fn&&(T.timescale=Fo(fn)),w.push(T)}),w},Wu=function(m,v=0){var w=Ai(m,["emsg"]);return w.map(x=>{var T=kl.parseEmsgBox(new Uint8Array(x)),A=Ud(T.message_data);return{cueTime:kl.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,v),duration:kl.scaleTime(T.event_duration,T.timescale),frames:A}})};var Ha={findBox:Ai,parseType:oa,timescale:za,startTime:El,compositionStartTime:Ku,videoTrackIds:Is,tracks:la,getTimescaleFromMediaHeader:Fo,getEmsgID3:Wu};const{parseTrun:zd}=Hu,{findBox:Hd}=Ha;var $d=yr,Um=function(m){var v=Hd(m,["moof","traf"]),w=Hd(m,["mdat"]),x=[];return w.forEach(function(T,A){var X=v[A];x.push({mdat:T,traf:X})}),x},qd=function(m,v,w){var x=v,T=w.defaultSampleDuration||0,A=w.defaultSampleSize||0,X=w.trackId,J=[];return m.forEach(function(oe){var he=zd(oe),Ae=he.samples;Ae.forEach(function(We){We.duration===void 0&&(We.duration=T),We.size===void 0&&(We.size=A),We.trackId=X,We.dts=x,We.compositionTimeOffset===void 0&&(We.compositionTimeOffset=0),typeof x=="bigint"?(We.pts=x+$d.BigInt(We.compositionTimeOffset),x+=$d.BigInt(We.duration)):(We.pts=x+We.compositionTimeOffset,x+=We.duration)}),J=J.concat(Ae)}),J},Xu={getMdatTrafPairs:Um,parseSamples:qd},Yu=Qt.discardEmulationPreventionBytes,Xr=Un.CaptionStream,$a=Sl,Dr=Fu,qa=Uu,{getMdatTrafPairs:Qu,parseSamples:Cl}=Xu,Al=function(m,v){for(var w=m,x=0;x<v.length;x++){var T=v[x];if(w<T.size)return T;w-=T.size}return null},Zu=function(m,v,w){var x=new DataView(m.buffer,m.byteOffset,m.byteLength),T={logs:[],seiNals:[]},A,X,J,oe;for(X=0;X+4<m.length;X+=J)if(J=x.getUint32(X),X+=4,!(J<=0))switch(m[X]&31){case 6:var he=m.subarray(X+1,X+1+J),Ae=Al(X,v);if(A={nalUnitType:"sei_rbsp",size:J,data:he,escapedRBSP:Yu(he),trackId:w},Ae)A.pts=Ae.pts,A.dts=Ae.dts,oe=Ae;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(m,v){var w={},x=Qu(m);return x.forEach(function(T){var A=T.mdat,X=T.traf,J=$a(X,["tfhd"]),oe=qa(J[0]),he=oe.trackId,Ae=$a(X,["tfdt"]),We=Ae.length>0?Dr(Ae[0]).baseMediaDecodeTime:0,Ct=$a(X,["trun"]),rt,Ot;v===he&&Ct.length>0&&(rt=Cl(Ct,We,oe),Ot=Zu(A,rt,he),w[he]||(w[he]={seiNals:[],logs:[]}),w[he].seiNals=w[he].seiNals.concat(Ot.seiNals),w[he].logs=w[he].logs.concat(Ot.logs))}),w},Vd=function(m,v,w){var x;if(v===null)return null;x=ua(m,v);var T=x[v]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:w}},Nl=function(){var m=!1,v,w,x,T,A,X;this.isInitialized=function(){return m},this.init=function(J){v=new Xr,m=!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,he){var Ae;if(this.isInitialized()){if(!oe||!he)return null;if(this.isNewInit(oe,he))x=oe[0],T=he[x];else if(x===null||!T)return w.push(J),null}else return null;for(;w.length>0;){var We=w.shift();this.parse(We,oe,he)}return Ae=Vd(J,x,T),Ae&&Ae.logs&&(A.logs=A.logs.concat(Ae.logs)),Ae===null||!Ae.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(Ae.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=Nl;const{parseTfdt:zm}=Hu,Ui=Sl,{getTimescaleFromMediaHeader:Ju}=Ha,{parseSamples:Ss,getMdatTrafPairs:Gd}=Xu;var Bs=function(){let m=9e4;this.init=function(v){const w=Ui(v,["moov","trak","mdia","mdhd"])[0];w&&(m=Ju(w))},this.parseSegment=function(v){const w=[],x=Gd(v);let T=0;return x.forEach(function(A){const X=A.mdat,J=A.traf,oe=Ui(J,["tfdt"])[0],he=Ui(J,["tfhd"])[0],Ae=Ui(J,["trun"]);if(oe&&(T=zm(oe).baseMediaDecodeTime),Ae.length&&he){const We=Ss(Ae,T,he);let Ct=0;We.forEach(function(rt){const Ot="utf-8",fn=new TextDecoder(Ot),Ki=X.slice(Ct,Ct+rt.size);if(Ui(Ki,["vtte"])[0]){Ct+=rt.size;return}Ui(Ki,["vttc"]).forEach(function($o){const wi=Ui($o,["payl"])[0],ca=Ui($o,["sttg"])[0],ks=rt.pts/m,$s=(rt.pts+rt.duration)/m;let ai,ls;if(wi)try{ai=fn.decode(wi)}catch(ar){console.error(ar)}if(ca)try{ls=fn.decode(ca)}catch(ar){console.error(ar)}rt.duration&&ai&&w.push({cueText:ai,start:ks,end:$s,settings:ls})}),Ct+=rt.size})}}),w}},Uo=Yn,tc=function(m){var v=m[1]&31;return v<<=8,v|=m[2],v},Ga=function(m){return!!(m[1]&64)},zo=function(m){var v=0;return(m[3]&48)>>>4>1&&(v+=m[4]+1),v},Mr=function(m,v){var w=tc(m);return w===0?"pat":w===v?"pmt":v?"pes":null},Ka=function(m){var v=Ga(m),w=4+zo(m);return v&&(w+=m[w]+1),(m[w+10]&31)<<8|m[w+11]},Wa=function(m){var v={},w=Ga(m),x=4+zo(m);if(w&&(x+=m[x]+1),!!(m[x+5]&1)){var T,A,X;T=(m[x+1]&15)<<8|m[x+2],A=3+T-4,X=(m[x+10]&15)<<8|m[x+11];for(var J=12+X;J<A;){var oe=x+J;v[(m[oe+1]&31)<<8|m[oe+2]]=m[oe],J+=((m[oe+3]&15)<<8|m[oe+4])+5}return v}},Dl=function(m,v){var w=tc(m),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}},Ho=function(m){var v=Ga(m);if(!v)return null;var w=4+zo(m);if(w>=m.byteLength)return null;var x=null,T;return T=m[w+7],T&192&&(x={},x.pts=(m[w+9]&14)<<27|(m[w+10]&255)<<20|(m[w+11]&254)<<12|(m[w+12]&255)<<5|(m[w+13]&254)>>>3,x.pts*=4,x.pts+=(m[w+13]&6)>>>1,x.dts=x.pts,T&64&&(x.dts=(m[w+14]&14)<<27|(m[w+15]&255)<<20|(m[w+16]&254)<<12|(m[w+17]&255)<<5|(m[w+18]&254)>>>3,x.dts*=4,x.dts+=(m[w+18]&6)>>>1)),x},br=function(m){switch(m){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},jr=function(m){for(var v=4+zo(m),w=m.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=br(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=br(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=br(w[T+3]&31),X==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},Ps={parseType:Mr,parsePat:Ka,parsePmt:Wa,parsePayloadUnitStartIndicator:Ga,parsePesType:Dl,parsePesTime:Ho,videoPacketContainsKeyFrame:jr},Yr=Yn,hr=Zn.handleRollover,kn={};kn.ts=Ps,kn.aac=yn;var Fs=vt.ONE_SECOND_IN_TS,ir=188,Rr=71,Kd=function(m,v){for(var w=0,x=ir,T,A;x<m.byteLength;){if(m[w]===Rr&&m[x]===Rr){switch(T=m.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+=ir,x+=ir;continue}w++,x++}},Zi=function(m,v,w){for(var x=0,T=ir,A,X,J,oe,he,Ae=!1;T<=m.byteLength;){if(m[x]===Rr&&(m[T]===Rr||T===m.byteLength)){if(A=m.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&&(he=kn.ts.parsePesTime(A),he&&(he.type="audio",w.audio.push(he),Ae=!0))),Ae)break;x+=ir,T+=ir;continue}x++,T++}for(T=m.byteLength,x=T-ir,Ae=!1;x>=0;){if(m[x]===Rr&&(m[T]===Rr||T===m.byteLength)){if(A=m.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&&(he=kn.ts.parsePesTime(A),he&&(he.type="audio",w.audio.push(he),Ae=!0))),Ae)break;x-=ir,T-=ir;continue}x--,T--}},gi=function(m,v,w){for(var x=0,T=ir,A,X,J,oe,he,Ae,We,Ct,rt=!1,Ot={data:[],size:0};T<m.byteLength;){if(m[x]===Rr&&m[T]===Rr){switch(A=m.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&&!rt&&(he=kn.ts.parsePesTime(A),he&&(he.type="video",w.video.push(he),rt=!0)),!w.firstKeyFrame)){if(oe&&Ot.size!==0){for(Ae=new Uint8Array(Ot.size),We=0;Ot.data.length;)Ct=Ot.data.shift(),Ae.set(Ct,We),We+=Ct.byteLength;if(kn.ts.videoPacketContainsKeyFrame(Ae)){var fn=kn.ts.parsePesTime(Ae);fn?(w.firstKeyFrame=fn,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.")}Ot.size=0}Ot.data.push(A),Ot.size+=A.byteLength}break}if(rt&&w.firstKeyFrame)break;x+=ir,T+=ir;continue}x++,T++}for(T=m.byteLength,x=T-ir,rt=!1;x>=0;){if(m[x]===Rr&&m[T]===Rr){if(A=m.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&&(he=kn.ts.parsePesTime(A),he&&(he.type="video",w.video.push(he),rt=!0))),rt)break;x-=ir,T-=ir;continue}x--,T--}},Rn=function(m,v){if(m.audio&&m.audio.length){var w=v;(typeof w>"u"||isNaN(w))&&(w=m.audio[0].dts),m.audio.forEach(function(A){A.dts=hr(A.dts,w),A.pts=hr(A.pts,w),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs})}if(m.video&&m.video.length){var x=v;if((typeof x>"u"||isNaN(x))&&(x=m.video[0].dts),m.video.forEach(function(A){A.dts=hr(A.dts,x),A.pts=hr(A.pts,x),A.dtsTime=A.dts/Fs,A.ptsTime=A.pts/Fs}),m.firstKeyFrame){var T=m.firstKeyFrame;T.dts=hr(T.dts,x),T.pts=hr(T.pts,x),T.dtsTime=T.dts/Fs,T.ptsTime=T.pts/Fs}}},Us=function(m){for(var v=!1,w=0,x=null,T=null,A=0,X=0,J;m.length-X>=3;){var oe=kn.aac.parseType(m,X);switch(oe){case"timed-metadata":if(m.length-X<10){v=!0;break}if(A=kn.aac.parseId3TagSize(m,X),A>m.length){v=!0;break}T===null&&(J=m.subarray(X,X+A),T=kn.aac.parseAacTimestamp(J)),X+=A;break;case"audio":if(m.length-X<7){v=!0;break}if(A=kn.aac.parseAdtsSize(m,X),A>m.length){v=!0;break}x===null&&(J=m.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 he=Fs/x,Ae={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+w*1024*he,pts:T+w*1024*he}]};return Ae},Or=function(m){var v={pid:null,table:null},w={};Kd(m,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(m,v,w),w.video.length===0&&delete w.video;break;case Yr.ADTS_STREAM_TYPE:w.audio=[],Zi(m,v,w),w.audio.length===0&&delete w.audio;break}}return w},nc=function(m,v){var w=kn.aac.isLikelyAacData(m),x;return w?x=Us(m):x=Or(m),!x||!x.audio&&!x.video?null:(Rn(x,v),x)},zs={inspect:nc,parseAudioPes_:Zi};const Wd=function(m,v){v.on("data",function(w){const x=w.initSegment;w.initSegment={data:x.buffer,byteOffset:x.byteOffset,byteLength:x.byteLength};const T=w.data;w.data=T.buffer,m.postMessage({action:"data",segment:w,byteOffset:T.byteOffset,byteLength:T.byteLength},[w.data])}),v.on("done",function(w){m.postMessage({action:"done"})}),v.on("gopInfo",function(w){m.postMessage({action:"gopInfo",gopInfo:w})}),v.on("videoSegmentTimingInfo",function(w){const x={start:{decode:vt.videoTsToSeconds(w.start.dts),presentation:vt.videoTsToSeconds(w.start.pts)},end:{decode:vt.videoTsToSeconds(w.end.dts),presentation:vt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:vt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=vt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:x})}),v.on("audioSegmentTimingInfo",function(w){const x={start:{decode:vt.videoTsToSeconds(w.start.dts),presentation:vt.videoTsToSeconds(w.start.pts)},end:{decode:vt.videoTsToSeconds(w.end.dts),presentation:vt.videoTsToSeconds(w.end.pts)},baseMediaDecodeTime:vt.videoTsToSeconds(w.baseMediaDecodeTime)};w.prependedContentDuration&&(x.prependedContentDuration=vt.videoTsToSeconds(w.prependedContentDuration)),m.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:x})}),v.on("id3Frame",function(w){m.postMessage({action:"id3Frame",id3Frame:w})}),v.on("caption",function(w){m.postMessage({action:"caption",caption:w})}),v.on("trackinfo",function(w){m.postMessage({action:"trackinfo",trackInfo:w})}),v.on("audioTimingInfo",function(w){m.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:vt.videoTsToSeconds(w.start),end:vt.videoTsToSeconds(w.end)}})}),v.on("videoTimingInfo",function(w){m.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:vt.videoTsToSeconds(w.start),end:vt.videoTsToSeconds(w.end)}})}),v.on("log",function(w){m.postMessage({action:"log",log:w})})};class ic{constructor(v,w){this.options=w||{},this.self=v,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Dm.Transmuxer(this.options),Wd(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=Ha.startTime(v,w);this.self.postMessage({action:"probeMp4StartTime",startTime:x,data:w},[w.buffer])}probeMp4Tracks({data:v}){const w=Ha.tracks(v);this.self.postMessage({action:"probeMp4Tracks",tracks:w,data:v},[v.buffer])}probeEmsgID3({data:v,offset:w}){const x=Ha.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*vt.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(vt.secondsToVideoTs(w)))}setAudioAppendStart(v){this.transmuxer.setAudioAppendStart(Math.ceil(vt.secondsToVideoTs(v.appendStart)))}setRemux(v){this.transmuxer.setRemux(v.remux)}flush(v){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(v){this.transmuxer.alignGopsWith(v.gopsToAlignWith.slice())}}self.onmessage=function(m){if(m.data.action==="init"&&m.data.options){this.messageHandlers=new ic(self,m.data.options);return}this.messageHandlers||(this.messageHandlers=new ic(self)),m.data&&m.data.action&&m.data.action!=="init"&&this.messageHandlers[m.data.action]&&this.messageHandlers[m.data.action](m.data)}}));var Yj=GS(Xj);const Qj=(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)},Zj=({transmuxedData:n,callback:e})=>{n.buffer=[],e(n)},Jj=(n,e)=>{e.gopInfo=n.data.gopInfo},XS=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:M,onDone:L,onEndedTimeline:E,onTransmuxerLog:B,isEndOfTimeline:G,segment:Q,triggerSegmentEventFn:H}=n,se={buffer:[]};let Y=G;const W=ae=>{e.currentTransmux===n&&(ae.data.action==="data"&&Qj(ae,se,u),ae.data.action==="trackinfo"&&h(ae.data.trackInfo),ae.data.action==="gopInfo"&&Jj(ae,se),ae.data.action==="audioTimingInfo"&&f(ae.data.audioTimingInfo),ae.data.action==="videoTimingInfo"&&g(ae.data.videoTimingInfo),ae.data.action==="videoSegmentTimingInfo"&&_(ae.data.videoSegmentTimingInfo),ae.data.action==="audioSegmentTimingInfo"&&S(ae.data.audioSegmentTimingInfo),ae.data.action==="id3Frame"&&C([ae.data.id3Frame],ae.data.id3Frame.dispatchType),ae.data.action==="caption"&&M(ae.data.caption),ae.data.action==="endedtimeline"&&(Y=!1,E()),ae.data.action==="log"&&B(ae.data.log),ae.data.type==="transmuxed"&&(Y||(e.onmessage=null,Zj({transmuxedData:se,callback:L}),YS(e))))},O=()=>{const ae={message:"Received an error message from the transmuxer worker",metadata:{errorType:Be.Error.StreamingFailedToTransmuxSegment,segmentInfo:al({segment:Q})}};L(null,ae)};if(e.onmessage=W,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 ae=t instanceof ArrayBuffer?t:t.buffer,k=t instanceof ArrayBuffer?0:t.byteOffset;H({type:"segmenttransmuxingstart",segment:Q}),e.postMessage({action:"push",data:ae,byteOffset:k,byteLength:t.byteLength},[ae])}G&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},YS=n=>{n.currentTransmux=null,n.transmuxQueue.length&&(n.currentTransmux=n.transmuxQueue.shift(),typeof n.currentTransmux=="function"?n.currentTransmux():XS(n.currentTransmux))},c_=(n,e)=>{n.postMessage({action:e}),YS(n)},QS=(n,e)=>{if(!e.currentTransmux){e.currentTransmux=n,c_(e,n);return}e.transmuxQueue.push(c_.bind(null,e,n))},eR=n=>{QS("reset",n)},tR=n=>{QS("endTimeline",n)},ZS=n=>{if(!n.transmuxer.currentTransmux){n.transmuxer.currentTransmux=n,XS(n);return}n.transmuxer.transmuxQueue.push(n)},nR=n=>{const e=new Yj;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:n}),e};var mg={reset:eR,endTimeline:tR,transmux:ZS,createTransmuxer:nR};const hu=function(n){const e=n.transmuxer,t=n.endAction||n.action,i=n.callback,a=Qi({},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},JS="wvtt",ry=n=>{n.forEach(e=>{e.abort()})},iR=n=>({bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}),rR=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},tb=(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=tb(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)},sR=(n,e)=>{e===JS&&n.transmuxer.postMessage({action:"initMp4WebVttParser",data:n.map.bytes})},aR=(n,e,t)=>{e===JS&&hu({action:"getMp4WebVttText",data:n.bytes,transmuxer:n.transmuxer,callback:({data:i,mp4VttCues:a})=>{n.bytes=i,t(null,n,{mp4VttCues:a})}})},ek=(n,e)=>{const t=Sy(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}})}hu({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"&&sR(n,l.codec))}),e(null))})},oR=({segment:n,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,a)=>{const l=tb(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,ek(n,function(h){if(h)return h.xhr=a,h.status=a.status,e(h,n);e(null,n)})},lR=({segment:n,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(a,l)=>{const u=tb(a,l);if(u)return e(u,n);i({type:"segmentloaded",segment:n});const h=t==="arraybuffer"||!l.responseText?l.response:Kj(l.responseText.substring(n.lastReachedChar||0));return n.stats=iR(l),n.key?n.encryptedBytes=new Uint8Array(h):n.bytes=new Uint8Array(h),e(null,n)},uR=({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:M})=>{const L=n.map&&n.map.tracks||{},E=!!(L.audio&&L.video);let B=i.bind(null,n,"audio","start");const G=i.bind(null,n,"audio","end");let Q=i.bind(null,n,"video","start");const H=i.bind(null,n,"video","end"),se=()=>ZS({bytes:e,transmuxer:n.transmuxer,audioAppendStart:n.audioAppendStart,gopsToAlignWith:n.gopsToAlignWith,remux:E,onData:Y=>{Y.type=Y.type==="combined"?"video":Y.type,_(n,Y)},onTrackInfo:Y=>{t&&(E&&(Y.isMuxed=!0),t(n,Y))},onAudioTimingInfo:Y=>{B&&typeof Y.start<"u"&&(B(Y.start),B=null),G&&typeof Y.end<"u"&&G(Y.end)},onVideoTimingInfo:Y=>{Q&&typeof Y.start<"u"&&(Q(Y.start),Q=null),H&&typeof Y.end<"u"&&H(Y.end)},onVideoSegmentTimingInfo:Y=>{const W={pts:{start:Y.start.presentation,end:Y.end.presentation},dts:{start:Y.start.decode,end:Y.end.decode}};M({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:W}),a(Y)},onAudioSegmentTimingInfo:Y=>{const W={pts:{start:Y.start.pts,end:Y.end.pts},dts:{start:Y.start.dts,end:Y.end.dts}};M({type:"segmenttransmuxingtiminginfoavailable",segment:n,timingInfo:W}),l(Y)},onId3:(Y,W)=>{u(n,Y,W)},onCaptions:Y=>{h(n,[Y])},isEndOfTimeline:f,onEndedTimeline:()=>{g()},onTransmuxerLog:C,onDone:(Y,W)=>{S&&(Y.type=Y.type==="combined"?"video":Y.type,M({type:"segmenttransmuxingcomplete",segment:n}),S(W,n,Y))},segment:n,triggerSegmentEventFn:M});hu({action:"probeTs",transmuxer:n.transmuxer,data:e,baseStartTime:n.baseStartTime,callback:Y=>{n.bytes=e=Y.data;const W=Y.result;W&&(t(n,{hasAudio:W.hasAudio,hasVideo:W.hasVideo,isMuxed:E}),t=null),se()}})},tk=({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:M})=>{let L=new Uint8Array(e);if(D4(L)){n.isFmp4=!0;const{tracks:E}=n.map;if(E.text&&(!E.audio||!E.video)){_(n,{data:L,type:"text"}),aR(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 Q=(H,se)=>{_(n,{data:L,type:G.hasAudio&&!G.isMuxed?"audio":"video"}),se&&se.length&&u(n,se),H&&H.length&&h(n,H),S(null,n,{})};hu({action:"probeMp4StartTime",timescales:n.map.timescales,data:L,transmuxer:n.transmuxer,callback:({data:H,startTime:se})=>{e=H.buffer,n.bytes=L=H,G.hasAudio&&!G.isMuxed&&i(n,"audio","start",se),G.hasVideo&&i(n,"video","start",se),hu({action:"probeEmsgID3",data:L,transmuxer:n.transmuxer,offset:se,callback:({emsgData:Y,id3Frames:W})=>{if(e=Y.buffer,n.bytes=L=Y,!E.video||!Y.byteLength||!n.transmuxer){Q(void 0,W);return}hu({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:n.transmuxer,data:L,timescales:n.map.timescales,trackIds:[E.video.id],callback:O=>{e=O.data.buffer,n.bytes=L=O.data,O.logs.forEach(function(ae){C(ii(ae,{stream:"mp4CaptionParser"}))}),Q(O.captions,W)}})}})}});return}if(!n.transmuxer){S(null,n,{});return}if(typeof n.container>"u"&&(n.container=Sy(L)),n.container!=="ts"&&n.container!=="aac"){t(n,{hasAudio:!1,hasVideo:!1}),S(null,n,{});return}uR({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:M})},nk=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(US({source:n,encrypted:t,key:f,iv:e.iv}),[t.buffer,f.buffer])},cR=({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:M})=>{M({type:"segmentdecryptionstart"}),nk({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:n,segment:e,doneFn:S},L=>{e.bytes=L,M({type:"segmentdecryptioncomplete",segment:e}),tk({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:M})})},dR=({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:M})=>{let L=0,E=!1;return(B,G)=>{if(!E){if(B)return E=!0,ry(n),S(B,G);if(L+=1,L===n.length){const Q=function(){if(G.encryptedBytes)return cR({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:M});tk({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:M})};if(G.endOfAllRequests=Date.now(),G.map&&G.map.encryptedBytes&&!G.map.bytes)return M({type:"segmentdecryptionstart",segment:G}),nk({decryptionWorker:e,id:G.requestId+"-init",encryptedBytes:G.map.encryptedBytes,key:G.map.key,segment:G,doneFn:S},H=>{G.map.bytes=H,M({type:"segmentdecryptioncomplete",segment:G}),ek(G,se=>{if(se)return ry(n),S(se,G);Q()})});Q()}}}},hR=({loadendState:n,abortFn:e})=>t=>{t.target.aborted&&e&&!n.calledAbortFn&&(e(),n.calledAbortFn=!0)},fR=({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=ii(n.stats,rR(S)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),e(S,n)},mR=({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:M,dataFn:L,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G})=>{const Q=[],H=dR({activeXhrs:Q,decryptionWorker:t,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:M,dataFn:L,doneFn:E,onTransmuxerLog:B,triggerSegmentEventFn:G});if(i.key&&!i.key.bytes){const ae=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&ae.push(i.map.key);const k=ii(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),j=d_(i,ae,H,G),Z={uri:i.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:Z});const V=n(k,j);Q.push(V)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const V=ii(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),te=d_(i,[i.map.key],H,G),me={uri:i.map.key.resolvedUri};G({type:"segmentkeyloadstart",segment:i,keyInfo:me});const le=n(V,te);Q.push(le)}const k=ii(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:ny(i.map),requestType:"segment-media-initialization"}),j=oR({segment:i,finishProcessingFn:H,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const Z=n(k,j);Q.push(Z)}const se=ii(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:ny(i),requestType:"segment"}),Y=lR({segment:i,finishProcessingFn:H,responseType:se.responseType,triggerSegmentEventFn:G});G({type:"segmentloadstart",segment:i});const W=n(se,Y);W.addEventListener("progress",fR({segment:i,progressFn:l,trackInfoFn:u,timingInfoFn:h,videoSegmentTimingInfoFn:f,audioSegmentTimingInfoFn:g,id3Fn:_,captionsFn:S,isEndOfTimeline:C,endedTimelineFn:M,dataFn:L})),Q.push(W);const O={};return Q.forEach(ae=>{ae.addEventListener("loadend",hR({loadendState:O,abortFn:a}))}),()=>ry(Q)},Qh=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||""})},fu=function(n,e){if(!n)return"";const t=ce.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})},nb=function(n,e){let t,i;return n.attributes.BANDWIDTH&&(t=n.attributes.BANDWIDTH),t=t||ce.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||ce.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||ce.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||ce.Number.MAX_VALUE,t===i&&n.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?n.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let ik=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;qr.isAudioOnly(e)&&(g=h.getAudioTrackPlaylists_(),f.audioOnly=!0);let _=g.map(O=>{let ae;const k=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,j=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return ae=O.attributes&&O.attributes.BANDWIDTH,ae=ae||ce.Number.MAX_VALUE,{bandwidth:ae,width:k,height:j,playlist:O}});mu(_,(O,ae)=>O.bandwidth-ae.bandwidth),_=_.filter(O=>!qr.isIncompatible(O.playlist));let S=_.filter(O=>qr.isEnabled(O.playlist));S.length||(S=_.filter(O=>!qr.isDisabled(O.playlist)));const C=S.filter(O=>O.bandwidth*ur.BANDWIDTH_VARIANCE<t);let M=C[C.length-1];const L=C.filter(O=>O.bandwidth===M.bandwidth)[0];if(u===!1){const O=L||S[0]||_[0];if(O&&O.playlist){let ae="sortedPlaylistReps";return L&&(ae="bandwidthBestRep"),S[0]&&(ae="enabledPlaylistReps"),Qh(`choosing ${h_(O)} using ${ae} with options`,f),O.playlist}return Qh("could not choose a playlist with options",f),null}const E=C.filter(O=>O.width&&O.height);mu(E,(O,ae)=>O.width-ae.width);const B=E.filter(O=>O.width===i&&O.height===a);M=B[B.length-1];const G=B.filter(O=>O.bandwidth===M.bandwidth)[0];let Q,H,se;G||(Q=E.filter(O=>l==="cover"?O.width>i&&O.height>a:O.width>i||O.height>a),H=Q.filter(O=>O.width===Q[0].width&&O.height===Q[0].height),M=H[H.length-1],se=H.filter(O=>O.bandwidth===M.bandwidth)[0]);let Y;if(h.leastPixelDiffSelector){const O=E.map(ae=>(ae.pixelDiff=Math.abs(ae.width-i)+Math.abs(ae.height-a),ae));mu(O,(ae,k)=>ae.pixelDiff===k.pixelDiff?k.bandwidth-ae.bandwidth:ae.pixelDiff-k.pixelDiff),Y=O[0]}const W=Y||se||G||L||S[0]||_[0];if(W&&W.playlist){let O="sortedPlaylistReps";return Y?O="leastPixelDiffRep":se?O="resolutionPlusOneRep":G?O="resolutionBestRep":L?O="bandwidthBestRep":S[0]&&(O="enabledPlaylistReps"),Qh(`choosing ${h_(W)} using ${O} with options`,f),W.playlist}return Qh("could not choose a playlist with options",f),null};const f_=function(){let n=this.useDevicePixelRatio&&ce.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),ik({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(fu(this.tech_.el(),"width"),10)*n,playerHeight:parseInt(fu(this.tech_.el(),"height"),10)*n,playerObjectFit:this.usePlayerObjectFit?fu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},gR=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&&ce.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),ik({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(fu(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(fu(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?fu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},yR=function(n){const{main:e,currentTime:t,bandwidth:i,duration:a,segmentDuration:l,timeUntilRebuffer:u,currentTimeline:h,syncController:f}=n,g=e.playlists.filter(L=>!qr.isIncompatible(L));let _=g.filter(qr.isEnabled);_.length||(_=g.filter(L=>!qr.isDisabled(L)));const C=_.filter(qr.hasAttribute.bind(null,"BANDWIDTH")).map(L=>{const B=f.getSyncPoint(L,a,h,t)?1:2,Q=qr.estimateSegmentRequestTime(l,i,L)*B-u;return{playlist:L,rebufferingImpact:Q}}),M=C.filter(L=>L.rebufferingImpact<=0);return mu(M,(L,E)=>nb(E.playlist,L.playlist)),M.length?M[0]:(mu(C,(L,E)=>L.rebufferingImpact-E.rebufferingImpact),C[0]||null)},bR=function(){const n=this.playlists.main.playlists.filter(qr.isEnabled);return mu(n,(t,i)=>nb(t,i)),n.filter(t=>!!ad(this.playlists.main,t).video)[0]||null},vR=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 rk(n){try{return new URL(n).pathname.split("/").slice(-2).join("/")}catch{return""}}const xR=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}}},_R=function({inbandTextTracks:n,captionArray:e,timestampOffset:t}){if(!e)return;const i=ce.WebKitDataCue||ce.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))})},wR=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}}})},TR=({inbandTextTracks:n,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const a=ce.WebKitDataCue||ce.VTTCue,l=n.metadataTrack_;if(!l||(e.forEach(_=>{const S=_.cueTime+t;typeof S!="number"||ce.isNaN(S)||S<0||!(S<1/0)||!_.frames||!_.frames.length||_.frames.forEach(C=>{const M=new a(S,S,C.value||C.url||C.data||"");M.frame=C,M.value=C,wR(M),l.addCue(M)})}),!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[_],M=isFinite(i)?i:_,L=Number(g[S+1])||M;C.forEach(E=>{E.endTime=L})})},SR={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"},kR=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),ER=({inbandTextTracks:n,dateRanges:e})=>{const t=n.metadataTrack_;if(!t)return;const i=ce.WebKitDataCue||ce.VTTCue;e.forEach(a=>{for(const l of Object.keys(a)){if(kR.has(l))continue;const u=new i(a.startTime,a.endTime,"");u.id=a.id,u.type="com.apple.quicktime.HLS",u.value={key:SR[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()})},m_=(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))},Wc=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)},CR=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}},AR=(n,e,t)=>{if(typeof e>"u"||e===null||!n.length)return[];const i=Math.ceil((e-t+3)*ll.ONE_SECOND_IN_TS);let a;for(a=0;a<n.length&&!(n[a].pts>i);a++);return n.slice(a)},NR=(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)},DR=(n,e,t,i)=>{const a=Math.ceil((e-i)*ll.ONE_SECOND_IN_TS),l=Math.ceil((t-i)*ll.ONE_SECOND_IN_TS),u=n.slice();let h=n.length;for(;h--&&!(n[h].pts<=l););if(h===-1)return u;let f=h+1;for(;f--&&!(n[f].pts<=a););return f=Math.max(f,0),u.splice(f,h-f+1),u},MR=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},jR=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]},Fc=1,RR=500,p_=n=>typeof n=="number"&&isFinite(n),Zh=1/60,OR=(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,LR=(n,e,t)=>{let i=e-ur.BACK_BUFFER_LENGTH;n.length&&(i=Math.max(i,n.start(0)));const a=e-t;return Math.min(a,i)},Ql=n=>{const{startOfSegment:e,duration:t,segment:i,part:a,playlist:{mediaSequence:l,id:u,segments:h=[]},mediaIndex:f,partIndex:g,timeline:_}=n,S=h.length-1;let C="mediaIndex/partIndex increment";n.getMediaInfoForTime?C=`getMediaInfoForTime (${n.getMediaInfoForTime})`:n.isSyncRequest&&(C="getSyncSegmentCandidate (isSyncRequest)"),n.independent&&(C+=` with independent ${n.independent}`);const M=typeof g=="number",L=n.segment.uri?"segment":"pre-segment",E=M?wS({preloadSegment:i})-1:0;return`${L} [${l+f}/${l+S}]`+(M?` part [${g}/${E}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(M?` part start/end [${a.start} => ${a.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${_}] selected by [${C}] playlist [${u}]`},g_=n=>`${n}TimingInfo`,IR=({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,sy=({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},BR=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)},PR=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(sy({timelineChangeController:n.timelineChangeController_,currentTimeline:n.currentTimeline_,segmentTimeline:e.timeline,loaderType:n.loaderType_,audioDisabled:n.audioDisabled_})&&BR(n.timelineChangeController_)){if(PR(n)){n.timelineChangeController_.trigger("audioTimelineBehind");return}n.timelineChangeController_.trigger("fixBadTimelineChange")}},FR=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=ce.BigInt(l)-ce.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,UR=(n,e)=>{if(e!=="hls")return null;const t=FR({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 ay 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(Qi({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(Qi({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 mg.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&ce.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,ce.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&mg.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return dr();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=zS(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_&&(ce.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&mg.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},a=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let l=1;const u=()=>{l--,l===0&&i()};(a||!this.audioDisabled_)&&(l++,this.sourceUpdater_.removeAudio(e,t,u)),(a||this.loaderType_==="main")&&(this.gopBuffer_=DR(this.gopBuffer_,e,t,this.timeMapping_),l++,this.sourceUpdater_.removeVideo(e,t,u));for(const h in this.inbandTextTracks_)Wc(e,t,this.inbandTextTracks_[h]);Wc(e,t,this.segmentMetadataTrack_),u()}monitorBuffer_(){this.checkBufferTimeout_&&ce.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ce.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&ce.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=ce.setTimeout(this.monitorBufferTick_.bind(this),RR)}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=Qy(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=jR(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],M=typeof this.partIndex=="number"?this.partIndex:-1;h.startOfSegment=C.end?C.end:t,C.parts&&C.parts[M+1]?(h.mediaIndex=this.mediaIndex,h.partIndex=M+1):h.mediaIndex=this.mediaIndex+1}else{let C,M,L;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,M=B.partIndex,L=B.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const B=qr.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:E,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});C=B.segmentIndex,M=B.partIndex,L=B.startTime}h.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${E}`:`currentTime ${E}`,h.mediaIndex=C,h.startOfSegment=L,h.partIndex=M,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],M=C.parts&&C.parts.length&&C.parts[C.parts.length-1];M&&M.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},M=typeof f<"u"?f:this.isPendingTimestampOffset_;C.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:_.timeline,currentTimeline:this.currentTimeline_,startOfSegment:l,buffered:this.buffered_(),overrideCheck:M});const L=hg(this.sourceUpdater_.audioBuffered());return typeof L=="number"&&(C.audioAppendStart=L-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(C.gopsToAlignWith=AR(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),C}timestampOffsetForSegment_(e){return IR(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=qr.estimateSegmentRequestTime(a,i,this.playlist_,e.bytesReceived),u=rj(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(l<=u)return;const h=yR({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*ur.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Ql(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:a}=t,l={segmentInfo:al({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:a}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:l}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},MR(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}`),xR(_,this.vhs_.tech_,u),Wc(h,f,_[u]),_R({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_()?!sy({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||sy({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: "+ul(l).join(", ")),u.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ul(u).join(", "));const h=l.length?l.start(0):0,f=l.length?l.end(l.length-1):0,g=u.length?u.start(0):0,_=u.length?u.end(u.length-1):0;if(f-h<=Fc&&_-g<=Fc){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${ul(l).join(", ")}, video buffer: ${ul(u).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const C=this.currentTime_()-Fc;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 ${Fc}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=ce.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Fc*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},a){if(a){if(a.code===RS){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=vR({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=Qi({},e,{forceTimestampOffset:!0});Qi(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
|
||
${rk(e.uri)}
|
||
${Ql(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=mR({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:u,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:h,level:f,stream:g})=>{this.logger_(`${Ql(e)} logged from transmuxer stream ${g} as a ${f}: ${h}`)},triggerSegmentEventFn:({type:h,segment:f,keyInfo:g,trackInfo:_,timingInfo:S})=>{const M={segmentInfo:al({segment:f})};g&&(M.keyInfo=g),_&&(M.trackInfo=_),S&&(M.timingInfo=S),this.trigger({type:h,metadata:M})}})}trimBackBuffer_(e){const t=LR(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<Zh){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Zh}`);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_=NR(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=OR(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=UR(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 ${Ql(e)}`);return}this.logger_(`Appended ${Ql(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,a=e.part,l=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,u=a&&a.end&&this.currentTime_()-a.end>e.playlist.partTargetDuration*3;if(l||u){this.logger_(`bad ${l?"segment":"part"} ${Ql(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<Zh){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Zh}`);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(!p_(i)||!p_(a))return;Wc(i,a,this.segmentMetadataTrack_);const l=ce.WebKitDataCue||ce.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 sk=function(n){return typeof n!="string"?n:n.replace(/./,e=>e.toUpperCase())},zR=["video","audio"],oy=(n,e)=>{const t=e[`${n}Buffer`];return t&&t.updating||e.queuePending[n]},HR=(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},pu=(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(),pu("audio",e),pu("video",e));return}if(n!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||oy(n,e))){if(i.type!==n){if(t=HR(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,pu(n,e);return}}},ak=(n,e)=>{const t=e[`${n}Buffer`],i=sk(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===RS?"(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=sk(n),a=xu(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(ak(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=xu(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}),pu(n,e)},b_=(n,e)=>t=>{const i=e[`${n}Buffered`](),a=tj(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_`])}pu(n,e)};class ok extends Be.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>pu("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&&ce.MediaSource&&ce.MediaSource.prototype&&typeof ce.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return ce.SourceBuffer&&ce.SourceBuffer.prototype&&typeof ce.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:dr()}videoBuffered(){return Xs(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:dr()}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():ij(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!!(oy("audio",this)||oy("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"),zR.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>ak(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 qR extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class VR extends ay{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 dr();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return dr([[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){Wc(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 ce.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 ce.VTTCue(h.startTime,h.endTime,h.text):h)}),CR(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 ce.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 ce.WebVTT!="function")throw new qR;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof ce.TextDecoder=="function"?t=new ce.TextDecoder("utf8"):(t=ce.WebVTT.StringDecoder(),i=!0);const a=new ce.WebVTT.Parser(ce,ce.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/ll.ONE_SECOND_IN_TS-u+t.mapping;if(e.cues.forEach(g=>{const _=g.endTime-g.startTime,S=this.handleRollover_(g.startTime+f,t.time);g.startTime=Math.max(S,0),g.endTime=Math.max(S+_,0)}),!i.syncInfo){const g=e.cues[0].startTime,_=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(g,_-a.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*ll.ONE_SECOND_IN_TS;const a=t*ll.ONE_SECOND_IN_TS;let l;for(a<i?l=-8589934592:l=8589934592;Math.abs(i-a)>4294967296;)i+=l;return i/ll.ONE_SECOND_IN_TS}}const GR=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},KR=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=GR(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 ce.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 ce.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 WR{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 lk{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,M=!!(_&&_.segmentSyncInfo&&_.segmentSyncInfo.isAppended),L=new __({start:S,end:C,appended:M,segmentIndex:g});f.syncInfo=L;let E=u;const B=(f.parts||[]).map((G,Q)=>{const H=E,se=E+G.duration,Y=!!(_&&_.partsSyncInfo&&_.partsSyncInfo[Q]&&_.partsSyncInfo[Q].isAppended),W=new __({start:H,end:se,appended:Y,segmentIndex:g,partIndex:Q});return E=se,l+=`Media Sequence: ${h}.${Q} | Range: ${H} --> ${se} | Appended: ${Y}
|
||
`,G.syncInfo=W,W});a.set(h,new WR(L,B)),l+=`${rk(f.resolvedUri)} | Media Sequence: ${h} | Range: ${S} --> ${C} | Appended: ${M}
|
||
`,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 lk{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 XR=86400,pg=[{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=Qg(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 L=S.dateTimeObject.getTime()/1e3+C;if(S.parts&&typeof _.partIndex=="number")for(let B=0;B<_.partIndex;B++)L+=S.parts[B].duration;const E=Math.abs(a-L);if(u!==null&&(E===0||u<E))break;u=E,l={time:L,segmentIndex:_.segmentIndex,partIndex:_.partIndex}}return l}},{name:"Segment",run:(n,e,t,i,a)=>{let l=null,u=null;a=a||0;const h=Qg(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 M=Math.abs(a-C);if(u!==null&&u<M)break;(!l||u===null||u>=M)&&(u=M,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 YR extends Be.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new lk,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 pg.find(({name:f})=>f==="VOD").run(this,e,t);const u=this.runStrategies_(e,t,i,a,l);if(!u.length)return null;for(const h of u){const{syncPoint:f,strategy:g}=h,{segmentIndex:_,time:S}=f;if(_<0)continue;const C=e.segments[_],M=S,L=M+C.duration;if(this.logger_(`Strategy: ${g}. Current time: ${a}. selected segment: ${_}. Time: [${M} -> ${L}]}`),a>=M&&a<L)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+sd({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:a.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,a,l){const u=[];for(let h=0;h<pg.length;h++){const f=pg[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>XR){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-sd({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:l}):g=i.end+sd({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 QR 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 ZR=KS(WS(function(){var n=(function(){function E(){this.listeners={}}var B=E.prototype;return B.on=function(Q,H){this.listeners[Q]||(this.listeners[Q]=[]),this.listeners[Q].push(H)},B.off=function(Q,H){if(!this.listeners[Q])return!1;var se=this.listeners[Q].indexOf(H);return this.listeners[Q]=this.listeners[Q].slice(0),this.listeners[Q].splice(se,1),se>-1},B.trigger=function(Q){var H=this.listeners[Q];if(H)if(arguments.length===2)for(var se=H.length,Y=0;Y<se;++Y)H[Y].call(this,arguments[1]);else for(var W=Array.prototype.slice.call(arguments,1),O=H.length,ae=0;ae<O;++ae)H[ae].apply(this,W)},B.dispose=function(){this.listeners={}},B.pipe=function(Q){this.on("data",function(H){Q.push(H)})},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],Q=B[4],H=G[4];let se,Y,W;const O=[],ae=[];let k,j,Z,V,te,me;for(se=0;se<256;se++)ae[(O[se]=se<<1^(se>>7)*283)^se]=se;for(Y=W=0;!Q[Y];Y^=k||1,W=ae[W]||1)for(V=W^W<<1^W<<2^W<<3^W<<4,V=V>>8^V&255^99,Q[Y]=V,H[V]=Y,Z=O[j=O[k=O[Y]]],me=Z*16843009^j*65537^k*257^Y*16843008,te=O[V]*257^V*16843008,se=0;se<4;se++)B[se][Y]=te=te<<24^te>>>8,G[se][V]=me=me<<24^me>>>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,Q,H;const se=this._tables[0][4],Y=this._tables[1],W=B.length;let O=1;if(W!==4&&W!==6&&W!==8)throw new Error("Invalid aes key size");const ae=B.slice(0),k=[];for(this._key=[ae,k],G=W;G<4*W+28;G++)H=ae[G-1],(G%W===0||W===8&&G%W===4)&&(H=se[H>>>24]<<24^se[H>>16&255]<<16^se[H>>8&255]<<8^se[H&255],G%W===0&&(H=H<<8^H>>>24^O<<24,O=O<<1^(O>>7)*283)),ae[G]=ae[G-W]^H;for(Q=0;G;Q++,G--)H=ae[Q&3?G:G-4],G<=4||Q<4?k[Q]=H:k[Q]=Y[0][se[H>>>24]]^Y[1][se[H>>16&255]]^Y[2][se[H>>8&255]]^Y[3][se[H&255]]}decrypt(B,G,Q,H,se,Y){const W=this._key[1];let O=B^W[0],ae=H^W[1],k=Q^W[2],j=G^W[3],Z,V,te;const me=W.length/4-2;let le,q=4;const F=this._tables[1],ee=F[0],ie=F[1],de=F[2],I=F[3],pe=F[4];for(le=0;le<me;le++)Z=ee[O>>>24]^ie[ae>>16&255]^de[k>>8&255]^I[j&255]^W[q],V=ee[ae>>>24]^ie[k>>16&255]^de[j>>8&255]^I[O&255]^W[q+1],te=ee[k>>>24]^ie[j>>16&255]^de[O>>8&255]^I[ae&255]^W[q+2],j=ee[j>>>24]^ie[O>>16&255]^de[ae>>8&255]^I[k&255]^W[q+3],q+=4,O=Z,ae=V,k=te;for(le=0;le<4;le++)se[(3&-le)+Y]=pe[O>>>24]<<24^pe[ae>>16&255]<<16^pe[k>>8&255]<<8^pe[j&255]^W[q++],Z=O,O=ae,ae=k,k=j,j=Z}}class l extends n{constructor(){super(n),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(B){this.jobs.push(B),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const u=function(E){return E<<24|(E&65280)<<8|(E&16711680)>>8|E>>>24},h=function(E,B,G){const Q=new Int32Array(E.buffer,E.byteOffset,E.byteLength>>2),H=new a(Array.prototype.slice.call(B)),se=new Uint8Array(E.byteLength),Y=new Int32Array(se.buffer);let W,O,ae,k,j,Z,V,te,me;for(W=G[0],O=G[1],ae=G[2],k=G[3],me=0;me<Q.length;me+=4)j=u(Q[me]),Z=u(Q[me+1]),V=u(Q[me+2]),te=u(Q[me+3]),H.decrypt(j,Z,V,te,Y,me),Y[me]=u(Y[me]^W),Y[me+1]=u(Y[me+1]^O),Y[me+2]=u(Y[me+2]^ae),Y[me+3]=u(Y[me+3]^k),W=j,O=Z,ae=V,k=te;return se};class f{constructor(B,G,Q,H){const se=f.STEP,Y=new Int32Array(B.buffer),W=new Uint8Array(B.byteLength);let O=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(Y.subarray(O,O+se),G,Q,W)),O=se;O<Y.length;O+=se)Q=new Uint32Array([u(Y[O-4]),u(Y[O-3]),u(Y[O-2]),u(Y[O-1])]),this.asyncStream_.push(this.decryptChunk_(Y.subarray(O,O+se),G,Q,W));this.asyncStream_.push(function(){H(null,e(W))})}static get STEP(){return 32e3}decryptChunk_(B,G,Q,H){return function(){const se=h(B,G,Q);H.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},M=S.BigInt||Number;M("0x1"),M("0x100"),M("0x10000"),M("0x1000000"),M("0x100000000"),M("0x10000000000"),M("0x1000000000000"),M("0x100000000000000"),M("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 L=function(E){const B={};return Object.keys(E).forEach(G=>{const Q=E[G];C(Q)?B[G]={bytes:Q.buffer,byteOffset:Q.byteOffset,byteLength:Q.byteLength}:B[G]=Q}),B};self.onmessage=function(E){const B=E.data,G=new Uint8Array(B.encrypted.bytes,B.encrypted.byteOffset,B.encrypted.byteLength),Q=new Uint32Array(B.key.bytes,B.key.byteOffset,B.key.byteLength/4),H=new Uint32Array(B.iv.bytes,B.iv.byteOffset,B.iv.byteLength/4);new f(G,Q,H,function(se,Y){self.postMessage(L({source:B.source,decrypted:Y}),[Y.buffer])})}}));var JR=GS(ZR);const e8=n=>{let e=n.default?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},uk=(n,e)=>{n.abort(),n.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},ly=(n,e)=>{e.activePlaylistLoader=n,n.load()},t8=(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,uk(t,a),!(!u||u.isMainPlaylist))){if(!u.playlistLoader){h&&i.resetEverything();return}t.resyncLoader(),ly(u.playlistLoader,a)}},n8=(n,e)=>()=>{const{segmentLoaders:{[n]:t},mediaTypes:{[n]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},i8=(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,uk(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){ly(h.playlistLoader,l);return}i.track&&i.track(u),i.resetEverything(),ly(h.playlistLoader,l)}},$f={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",$f[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",$f[n](n,t))}},r8={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=kd(_.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 M in u[n][C]){let L=u[n][C][M],E;if(S?(g(`AUDIO group '${C}' label '${M}' is a main playlist`),L.isMainPlaylist=!0,E=null):i==="vhs-json"&&L.playlists?E=new ru(L.playlists[0],t,l):L.resolvedUri?E=new ru(L.resolvedUri,t,l):L.playlists&&i==="dash"?E=new iy(L.playlists[0],t,l,_):E=null,L=ii({id:M,playlistLoader:E},L),T_[n](n,L.playlistLoader,e),h[C].push(L),typeof f[M]>"u"){const B=new Be.AudioTrack({id:M,kind:e8(L),enabled:!1,language:L.language,default:L.default,label:M});f[M]=B}}}a.on("error",$f[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 M=h[n][S][C],L;if(a==="hls")L=new ru(M.resolvedUri,i,u);else if(a==="dash"){if(!M.playlists.filter(B=>B.excludeUntil!==1/0).length)return;L=new iy(M.playlists[0],i,u,_)}else a==="vhs-json"&&(L=new ru(M.playlists?M.playlists[0]:M.resolvedUri,i,u));if(M=ii({id:C,playlistLoader:L},M),T_[n](n,M.playlistLoader,e),f[S].push(M),typeof g[C]>"u"){const E=t.addRemoteTextTrack({id:C,kind:"subtitles",default:M.default&&M.autoselect,language:M.language,label:C},!1).track;g[C]=E}}}l.on("error",$f[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]&&(_=ii(_,g[_.instreamId])),_.default===void 0&&delete _.default,a[u].push(ii({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}}}}},ck=(n,e)=>{for(let t=0;t<n.length;t++)if(eb(e,n[t])||n[t].playlists&&ck(n[t].playlists,e))return!0;return!1},s8=(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&&kd(e.main))for(let f=0;f<h.length;f++){const g=a[h[f]];if(ck(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},a8={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}},o8=(n,{mediaTypes:e})=>()=>{const t=e[n].activeTrack();return t?e[n].activeGroup(t):null},l8=n=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(g=>{r8[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=s8(g,n),e[g].activeTrack=a8[g](g,n),e[g].onGroupChanged=t8(g,n),e[g].onGroupChanging=n8(g,n),e[g].onTrackChanged=i8(g,n),e[g].getActiveGroup=o8(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])},u8=()=>{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_=Hr(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 c8 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=Hr(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 ce.URL(e),i=new ce.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(ce.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new ce.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_=ce.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){ce.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&&(Hr(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const d8=(n,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{n.apply(null,i)},e)}},h8=10;let yo;const f8=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],m8=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 _=!!iu(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=Qy(e,t),C=h?ur.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:ur.MAX_BUFFER_LOW_WATER_LINE;if(u<C)return f(`${g} as duration < max low water line (${u} < ${C})`),!0;const M=i.attributes.BANDWIDTH,L=n.attributes.BANDWIDTH;if(M<L&&(!h||S<l)){let E=`${g} as next bandwidth < current bandwidth (${M} < ${L})`;return h&&(E+=` and forwardBuffer < bufferHighWaterLine (${S} < ${l})`),f(E),!0}if((!h||M>L)&&S>=a){let E=`${g} as forwardBuffer >= bufferLowWaterLine (${S} >= ${a})`;return h&&(E+=` and next bandwidth > current bandwidth (${M} > ${L})`),f(E),!0}return f(`not ${g} as no switching criteria met`),!1};class g8 extends Be.EventTarget{constructor(e){super(),this.fastQualityChange_=d8(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:M,captionServices:L,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=!!M,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_=u8(),E&&ce.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new ce.ManagedMediaSource,this.usingManagedMediaSource_=!0,Be.log("Using ManagedMediaSource")):ce.MediaSource&&(this.mediaSource=new ce.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_=dr(),this.hasPlayed_=!1,this.syncController_=new YR(e),this.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new JR,this.sourceUpdater_=new ok(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new QR,this.keyStatusMap_=new Map;const G={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:L,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 iy(t,this.vhs_,ii(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ru(t,this.vhs_,ii(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new ay(ii(G,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new ay(ii(G,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new VR(ii(G,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((se,Y)=>{function W(){a.off("vttjserror",O),se()}function O(){a.off("vttjsloaded",W),Y()}a.one("vttjsloaded",W),a.one("vttjserror",O),a.addWebVttScript_()})}),e);const Q=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new c8(this.vhs_.xhr,Q),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),f8.forEach(se=>{this[se+"_"]=m8.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 H=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(H,()=>{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_=ce.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(ce.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;Zg(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()),l8({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;Zg(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(Qi({},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:h8}))});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(Qi({},a))}),this.audioSegmentLoader_.on(i,a=>{this.player_.trigger(Qi({},a))}),this.subtitleSegmentLoader_.on(i,a=>{this.player_.trigger(Qi({},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(Sm),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 L=this.pathwayAttribute_(e),E=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(L),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(L)},E);return}let M=!1;a.forEach(L=>{if(L===e)return;const E=L.excludeUntil;typeof E<"u"&&E!==1/0&&(M=!0,delete L.excludeUntil)}),M&&(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=iu(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 dr([[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:dr([[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 [${xS(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=ad(this.main(),t),a={},l=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(a.video=i.video||e.main.videoCodec||rD),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?td(_,this.usingManagedMediaSource_):X0(_),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=ad(this.main,a),u=[];l.audio&&!X0(l.audio)&&!td(l.audio,this.usingManagedMediaSource_)&&u.push(`audio codec ${l.audio}`),l.video&&!X0(l.video)&&!td(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=pd(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=ad(this.mainPlaylistLoader_.main,g),C=a_(S);if(!(!S.audio&&!S.video)){if(C!==l&&_.push(`codec count "${C}" !== "${l}"`),!this.sourceUpdater_.canChangeType()){const M=S.video&&Ws(S.video)[0]||null,L=S.audio&&Ws(S.audio)[0]||null;M&&u&&M.type.toLowerCase()!==u.type.toLowerCase()&&_.push(`video codec "${M.type}" !== "${u.type}"`),L&&h&&L.type.toLowerCase()!==h.type.toLowerCase()&&_.push(`audio codec "${L.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)),KR(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=ur.GOAL_BUFFER_LENGTH,i=ur.GOAL_BUFFER_LENGTH_RATE,a=Math.max(t,ur.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,a)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=ur.BUFFER_LOW_WATER_LINE,i=ur.BUFFER_LOW_WATER_LINE_RATE,a=Math.max(t,ur.MAX_BUFFER_LOW_WATER_LINE),l=Math.max(t,ur.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?l:a)}bufferHighWaterLine(){return ur.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){m_(this.inbandTextTracks_,"com.apple.streaming",this.tech_),ER({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const a=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();m_(this.inbandTextTracks_,e,this.tech_),TR({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(Qi({},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 y8=(n,e,t)=>i=>{const a=n.main.playlists[e],l=Jy(a),u=Sm(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 b8{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=ad(a.main(),t),this.playlist=t,this.id=i,this.enabled=y8(e.playlists,t.id,l)}}const v8=function(n){n.representations=()=>{const e=n.playlistController_.main(),t=kd(e)?n.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!Jy(i)).map((i,a)=>new b8(n,i,i.id)):[]}},k_=["seeking","seeked","pause","playing","error"];class x8 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_&&ce.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&ce.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=ce.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=sj(this[`${e}Buffered_`],a);if(this[`${e}Buffered_`]=a,l){const u={bufferedRanges:a};t.trigger({type:"bufferedrangeschanged",metadata:u}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:ul(a)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+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(dr([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 L=t.start(0);l=L+(L===t.end(0)?0:Zs)}if(typeof l<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${xS(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 L=0;L<C.length;L++){if(!C[L])continue;if(Qy(C[L],i)<S)return!1}const M=Yh(h,i);return M.length===0?!1:(l=M.start(0)+Zs,this.logger_(`Buffered region starts (${M.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=iu(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=Yh(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=iu(e,i-3),u=iu(e,i),h=iu(t,i);h.length&&!u.length&&l.length&&(a={start:l.end(0),end:h.end(0)})}else Yh(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=Yh(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=nj(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 _8={errorInterval:30,getSource(n){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return n(t)}},dk=function(n,e){let t=0,i=0;const a=ii(_8,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(),dk(n,_)};n.on("error",h),n.on("dispose",f),n.reloadSourceOnError=g},w8=function(n){dk(this,n)};var hk="3.17.2",T8="7.1.0",S8="1.3.1",k8="7.2.0",E8="4.0.2";const Li={PlaylistLoader:ru,Playlist:qr,utils:Mj,STANDARD_PLAYLIST_SELECTOR:f_,INITIAL_PLAYLIST_SELECTOR:bR,lastBandwidthSelector:f_,movingAverageBandwidthSelector:gR,comparePlaylistBandwidth:nb,comparePlaylistResolution:pR,xhr:FS()};Object.keys(ur).forEach(n=>{Object.defineProperty(Li,n,{get(){return Be.log.warn(`using Vhs.${n} is UNSAFE be sure you know what you are doing`),ur[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}ur[n]=e}})});const fk="videojs-vhs",mk=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"})},C8=function(n,e){e.representations().forEach(t=>{n.addQualityLevel(t)}),mk(n,e.playlists)};Li.canPlaySource=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const A8=(n,e,t)=>{if(!n)return n;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=pd(Ws(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const a=xu(i.video),l=xu(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 ii(n,u)},N8=(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},[]),D8=({player:n,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!n.eme.initializeMediaKeys)return Promise.resolve();const a=t?i.concat([t]):i,l=N8(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)])},M8=({player:n,sourceKeySystems:e,media:t,audioMedia:i})=>{const a=A8(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(!ce.localStorage)return null;const n=ce.localStorage.getItem(fk);if(!n)return null;try{return JSON.parse(n)}catch{return null}},j8=n=>{if(!ce.localStorage)return!1;let e=pk();e=e?ii(e,n):n;try{ce.localStorage.setItem(fk,JSON.stringify(e))}catch{return!1}return e},R8=n=>n.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(n.substring(n.indexOf(",")+1)):n,gk=(n,e)=>{n._requestCallbackSet||(n._requestCallbackSet=new Set),n._requestCallbackSet.add(e)},yk=(n,e)=>{n._responseCallbackSet||(n._responseCallbackSet=new Set),n._responseCallbackSet.add(e)},bk=(n,e)=>{n._requestCallbackSet&&(n._requestCallbackSet.delete(e),n._requestCallbackSet.size||delete n._requestCallbackSet)},vk=(n,e)=>{n._responseCallbackSet&&(n._responseCallbackSet.delete(e),n._responseCallbackSet.size||delete n._responseCallbackSet)};Li.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})();Li.supportsNativeDash=(function(){return!_t||!_t.createElement||!Be.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(_t.createElement("video").canPlayType("application/dash+xml"))})();Li.supportsTypeNatively=n=>n==="hls"?Li.supportsNativeHls:n==="dash"?Li.supportsNativeDash:!1;Li.isSupported=function(){return Be.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Li.xhr.onRequest=function(n){gk(Li.xhr,n)};Li.xhr.onResponse=function(n){yk(Li.xhr,n)};Li.xhr.offRequest=function(n){bk(Li.xhr,n)};Li.xhr.offResponse=function(n){vk(Li.xhr,n)};const O8=Be.getComponent("Component");class xk extends O8{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_=ii(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=ur.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===ur.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=R8(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Li,this.options_.sourceType=zw(t),this.options_.seekTo=l=>{this.tech_.setCurrentTime(l)},this.options_.player_=this.player_,this.playlistController_=new g8(this.options_);const i=ii({liveRangeSafeTimeDelta:Zs},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new x8(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?Li.movingAverageBandwidthSelector(.55):Li.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Li.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(l){this.playlistController_.selectPlaylist=l.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(l){this.playlistController_.mainSegmentLoader_.throughput.rate=l,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let l=this.playlistController_.mainSegmentLoader_.bandwidth;const u=ce.navigator.connection||ce.navigator.mozConnection||ce.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:()=>ul(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ul(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&j8({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{v8(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_=ce.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"),D8({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=M8({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",()=>{C8(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{mk(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":hk,"mux.js":T8,"mpd-parser":S8,"m3u8-parser":k8,"aes-decrypter":E8}}version(){return this.constructor.version()}canChangeType(){return ok.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_&&ce.URL.revokeObjectURL&&(ce.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Pj({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,a=2){return qS({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=>{gk(this.xhr,e)},this.xhr.onResponse=e=>{yk(this.xhr,e)},this.xhr.offRequest=e=>{bk(this.xhr,e)},this.xhr.offResponse=e=>{vk(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(Qi({},a))})}),t.forEach(i=>{this.playbackWatcher_.on(i,a=>{this.player_.trigger(Qi({},a))})})}}const qf={name:"videojs-http-streaming",VERSION:hk,canHandleSource(n,e={}){const t=ii(Be.options,e);return!t.vhs.experimentalUseMMS&&!td("avc1.4d400d,mp4a.40.2",!1)?!1:qf.canPlayType(n.type,t)},handleSource(n,e,t={}){const i=ii(Be.options,t);return e.vhs=new xk(n,e,i),e.vhs.xhr=FS(),e.vhs.setupXhrHooks_(),e.vhs.src(n.src,n.type),e.vhs},canPlayType(n,e){const t=zw(n);if(!t)return"";const i=qf.getOverrideNative(e);return!Li.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}},L8=()=>td("avc1.4d400d,mp4a.40.2",!0);L8()&&Be.getTech("Html5").registerSourceHandler(qf,0);Be.VhsHandler=xk;Be.VhsSourceHandler=qf;Be.Vhs=Li;Be.use||Be.registerComponent("Vhs",Li);Be.options.vhs=Be.options.vhs||{};(!Be.getPlugin||!Be.getPlugin("reloadSourceOnError"))&&Be.registerPlugin("reloadSourceOnError",w8);const I8="",rl=n=>{const e=n.startsWith("/")?n:`/${n}`;return`${I8}${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 ib({src:n,muted:e=Tf,className:t}){const i=p.useRef(null),[a,l]=p.useState(!1),[u,h]=p.useState(null);return p.useEffect(()=>{let f=!1,g=null;const _=i.current;if(!_)return;l(!1),h(null),ld(_,{muted:e});const S=()=>{try{_.pause(),_.removeAttribute("src"),_.load()}catch{}};S(),_.src=n,_.load(),_.play().catch(()=>{});let C=Date.now();const M=()=>{C=Date.now()};_.addEventListener("timeupdate",M),g=window.setInterval(()=>{f||!_.paused&&Date.now()-C>12e3&&(S(),_.src=n,_.load(),_.play().catch(()=>{}),C=Date.now())},4e3);const L=()=>{l(!0)};return _.addEventListener("error",L),()=>{f=!0,g&&window.clearInterval(g),g=null,_.removeEventListener("timeupdate",M),_.removeEventListener("error",L),S()}},[n,e]),a?c.jsx("div",{className:"text-xs text-gray-400 italic",children:u==="private"?"Private":u==="offline"?"Offline":"–"}):c.jsx("video",{ref:i,className:t,playsInline:!0,autoPlay:!0,muted:e,preload:"auto",crossOrigin:"anonymous",onClick:()=>{const f=i.current;f&&(f.muted=!1,f.play().catch(()=>{}))}})}const ms=n=>(n||"").replaceAll("\\","/").split("/").pop()||"",rb=n=>n.startsWith("HOT ")?n.slice(4):n,B8=n=>(n||"").trim().toLowerCase(),P8=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 F8(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 U8(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 Jh=(...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 z8(n){if(!n||!Number.isFinite(n))return"—";const e=n>=10?0:2;return`${n.toFixed(e)} fps`}function H8(n){return!n||!Number.isFinite(n)?"—":`${Math.round(n)}p`}function $8(n){const e=ms(n||""),t=rb(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 q8=n=>{const e=ms(n||""),t=rb(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},V8=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 G8(n){const[e,t]=p.useState(!1);return p.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(n),a=()=>t(i.matches);return a(),i.addEventListener?i.addEventListener("change",a):i.addListener(a),()=>{i.removeEventListener?i.removeEventListener("change",a):i.removeListener(a)}},[n]),e}function K8(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 W8({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:M,onToggleLike:L,onToggleWatch:E,onStopJob:B,startMuted:G=qN,startAtSec:Q=0}){const H=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),se=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),Y=p.useMemo(()=>ms(n.output?.trim()||""),[n.output]),W=p.useMemo(()=>U8(V8(n)),[n]),O=n,[ae,k]=p.useState(()=>Number(n?.meta?.durationSeconds)||Number(n?.durationSeconds)||0),[j,Z]=p.useState(()=>n.status==="running"),[V,te]=p.useState(()=>({h:0,fps:null})),me=n.status==="running",[le,q]=p.useState(!1),F=me&&le,ee=p.useMemo(()=>(Y||"").replace(/\.[^.]+$/,""),[Y]),ie=p.useMemo(()=>me?n.id:ee||n.id,[me,n.id,ee]);p.useEffect(()=>{if(me||ae>0)return;const R=ms(n.output?.trim()||"");if(!R)return;let U=!0;const ue=new AbortController;return(async()=>{try{const Se=rl(`/api/record/done/meta?file=${encodeURIComponent(R)}`),Ee=await gg(Se,{signal:ue.signal,cache:"no-store"});if(!Ee.ok)return;const Ve=await Ee.json(),z=Number(Ve?.durationSeconds||Ve?.meta?.durationSeconds||0)||0;if(!U||z<=0)return;k(z);const K=Ze.current;if(K&&!K.isDisposed?.())try{K.__fullDurationSec=z,K.trigger?.("durationchange"),K.trigger?.("timeupdate")}catch{}}catch{}})(),()=>{U=!1,ue.abort()}},[me,ae,n.output]);const de=se.startsWith("HOT "),I=p.useMemo(()=>{const R=(a||"").trim();return R||q8(n.output)},[a,n.output]),pe=p.useMemo(()=>rb(se),[se]),we=p.useMemo(()=>{const R=Number(ae||0)||0;return R>0?F8(R*1e3):"—"},[ae]),ve=p.useMemo(()=>{const R=$8(n.output);if(R)return E_(R);const U=O.startedAt??O.endedAt??O.createdAt??O.fileCreatedAt??O.ctime??null,ue=U?new Date(U):null;return E_(ue&&Number.isFinite(ue.getTime())?ue:null)},[n.output,O.startedAt,O.endedAt,O.createdAt,O.fileCreatedAt,O.ctime]),ge=p.useMemo(()=>B8((a||I||"").trim()),[a,I]),ht=p.useMemo(()=>{const R=l?.[ge];return P8(R?.tags)},[l,ge]),Ge=p.useMemo(()=>rl(`/api/preview?id=${encodeURIComponent(ie)}&file=preview.webp`),[ie]),Te=p.useMemo(()=>rl(`/api/preview/live?id=${encodeURIComponent(ie)}&play=1`),[ie]),[Le,ut]=p.useState(Ge);p.useEffect(()=>{ut(Ge)},[Ge]);const Oe=p.useMemo(()=>Jh(V.h,O.videoHeight,O.height,O.meta?.height),[V.h,O.videoHeight,O.height,O.meta?.height]),_e=p.useMemo(()=>Jh(V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate),[V.fps,O.fps,O.frameRate,O.meta?.fps,O.meta?.frameRate]),[Ke,Je]=p.useState(null),bt=p.useMemo(()=>H8(Ke??Oe),[Ke,Oe]),ft=p.useMemo(()=>z8(_e),[_e]);p.useEffect(()=>{const R=U=>U.key==="Escape"&&t();return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[t]);const kt=p.useMemo(()=>{const R=`/api/preview?id=${encodeURIComponent(ie)}&file=index_hq.m3u8&play=1`;return rl(me?`${R}&t=${Date.now()}`:R)},[ie,me]);p.useEffect(()=>{if(!me){q(!1);return}let R=!0;const U=new AbortController;return q(!1),(async()=>{for(let Se=0;Se<120&&R&&!U.signal.aborted;Se++){try{const Ee=await gg(kt,{method:"GET",cache:"no-store",signal:U.signal,headers:{"cache-control":"no-cache"}});if(Ee.ok){const Ve=await Ee.text(),z=Ve.includes("#EXTM3U"),K=/#EXTINF:/i.test(Ve)||/\.ts(\?|$)/i.test(Ve)||/\.m4s(\?|$)/i.test(Ve);if(z&&K){R&&q(!0);return}}}catch{}await new Promise(Ee=>setTimeout(Ee,500))}})(),()=>{R=!1,U.abort()}},[me,kt]);const Pe=p.useCallback(R=>{const U=new URLSearchParams;return R.file&&U.set("file",R.file),R.id&&U.set("id",R.id),rl(`/api/record/video?${U.toString()}`)},[]),Xe=p.useMemo(()=>{if(me)return{src:"",type:""};if(!j)return{src:"",type:""};const R=ms(n.output?.trim()||"");if(R){const U=R.toLowerCase().split(".").pop(),ue=U==="mp4"?"video/mp4":U==="ts"?"video/mp2t":"application/octet-stream";return{src:Pe({file:R}),type:ue}}return{src:Pe({id:n.id}),type:"video/mp4"}},[me,j,n.output,n.id,Pe]),st=p.useRef(null),Ze=p.useRef(null),nt=p.useRef(null),[wt,fe]=p.useState(!1),He=p.useCallback(()=>{const R=Ze.current;if(!R||R.isDisposed?.())return;const U=typeof R.videoHeight=="function"?R.videoHeight():0;typeof U=="number"&&U>0&&Number.isFinite(U)&&Je(U)},[]),Ce=p.useCallback(()=>{try{const R=Ze.current?.tech?.(!0)?.el?.()||Ze.current?.el?.()?.querySelector?.("video.vjs-tech")||nt.current;if(!R||!(R instanceof HTMLVideoElement))return null;const U=Number(R.videoWidth||0),ue=Number(R.videoHeight||0);if(!Number.isFinite(U)||!Number.isFinite(ue)||U<=0||ue<=0)return null;let Se=Sn.current;Se||(Se=document.createElement("canvas"),Sn.current=Se);const Ve=Math.min(1,640/U),z=Math.max(1,Math.round(U*Ve)),K=Math.max(1,Math.round(ue*Ve));Se.width!==z&&(Se.width=z),Se.height!==K&&(Se.height=K);const re=Se.getContext("2d",{alpha:!1});return re?(re.drawImage(R,0,0,z,K),Se.toDataURL("image/jpeg",.78)):null}catch{return null}},[]),De=p.useMemo(()=>ms(n.output?.trim()||"")||n.id,[n.output,n.id]),Ie=p.useMemo(()=>{const R=Number(Q);return Number.isFinite(R)&&R>=0?R:0},[Q]),Qe=p.useRef("");p.useEffect(()=>{if(me){Z(!0);return}const R=ms(n.output?.trim()||"");if(!R){Z(!0);return}let U=!0;const ue=new AbortController;return Z(!1),(async()=>{for(let Se=0;Se<80&&U&&!ue.signal.aborted;Se++){try{const Ee=rl(`/api/record/done/meta?file=${encodeURIComponent(R)}`),Ve=await gg(Ee,{signal:ue.signal,cache:"no-store"});if(Ve.ok){const z=await Ve.json(),K=!!z?.metaExists,re=Number(z?.durationSeconds||0)||0,ye=Number(z?.height||0)||0,ze=Number(z?.fps||0)||0;if(re>0){k(re);const Me=Ze.current;if(Me&&!Me.isDisposed?.())try{Me.__fullDurationSec=re,Me.trigger?.("durationchange"),Me.trigger?.("timeupdate")}catch{}}if(ye>0&&te({h:ye,fps:ze>0?ze:null}),K){Z(!0);return}}}catch{}await new Promise(Ee=>setTimeout(Ee,250))}U&&Z(!0)})(),()=>{U=!1,ue.abort()}},[me,De,n.output]);const[,Et]=p.useState(0);p.useEffect(()=>{if(typeof window>"u")return;const R=window.visualViewport;if(!R)return;const U=()=>Et(ue=>ue+1);return U(),R.addEventListener("resize",U),R.addEventListener("scroll",U),window.addEventListener("resize",U),window.addEventListener("orientationchange",U),()=>{R.removeEventListener("resize",U),R.removeEventListener("scroll",U),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U)}},[]);const[It,vt]=p.useState(30),[Yt,Ft]=p.useState(null),zt=!e,At=G8("(min-width: 640px)"),Nt=zt&&At,ln=e||Nt,dn="player_window_v1",yt=420,Fn=280,ot=12,N=320,P=200;p.useEffect(()=>{if(!wt)return;const R=Ze.current;if(!R||R.isDisposed?.())return;const U=R.el();if(!U)return;const ue=U.querySelector(".vjs-control-bar");if(!ue)return;const Se=()=>{const Ve=Math.round(ue.getBoundingClientRect().height||0);Ve>0&&vt(Ve)};Se();let Ee=null;return typeof ResizeObserver<"u"&&(Ee=new ResizeObserver(Se),Ee.observe(ue)),window.addEventListener("resize",Se),()=>{window.removeEventListener("resize",Se),Ee?.disconnect()}},[wt,e]),p.useEffect(()=>fe(!0),[]),p.useEffect(()=>{if(!ln){Ft(null);return}let R=document.getElementById("player-root");R||(R=document.createElement("div"),R.id="player-root");let U=null;if(At){const ue=Array.from(document.querySelectorAll("dialog[open]"));U=ue.length?ue[ue.length-1]:null}U=U??document.body,U.appendChild(R),R.style.position="relative",R.style.zIndex="2147483647",Ft(R)},[At,ln]),p.useEffect(()=>{const R=Ze.current;if(!R||R.isDisposed?.()||me||(K8(R),!ms(n.output?.trim()||"")))return;const ue=Number(ae||0)||0;return ue>0&&(R.__fullDurationSec=ue),R.__serverSeekAbs=Se=>{const Ee=Math.max(0,Number(Se)||0);try{R.__origCurrentTime?.(Ee);try{R.trigger?.("timeupdate")}catch{}}catch{try{R.currentTime?.(Ee)}catch{}}},()=>{try{delete R.__serverSeekAbs}catch{}}},[n.output,me]),p.useLayoutEffect(()=>{if(!wt||!st.current||Ze.current||me||!j)return;const R=document.createElement("video");R.className="video-js vjs-big-play-centered w-full h-full",R.setAttribute("playsinline","true"),st.current.appendChild(R),nt.current=R;const U=Be(R,{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 Ze.current=U,U.one("loadedmetadata",()=>{He()}),U.userActive(!0),U.on("userinactive",()=>U.userActive(!0)),()=>{try{Ze.current&&(Ze.current.dispose(),Ze.current=null)}finally{nt.current&&(nt.current.remove(),nt.current=null)}}},[wt,G,me,j,Oe,He]),p.useEffect(()=>{const R=Ze.current;if(!R||R.isDisposed?.())return;const U=R.el();U&&U.classList.toggle("is-live-download",!!F)},[F]);const ne=p.useCallback(()=>{const R=Ze.current;if(!(!R||R.isDisposed?.())){try{R.pause(),R.reset?.()}catch{}try{R.src({src:"",type:"video/mp4"}),R.load?.()}catch{}}},[]),je=p.useCallback(R=>{const U=Ze.current;if(!U||U.isDisposed?.())return;const ue=Math.max(0,Number(R)||0);try{const Se=Number(U.duration?.()??0),Ee=Number.isFinite(Se)&&Se>0?Math.max(0,Se-.05):ue;U.currentTime(Math.min(ue,Ee)),U.trigger?.("timeupdate")}catch{try{U.currentTime(ue)}catch{}}},[]);p.useEffect(()=>{if(!wt)return;if(!me&&!j){ne();return}const R=Ze.current;if(!R||R.isDisposed?.())return;const U=R.currentTime()||0;if(R.muted(G),!Xe.src){try{R.pause(),R.reset?.(),R.error(null)}catch{}return}R.__timeOffsetSec=0;const ue=Number(ae||0)||0;R.__fullDurationSec=ue;const Se=String(R.currentSrc?.()||"");if(Qe.current="",Se&&Se===Xe.src){const Ve=R.play?.();Ve&&typeof Ve.catch=="function"&&Ve.catch(()=>{});return}R.src({src:Xe.src,type:Xe.type});const Ee=()=>{const Ve=R.play?.();Ve&&typeof Ve.catch=="function"&&Ve.catch(()=>{})};R.one("loadedmetadata",()=>{if(R.isDisposed?.())return;He();try{const z=Number(ae||0)||0;z>0&&(R.__fullDurationSec=z)}catch{}try{R.playbackRate(1)}catch{}const Ve=/mpegurl/i.test(Xe.type);if(U>0&&!Ve)try{const z=Number(R.__timeOffsetSec??0)||0,K=Math.max(0,U-z);R.__setRelativeTime?.(K)}catch{}try{R.trigger?.("timeupdate")}catch{}Ee()}),Ee()},[wt,me,j,Xe.src,Xe.type,G,He,ae,ne]),p.useEffect(()=>{if(!wt||me||!j||!Xe.src)return;const R=Ze.current;if(!R||R.isDisposed?.())return;if(!(Ie>0)){Qe.current="";return}const U=`${De}|${Xe.src}|${Ie.toFixed(3)}`;if(Qe.current===U)return;let ue=!1;const Se=()=>{if(ue)return;const K=Ze.current;if(!K||K.isDisposed?.())return;const re=String(K.currentSrc?.()||"");if(!re||re!==Xe.src)return;const ye=K.tech?.(!0)?.el?.()||K.el?.()?.querySelector?.("video.vjs-tech");if(!((ye instanceof HTMLVideoElement?Number(ye.readyState||0):0)<1)){je(Ie),Qe.current=U;try{const Me=K.play?.();Me&&typeof Me.catch=="function"&&Me.catch(()=>{})}catch{}}};if(Se(),Qe.current===U)return;const Ee=()=>Se();R.one?.("loadedmetadata",Ee),R.one?.("canplay",Ee),R.one?.("durationchange",Ee);const Ve=window.setTimeout(Se,0),z=window.setTimeout(Se,120);return()=>{ue=!0,window.clearTimeout(Ve),window.clearTimeout(z);try{R.off?.("loadedmetadata",Ee)}catch{}try{R.off?.("canplay",Ee)}catch{}try{R.off?.("durationchange",Ee)}catch{}}},[wt,me,j,Xe.src,De,Ie,je]),p.useEffect(()=>{if(!wt)return;const R=Ze.current;if(!R||R.isDisposed?.())return;const U=()=>{n.status==="running"&&q(!1)};return R.on("error",U),()=>{try{R.off("error",U)}catch{}}},[wt,n.status]),p.useEffect(()=>{const R=Ze.current;!R||R.isDisposed?.()||queueMicrotask(()=>R.trigger("resize"))},[e]),p.useEffect(()=>{const R=U=>{const Se=(U.detail?.file??"").trim();if(!Se)return;const Ee=ms(n.output?.trim()||"");Ee&&Ee===Se&&ne()};return window.addEventListener("player:release",R),()=>window.removeEventListener("player:release",R)},[n.output,ne]),p.useEffect(()=>{const R=U=>{const Se=(U.detail?.file??"").trim();if(!Se)return;const Ee=ms(n.output?.trim()||"");Ee&&Ee===Se&&(ne(),t())};return window.addEventListener("player:close",R),()=>window.removeEventListener("player:close",R)},[n.output,ne,t]);const qe=()=>{if(typeof window>"u")return{w:0,h:0,ox:0,oy:0,bottomInset:0};const R=window.visualViewport;if(R&&Number.isFinite(R.width)&&Number.isFinite(R.height)){const Ee=Math.floor(R.width),Ve=Math.floor(R.height),z=Math.floor(R.offsetLeft||0),K=Math.floor(R.offsetTop||0),re=Math.max(0,Math.floor(window.innerHeight-(R.height+R.offsetTop)));return{w:Ee,h:Ve,ox:z,oy:K,bottomInset:re}}const U=document.documentElement,ue=U?.clientWidth||window.innerWidth,Se=U?.clientHeight||window.innerHeight;return{w:ue,h:Se,ox:0,oy:0,bottomInset:0}},dt=p.useRef(null);p.useEffect(()=>{if(typeof window>"u")return;const{w:R,h:U}=qe();dt.current={w:R,h:U}},[]);const $t=p.useCallback(()=>{const R=n,U=Jh(Ze.current?.videoWidth?.(),R.videoWidth,R.width,R.meta?.width)??0,ue=Jh(Ke,Ze.current?.videoHeight?.(),R.videoHeight,R.height,R.meta?.height)??0;return U>0&&ue>0?U/ue:16/9},[n,Ke]),Zt=p.useCallback(R=>{if(typeof window>"u")return R;const U=$t(),ue=me?0:30,{w:Se,h:Ee}=qe(),Ve=Se-ot*2,z=Math.max(1,Ee-ot*2-ue),K=Math.max(1,P-ue);let re=Math.max(N,Math.min(R.w,Ve)),ye=re/U;ye<K&&(ye=K,re=ye*U),ye>z&&(ye=z,re=ye*U),re>Ve&&(re=Ve,ye=re/U);const ze=Math.round(ye+ue),Me=Math.max(ot,Math.min(R.x,Se-re-ot)),et=Math.max(ot,Math.min(R.y,Ee-ze-ot));return{x:Me,y:et,w:Math.round(re),h:ze}},[$t,me]),hn=p.useCallback(()=>{if(typeof window>"u")return{x:ot,y:ot,w:yt,h:Fn};try{const z=window.localStorage.getItem(dn);if(z){const K=JSON.parse(z);if(typeof K.x=="number"&&typeof K.y=="number"&&typeof K.w=="number"&&typeof K.h=="number")return Zt({x:K.x,y:K.y,w:K.w,h:K.h})}}catch{}const{w:R,h:U}=qe(),ue=yt,Se=Fn,Ee=Math.max(ot,R-ue-ot),Ve=Math.max(ot,U-Se-ot);return Zt({x:Ee,y:Ve,w:ue,h:Se})},[Zt]),[Qt,vn]=p.useState(()=>hn()),Tn=Nt&&Qt.w<380,Wt=p.useCallback(R=>{if(!(typeof window>"u"))try{window.localStorage.setItem(dn,JSON.stringify(R))}catch{}},[]),gn=p.useRef(Qt);p.useEffect(()=>{gn.current=Qt},[Qt]),p.useEffect(()=>{Nt&&vn(hn())},[Nt,hn]),p.useEffect(()=>{if(!Nt)return;const R=()=>{const U=dt.current,{w:ue,h:Se}=qe();vn(Ee=>{if(!U)return Zt(Ee);const Ve=24,z=Ee.x-ot,K=U.w-ot-(Ee.x+Ee.w),re=U.h-ot-(Ee.y+Ee.h),ye=Math.abs(z)<=Ve,ze=Math.abs(K)<=Ve,Me=Math.abs(re)<=Ve;let et=Zt(Ee);return Me&&(et={...et,y:Math.max(ot,Se-et.h-ot)}),ze?et={...et,x:Math.max(ot,ue-et.w-ot)}:ye&&(et={...et,x:ot}),Zt(et)}),dt.current={w:ue,h:Se}};return dt.current=(()=>{const{w:U,h:ue}=qe();return{w:U,h:ue}})(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[Nt,Zt]);const sn=p.useRef(null);p.useEffect(()=>{const R=Ze.current;if(!(!R||R.isDisposed?.()))return sn.current!=null&&cancelAnimationFrame(sn.current),sn.current=requestAnimationFrame(()=>{sn.current=null;try{R.trigger("resize")}catch{}}),()=>{sn.current!=null&&(cancelAnimationFrame(sn.current),sn.current=null)}},[Nt,Qt.w,Qt.h]);const[an,Bt]=p.useState(!1),[Dt,jt]=p.useState(!1),[Dn,Mt]=p.useState(null),[Hn,In]=p.useState(null),Sn=p.useRef(null),Xt=p.useRef(null),Un=p.useRef(null),Yn=p.useRef(null),Cn=p.useCallback(R=>{const{w:U,h:ue}=qe(),Se=ot,Ee=U-R.w-ot,Ve=ue-R.h-ot,K=R.x+R.w/2<U/2;return{...R,x:K?Se:Ee,y:Ve}},[]),ti=p.useCallback(R=>{const U=Yn.current;if(!U)return;const ue=R.clientX-U.sx,Se=R.clientY-U.sy,Ee=U.start,Ve=Zt({x:Ee.x+ue,y:Ee.y+Se,w:Ee.w,h:Ee.h});Un.current={x:Ve.x,y:Ve.y},Mt(Cn(Ve)),Xt.current==null&&(Xt.current=requestAnimationFrame(()=>{Xt.current=null;const z=Un.current;z&&vn(K=>({...K,x:z.x,y:z.y}))}))},[Zt,Cn]),wn=p.useCallback(()=>{Yn.current&&(jt(!1),Mt(null),Xt.current!=null&&(cancelAnimationFrame(Xt.current),Xt.current=null),Yn.current=null,window.removeEventListener("pointermove",ti),window.removeEventListener("pointerup",wn),vn(R=>{const U=Cn(Zt(R));return queueMicrotask(()=>Wt(U)),U}))},[ti,Cn,Zt,Wt]),ui=p.useCallback(R=>{if(!Nt||an||R.button!==0)return;R.preventDefault(),R.stopPropagation();const U=gn.current;Yn.current={sx:R.clientX,sy:R.clientY,start:U},jt(!0);const ue=Ce();In(ue),Mt(Cn(U)),window.addEventListener("pointermove",ti),window.addEventListener("pointerup",wn)},[Nt,an,ti,wn,Cn,Ce]),ri=p.useRef(null),Qn=p.useRef(null),Zn=p.useRef(null),xi=p.useCallback(R=>{const U=Zn.current;if(!U)return;const ue=R.clientX-U.sx,Se=R.clientY-U.sy,Ee=U.ratio,Ve=U.dir.includes("w"),z=U.dir.includes("e"),K=U.dir.includes("n"),re=U.dir.includes("s");let ye=U.start.w,ze=U.start.h,Me=U.start.x,et=U.start.y;const{w:gt,h:Tt}=qe(),Vt=24,Ut=U.start.x+U.start.w,un=U.start.y+U.start.h,Ci=Math.abs(gt-ot-Ut)<=Vt,Pi=Math.abs(Tt-ot-un)<=Vt,yn=ci=>{ci=Math.max(N,ci);let Fi=ci/Ee;return Fi<P&&(Fi=P,ci=Fi*Ee),{newW:ci,newH:Fi}},Os=ci=>{ci=Math.max(P,ci);let Fi=ci*Ee;return Fi<N&&(Fi=N,ci=Fi/Ee),{newW:Fi,newH:ci}};if((z||Ve)&&(K||re)){if(Math.abs(ue)>=Math.abs(Se)){const Fi=z?U.start.w+ue:U.start.w-ue,{newW:_s,newH:Do}=yn(Fi);ye=_s,ze=Do}else{const Fi=re?U.start.h+Se:U.start.h-Se,{newW:_s,newH:Do}=Os(Fi);ye=_s,ze=Do}Ve&&(Me=U.start.x+(U.start.w-ye)),K&&(et=U.start.y+(U.start.h-ze))}else if(z||Ve){const ci=z?U.start.w+ue:U.start.w-ue,{newW:Fi,newH:_s}=yn(ci);ye=Fi,ze=_s,Ve&&(Me=U.start.x+(U.start.w-ye)),et=Pi?U.start.y+(U.start.h-ze):U.start.y}else if(K||re){const ci=re?U.start.h+Se:U.start.h-Se,{newW:Fi,newH:_s}=Os(ci);ye=Fi,ze=_s,K&&(et=U.start.y+(U.start.h-ze)),Ci?Me=U.start.x+(U.start.w-ye):Me=U.start.x}const Nr=Zt({x:Me,y:et,w:ye,h:ze});Qn.current=Nr,ri.current==null&&(ri.current=requestAnimationFrame(()=>{ri.current=null;const ci=Qn.current;ci&&vn(ci)}))},[Zt]),Mn=p.useCallback(()=>{Zn.current&&(Bt(!1),Mt(null),In(null),ri.current!=null&&(cancelAnimationFrame(ri.current),ri.current=null),Zn.current=null,window.removeEventListener("pointermove",xi),window.removeEventListener("pointerup",Mn),Wt(gn.current))},[xi,Wt]),jn=p.useCallback(R=>U=>{if(!Nt||U.button!==0)return;U.preventDefault(),U.stopPropagation();const ue=gn.current;Zn.current={dir:R,sx:U.clientX,sy:U.clientY,start:ue,ratio:ue.w/ue.h},Bt(!0),window.addEventListener("pointermove",xi),window.addEventListener("pointerup",Mn)},[Nt,xi,Mn]),[qn,xe]=p.useState(!1),[it,mt]=p.useState(!1);p.useEffect(()=>{const R=window.matchMedia?.("(hover: hover) and (pointer: fine)"),U=()=>xe(!!R?.matches);return U(),R?.addEventListener?.("change",U),()=>R?.removeEventListener?.("change",U)},[]);const Rt=Nt&&(it||Dt||an),[Ne,pt]=p.useState(!1);if(p.useEffect(()=>{n.status!=="running"&&pt(!1)},[n.id,n.status]),!wt||ln&&!Yt)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",Pt=String(n.phase??"").toLowerCase(),Ht=Pt==="stopping"||Pt==="remuxing"||Pt==="moving",Gt=!B||!me||Ht||Ne,xn=c.jsx("div",{className:"flex items-center gap-1 min-w-0",children:me?c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Gt,title:Ht||Ne?"Stoppe…":"Stop","aria-label":Ht||Ne?"Stoppe…":"Stop",onClick:async R=>{if(R.preventDefault(),R.stopPropagation(),!Gt)try{pt(!0),await B?.(n.id)}finally{pt(!1)}},className:Ta("shadow-none shrink-0",Nt&&Tn&&"px-2"),children:c.jsx("span",{className:"whitespace-nowrap",children:Ht||Ne?"Stoppe…":Nt&&Tn?"Stop":"Stoppen"})}),c.jsx(Ds,{job:n,variant:"overlay",collapseToMenu:!0,busy:Ht||Ne,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?R=>E(R):void 0,onToggleFavorite:M?R=>M(R):void 0,onToggleLike:L?R=>L(R):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||de,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?R=>E(R):void 0,onToggleFavorite:M?R=>M(R):void 0,onToggleLike:L?R=>L(R):void 0,onToggleHot:C?async R=>{ne(),await new Promise(ue=>setTimeout(ue,150)),await C(R),await new Promise(ue=>setTimeout(ue,0));const U=Ze.current;if(U&&!U.isDisposed?.()){const ue=U.play?.();ue&&typeof ue.catch=="function"&&ue.catch(()=>{})}}:void 0,onKeep:_?async R=>{ne(),t(),await new Promise(U=>setTimeout(U,150)),await _(R)}:void 0,onDelete:S?async R=>{ne(),t(),await new Promise(U=>setTimeout(U,150)),await S(R)}:void 0,order:["watch","favorite","like","hot","keep","delete","details"],className:"gap-1 min-w-0 flex-1"})}),zn=e||Nt,Bi=me?"calc(4px + env(safe-area-inset-bottom))":`calc(${It+2}px + env(safe-area-inset-bottom))`,$n="top-2",Vi=e&&At,Si=c.jsx("div",{className:Ta("relative overflow-visible flex-1 min-h-0"),onMouseEnter:()=>{!Nt||!qn||mt(!0)},onMouseLeave:()=>{!Nt||!qn||mt(!1)},children:c.jsxs("div",{className:Ta("relative w-full h-full",Nt&&"vjs-mini"),style:{"--vjs-controlbar-h":`${It}px`},children:[me?c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx(ib,{src:Te,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:st,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",$n),children:c.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-2",children:[c.jsx("div",{className:"min-w-0 pointer-events-auto overflow-visible",children:Vi?null:xn}),Nt?c.jsxs("button",{type:"button","aria-label":"Player-Fenster verschieben",title:"Ziehen zum Verschieben",onPointerDown:ui,onClick:R=>{R.preventDefault(),R.stopPropagation()},className:Ta(xt,"px-3 gap-1 cursor-grab active:cursor-grabbing select-none",Rt?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none -translate-y-1",Dt&&"scale-[0.98] opacity-90"),children:[c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"}),c.jsx("span",{className:"h-1 w-1 rounded-full bg-black/35 dark:bg-white/35"})]}):null,c.jsxs("div",{className:"shrink-0 flex items-center gap-1 pointer-events-auto",children:[c.jsx("button",{type:"button",className:xt,onClick:i,"aria-label":e?"Minimieren":"Maximieren",title:e?"Minimieren":"Maximieren",children:e?c.jsx(RA,{className:"h-5 w-5"}):c.jsx(LA,{className:"h-5 w-5"})}),c.jsx("button",{type:"button",className:xt,onClick:t,"aria-label":"Schließen",title:"Schließen",children:c.jsx(_f,{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:Bi},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||H}),u||de?c.jsx("span",{className:"shrink-0 rounded bg-amber-500/25 px-1.5 py-0.5 font-semibold text-white",children:"HOT"}):null]})})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5 text-[11px] text-white",children:[bt!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:bt}):null,me?null:c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:we}),W!=="—"?c.jsx("span",{className:"rounded bg-black/40 px-1.5 py-0.5 font-medium",children:W}):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:Le,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||H})]}),c.jsx("div",{className:"pointer-events-auto",children:c.jsxs("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[me?c.jsx(en,{variant:"primary",color:"red",size:"sm",rounded:"md",disabled:Gt,title:Ht||Ne?"Stoppe…":"Stop","aria-label":Ht||Ne?"Stoppe…":"Stop",onClick:async R=>{if(R.preventDefault(),R.stopPropagation(),!Gt)try{pt(!0),await B?.(n.id)}finally{pt(!1)}},className:"shadow-none",children:Ht||Ne?"Stoppe…":"Stoppen"}):null,c.jsx(Ds,{job:n,variant:"table",collapseToMenu:!1,busy:Ht||Ne,isHot:u||de,isFavorite:h,isLiked:f,isWatching:g,onToggleWatch:E?R=>E(R):void 0,onToggleFavorite:M?R=>M(R):void 0,onToggleLike:L?R=>L(R):void 0,onToggleHot:C?async R=>{ne(),await new Promise(ue=>setTimeout(ue,150)),await C(R),await new Promise(ue=>setTimeout(ue,0));const U=Ze.current;if(U&&!U.isDisposed?.()){const ue=U.play?.();ue&&typeof ue.catch=="function"&&ue.catch(()=>{})}}:void 0,onKeep:_?async R=>{ne(),t(),await new Promise(U=>setTimeout(U,150)),await _(R)}:void 0,onDelete:S?async R=>{ne(),t(),await new Promise(U=>setTimeout(U,150)),await S(R)}:void 0,order:me?["watch","favorite","like","details"]:["watch","favorite","like","hot","details","keep","delete"],className:"flex items-center justify-start gap-1"})]})}),c.jsxs("div",{className:"grid grid-cols-2 gap-x-3 gap-y-2 text-sm",children:[c.jsx("div",{className:"text-white/60",children:"Status"}),c.jsx("div",{className:"font-medium",children:n.status}),c.jsx("div",{className:"text-white/60",children:"Auflösung"}),c.jsx("div",{className:"font-medium",children:bt}),c.jsx("div",{className:"text-white/60",children:"FPS"}),c.jsx("div",{className:"font-medium",children:ft}),c.jsx("div",{className:"text-white/60",children:"Laufzeit"}),c.jsx("div",{className:"font-medium",children:we}),c.jsx("div",{className:"text-white/60",children:"Größe"}),c.jsx("div",{className:"font-medium",children:W}),c.jsx("div",{className:"text-white/60",children:"Datum"}),c.jsx("div",{className:"font-medium",children:ve}),c.jsx("div",{className:"col-span-2",children:ht.length?c.jsx("div",{className:"flex flex-wrap gap-1.5",children:ht.map(R=>c.jsx("span",{className:"rounded bg-white/10 px-2 py-0.5 text-xs text-white/90",children:R},R))}):c.jsx("span",{className:"text-white/50",children:"—"})})]})]})}),pi=Nt&&Dt&&Dn?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:Dn.x-Qt.x,top:Dn.y-Qt.y,width:Dn.w,height:Dn.h},"aria-hidden":"true",children:c.jsxs("div",{className:"absolute inset-0 bg-black",children:[c.jsx("img",{src:Hn||Le,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||H,u||de?c.jsx("span",{className:"ml-1.5 rounded bg-amber-500/30 px-1.5 py-0.5 text-white",children:"HOT"}):null]})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-[10px] text-white/90",children:[bt!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:bt}):null,!me&&we!=="—"?c.jsx("span",{className:"rounded bg-black/45 px-1.5 py-0.5",children:we}):null]})]}),c.jsx("div",{className:"absolute inset-x-0 bottom-0 h-8 bg-gradient-to-t from-white/8 to-transparent"})]})}):null,Ri=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",zn?"h-full":"h-[220px] max-h-[40vh]",e?"rounded-2xl":Nt?"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:[Vi?si:null,Si]})}),{w:Vn,h:Gn,ox:Kn,oy:An,bottomInset:Oi}=qe(),Jn={left:Kn+16,top:An+16,width:Math.max(0,Vn-32),height:Math.max(0,Gn-32)},Gi=e?Jn:Nt?{left:Qt.x,top:Qt.y,width:Qt.w,height:Qt.h}:void 0,_i=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||Nt?c.jsxs("div",{className:Ta("fixed z-[2147483647]",!an&&!Dt&&"transition-[left,top,width,height] duration-300 ease-[cubic-bezier(.2,.9,.2,1)]"),style:{...Gi,willChange:an?"left, top, width, height":void 0},children:[pi,Ri,Nt?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:jn("w")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 bottom-2 top-2 w-3 cursor-ew-resize",onPointerDown:jn("e")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -top-1 h-3 cursor-ns-resize",onPointerDown:jn("n")}),c.jsx("div",{className:"pointer-events-auto absolute left-2 right-2 -bottom-1 h-3 cursor-ns-resize",onPointerDown:jn("s")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -top-1 h-4 w-4 cursor-nwse-resize",onPointerDown:jn("nw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -top-1 h-4 w-4 cursor-nesw-resize",onPointerDown:jn("ne")}),c.jsx("div",{className:"pointer-events-auto absolute -left-1 -bottom-1 h-4 w-4 cursor-nesw-resize",onPointerDown:jn("sw")}),c.jsx("div",{className:"pointer-events-auto absolute -right-1 -bottom-1 h-4 w-4 cursor-nwse-resize",onPointerDown:jn("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:Ri})]});return ln?gu.createPortal(_i,Yt):_i}function _k({jobId:n,thumbTick:e,autoTickMs:t=1e4,blur:i=!1,className:a,alignStartAt:l,alignEndAt:u=null,alignEveryMs:h,fastRetryMs:f,fastRetryMax:g,fastRetryWindowMs:_,thumbsWebpUrl:S,thumbsCandidates:C}){const M=i?"blur-md":"",L=0,E=p.useRef(null),B=p.useRef(!0),[G,Q]=p.useState(!1),H=p.useRef(!1),[se,Y]=p.useState(0),[W,O]=p.useState(!1),[ae,k]=p.useState(!1),j=p.useRef(null),Z=p.useRef(0),V=p.useRef(!1),te=p.useRef(!1),[me,le]=p.useState(!0),q=Le=>{if(typeof Le=="number"&&Number.isFinite(Le))return Le;if(Le instanceof Date)return Le.getTime();const ut=Date.parse(String(Le??""));return Number.isFinite(ut)?ut:NaN},F=Le=>{const ut=String(Le??"").trim();return ut?/^https?:\/\//i.test(ut)||ut.startsWith("/")?ut:`/${ut}`:""},ee=p.useMemo(()=>{const Le=[S,...Array.isArray(C)?C:[]].map(F).filter(Boolean);return Array.from(new Set(Le)).join("|")},[S,C]);p.useEffect(()=>{const Le=()=>{const Oe=!document.hidden;B.current=Oe,le(Oe)},ut=!document.hidden;return B.current=ut,le(ut),document.addEventListener("visibilitychange",Le),()=>document.removeEventListener("visibilitychange",Le)},[]),p.useEffect(()=>()=>{j.current&&window.clearTimeout(j.current)},[]),p.useEffect(()=>{const Le=E.current;if(!Le)return;const ut=new IntersectionObserver(Oe=>{const _e=Oe[0],Ke=!!(_e&&(_e.isIntersecting||_e.intersectionRatio>0));Ke!==H.current&&(H.current=Ke,Q(Ke))},{root:null,threshold:0,rootMargin:"300px 0px"});return ut.observe(Le),()=>ut.disconnect()},[]),p.useEffect(()=>{typeof e!="number"&&G&&B.current&&(te.current||(te.current=!0,Y(Le=>Le+1)))},[G,e]),p.useEffect(()=>{if(typeof e=="number"||!G||!B.current)return;const Le=Number(h??t??1e4);if(!Number.isFinite(Le)||Le<=0)return;const ut=l?q(l):NaN,Oe=u?q(u):NaN;if(Number.isFinite(ut)){let Ke;const Je=()=>{if(!B.current)return;const bt=Date.now();if(Number.isFinite(Oe)&&bt>=Oe)return;const kt=Math.max(0,bt-ut)%Le,Pe=kt===0?Le:Le-kt;Ke=window.setTimeout(()=>{H.current&&B.current&&(Y(Xe=>Xe+1),Je())},Pe)};return Je(),()=>{Ke&&window.clearTimeout(Ke)}}const _e=window.setInterval(()=>{H.current&&B.current&&Y(Ke=>Ke+1)},Le);return()=>window.clearInterval(_e)},[e,t,G,me,l,u,h]);const ie=typeof e=="number"?e:se,de=p.useRef(0),[I,pe]=p.useState(0);p.useEffect(()=>{G&&B.current&&(de.current=ie,pe(ie))},[ie,G]),p.useEffect(()=>{O(!1),k(!1)},[I]),p.useEffect(()=>{V.current=!1,Z.current=0,te.current=!1,O(!1),k(!1),H.current&&B.current&&Y(Le=>Le+1)},[n,ee]);const we=p.useMemo(()=>`/api/preview?id=${encodeURIComponent(n)}&v=${I}`,[n,I]),ve=p.useMemo(()=>`/api/preview/live?id=${encodeURIComponent(n)}&hover=1`,[n]),ht=p.useMemo(()=>ee?ee.split("|"):[],[ee])[0]||"",Ge=!!ht&&!W,Te=p.useMemo(()=>{if(Ge){const Le=ht.includes("?")?"&":"?";return`${ht}${Le}v=${encodeURIComponent(String(I))}`}return we},[Ge,ht,I,we]);return c.jsx(Mw,{content:(Le,{close:ut})=>Le&&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% + ${L}px)`},children:c.jsxs("div",{className:"absolute inset-0",children:[c.jsx(ib,{src:ve,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:Oe=>{Oe.preventDefault(),Oe.stopPropagation(),ut()},children:c.jsx(_f,{className:"h-4 w-4"})})]})})}),children:c.jsx("div",{ref:E,className:["block relative rounded bg-gray-100 dark:bg-white/5 overflow-hidden",a||"w-full h-full"].join(" "),children:ae?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:Te,loading:G?"eager":"lazy",fetchPriority:G?"high":"auto",decoding:"async",alt:"",className:["block w-full h-full object-cover object-center",M].filter(Boolean).join(" "),onLoad:()=>{V.current=!0,Z.current=0,j.current&&window.clearTimeout(j.current),Ge?O(!1):k(!1)},onError:()=>{if(Ge){O(!0);return}if(k(!0),!f||!H.current||!B.current||V.current)return;const Le=l?q(l):NaN,ut=Number(_??6e4);if(!(!Number.isFinite(Le)||Date.now()-Le<ut))return;const _e=Number(g??25);Z.current>=_e||(j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{Z.current+=1,k(!1),Y(Ke=>Ke+1)},f))}})})})}function gd({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,M=B=>B===0?"text-left":B===C-1?"text-right":"text-center",L=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:[M(G),L(G)?"text-indigo-600 dark:text-indigo-400":""].join(" "),children:B},`${G}-${B}`))}):null]})]})}function X8(n){const[e,t]=p.useState(n),i=p.useRef(n.length);return p.useEffect(()=>{const a=nm("/api/record/stream","jobs",l=>{Array.isArray(l)&&(l.length,i.current,i.current=l.length,t(l))});return()=>a()},[]),e}function Y8(n,e=!1){const[t,i]=p.useState(e);return p.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 Vf=n=>{const e=n;return e.modelName??e.model??e.modelKey??e.username??e.name??"—"},wk=n=>{const e=n;return e.sourceUrl??e.url??e.roomUrl??""},Tk=n=>{const e=n;return String(e.imageUrl??e.image_url??"").trim()},Zl=n=>{const e=n;return String(e.key??e.id??Vf(n))},sb=n=>{switch(String(n??"").trim().toLowerCase()){case"public":return"Public";case"private":return"Private";case"hidden":return"Hidden";case"away":return"Away";case"offline":return"Offline";default:return"Offline"}},Sk=n=>{const e=n,t=e.currentShow??e.roomStatus??e.modelStatus??e.show??e.statusText??e.model?.currentShow??e.model?.roomStatus??e.model?.status??e.room?.currentShow??e.room?.status??"";return sb(t)},kk=n=>{switch(n){case"Public":return"bg-emerald-500/15 text-emerald-900 ring-emerald-500/30 dark:bg-emerald-400/10 dark:text-emerald-200 dark:ring-emerald-400/25";case"Private":return"bg-fuchsia-500/15 text-fuchsia-900 ring-fuchsia-500/30 dark:bg-fuchsia-400/10 dark:text-fuchsia-200 dark:ring-fuchsia-400/25";case"Hidden":return"bg-slate-500/15 text-slate-900 ring-slate-500/30 dark:bg-slate-400/10 dark:text-slate-200 dark:ring-slate-400/25";case"Away":return"bg-amber-500/15 text-amber-900 ring-amber-500/30 dark:bg-amber-400/10 dark:text-amber-200 dark:ring-amber-400/25";default:return"bg-gray-900/5 text-gray-800 ring-gray-900/10 dark:bg-white/10 dark:text-gray-200 dark:ring-white/10"}},$i=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},Q8=n=>{const e=String(n??"").trim();return e?/^https?:\/\//i.test(e)||e.startsWith("/")?e:`/${e}`:""},Ek=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=>Q8(String(a??""))).filter(Boolean)},Jl=n=>{if(n.kind==="job"){const t=n.job;return $i(t.addedAt)||$i(t.createdAt)||$i(t.enqueuedAt)||$i(t.queuedAt)||$i(t.requestedAt)||$i(t.startedAt)||0}const e=n.pending;return $i(e.addedAt)||$i(e.createdAt)||$i(e.enqueuedAt)||$i(e.queuedAt)||$i(e.requestedAt)||0},Ck=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 Z8(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 Ak(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 J8({job:n,postworkInfo:e}){const t=String(n?.phase??"").trim(),i=Number(n?.progress??0),a=t.toLowerCase(),l=a==="recording";let u=t?Ck(t)||t:"";a==="postwork"&&(u=Ak(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(gd,{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(gd,{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 F=n.pending,ee=Vf(F),ie=wk(F),de=sb(F.currentShow);return c.jsxs("div",{className:`\r
|
||
relative overflow-hidden rounded-2xl border border-white/40 bg-white/35 shadow-sm\r
|
||
backdrop-blur-xl supports-[backdrop-filter]:bg-white/25\r
|
||
ring-1 ring-black/5\r
|
||
transition-all hover:-translate-y-0.5 hover:shadow-md active:translate-y-0\r
|
||
dark:border-white/10 dark:bg-gray-950/35 dark:supports-[backdrop-filter]:bg-gray-950/25\r
|
||
`,children:[c.jsx("div",{className:"pointer-events-none absolute inset-0 bg-gradient-to-br from-white/70 via-white/20 to-white/60 dark:from-white/10 dark:via-transparent dark:to-white/5"}),c.jsxs("div",{className:"relative p-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-gray-900 dark:text-white",title:ee,children:ee}),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:de})]})]}),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=Tk(F);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:ee,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…"})})})})()}),ie?c.jsx("a",{href:ie,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:ie,children:ie}):null]})]})}const C=n.job,M=uy(C.output),L=ab(C.output||""),E=String(C.phase??"").trim(),B=E.toLowerCase(),G=B==="recording",Q=!!a[C.id],H=String(C.status??"").toLowerCase(),Y=B!==""&&B!=="recording"||H!=="running"||Q,W=Sk(C);let O=E?Ck(E)||E:"";B==="recording"?O="Recording läuft…":B==="postwork"&&(O=Ak(C,l(C)));const ae=O||W,k=Number(C.progress??0),j=!G&&Number.isFinite(k)&&k>0&&k<100,Z=!G&&!j&&!!E&&(!Number.isFinite(k)||k<=0||k>=100),V=M&&M!=="—"?M.toLowerCase():"",te=V?i[V]:void 0,me=!!te?.favorite,le=te?.liked===!0,q=!!te?.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:F=>{(F.key==="Enter"||F.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(_k,{jobId:C.id,blur:t,alignStartAt:C.startedAt,alignEndAt:C.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ek(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:M,children:M}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",kk(W)].join(" "),title:W,children:W})]}),c.jsx("div",{className:"mt-0.5 truncate text-xs text-gray-600 dark:text-gray-300",title:C.output,children:L||"—"})]}),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:Nk(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:Mk(Dk(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:F=>F.stopPropagation(),title:C.sourceUrl,children:C.sourceUrl}):null]})]}),j||Z?c.jsx("div",{className:"mt-3",children:j?c.jsx(gd,{label:ae,value:Math.max(0,Math.min(100,k)),showPercent:!0,size:"sm",className:"w-full"}):c.jsx(gd,{label:ae,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:F=>F.stopPropagation(),onMouseDown:F=>F.stopPropagation(),children:c.jsx(Ds,{job:C,variant:"table",busy:Y,isFavorite:me,isLiked:le,isWatching:q,onToggleFavorite:g,onToggleLike:_,onToggleWatch:S,order:["watch","favorite","like","details"],className:"flex items-center gap-1"})}),c.jsx(en,{size:"sm",variant:"primary",disabled:Y,className:"shrink-0",onClick:F=>{F.stopPropagation(),!Y&&(u(C.id),f(C.id))},children:Y?"Stoppe…":"Stop"})]})]})]})}const ab=n=>(n||"").replaceAll("\\","/").trim().split("/").pop()||"",uy=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},e6=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`},Nk=(n,e)=>{const t=n,i=$i(t.startedAtMs)||$i(n.startedAt);if(!Number.isFinite(i)||i<=0)return"—";const a=n.endedAt?$i(t.endedAtMs)||$i(n.endedAt):e;return!Number.isFinite(a)||a<=0?"—":e6(a-i)},Dk=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},Mk=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 t6({jobs:n,pending:e=[],onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,modelsByKey:f={},blurPreviews:g}){const _=X8(n),S=Y8("(min-width: 640px)",!0),[C,M]=p.useState(!1),[L,E]=p.useState(!1),[,B]=p.useState(!1),[G,Q]=p.useState(!1),H=p.useRef(null),se=p.useRef(null),Y=p.useRef(null),[W,O]=p.useState(!1),ae=p.useCallback(async()=>{try{const Te=await Z8("/api/autostart/state",{cache:"no-store"}),Le=!!Te?.paused,ut=!!Te?.pausedByUser,Oe=!!Te?.pausedByDisk;H.current=Le,se.current=ut,Y.current=Oe,E(Le),B(ut),Q(Oe)}catch{}},[]);p.useEffect(()=>{ae();const Te=nm("/api/autostart/state/stream","autostart",Le=>{const ut=!!Le?.paused,Oe=!!Le?.pausedByUser,_e=!!Le?.pausedByDisk;H.current===ut&&se.current===Oe&&Y.current===_e||(H.current=ut,se.current=Oe,Y.current=_e,E(ut),B(Oe),Q(_e))});return()=>{Te()}},[ae]);const k=p.useCallback(async()=>{if(!(W||L)){O(!0);try{const Te=await fetch("/api/autostart/pause",{method:"POST"});if(!Te.ok)throw new Error(`HTTP ${Te.status}`);await ae()}catch{}finally{O(!1)}}},[W,L,ae]),j=p.useCallback(async()=>{if(!(W||!L||G)){O(!0);try{const Te=await fetch("/api/autostart/resume",{method:"POST"});if(!Te.ok)throw new Error(`HTTP ${Te.status}`);await ae()}catch{}finally{O(!1)}}},[W,L,G,ae]),[Z,V]=p.useState({}),[te,me]=p.useState({}),le=p.useCallback(Te=>{const Le=Array.isArray(Te)?Te:[Te];V(ut=>{const Oe={...ut};for(const _e of Le)_e&&(Oe[_e]=!0);return Oe}),me(ut=>{const Oe={...ut};for(const _e of Le)_e&&(Oe[_e]=!0);return Oe})},[]);p.useEffect(()=>{V(Te=>{const Le=Object.keys(Te);if(Le.length===0)return Te;const ut={};for(const Oe of Le){const _e=_.find(ft=>ft.id===Oe);if(!_e)continue;const Ke=String(_e.phase??"").trim().toLowerCase();Ke!==""&&Ke!=="recording"||_e.status!=="running"||(ut[Oe]=!0)}return ut})},[_]);const[q,F]=p.useState(()=>Date.now()),ee=p.useMemo(()=>_.some(Te=>!Te.endedAt&&Te.status==="running"),[_]),ie=p.useMemo(()=>{const Te=new Map,Le=Je=>{const bt=Je,ft=bt.postWork;return $i(ft?.enqueuedAt)||$i(bt.enqueuedAt)||$i(bt.queuedAt)||$i(bt.createdAt)||$i(bt.addedAt)||$i(Je.endedAt)||$i(Je.startedAt)||0},ut=[],Oe=[];for(const Je of _){const bt=Je?.postWork;if(!bt)continue;const ft=String(bt.state??"").toLowerCase();ft==="running"?ut.push(Je):ft==="queued"&&Oe.push(Je)}ut.sort((Je,bt)=>Le(Je)-Le(bt)),Oe.sort((Je,bt)=>Le(Je)-Le(bt));const _e=ut.length,Ke=_e+Oe.length;for(let Je=0;Je<Oe.length;Je++){const bt=String(Oe[Je]?.id??"");bt&&Te.set(bt,{pos:_e+Je+1,total:Ke})}return Te},[_]),de=p.useCallback(Te=>{const Le=String(Te?.id??"");return Le?ie.get(Le):void 0},[ie]);p.useEffect(()=>{if(!ee)return;const Te=window.setInterval(()=>F(Date.now()),1e3);return()=>window.clearInterval(Te)},[ee]);const I=p.useMemo(()=>_.filter(Te=>{if(bg(Te)||Te.endedAt)return!1;const Le=String(Te.phase??"").trim(),ut=!!Z[Te.id],Oe=Le.trim().toLowerCase();return!(Oe!==""&&Oe!=="recording"||Te.status!=="running"||ut)}).map(Te=>Te.id),[_,Z]),pe=p.useMemo(()=>[{key:"preview",header:"Vorschau",widthClassName:"w-[96px]",cell:Te=>{if(Te.kind==="job"){const _e=Te.job;return c.jsx("div",{className:"grid w-[96px] h-[60px] overflow-hidden rounded-md",children:c.jsx(_k,{jobId:_e.id,blur:g,alignStartAt:_e.startedAt,alignEndAt:_e.endedAt??null,alignEveryMs:1e4,fastRetryMs:1e3,fastRetryMax:25,fastRetryWindowMs:6e4,thumbsCandidates:Ek(_e),className:"w-full h-full"})})}const Le=Te.pending,ut=Vf(Le),Oe=Tk(Le);return Oe?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:Oe,alt:ut,className:["h-full w-full object-cover",g?"blur-md":""].join(" "),loading:"lazy",referrerPolicy:"no-referrer",onError:_e=>{_e.currentTarget.style.display="none"}})}):c.jsx("div",{className:"h-[60px] w-[96px] rounded-md bg-gray-100 dark:bg-white/10 grid place-items-center text-sm text-gray-500",children:"⏳"})}},{key:"model",header:"Modelname",widthClassName:"w-[170px]",cell:Te=>{if(Te.kind==="job"){const _e=Te.job,Ke=ab(_e.output||""),Je=uy(_e.output),bt=Sk(_e);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:Je,children:Je}),c.jsx("span",{className:["shrink-0 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-semibold ring-1",kk(bt)].join(" "),title:bt,children:bt})]}),c.jsx("span",{className:"block max-w-[220px] truncate",title:_e.output,children:Ke}),_e.sourceUrl?c.jsx("a",{href:_e.sourceUrl,target:"_blank",rel:"noreferrer",title:_e.sourceUrl,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:ft=>ft.stopPropagation(),children:_e.sourceUrl}):c.jsx("span",{className:"block max-w-[260px] truncate text-gray-500 dark:text-gray-400",children:"—"})]})}const Le=Te.pending,ut=Vf(Le),Oe=wk(Le);return c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"block max-w-[170px] truncate font-medium",title:ut,children:ut}),Oe?c.jsx("a",{href:Oe,target:"_blank",rel:"noreferrer",title:Oe,className:"block max-w-[260px] truncate text-indigo-600 dark:text-indigo-400 hover:underline",onClick:_e=>_e.stopPropagation(),children:Oe}):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:Te=>{if(Te.kind==="job"){const Oe=Te.job;return c.jsx(J8,{job:Oe,postworkInfo:de(Oe)})}const Le=Te.pending,ut=sb(Le.currentShow);return c.jsx("div",{className:"min-w-0",children:c.jsx("div",{className:"truncate",children:c.jsx("span",{className:"font-medium",children:ut})})})}},{key:"runtime",header:"Dauer",widthClassName:"w-[90px]",cell:Te=>Te.kind==="job"?Nk(Te.job,q):"—"},{key:"size",header:"Größe",align:"right",widthClassName:"w-[110px]",cell:Te=>Te.kind==="job"?c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white",children:Mk(Dk(Te.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:Te=>{if(Te.kind!=="job")return c.jsx("div",{className:"pr-2 text-right text-sm text-gray-500 dark:text-gray-400",children:"—"});const Le=Te.job,ut=String(Le.phase??"").trim(),Oe=!!Z[Le.id],_e=ut.trim().toLowerCase(),Je=_e!==""&&_e!=="recording"||Le.status!=="running"||Oe,bt=uy(Le.output||""),ft=bt&&bt!=="—"?f[bt.toLowerCase()]:void 0,kt=!!ft?.favorite,Pe=ft?.liked===!0,Xe=!!ft?.watching;return c.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 pr-2",children:[c.jsx(Ds,{job:Le,variant:"table",busy:Je,isFavorite:kt,isLiked:Pe,isWatching:Xe,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u,onAddToDownloads:h,order:["watch","favorite","like","details"],className:"flex items-center gap-1"}),(()=>{const st=String(Le.phase??"").trim(),Ze=!!Z[Le.id],nt=st.trim().toLowerCase(),fe=nt!==""&&nt!=="recording"||Le.status!=="running"||Ze;return c.jsx(en,{size:"sm",variant:"primary",disabled:fe,className:"shrink-0",onClick:He=>{He.stopPropagation(),!fe&&(le(Le.id),i(Le.id))},children:fe?"Stoppe…":"Stop"})})()]})}}],[g,le,f,q,i,a,l,u,Z,te,de]),we=p.useMemo(()=>{const Te=_.filter(Le=>!(bg(Le)||C_(Le?.status)||Le?.endedAt)).map(Le=>({kind:"job",job:Le}));return Te.sort((Le,ut)=>Jl(ut)-Jl(Le)),Te},[_]),ve=p.useMemo(()=>{const Te=_.filter(Oe=>!(!bg(Oe)||C_(Oe?.status))).map(Oe=>({kind:"job",job:Oe})),Le=Oe=>{const _e=Oe?.postWork,Ke=String(_e?.state??"").toLowerCase();return Ke==="running"?0:Ke==="queued"?1:2},ut=Oe=>{const _e=String(Oe?.id??""),Ke=_e?ie.get(_e):void 0;return typeof Ke?.pos=="number"&&Number.isFinite(Ke.pos)?Ke.pos:Number.MAX_SAFE_INTEGER};return Te.sort((Oe,_e)=>{const Ke=Oe.job,Je=_e.job,bt=Le(Ke)-Le(Je);if(bt!==0)return bt;const ft=ut(Ke),kt=ut(Je);return ft!==kt?ft-kt:Jl(Oe)-Jl(_e)}),Te},[_,ie]),ge=p.useMemo(()=>{const Te=e.map(Le=>({kind:"pending",pending:Le}));return Te.sort((Le,ut)=>Jl(ut)-Jl(Le)),Te},[e]),ht=we.length+ve.length+ge.length,Ge=p.useCallback(async()=>{if(!C&&I.length!==0){M(!0);try{le(I),await Promise.allSettled(I.map(Te=>Promise.resolve(i(Te))))}finally{M(!1)}}},[C,I,le,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:ht})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-2",children:[c.jsx(en,{size:"sm",variant:L?"secondary":"primary",disabled:W||G,onClick:Te=>{Te.preventDefault(),Te.stopPropagation(),!G&&(L?j():k())},className:"hidden sm:inline-flex",title:G?"Autostart durch Speicherplatz-Notbremse gesperrt":L?"Autostart fortsetzen":"Autostart pausieren",leadingIcon:L?c.jsx(DN,{className:"size-4 shrink-0"}):c.jsx(jN,{className:"size-4 shrink-0"}),children:"Autostart"}),c.jsx(en,{size:"sm",variant:"primary",disabled:C||I.length===0,onClick:Te=>{Te.preventDefault(),Te.stopPropagation(),Ge()},className:"hidden sm:inline-flex",title:I.length===0?"Nichts zu stoppen":"Alle laufenden stoppen",children:C?"Stoppe alle…":`Alle stoppen (${I.length})`})]})]})})}),we.length>0||ve.length>0||ge.length>0?c.jsx(c.Fragment,{children:S?c.jsxs("div",{className:"mt-3 space-y-4",children:[we.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 (",we.length,")"]}),G?c.jsx(A_,{}):null]}),c.jsx(ed,{rows:we,columns:pe,getRowKey:Te=>Te.kind==="job"?`dl:job:${Te.job.id}`:`dl:pending:${Zl(Te.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Te=>{Te.kind==="job"&&t(Te.job)}})]}):null,ve.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 (",ve.length,")"]}),c.jsx(ed,{rows:ve,columns:pe,getRowKey:Te=>Te.kind==="job"?`pw:job:${Te.job.id}`:`pw:pending:${Zl(Te.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0,onRowClick:Te=>{Te.kind==="job"&&t(Te.job)}})]}):null,ge.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 (",ge.length,")"]}),c.jsx(ed,{rows:ge,columns:pe,getRowKey:Te=>Te.kind==="job"?`wa:job:${Te.job.id}`:`wa:pending:${Zl(Te.pending)}`,striped:!0,fullWidth:!0,stickyHeader:!0,compact:!1,card:!0})]}):null]}):c.jsxs("div",{className:"mt-3 grid gap-4",children:[we.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 (",we.length,")"]}),G?c.jsx(A_,{}):null]}),we.map(Te=>c.jsx(yg,{r:Te,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:de,stopRequestedIds:Z,markStopRequested:le,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`dl:${Te.kind==="job"?Te.job.id:Zl(Te.pending)}`))]}):null,ve.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 (",ve.length,")"]}),ve.map(Te=>c.jsx(yg,{r:Te,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:de,stopRequestedIds:Z,markStopRequested:le,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`pw:${Te.kind==="job"?Te.job.id:Zl(Te.pending)}`))]}):null,ge.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 (",ge.length,")"]}),ge.map(Te=>c.jsx(yg,{r:Te,nowMs:q,blurPreviews:g,modelsByKey:f,postworkInfoOf:de,stopRequestedIds:Z,markStopRequested:le,onOpenPlayer:t,onStopJob:i,onToggleFavorite:a,onToggleLike:l,onToggleWatch:u},`wa:${Te.kind==="job"?Te.job.id:Zl(Te.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 N_(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 D_=(n,e)=>c.jsx("span",{className:rn("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 n6(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 ef(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 i6(n){return String(n??"").trim().toLowerCase().replace(/^www\./,"")}function r6(n){const t=String(n||"").replaceAll("\\","/").split("/");return t[t.length-1]||""}function s6(n){const e=String(n||"");return e.toUpperCase().startsWith("HOT ")?e.slice(4).trim():e}function a6(n){const e=r6(n||""),t=s6(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 tf(n){if(n.isUrl&&/^https?:\/\//i.test(String(n.input??"")))return String(n.input);const e=i6(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 M_(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 j_({title:n,active:e,hiddenUntilHover:t,onClick:i,icon:a}){return c.jsx("span",{className:rn(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:rn("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 R_(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 O_(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 L_(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 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:"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 B_(){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 o6(){const[n,e]=p.useState([]),t=p.useRef({}),[i,a]=p.useState(!1),[l,u]=p.useState(null),[h,f]=p.useState(""),[g,_]=p.useState(1),S=10,[C,M]=p.useState("gallery"),[L,E]=p.useState([]),[B,G]=p.useState({}),[Q,H]=p.useState(!1),[se,Y]=p.useState({key:"createdAt",direction:"desc"}),W=p.useCallback(async()=>{H(!0);try{const fe=await fetch("/api/record/done?all=1&includeKeep=1",{cache:"no-store"});if(!fe.ok)return;const He=await fe.json().catch(()=>null),Ce=Array.isArray(He?.items)?He.items:Array.isArray(He)?He:[],De={};for(const Ie of Ce){const Qe=a6(Ie.output);if(!Qe||Qe==="—")continue;const Et=Qe.trim().toLowerCase();Et&&(De[Et]=(De[Et]??0)+1)}G(De)}finally{H(!1)}},[]),O=p.useMemo(()=>new Set(L.map(fe=>fe.toLowerCase())),[L]),ae=p.useCallback(fe=>{const He=fe.toLowerCase();E(Ce=>Ce.some(Ie=>Ie.toLowerCase()===He)?Ce.filter(Ie=>Ie.toLowerCase()!==He):[...Ce,fe])},[]),k=p.useCallback(()=>E([]),[]);p.useEffect(()=>{const fe=He=>{const Ce=He,De=Array.isArray(Ce.detail?.tags)?Ce.detail.tags:[];E(De)};return window.addEventListener("models:set-tag-filter",fe),()=>window.removeEventListener("models:set-tag-filter",fe)},[]),p.useEffect(()=>{try{const fe=localStorage.getItem("models_pendingTags");if(!fe)return;const He=JSON.parse(fe);Array.isArray(He)&&E(He),localStorage.removeItem("models_pendingTags")}catch{}},[]),p.useEffect(()=>{try{const fe=localStorage.getItem("models_viewMode");(fe==="table"||fe==="gallery")&&M(fe)}catch{}},[]),p.useEffect(()=>{try{localStorage.setItem("models_viewMode",C)}catch{}},[C]);const[j,Z]=p.useState(""),[V,te]=p.useState(null),[me,le]=p.useState(null),[q,F]=p.useState(!1),[ee,ie]=p.useState(!1),[de,I]=p.useState(null),[pe,we]=p.useState(null),[ve,ge]=p.useState("favorite"),[ht,Ge]=p.useState(!1),[Te,Le]=p.useState(null);async function ut(){if(de){Ge(!0),we(null),u(null);try{const fe=new FormData;fe.append("file",de),fe.append("kind",ve);const He=await fetch("/api/models/import",{method:"POST",body:fe});if(!He.ok)throw new Error(await He.text());const Ce=await He.json();we(`✅ Import: ${Ce.inserted} neu, ${Ce.updated} aktualisiert, ${Ce.skipped} übersprungen`),ie(!1),I(null),await Ke(),window.dispatchEvent(new Event("models-changed"))}catch(fe){Le(fe?.message??String(fe))}finally{Ge(!1)}}}function Oe(fe){const He=tf(fe)??void 0;return{output:`${fe.modelKey}_01_01_2000__00-00-00.mp4`,sourceUrl:He}}const _e=()=>{Le(null),we(null),I(null),ge("favorite"),ie(!0)},Ke=p.useCallback(async()=>{a(!0),u(null);try{const fe=await fetch("/api/models",{cache:"no-store"});if(!fe.ok)throw new Error(await fe.text().catch(()=>`HTTP ${fe.status}`));const He=await fe.json().catch(()=>null),Ce=Array.isArray(He?.items)?He.items:Array.isArray(He)?He:[];e(Ce),W()}catch(fe){u(fe?.message??String(fe))}finally{a(!1)}},[W]);p.useEffect(()=>{W()},[W]),p.useEffect(()=>{Ke()},[Ke]),p.useEffect(()=>{const fe=He=>{const De=He?.detail??{};if(De?.model){const Ie=De.model;e(Qe=>{const Et=Qe.findIndex(vt=>vt.id===Ie.id);if(Et===-1)return[Ie,...Qe];const It=Qe.slice();return It[Et]=Ie,It});return}if(De?.removed&&De?.id){const Ie=String(De.id);e(Qe=>Qe.filter(Et=>Et.id!==Ie));return}Ke()};return window.addEventListener("models-changed",fe),()=>window.removeEventListener("models-changed",fe)},[Ke]),p.useEffect(()=>{const fe=j.trim();if(!fe){te(null),le(null);return}const He=n6(fe);if(!He){te(null),le("Bitte nur gültige http(s) URLs einfügen (keine Modelnamen).");return}const Ce=window.setTimeout(async()=>{try{const De=await N_("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:He})});if(!De?.isUrl){te(null),le("Bitte nur URLs einfügen (keine Modelnamen).");return}te(De),le(null)}catch(De){te(null),le(De?.message??String(De))}},300);return()=>window.clearTimeout(Ce)},[j]);const Je=p.useMemo(()=>n.map(fe=>({m:fe,hay:`${fe.modelKey} ${fe.host??""} ${fe.input??""} ${fe.tags??""}`.toLowerCase()})),[n]),bt=p.useDeferredValue(h);async function ft(fe,He){if(u(null),t.current[fe])return;t.current[fe]=!0;const Ce=n.find(De=>De.id===fe)??null;if(Ce){const De={...Ce,...He};typeof He?.watched=="boolean"&&(De.watching=He.watched),He?.favorite===!0&&(De.liked=!1),He?.liked===!0&&(De.favorite=!1),e(Ie=>Ie.map(Qe=>Qe.id===fe?De:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:De}}))}try{const De=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:fe,...He})});if(De.status===204){e(Qe=>Qe.filter(Et=>Et.id!==fe)),Ce?window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:Ce.id,modelKey:Ce.modelKey}})):window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:fe}}));return}if(!De.ok){const Qe=await De.text().catch(()=>"");throw new Error(Qe||`HTTP ${De.status}`)}const Ie=await De.json();e(Qe=>{const Et=Qe.findIndex(vt=>vt.id===Ie.id);if(Et===-1)return Qe;const It=Qe.slice();return It[Et]=Ie,It}),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ie}}))}catch(De){Ce&&(e(Ie=>Ie.map(Qe=>Qe.id===fe?Ce:Qe)),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Ce}}))),u(De?.message??String(De))}finally{delete t.current[fe]}}const kt=p.useMemo(()=>[{key:"statusAll",header:"Status",align:"center",cell:fe=>{const He=fe.liked===!0,Ce=fe.favorite===!0,De=fe.watching===!0,Ie=!De&&!Ce&&!He;return c.jsxs("div",{className:"group flex items-center justify-center gap-1 w-[110px]",children:[c.jsx("span",{className:rn(Ie&&!De?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100"),children:c.jsx(en,{variant:De?"soft":"secondary",size:"xs",className:rn("px-2 py-1 leading-none",!De&&"bg-transparent shadow-none hover:bg-gray-50 dark:hover:bg-white/10"),title:De?"Nicht mehr beobachten":"Beobachten",onClick:Qe=>{Qe.stopPropagation(),ft(fe.id,{watched:!De})},children:c.jsx("span",{className:rn("text-base leading-none",De?"text-indigo-600 dark:text-indigo-400":"text-gray-400 dark:text-gray-500"),children:"👁"})})}),c.jsx(j_,{title:Ce?"Favorit entfernen":"Als Favorit markieren",active:Ce,hiddenUntilHover:Ie,onClick:Qe=>{Qe.stopPropagation(),Ce?ft(fe.id,{favorite:!1}):ft(fe.id,{favorite:!0,liked:!1})},icon:c.jsx("span",{className:Ce?"text-amber-500":"text-gray-400 dark:text-gray-500",children:"★"})}),c.jsx(j_,{title:He?"Gefällt mir entfernen":"Gefällt mir",active:He,hiddenUntilHover:Ie,onClick:Qe=>{Qe.stopPropagation(),He?ft(fe.id,{liked:!1}):ft(fe.id,{liked:!0,favorite:!1})},icon:c.jsx("span",{className:He?"text-rose-500":"text-gray-400 dark:text-gray-500",children:"♥"})})]})}},{key:"model",header:"Model",sortable:!0,sortValue:fe=>(fe.modelKey||"").toLowerCase(),cell:fe=>{const He=tf(fe),Ce=M_(fe);return c.jsx("div",{className:"min-w-0",children:c.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[c.jsx("div",{className:"shrink-0 mt-0.5",children:Ce?c.jsx("img",{src:Ce,alt:fe.modelKey,loading:"lazy",className:"w-10 h-10 rounded-full object-cover bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10",onClick:De=>{De.stopPropagation(),He&&window.open(He,"_blank","noreferrer")},onError:De=>{De.currentTarget.style.display="none"}}):c.jsx("div",{className:"w-10 h-10 rounded-full bg-gray-100 dark:bg-white/10 ring-1 ring-gray-200 dark:ring-white/10 flex items-center justify-center text-xs text-gray-500 dark:text-gray-400",children:String(fe.modelKey||"?").slice(0,1).toUpperCase()})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx("div",{className:"font-medium truncate",children:fe.modelKey}),He?c.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",title:He,onClick:De=>{De.stopPropagation(),window.open(He,"_blank","noreferrer")},children:"↗"}):null]}),c.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:fe.host??"—"}),He?c.jsx("div",{className:"text-xs text-indigo-600 dark:text-indigo-400 truncate max-w-[520px]",children:He}):null]})]})})}},{key:"videos",header:"Videos",sortable:!0,sortValue:fe=>{const He=String(fe.modelKey||"").trim().toLowerCase(),Ce=B[He];return typeof Ce=="number"?Ce:0},align:"right",cell:fe=>{const He=String(fe.modelKey||"").trim().toLowerCase(),Ce=B[He];return c.jsx("span",{className:"tabular-nums text-sm text-gray-900 dark:text-white w-[64px] inline-block text-right",children:typeof Ce=="number"?Ce:Q?"…":0})}},{key:"tags",header:"Tags",sortable:!0,sortValue:fe=>ef(fe.tags).length,cell:fe=>{const He=ef(fe.tags),Ce=He.slice(0,6),De=He.length-Ce.length,Ie=He.join(", ");return c.jsxs("div",{className:"flex flex-wrap gap-2 max-w-[520px]",title:Ie||void 0,children:[fe.hot?D_(!0,"🔥 HOT"):null,fe.keep?D_(!0,"📌 Behalten"):null,Ce.map(Qe=>c.jsx(ps,{tag:Qe,title:Qe,active:O.has(Qe.toLowerCase()),onClick:ae},Qe)),De>0?c.jsxs(ps,{title:Ie,children:["+",De]}):null,!fe.hot&&!fe.keep&&He.length===0?c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"}):null]})}},{key:"createdAt",header:"Hinzugefügt",sortable:!0,sortValue:fe=>{const He=Date.parse(String(fe.createdAt??""));return Number.isFinite(He)?He:0},widthClassName:"w-[160px]",cell:fe=>{const He=Date.parse(String(fe.createdAt??""));if(!Number.isFinite(He)||He<=0)return c.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"—"});const Ce=new Date(He);return c.jsxs("div",{className:"text-xs text-gray-700 dark:text-gray-300 leading-tight",children:[c.jsx("div",{className:"tabular-nums",children:Ce.toLocaleDateString("de-DE")}),c.jsx("div",{className:"tabular-nums text-gray-500 dark:text-gray-400",children:Ce.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})})]})}},{key:"actions",header:"",align:"right",cell:fe=>c.jsx("div",{className:"flex justify-end w-[92px]",children:c.jsx(Ds,{job:Oe(fe),variant:"table",order:["add","details"],className:"flex items-center gap-2"})})}],[O,ae,B,Q]),Pe=p.useMemo(()=>{const fe=bt.trim().toLowerCase(),He=fe?Je.filter(Ce=>Ce.hay.includes(fe)).map(Ce=>Ce.m):n;return O.size===0?He:He.filter(Ce=>{const De=ef(Ce.tags);if(De.length===0)return!1;const Ie=new Set(De.map(Qe=>Qe.toLowerCase()));for(const Qe of O)if(!Ie.has(Qe))return!1;return!0})},[n,Je,bt,O]),Xe=p.useMemo(()=>{if(!se)return Pe;const fe=kt.find(De=>De.key===se.key);if(!fe)return Pe;const He=se.direction==="asc"?1:-1,Ce=Pe.map((De,Ie)=>({r:De,i:Ie}));return Ce.sort((De,Ie)=>{let Qe=0;if(fe.sortFn)Qe=fe.sortFn(De.r,Ie.r);else{const Et=fe.sortValue?fe.sortValue(De.r):De.r?.[fe.key],It=fe.sortValue?fe.sortValue(Ie.r):Ie.r?.[fe.key],vt=R_(Et),Yt=R_(It);vt.isNull&&!Yt.isNull?Qe=1:!vt.isNull&&Yt.isNull?Qe=-1:vt.kind==="number"&&Yt.kind==="number"?Qe=vt.value<Yt.value?-1:vt.value>Yt.value?1:0:Qe=String(vt.value).localeCompare(String(Yt.value),void 0,{numeric:!0})}return Qe===0?De.i-Ie.i:Qe*He}),Ce.map(De=>De.r)},[Pe,se,kt]);p.useEffect(()=>{_(1)},[h,L,C,se]);const st=Xe.length,Ze=p.useMemo(()=>Math.max(1,Math.ceil(st/S)),[st,S]);p.useEffect(()=>{g>Ze&&_(Ze)},[g,Ze]);const nt=p.useMemo(()=>{const fe=(g-1)*S;return Xe.slice(fe,fe+S)},[Xe,g,S]),wt=async()=>{if(V){if(!V.isUrl){le("Bitte nur URLs einfügen (keine Modelnamen).");return}F(!0),u(null);try{const fe=await N_("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});e(He=>{const Ce=He.filter(De=>De.id!==fe.id);return[fe,...Ce]}),Z(""),te(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:fe}}))}catch(fe){u(fe?.message??String(fe))}finally{F(!1)}}};return c.jsxs("div",{className:"space-y-4",children:[c.jsx(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:fe=>Z(fe.target.value),placeholder:"https://…",className:"flex-1 rounded-md px-3 py-2 text-sm bg-white text-gray-900 dark:bg-white/10 dark:text-white"}),c.jsx(en,{className:"px-3 py-2 text-sm",onClick:wt,disabled:!V||q,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:Ke,disabled:i,children:"Aktualisieren"})]}),me?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:me}):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:["(",Pe.length,")"]})]}),c.jsx("div",{className:"sm:hidden shrink-0",children:c.jsx(en,{variant:"secondary",size:"md",onClick:_e,children:"Import"})}),c.jsx("div",{className:"hidden sm:block shrink-0",children:c.jsx(en,{variant:"secondary",size:"md",onClick:_e,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(Lg,{ariaLabel:"Ansicht umschalten",size:"lg",className:"flex w-full [&>button]:flex-1 [&>button]:min-w-0",value:C,onChange:fe=>{(fe==="table"||fe==="gallery")&&M(fe)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(I_,{})},{id:"table",label:"Tabelle",icon:c.jsx(B_,{})}]})}),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:O_(se),onChange:fe=>{const He=L_(fe.target.value);Y(He)},className:`\r
|
||
h-9 w-full min-w-0\r
|
||
rounded-md px-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10 dark:[color-scheme:dark]\r
|
||
`,children:[c.jsx("option",{value:"created_desc",children:"Hinzugefügt ↓"}),c.jsx("option",{value:"created_asc",children:"Hinzugefügt ↑"}),c.jsx("option",{value:"model_asc",children:"Model A→Z"}),c.jsx("option",{value:"model_desc",children:"Model Z→A"}),c.jsx("option",{value:"videos_desc",children:"Videos ↓"}),c.jsx("option",{value:"videos_asc",children:"Videos ↑"}),c.jsx("option",{value:"tags_desc",children:"Tags ↓"}),c.jsx("option",{value:"tags_asc",children:"Tags ↑"})]})]}):c.jsx("div",{"aria-hidden":"true",className:`\r
|
||
h-9 w-full min-w-0\r
|
||
rounded-md px-3 text-sm\r
|
||
inline-flex items-center\r
|
||
bg-gray-50 text-gray-400 ring-1 ring-gray-200\r
|
||
dark:bg-white/5 dark:text-white/30 dark:ring-white/10\r
|
||
select-none\r
|
||
`,title:"Sortierung in der Tabellenansicht über Spaltenkopf",children:"Sortierung"})})]}),c.jsx("input",{value:h,onChange:fe=>f(fe.target.value),placeholder:"Suchen…",className:`\r
|
||
w-full min-w-0\r
|
||
rounded-md px-3 py-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10\r
|
||
`})]}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 min-w-0 sm:justify-end",children:[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:O_(se),onChange:fe=>{const He=L_(fe.target.value);Y(He)},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(Lg,{ariaLabel:"Ansicht umschalten",size:"lg",value:C,onChange:fe=>{(fe==="table"||fe==="gallery")&&M(fe)},items:[{id:"gallery",label:"Gallery",icon:c.jsx(I_,{})},{id:"table",label:"Tabelle",icon:c.jsx(B_,{})}]})}),c.jsx("input",{value:h,onChange:fe=>f(fe.target.value),placeholder:"Suchen…",className:`\r
|
||
w-full sm:w-[260px]\r
|
||
rounded-md px-3 py-2 text-sm\r
|
||
bg-white text-gray-900 shadow-sm ring-1 ring-gray-200\r
|
||
focus:outline-none focus:ring-2 focus:ring-indigo-500\r
|
||
dark:bg-white/10 dark:text-white dark:ring-white/10\r
|
||
`})]})]})]}),L.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:[L.map(fe=>c.jsx(ps,{tag:fe,active:!0,onClick:ae,title:fe},fe)),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(ed,{rows:nt,columns:kt,getRowKey:fe=>fe.id,striped:!0,compact:!0,fullWidth:!0,stickyHeader:!0,sort:se,onSortChange:fe=>Y(fe),onRowClick:fe=>{const He=tf(fe);He&&window.open(He,"_blank","noreferrer")}})})}),c.jsx(Sf,{page:g,pageSize:S,totalItems:st,onPageChange:_})]}):c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"p-2 sm:p-3",children:nt.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:nt.map(fe=>{const He=tf(fe),Ce=M_(fe),De=ef(fe.tags),Ie=De.slice(0,3),Qe=fe.liked===!0,Et=fe.favorite===!0,It=fe.watching===!0,vt=!It&&!Et&&!Qe,Yt=B[String(fe.modelKey||"").trim().toLowerCase()]??0,Ft=String(fe.modelKey||"?"),zt=Ft.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:()=>{He&&window.open(He,"_blank","noreferrer")},children:c.jsxs("div",{className:"relative aspect-[3/4] w-full overflow-hidden bg-[#12202c]",children:[Ce?c.jsx("img",{src:Ce,alt:fe.modelKey,loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]",onError:At=>{At.currentTarget.style.display="none";const Nt=At.currentTarget.nextElementSibling;Nt&&(Nt.style.display="flex")}}):null,c.jsx("div",{className:rn("absolute inset-0 items-center justify-center px-3 text-center font-semibold text-slate-500 leading-tight",Ce?"hidden":"flex"),style:{display:Ce?"none":"flex",fontSize:zt<=10?"clamp(1rem, 1.4vw + 0.4rem, 2.1rem)":zt<=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:Ft,children:Ft}),c.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-black/70 via-black/20 to-transparent"}),c.jsxs("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 p-2.5 pr-18 sm:pr-2.5",children:[c.jsx("div",{className:"truncate text-sm font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:fe.modelKey,children:fe.modelKey}),fe.host?c.jsx("div",{className:"truncate text-[11px] text-white/70 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:fe.host}):null]}),c.jsxs("div",{className:"pointer-events-none absolute bottom-2 right-2 z-10 flex flex-col items-end gap-1",children:[c.jsxs("span",{className:"inline-flex items-center gap-1 px-0.5 py-0 text-[10px] font-semibold text-white/95 tabular-nums",title:"Videos","aria-hidden":"true",children:[c.jsx("span",{className:"text-[11px] leading-none drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"🎬"}),c.jsx("span",{className:"drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:Q?"…":Yt})]}),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:De.length})]})]}),c.jsx("div",{className:rn("absolute left-2 z-10 flex items-center gap-1",fe.hot||fe.keep?"top-12":"top-2"),onClick:At=>At.stopPropagation(),children:c.jsx(Ds,{job:Oe(fe),variant:"table",order:["add","details"],className:`\r
|
||
flex items-center gap-1\r
|
||
[&_button]:h-7 [&_button]:w-7 [&_button]:min-w-0 [&_button]:p-0\r
|
||
[&_button]:bg-transparent [&_button]:shadow-none\r
|
||
[&_button:hover]:bg-white/10\r
|
||
[&_button]:border-0\r
|
||
[&_button_svg]:drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]\r
|
||
`})}),c.jsxs("div",{className:"absolute right-2 top-2 flex items-center gap-1.5 pointer-events-none select-none",children:[It?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,Et?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-amber-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Favorit","aria-hidden":"true",children:"★"}):null,Qe?c.jsx("span",{className:"inline-flex items-center justify-center text-xl leading-none text-rose-300 drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",title:"Gefällt mir","aria-hidden":"true",children:"♥"}):null]}),(fe.hot||fe.keep)&&c.jsxs("div",{className:"absolute left-2 top-2 flex flex-col gap-1",children:[fe.hot?c.jsx("span",{className:"rounded bg-amber-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"HOT"}):null,fe.keep?c.jsx("span",{className:"rounded bg-indigo-500/90 px-1.5 py-0.5 text-[10px] font-semibold text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.9)]",children:"KEEP"}):null]})]})}),c.jsxs("div",{className:"border-t border-white/5 bg-slate-800/70 px-2.5 py-2 rounded-b-md flex-1",children:[c.jsxs("div",{className:"sm:hidden",children:[c.jsxs("div",{className:"grid grid-cols-3 gap-1.5",onClick:At=>At.stopPropagation(),children:[c.jsx(en,{variant:It?"soft":"secondary",size:"xs",className:rn("h-8 min-w-0 px-0 shadow-none",It?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:It?"Nicht mehr beobachten":"Beobachten",onClick:At=>{At.stopPropagation(),ft(fe.id,{watched:!It})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("text-xl leading-none",It?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(en,{variant:Et?"soft":"secondary",size:"xs",className:rn("h-8 min-w-0 px-0 shadow-none",Et?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Et?"Favorit entfernen":"Als Favorit markieren",onClick:At=>{At.stopPropagation(),Et?ft(fe.id,{favorite:!1}):ft(fe.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("text-xl leading-none",Et?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(en,{variant:Qe?"soft":"secondary",size:"xs",className:rn("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:At=>{At.stopPropagation(),Qe?ft(fe.id,{liked:!1}):ft(fe.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("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:Ie.length>0?Ie.map(At=>c.jsx(ps,{tag:At,title:At,active:O.has(At.toLowerCase()),onClick:ae},`${fe.id}:${At}`)):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:At=>At.stopPropagation(),children:c.jsxs("div",{className:"grid grid-cols-3 gap-1.5 w-full",children:[c.jsx(en,{variant:It?"soft":"secondary",size:"xs",className:rn("h-8 min-w-0 px-0 shadow-none",vt&&!It?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",It?"bg-indigo-500/20 text-indigo-200 hover:bg-indigo-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:It?"Nicht mehr beobachten":"Beobachten",onClick:At=>{At.stopPropagation(),ft(fe.id,{watched:!It})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("text-xl leading-none",It?"text-indigo-300":"text-slate-300"),children:"👁"})})}),c.jsx(en,{variant:Et?"soft":"secondary",size:"xs",className:rn("h-8 min-w-0 px-0 shadow-none",vt&&!Et?"opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto transition-opacity":"opacity-100",Et?"bg-amber-500/20 text-amber-200 hover:bg-amber-500/30":"bg-white/5 text-slate-200 hover:bg-white/10"),title:Et?"Favorit entfernen":"Als Favorit markieren",onClick:At=>{At.stopPropagation(),Et?ft(fe.id,{favorite:!1}):ft(fe.id,{favorite:!0,liked:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("text-xl leading-none",Et?"text-amber-300":"text-slate-300"),children:"★"})})}),c.jsx(en,{variant:Qe?"soft":"secondary",size:"xs",className:rn("h-8 min-w-0 px-0 shadow-none",vt&&!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:At=>{At.stopPropagation(),Qe?ft(fe.id,{liked:!1}):ft(fe.id,{liked:!0,favorite:!1})},children:c.jsx("span",{className:"inline-flex items-center justify-center gap-1",children:c.jsx("span",{className:rn("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:Ie.length>0?Ie.map(At=>c.jsx(ps,{tag:At,title:At,active:O.has(At.toLowerCase()),onClick:ae},`${fe.id}:${At}`)):c.jsx("span",{className:"opacity-0 select-none pointer-events-none text-[11px]",children:"placeholder"})})]})]})]},fe.id)})})}),c.jsx(Sf,{page:g,pageSize:S,totalItems:st,onPageChange:_})]})}),c.jsx(wf,{open:ee,onClose:()=>!ht&&ie(!1),title:"Models importieren",footer:c.jsxs(c.Fragment,{children:[c.jsx(en,{variant:"secondary",onClick:()=>ie(!1),disabled:ht,children:"Abbrechen"}),c.jsx(en,{variant:"primary",onClick:ut,isLoading:ht,disabled:!de||ht,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:ve==="favorite",onChange:()=>ge("favorite"),disabled:ht}),"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:ve==="liked",onChange:()=>ge("liked"),disabled:ht}),"Gefällt mir (♥)"]})]})]}),c.jsx("input",{type:"file",accept:".csv,text/csv",onChange:fe=>{const He=fe.target.files?.[0]??null;Le(null),I(He)},className:"block w-full text-sm text-gray-700 file:mr-4 file:rounded-md file:border-0 file:bg-gray-100 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-gray-900 hover:file:bg-gray-200 dark:text-gray-200 dark:file:bg-white/10 dark:file:text-white dark:hover:file:bg-white/20"}),de?c.jsxs("div",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Ausgewählt: ",c.jsx("span",{className:"font-medium",children:de.name})]}):null,Te?c.jsx("div",{className:"text-xs text-red-600 dark:text-red-300",children:Te}):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 ni(...n){return n.filter(Boolean).join(" ")}function vg(n){const e=String(n?.status??"").toLowerCase();return!!!(n?.endedAt??n?.completedAt)&&(e==="running"||e==="postwork")}const l6=600*1e3,u6=new Map,P_=new Map;function nf(n){return Number.isFinite(n)&&Date.now()-n<=l6}function F_(n){try{if(typeof window>"u")return null;const e=window.sessionStorage.getItem(n);return e?JSON.parse(e):null}catch{return null}}function c6(n,e){try{if(typeof window>"u")return;window.sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function d6(n){return`md:cb:online:${n}`}function U_(n){return`md:cb:bio:${n}`}const h6=new Intl.NumberFormat("de-DE");function el(n){return n==null||!Number.isFinite(n)?"—":h6.format(n)}function f6(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 xg(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 Uc(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 m6(n){return n?n.split(",").map(e=>e.trim()).filter(Boolean):[]}function vo(n){return(n||"").split(/[\\/]/).pop()||""}function p6(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 cy(n){return String(n||"").startsWith("HOT ")}function g6(n,e){const t=String(n||"");return t&&t.replace(/([\\/])[^\\/]*$/,`$1${e}`)}function y6(n){return cy(n)?wo(n):`HOT ${n}`}function b6(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 z_(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 H_(n){const e=String(n??"").trim();if(!e)return"";const t=mf(e);return t.length>2e3?t.slice(0,2e3)+"…":t}function v6(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 ni("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ring-1 ring-inset",n)}const rf=n=>n?"blur-md scale-[1.03] brightness-90":"";function sf(...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 eu(n){if(!(typeof n!="number"||!Number.isFinite(n)||n<=0))return n>1440*60?n/1e3:n}function af(n,e,t){return Math.max(e,Math.min(t,n))}const q_=5;function V_(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 x6(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 _6(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 w6({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:M,onKeep:L,onStopJob:E}){const[B,G]=p.useState([]),[Q,H]=p.useState(null),[se,Y]=p.useState(null),[W,O]=p.useState(null),[ae,k]=p.useState(null),[j,Z]=p.useState(!1),[V,te]=p.useState([]),[me,le]=p.useState(!1),[q,F]=p.useState([]),[ee,ie]=p.useState(!1),de=p.useRef(0),[,I]=p.useState(0),[pe,we]=p.useState(null),[,ve]=p.useState(!1),[ge,ht]=p.useState(!1),[Ge,Te]=p.useState(0),[Le,ut]=p.useState(1),Oe=4,_e=x6(e),[Ke,Je]=p.useState("info"),bt=p.useRef(null),[ft,kt]=p.useState({}),[Pe,Xe]=p.useState(null),[st,Ze]=p.useState(null),[nt,wt]=p.useState(null),[fe,He]=p.useState({}),[Ce,De]=p.useState(null),Ie=p.useCallback(xe=>String(xe??"").toLowerCase(),[]),Qe=p.useMemo(()=>new Set,[]),Et=p.useMemo(()=>new Set,[]),It=p.useMemo(()=>new Set,[]),vt=p.useMemo(()=>new Set,[]);p.useEffect(()=>{if(!n||!_e)return;const xe=u6.get(_e),it=F_(d6(_e)),mt=(xe&&nf(xe.at)?xe:null)||(it&&nf(it.at)?it:null);mt&&(H(mt.room??null),Y(mt.meta??null));const Rt=P_.get(_e),Ne=F_(U_(_e)),pt=(Rt&&nf(Rt.at)?Rt:null)||(Ne&&nf(Ne.at)?Ne:null);pt&&(O(pt.bio??null),k(pt.meta??null))},[n,_e]),p.useEffect(()=>{n&&ht(!1)},[n,_e]);const Yt=p.useCallback(async()=>{if(!_e)return;bt.current?.abort();const xe=new AbortController;bt.current=xe,Z(!0);try{const it=_6(a),mt=`/api/chaturbate/biocontext?model=${encodeURIComponent(_e)}&refresh=1`,Rt=await fetch(mt,{cache:"no-store",signal:xe.signal,headers:it?{"X-Chaturbate-Cookie":it}:void 0});if(!Rt.ok){const Pt=await Rt.text().catch(()=>"");throw new Error(Pt||`HTTP ${Rt.status}`)}const Ne=await Rt.json().catch(()=>null),pt={enabled:Ne?.enabled,fetchedAt:Ne?.fetchedAt,lastError:Ne?.lastError},xt=Ne?.bio??null;k(pt),O(xt);const St={at:Date.now(),bio:xt,meta:pt};P_.set(_e,St),c6(U_(_e),St)}catch(it){if(it?.name==="AbortError")return;k({enabled:void 0,fetchedAt:void 0,lastError:it?.message||"Fetch fehlgeschlagen"})}finally{Z(!1)}},[_e,a]);p.useEffect(()=>{n||(bt.current?.abort(),bt.current=null)},[n]);const Ft=p.useCallback(async()=>{try{const it=await(await fetch("/api/models",{cache:"no-store"})).json().catch(()=>null);G(Array.isArray(it)?it:[])}catch{}},[]),zt=p.useCallback(async()=>{if(_e){le(!0);try{const xe=`/api/record/done?model=${encodeURIComponent(_e)}&page=${Le}&pageSize=${Oe}&sort=completed_desc&includeKeep=1&withCount=1`,mt=await(await fetch(xe,{cache:"no-store"})).json().catch(()=>null),Rt=Array.isArray(mt?.items)?mt.items:[],Ne=Number(mt?.count??Rt.length);te(Rt),Te(Number.isFinite(Ne)?Ne:Rt.length)}catch{}finally{le(!1)}}},[_e,Le]),At=p.useRef(zt);p.useEffect(()=>{At.current=zt},[zt]),p.useEffect(()=>{if(!n)return;const xe=new EventSource("/api/stream"),it=()=>{},mt=()=>{At.current()};return xe.addEventListener("jobs",it),xe.addEventListener("doneChanged",mt),()=>{xe.removeEventListener("jobs",it),xe.removeEventListener("doneChanged",mt),xe.close()}},[n]);function Nt(xe){return{id:`model:${xe}`,output:`${xe}_01_01_2000__00-00-00.mp4`,status:"finished"}}const ln=p.useCallback((xe,it)=>{const mt=String(xe??"").trim();mt&&we({src:mt,alt:it})},[]);p.useEffect(()=>{n||I(0)},[n]);const dn=p.useMemo(()=>Array.isArray(l)?l:q,[l,q]);p.useEffect(()=>{n&&ut(1)},[n,e]),p.useEffect(()=>{n&&Ft()},[n,Ft]),p.useEffect(()=>{!n||!_e||zt()},[n,_e,zt]),p.useEffect(()=>{if(!n||Array.isArray(l))return;const xe=new AbortController,it=++de.current;return ie(!0),fetch("/api/record/jobs",{cache:"no-store",signal:xe.signal}).then(mt=>mt.json()).then(mt=>{xe.signal.aborted||de.current===it&&F(Array.isArray(mt)?mt:[])}).catch(()=>{xe.signal.aborted||de.current===it&&F([])}).finally(()=>{xe.signal.aborted||de.current===it&&ie(!1)}),()=>{xe.abort()}},[n,l]);const yt=p.useMemo(()=>_e?B.find(xe=>(xe.modelKey||"").toLowerCase()===_e)??null:null,[B,_e]),Fn=p.useMemo(()=>{const xe=yt?.cbOnlineJson;if(!xe||typeof xe!="string")return null;try{return JSON.parse(xe)}catch{return null}},[yt]),ot=p.useMemo(()=>{const xe=yt?.cbOnlineFetchedAt,it=yt?.cbOnlineLastError;return!xe&&!it?null:{enabled:!0,fetchedAt:xe,lastError:it}},[yt]),N=Q??Fn,P=se??ot,ne=V,je=p.useMemo(()=>_e?dn.filter(xe=>{const it=b6(xe.output);return it!=="—"&&it.trim().toLowerCase()===_e}):[],[dn,_e]),qe=N?.display_name||yt?.modelKey||_e||"Model",dt=N?.image_url_360x270||N?.image_url||"",$t=N?.image_url||dt,Zt=N?.chat_room_url_revshare||N?.chat_room_url||"",hn=(N?.current_show||"").trim().toLowerCase(),Qt=hn?hn==="public"?"Public":hn==="private"?"Private":hn:"",vn=(W?.location||"").trim(),Tn=W?.follower_count,Wt=W?.display_age,gn=(W?.room_status||"").trim(),sn=W?.last_broadcast?Uc(W.last_broadcast):"—",an=mf(W?.about_me),Bt=mf(W?.wish_list),Dt=yt?.lastSeenOnline==null?"":yt.lastSeenOnline?"online":"offline",jt=(gn||hn||Dt||"").trim(),Dn=Array.isArray(W?.social_medias)?W.social_medias:[],Mt=Array.isArray(W?.photo_sets)?W.photo_sets:[],Hn=Array.isArray(W?.interested_in)?W.interested_in:[],In=p.useMemo(()=>{const xe=m6(yt?.tags),it=Array.isArray(N?.tags)?N.tags:[],mt=new Map;for(const Rt of[...xe,...it]){const Ne=String(Rt).trim().toLowerCase();Ne&&(mt.has(Ne)||mt.set(Ne,String(Rt).trim()))}return Array.from(mt.values()).sort((Rt,Ne)=>Rt.localeCompare(Ne,"de"))},[yt?.tags,N?.tags]),Sn=({icon:xe,label:it,value:mt})=>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:[xe,it]}),c.jsx("div",{className:"mt-0.5 text-sm font-semibold text-gray-900 dark:text-white",children:mt})]}),Xt=p.useCallback(xe=>{const it=String(xe?.id??""),mt=String(xe.output??"");return it?`${it}::${mt}`:mt},[]),Un=p.useCallback(async xe=>{const it=xe.output||"",mt=vo(it);if(!mt){await C?.(xe);return}const Rt=y6(mt);te(Ne=>Ne.map(pt=>pt.id&&xe.id&&pt.id===xe.id||pt.output&&xe.output&&pt.output===xe.output?{...pt,output:g6(pt.output||"",Rt)}:pt)),await C?.(xe),zt()},[C,zt]),Yn=p.useCallback((xe,it,mt)=>{const Rt=xe?.meta,Ne=typeof Rt=="string"?(()=>{try{return JSON.parse(Rt)}catch{return null}})():Rt,pt=typeof Ne?.previewSprite?.stepSeconds=="number"&&Number.isFinite(Ne.previewSprite.stepSeconds)&&Ne.previewSprite.stepSeconds>0?Ne.previewSprite.stepSeconds:5,xt=Math.max(0,Math.floor(it)*pt);i?.(xe,xt)},[i]),Cn=p.useCallback(async()=>{_e&&(G(xe=>xe.map(it=>(it.modelKey||"").toLowerCase()===_e?{...it,favorite:!it.favorite}:it)),await _?.(Nt(_e)),Ft())},[_e,_,Ft]),ti=p.useCallback(async()=>{_e&&(G(xe=>xe.map(it=>(it.modelKey||"").toLowerCase()===_e?{...it,liked:it.liked!==!0}:it)),await S?.(Nt(_e)),Ft())},[_e,S,Ft]),wn=p.useCallback(async()=>{_e&&(G(xe=>xe.map(it=>(it.modelKey||"").toLowerCase()===_e?{...it,watching:!it.watching}:it)),await g?.(Nt(_e)),Ft())},[_e,g,Ft]);p.useEffect(()=>{n||(Xe(null),Ze(null),wt(null),De(null),He({}),kt({}))},[n,_e]);const ui=p.useCallback((xe,it)=>{const mt=Xt(xe);kt(Rt=>Rt[mt]===it?Rt:{...Rt,[mt]:it})},[Xt]),ri=p.useCallback(xe=>{Xe(xe),h==="hover"&&Ze(xe)},[h]),Qn=p.useCallback(xe=>{const it=Xt(xe),mt=xe?.durationSeconds??xe?.meta?.durationSeconds??ft[it],Rt=typeof mt=="number"&&Number.isFinite(mt)?mt>1440*60?mt/1e3:mt:null;return xg(Rt)},[ft,Xt]),Zn=p.useCallback(xe=>{const it=xe?.sizeBytes??xe?.size??xe?.meta?.sizeBytes??xe?.meta?.size;return typeof it=="number"&&Number.isFinite(it)?it:null},[]),xi=p.useCallback(xe=>f6(xe??null),[]),Mn=p.useCallback((xe,it)=>{He(mt=>{if(it===void 0){if(!(xe in mt))return mt;const Rt={...mt};return delete Rt[xe],Rt}return mt[xe]===it?mt:{...mt,[xe]:it}})},[]),jn=p.useCallback(xe=>Mn(xe,void 0),[Mn]);p.useEffect(()=>{n&&Je("info")},[n,_e]);const qn=[{id:"info",label:"Info"},{id:"downloads",label:"Downloads",count:Ge?el(Ge):void 0,disabled:me},{id:"running",label:"Running",count:je.length?el(je.length):void 0,disabled:ee}];return c.jsxs(wf,{open:n,onClose:t,title:qe,width:"max-w-6xl",layout:"split",scroll:"right",leftWidthClass:"lg:w-[320px]",mobileCollapsedImageSrc:dt||void 0,mobileCollapsedImageAlt:qe,rightBodyClassName:"pt-0 sm:pt-2",titleRight:Ke==="info"?c.jsx(en,{variant:"secondary",className:ni("h-8 px-2 sm:h-9 sm:px-3","whitespace-nowrap"),disabled:j||!e,onClick:()=>{Yt()},title:"BioContext neu abrufen",children:c.jsxs("span",{className:"inline-flex items-center gap-2",children:[c.jsx(DA,{className:ni("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:[dt?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>ln($t,qe),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:dt,alt:qe,className:ni("h-24 sm:h-52 w-full object-cover transition",rf(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:[Qt?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:Qt}):null,jt?c.jsx("span",{className:ss(jt.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:jt}):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||yt?.modelKey||_e||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:N?.username?`@${N.username}`:yt?.modelKey?`@${yt.modelKey}`:""})]}),c.jsxs("div",{className:"absolute bottom-3 right-3 flex items-center gap-2",children:[c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),wn()},className:ni("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",yt?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/20 ring-white/15"),title:yt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!yt?.watching,"aria-label":yt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(vf,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.watching?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(gl,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.watching?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),Cn()},className:ni("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",yt?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/20 ring-white/15"),title:yt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!yt?.favorite,"aria-label":yt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.favorite?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(bu,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.favorite?"opacity-100 scale-110 rotate-0":"opacity-0 scale-75 -rotate-12","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),ti()},className:ni("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",yt?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/20 ring-white/15"),title:yt?.liked?"Like entfernen":"Liken","aria-pressed":yt?.liked===!0,"aria-label":yt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(Jc,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.liked?"opacity-0 scale-75 rotate-12":"opacity-100 scale-100 rotate-0","text-white/70")}),c.jsx(yl,{className:ni("absolute inset-0 size-4 transition-all duration-200 ease-out motion-reduce:transition-none",yt?.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(Sn,{icon:c.jsx(O1,{className:"size-4"}),label:"Viewer",value:el(N?.num_users)}),c.jsx(Sn,{icon:c.jsx(C0,{className:"size-4"}),label:"Follower",value:el(N?.num_followers??Tn)})]}),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(sN,{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||vn||"—"})]}),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(eN,{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(E0,{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:xg(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(Jc,{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:Wt!=null?String(Wt):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(E0,{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:sn})]})]}),P?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):P?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:[c.jsxs("div",{className:"font-medium",children:["Online-Info: ",z_(P.lastError)]}),c.jsxs("details",{className:"mt-1",children:[c.jsx("summary",{className:"cursor-pointer select-none text-[11px] text-rose-900/80 underline underline-offset-2 dark:text-rose-200/80",children:"Details"}),c.jsx("pre",{className:"mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words rounded-md bg-black/5 p-2 text-[11px] leading-snug dark:bg-white/10",children:H_(P.lastError)})]})]}):null,ae?.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."}):ae?.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: ",ae.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"}),In.length?c.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:In.map(xe=>c.jsx(ps,{tag:xe},xe))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Tags vorhanden."})]})]})}),rightHeader:c.jsxs("div",{className:ni("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:[dt?c.jsx("button",{type:"button",className:"absolute inset-0 block w-full",onClick:()=>$t?ln($t,qe):void 0,"aria-label":"Bild vergrößern",children:c.jsx("img",{src:$t||dt,alt:qe,className:ni("h-full w-full object-cover",rf(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||yt?.modelKey||_e||"—"}),c.jsx("div",{className:"truncate text-xs text-white/85 drop-shadow",children:N?.username?`@${N.username}`:yt?.modelKey?`@${yt.modelKey}`:""})]}),c.jsxs("div",{className:"shrink-0 flex items-center gap-1.5",children:[c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),wn()},className:ni("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",yt?.watching?"bg-sky-500/25 ring-sky-200/30":"bg-black/30 ring-white/20"),title:yt?.watching?"Watch entfernen":"Auf Watch setzen","aria-pressed":!!yt?.watching,"aria-label":yt?.watching?"Watch entfernen":"Auf Watch setzen",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(vf,{className:ni("absolute inset-0 size-4","text-white/70")}),c.jsx(gl,{className:ni("absolute inset-0 size-4",yt?.watching?"opacity-100":"opacity-0","text-sky-200")})]})}),c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),Cn()},className:ni("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",yt?.favorite?"bg-amber-500/25 ring-amber-200/30":"bg-black/30 ring-white/20"),title:yt?.favorite?"Favorit entfernen":"Als Favorit markieren","aria-pressed":!!yt?.favorite,"aria-label":yt?.favorite?"Favorit entfernen":"Als Favorit markieren",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(xf,{className:ni("absolute inset-0 size-4","text-white/70")}),c.jsx(bu,{className:ni("absolute inset-0 size-4",yt?.favorite?"opacity-100":"opacity-0","text-amber-200")})]})}),c.jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),ti()},className:ni("inline-flex items-center justify-center rounded-full p-1.5 ring-1 ring-inset backdrop-blur","transition active:scale-[0.98]",yt?.liked?"bg-rose-500/25 ring-rose-200/30":"bg-black/30 ring-white/20"),title:yt?.liked?"Like entfernen":"Liken","aria-pressed":yt?.liked===!0,"aria-label":yt?.liked?"Like entfernen":"Liken",children:c.jsxs("span",{className:"relative inline-block size-4",children:[c.jsx(Jc,{className:ni("absolute inset-0 size-4","text-white/70")}),c.jsx(yl,{className:ni("absolute inset-0 size-4",yt?.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:[Qt?c.jsx("span",{className:ss("bg-white/15 text-white ring-white/20"),children:Qt}):null,jt?c.jsx("span",{className:ss((jt||"").toLowerCase()==="online"?"bg-emerald-500/25 text-white ring-emerald-200/30":"bg-white/15 text-white ring-white/20"),children:jt}):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]}),Zt?c.jsx("div",{className:"absolute right-3 bottom-3",children:c.jsxs("a",{href:Zt,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(Vh,{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(C0,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:el(N?.num_followers??Tn)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(zA,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:xg(N?.seconds_online)})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(E0,{className:"size-3.5 text-gray-400"}),c.jsx("span",{className:"font-semibold text-gray-900 dark:text-white",children:W?.last_broadcast?p6(W.last_broadcast):"—"})]})]}),P?.enabled===!1?c.jsx("div",{className:"mt-2 rounded-lg border border-amber-200/60 bg-amber-50/70 px-3 py-2 text-xs text-amber-900 dark:border-amber-400/20 dark:bg-amber-400/10 dark:text-amber-200",children:"Chaturbate-Online ist aktuell deaktiviert."}):P?.lastError?c.jsxs("div",{className:"mt-2 rounded-lg border border-rose-200/60 bg-rose-50/70 px-3 py-2 text-xs text-rose-900 dark:border-rose-400/20 dark:bg-rose-400/10 dark:text-rose-200",children:["Online-Info: ",P.lastError]}):null,ae?.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."}):ae?.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: ",z_(ae.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:H_(ae.lastError)})]})]}):null]})]}),In.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:["(",In.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:[In.slice(0,20).map(xe=>c.jsx(ps,{tag:xe},xe)),In.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:["+",In.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:_e?c.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[P?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["Online-Stand: ",Uc(P.fetchedAt)]}):null,ae?.fetchedAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Bio-Stand: ",Uc(ae.fetchedAt)]}):null,yt?.lastSeenOnlineAt?c.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:["· Zuletzt gesehen:"," ",c.jsx("span",{className:"font-medium",children:yt.lastSeenOnline==null?"—":yt.lastSeenOnline?"online":"offline"})," ","(",Uc(yt.lastSeenOnlineAt),")"]}):null]}):"—"})}),c.jsx("div",{className:"flex shrink-0 items-center gap-2",children:Zt?c.jsxs("a",{href:Zt,target:"_blank",rel:"noreferrer",className:ni("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(Vh,{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(jg,{tabs:qn,value:Ke,onChange:xe=>Je(xe),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:[Ke==="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(YA,{className:"size-4"}),"Über mich"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:an?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:an}):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(C0,{className:"size-4"}),"Wishlist"]}),c.jsx("div",{className:"mt-2 text-sm text-gray-800 dark:text-gray-100",children:Bt?c.jsx("p",{className:"line-clamp-6 whitespace-pre-wrap",children:Bt}):c.jsx("span",{className:"text-gray-600 dark:text-gray-300",children:"—"})})]})]}),c.jsxs("div",{className:"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:W?.real_name?mf(W.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:W?.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:W?.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:W?.sex||"—"})]})]}),Hn.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:Hn.map(xe=>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:xe},xe))})]}):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"}),Dn.length?c.jsxs("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:[Dn.length," Links"]}):null]}),Dn.length?c.jsx("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:Dn.map(xe=>{const it=v6(xe.link);return c.jsxs("a",{href:it,target:"_blank",rel:"noreferrer",className:ni("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:xe.title_name,children:[c.jsx("div",{className:"flex size-9 items-center justify-center rounded-lg bg-black/5 dark:bg-white/5",children:xe.image_url?c.jsx("img",{src:xe.image_url,alt:"",className:"size-5"}):c.jsx(nN,{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:xe.title_name}),c.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-300",children:xe.label_text?xe.label_text:xe.tokens!=null?`${xe.tokens} token(s)`:"Link"})]}),c.jsx(Vh,{className:"ml-auto size-4 text-gray-400 transition group-hover:text-indigo-500 dark:text-gray-500 dark:group-hover:text-indigo-400"})]},xe.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(xe=>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:[xe.cover_url?c.jsx("button",{type:"button",className:"block w-full cursor-zoom-in",onClick:()=>ln(xe.cover_url,xe.name),"aria-label":"Bild vergrößern",children:c.jsx("img",{src:xe.cover_url,alt:xe.name,className:ni("h-28 w-full object-cover transition",rf(u))})}):c.jsx("div",{className:"flex h-28 w-full items-center justify-center bg-black/5 dark:bg-white/5",children:c.jsx(oN,{className:"size-6 text-gray-500"})}),c.jsxs("div",{className:"absolute left-2 top-2 flex flex-wrap gap-2",children:[xe.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"}),xe.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:xe.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(xe.tokens)}),xe.user_can_access===!0?c.jsx("span",{className:"ml-2",children:"· Zugriff: ✅"}):null]})]})]},xe.id))}):c.jsx("div",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:"Keine Photo-Sets vorhanden."})]})]}):null,Ke==="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(Sf,{page:Le,pageSize:Oe,totalItems:Ge,onPageChange:xe=>ut(xe),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:me?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade Downloads…"}):ne.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Keine abgeschlossenen Downloads für dieses Model gefunden."}):c.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:ne.map(xe=>{const it=Xt(xe),Rt=!(!!f&&Pe===it),Ne=vo(xe.output||""),pt=cy(Ne),xt=wo(Ne),St=Qn(xe),Pt=xi(Zn(xe)),Ht=$_(xe?.meta),Gt=typeof Ht?.videoWidth=="number"&&typeof Ht?.videoHeight=="number"&&Ht.videoWidth>0&&Ht.videoHeight>0?{w:Ht.videoWidth,h:Ht.videoHeight}:typeof xe?.videoWidth=="number"&&typeof xe?.videoHeight=="number"&&xe.videoWidth>0&&xe.videoHeight>0?{w:xe.videoWidth,h:xe.videoHeight}:null,xn=cd(Gt),zn=Qe.has(it)||Et.has(it)||It.has(it),Bi=vt.has(it),$n=!!yt?.favorite,Vi=yt?.liked===!0,Si=!!yt?.watching,si=In,pi=sf($t,dt),Vn=wo(vo(xe.output||"")).replace(/\.[^.]+$/,"").trim(),Gn=sf(Ht?.previewSprite?.path,Ht?.previewSpritePath,Vn?`/api/preview-sprite/${encodeURIComponent(Vn)}`:void 0),Kn=Gn?Gn.replace(/\/+$/,""):void 0,An=Ht?.previewSprite?.stepSeconds??Ht?.previewSpriteStepSeconds,Oi=typeof An=="number"&&Number.isFinite(An)&&An>0?An:q_,Jn=eu(Ht?.durationSeconds)??eu(xe?.durationSeconds)??eu(ft[it]),Gi=typeof Jn=="number"&&Jn>0?Math.max(1,Math.min(200,Math.floor(Jn/Oi)+1)):void 0,_i=Ht?.previewSprite?.count??Ht?.previewSpriteCount??Gi,R=Ht?.previewSprite?.cols??Ht?.previewSpriteCols,U=Ht?.previewSprite?.rows??Ht?.previewSpriteRows,ue=typeof _i=="number"&&Number.isFinite(_i)?Math.max(0,Math.floor(_i)):0,[Se,Ee]=ue>1?V_(ue):[0,0],Ve=typeof R=="number"&&Number.isFinite(R)?Math.max(0,Math.floor(R)):Se,z=typeof U=="number"&&Number.isFinite(U)?Math.max(0,Math.floor(U)):Ee,K=(typeof Ht?.updatedAtUnix=="number"&&Number.isFinite(Ht.updatedAtUnix)?Ht.updatedAtUnix:void 0)??(typeof Ht?.fileModUnix=="number"&&Number.isFinite(Ht.fileModUnix)?Ht.fileModUnix:void 0)??0,re=Kn&&K?`${Kn}?v=${encodeURIComponent(String(K))}`:Kn||void 0,ye=!!re&&ue>1,ze=ye&&Ve>0&&z>0,Me=ye?ue:0,et=ye?Oi:0,gt=ye,Tt=fe[it],Vt=typeof Tt=="number"&&Me>1?af(Tt/(Me-1),0,1):void 0,Ut=ze&&typeof Tt=="number"?(()=>{const yn=af(Tt,0,Math.max(0,ue-1)),Os=yn%Ve,sa=Math.floor(yn/Ve),Nr=Ve<=1?0:Os/(Ve-1)*100,ci=z<=1?0:sa/(z-1)*100;return{backgroundImage:`url("${re}")`,backgroundRepeat:"no-repeat",backgroundSize:`${Ve*100}% ${z*100}%`,backgroundPosition:`${Nr}% ${ci}%`}})():void 0,un=nt===it&&!!pi,Ci=!un&&!!Ut,Pi=un||Ci;return Bi?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",zn&&"pointer-events-none opacity-70",It.has(it)&&"opacity-0 translate-y-2 scale-[0.98]"].filter(Boolean).join(" "),onClick:()=>i?.(xe),onKeyDown:yn=>{(yn.key==="Enter"||yn.key===" ")&&i?.(xe)},children:[c.jsx("div",{className:"group/thumb relative aspect-video rounded-t-lg bg-black/5 dark:bg-white/5",onMouseEnter:()=>{De(it),ri(it)},onMouseLeave:()=>{De(null),ri(null),jn(it),wt(yn=>yn===it?null:yn)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-t-lg",children:[c.jsx("div",{className:"absolute inset-0",children:c.jsx(vu,{job:xe,getFileName:yn=>wo(vo(yn)),durationSeconds:ft[it]??xe?.durationSeconds,onDuration:ui,variant:"fill",showPopover:!1,blur:u,animated:Pi?!1:h==="all"?!0:h==="hover"?st===it:!1,animatedMode:"teaser",animatedTrigger:"always",muted:Rt,popoverMuted:Rt,scrubProgressRatio:Vt,preferScrubProgress:typeof Tt=="number"})}),ze&&re?c.jsx("img",{src:re,alt:"",className:"hidden",loading:"lazy",decoding:"async","aria-hidden":"true"}):null,Ci&&Ut?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:Ut})}):null,un&&pi?c.jsxs("div",{className:"absolute inset-0 z-[6]",children:[c.jsx("img",{src:pi,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,gt&&Ce===it?c.jsx("div",{className:"absolute inset-x-0 bottom-0 z-30 pointer-events-none opacity-100 transition-opacity duration-150",onClick:yn=>yn.stopPropagation(),onMouseDown:yn=>yn.stopPropagation(),children:c.jsx(yy,{className:"pointer-events-auto px-1",imageCount:Me,activeIndex:Tt,onActiveIndexChange:yn=>Mn(it,yn),onIndexClick:yn=>{Mn(it,yn),Yn(xe,yn,Me)},stepSeconds:et})}):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:[St,Gt?`${Gt.w}×${Gt.h}`:xn||"",Pt].filter(Boolean).join(" • "),children:[c.jsx("span",{children:St}),xn?c.jsx("span",{"aria-hidden":"true",children:"•"}):null,xn?c.jsx("span",{children:xn}):null,c.jsx("span",{"aria-hidden":"true",children:"•"}),c.jsx("span",{children:Pt})]})})]})}),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:[pt?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:yn=>yn.stopPropagation(),onMouseDown:yn=>yn.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:xe,variant:"table",busy:zn,collapseToMenu:!0,compact:!0,isHot:pt,isFavorite:$n,isLiked:Vi,isWatching:Si,onToggleWatch:g,onToggleFavorite:_,onToggleLike:S,onToggleHot:async yn=>(await Un(yn),!0),onKeep:async yn=>{try{return await L?.(yn),!0}catch{return!1}},onDelete:async yn=>{try{return await M?.(yn),!0}catch{return!1}},order:["hot","keep","delete"],className:"w-full gap-1.5"})})}),c.jsx("div",{className:"mt-2",onClick:yn=>yn.stopPropagation(),onMouseDown:yn=>yn.stopPropagation(),children:c.jsx(ud,{rowKey:it,tags:si,activeTagSet:new Set,lower:Ie,onToggleTagFilter:()=>{}})})]})]},it)})})})]})}):null,Ke==="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"}),ee?c.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Lade…"}):null]}),c.jsx("div",{className:"mt-3",children:ee?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Lade…"}):je.length===0?c.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Kein laufender Job."}):(()=>{const xe=je[0],it=Xt(xe),Rt=!(!!f&&Pe===it),Ne=vo(xe.output||""),pt=cy(Ne),xt=wo(Ne)||"—",St=$_(xe?.meta),Pt=typeof St?.videoWidth=="number"&&typeof St?.videoHeight=="number"&&St.videoWidth>0&&St.videoHeight>0?{w:St.videoWidth,h:St.videoHeight}:typeof xe?.videoWidth=="number"&&typeof xe?.videoHeight=="number"&&xe.videoWidth>0&&xe.videoHeight>0?{w:xe.videoWidth,h:xe.videoHeight}:null,Ht=cd(Pt),Gt=Qn(xe),xn=xi(Zn(xe)),zn=In,Bi=sf($t,dt),Vi=wo(vo(xe.output||"")).replace(/\.[^.]+$/,"").trim(),Si=sf(St?.previewSprite?.path,St?.previewSpritePath,Vi?`/api/preview-sprite/${encodeURIComponent(Vi)}`:void 0),si=Si?Si.replace(/\/+$/,""):void 0,pi=St?.previewSprite?.stepSeconds??St?.previewSpriteStepSeconds,Ri=typeof pi=="number"&&Number.isFinite(pi)&&pi>0?pi:q_,Vn=eu(St?.durationSeconds)??eu(xe?.durationSeconds)??eu(ft[it]),Gn=typeof Vn=="number"&&Vn>0?Math.max(1,Math.min(200,Math.floor(Vn/Ri)+1)):void 0,Kn=St?.previewSprite?.count??St?.previewSpriteCount??Gn,An=St?.previewSprite?.cols??St?.previewSpriteCols,Oi=St?.previewSprite?.rows??St?.previewSpriteRows,Jn=typeof Kn=="number"&&Number.isFinite(Kn)?Math.max(0,Math.floor(Kn)):0,[Gi,_i]=Jn>1?V_(Jn):[0,0],R=typeof An=="number"&&Number.isFinite(An)?Math.max(0,Math.floor(An)):Gi,U=typeof Oi=="number"&&Number.isFinite(Oi)?Math.max(0,Math.floor(Oi)):_i,ue=(typeof St?.updatedAtUnix=="number"&&Number.isFinite(St.updatedAtUnix)?St.updatedAtUnix:void 0)??(typeof St?.fileModUnix=="number"&&Number.isFinite(St.fileModUnix)?St.fileModUnix:void 0)??0,Se=si&&ue?`${si}?v=${encodeURIComponent(String(ue))}`:si||void 0,Ee=!!Se&&Jn>1,Ve=Ee&&R>0&&U>0,z=Ee?Jn:0,K=fe[it],re=typeof K=="number"&&z>1?af(K/(z-1),0,1):void 0,ye=Ve&&typeof K=="number"?(()=>{const Tt=af(K,0,Math.max(0,Jn-1)),Vt=Tt%R,Ut=Math.floor(Tt/R),un=R<=1?0:Vt/(R-1)*100,Ci=U<=1?0:Ut/(U-1)*100;return{backgroundImage:`url("${Se}")`,backgroundRepeat:"no-repeat",backgroundSize:`${R*100}% ${U*100}%`,backgroundPosition:`${un}% ${Ci}%`}})():void 0,ze=nt===it&&!!Bi,et=ze||!ze&&!!ye,gt=vg(xe);return c.jsx("div",{className:"w-full",children:c.jsxs("div",{className:ni("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:ni("group/thumb relative w-full bg-black/5 dark:bg-white/5","aspect-video sm:aspect-[21/9]",i?"cursor-pointer":""),onClick:()=>i?.(xe),onKeyDown:Tt=>{i&&(Tt.key==="Enter"||Tt.key===" ")&&i(xe)},onMouseEnter:()=>{ve(!0),De(it),ri(it)},onMouseLeave:()=>{ve(!1),De(null),ri(null),jn(it),wt(Tt=>Tt===it?null:Tt)},children:c.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[gt?null:c.jsx("div",{className:"absolute inset-0",children:c.jsx(vu,{job:xe,getFileName:Tt=>wo(vo(Tt)),durationSeconds:ft[it]??xe?.durationSeconds,onDuration:ui,variant:"fill",showPopover:!1,blur:u,animated:et?!1:h==="all"?!0:h==="hover"?st===it:!1,animatedMode:"teaser",animatedTrigger:"always",muted:Rt,popoverMuted:Rt,scrubProgressRatio:re,preferScrubProgress:typeof K=="number"})}),gt?c.jsxs("div",{className:"absolute inset-0 z-10",children:[c.jsx(ib,{src:`/api/preview/live?id=${encodeURIComponent(String(xe?.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:[Gt,Pt?`${Pt.w}×${Pt.h}`:Ht||"",xn].filter(Boolean).join(" • "),children:c.jsx("span",{children:xn})})})]})}),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:[pt?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:Uc(xe?.startedAt)})," · ","Status:"," ",c.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:String(xe?.status??"running")})]})]}),c.jsx("div",{className:"mt-2",onClick:Tt=>Tt.stopPropagation(),onMouseDown:Tt=>Tt.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||!vg(xe)||ge,title:ge?"Stoppe…":"Stop","aria-label":ge?"Stoppe…":"Stop",onClick:async Tt=>{if(Tt.preventDefault(),Tt.stopPropagation(),!!E&&vg(xe)&&!ge)try{ht(!0),await E(String(xe?.id??""))}finally{ht(!1)}},children:ge?"Stoppe…":"Stoppen"})})}),c.jsx("div",{className:"mt-2",onClick:Tt=>Tt.stopPropagation(),onMouseDown:Tt=>Tt.stopPropagation(),children:c.jsx(ud,{rowKey:it,tags:zn,activeTagSet:new Set,lower:Ie,onToggleTagFilter:()=>{}})})]})]})})})()})]})}):null]}),c.jsx(wf,{open:!!pe,onClose:()=>we(null),title:pe?.alt||"Bild",width:"max-w-4xl",layout:"single",scroll:"body",footer:c.jsxs("div",{className:"flex items-center justify-end gap-2",children:[pe?.src?c.jsxs("a",{href:pe.src,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-lg border border-gray-200/70 bg-white/70 px-3 py-1.5 text-xs font-medium text-gray-900 shadow-sm backdrop-blur hover:bg-white dark:border-white/10 dark:bg-white/5 dark:text-white",children:[c.jsx(Vh,{className:"size-4"}),"In neuem Tab"]}):null,c.jsx(en,{variant:"secondary",onClick:()=>we(null),children:"Schließen"})]}),children:c.jsx("div",{className:"grid place-items-center",children:pe?.src?c.jsx("img",{src:pe.src,alt:pe.alt||"",className:ni("max-h-[80vh] w-auto max-w-full rounded-lg object-contain",rf(u))}):null})})]})}const of=n=>Math.max(0,Math.min(1,n));function lf(n){return n==="good"?"bg-emerald-500":n==="warn"?"bg-amber-500":"bg-red-500"}function T6(n){return n==null?"–":`${Math.round(n)}ms`}function G_(n){return n==null?"–":`${Math.round(n)}%`}function _g(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 S6(n=1e3){const[e,t]=tn.useState(null);return tn.useEffect(()=>{let i=0,a=performance.now(),l=0,u=!0,h=!1;const f=C=>{if(!u||!h)return;l+=1;const M=C-a;if(M>=n){const L=Math.round(l*1e3/M);t(L),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 K_({mode:n="inline",className:e,pollMs:t=3e3}){const i=S6(1e3),[a,l]=tn.useState(null),[u,h]=tn.useState(null),[f,g]=tn.useState(null),[_,S]=tn.useState(null),[C,M]=tn.useState(null),L=5*1024*1024*1024,E=8*1024*1024*1024,B=tn.useRef(!1);tn.useEffect(()=>{const te=`/api/perf/stream?ms=${encodeURIComponent(String(t))}`,me=nm(te,"perf",le=>{const q=typeof le?.cpuPercent=="number"?le.cpuPercent:null,F=typeof le?.diskFreeBytes=="number"?le.diskFreeBytes:null,ee=typeof le?.diskTotalBytes=="number"?le.diskTotalBytes:null,ie=typeof le?.diskUsedPercent=="number"?le.diskUsedPercent:null;h(q),g(F),S(ee),M(ie);const de=typeof le?.serverMs=="number"?le.serverMs:null;l(de!=null?Math.max(0,Date.now()-de):null)});return()=>me()},[t]);const G=a==null?"bad":a<=120?"good":a<=300?"warn":"bad",Q=i==null?"bad":i>=55?"good":i>=30?"warn":"bad",H=u==null?"bad":u<=60?"good":u<=85?"warn":"bad",se=of((a??999)/500),Y=of((i??0)/60),W=of((u??0)/100),O=f!=null&&_!=null&&_>0?f/_:null,ae=C??(O!=null?(1-O)*100:null),k=of((ae??0)/100);f==null?B.current=!1:B.current?f>=E&&(B.current=!1):f<=L&&(B.current=!0);const j=f==null||B.current||O==null?"bad":O>=.15?"good":O>=.07?"warn":"bad",Z=f==null?"Disk: –":`Free: ${_g(f)} / Total: ${_g(_)} · Used: ${G_(ae)}`,V=n==="floating"?"fixed bottom-4 right-4 z-[80]":"flex items-center";return c.jsx("div",{className:`${V} ${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:Z,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 ${lf(j)}`,style:{width:`${Math.round(k*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-11 tabular-nums text-gray-900 dark:text-gray-100",children:_g(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 ${lf(G)}`,style:{width:`${Math.round(se*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:T6(a)})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"FPS"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${lf(Q)}`,style:{width:`${Math.round(Y*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-8 tabular-nums text-gray-900 dark:text-gray-100",children:i??"–"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-[11px] font-medium text-gray-600 dark:text-gray-300",children:"CPU"}),c.jsx("div",{className:"hidden sm:block h-2 w-14 sm:w-16 rounded-full bg-gray-200/70 dark:bg-white/10 overflow-hidden",children:c.jsx("div",{className:`h-full ${lf(H)}`,style:{width:`${Math.round(W*100)}%`}})}),c.jsx("span",{className:"text-[11px] w-10 tabular-nums text-gray-900 dark:text-gray-100",children:G_(u)})]})]})})}async function wg(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 k6(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 W_(n){if(!n)return[];const e=n.split(/[\n,;|]+/g).map(t=>t.trim()).filter(Boolean);return Array.from(new Set(e))}function jk(n){return String(n||"").replaceAll("\\","/").split("/").pop()||""}function Rk(n){return n.toUpperCase().startsWith("HOT ")?n.slice(4).trim():n}function E6(n){const e=Rk(jk(n||""));return e?e.replace(/\.[^.]+$/,""):""}const C6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Tg(n){const t=Rk(jk(n)).replace(/\.[^.]+$/,""),i=t.match(C6);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 A6(n){const e=E6(n);return e?`/generated/meta/${encodeURIComponent(e)}/preview.webp`:null}async function N6(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 D6(){const[n,e]=p.useState([]),[t,i]=p.useState(!1),[a,l]=p.useState(null),[u,h]=p.useState(()=>Date.now()),[f,g]=p.useState({}),[_,S]=p.useState({}),[C,M]=p.useState(!1),[L,E]=p.useState(null),[B,G]=p.useState({}),Q=p.useRef(null),H=p.useRef({}),se=p.useCallback((k,j)=>{const Z={};for(const te of Array.isArray(k)?k:[]){const me=String(te?.modelKey??"").trim().toLowerCase();if(!me)continue;const le=W_(te?.tags).map(q=>q.toLowerCase());le.length&&(Z[me]=le)}const V={};for(const te of Array.isArray(j)?j:[]){const me=String(te?.output??"");if(!me)continue;const le=(Tg(me)||"").trim().toLowerCase();if(!le)continue;const q=Z[le];if(!(!q||q.length===0))for(const F of q)F&&(V[F]||(V[F]=[]),V[F].push(me))}for(const[te,me]of Object.entries(V))V[te]=Array.from(new Set(me));H.current=V},[]),Y=p.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"}}))}},[]),W=p.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=p.useCallback(async()=>{Q.current?.abort();const k=new AbortController;Q.current=k,i(!0),l(null);try{const[j,Z]=await Promise.all([wg("/api/models",{cache:"no-store",signal:k.signal}),wg("/api/record/done?page=1&pageSize=2000&sort=completed_desc",{cache:"no-store",signal:k.signal})]),V=Array.isArray(Z?.items)?Z.items:Array.isArray(Z)?Z:[];se(Array.isArray(j)?j:[],V);const te=new Map;for(const ie of Array.isArray(j)?j:[])for(const de of W_(ie?.tags)){const I=de.toLowerCase();te.set(I,(te.get(I)??0)+1)}const me=H.current||{},le=Array.from(te.entries()).map(([ie,de])=>({tag:ie,modelsCount:de,downloadsCount:(me[ie]||[]).length})).sort((ie,de)=>ie.tag.localeCompare(de.tag,void 0,{sensitivity:"base"})),q=new Map;try{const ie=await wg("/api/generated/coverinfo/list",{cache:"no-store",signal:k.signal});for(const de of Array.isArray(ie)?ie:[]){const I=String(de?.category??"").trim().toLowerCase();I&&q.set(I,de)}}catch{}const F={};for(const ie of le){const de=q.get(ie.tag);F[ie.tag]=!!de?.hasCover}S(F);const ee={};for(const ie of le){const I=(me[ie.tag]||[])[0]||"";let pe=I?Tg(I):null;if(!pe){const we=q.get(ie.tag);we?.hasCover&&we.model?.trim()&&(pe=we.model.trim())}pe&&(ee[ie.tag]=pe)}G(ee),g(ie=>{const de={};for(const I of le){const pe=ie[I.tag];pe&&F[I.tag]===!0&&(de[I.tag]=pe)}return de}),e(le)}catch(j){if(j?.name==="AbortError")return;l(j?.message??String(j)),e([]),H.current={},G({}),S({}),g({})}finally{Q.current===k&&(Q.current=null,i(!1))}},[se]);p.useEffect(()=>(O(),()=>{Q.current?.abort()}),[O]);const ae=p.useCallback(async()=>{if(!C){M(!0),l(null),E({done:0,total:n.length});try{const k=H.current||{},j=await Promise.all(n.map(async V=>{try{const te=k[V.tag]||[];if(te.length===0)return{tag:V.tag,ok:!0,status:0,text:"skipped (no candidates)"};const me=te[Math.floor(Math.random()*te.length)],le=A6(me);if(!le)return{tag:V.tag,ok:!0,status:0,text:"skipped (no thumb url)"};const q=Tg(me);return await N6(V.tag,le,q,!0),S(F=>({...F,[V.tag]:!0})),G(F=>{const ee={...F};return q?.trim()?ee[V.tag]=q.trim():delete ee[V.tag],ee}),g(F=>{const ee={...F};return delete ee[V.tag],ee}),{tag:V.tag,ok:!0,status:200,text:""}}catch(te){return{tag:V.tag,ok:!1,status:0,text:te?.message??String(te)}}finally{E(te=>te&&{...te,done:Math.min(te.total,te.done+1)})}})),Z=j.filter(V=>!V.ok);if(Z.length){console.warn("Cover renew failed:",Z.slice(0,20));const V=Z.slice(0,8).map(te=>`${te.tag} (ERR)`).join(", ");l(`Covers fehlgeschlagen: ${Z.length}/${j.length} — z.B.: ${V}`)}else l(null)}finally{h(Date.now()),M(!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:[L?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: ",L.done,"/",L.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:L.total>0?`${Math.round(L.done/L.total*100)}%`:"0%"}})})]}):null,c.jsx(en,{variant:"secondary",size:"md",onClick:ae,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,Z=_[k.tag]===!0,V=Object.prototype.hasOwnProperty.call(_,k.tag),te=Z?k6(k.tag,u,!1,j):"",me=f[k.tag]==="ok",le=f[k.tag]==="error";return c.jsxs("button",{type:"button",onClick:()=>Y(k.tag),className:rn("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?Z?le?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:q=>{q.preventDefault(),q.stopPropagation(),g(F=>{const ee={...F};return delete ee[k.tag],ee}),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:te,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:te,alt:k.tag,className:"absolute inset-0 z-0 h-full w-full object-contain",loading:"lazy",onLoad:()=>g(q=>({...q,[k.tag]:"ok"})),onError:()=>{g(q=>({...q,[k.tag]:"error"})),S(q=>({...q,[k.tag]:!1}))}}),me&&j?c.jsx("div",{className:"absolute left-3 bottom-3 z-10 max-w-[calc(100%-24px)]",children:c.jsx("div",{className:rn("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:rn("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:q=>{q.preventDefault(),q.stopPropagation(),Y(k.tag)},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),q.stopPropagation(),Y(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:rn("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:q=>{q.preventDefault(),q.stopPropagation(),W(k.tag)},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),q.stopPropagation(),W(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:rn("shrink-0 mt-0.5 text-gray-400 dark:text-gray-500","transition-transform group-hover:translate-x-[1px]"),children:"→"})]})})]},k.tag)})})]})}async function zc(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 M6(){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 j6(){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 R6(n){try{sessionStorage.setItem(ob,JSON.stringify(n))}catch{}}function uf(){try{sessionStorage.removeItem(ob)}catch{}}function O6(n){const t=(n??"").replace(/\D/g,"").slice(0,6).split("");for(;t.length<6;)t.push("");return t}function L6(n){return(n??[]).join("")}function I6({onLoggedIn:n}){const e=p.useMemo(()=>M6(),[]),[t,i]=p.useState(""),[a,l]=p.useState(""),[u,h]=p.useState(["","","","","",""]),f=p.useRef([]),[g,_]=p.useState(!1),[S,C]=p.useState(null),[M,L]=p.useState("login"),[E,B]=p.useState(null),[G,Q]=p.useState(null),[H,se]=p.useState(null),Y=p.useRef(!1),W=p.useMemo(()=>L6(u),[u]);function O(F){const ee=f.current[F];ee&&ee.focus()}function ae(){h(["","","","","",""]),Y.current=!1,window.setTimeout(()=>O(0),0)}function k(F,ee){const ie=(ee??"").replace(/\D/g,"").slice(-1);h(de=>{const I=[...de];return I[F]=ie,I})}function j(F,ee){const ie=(ee??"").replace(/\D/g,"");if(!ie){k(F,""),Y.current=!1;return}if(ie.length>1){h(de=>{const I=[...de];let pe=F;for(const we of ie){if(pe>5)break;I[pe]=we,pe++}return I}),Y.current=!1,window.setTimeout(()=>O(Math.min(5,F+ie.length)),0);return}k(F,ie),Y.current=!1,F<5&&window.setTimeout(()=>O(F+1),0)}function Z(F,ee){if(ee.key==="Backspace"){if(u[F]){ee.preventDefault(),k(F,""),Y.current=!1;return}F>0&&(ee.preventDefault(),O(F-1),k(F-1,""),Y.current=!1);return}if(ee.key==="ArrowLeft"){ee.preventDefault(),F>0&&O(F-1);return}if(ee.key==="ArrowRight"){ee.preventDefault(),F<5&&O(F+1);return}}function V(F,ee){const de=(ee.clipboardData.getData("text")||"").replace(/\D/g,"").slice(0,6);de&&(ee.preventDefault(),h(I=>{const pe=[...I];let we=F;for(const ve of de){if(we>5)break;pe[we]=ve,we++}return pe}),Y.current=!1,window.setTimeout(()=>O(Math.min(5,F+de.length)),0))}p.useEffect(()=>{const F=j6();F&&(L(F.stage??"login"),i(F.username??""),h(O6(F.code??"")),B(F.setupAuthUrl??null),Q(F.setupSecret??null),se(F.setupInfo??null))},[]),p.useEffect(()=>{R6({stage:M,username:t,code:W,setupAuthUrl:E,setupSecret:G,setupInfo:H,ts:Date.now()})},[M,t,W,E,G,H]),p.useEffect(()=>{Y.current=!1,(M==="verify"||M==="setup")&&window.setTimeout(()=>O(0),0)},[M]),p.useEffect(()=>{let F=!1;return(async()=>{try{const ie=await zc("/api/auth/me",{cache:"no-store"});if(F)return;if(ie?.authenticated){ie?.totpConfigured?(uf(),window.location.assign(e||"/")):(L("setup"),le());return}if(ie?.pending2fa){L("verify");return}L("login")}catch{}})(),()=>{F=!0}},[e]);const te=async()=>{_(!0),C(null);try{if((await zc("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:a})}))?.totpRequired){L("verify"),ae();return}const ee=await zc("/api/auth/me",{cache:"no-store"});if(ee?.authenticated&&!ee?.totpConfigured){L("setup"),ae(),await le();return}n&&await n(),uf(),window.location.assign(e||"/")}catch(F){C(F?.message??String(F))}finally{_(!1)}},me=async()=>{const F=W.trim();if(/^\d{6}$/.test(F)){_(!0),C(null);try{await zc("/api/auth/2fa/enable",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:F})}),n&&await n(),uf(),window.location.assign(e||"/")}catch(ee){Y.current=!1,C(ee?.message??String(ee))}finally{_(!1)}}},le=async()=>{C(null),se(null);try{const F=await zc("/api/auth/2fa/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),ee=(F?.otpauth??"").trim();if(!ee)throw new Error("2FA Setup fehlgeschlagen (keine otpauth URL).");B(ee),Q((F?.secret??"").trim()||null),se("Scan den QR-Code in deiner Authenticator-App und bestätige danach mit dem 6-stelligen Code.")}catch(F){C(F?.message??String(F))}};p.useEffect(()=>{g||M!=="verify"&&M!=="setup"||/^\d{6}$/.test(W)&&(Y.current||(Y.current=!0,me()))},[W,M,g]);const q=c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"2FA Code"}),c.jsx("div",{className:"flex items-center justify-between gap-2",children:u.map((F,ee)=>c.jsx("input",{ref:ie=>{f.current[ee]=ie},value:F,onChange:ie=>j(ee,ie.target.value),onKeyDown:ie=>Z(ee,ie),onPaste:ie=>V(ee,ie),inputMode:"numeric",pattern:"[0-9]*",maxLength:1,autoComplete:ee===0?"one-time-code":"off",enterKeyHint:ee===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 ${ee+1}`},ee))})]});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:[M==="login"?c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&te()},className:"space-y-3",children:[c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Username"}),c.jsx("input",{value:t,onChange:F=>i(F.target.value),autoComplete:"username",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"admin",disabled:g})]}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"text-xs font-medium text-gray-700 dark:text-gray-200",children:"Passwort"}),c.jsx("input",{type:"password",value:a,onChange:F=>l(F.target.value),autoComplete:"current-password",className:"block w-full rounded-lg px-3 py-2.5 text-sm bg-white text-gray-900 shadow-sm ring-1 ring-gray-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 dark:bg-white/10 dark:text-white dark:ring-white/10",placeholder:"••••••••••",disabled:g})]}),c.jsx(en,{type:"submit",variant:"primary",className:"w-full rounded-lg",disabled:g||!t.trim()||!a,children:g?"Login…":"Login"})]}):M==="verify"?c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&me()},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."}),q,c.jsxs("div",{className:"flex gap-2",children:[c.jsx(en,{type:"button",variant:"secondary",className:"flex-1 rounded-lg",disabled:g,onClick:()=>{L("login"),ae()},children:"Zurück"}),c.jsx(en,{type:"submit",variant:"primary",className:"flex-1 rounded-lg",disabled:g||!/^\d{6}$/.test(W),children:g?"Prüfe…":"Bestätigen"})]})]}):c.jsxs("form",{onSubmit:F=>{F.preventDefault(),!g&&me()},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,H?c.jsx("div",{className:"mt-3 text-xs text-gray-600 dark:text-gray-300",children:H}):null,c.jsx("div",{className:"mt-3",children:c.jsx(en,{type:"button",variant:"secondary",className:"w-full rounded-lg",disabled:g,onClick:()=>{le()},title:"Setup-Infos neu laden",children:E?"QR/Setup erneut laden":"QR/Setup laden"})})]}),q,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(),uf(),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(W),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 Sg="record_cookies";function cf(n){return Object.fromEntries(Object.entries(n??{}).map(([t,i])=>[t.trim().toLowerCase(),String(i??"").trim()]).filter(([t,i])=>t.length>0&&i.length>0))}async function lr(n,e){const t=await fetch(n,e);if(!t.ok){const i=await t.text().catch(()=>"");throw new Error(i||`HTTP ${t.status}`)}return t.json()}const X_={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 od(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 Ok(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=od(n);if(!e)return n;if(e==="chaturbate"){const i=Ok(n);return i?`https://chaturbate.com/${encodeURIComponent(i)}/`:n}const t=Lk(n);return t?`https://www.myfreecams.com/#${encodeURIComponent(t)}`:n}function B6(n){const e=od(n);return e?((e==="chaturbate"?Ok(n):Lk(n))||"").trim().toLowerCase():""}function Lk(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 Ei=n=>(n||"").replaceAll("\\","/").split("/").pop()||"";function P6(n,e){const i=(n||"").replaceAll("\\","/").split("/");return i[i.length-1]=e,i.join("/")}function F6(n){return n.startsWith("HOT ")?n.slice(4):n}const U6=/^(.*?)_\d{1,2}_\d{1,2}_\d{4}__\d{1,2}-\d{2}-\d{2}/;function Hc(n){const t=F6(Ei(n)).replace(/\.[^.]+$/,""),i=t.match(U6);if(i?.[1]?.trim())return i[1].trim();const a=t.lastIndexOf("_");return a>0?t.slice(0,a):t||null}function z6(){const[n,e]=p.useState(!1),[t,i]=p.useState(!1),a=p.useRef(null),l=p.useCallback(()=>{const R=a.current;R&&(R.focus(),requestAnimationFrame(()=>R.select()))},[]),u=p.useCallback(async()=>{try{const R=await lr("/api/auth/me",{cache:"no-store"});i(!!R?.authenticated)}catch{i(!1)}finally{e(!0)}},[]),h=p.useCallback(async()=>{try{await fetch("/api/auth/logout",{method:"POST",cache:"no-store"})}catch{}finally{i(!1),e(!0),Ie(null),Et(!1),ln("running"),yt(null),ot(!1),He(null),ie([]),I([]),ge(0),we(1),Pe({}),Ge(0),ri({}),Qn.current={},Dt.current={},jt.current=!1,Tn([]),gn({}),Le(0),F("")}},[]);p.useEffect(()=>{u()},[u]);const f=Lw(),g=p.useRef(f),_=p.useRef(0),S=R=>{const U=(R||"").toLowerCase();return U.includes("altersverifikationsseite erhalten")||U.includes("verify your age")||U.includes("schutzseite von cloudflare erhalten")||U.includes("just a moment")||U.includes("kein room-html")},C=R=>{const U=!!R?.silent,ue="Cookies fehlen oder sind abgelaufen",Se="Der Recorder hat statt des Room-HTML eine Schutz-/Altersverifikationsseite erhalten. Bitte Cookies aktualisieren (bei Chaturbate z.B. cf_clearance + sessionId) und erneut starten.";if(!U){Ie(`⚠️ ${ue}. ${Se}`),vt(!0);return}const Ee=Date.now();Ee-_.current>15e3&&(_.current=Ee,g.current?.error(ue,Se))};p.useEffect(()=>{g.current=f},[f]);const[M,L]=p.useState(!1);p.useEffect(()=>{const R=window,U=typeof R.requestIdleCallback=="function"?R.requestIdleCallback(()=>L(!0),{timeout:1500}):window.setTimeout(()=>L(!0),800);return()=>{typeof R.cancelIdleCallback=="function"?R.cancelIdleCallback(U):window.clearTimeout(U)}},[]);const E=8,B="finishedDownloads_sort",[G,Q]=p.useState(()=>{try{return window.localStorage.getItem(B)||"completed_desc"}catch{return"completed_desc"}}),H=p.useRef(null),se=p.useRef(!1),Y=(R,U)=>`${U}::${R}`,W=p.useCallback(async R=>{if(R<1||se.current)return;const U=Y(R,G),ue=H.current;if(!(ue?.key===U&&Date.now()-ue.ts<15e3)){se.current=!0;try{const Se=await fetch(`/api/record/done?page=${R}&pageSize=${E}&sort=${encodeURIComponent(G)}`,{cache:"no-store"});if(!Se.ok)return;const Ee=await Se.json().catch(()=>null),Ve=Array.isArray(Ee?.items)?Ee.items:Array.isArray(Ee)?Ee:[];H.current={key:U,items:Ve,ts:Date.now()}}finally{se.current=!1}}},[G]),O=p.useCallback(async()=>{const R=Date.now();if(!ae.current&&!(R-k.current<500)){ae.current=!0,k.current=R;try{const U=await fetch("/api/record/done/meta",{cache:"no-store"});if(!U.ok)return;const ue=await U.json().catch(()=>null),Se=Number(ue?.count??0),Ee=Number.isFinite(Se)&&Se>=0?Se:0;ge(Ee),Oe(Date.now())}catch{}finally{ae.current=!1}}},[]),ae=p.useRef(!1),k=p.useRef(0),j=p.useRef(null),Z=p.useRef(0),V=p.useCallback((R="unknown")=>{const U=Date.now(),ue=700;if(xe.current!=="finished"||j.current!=null)return;const Se=U-Z.current;if(Se<ue){j.current=window.setTimeout(()=>{j.current=null,Z.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload(cooldown-tail)",reason:R}}))},ue-Se);return}j.current=window.setTimeout(()=>{j.current=null,Z.current=Date.now(),window.dispatchEvent(new CustomEvent("finished-downloads:reload",{detail:{source:"App.requestFinishedReload",reason:R}}))},150)},[]);p.useEffect(()=>()=>{j.current!=null&&(window.clearTimeout(j.current),j.current=null)},[]);const te=p.useCallback(async()=>{try{const R=await fetch("/api/record/list",{cache:"no-store"});if(!R.ok)return;const U=await R.json().catch(()=>null),ue=Array.isArray(U)?U:Array.isArray(U?.items)?U.items:[];ie(ue),Bt.current=ue,Oe(Date.now())}catch{}},[]);p.useEffect(()=>{try{window.localStorage.setItem(B,G)}catch{}},[G]),p.useEffect(()=>{t&&O()},[t,O]);const[me,le]=p.useState(null),[q,F]=p.useState(""),[ee,ie]=p.useState([]),[de,I]=p.useState([]),[pe,we]=p.useState(1),[ve,ge]=p.useState(0),[ht,Ge]=p.useState(0),[Te,Le]=p.useState(0),[ut,Oe]=p.useState(()=>Date.now()),[_e,Ke]=p.useState(()=>Date.now());p.useEffect(()=>{const R=window.setInterval(()=>Ke(Date.now()),1e3);return()=>window.clearInterval(R)},[]);const Je=R=>(R||"").toLowerCase().trim(),bt=R=>{const U=Math.max(0,Math.floor(R/1e3));if(U<2)return"gerade eben";if(U<60)return`vor ${U} Sekunden`;const ue=Math.floor(U/60);if(ue===1)return"vor 1 Minute";if(ue<60)return`vor ${ue} Minuten`;const Se=Math.floor(ue/60);return Se===1?"vor 1 Stunde":`vor ${Se} Stunden`},ft=p.useMemo(()=>{const R=_e-ut;return`(zuletzt aktualisiert: ${bt(R)})`},[_e,ut]),[kt,Pe]=p.useState({}),Xe=p.useCallback(R=>{const U={};for(const ue of Array.isArray(R)?R:[]){const Se=(ue?.modelKey||"").trim().toLowerCase();if(!Se)continue;const Ee=z=>(z.favorite?4:0)+(z.liked===!0?2:0)+(z.watching?1:0),Ve=U[Se];(!Ve||Ee(ue)>=Ee(Ve))&&(U[Se]=ue)}return U},[]),st=p.useCallback(async()=>{try{const R=await lr("/api/models",{cache:"no-store"});Pe(Xe(Array.isArray(R)?R:[])),Oe(Date.now())}catch{}},[Xe]),[Ze,nt]=p.useState(null),wt=p.useRef(null),[fe,He]=p.useState(null);p.useEffect(()=>{const R=U=>{const Se=(U.detail?.modelKey??"").trim();if(!Se)return;if(!Se.includes(" ")&&!Se.includes("/")&&!Se.includes("\\")){const re=Se.replace(/^@/,"").trim().toLowerCase();re&&He(re);return}const Ve=ka(Se);if(!Ve){let re=Se.replace(/^https?:\/\//i,"");re.includes("/")&&(re=re.split("/").filter(Boolean).pop()||re),re.includes(":")&&(re=re.split(":").pop()||re),re=re.trim().toLowerCase(),re&&He(re);return}const z=bo(Ve),K=B6(z);K&&He(K)};return window.addEventListener("open-model-details",R),()=>window.removeEventListener("open-model-details",R)},[]);const Ce=p.useCallback(R=>{const U=Date.now(),ue=wt.current;if(!ue){wt.current={ts:U,list:[R]};return}ue.ts=U;const Se=ue.list.findIndex(Ee=>Ee.id===R.id);Se>=0?ue.list[Se]=R:ue.list.unshift(R)},[]);p.useEffect(()=>{st();const R=U=>{const Se=U?.detail??{},Ee=Se?.model;if(Ee&&typeof Ee=="object"){const Ve=String(Ee.modelKey??"").toLowerCase().trim();Ve&&Pe(z=>({...z,[Ve]:Ee}));try{Ce(Ee)}catch{}nt(z=>z?.id===Ee.id?Ee:z),Oe(Date.now());return}if(Se?.removed){const Ve=String(Se?.id??"").trim(),z=String(Se?.modelKey??"").toLowerCase().trim();z&&Pe(K=>{const{[z]:re,...ye}=K;return ye}),Ve&&nt(K=>K?.id===Ve?null:K),Oe(Date.now());return}st()};return window.addEventListener("models-changed",R),()=>window.removeEventListener("models-changed",R)},[st,Ce]);const[De,Ie]=p.useState(null),[Qe,Et]=p.useState(!1),[It,vt]=p.useState(!1),[Yt,Ft]=p.useState({}),[zt,At]=p.useState(!1),[Nt,ln]=p.useState("running"),[dn,yt]=p.useState(null),[Fn,ot]=p.useState(!1),[N,P]=p.useState(null),[ne,je]=p.useState(0),qe=p.useCallback(()=>je(R=>R+1),[]),[dt,$t]=p.useState(X_),Zt=p.useRef(dt);p.useEffect(()=>{Zt.current=dt},[dt]);const hn=!!dt.autoAddToDownloadList,Qt=!!dt.autoStartAddedDownloads,[vn,Tn]=p.useState([]),[Wt,gn]=p.useState({}),sn=p.useRef(!1),an=p.useRef({}),Bt=p.useRef([]),Dt=p.useRef({}),jt=p.useRef(!1);p.useEffect(()=>{sn.current=Qe},[Qe]),p.useEffect(()=>{an.current=Yt},[Yt]),p.useEffect(()=>{Bt.current=ee},[ee]);const Dn=p.useRef(null),Mt=p.useRef(""),Hn=4,In=p.useRef([]),Sn=p.useRef(0),Xt=p.useRef(new Set),Un=p.useRef(!1),Yn=p.useCallback(()=>{const R=Sn.current>0;Et(R),sn.current=R},[]),Cn=p.useCallback(R=>{const U=ka(R.url);if(!U)return!1;const ue=bo(U);return Xt.current.has(ue)||(Xt.current.add(ue),In.current.push({...R,url:ue}),Un.current||(Un.current=!0,queueMicrotask(()=>{Un.current=!1,wn()}))),!0},[]);async function ti(R,U){if(R=bo(R),Bt.current.some(Se=>{if(String(Se.status||"").toLowerCase()!=="running"||Se.endedAt)return!1;const Ee=ka(String(Se.sourceUrl||""));return(Ee?bo(Ee):"")===R}))return!0;try{const Se=an.current,Ee=od(R);if(!Ee)return U||Ie("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;if(Ee==="chaturbate"&&!zn(Se))return U||Ie('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;const Ve=Object.entries(Se).map(([K,re])=>`${K}=${re}`).join("; "),z=await lr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:R,cookie:Ve})});return z?.id&&(Dt.current[String(z.id)]=!0),ie(K=>[z,...K]),Bt.current=[z,...Bt.current],!0}catch(Se){const Ee=Se?.message??String(Se);return S(Ee)?(C({silent:U}),!1):(U||Ie(Ee),!1)}}async function wn(){for(;Sn.current<Hn&&In.current.length>0;){const R=In.current.shift();Sn.current++,Yn(),(async()=>{try{if(await ti(R.url,R.silent)&&R.pendingKeyLower){const ue=R.pendingKeyLower;gn(Se=>{const Ee={...Se||{}};return delete Ee[ue],jn.current=Ee,Ee})}}finally{Xt.current.delete(R.url),Sn.current=Math.max(0,Sn.current-1),Yn(),In.current.length>0&&wn()}})()}}const[ui,ri]=p.useState({}),Qn=p.useRef({});p.useEffect(()=>{Qn.current=ui},[ui]);const Zn=p.useCallback(R=>{const U=String(R?.host??"").toLowerCase(),ue=String(R?.input??"").toLowerCase();return U.includes("chaturbate")||ue.includes("chaturbate.com")},[]),xi=p.useMemo(()=>{const R=new Set;for(const U of Object.values(kt)){if(!Zn(U))continue;const ue=Je(String(U?.modelKey??""));ue&&R.add(ue)}return Array.from(R)},[kt,Zn]),Mn=p.useRef(kt);p.useEffect(()=>{Mn.current=kt},[kt]);const jn=p.useRef(Wt);p.useEffect(()=>{jn.current=Wt},[Wt]);const qn=p.useRef(xi);p.useEffect(()=>{qn.current=xi},[xi]);const xe=p.useRef(Nt);p.useEffect(()=>{xe.current=Nt},[Nt]);const it=p.useCallback(async(R,U)=>{const ue=ka(R);if(!ue)return!1;const Se=bo(ue),Ee=!!U?.silent;Ee||Ie(null);const Ve=od(Se);if(!Ve)return Ee||Ie("Nur chaturbate.com oder myfreecams.com werden unterstützt."),!1;const z=an.current;if(Ve==="chaturbate"&&!zn(z))return Ee||Ie('Für Chaturbate müssen die Cookies "cf_clearance" und "sessionId" gesetzt sein.'),!1;if(Bt.current.some(re=>{if(String(re.status||"").toLowerCase()!=="running"||re.endedAt)return!1;const ye=ka(String(re.sourceUrl||""));return(ye?bo(ye):"")===Se}))return!0;if(Ve==="chaturbate"&&Zt.current.useChaturbateApi)try{const re=await lr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:Se})}),ye=String(re?.modelKey??"").trim().toLowerCase();if(ye){if(sn.current)return gn(et=>({...et||{},[ye]:Se})),!0;const ze=Qn.current[ye],Me=String(ze?.current_show??"");if(ze&&Me&&Me!=="public")return gn(et=>({...et||{},[ye]:Se})),!0}}catch{}else if(sn.current)return Dn.current=Se,!0;if(sn.current)return!1;Et(!0),sn.current=!0;try{const re=Object.entries(z).map(([ze,Me])=>`${ze}=${Me}`).join("; "),ye=await lr("/api/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:Se,cookie:re})});return ye?.id&&(Dt.current[String(ye.id)]=!0),ie(ze=>[ye,...ze]),Bt.current=[ye,...Bt.current],!0}catch(re){const ye=re?.message??String(re);return S(ye)?(C({silent:Ee}),!1):(Ee||Ie(ye),!1)}finally{Et(!1),sn.current=!1}},[]);p.useEffect(()=>{let R=!1;const U=async()=>{try{const Ee=await lr("/api/settings",{cache:"no-store"});!R&&Ee&&$t({...X_,...Ee})}catch{}},ue=()=>{U()},Se=()=>{U()};return window.addEventListener("recorder-settings-updated",ue),window.addEventListener("focus",Se),document.addEventListener("visibilitychange",Se),U(),()=>{R=!0,window.removeEventListener("recorder-settings-updated",ue),window.removeEventListener("focus",Se),document.removeEventListener("visibilitychange",Se)}},[]),p.useEffect(()=>{let R=!1;const U=async()=>{try{const Se=await lr("/api/models/meta",{cache:"no-store"}),Ee=Number(Se?.count??0);!R&&Number.isFinite(Ee)&&(Ge(Ee),Oe(Date.now()))}catch{}};U();const ue=window.setInterval(U,document.hidden?6e4:3e4);return()=>{R=!0,window.clearInterval(ue)}},[]);const mt=p.useMemo(()=>Object.entries(Yt).map(([R,U])=>({name:R,value:U})),[Yt]),Rt=p.useCallback((R,U)=>{wt.current=null,nt(null),yt(R),ot(!1),P(typeof U=="number"&&Number.isFinite(U)&&U>=0?U:null)},[]),Ne=ee.filter(R=>{const U=String(R?.status??"").toLowerCase();return U==="running"||U==="postwork"}),pt=p.useMemo(()=>{let R=0;for(const U of Object.values(kt)){if(!U?.watching||!Zn(U))continue;const ue=Je(String(U?.modelKey??""));ue&&ui[ue]&&R++}return R},[kt,ui,Zn]),{onlineFavCount:xt,onlineLikedCount:St}=p.useMemo(()=>{let R=0,U=0;for(const ue of Object.values(kt)){const Se=Je(String(ue?.modelKey??""));Se&&ui[Se]&&(ue?.favorite&&R++,ue?.liked===!0&&U++)}return{onlineFavCount:R,onlineLikedCount:U}},[kt,ui]),Pt=[{id:"running",label:"Laufende Downloads",count:Ne.length},{id:"finished",label:"Abgeschlossene Downloads",count:ve},{id:"models",label:"Models",count:ht},{id:"categories",label:"Kategorien"},{id:"settings",label:"Einstellungen"}],Ht=p.useMemo(()=>q.trim().length>0&&!Qe,[q,Qe]);p.useEffect(()=>{let R=!1;return(async()=>{try{const ue=await lr("/api/cookies",{cache:"no-store"}),Se=cf(ue?.cookies);if(R||Ft(Se),Object.keys(Se).length===0){const Ee=localStorage.getItem(Sg);if(Ee)try{const Ve=JSON.parse(Ee),z=cf(Ve);Object.keys(z).length>0&&(R||Ft(z),await lr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:z})}))}catch{}}}catch{const ue=localStorage.getItem(Sg);if(ue)try{const Se=JSON.parse(ue);R||Ft(cf(Se))}catch{}}finally{R||At(!0)}})(),()=>{R=!0}},[]),p.useEffect(()=>{zt&&localStorage.setItem(Sg,JSON.stringify(Yt))},[Yt,zt]),p.useEffect(()=>{O();const R=()=>{document.hidden||O()};return document.addEventListener("visibilitychange",R),()=>{document.removeEventListener("visibilitychange",R)}},[O]),p.useEffect(()=>{if(Nt!=="finished")return;O(),V("selectedTab effect");const R=()=>{document.hidden||(O(),V("selectedTab visibilitychange"))};return document.addEventListener("visibilitychange",R),()=>{document.removeEventListener("visibilitychange",R)}},[Nt,O,V]),p.useEffect(()=>{const R=Math.max(1,Math.ceil(ve/E));pe>R&&we(R)},[ve,pe]),p.useEffect(()=>{if(!t)return;let R=null,U=null;const ue=()=>{U!=null&&(window.clearInterval(U),U=null)},Se=()=>{U==null&&(U=window.setInterval(()=>{document.hidden||(xe.current==="finished"?(O(),V("done-stream poll tick")):O())},document.hidden?6e4:15e3))},Ee={t:0};let Ve=null;const z=()=>{const ye=Date.now();if(ye-Ee.t<800){if(Ve!=null)return;Ve=window.setTimeout(()=>{Ve=null,Ee.t=Date.now(),xe.current==="finished"?(O(),V("done-stream coalesced requestRefresh")):O()},900);return}Ee.t=ye,xe.current==="finished"?(O(),V("done-stream requestRefresh")):O()};O(),R=new EventSource("/api/record/done/stream"),R.onopen=()=>{ue()},R.onerror=()=>{Se()};const K=()=>z();R.addEventListener("doneChanged",K);const re=()=>{document.hidden||z()};return document.addEventListener("visibilitychange",re),()=>{document.removeEventListener("visibilitychange",re),Ve!=null&&window.clearTimeout(Ve),ue(),R?.removeEventListener("doneChanged",K),R?.close(),R=null}},[t,O,V]),p.useEffect(()=>{if(!t)return;te();const R=window.setInterval(()=>{if(document.hidden)return;const ue=Bt.current.some(Se=>{const Ee=String(Se?.status??"").toLowerCase();return Ee==="running"||Ee==="postwork"});(xe.current==="running"||ue)&&te()},document.hidden?6e4:3e3),U=()=>{document.hidden||te()};return document.addEventListener("visibilitychange",U),()=>{window.clearInterval(R),document.removeEventListener("visibilitychange",U)}},[t,te]);function Gt(R){const U=ka(R);if(!U)return!1;try{return new URL(U).hostname.includes("chaturbate.com")}catch{return!1}}function xn(R,U){const ue=Object.fromEntries(Object.entries(R).map(([Se,Ee])=>[Se.trim().toLowerCase(),Ee]));for(const Se of U){const Ee=ue[Se.toLowerCase()];if(Ee)return Ee}}function zn(R){const U=xn(R,["cf_clearance"]),ue=xn(R,["sessionid","session_id","sessionId"]);return!!(U&&ue)}async function Bi(R){try{await lr(`/api/record/stop?id=${encodeURIComponent(R)}`,{method:"POST"})}catch(U){f.error("Stop fehlgeschlagen",U?.message??String(U))}}p.useEffect(()=>{const R=U=>{const Se=Number(U.detail?.delta??0);Number.isFinite(Se)&&Se!==0&&ge(Ee=>Math.max(0,Ee+Se)),O()};return window.addEventListener("finished-downloads:count-hint",R),()=>window.removeEventListener("finished-downloads:count-hint",R)},[O]),p.useEffect(()=>{const R=U=>{const ue=U.detail||{};ue.tab==="finished"&&ln("finished"),ue.tab==="categories"&&ln("categories"),ue.tab==="models"&&ln("models"),ue.tab==="running"&&ln("running"),ue.tab==="settings"&&ln("settings")};return window.addEventListener("app:navigate-tab",R),()=>window.removeEventListener("app:navigate-tab",R)},[]),p.useEffect(()=>{if(!dn){nt(null),le(null);return}const R=(Hc(dn.output||"")||"").trim().toLowerCase();le(R||null);const U=R?kt[R]:void 0;nt(U??null)},[dn,kt]);async function $n(){return it(q)}const Vi=p.useCallback(async R=>{const U=String(R?.sourceUrl??""),ue=tl(U);if(!ue)return!1;const Se=ka(ue);if(!Se)return!1;const Ee=bo(Se),Ve=await it(Ee,{silent:!0});return Ve||f.error("Konnte URL nicht hinzufügen","Start fehlgeschlagen oder URL ungültig."),Ve},[it,f]);async function Si(R){const{kind:U,file:ue,run:Se,onSuccess:Ee,onError:Ve}=R;(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ue,phase:"start"}}));try{const z=await Se();return(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ue,phase:"success"}})),await Ee?.(z),z}catch(z){throw(U==="delete"||U==="keep")&&window.dispatchEvent(new CustomEvent("finished-downloads:delete",{detail:{file:ue,phase:"error"}})),await Ve?.(z),z}}const si=p.useCallback(async R=>{const U=Ei(R.output||"");if(U)try{const ue=await Si({kind:"delete",file:U,run:()=>lr(`/api/record/delete?file=${encodeURIComponent(U)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{I(Ee=>{const Ve=Ee.filter(Me=>Ei(Me.output||"")!==U);if(E-Ve.length<=0)return Ve;const K=Y(pe+1,G),re=H.current;if(!re||re.key!==K||!Array.isArray(re.items)||re.items.length===0)return Ve;const ye=[...Ve],ze=new Set(ye.map(Me=>String(Me.id||Ei(Me.output||"")).trim()));for(;ye.length<E&&re.items.length>0;){const Me=re.items.shift(),et=String(Me.id||Ei(Me.output||"")).trim();!et||ze.has(et)||(ze.add(et),ye.push(Me))}return H.current={...re,items:re.items,ts:re.ts},ye}),ge(Ee=>Math.max(0,Ee-1)),ie(Ee=>Ee.filter(Ve=>Ei(Ve.output||"")!==U)),yt(Ee=>Ee&&Ei(Ee.output||"")===U?null:Ee),W(pe+1)},320)},onError:async()=>{f.error("Löschen fehlgeschlagen",U)}}),Se=typeof ue?.undoToken=="string"?ue.undoToken:"";return Se?{undoToken:Se}:{}}catch{return}},[Si,f,pe,G,W]),pi=p.useCallback(async R=>{const U=Ei(R.output||"");if(U)try{await Si({kind:"keep",file:U,run:()=>lr(`/api/record/keep?file=${encodeURIComponent(U)}`,{method:"POST"}),onSuccess:async()=>{window.setTimeout(()=>{I(ue=>ue.filter(Se=>Ei(Se.output||"")!==U)),ie(ue=>ue.filter(Se=>Ei(Se.output||"")!==U)),yt(ue=>ue&&Ei(ue.output||"")===U?null:ue),ge(ue=>Math.max(0,ue-1)),W(pe+1)},320)},onError:async()=>{f.error("Keep fehlgeschlagen",U)}})}catch{return}},[Si,f,pe,W]),Ri=p.useCallback(async R=>{const U=Ei(R.output||"");if(U)try{window.dispatchEvent(new CustomEvent("player:release",{detail:{file:U}})),await new Promise(z=>window.setTimeout(z,60));const ue=await lr(`/api/record/toggle-hot?file=${encodeURIComponent(U)}`,{method:"POST"}),Se=Ei(ue.oldFile||U)||U,Ee=Ei(ue.newFile||"")||"";if(!Ee)throw new Error("Backend lieferte keinen neuen Dateinamen zurück");window.dispatchEvent(new CustomEvent("finished-downloads:rename",{detail:{oldFile:Se,newFile:Ee}}));const Ve=z=>P6(z||"",Ee);return yt(z=>z&&(z.id===R.id||Ei(z.output||"")===Se?{...z,output:Ve(z.output||"")}:z)),I(z=>z.map(K=>K.id===R.id||Ei(K.output||"")===Se?{...K,output:Ve(K.output||"")}:K)),ie(z=>z.map(K=>K.id===R.id||Ei(K.output||"")===Se?{...K,output:Ve(K.output||"")}:K)),ue}catch(ue){f.error("Umbenennen fehlgeschlagen",ue?.message??String(ue));return}},[f]),Vn=p.useCallback(async R=>{await si(R)},[si]);async function Gn(R){const U=await fetch("/api/models/flags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)});if(U.status===204)return null;if(!U.ok){const ue=await U.text().catch(()=>"");throw new Error(ue||`HTTP ${U.status}`)}return U.json()}const Kn=p.useCallback(R=>{const U=wt.current;!U||!R||(U.ts=Date.now(),U.list=U.list.filter(ue=>ue.id!==R))},[]),An=p.useRef({}),Oi=p.useCallback(async R=>{const U=Ei(R.output||""),ue=!!(dn&&Ei(dn.output||"")===U),Se=Me=>{try{const et=String(Me.sourceUrl??Me.SourceURL??""),gt=tl(et);return gt?new URL(gt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(Hc(R.output||"")||"").trim().toLowerCase();if(Ee){const Me=Ee;if(An.current[Me])return;An.current[Me]=!0;const et=kt[Ee]??{id:"",input:"",host:Se(R)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},gt=!et.favorite,Tt={...et,modelKey:et.modelKey||Ee,favorite:gt,liked:gt?!1:et.liked};Pe(Vt=>({...Vt,[Ee]:Tt})),Ce(Tt),ue&&nt(Tt);try{const Vt=await Gn({...Tt.id?{id:Tt.id}:{},host:Tt.host||Se(R)||"",modelKey:Ee,favorite:gt,...gt?{liked:!1}:{}});if(!Vt){Pe(un=>{const{[Ee]:Ci,...Pi}=un;return Pi}),et.id&&Kn(et.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:et.id,modelKey:Ee}}));return}const Ut=Je(Vt.modelKey||Ee);Ut&&Pe(un=>({...un,[Ut]:Vt})),Ce(Vt),ue&&nt(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Pe(Ut=>({...Ut,[Ee]:et})),Ce(et),ue&&nt(et),f.error("Favorit umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete An.current[Me]}return}let Ve=ue?Ze:null;if(Ve||(Ve=await _i(R,{ensure:!0})),!Ve)return;const z=Je(Ve.modelKey||Ve.id||"");if(!z||An.current[z])return;An.current[z]=!0;const K=Ve,re=!K.favorite,ye={...K,favorite:re,liked:re?!1:K.liked},ze=Je(K.modelKey||"");ze&&Pe(Me=>({...Me,[ze]:ye})),Ce(ye),ue&&nt(ye);try{const Me=await Gn({id:K.id,favorite:re,...re?{liked:!1}:{}});if(!Me){Pe(gt=>{const Tt=Je(K.modelKey||"");if(!Tt)return gt;const{[Tt]:Vt,...Ut}=gt;return Ut}),Kn(K.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:K.id,modelKey:K.modelKey}}));return}const et=Je(Me.modelKey||"");et&&Pe(gt=>({...gt,[et]:Me})),Ce(Me),ue&&nt(Me),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Me}}))}catch(Me){const et=Je(K.modelKey||"");et&&Pe(gt=>({...gt,[et]:K})),Ce(K),ue&&nt(K),f.error("Favorit umschalten fehlgeschlagen",Me?.message??String(Me))}finally{delete An.current[z]}},[f,dn,Ze,_i,Gn,Ce,Kn,kt]),Jn=p.useCallback(async R=>{const U=Ei(R.output||""),ue=!!(dn&&Ei(dn.output||"")===U),Se=Me=>{try{const et=String(Me.sourceUrl??Me.SourceURL??""),gt=tl(et);return gt?new URL(gt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(Hc(R.output||"")||"").trim().toLowerCase();if(Ee){const Me=Ee;if(An.current[Me])return;An.current[Me]=!0;const et=kt[Ee]??{id:"",input:"",host:Se(R)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},gt=et.liked!==!0,Tt={...et,modelKey:et.modelKey||Ee,liked:gt,favorite:gt?!1:et.favorite};Pe(Vt=>({...Vt,[Ee]:Tt})),Ce(Tt),ue&&nt(Tt);try{const Vt=await Gn({...Tt.id?{id:Tt.id}:{},host:Tt.host||Se(R)||"",modelKey:Ee,liked:gt,...gt?{favorite:!1}:{}});if(!Vt){Pe(un=>{const{[Ee]:Ci,...Pi}=un;return Pi}),et.id&&Kn(et.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:et.id,modelKey:Ee}}));return}const Ut=Je(Vt.modelKey||Ee);Ut&&Pe(un=>({...un,[Ut]:Vt})),Ce(Vt),ue&&nt(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Pe(Ut=>({...Ut,[Ee]:et})),Ce(et),ue&&nt(et),f.error("Like umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete An.current[Me]}return}let Ve=ue?Ze:null;if(Ve||(Ve=await _i(R,{ensure:!0})),!Ve)return;const z=Je(Ve.modelKey||Ve.id||"");if(!z||An.current[z])return;An.current[z]=!0;const K=Ve,re=K.liked!==!0,ye={...K,liked:re,favorite:re?!1:K.favorite},ze=Je(K.modelKey||"");ze&&Pe(Me=>({...Me,[ze]:ye})),Ce(ye),ue&&nt(ye);try{const Me=re?await Gn({id:K.id,liked:!0,favorite:!1}):await Gn({id:K.id,liked:!1});if(!Me){Pe(gt=>{const Tt=Je(K.modelKey||"");if(!Tt)return gt;const{[Tt]:Vt,...Ut}=gt;return Ut}),Kn(K.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:K.id,modelKey:K.modelKey}}));return}const et=Je(Me.modelKey||"");et&&Pe(gt=>({...gt,[et]:Me})),Ce(Me),ue&&nt(Me),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Me}}))}catch(Me){const et=Je(K.modelKey||"");et&&Pe(gt=>({...gt,[et]:K})),Ce(K),ue&&nt(K),f.error("Like umschalten fehlgeschlagen",Me?.message??String(Me))}finally{delete An.current[z]}},[f,dn,Ze,_i,Gn,Ce,Kn,kt]),Gi=p.useCallback(async R=>{const U=Ei(R.output||""),ue=!!(dn&&Ei(dn.output||"")===U),Se=Me=>{try{const et=String(Me.sourceUrl??Me.SourceURL??""),gt=tl(et);return gt?new URL(gt).hostname.replace(/^www\./i,"").toLowerCase():""}catch{return""}},Ee=(Hc(R.output||"")||"").trim().toLowerCase();if(Ee){const Me=Ee;if(An.current[Me])return;An.current[Me]=!0;const et=kt[Ee]??{id:"",input:"",host:Se(R)||void 0,modelKey:Ee,watching:!1,favorite:!1,liked:null,isUrl:!1},gt=!et.watching,Tt={...et,modelKey:et.modelKey||Ee,watching:gt};Pe(Vt=>({...Vt,[Ee]:Tt})),Ce(Tt),ue&&nt(Tt);try{const Vt=await Gn({...Tt.id?{id:Tt.id}:{},host:Tt.host||Se(R)||"",modelKey:Ee,watched:gt});if(!Vt){Pe(un=>{const{[Ee]:Ci,...Pi}=un;return Pi}),et.id&&Kn(et.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:et.id,modelKey:Ee}}));return}const Ut=Je(Vt.modelKey||Ee);Ut&&Pe(un=>({...un,[Ut]:Vt})),Ce(Vt),ue&&nt(Vt),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Vt}}))}catch(Vt){Pe(Ut=>({...Ut,[Ee]:et})),Ce(et),ue&&nt(et),f.error("Watched umschalten fehlgeschlagen",Vt?.message??String(Vt))}finally{delete An.current[Me]}return}let Ve=ue?Ze:null;if(Ve||(Ve=await _i(R,{ensure:!0})),!Ve)return;const z=Je(Ve.modelKey||Ve.id||"");if(!z||An.current[z])return;An.current[z]=!0;const K=Ve,re=!K.watching,ye={...K,watching:re},ze=Je(K.modelKey||"");ze&&Pe(Me=>({...Me,[ze]:ye})),Ce(ye),ue&&nt(ye);try{const Me=await Gn({id:K.id,watched:re});if(!Me){Pe(gt=>{const Tt=Je(K.modelKey||"");if(!Tt)return gt;const{[Tt]:Vt,...Ut}=gt;return Ut}),Kn(K.id),ue&&nt(null),window.dispatchEvent(new CustomEvent("models-changed",{detail:{removed:!0,id:K.id,modelKey:K.modelKey}}));return}const et=Je(Me.modelKey||"");et&&Pe(gt=>({...gt,[et]:Me})),Ce(Me),ue&&nt(Me),window.dispatchEvent(new CustomEvent("models-changed",{detail:{model:Me}}))}catch(Me){const et=Je(K.modelKey||"");et&&Pe(gt=>({...gt,[et]:K})),Ce(K),ue&&nt(K),f.error("Watched umschalten fehlgeschlagen",Me?.message??String(Me))}finally{delete An.current[z]}},[f,dn,Ze,_i,Gn,Ce,Kn,kt]);async function _i(R,U){const ue=!!U?.ensure,Se=ye=>{const ze=Date.now(),Me=wt.current;if(!Me){wt.current={ts:ze,list:[ye]};return}Me.ts=ze;const et=Me.list.findIndex(gt=>gt.id===ye.id);et>=0?Me.list[et]=ye:Me.list.unshift(ye)},Ee=async ye=>{if(!ye)return null;const ze=ye.trim().toLowerCase();if(!ze)return null;const Me=kt[ze];if(Me)return Se(Me),Me;if(ue){let Ut;try{const Ci=R.sourceUrl??R.SourceURL??"",Pi=tl(Ci);Pi&&(Ut=new URL(Pi).hostname.replace(/^www\./i,"").toLowerCase())}catch{}const un=await lr("/api/models/ensure",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modelKey:ye,...Ut?{host:Ut}:{}})});return Ce(un),un}const et=Date.now(),gt=wt.current;if(!gt||et-gt.ts>3e4){const Ut=Object.values(kt);if(Ut.length)wt.current={ts:et,list:Ut};else{const un=await lr("/api/models",{cache:"no-store"});wt.current={ts:et,list:Array.isArray(un)?un:[]}}}const Vt=(wt.current?.list??[]).find(Ut=>(Ut.modelKey||"").trim().toLowerCase()===ze);return Vt||null},Ve=Hc(R.output||"");if(Ve)return Ee(Ve);const z=R.status==="running",K=R.sourceUrl??R.SourceURL??"",re=tl(K);if(z&&re){const ye=await lr("/api/models/parse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:re})}),ze=await lr("/api/models/upsert",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ye)});return Ce(ze),ze}return null}return p.useEffect(()=>{if(!hn&&!Qt||!navigator.clipboard?.readText)return;let R=!1,U=!1,ue=null;const Se=async()=>{if(!(R||U)){U=!0;try{const z=await navigator.clipboard.readText(),K=tl(z);if(!K)return;const re=ka(K);if(!re||!od(re))return;const ze=bo(re);if(ze===Mt.current)return;Mt.current=ze,hn&&F(ze),Qt&&Cn({url:ze,silent:!1})}catch{}finally{U=!1}}},Ee=z=>{R||(ue=window.setTimeout(async()=>{await Se(),Ee(document.hidden?5e3:1500)},z))},Ve=()=>{Se()};return window.addEventListener("hover",Ve),document.addEventListener("visibilitychange",Ve),Ee(0),()=>{R=!0,ue&&window.clearTimeout(ue),window.removeEventListener("hover",Ve),document.removeEventListener("visibilitychange",Ve)}},[hn,Qt,Cn]),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(ON,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:Te})]}),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(gl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:pt})]}),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(yl,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:xt})]}),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(CN,{className:"size-4 opacity-80"}),c.jsx("span",{className:"tabular-nums",children:St})]})]}),c.jsx("div",{className:"hidden sm:block text-[11px] text-gray-500 dark:text-gray-400",children:ft})]}),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:ft}),c.jsxs("div",{className:"mt-2 flex items-stretch gap-2",children:[M?c.jsx(K_,{mode:"inline",className:"flex-1"}):c.jsx("div",{className:"flex-1"}),c.jsx(en,{variant:"secondary",onClick:()=>vt(!0),className:"px-3 shrink-0",children:"Cookies"}),c.jsx(en,{variant:"secondary",onClick:h,className:"px-3 shrink-0",children:"Abmelden"})]})]})]})}),c.jsxs("div",{className:"hidden sm:flex items-center gap-2 h-full",children:[M?c.jsx(K_,{mode:"inline"}):null,c.jsx(en,{variant:"secondary",onClick:()=>vt(!0),className:"h-9 px-3",children:"Cookies"}),c.jsx(en,{variant:"secondary",onClick:h,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:q,onChange:R=>F(R.target.value),onMouseDown:R=>{R.button===0&&(R.preventDefault(),l())},onFocus:()=>{l()},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:$n,disabled:!Ht,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:()=>Ie(null),"aria-label":"Fehlermeldung schließen",title:"Schließen",children:"✕"})]})}):null,Gt(q)&&!zn(Yt)?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,Qe?c.jsx("div",{className:"pt-1",children:c.jsx(gd,{label:"Starte Download…",indeterminate:!0})}):null,c.jsx("div",{className:"hidden sm:block pt-2",children:c.jsx(jg,{tabs:Pt,value:Nt,onChange:ln,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(jg,{tabs:Pt,value:Nt,onChange:ln,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(t6,{jobs:Ne,modelsByKey:kt,pending:vn,onOpenPlayer:Rt,onStopJob:Bi,onToggleFavorite:Oi,onToggleLike:Jn,onToggleWatch:Gi,onAddToDownloads:Vi,blurPreviews:!!dt.blurPreviews}):null,Nt==="finished"?c.jsx(D3,{jobs:ee,modelsByKey:kt,doneJobs:de,doneTotal:ve,page:pe,pageSize:E,onPageChange:we,onOpenPlayer:Rt,onDeleteJob:si,onToggleHot:Ri,onToggleFavorite:Oi,onToggleLike:Jn,onToggleWatch:Gi,onKeepJob:pi,blurPreviews:!!dt.blurPreviews,teaserPlayback:dt.teaserPlayback??"hover",teaserAudio:!!dt.teaserAudio,assetNonce:ne,sortMode:G,onSortModeChange:R=>{Q(R),we(1)},loadMode:"paged"}):null,Nt==="models"?c.jsx(o6,{}):null,Nt==="categories"?c.jsx(D6,{}):null,Nt==="settings"?c.jsx(FN,{onAssetsGenerated:qe}):null]}),c.jsx(yA,{open:It,onClose:()=>vt(!1),initialCookies:mt,onApply:R=>{const U=cf(Object.fromEntries(R.map(ue=>[ue.name,ue.value])));Ft(U),lr("/api/cookies",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookies:U})}).catch(()=>{})}}),c.jsx(w6,{open:!!fe,modelKey:fe,onClose:()=>He(null),onOpenPlayer:Rt,runningJobs:Ne,cookies:Yt,blurPreviews:dt.blurPreviews,teaserPlayback:dt.teaserPlayback??"hover",teaserAudio:!!dt.teaserAudio,onToggleHot:Ri,onDelete:Vn,onKeep:pi,onToggleFavorite:Oi,onToggleLike:Jn,onToggleWatch:Gi,onStopJob:Bi}),dn?c.jsx(W8,{job:dn,modelKey:me??void 0,modelsByKey:kt,expanded:Fn,onToggleExpand:()=>ot(R=>!R),onClose:()=>{yt(null),P(null)},startAtSec:N??void 0,isHot:Ei(dn.output||"").startsWith("HOT "),isFavorite:!!Ze?.favorite,isLiked:Ze?.liked===!0,isWatching:!!Ze?.watching,onKeep:pi,onDelete:Vn,onToggleHot:Ri,onToggleFavorite:Oi,onToggleLike:Jn,onStopJob:Bi,onToggleWatch:Gi},[String(dn?.id??""),Ei(dn.output||""),String(ne)].join("::")):null]})]}):c.jsx(I6,{onLoggedIn:u}):c.jsx("div",{className:"min-h-[100dvh] grid place-items-center",children:"Lade…"})}Q_.createRoot(document.getElementById("root")).render(c.jsx(p.StrictMode,{children:c.jsx(T3,{position:"top-right",maxToasts:3,defaultDurationMs:3500,children:c.jsx(z6,{})})}));
|