@halibegic/react-video-player 0.0.57 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,17 @@
1
- (function(k,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("react"),require("zustand"),require("mitt"),require("hls.js"),require("@radix-ui/react-slider"),require("@radix-ui/react-popover"),require("@radix-ui/react-scroll-area")):typeof define=="function"&&define.amd?define(["exports","react","zustand","mitt","hls.js","@radix-ui/react-slider","@radix-ui/react-popover","@radix-ui/react-scroll-area"],f):(k=typeof globalThis!="undefined"?globalThis:k||self,f(k.ReactVideoPlayer={},k.React,k.zustand,k.Mitt,k.Hls,k.RadixUISlider,k.RadixUIPopover,k.RadixUIScrollArea))})(this,(function(k,f,Y,te,$,mn,pn,vn){"use strict";var xo=Object.defineProperty,Eo=Object.defineProperties;var Ro=Object.getOwnPropertyDescriptors;var Ve=Object.getOwnPropertySymbols;var fn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable;var dn=(k,f,Y)=>f in k?xo(k,f,{enumerable:!0,configurable:!0,writable:!0,value:Y}):k[f]=Y,V=(k,f)=>{for(var Y in f||(f={}))fn.call(f,Y)&&dn(k,Y,f[Y]);if(Ve)for(var Y of Ve(f))hn.call(f,Y)&&dn(k,Y,f[Y]);return k},pe=(k,f)=>Eo(k,Ro(f));var re=(k,f)=>{var Y={};for(var te in k)fn.call(k,te)&&f.indexOf(te)<0&&(Y[te]=k[te]);if(k!=null&&Ve)for(var te of Ve(k))f.indexOf(te)<0&&hn.call(k,te)&&(Y[te]=k[te]);return Y};function Ae(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Ee=Ae(mn),ve=Ae(pn),Re=Ae(vn);function nt(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function rt(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var a=Array.prototype.slice.call(e);if(a.length===0)return n([]);var l=a.length;function u(c,d){if(d&&(typeof d=="object"||typeof d=="function")){var w=d.then;if(typeof w=="function"){w.call(d,function(_){u(c,_)},function(_){a[c]={status:"rejected",reason:_},--l===0&&n(a)});return}}a[c]={status:"fulfilled",value:d},--l===0&&n(a)}for(var s=0;s<a.length;s++)u(s,a[s])})}function ot(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}ot.prototype=Error.prototype;function st(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError("Promise.any accepts an array"));var a=Array.prototype.slice.call(e);if(a.length===0)return r();for(var l=[],u=0;u<a.length;u++)try{t.resolve(a[u]).then(n).catch(function(s){l.push(s),l.length===a.length&&r(new ot(l,"All promises were rejected"))})}catch(s){r(s)}})}var yn=setTimeout;function it(e){return!!(e&&typeof e.length!="undefined")}function gn(){}function wn(e,t){return function(){e.apply(t,arguments)}}function O(e){if(!(this instanceof O))throw new TypeError("Promises must be constructed via new");if(typeof e!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],ct(e,this)}function at(e,t){for(;e._state===3;)e=e._value;if(e._state===0){e._deferreds.push(t);return}e._handled=!0,O._immediateFn(function(){var n=e._state===1?t.onFulfilled:t.onRejected;if(n===null){(e._state===1?Oe:ye)(t.promise,e._value);return}var r;try{r=n(e._value)}catch(a){ye(t.promise,a);return}Oe(t.promise,r)})}function Oe(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var n=t.then;if(t instanceof O){e._state=3,e._value=t,He(e);return}else if(typeof n=="function"){ct(wn(n,t),e);return}}e._state=1,e._value=t,He(e)}catch(r){ye(e,r)}}function ye(e,t){e._state=2,e._value=t,He(e)}function He(e){e._state===2&&e._deferreds.length===0&&O._immediateFn(function(){e._handled||O._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)at(e,e._deferreds[t]);e._deferreds=null}function Cn(e,t,n){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.promise=n}function ct(e,t){var n=!1;try{e(function(r){n||(n=!0,Oe(t,r))},function(r){n||(n=!0,ye(t,r))})}catch(r){if(n)return;n=!0,ye(t,r)}}O.prototype.catch=function(e){return this.then(null,e)},O.prototype.then=function(e,t){var n=new this.constructor(gn);return at(this,new Cn(e,t,n)),n},O.prototype.finally=nt,O.all=function(e){return new O(function(t,n){if(!it(e))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(e);if(r.length===0)return t([]);var a=r.length;function l(s,c){try{if(c&&(typeof c=="object"||typeof c=="function")){var d=c.then;if(typeof d=="function"){d.call(c,function(w){l(s,w)},n);return}}r[s]=c,--a===0&&t(r)}catch(w){n(w)}}for(var u=0;u<r.length;u++)l(u,r[u])})},O.any=st,O.allSettled=rt,O.resolve=function(e){return e&&typeof e=="object"&&e.constructor===O?e:new O(function(t){t(e)})},O.reject=function(e){return new O(function(t,n){n(e)})},O.race=function(e){return new O(function(t,n){if(!it(e))return n(new TypeError("Promise.race accepts an array"));for(var r=0,a=e.length;r<a;r++)O.resolve(e[r]).then(t,n)})},O._immediateFn=typeof setImmediate=="function"&&function(e){setImmediate(e)}||function(e){yn(e,0)},O._unhandledRejectionFn=function(t){typeof console!="undefined"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var ce=(function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("unable to locate global object")})();typeof ce.Promise!="function"?ce.Promise=O:(ce.Promise.prototype.finally||(ce.Promise.prototype.finally=nt),ce.Promise.allSettled||(ce.Promise.allSettled=rt),ce.Promise.any||(ce.Promise.any=st));var Se={exports:{}},ge={};var lt;function _n(){if(lt)return ge;lt=1;var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(s,c,d){var w,_={},g=null,N=null;d!==void 0&&(g=""+d),c.key!==void 0&&(g=""+c.key),c.ref!==void 0&&(N=c.ref);for(w in c)r.call(c,w)&&!l.hasOwnProperty(w)&&(_[w]=c[w]);if(s&&s.defaultProps)for(w in c=s.defaultProps,c)_[w]===void 0&&(_[w]=c[w]);return{$$typeof:t,type:s,key:g,ref:N,props:_,_owner:a.current}}return ge.Fragment=n,ge.jsx=u,ge.jsxs=u,ge}var we={};var ut;function Tn(){return ut||(ut=1,process.env.NODE_ENV!=="production"&&(function(){var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),N=Symbol.for("react.offscreen"),R=Symbol.iterator,x="@@iterator";function S(o){if(o===null||typeof o!="object")return null;var m=R&&o[R]||o[x];return typeof m=="function"?m:null}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(o){{for(var m=arguments.length,y=new Array(m>1?m-1:0),T=1;T<m;T++)y[T-1]=arguments[T];P("error",o,y)}}function P(o,m,y){{var T=C.ReactDebugCurrentFrame,D=T.getStackAddendum();D!==""&&(m+="%s",y=y.concat([D]));var F=y.map(function(L){return String(L)});F.unshift("Warning: "+m),Function.prototype.apply.call(console[o],console,F)}}var B=!1,U=!1,p=!1,v=!1,b=!1,I;I=Symbol.for("react.module.reference");function A(o){return!!(typeof o=="string"||typeof o=="function"||o===r||o===l||b||o===a||o===d||o===w||v||o===N||B||U||p||typeof o=="object"&&o!==null&&(o.$$typeof===g||o.$$typeof===_||o.$$typeof===u||o.$$typeof===s||o.$$typeof===c||o.$$typeof===I||o.getModuleId!==void 0))}function M(o,m,y){var T=o.displayName;if(T)return T;var D=m.displayName||m.name||"";return D!==""?y+"("+D+")":y}function Q(o){return o.displayName||"Context"}function K(o){if(o==null)return null;if(typeof o.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case r:return"Fragment";case n:return"Portal";case l:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case w:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case s:var m=o;return Q(m)+".Consumer";case u:var y=o;return Q(y._context)+".Provider";case c:return M(o,o.render,"ForwardRef");case _:var T=o.displayName||null;return T!==null?T:K(o.type)||"Memo";case g:{var D=o,F=D._payload,L=D._init;try{return K(L(F))}catch(E){return null}}}return null}var G=Object.assign,ie=0,fe,ne,X,Te,Yt,Zt,Kt;function Gt(){}Gt.__reactDisabledLog=!0;function Xr(){{if(ie===0){fe=console.log,ne=console.info,X=console.warn,Te=console.error,Yt=console.group,Zt=console.groupCollapsed,Kt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Gt,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ie++}}function Jr(){{if(ie--,ie===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:G({},o,{value:fe}),info:G({},o,{value:ne}),warn:G({},o,{value:X}),error:G({},o,{value:Te}),group:G({},o,{value:Yt}),groupCollapsed:G({},o,{value:Zt}),groupEnd:G({},o,{value:Kt})})}ie<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ge=C.ReactCurrentDispatcher,Xe;function De(o,m,y){{if(Xe===void 0)try{throw Error()}catch(D){var T=D.stack.trim().match(/\n( *(at )?)/);Xe=T&&T[1]||""}return`
2
- `+Xe+o}}var Je=!1,Ne;{var Qr=typeof WeakMap=="function"?WeakMap:Map;Ne=new Qr}function Xt(o,m){if(!o||Je)return"";{var y=Ne.get(o);if(y!==void 0)return y}var T;Je=!0;var D=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var F;F=Ge.current,Ge.current=null,Xr();try{if(m){var L=function(){throw Error()};if(Object.defineProperty(L.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(L,[])}catch(q){T=q}Reflect.construct(o,[],L)}else{try{L.call()}catch(q){T=q}o.call(L.prototype)}}else{try{throw Error()}catch(q){T=q}o()}}catch(q){if(q&&T&&typeof q.stack=="string"){for(var E=q.stack.split(`
3
- `),J=T.stack.split(`
4
- `),z=E.length-1,W=J.length-1;z>=1&&W>=0&&E[z]!==J[W];)W--;for(;z>=1&&W>=0;z--,W--)if(E[z]!==J[W]){if(z!==1||W!==1)do if(z--,W--,W<0||E[z]!==J[W]){var ee=`
5
- `+E[z].replace(" at new "," at ");return o.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",o.displayName)),typeof o=="function"&&Ne.set(o,ee),ee}while(z>=1&&W>=0);break}}}finally{Je=!1,Ge.current=F,Jr(),Error.prepareStackTrace=D}var me=o?o.displayName||o.name:"",le=me?De(me):"";return typeof o=="function"&&Ne.set(o,le),le}function qr(o,m,y){return Xt(o,!1)}function $r(o){var m=o.prototype;return!!(m&&m.isReactComponent)}function Me(o,m,y){if(o==null)return"";if(typeof o=="function")return Xt(o,$r(o));if(typeof o=="string")return De(o);switch(o){case d:return De("Suspense");case w:return De("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case c:return qr(o.render);case _:return Me(o.type,m,y);case g:{var T=o,D=T._payload,F=T._init;try{return Me(F(D),m,y)}catch(L){}}}return""}var xe=Object.prototype.hasOwnProperty,Jt={},Qt=C.ReactDebugCurrentFrame;function Fe(o){if(o){var m=o._owner,y=Me(o.type,o._source,m?m.type:null);Qt.setExtraStackFrame(y)}else Qt.setExtraStackFrame(null)}function eo(o,m,y,T,D){{var F=Function.call.bind(xe);for(var L in o)if(F(o,L)){var E=void 0;try{if(typeof o[L]!="function"){var J=Error((T||"React class")+": "+y+" type `"+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[L]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}E=o[L](m,L,T,y,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(z){E=z}E&&!(E instanceof Error)&&(Fe(D),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",T||"React class",y,L,typeof E),Fe(null)),E instanceof Error&&!(E.message in Jt)&&(Jt[E.message]=!0,Fe(D),j("Failed %s type: %s",y,E.message),Fe(null))}}}var to=Array.isArray;function Qe(o){return to(o)}function no(o){{var m=typeof Symbol=="function"&&Symbol.toStringTag,y=m&&o[Symbol.toStringTag]||o.constructor.name||"Object";return y}}function ro(o){try{return qt(o),!1}catch(m){return!0}}function qt(o){return""+o}function $t(o){if(ro(o))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",no(o)),qt(o)}var en=C.ReactCurrentOwner,oo={key:!0,ref:!0,__self:!0,__source:!0},tn,nn;function so(o){if(xe.call(o,"ref")){var m=Object.getOwnPropertyDescriptor(o,"ref").get;if(m&&m.isReactWarning)return!1}return o.ref!==void 0}function io(o){if(xe.call(o,"key")){var m=Object.getOwnPropertyDescriptor(o,"key").get;if(m&&m.isReactWarning)return!1}return o.key!==void 0}function ao(o,m){typeof o.ref=="string"&&en.current}function co(o,m){{var y=function(){tn||(tn=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(o,"key",{get:y,configurable:!0})}}function lo(o,m){{var y=function(){nn||(nn=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};y.isReactWarning=!0,Object.defineProperty(o,"ref",{get:y,configurable:!0})}}var uo=function(o,m,y,T,D,F,L){var E={$$typeof:t,type:o,key:m,ref:y,props:L,_owner:F};return E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(E,"_self",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.defineProperty(E,"_source",{configurable:!1,enumerable:!1,writable:!1,value:D}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E};function fo(o,m,y,T,D){{var F,L={},E=null,J=null;y!==void 0&&($t(y),E=""+y),io(m)&&($t(m.key),E=""+m.key),so(m)&&(J=m.ref,ao(m,D));for(F in m)xe.call(m,F)&&!oo.hasOwnProperty(F)&&(L[F]=m[F]);if(o&&o.defaultProps){var z=o.defaultProps;for(F in z)L[F]===void 0&&(L[F]=z[F])}if(E||J){var W=typeof o=="function"?o.displayName||o.name||"Unknown":o;E&&co(L,W),J&&lo(L,W)}return uo(o,E,J,D,T,en.current,L)}}var qe=C.ReactCurrentOwner,rn=C.ReactDebugCurrentFrame;function he(o){if(o){var m=o._owner,y=Me(o.type,o._source,m?m.type:null);rn.setExtraStackFrame(y)}else rn.setExtraStackFrame(null)}var $e;$e=!1;function et(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function on(){{if(qe.current){var o=K(qe.current.type);if(o)return`
1
+ (function(k,f){typeof exports=="object"&&typeof module!="undefined"?f(exports,require("react"),require("zustand"),require("mitt"),require("hls.js"),require("@radix-ui/react-slider"),require("@radix-ui/react-popover"),require("@radix-ui/react-scroll-area")):typeof define=="function"&&define.amd?define(["exports","react","zustand","mitt","hls.js","@radix-ui/react-slider","@radix-ui/react-popover","@radix-ui/react-scroll-area"],f):(k=typeof globalThis!="undefined"?globalThis:k||self,f(k.ReactVideoPlayer={},k.React,k.zustand,k.Mitt,k.Hls,k.RadixUISlider,k.RadixUIPopover,k.RadixUIScrollArea))})(this,(function(k,f,z,te,q,mn,pn,vn){"use strict";var Po=Object.defineProperty,Lo=Object.defineProperties;var jo=Object.getOwnPropertyDescriptors;var Ve=Object.getOwnPropertySymbols;var fn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable;var dn=(k,f,z)=>f in k?Po(k,f,{enumerable:!0,configurable:!0,writable:!0,value:z}):k[f]=z,A=(k,f)=>{for(var z in f||(f={}))fn.call(f,z)&&dn(k,z,f[z]);if(Ve)for(var z of Ve(f))hn.call(f,z)&&dn(k,z,f[z]);return k},pe=(k,f)=>Lo(k,jo(f));var re=(k,f)=>{var z={};for(var te in k)fn.call(k,te)&&f.indexOf(te)<0&&(z[te]=k[te]);if(k!=null&&Ve)for(var te of Ve(k))f.indexOf(te)<0&&hn.call(k,te)&&(z[te]=k[te]);return z};function Ae(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Re=Ae(mn),ve=Ae(pn),xe=Ae(vn);function nt(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})}function rt(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var a=Array.prototype.slice.call(e);if(a.length===0)return n([]);var l=a.length;function u(c,d){if(d&&(typeof d=="object"||typeof d=="function")){var v=d.then;if(typeof v=="function"){v.call(d,function(T){u(c,T)},function(T){a[c]={status:"rejected",reason:T},--l===0&&n(a)});return}}a[c]={status:"fulfilled",value:d},--l===0&&n(a)}for(var s=0;s<a.length;s++)u(s,a[s])})}function ot(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}ot.prototype=Error.prototype;function st(e){var t=this;return new t(function(n,r){if(!(e&&typeof e.length!="undefined"))return r(new TypeError("Promise.any accepts an array"));var a=Array.prototype.slice.call(e);if(a.length===0)return r();for(var l=[],u=0;u<a.length;u++)try{t.resolve(a[u]).then(n).catch(function(s){l.push(s),l.length===a.length&&r(new ot(l,"All promises were rejected"))})}catch(s){r(s)}})}var yn=setTimeout;function at(e){return!!(e&&typeof e.length!="undefined")}function gn(){}function wn(e,t){return function(){e.apply(t,arguments)}}function H(e){if(!(this instanceof H))throw new TypeError("Promises must be constructed via new");if(typeof e!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],ct(e,this)}function it(e,t){for(;e._state===3;)e=e._value;if(e._state===0){e._deferreds.push(t);return}e._handled=!0,H._immediateFn(function(){var n=e._state===1?t.onFulfilled:t.onRejected;if(n===null){(e._state===1?Oe:ye)(t.promise,e._value);return}var r;try{r=n(e._value)}catch(a){ye(t.promise,a);return}Oe(t.promise,r)})}function Oe(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&(typeof t=="object"||typeof t=="function")){var n=t.then;if(t instanceof H){e._state=3,e._value=t,He(e);return}else if(typeof n=="function"){ct(wn(n,t),e);return}}e._state=1,e._value=t,He(e)}catch(r){ye(e,r)}}function ye(e,t){e._state=2,e._value=t,He(e)}function He(e){e._state===2&&e._deferreds.length===0&&H._immediateFn(function(){e._handled||H._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)it(e,e._deferreds[t]);e._deferreds=null}function Cn(e,t,n){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.promise=n}function ct(e,t){var n=!1;try{e(function(r){n||(n=!0,Oe(t,r))},function(r){n||(n=!0,ye(t,r))})}catch(r){if(n)return;n=!0,ye(t,r)}}H.prototype.catch=function(e){return this.then(null,e)},H.prototype.then=function(e,t){var n=new this.constructor(gn);return it(this,new Cn(e,t,n)),n},H.prototype.finally=nt,H.all=function(e){return new H(function(t,n){if(!at(e))return n(new TypeError("Promise.all accepts an array"));var r=Array.prototype.slice.call(e);if(r.length===0)return t([]);var a=r.length;function l(s,c){try{if(c&&(typeof c=="object"||typeof c=="function")){var d=c.then;if(typeof d=="function"){d.call(c,function(v){l(s,v)},n);return}}r[s]=c,--a===0&&t(r)}catch(v){n(v)}}for(var u=0;u<r.length;u++)l(u,r[u])})},H.any=st,H.allSettled=rt,H.resolve=function(e){return e&&typeof e=="object"&&e.constructor===H?e:new H(function(t){t(e)})},H.reject=function(e){return new H(function(t,n){n(e)})},H.race=function(e){return new H(function(t,n){if(!at(e))return n(new TypeError("Promise.race accepts an array"));for(var r=0,a=e.length;r<a;r++)H.resolve(e[r]).then(t,n)})},H._immediateFn=typeof setImmediate=="function"&&function(e){setImmediate(e)}||function(e){yn(e,0)},H._unhandledRejectionFn=function(t){typeof console!="undefined"&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var ce=(function(){if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("unable to locate global object")})();typeof ce.Promise!="function"?ce.Promise=H:(ce.Promise.prototype.finally||(ce.Promise.prototype.finally=nt),ce.Promise.allSettled||(ce.Promise.allSettled=rt),ce.Promise.any||(ce.Promise.any=st));var Se={exports:{}},ge={};var lt;function Tn(){if(lt)return ge;lt=1;var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function u(s,c,d){var v,T={},y=null,M=null;d!==void 0&&(y=""+d),c.key!==void 0&&(y=""+c.key),c.ref!==void 0&&(M=c.ref);for(v in c)r.call(c,v)&&!l.hasOwnProperty(v)&&(T[v]=c[v]);if(s&&s.defaultProps)for(v in c=s.defaultProps,c)T[v]===void 0&&(T[v]=c[v]);return{$$typeof:t,type:s,key:y,ref:M,props:T,_owner:a.current}}return ge.Fragment=n,ge.jsx=u,ge.jsxs=u,ge}var we={};var ut;function _n(){return ut||(ut=1,process.env.NODE_ENV!=="production"&&(function(){var e=f,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),b=Symbol.iterator,S="@@iterator";function L(o){if(o===null||typeof o!="object")return null;var m=b&&o[b]||o[S];return typeof m=="function"?m:null}var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function D(o){{for(var m=arguments.length,p=new Array(m>1?m-1:0),R=1;R<m;R++)p[R-1]=arguments[R];I("error",o,p)}}function I(o,m,p){{var R=_.ReactDebugCurrentFrame,N=R.getStackAddendum();N!==""&&(m+="%s",p=p.concat([N]));var V=p.map(function(j){return String(j)});V.unshift("Warning: "+m),Function.prototype.apply.call(console[o],console,V)}}var w=!1,E=!1,g=!1,x=!1,C=!1,Z;Z=Symbol.for("react.module.reference");function O(o){return!!(typeof o=="string"||typeof o=="function"||o===r||o===l||C||o===a||o===d||o===v||x||o===M||w||E||g||typeof o=="object"&&o!==null&&(o.$$typeof===y||o.$$typeof===T||o.$$typeof===u||o.$$typeof===s||o.$$typeof===c||o.$$typeof===Z||o.getModuleId!==void 0))}function F(o,m,p){var R=o.displayName;if(R)return R;var N=m.displayName||m.name||"";return N!==""?p+"("+N+")":p}function $(o){return o.displayName||"Context"}function X(o){if(o==null)return null;if(typeof o.tag=="number"&&D("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case r:return"Fragment";case n:return"Portal";case l:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case v:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case s:var m=o;return $(m)+".Consumer";case u:var p=o;return $(p._context)+".Provider";case c:return F(o,o.render,"ForwardRef");case T:var R=o.displayName||null;return R!==null?R:X(o.type)||"Memo";case y:{var N=o,V=N._payload,j=N._init;try{return X(j(V))}catch(P){return null}}}return null}var K=Object.assign,ae=0,fe,ne,G,_e,Yt,Zt,Kt;function Gt(){}Gt.__reactDisabledLog=!0;function eo(){{if(ae===0){fe=console.log,ne=console.info,G=console.warn,_e=console.error,Yt=console.group,Zt=console.groupCollapsed,Kt=console.groupEnd;var o={configurable:!0,enumerable:!0,value:Gt,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}ae++}}function to(){{if(ae--,ae===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:K({},o,{value:fe}),info:K({},o,{value:ne}),warn:K({},o,{value:G}),error:K({},o,{value:_e}),group:K({},o,{value:Yt}),groupCollapsed:K({},o,{value:Zt}),groupEnd:K({},o,{value:Kt})})}ae<0&&D("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ge=_.ReactCurrentDispatcher,Xe;function De(o,m,p){{if(Xe===void 0)try{throw Error()}catch(N){var R=N.stack.trim().match(/\n( *(at )?)/);Xe=R&&R[1]||""}return`
2
+ `+Xe+o}}var Je=!1,Ne;{var no=typeof WeakMap=="function"?WeakMap:Map;Ne=new no}function Xt(o,m){if(!o||Je)return"";{var p=Ne.get(o);if(p!==void 0)return p}var R;Je=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var V;V=Ge.current,Ge.current=null,eo();try{if(m){var j=function(){throw Error()};if(Object.defineProperty(j.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(j,[])}catch(Q){R=Q}Reflect.construct(o,[],j)}else{try{j.call()}catch(Q){R=Q}o.call(j.prototype)}}else{try{throw Error()}catch(Q){R=Q}o()}}catch(Q){if(Q&&R&&typeof Q.stack=="string"){for(var P=Q.stack.split(`
3
+ `),J=R.stack.split(`
4
+ `),B=P.length-1,W=J.length-1;B>=1&&W>=0&&P[B]!==J[W];)W--;for(;B>=1&&W>=0;B--,W--)if(P[B]!==J[W]){if(B!==1||W!==1)do if(B--,W--,W<0||P[B]!==J[W]){var ee=`
5
+ `+P[B].replace(" at new "," at ");return o.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",o.displayName)),typeof o=="function"&&Ne.set(o,ee),ee}while(B>=1&&W>=0);break}}}finally{Je=!1,Ge.current=V,to(),Error.prepareStackTrace=N}var me=o?o.displayName||o.name:"",le=me?De(me):"";return typeof o=="function"&&Ne.set(o,le),le}function ro(o,m,p){return Xt(o,!1)}function oo(o){var m=o.prototype;return!!(m&&m.isReactComponent)}function Me(o,m,p){if(o==null)return"";if(typeof o=="function")return Xt(o,oo(o));if(typeof o=="string")return De(o);switch(o){case d:return De("Suspense");case v:return De("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case c:return ro(o.render);case T:return Me(o.type,m,p);case y:{var R=o,N=R._payload,V=R._init;try{return Me(V(N),m,p)}catch(j){}}}return""}var Ee=Object.prototype.hasOwnProperty,Jt={},Qt=_.ReactDebugCurrentFrame;function Fe(o){if(o){var m=o._owner,p=Me(o.type,o._source,m?m.type:null);Qt.setExtraStackFrame(p)}else Qt.setExtraStackFrame(null)}function so(o,m,p,R,N){{var V=Function.call.bind(Ee);for(var j in o)if(V(o,j)){var P=void 0;try{if(typeof o[j]!="function"){var J=Error((R||"React class")+": "+p+" type `"+j+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[j]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw J.name="Invariant Violation",J}P=o[j](m,j,R,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(B){P=B}P&&!(P instanceof Error)&&(Fe(N),D("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",R||"React class",p,j,typeof P),Fe(null)),P instanceof Error&&!(P.message in Jt)&&(Jt[P.message]=!0,Fe(N),D("Failed %s type: %s",p,P.message),Fe(null))}}}var ao=Array.isArray;function Qe(o){return ao(o)}function io(o){{var m=typeof Symbol=="function"&&Symbol.toStringTag,p=m&&o[Symbol.toStringTag]||o.constructor.name||"Object";return p}}function co(o){try{return qt(o),!1}catch(m){return!0}}function qt(o){return""+o}function $t(o){if(co(o))return D("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",io(o)),qt(o)}var en=_.ReactCurrentOwner,lo={key:!0,ref:!0,__self:!0,__source:!0},tn,nn;function uo(o){if(Ee.call(o,"ref")){var m=Object.getOwnPropertyDescriptor(o,"ref").get;if(m&&m.isReactWarning)return!1}return o.ref!==void 0}function fo(o){if(Ee.call(o,"key")){var m=Object.getOwnPropertyDescriptor(o,"key").get;if(m&&m.isReactWarning)return!1}return o.key!==void 0}function ho(o,m){typeof o.ref=="string"&&en.current}function mo(o,m){{var p=function(){tn||(tn=!0,D("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};p.isReactWarning=!0,Object.defineProperty(o,"key",{get:p,configurable:!0})}}function po(o,m){{var p=function(){nn||(nn=!0,D("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};p.isReactWarning=!0,Object.defineProperty(o,"ref",{get:p,configurable:!0})}}var vo=function(o,m,p,R,N,V,j){var P={$$typeof:t,type:o,key:m,ref:p,props:j,_owner:V};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:N}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function yo(o,m,p,R,N){{var V,j={},P=null,J=null;p!==void 0&&($t(p),P=""+p),fo(m)&&($t(m.key),P=""+m.key),uo(m)&&(J=m.ref,ho(m,N));for(V in m)Ee.call(m,V)&&!lo.hasOwnProperty(V)&&(j[V]=m[V]);if(o&&o.defaultProps){var B=o.defaultProps;for(V in B)j[V]===void 0&&(j[V]=B[V])}if(P||J){var W=typeof o=="function"?o.displayName||o.name||"Unknown":o;P&&mo(j,W),J&&po(j,W)}return vo(o,P,J,N,R,en.current,j)}}var qe=_.ReactCurrentOwner,rn=_.ReactDebugCurrentFrame;function he(o){if(o){var m=o._owner,p=Me(o.type,o._source,m?m.type:null);rn.setExtraStackFrame(p)}else rn.setExtraStackFrame(null)}var $e;$e=!1;function et(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function on(){{if(qe.current){var o=X(qe.current.type);if(o)return`
6
6
 
7
- Check the render method of \``+o+"`."}return""}}function ho(o){return""}var sn={};function mo(o){{var m=on();if(!m){var y=typeof o=="string"?o:o.displayName||o.name;y&&(m=`
7
+ Check the render method of \``+o+"`."}return""}}function go(o){return""}var sn={};function wo(o){{var m=on();if(!m){var p=typeof o=="string"?o:o.displayName||o.name;p&&(m=`
8
8
 
9
- Check the top-level render call using <`+y+">.")}return m}}function an(o,m){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var y=mo(m);if(sn[y])return;sn[y]=!0;var T="";o&&o._owner&&o._owner!==qe.current&&(T=" It was passed a child from "+K(o._owner.type)+"."),he(o),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',y,T),he(null)}}function cn(o,m){{if(typeof o!="object")return;if(Qe(o))for(var y=0;y<o.length;y++){var T=o[y];et(T)&&an(T,m)}else if(et(o))o._store&&(o._store.validated=!0);else if(o){var D=S(o);if(typeof D=="function"&&D!==o.entries)for(var F=D.call(o),L;!(L=F.next()).done;)et(L.value)&&an(L.value,m)}}}function po(o){{var m=o.type;if(m==null||typeof m=="string")return;var y;if(typeof m=="function")y=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===c||m.$$typeof===_))y=m.propTypes;else return;if(y){var T=K(m);eo(y,o.props,"prop",T,o)}else if(m.PropTypes!==void 0&&!$e){$e=!0;var D=K(m);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",D||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function vo(o){{for(var m=Object.keys(o.props),y=0;y<m.length;y++){var T=m[y];if(T!=="children"&&T!=="key"){he(o),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",T),he(null);break}}o.ref!==null&&(he(o),j("Invalid attribute `ref` supplied to `React.Fragment`."),he(null))}}var ln={};function un(o,m,y,T,D,F){{var L=A(o);if(!L){var E="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=ho();J?E+=J:E+=on();var z;o===null?z="null":Qe(o)?z="array":o!==void 0&&o.$$typeof===t?(z="<"+(K(o.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):z=typeof o,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",z,E)}var W=fo(o,m,y,D,F);if(W==null)return W;if(L){var ee=m.children;if(ee!==void 0)if(T)if(Qe(ee)){for(var me=0;me<ee.length;me++)cn(ee[me],o);Object.freeze&&Object.freeze(ee)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else cn(ee,o)}if(xe.call(m,"key")){var le=K(o),q=Object.keys(m).filter(function(To){return To!=="key"}),tt=q.length>0?"{key: someKey, "+q.join(": ..., ")+": ...}":"{key: someKey}";if(!ln[le+tt]){var _o=q.length>0?"{"+q.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX:
9
+ Check the top-level render call using <`+p+">.")}return m}}function an(o,m){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var p=wo(m);if(sn[p])return;sn[p]=!0;var R="";o&&o._owner&&o._owner!==qe.current&&(R=" It was passed a child from "+X(o._owner.type)+"."),he(o),D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,R),he(null)}}function cn(o,m){{if(typeof o!="object")return;if(Qe(o))for(var p=0;p<o.length;p++){var R=o[p];et(R)&&an(R,m)}else if(et(o))o._store&&(o._store.validated=!0);else if(o){var N=L(o);if(typeof N=="function"&&N!==o.entries)for(var V=N.call(o),j;!(j=V.next()).done;)et(j.value)&&an(j.value,m)}}}function Co(o){{var m=o.type;if(m==null||typeof m=="string")return;var p;if(typeof m=="function")p=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===c||m.$$typeof===T))p=m.propTypes;else return;if(p){var R=X(m);so(p,o.props,"prop",R,o)}else if(m.PropTypes!==void 0&&!$e){$e=!0;var N=X(m);D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",N||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&D("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function To(o){{for(var m=Object.keys(o.props),p=0;p<m.length;p++){var R=m[p];if(R!=="children"&&R!=="key"){he(o),D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",R),he(null);break}}o.ref!==null&&(he(o),D("Invalid attribute `ref` supplied to `React.Fragment`."),he(null))}}var ln={};function un(o,m,p,R,N,V){{var j=O(o);if(!j){var P="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(P+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var J=go();J?P+=J:P+=on();var B;o===null?B="null":Qe(o)?B="array":o!==void 0&&o.$$typeof===t?(B="<"+(X(o.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):B=typeof o,D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",B,P)}var W=yo(o,m,p,N,V);if(W==null)return W;if(j){var ee=m.children;if(ee!==void 0)if(R)if(Qe(ee)){for(var me=0;me<ee.length;me++)cn(ee[me],o);Object.freeze&&Object.freeze(ee)}else D("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else cn(ee,o)}if(Ee.call(m,"key")){var le=X(o),Q=Object.keys(m).filter(function(bo){return bo!=="key"}),tt=Q.length>0?"{key: someKey, "+Q.join(": ..., ")+": ...}":"{key: someKey}";if(!ln[le+tt]){var So=Q.length>0?"{"+Q.join(": ..., ")+": ...}":"{}";D(`A props object containing a "key" prop is being spread into JSX:
10
10
  let props = %s;
11
11
  <%s {...props} />
12
12
  React keys must be passed directly to JSX without using spread:
13
13
  let props = %s;
14
- <%s key={someKey} {...props} />`,tt,le,_o,le),ln[le+tt]=!0}}return o===r?vo(W):po(W),W}}function yo(o,m,y){return un(o,m,y,!0)}function go(o,m,y){return un(o,m,y,!1)}var wo=go,Co=yo;we.Fragment=r,we.jsx=wo,we.jsxs=Co})()),we}var dt;function xn(){return dt||(dt=1,process.env.NODE_ENV==="production"?Se.exports=_n():Se.exports=Tn()),Se.exports}var i=xn();const ft=typeof window!="undefined"?f.useLayoutEffect:f.useEffect;function Ce(e,t){const n=f.useRef(e);ft(()=>{n.current=e},[e]),f.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function En(e,t){var n,r,a,l,u,s;if(typeof Intl!="undefined"&&Intl.DateTimeFormat)try{const d=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),w=parseInt(((n=d.find(S=>S.type==="year"))==null?void 0:n.value)||"0",10),_=parseInt(((r=d.find(S=>S.type==="month"))==null?void 0:r.value)||"0",10)-1,g=parseInt(((a=d.find(S=>S.type==="day"))==null?void 0:a.value)||"0",10),N=parseInt(((l=d.find(S=>S.type==="hour"))==null?void 0:l.value)||"0",10),R=parseInt(((u=d.find(S=>S.type==="minute"))==null?void 0:u.value)||"0",10),x=parseInt(((s=d.find(S=>S.type==="second"))==null?void 0:s.value)||"0",10);return new Date(w,_,g,N,R,x)}catch(c){return console.warn(`Failed to convert date to timezone ${t}, returning original date:`,c),e}return console.warn("Intl.DateTimeFormat not available, timezone conversion may be inaccurate"),e}function Rn(e,t,n){return ht(t.getTime()-e.getTime(),n,"milliseconds")}function Sn(){const e=new Date,t="YYYY-MM-DD HH:mm:ss.SSSSSS",n=(a,l=2)=>String(a).padStart(l,"0"),r={YYYY:String(e.getFullYear()),MM:n(e.getMonth()+1),DD:n(e.getDate()),HH:n(e.getHours()),mm:n(e.getMinutes()),ss:n(e.getSeconds()),SSSSSS:n(e.getMilliseconds(),3)+"000"};return Object.entries(r).reduce((a,[l,u])=>a.replace(l,u),t)}const _e=e=>{if(isNaN(e)||e===1/0)return"0:00";const t=l=>(l<10?"0":"")+l,n=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return n===0?`${r}:${t(a)}`:`${n}:${t(r)}:${t(a)}`};function bn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to get time zone, returning default time zone:",e),"Europe/Sarajevo"}}function Pn(e){return ht(e,"milliseconds","seconds")}function ht(e,t,n){const r={days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};return e*(r[t]/r[n])}function Ue(e){var n;const t=typeof window!="undefined"&&((n=window.navigator)==null?void 0:n.userAgent)||"";return e.test(t)}const mt=Ue(/Safari/i)&&!Ue(/Chrome|Chromium/i),Ln=Ue(/Tizen/i);function jn(){const e=document;return!!(e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||e.msFullscreenElement)}function kn(e){e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.webkitEnterFullScreen?e.webkitEnterFullScreen():e.mozRequestFullScreen&&e.mozRequestFullScreen()}function In(e){e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen&&e.mozCancelFullScreen()}function Dn(e,t){return e.addEventListener("fullscreenchange",t),e.addEventListener("webkitfullscreenchange",t),e.addEventListener("mozfullscreenchange",t),e.addEventListener("MSFullscreenChange",t),()=>{e.removeEventListener("fullscreenchange",t),e.removeEventListener("webkitfullscreenchange",t),e.removeEventListener("mozfullscreenchange",t),e.removeEventListener("MSFullscreenChange",t)}}const Nn=()=>te(),Mn=(e,t)=>({currentTime:0,duration:0,isEnded:!1,isLoading:!1,isLoop:!1,isMetaLoaded:!1,isPlaying:!1,isReady:!1,isStarted:!1,pauseTime:0,seekTime:-1,startTime:-1,volume:100,destroy:()=>{t().isStarted&&t().eventEmitter.emit("ended")},handleDurationChange:()=>{const n=t().techRef.current;n&&e({duration:n.duration})},handleEnd:()=>{t().techRef.current&&(t().eventEmitter.emit("ended"),e({isEnded:!0,isLoading:!1,isMetaLoaded:!1,isPlaying:!1}))},handleLoadedMetadata:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadedMetadata",{duration:n.duration}),n.loop=t().isLoop,n.volume=n.muted?0:1,t().startTime!==-1&&(n.currentTime=t().startTime),e({currentTime:t().startTime!==-1?t().startTime:n.currentTime,duration:n.duration,startTime:-1,isMetaLoaded:!0,volume:n.muted?0:100}))},handleLoadStart:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadStart"),e({isReady:!0}),!(t().isStarted&&!t().isPlaying)&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})}))},handlePause:()=>{t().techRef.current&&(t().eventEmitter.emit("pause"),e({isPlaying:!1,pauseTime:Date.now()}))},handlePlay:()=>{t().techRef.current&&(t().eventEmitter.emit(t().isStarted&&!t().isEnded?"resume":"play"),e({isPlaying:!0,pauseTime:0}))},handlePlaying:()=>{t().techRef.current&&(t().eventEmitter.emit("playing"),e({isLoading:!1}))},handleSeeked:()=>{t().techRef.current&&(t().eventEmitter.emit("seeked"),e({isLoading:!1}))},handleSeeking:()=>{t().techRef.current&&(t().eventEmitter.emit("seeking"),e({isLoading:!0}))},handleTimeUpdate:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("timeUpdate",{currentTime:n.currentTime,duration:n.duration}),e({currentTime:n.currentTime}))},handleWaiting:()=>{t().techRef.current&&(t().eventEmitter.emit("waiting"),e({isLoading:!0}))},handleVolumeChange:()=>{const n=t().techRef.current;n&&t().eventEmitter.emit("volumeChange",{volume:n.volume})},handleError:n=>{const r=t().techRef.current;if(!r)return;t().eventEmitter.emit("error",n);const a=r.error;if(!a)return;const l=`${a.code}`,u=a.message||"Unknown error occurred";e({error:{message:u,code:l,tech:"native"}})},pause:()=>{const n=t().techRef.current;n&&(n.pause(),e({isEnded:!1,isPlaying:!1,pauseTime:Date.now()}))},getPauseTimeDiff:()=>!t().isStarted||!t().pauseTime?0:parseInt(Pn(Date.now()-t().pauseTime).toFixed(0)),play:()=>{const n=t().techRef.current;n&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})})},restart:()=>{t().eventEmitter.emit("restart")},seek:n=>{const r=t().techRef.current;r&&(r.currentTime=n,e({seekTime:-1,currentTime:n,isStarted:!0,isEnded:!1}))},setIsLoading:n=>e({isLoading:n}),setIsLoop:n=>{const r=t().techRef.current;r&&(r.loop=n,e({isLoop:n}))},setStartTime:n=>e({startTime:n}),setVolume:n=>{const r=t().techRef.current;r&&(r.muted=n===0,r.volume=n/100,e({volume:n}))},stop:()=>{t().techRef.current&&e({isPlaying:!1,isLoading:!1})}}),Fn=(e,t)=>({isIdle:!1,setIsIdle:n=>e({isIdle:n}),resetIdle:()=>t().eventEmitter.emit("resetIdle")}),Vn=e=>({idleLocks:new Set,addIdleLock:t=>e(n=>({idleLocks:new Set(n.idleLocks).add(t)})),removeIdleLock:t=>e(n=>{const r=new Set(n.idleLocks);return r.delete(t),{idleLocks:r}})}),An=(e,t)=>({playbackRate:1,setPlaybackRate:n=>{const r=t().techRef.current;r&&(r.playbackRate=n,e({playbackRate:n}))}}),On=(e,t)=>({level:null,levels:null,setLevels:n=>e({levels:n}),setLevel:n=>e({level:n}),logLevel:n=>{n&&t().eventEmitter.emit("qualityChange",{level:n})}}),Hn=(e,t)=>({isFullscreen:!1,isFullscreenReady:!1,exitFullscreen:()=>{t().eventEmitter.emit("fullscreenChange",{isFullscreen:!1}),In(document),e({isFullscreen:!1})},requestFullscreen:()=>{const n=t().techRef.current,r=t().containerRef.current;if(!n||!r)return;t().eventEmitter.emit("fullscreenChange",{isFullscreen:!0});const a=mt?n:r;a&&kn(a),e({isFullscreen:!0})},setIsFullscreen:n=>e({isFullscreen:n}),setIsFullscreenReady:n=>e({isFullscreenReady:n})}),Un=e=>({error:null,setError:t=>e({error:t})}),Bn=()=>({eventEmitter:Nn()}),zn=e=>()=>V({},e),Wn=(e,t)=>Y.create()((...n)=>V(V(V(V(V(V(V(V(V({},Mn(...n)),Fn(...n)),Vn(...n)),An(...n)),On(...n)),Hn(...n)),Un(...n)),Bn(...n)),zn({techRef:e,containerRef:t})(...n))),pt=f.createContext(null);function Yn({children:e}){const t=f.useRef(null),n=f.useRef(null),r=f.useRef(null);return t.current||(t.current=Wn(n,r)),i.jsx(pt.Provider,{value:t.current,children:e})}const h=e=>{const t=f.useContext(pt);if(!t)throw new Error("usePlayerStore must be used within PlayerStoreProvider");return Y.useStore(t,e)},Be={version:"0.0.57"},ze=11e3,We={DEBUG:2,INFO:3,WARNING:4};function vt({title:e,id:t,kind:n,delay:r,url:a}){const l=f.useRef(null),u=f.useRef(!1),[s,c]=f.useState(null),d=h(C=>C.eventEmitter),w=h(C=>C.isPlaying),_=a.includes("staging")?"stg":"prd",g=_==="stg"?"https://collector-staging.spectar.tv/ingest":"https://collector.spectar.tv/ingest",N=_==="stg"?"spectar_fitnessanny_staging":"spectar_fitnessanny_production";u.current=w;const R=f.useCallback(async({type:C,message:j,level:P=We.INFO,duration:B,valueStr1:U,valueStr2:p})=>{const v={content_kind:n,datetime:{date:Sn(),timezone:bn()},installation:N,level_num:P,log_source:"fitnessanny_player",capp_version:Be.version,message:j,target_index:C==="client"?"client_log":"watching_activity_log"};e&&(v.title=e),t&&(v.value_int1=t),U&&(v.value_str1=U),p&&(v.value_str2=p),C==="watch"&&(B&&(v.interval_duration=B),r&&(v.catchup_time=r));const b=await fetch(g,{method:"POST",body:JSON.stringify(v)});if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`)},[g,r,t,N,n,e]),x=f.useCallback(C=>{l.current=C!=null?C:new Date},[]),S=f.useCallback(async C=>{!C&&l.current&&(C=Rn(l.current,new Date,"milliseconds")),console.log("[Player][Activity]","Watching",C),await R({type:"watch",message:"WATCHING",duration:C})},[R]);return Ce(()=>{S(s),x()},s),f.useEffect(()=>{const C=()=>{c(ze),R({type:"watch",message:"PLAY"}),x()},j=()=>{c(null),R({type:"watch",message:"PAUSE"}),S(),x()},P=()=>{c(ze),R({type:"watch",message:"RESUME"}),x()},B=()=>{c(null),u.current&&(R({type:"watch",message:"STOP"}),S()),c(ze),R({type:"watch",message:"PLAY"}),x()},U=()=>{c(null),R({type:"watch",message:"STOP"}),u.current&&S(),x()},p=({level:b})=>{b&&R({type:"client",message:"QUALITY_CHANGE",level:We.DEBUG,valueStr1:b})},v=b=>{let I="UNKNOWN_ERROR",A="Unknown error occurred";b instanceof MediaError&&(b.code&&(I=`${b.code}`),b.message&&(A=`${b.message}`)),R({type:"client",message:"ERROR",level:We.WARNING,valueStr1:I,valueStr2:A})};return d.on("play",C),d.on("pause",j),d.on("resume",P),d.on("restart",B),d.on("ended",U),d.on("qualityChange",p),d.on("error",v),()=>{d.off("play",C),d.off("pause",j),d.off("resume",P),d.off("restart",B),d.off("ended",U),d.off("qualityChange",p),d.off("error",v)}},[d,R,x,S]),null}const Zn=()=>Y.create(e=>({delay:0,startDate:null,viewerCount:null,setDelay:t=>e({delay:t}),setStartDate:t=>e({startDate:t}),setViewerCount:t=>e({viewerCount:t})})),yt=f.createContext(null),Kn=({children:e})=>{const t=f.useRef(null);return t.current||(t.current=Zn()),i.jsx(yt.Provider,{value:t.current,children:e})},H=e=>{const t=f.useContext(yt);if(!t)throw new Error("useLivePlayerStore must be used within PlayerStoreProvider");return Y.useStore(t,e)};function gt(e){try{const n=new URL(e).searchParams,r={};return n.forEach((a,l)=>{r[l]=a}),r}catch(t){return console.error("Invalid URL:",t),{}}}function Gn({url:e}){const{video_id:t}=gt(e),n=H(a=>a.delay),r=t?Number(t):void 0;return r?i.jsx(vt,{kind:n?"catchup":"live",delay:n,url:e,id:r}):null}const oe={playerNotice:"_playerNotice_x3acc_1",playerNoticeTitle:"_playerNoticeTitle_x3acc_19",playerNoticeText:"_playerNoticeText_x3acc_28",playerNoticeLowZIndex:"_playerNoticeLowZIndex_x3acc_37"};function Xn(e){const[,t]=f.useState(0);Ce(()=>t(n=>n+1),e)}function Jn(e){const t=e.split(`
15
- `);for(const n of t){const r=n.trim();if(r.startsWith("#EXT-X-PROGRAM-DATE-TIME:")){const a=r.replace("#EXT-X-PROGRAM-DATE-TIME:","").trim(),l=new Date(a);if(!isNaN(l.getTime()))return En(l,"Europe/Sarajevo")}}return null}function Qn(e,t){const n=e.split(`
16
- `);let r=!1;for(const a of n){const l=a.trim();if(l.startsWith("#EXT-X-STREAM-INF:")){r=!0;continue}if(r&&!l.startsWith("#")){if(l.startsWith("http"))return l;{const u=new URL(t);return new URL(l,u.origin+u.pathname.substring(0,u.pathname.lastIndexOf("/"))+"/").toString()}}}return null}function qn(e){return e.replace("playlist.m3u8","playlist_fmp4_dvr.m3u8")}async function $n(e){try{const t=qn(e);console.log("Converting to DVR URL:",t);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch master playlist: ${n.status} ${n.statusText}`);const r=await n.text(),a=Qn(r,t);if(!a)throw new Error("No chunklist URL found in master playlist");console.log("Found chunklist URL:",a);const l=await fetch(a);if(!l.ok)throw new Error(`Failed to fetch chunklist: ${l.status} ${l.statusText}`);const u=await l.text(),s=Jn(u);return s?console.log("Successfully detected start time:",s.toISOString()):console.log(" No start time found in chunklist"),s}catch(t){return console.error("Error getting start time from HLS URL:",t),null}}function er(n){var r=n,{url:e}=r,t=re(r,["url"]);const[a,l]=f.useState(!0),u=H(d=>d.startDate),s=H(d=>d.setStartDate),c=f.useCallback(async()=>{const d=await $n(e);d&&s(d)},[e,s]);return f.useEffect(()=>{(async()=>{l(!0),await c(),l(!1)})()},[c]),Ce(c,u?null:5e3),a?null:i.jsx(tr,V({},t))}function tr({children:e,messages:t}){const n=H(u=>u.startDate),r=h(u=>u.isStarted);return Xn(r?null:5e3),n?Date.now()<n.getTime()?i.jsx(nr,{startDate:n,title:t.eventNotStarted,message:t.eventStartingSoon}):i.jsx(i.Fragment,{children:e}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:t.unableToPlay})})}function nr({startDate:e,title:t,message:n}){const r=e.getTime()-Date.now(),a=Math.floor(r/(1e3*60*60)),l=Math.floor(r%(1e3*60*60)/(1e3*60));return a||l?i.jsxs("div",{className:oe.playerNotice,children:[i.jsx("h3",{className:oe.playerNoticeTitle,children:t}),i.jsxs("p",{className:oe.playerNoticeText,children:["(",a>0?`${a}h ${l}m`:`${l}m`,")"]})]}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:n})})}function wt({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=()=>e("play",void 0),r=()=>e("pause",void 0),a=()=>e("resume",void 0),l=()=>e("restart",void 0),u=()=>e("ended",void 0),s=()=>e("seeking",void 0),c=()=>e("seeked",void 0),d=C=>e("volumeChange",C),w=C=>e("fullscreenChange",C),_=C=>e("qualityChange",C),g=C=>e("loadedMetadata",C),N=()=>e("loadStart",void 0),R=()=>e("playing",void 0),x=()=>e("waiting",void 0),S=()=>e("error",void 0);return t.on("play",n),t.on("pause",r),t.on("resume",a),t.on("restart",l),t.on("ended",u),t.on("seeking",s),t.on("seeked",c),t.on("volumeChange",d),t.on("fullscreenChange",w),t.on("qualityChange",_),t.on("loadedMetadata",g),t.on("loadStart",N),t.on("playing",R),t.on("waiting",x),t.on("error",S),()=>{t.off("play",n),t.off("pause",r),t.off("resume",a),t.off("restart",l),t.off("ended",u),t.off("seeking",s),t.off("seeked",c),t.off("volumeChange",d),t.off("fullscreenChange",w),t.off("qualityChange",_),t.off("loadedMetadata",g),t.off("loadStart",N),t.off("playing",R),t.off("waiting",x),t.off("error",S)}},[e,t]),null}const Ct=(e,t=0)=>parseInt(Math.max(0,(Date.now()-(e+t*1e3))/1e3).toFixed(0)),_t=(e,t)=>Math.max(0,(Date.now()-e-t*1e3)/1e3),rr=(e,t)=>Math.max(0,(t-e)/1e3),or=(e,t=0)=>{const r=t<0?0:t,a=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"],l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(r))}${a[l]}`};function sr({isAuto:e,level:t,levels:n}){const r=n.length,a=[];return r>1&&a.push({sid:"quality-level-auto",label:"Auto",value:-1,selected:e||t===-1}),n.sort(function(l,u){const s=l.height||l.bitrate||0,c=u.height||u.bitrate||0;return s===c?0:s>c?1:-1}),n.map(l=>{const{bitrate:u,height:s,index:c}=l;a.push({sid:`quality-level-${c}`,label:s?`${s}p`:or(u),value:c,selected:r===1||!e&&c===t})}),a}function ir({callback:e}){const t=H(l=>l.delay),n=H(l=>l.startDate),r=n?n.getTime():0,a=h(l=>l.eventEmitter);return f.useEffect(()=>{const l=()=>e("timeUpdate",{currentTime:_t(r,t),duration:-1});return a.on("timeUpdate",l),()=>{a.off("timeUpdate",l)}},[e,t,a,r]),i.jsx(wt,{callback:e})}function Tt(){const e=h(s=>s.exitFullscreen),t=h(s=>s.isFullscreen),n=h(s=>s.isFullscreenReady),r=h(s=>s.requestFullscreen),a=h(s=>s.setVolume),l=h(s=>s.volume),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowUp":a(l+10<100?l+10:100),c=!0;break;case"ArrowDown":a(l-10>0?l-10:0),c=!0;break;case"KeyM":a(l===0?100:0),c=!0;break;case"KeyF":n&&(t?e():r(),c=!0);break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),null}function ar(){const e=H(s=>s.delay),t=h(s=>s.isPlaying),n=h(s=>s.pause),r=h(s=>s.getPauseTimeDiff),a=h(s=>s.play),l=H(s=>s.setDelay),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e+10),c=!0;break;case"ArrowRight":l(e-10>0?e-10:0),c=!0;break;case"Space":if(t)n();else{const d=r();d&&l(e+d),a()}c=!0;break}c&&s.preventDefault()}},[e,r,t,n,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Tt,{})}function xt({children:e}){return i.jsx(Yn,{children:e})}function cr({children:e}){return i.jsx(Kn,{children:i.jsx(xt,{children:e})})}function lr({url:e,isLive:t,messages:n}){const r=f.useRef(null),a=h(p=>p.level),l=h(p=>p.levels),u=h(p=>p.setLevel),s=h(p=>p.setLevels),c=h(p=>p.logLevel),d=h(p=>p.techRef),w=h(p=>p.setError),_=f.useRef(0),g=f.useRef(null),N=50,R=1e4,x=f.useCallback(p=>{if(r.current&&(r.current.nextLevel=p,u(null),l)){const v=l.map(b=>pe(V({},b),{selected:b.value===p}));s(v)}},[l,u,s]),S=f.useCallback(()=>{if(!d.current)return;console.log("[Player][HLS] MEDIA_ATTACHING");const p=document.createElement("source");p.src=e,p.type="application/vnd.apple.mpegurl",p.dataset.id="original-stream",d.current.appendChild(p),d.current.disableRemotePlayback=!1},[e,d]),C=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] MANIFEST_LOADED"),w(null),g.current&&(clearTimeout(g.current),g.current=null),_.current=0;const p=r.current.levels,v=r.current.currentLevel,b=r.current.autoLevelEnabled;s(sr({levels:p.map((I,A)=>{const{bitrate:M,height:Q,width:K}=I;return{bitrate:M,height:Q,index:A,width:K}}),level:v,isAuto:b}))},[w,s]),j=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] LEVEL_SWITCHED");const p=r.current.levels,v=r.current.currentLevel;if(p[v]?JSON.stringify(p[v]):null){let I="";p[v].height?I=`${p[v].height}p`:p[v].bitrate&&(I=`${p[v].bitrate}bps`),c(I)}},[c]),P=f.useCallback((p,v)=>{if(r.current&&v.fatal){let b,I="UNKNOWN_ERROR";switch(v.type){case $.ErrorTypes.NETWORK_ERROR:b=n.unableToPlay,console.log("[Player][HLS] NETWORK_ERROR",v),t?(_.current<N&&(g.current&&clearTimeout(g.current),_.current+=1,g.current=setTimeout(()=>{if(r.current)try{console.log("[Player][HLS] Retrying stream..."),r.current.loadSource(e)}catch(A){console.error("[Player][HLS] Retry failed:",A)}},R)),I="LIVE_MANIFEST_LOAD_ERROR"):(r.current.startLoad(),I="NETWORK_ERROR"),w({message:b,code:I,tech:"hls"});break;case $.ErrorTypes.MEDIA_ERROR:r.current.recoverMediaError();break}}},[t,e,w,n]),B=f.useCallback(()=>{if(!d.current)return;const p={startLevel:-1,maxBufferSize:30*1024*1024};Ln?(p.backBufferLength=-1,p.enableWorker=!1):t?p.backBufferLength=10:p.backBufferLength=60;try{console.log("[Player][HLS] URL",e),console.log("[Player][HLS] Config",JSON.stringify(p)),console.log("[Player][HLS] Version",$.version),r.current=new $(p),r.current.on($.Events.MEDIA_ATTACHING,S),r.current.on($.Events.MANIFEST_LOADED,C),r.current.on($.Events.LEVEL_SWITCHED,j),r.current.on($.Events.ERROR,P),r.current.attachMedia(d.current),r.current.loadSource(e)}catch(v){throw new Error(`Error initializing Hls: ${v}`)}},[S,C,j,P,t,d,e]),U=f.useCallback(()=>{if(r.current&&(r.current.off($.Events.MEDIA_ATTACHING,S),r.current.off($.Events.MANIFEST_LOADED,C),r.current.off($.Events.LEVEL_SWITCHED,j),r.current.off($.Events.ERROR,P),r.current.destroy(),r.current=null),d.current){const p=d.current;Array.from(p.children).filter(b=>{var I;return((I=b.dataset)==null?void 0:I.id)==="original-stream"}).forEach(b=>p.removeChild(b))}g.current&&(clearTimeout(g.current),g.current=null),_.current=0},[S,j,C,P,d]);return f.useEffect(()=>{a!==null&&x(a)},[a,x]),f.useEffect(()=>($.isSupported()&&B(),U),[U,B]),null}const ur={playerVideo:"_playerVideo_wc0sm_1"};function Et({url:e,isLive:t,isMuted:n=!1,messages:r}){const a=h(v=>v.destroy),l=h(v=>v.handleDurationChange),u=h(v=>v.handleEnd),s=h(v=>v.handleLoadedMetadata),c=h(v=>v.handleLoadStart),d=h(v=>v.handlePause),w=h(v=>v.handlePlay),_=h(v=>v.handlePlaying),g=h(v=>v.handleSeeked),N=h(v=>v.handleSeeking),R=h(v=>v.handleTimeUpdate),x=h(v=>v.handleWaiting),S=h(v=>v.handleVolumeChange),C=h(v=>v.handleError),j=h(v=>v.techRef),P=f.useRef(null),B=()=>t?{onTimeUpdate:U}:{onDurationChange:l,onSeeked:g,onSeeking:N,onTimeUpdate:U},U=()=>{(!P.current||Date.now()-P.current>=1e3)&&(R(),P.current=Date.now())},p=B();return f.useEffect(()=>()=>{a()},[a]),i.jsxs(i.Fragment,{children:[i.jsx(lr,{isLive:t,url:e,messages:r}),i.jsx("video",V({ref:j,className:ur.playerVideo,playsInline:!0,controls:!1,muted:n,preload:"auto",crossOrigin:"anonymous",onEnded:u,onError:C,onLoadedMetadata:s,onLoadStart:c,onPause:d,onPlay:w,onPlaying:_,onWaiting:x,onVolumeChange:S,tabIndex:-1},p))]})}function dr({url:e,messages:t}){const[n,r]=f.useState(null),a=H(u=>u.delay),l=f.useCallback(async()=>{r(a?e.replace("-live","-catchup").replace("playlist.m3u8",`playlist_fmp4_dvr_timeshift-${a}.m3u8`):e)},[a,e]);return f.useEffect(()=>{const u=requestAnimationFrame(()=>l());return()=>cancelAnimationFrame(u)},[l]),n?i.jsx(Et,{url:n,isLive:!0,messages:t}):null}function fr({url:e}){return h(n=>n.isStarted)?i.jsx(hr,{url:e}):null}function hr({url:e}){const t=H(l=>l.setViewerCount),n=f.useRef(null),r=l=>{try{return new URL(l).pathname.split("/").filter(d=>d.length>0)[0]||null}catch(u){return console.error("Failed to extract URI from player URL:",u),null}},a=f.useCallback(async()=>{var c;const l=r(e);if(!l){console.error("Could not extract URI from URL:",e);return}n.current&&n.current.abort(),n.current=new AbortController;const s=`https://${e.includes("staging")?"stg":"prd"}-fitnessanny.spectar.tv/analytics-api/v1/token-info/uri/${l}`;try{const d=await fetch(s,{signal:n.current.signal});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const _=(c=(await d.json()).count)!=null?c:0;t(_)}catch(d){if(d.name==="AbortError")return;console.error("Failed to fetch viewer count:",d),t(null)}},[t,e]);return f.useEffect(()=>(a(),()=>{n.current&&n.current.abort()}),[a,e]),Ce(a,15e3),null}function mr(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=s=>typeof window=="undefined"?t:window.matchMedia(s).matches,[a,l]=f.useState(()=>n?r(e):t);function u(){l(r(e))}return ft(()=>{if(typeof window=="undefined")return;const s=window.matchMedia(e);return u(),s.addListener?s.addListener(u):s.addEventListener("change",u),()=>{s.removeListener?s.removeListener(u):s.removeEventListener("change",u)}},[e]),a}const ue={playbackButton:"_playbackButton_lgsgw_1",seekIndicator:"_seekIndicator_lgsgw_23",seekIndicatorLeft:"_seekIndicatorLeft_lgsgw_49",seekIndicatorRight:"_seekIndicatorRight_lgsgw_53",seekIndicatorVisible:"_seekIndicatorVisible_lgsgw_57"},pr=10;function Rt(s){var c=s,{className:e,onClick:t,onForwardSeek:n,onBackwardSeek:r,maxForwardTime:a,maxBackwardTime:l}=c,u=re(c,["className","onClick","onForwardSeek","onBackwardSeek","maxForwardTime","maxBackwardTime"]);return mr("(pointer: coarse)")?i.jsx(yr,V({className:e,maxForwardTime:a,maxBackwardTime:l,onForwardSeek:n,onBackwardSeek:r},u)):i.jsx(vr,V({className:e,onClick:t},u))}function vr(r){var a=r,{className:e,onClick:t}=a,n=re(a,["className","onClick"]);const l=f.useRef(null),u=h(x=>x.exitFullscreen),s=h(x=>x.isFullscreen),c=h(x=>x.requestFullscreen),d=h(x=>x.resetIdle),w=x=>{N()?(g(),s?u():c()):_(x)},_=x=>{l.current=window.setTimeout(()=>{t==null||t(x),g()},200)},g=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},N=()=>l.current!==null,R=()=>{d()};return f.useEffect(()=>()=>{g()},[]),i.jsx("button",V({onClick:w,onMouseMove:R,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},n))}function yr(u){var s=u,{className:e,maxForwardTime:t,maxBackwardTime:n,onForwardSeek:r,onBackwardSeek:a}=s,l=re(s,["className","maxForwardTime","maxBackwardTime","onForwardSeek","onBackwardSeek"]);const c=f.useRef(null),d=f.useRef({single:null,indicator:null,accumulate:null}),w=f.useRef(null),_=f.useRef(0),g=f.useRef(null),[N,R]=f.useState({visible:!1,direction:null,time:0}),x=h(p=>p.isIdle),S=h(p=>p.setIsIdle),C=h(p=>p.resetIdle),j=(p,v)=>p<v/2?"backward":"forward",P=p=>{if(!w.current)return;const v=p.changedTouches[0];if(!v)return;const b=Date.now(),I=w.current.getBoundingClientRect(),A=v.clientX-I.left,M=v.clientY-I.top;if(A<0||A>I.width||M<0||M>I.height)return;const Q=c.current,K=Q?b-Q.time:1/0,G=j(A,I.width),ie=g.current!==null&&g.current===G&&Q!==null&&K<700&&Math.abs(A-Q.x)<100;if(Q!==null&&g.current===null&&K<300&&Math.abs(A-Q.x)<50||ie){p.preventDefault(),p.stopPropagation(),d.current.single&&(window.clearTimeout(d.current.single),d.current.single=null),C(),(g.current===null||g.current!==G)&&(_.current=0,g.current=G);const ne=G==="backward"?n:t;_.current=Math.min(_.current+pr,ne!=null?ne:1/0),B(G,_.current),d.current.accumulate&&window.clearTimeout(d.current.accumulate),d.current.accumulate=window.setTimeout(()=>{const X=_.current;X>0&&(g.current==="backward"?a==null||a(X):r==null||r(X),C()),_.current=0,g.current=null,c.current=null,U(),d.current.accumulate=null},500),c.current={time:b,x:A}}else{c.current={time:b,x:A},d.current.single&&window.clearTimeout(d.current.single);const ne=g.current!==null?700:350;d.current.single=window.setTimeout(()=>{if(g.current===null){d.current.single=null;const X=x;S(!X),X&&C()}c.current=null},ne)}},B=(p,v)=>{v!==0&&(R({visible:!0,direction:p,time:v}),d.current.indicator&&window.clearTimeout(d.current.indicator),d.current.indicator=window.setTimeout(()=>{U()},700))},U=()=>{R({visible:!1,direction:null,time:0}),d.current.indicator&&(window.clearTimeout(d.current.indicator),d.current.indicator=null)};return f.useEffect(()=>{const p=d.current;return()=>{p!=null&&p.single&&window.clearTimeout(p.single),p!=null&&p.indicator&&window.clearTimeout(p.indicator),p!=null&&p.accumulate&&window.clearTimeout(p.accumulate)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("button",V({ref:w,onTouchEnd:P,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},l)),N.visible&&i.jsxs("div",{className:`${ue.seekIndicator} ${ue.seekIndicatorVisible} ${N.direction==="backward"?ue.seekIndicatorLeft:ue.seekIndicatorRight}`,children:[N.direction==="backward"?"-":"+",_e(N.time)]})]})}function gr(){const e=h(c=>c.isPlaying),t=h(c=>c.pause),n=h(c=>c.getPauseTimeDiff),r=h(c=>c.play),a=H(c=>c.delay),l=H(c=>c.setDelay),u=H(c=>c.startDate),s=u?u.getTime():0;return i.jsx(Rt,{onClick:()=>{if(e)t();else{const c=n();c&&l(a+c),r()}},onBackwardSeek:c=>{const d=a+c;l(d)},onForwardSeek:c=>{const d=Math.max(0,a-c);l(d)},maxBackwardTime:Math.floor(s),maxForwardTime:Math.floor(a)})}const St={playerButton:"_playerButton_izwqq_1",playerButtonCircle:"_playerButtonCircle_izwqq_42"},ae=f.forwardRef((a,r)=>{var l=a,{shape:e="circle",className:t}=l,n=re(l,["shape","className"]);const u=e==="circle"?St.playerButtonCircle:"",s=[St.playerButton,u,t].filter(Boolean).join(" ");return i.jsx("button",V({ref:r,className:s},n))});ae.displayName="PlayerButton";const be={liveIndicator:"_liveIndicator_1jczn_1",liveIndicatorHasDelay:"_liveIndicatorHasDelay_1jczn_9",liveIndicatorNoDelay:"_liveIndicatorNoDelay_1jczn_13"};function wr(n){var r=n,{message:e}=r,t=re(r,["message"]);const a=h(d=>d.restart),l=H(d=>d.delay),u=H(d=>d.setDelay),s=()=>{l&&(a(),u(0))},c=l?`${be.liveIndicator} ${be.liveIndicatorHasDelay}`:`${be.liveIndicator} ${be.liveIndicatorNoDelay}`;return i.jsxs(ae,pe(V({onClick:s,shape:"square"},t),{children:[i.jsx("div",{className:c}),e||"Live"]}))}function bt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6 5H8V19H6V5ZM16 5H18V19H16V5Z"})})}function Pt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M19.376 12.4161L8.77735 19.4818C8.54759 19.635 8.23715 19.5729 8.08397 19.3432C8.02922 19.261 8 19.1645 8 19.0658V4.93433C8 4.65818 8.22386 4.43433 8.5 4.43433C8.59871 4.43433 8.69522 4.46355 8.77735 4.5183L19.376 11.584C19.6057 11.7372 19.6678 12.0477 19.5146 12.2774C19.478 12.3323 19.4309 12.3795 19.376 12.4161Z"})})}function Cr(){const e=h(s=>s.isPlaying),t=h(s=>s.pause),n=h(s=>s.getPauseTimeDiff),r=h(s=>s.play),a=H(s=>s.delay),l=H(s=>s.setDelay),u=()=>{if(e)t();else{const s=n();s&&l(a+s),r()}};return i.jsx(ae,{onClick:u,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const se={progressSlider:"_progressSlider_hwzgf_1",tipContainer:"_tipContainer_hwzgf_7",tipContainerVisible:"_tipContainerVisible_hwzgf_17",tipContainerHidden:"_tipContainerHidden_hwzgf_22",tipContent:"_tipContent_hwzgf_27"},Pe={sliderRoot:"_sliderRoot_aeak6_1",sliderTrack:"_sliderTrack_aeak6_18",sliderRange:"_sliderRange_aeak6_28",sliderThumb:"_sliderThumb_aeak6_37"},Le=f.forwardRef((l,a)=>{var u=l,{max:e=100,min:t=0,className:n}=u,r=re(u,["max","min","className"]);return i.jsxs(Ee.Root,pe(V({ref:a,min:t,max:e,"aria-label":"Player progress",className:[Pe.sliderRoot,n].filter(Boolean).join(" "),onKeyDown:s=>s.preventDefault()},r),{children:[i.jsx(Ee.Track,{className:Pe.sliderTrack,children:i.jsx(Ee.Range,{className:Pe.sliderRange})}),i.jsx(Ee.Thumb,{className:Pe.sliderThumb})]}))});Le.displayName="PlayerSlider";function je(e){const t=e.getBoundingClientRect();return e.offsetWidth/e.offsetHeight>e.clientWidth/e.clientHeight?{left:t.left*100,right:t.right*100,top:t.top*100,bottom:t.bottom*100,width:t.width*100,height:t.height*100}:t}const Lt="vod-player-progress-bar";function _r(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(0),[a,l]=f.useState(0),[u,s]=f.useState(!1),[c,d]=f.useState(-1),[w,_]=f.useState(-1),g=H(M=>M.delay),N=H(M=>M.startDate),R=N?N.getTime():0,x=new Date().getTime(),S=H(M=>M.setDelay),C=h(M=>M.isPlaying),j=h(M=>M.addIdleLock),P=h(M=>M.removeIdleLock),B=f.useCallback(()=>{r(_t(R,g)),l(rr(R,x))},[g,x,R]),U=parseFloat((a?(w!==-1?w:n)/a*100:0).toFixed(1)),p=M=>{_(a*(M[0]/100)),j(Lt)},v=()=>{if(w!==-1){const M=Ct(R,w);S(M),_(-1),P(Lt)}},b=()=>s(!0),I=()=>s(!1),A=f.useCallback(M=>{const Q=e.current,K=t.current;if(Q&&K){const G=je(Q),ie=je(K),fe=(M.pageX||M.clientX)-G.left,ne=fe/G.width;if(ne<0)return;let X=fe-ie.width/2;X<0&&(X=0),X>G.width-ie.width&&(X=-1),K.style.left=X>-1?`${X}px`:"auto",K.style.right=X>-1?"auto":"0px";const Te=a-ne*a;d(Te>0?Te:0)}b()},[a]);return Ce(()=>B(),C?1e3:null),f.useEffect(()=>{const M=requestAnimationFrame(()=>B());return()=>cancelAnimationFrame(M)},[B]),i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[U],onPointerLeave:I,onPointerDown:I,onPointerMove:A,onValueChange:p,onValueCommit:v,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${u?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:`-${_e(c)}`})})]})}function Tr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M22 12C22 17.5228 17.5229 22 12 22C6.4772 22 2 17.5228 2 12C2 6.47715 6.4772 2 12 2V4C7.5817 4 4 7.58172 4 12C4 16.4183 7.5817 20 12 20C16.4183 20 20 16.4183 20 12C20 9.53614 18.8862 7.33243 17.1346 5.86492L15 8V2L21 2L18.5535 4.44656C20.6649 6.28002 22 8.9841 22 12Z"})})}function xr(){const e=H(a=>a.startDate),t=H(a=>a.setDelay),n=e?e.getTime():0,r=()=>t(Ct(n));return i.jsx(ae,{onClick:r,children:i.jsx(Tr,{})})}const ke={viewersContainer:"_viewersContainer_z1ihz_1",viewersIndicator:"_viewersIndicator_z1ihz_16",viewersIcon:"_viewersIcon_z1ihz_24",viewersCount:"_viewersCount_z1ihz_28"};function Er(){const e=H(t=>t.viewerCount);return e?i.jsxs("div",{className:ke.viewersContainer,children:[i.jsx("span",{className:ke.viewersIndicator}),i.jsxs("svg",{className:ke.viewersIcon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M8 7C9.10457 7 10 6.10457 10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5C6 6.10457 6.89543 7 8 7Z",fill:"currentColor"}),i.jsx("path",{d:"M8 8C5.79086 8 4 9.79086 4 12V13H12V12C12 9.79086 10.2091 8 8 8Z",fill:"currentColor"})]}),i.jsx("span",{className:ke.viewersCount,children:e.toLocaleString()})]}):null}function jt(){const e=h(n=>n.error);if(!e)return null;const t=e.code==="LIVE_MANIFEST_LOAD_ERROR";return i.jsx("div",{className:`${oe.playerNotice} ${t?oe.playerNoticeLowZIndex:""}`,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:e.message})})}const Z={playerContainer:"_playerContainer_146tx_1",controlsTop:"_controlsTop_146tx_12",controlsBottom:"_controlsBottom_146tx_29",controlsContainer:"_controlsContainer_146tx_45",controlsRow:"_controlsRow_146tx_61",controlsSection:"_controlsSection_146tx_68",controlsSectionStart:"_controlsSectionStart_146tx_78",controlsSectionEnd:"_controlsSectionEnd_146tx_82"};function Rr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M16 3H22V9H20V5H16V3ZM2 3H8V5H4V9H2V3ZM20 19V15H22V21H16V19H20ZM4 19H8V21H2V15H4V19Z"})})}function Sr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z"})})}function kt(){const e=h(d=>d.containerRef),t=h(d=>d.exitFullscreen),n=h(d=>d.isFullscreen),r=h(d=>d.requestFullscreen),a=h(d=>d.setIsFullscreen),l=h(d=>d.setIsFullscreenReady),u=h(d=>d.techRef),s=f.useCallback(d=>{d.stopPropagation(),a(jn())},[a]),c=()=>{n?t():r()};return f.useEffect(()=>{const d=mt?u.current:e.current;if(d)return Dn(d,s)},[e,s,u]),f.useEffect(()=>{l(!0)},[l]),i.jsx(ae,{onClick:c,children:n?i.jsx(Sr,{}):i.jsx(Rr,{})})}const Ye={idleCheckContainer:"_idleCheckContainer_crh2s_1",idleCheckContainerIdle:"_idleCheckContainerIdle_crh2s_5",idleCheckContainerActive:"_idleCheckContainerActive_crh2s_11"},br=5*1e3;function It({children:e}){const t=f.useRef(null),n=h(g=>g.isIdle),r=h(g=>g.setIsIdle),a=f.useRef(null),u=h(g=>g.idleLocks).size,s=h(g=>g.eventEmitter),c=f.useCallback(()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},[]),d=f.useCallback(()=>{c(),a.current=window.setTimeout(()=>r(!0),br)},[c,r]);f.useEffect(()=>(r(!1),d(),()=>{c()}),[c,r,d]),f.useEffect(()=>{const g=()=>{r(!1),d()};return s.on("resetIdle",g),()=>{s.off("resetIdle",g)}},[s,r,d]);const w=n&&!u,_=`${Ye.idleCheckContainer} ${w?Ye.idleCheckContainerIdle:Ye.idleCheckContainerActive}`;return i.jsx("div",{ref:t,className:_,children:e})}const Pr={spinner:"_spinner_oo4hi_10"};function Lr(e){return i.jsx("div",V({className:Pr.spinner},e))}function jr(e,t=500){const[n,r]=f.useState(e);return f.useEffect(()=>{const a=window.setTimeout(()=>r(e),t);return()=>{window.clearTimeout(a)}},[e,t]),n}const kr={loadingContainer:"_loadingContainer_v9v7r_1"};function Dt(n){var r=n,{style:e}=r,t=re(r,["style"]);const a=h(u=>u.isLoading);return jr(a,100)?i.jsx("div",pe(V({className:kr.loadingContainer,style:e},t),{children:i.jsx(Lr,{})})):null}function Nt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})})}function Ir(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 5V19H20V5H4ZM3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3ZM7.5 11.25H9.5V9H11V15H9.5V12.75H7.5V15H6V9H7.5V11.25ZM14.5 10.5V13.5H16C16.2761 13.5 16.5 13.2761 16.5 13V11C16.5 10.7239 16.2761 10.5 16 10.5H14.5ZM13 9H16C17.1046 9 18 9.89543 18 11V13C18 14.1046 17.1046 15 16 15H13V9Z"})})}const de={dropdownMenuContent:"_dropdownMenuContent_zi433_1",dropdownMenuItem:"_dropdownMenuItem_zi433_77",scrollAreaRoot:"_scrollAreaRoot_zi433_120",scrollAreaViewport:"_scrollAreaViewport_zi433_127",scrollAreaScrollbar:"_scrollAreaScrollbar_zi433_133",scrollAreaThumb:"_scrollAreaThumb_zi433_160"},Mt=ve.Root,Ft=ve.Trigger,Vt=ve.Portal,Ze=f.forwardRef((l,a)=>{var u=l,{sideOffset:e=4,className:t,children:n}=u,r=re(u,["sideOffset","className","children"]);return i.jsx(ve.Content,pe(V({ref:a,sideOffset:e,className:[de.dropdownMenuContent,t].filter(Boolean).join(" "),onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()}},r),{children:i.jsxs(Re.Root,{className:de.scrollAreaRoot,type:"always",scrollHideDelay:0,children:[i.jsx(Re.Viewport,{className:de.scrollAreaViewport,children:n}),i.jsx(Re.Scrollbar,{className:de.scrollAreaScrollbar,orientation:"vertical",children:i.jsx(Re.Thumb,{className:de.scrollAreaThumb})})]})}))});Ze.displayName="PlayerMenuContent";const Ke=f.forwardRef((a,r)=>{var l=a,{className:e,onClick:t}=l,n=re(l,["className","onClick"]);const u=c=>{t==null||t(c)},s=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t==null||t(c))};return i.jsx(ve.Close,{asChild:!0,children:i.jsx("div",V({ref:r,className:[de.dropdownMenuItem,e].filter(Boolean).join(" "),role:"menuitem",tabIndex:0,onClick:u,onKeyDown:s},n))})});Ke.displayName="PlayerMenuItem";const At="quality";function Ot(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.levels),u=h(c=>c.setLevel),s=f.useCallback(c=>{t(c),c?r(At):a(At)},[r,a]);return!l||l.length===0?null:i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsx(ae,{children:i.jsx(Ir,{})})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ze,{side:"top",align:"end",children:l.map(c=>i.jsxs(Ke,{onClick:()=>u(c.value),children:[c.label,c.selected&&i.jsx(Nt,{})]},c.sid))})})]})}function Dr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6.60282 10.0001L10 7.22056V16.7796L6.60282 14.0001H3V10.0001H6.60282ZM2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"})})}function Nr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M13 7.22056L9.60282 10.0001H6V14.0001H9.60282L13 16.7796V7.22056ZM8.88889 16.0001H5C4.44772 16.0001 4 15.5524 4 15.0001V9.00007C4 8.44778 4.44772 8.00007 5 8.00007H8.88889L14.1834 3.66821C14.3971 3.49335 14.7121 3.52485 14.887 3.73857C14.9601 3.8279 15 3.93977 15 4.05519V19.9449C15 20.2211 14.7761 20.4449 14.5 20.4449C14.3846 20.4449 14.2727 20.405 14.1834 20.3319L8.88889 16.0001ZM18.8631 16.5911L17.4411 15.1691C18.3892 14.4376 19 13.2902 19 12.0001C19 10.5697 18.2493 9.31476 17.1203 8.60766L18.5589 7.16906C20.0396 8.26166 21 10.0187 21 12.0001C21 13.8422 20.1698 15.4905 18.8631 16.5911Z"})})}function Mr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M10 7.22056L6.60282 10.0001H3V14.0001H6.60282L10 16.7796V7.22056ZM5.88889 16.0001H2C1.44772 16.0001 1 15.5524 1 15.0001V9.00007C1 8.44778 1.44772 8.00007 2 8.00007H5.88889L11.1834 3.66821C11.3971 3.49335 11.7121 3.52485 11.887 3.73857C11.9601 3.8279 12 3.93977 12 4.05519V19.9449C12 20.2211 11.7761 20.4449 11.5 20.4449C11.3846 20.4449 11.2727 20.405 11.1834 20.3319L5.88889 16.0001ZM20.4142 12.0001L23.9497 15.5356L22.5355 16.9498L19 13.4143L15.4645 16.9498L14.0503 15.5356L17.5858 12.0001L14.0503 8.46454L15.4645 7.05032L19 10.5859L22.5355 7.05032L23.9497 8.46454L20.4142 12.0001Z"})})}const Ht={volumeContainer:"_volumeContainer_4d6jg_1",volumeSlider:"_volumeSlider_4d6jg_8"},Ut="volume";function Bt(){const e=h(s=>s.setVolume),t=h(s=>s.volume),n=h(s=>s.addIdleLock),r=h(s=>s.removeIdleLock),a=s=>{e(s[0]),n(Ut)},l=()=>{r(Ut)},u=()=>e(t?0:100);return i.jsxs("div",{className:Ht.volumeContainer,children:[i.jsx(ae,{onClick:u,className:"shrink-0",children:t?t>50?i.jsx(Dr,{}):i.jsx(Nr,{}):i.jsx(Mr,{})}),i.jsx("div",{className:Ht.volumeSlider,children:i.jsx(Le,{value:[t],onValueChange:a,onValueCommit:l})})]})}function Fr(e){return i.jsx(cr,{children:i.jsx(Vr,V({},e))})}function Vr({url:e,messages:t={},onEvent:n}){var l,u,s,c;const r=h(d=>d.containerRef),a={eventNotStarted:"Event has not started yet.",eventStartingSoon:"Starting in few seconds...",unableToPlay:"Unable to play the live stream. Please try again later."};return f.useEffect(()=>{console.log(`[Player][Live] Version: ${Be.version}`)},[]),i.jsxs("div",{ref:r,className:Z.playerContainer,children:[i.jsxs(er,{url:e,messages:{eventNotStarted:(l=t==null?void 0:t.eventNotStarted)!=null?l:a.eventNotStarted,eventStartingSoon:(u=t==null?void 0:t.eventStartingSoon)!=null?u:a.eventStartingSoon,unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:a.unableToPlay},children:[i.jsx(dr,{url:e,messages:{unableToPlay:(c=t==null?void 0:t.unableToPlay)!=null?c:a.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(gr,{}),i.jsxs(It,{children:[i.jsx("div",{className:Z.controlsTop,children:i.jsx("div",{className:Z.controlsContainer,children:i.jsx("div",{className:Z.controlsRow,children:i.jsx(Er,{})})})}),i.jsx("div",{className:Z.controlsBottom,children:i.jsxs("div",{className:Z.controlsContainer,children:[i.jsx(_r,{}),i.jsxs("div",{className:Z.controlsRow,children:[i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionStart}`,children:[i.jsx(Cr,{}),i.jsx(xr,{}),i.jsx(Bt,{})]}),i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionEnd}`,children:[i.jsx(wr,{message:t==null?void 0:t.live}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})]}),i.jsx(Gn,{url:e}),i.jsx(ar,{}),i.jsx(fr,{url:e})]}),n&&i.jsx(ir,{callback:n})]})}const Ar=[.5,.75,1,1.25,1.5,1.75,2],zt="playback-rate";function Or(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.playbackRate),u=h(c=>c.setPlaybackRate),s=f.useCallback(c=>{t(c),c?r(zt):a(zt)},[r,a]);return i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsxs(ae,{children:[l,"x"]})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ze,{side:"top",align:"end",children:Ar.map(c=>i.jsxs(Ke,{onClick:()=>u(c),children:[c,"x",l===c&&i.jsx(Nt,{})]},c))})})]})}function Hr(){const e=h(u=>u.isPlaying),t=h(u=>u.pause),n=h(u=>u.play),r=h(u=>u.currentTime),a=h(u=>u.duration),l=h(u=>u.seek);return i.jsx(Rt,{onClick:()=>{e?t():n()},onBackwardSeek:u=>{const s=Math.max(0,r-u);l(s)},onForwardSeek:u=>{const s=Math.min(r+u,a);l(s)},maxBackwardTime:Math.floor(r),maxForwardTime:Math.floor(a-r)})}function Ur(){const e=h(a=>a.isPlaying),t=h(a=>a.pause),n=h(a=>a.play),r=()=>{e?t():n()};return i.jsx(ae,{onClick:r,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const Wt="vod-player-progress-bar";function Br(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(!1),[a,l]=f.useState(-1),[u,s]=f.useState(-1),c=h(P=>P.currentTime),d=h(P=>P.duration),w=h(P=>P.seek),_=h(P=>P.addIdleLock),g=h(P=>P.removeIdleLock),N=parseFloat((d?(u!==-1?u:c)/d*100:0).toFixed(1)),R=P=>{s(d*(P[0]/100)),_(Wt)},x=()=>{u!==-1&&(w(u),s(-1),g(Wt))},S=()=>r(!0),C=()=>r(!1),j=f.useCallback(P=>{const B=e.current,U=t.current;if(B&&U){const p=je(B),v=je(U),b=(P.pageX||P.clientX)-p.left,I=b/p.width;if(I<0)return;let A=b-v.width/2;A<0&&(A=0),A>p.width-v.width&&(A=-1),U.style.left=A>-1?`${A}px`:"auto",U.style.right=A>-1?"auto":"0px",l(I*d)}S()},[d]);return i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[N],onPointerLeave:C,onPointerDown:C,onPointerMove:j,onValueChange:R,onValueCommit:x,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${n?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:_e(a)})})]})}const Ie={remainingTimeContainer:"_remainingTimeContainer_1yyhb_1",remainingTime:"_remainingTime_1yyhb_1",remainingSeparator:"_remainingSeparator_1yyhb_17"};function zr(){const e=h(n=>n.currentTime),t=h(n=>n.duration);return i.jsxs("div",{className:Ie.remainingTimeContainer,children:[i.jsx("p",{className:Ie.remainingTime,children:_e(e)}),i.jsx("p",{className:Ie.remainingSeparator}),i.jsx("p",{className:Ie.remainingTime,children:_e(t)})]})}function Wr({url:e}){const{video_id:t}=gt(e),n=t?Number(t):void 0;return n?i.jsx(vt,{kind:"vod",url:e,id:n}):null}function Yr({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=r=>e("timeUpdate",r);return t.on("timeUpdate",n),()=>{t.off("timeUpdate",n)}},[e,t]),i.jsx(wt,{callback:e})}function Zr(){const e=h(s=>s.currentTime),t=h(s=>s.duration),n=h(s=>s.isPlaying),r=h(s=>s.pause),a=h(s=>s.play),l=h(s=>s.seek),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e-10>=0?e-10:0),c=!0;break;case"ArrowRight":l(e+10<t?e+10:t),c=!0;break;case"Space":n?r():a(),c=!0;break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(Tt,{})}function Kr(e){return i.jsx(xt,{children:i.jsx(Gr,V({},e))})}function Gr({url:e,messages:t,onEvent:n,startTime:r}){var s;const a=h(c=>c.setStartTime),l=h(c=>c.containerRef),u={unableToPlay:"Unable to play the video. Please try again later."};return f.useEffect(()=>{r&&a(r)},[r,a]),f.useEffect(()=>{console.log(`[Player][VOD] Version: ${Be.version}`)},[]),i.jsxs("div",{ref:l,className:Z.playerContainer,children:[i.jsx(Et,{url:e,isLive:!1,messages:{unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:u.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(Hr,{}),i.jsx(It,{children:i.jsx("div",{className:Z.controlsBottom,children:i.jsxs("div",{className:Z.controlsContainer,children:[i.jsx(Br,{}),i.jsxs("div",{className:Z.controlsRow,children:[i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionStart}`,children:[i.jsx(Ur,{}),i.jsx(Bt,{}),i.jsx(zr,{})]}),i.jsxs("div",{className:`${Z.controlsSection} ${Z.controlsSectionEnd}`,children:[i.jsx(Or,{}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})}),i.jsx(Zr,{}),i.jsx(Wr,{url:e}),n&&i.jsx(Yr,{callback:n})]})}k.LivePlayer=Fr,k.VodPlayer=Kr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
14
+ <%s key={someKey} {...props} />`,tt,le,So,le),ln[le+tt]=!0}}return o===r?To(W):Co(W),W}}function _o(o,m,p){return un(o,m,p,!0)}function Eo(o,m,p){return un(o,m,p,!1)}var Ro=Eo,xo=_o;we.Fragment=r,we.jsx=Ro,we.jsxs=xo})()),we}var dt;function En(){return dt||(dt=1,process.env.NODE_ENV==="production"?Se.exports=Tn():Se.exports=_n()),Se.exports}var i=En();const ft=typeof window!="undefined"?f.useLayoutEffect:f.useEffect;function Ce(e,t){const n=f.useRef(e);ft(()=>{n.current=e},[e]),f.useEffect(()=>{if(t===null)return;const r=setInterval(()=>{n.current()},t);return()=>{clearInterval(r)}},[t])}function Rn(e,t){var n,r,a,l,u,s;if(typeof Intl!="undefined"&&Intl.DateTimeFormat)try{const d=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),v=parseInt(((n=d.find(L=>L.type==="year"))==null?void 0:n.value)||"0",10),T=parseInt(((r=d.find(L=>L.type==="month"))==null?void 0:r.value)||"0",10)-1,y=parseInt(((a=d.find(L=>L.type==="day"))==null?void 0:a.value)||"0",10),M=parseInt(((l=d.find(L=>L.type==="hour"))==null?void 0:l.value)||"0",10),b=parseInt(((u=d.find(L=>L.type==="minute"))==null?void 0:u.value)||"0",10),S=parseInt(((s=d.find(L=>L.type==="second"))==null?void 0:s.value)||"0",10);return new Date(v,T,y,M,b,S)}catch(c){return console.warn(`Failed to convert date to timezone ${t}, returning original date:`,c),e}return console.warn("Intl.DateTimeFormat not available, timezone conversion may be inaccurate"),e}function xn(e,t,n){return ht(t.getTime()-e.getTime(),n,"milliseconds")}function Sn(){const e=new Date,t="YYYY-MM-DD HH:mm:ss.SSSSSS",n=(a,l=2)=>String(a).padStart(l,"0"),r={YYYY:String(e.getFullYear()),MM:n(e.getMonth()+1),DD:n(e.getDate()),HH:n(e.getHours()),mm:n(e.getMinutes()),ss:n(e.getSeconds()),SSSSSS:n(e.getMilliseconds(),3)+"000"};return Object.entries(r).reduce((a,[l,u])=>a.replace(l,u),t)}const Te=e=>{if(isNaN(e)||e===1/0)return"0:00";const t=l=>(l<10?"0":"")+l,n=Math.floor(e/3600),r=Math.floor(e%3600/60),a=Math.floor(e%60);return n===0?`${r}:${t(a)}`:`${n}:${t(r)}:${t(a)}`};function bn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return console.warn("Failed to get time zone, returning default time zone:",e),"Europe/Sarajevo"}}function Pn(e){return ht(e,"milliseconds","seconds")}function ht(e,t,n){const r={days:86400,hours:3600,minutes:60,seconds:1,milliseconds:.001};return e*(r[t]/r[n])}function mt(e){var n;const t=typeof window!="undefined"&&((n=window.navigator)==null?void 0:n.userAgent)||"";return e.test(t)}const Ue=mt(/iPhone|iPad|iPod/i),Ln=mt(/Tizen/i);function jn(){const e=document;return!!(e.fullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||e.msFullscreenElement)}function kn(e){e.requestFullscreen?e.requestFullscreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullScreen?e.webkitRequestFullScreen():e.webkitEnterFullScreen?e.webkitEnterFullScreen():e.mozRequestFullScreen&&e.mozRequestFullScreen()}function In(e){e.exitFullscreen?e.exitFullscreen():e.msExitFullscreen?e.msExitFullscreen():e.webkitExitFullscreen?e.webkitExitFullscreen():e.mozCancelFullScreen&&e.mozCancelFullScreen()}function Dn(e,t){return e.addEventListener("fullscreenchange",t),e.addEventListener("webkitfullscreenchange",t),e.addEventListener("mozfullscreenchange",t),e.addEventListener("MSFullscreenChange",t),()=>{e.removeEventListener("fullscreenchange",t),e.removeEventListener("webkitfullscreenchange",t),e.removeEventListener("mozfullscreenchange",t),e.removeEventListener("MSFullscreenChange",t)}}const Nn=()=>te(),Mn=(e,t)=>({currentTime:0,duration:0,isEnded:!1,isLoading:!1,isLoop:!1,isMetaLoaded:!1,isPlaying:!1,isReady:!1,isStarted:!1,pauseTime:0,seekTime:-1,startTime:-1,volume:100,destroy:()=>{t().isStarted&&t().eventEmitter.emit("ended")},handleDurationChange:()=>{const n=t().techRef.current;n&&e({duration:n.duration})},handleEnd:()=>{t().techRef.current&&(t().eventEmitter.emit("ended"),e({isEnded:!0,isLoading:!1,isMetaLoaded:!1,isPlaying:!1}))},handleLoadedMetadata:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadedMetadata",{duration:n.duration}),n.loop=t().isLoop,n.volume=n.muted?0:1,t().startTime!==-1&&(n.currentTime=t().startTime),e({currentTime:t().startTime!==-1?t().startTime:n.currentTime,duration:n.duration,startTime:-1,isMetaLoaded:!0,volume:n.muted?0:100}))},handleLoadStart:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("loadStart"),e({isReady:!0}),!(t().isStarted&&!t().isPlaying)&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})}))},handlePause:()=>{t().techRef.current&&(t().eventEmitter.emit("pause"),e({isPlaying:!1,pauseTime:Date.now()}))},handlePlay:()=>{t().techRef.current&&(t().eventEmitter.emit(t().isStarted&&!t().isEnded?"resume":"play"),e({isPlaying:!0,pauseTime:0}))},handlePlaying:()=>{t().techRef.current&&(t().eventEmitter.emit("playing"),e({isLoading:!1}))},handleSeeked:()=>{t().techRef.current&&(t().eventEmitter.emit("seeked"),e({isLoading:!1}))},handleSeeking:()=>{t().techRef.current&&(t().eventEmitter.emit("seeking"),e({isLoading:!0}))},handleTimeUpdate:()=>{const n=t().techRef.current;n&&(t().eventEmitter.emit("timeUpdate",{currentTime:n.currentTime,duration:n.duration}),e({currentTime:n.currentTime}))},handleWaiting:()=>{t().techRef.current&&(t().eventEmitter.emit("waiting"),e({isLoading:!0}))},handleVolumeChange:()=>{const n=t().techRef.current;n&&t().eventEmitter.emit("volumeChange",{volume:n.volume})},handleError:n=>{const r=t().techRef.current;if(!r)return;t().eventEmitter.emit("error",n);const a=r.error;if(!a)return;const l=`${a.code}`,u=a.message||"Unknown error occurred";e({error:{message:u,code:l,tech:"native"}})},pause:()=>{const n=t().techRef.current;n&&(n.pause(),e({isEnded:!1,isPlaying:!1,pauseTime:Date.now()}))},getPauseTimeDiff:()=>!t().isStarted||!t().pauseTime?0:parseInt(Pn(Date.now()-t().pauseTime).toFixed(0)),play:()=>{const n=t().techRef.current;n&&n.play().then(()=>{e({isEnded:!1,isLoading:!1,isPlaying:!0,isStarted:!0,pauseTime:0})}).catch(()=>{e({isStarted:!1,isEnded:!1,isLoading:!1,isPlaying:!1})})},restart:()=>{t().eventEmitter.emit("restart")},seek:n=>{const r=t().techRef.current;r&&(r.currentTime=n,e({seekTime:-1,currentTime:n,isStarted:!0,isEnded:!1}))},setIsLoading:n=>e({isLoading:n}),setIsLoop:n=>{const r=t().techRef.current;r&&(r.loop=n,e({isLoop:n}))},setStartTime:n=>e({startTime:n}),setVolume:n=>{const r=t().techRef.current;r&&(r.muted=n===0,r.volume=n/100,e({volume:n}))},stop:()=>{t().techRef.current&&e({isPlaying:!1,isLoading:!1})}}),Fn=(e,t)=>({isIdle:!1,setIsIdle:n=>e({isIdle:n}),resetIdle:()=>t().eventEmitter.emit("resetIdle")}),Vn=e=>({idleLocks:new Set,addIdleLock:t=>e(n=>({idleLocks:new Set(n.idleLocks).add(t)})),removeIdleLock:t=>e(n=>{const r=new Set(n.idleLocks);return r.delete(t),{idleLocks:r}})}),An=(e,t)=>({playbackRate:1,setPlaybackRate:n=>{const r=t().techRef.current;r&&(r.playbackRate=n,e({playbackRate:n}))}}),On=(e,t)=>({level:null,levels:null,setLevels:n=>e({levels:n}),setLevel:n=>e({level:n}),logLevel:n=>{n&&t().eventEmitter.emit("qualityChange",{level:n})}}),Hn=(e,t)=>({isFullscreen:!1,isFullscreenReady:!1,exitFullscreen:()=>{t().eventEmitter.emit("fullscreenChange",{isFullscreen:!1}),In(document),e({isFullscreen:!1})},requestFullscreen:()=>{const n=t().techRef.current,r=t().containerRef.current;if(!n||!r)return;t().eventEmitter.emit("fullscreenChange",{isFullscreen:!0});const a=Ue?n:r;a&&kn(a),e({isFullscreen:!0})},setIsFullscreen:n=>e({isFullscreen:n}),setIsFullscreenReady:n=>e({isFullscreenReady:n})}),Un=e=>({error:null,setError:t=>e({error:t})}),Bn=()=>({eventEmitter:Nn()}),Wn=e=>()=>A({},e),zn=(e,t)=>z.create()((...n)=>A(A(A(A(A(A(A(A(A({},Mn(...n)),Fn(...n)),Vn(...n)),An(...n)),On(...n)),Hn(...n)),Un(...n)),Bn(...n)),Wn({techRef:e,containerRef:t})(...n))),pt=f.createContext(null);function Yn({children:e}){const t=f.useRef(null),n=f.useRef(null),r=f.useRef(null);return t.current||(t.current=zn(n,r)),i.jsx(pt.Provider,{value:t.current,children:e})}const h=e=>{const t=f.useContext(pt);if(!t)throw new Error("usePlayerStore must be used within PlayerStoreProvider");return z.useStore(t,e)},Be={version:"0.0.59"},We=11e3,ze={DEBUG:2,INFO:3,WARNING:4};function vt({title:e,id:t,kind:n,delay:r,url:a}){const l=f.useRef(null),u=f.useRef(!1),[s,c]=f.useState(null),d=h(_=>_.eventEmitter),v=h(_=>_.isPlaying),T=a.includes("staging")?"stg":"prd",y=T==="stg"?"https://collector-staging.spectar.tv/ingest":"https://collector.spectar.tv/ingest",M=T==="stg"?"spectar_fitnessanny_staging":"spectar_fitnessanny_production";u.current=v;const b=f.useCallback(async({type:_,message:D,level:I=ze.INFO,duration:w,valueStr1:E,valueStr2:g})=>{const x={content_kind:n,datetime:{date:Sn(),timezone:bn()},installation:M,level_num:I,log_source:"fitnessanny_player",capp_version:Be.version,message:D,target_index:_==="client"?"client_log":"watching_activity_log"};e&&(x.title=e),t&&(x.value_int1=t),E&&(x.value_str1=E),g&&(x.value_str2=g),_==="watch"&&(w&&(x.interval_duration=w),r&&(x.catchup_time=r));const C=await fetch(y,{method:"POST",body:JSON.stringify(x)});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)},[y,r,t,M,n,e]),S=f.useCallback(_=>{l.current=_!=null?_:new Date},[]),L=f.useCallback(async _=>{!_&&l.current&&(_=xn(l.current,new Date,"milliseconds")),console.log("[Player][Activity]","Watching",_),await b({type:"watch",message:"WATCHING",duration:_})},[b]);return Ce(()=>{L(s),S()},s),f.useEffect(()=>{const _=()=>{c(We),b({type:"watch",message:"PLAY"}),S()},D=()=>{c(null),b({type:"watch",message:"PAUSE"}),L(),S()},I=()=>{c(We),b({type:"watch",message:"RESUME"}),S()},w=()=>{c(null),u.current&&(b({type:"watch",message:"STOP"}),L()),c(We),b({type:"watch",message:"PLAY"}),S()},E=()=>{c(null),b({type:"watch",message:"STOP"}),u.current&&L(),S()},g=({level:C})=>{C&&b({type:"client",message:"QUALITY_CHANGE",level:ze.DEBUG,valueStr1:C})},x=C=>{let Z="UNKNOWN_ERROR",O="Unknown error occurred";C instanceof MediaError&&(C.code&&(Z=`${C.code}`),C.message&&(O=`${C.message}`)),b({type:"client",message:"ERROR",level:ze.WARNING,valueStr1:Z,valueStr2:O})};return d.on("play",_),d.on("pause",D),d.on("resume",I),d.on("restart",w),d.on("ended",E),d.on("qualityChange",g),d.on("error",x),()=>{d.off("play",_),d.off("pause",D),d.off("resume",I),d.off("restart",w),d.off("ended",E),d.off("qualityChange",g),d.off("error",x)}},[d,b,S,L]),null}const Zn=()=>z.create(e=>({delay:0,startDate:null,viewerCount:null,setDelay:t=>e({delay:t}),setStartDate:t=>e({startDate:t}),setViewerCount:t=>e({viewerCount:t})})),yt=f.createContext(null),Kn=({children:e})=>{const t=f.useRef(null);return t.current||(t.current=Zn()),i.jsx(yt.Provider,{value:t.current,children:e})},U=e=>{const t=f.useContext(yt);if(!t)throw new Error("useLivePlayerStore must be used within PlayerStoreProvider");return z.useStore(t,e)};function gt(e){try{const n=new URL(e).searchParams,r={};return n.forEach((a,l)=>{r[l]=a}),r}catch(t){return console.error("Invalid URL:",t),{}}}function Gn({url:e}){const{video_id:t}=gt(e),n=U(a=>a.delay),r=t?Number(t):void 0;return r?i.jsx(vt,{kind:n?"catchup":"live",delay:n,url:e,id:r}):null}const oe={playerNotice:"_playerNotice_x3acc_1",playerNoticeTitle:"_playerNoticeTitle_x3acc_19",playerNoticeText:"_playerNoticeText_x3acc_28",playerNoticeLowZIndex:"_playerNoticeLowZIndex_x3acc_37"};function Xn(e){const[,t]=f.useState(0);Ce(()=>t(n=>n+1),e)}function Jn(e){const t=e.split(`
15
+ `);for(const n of t){const r=n.trim();if(r.startsWith("#EXT-X-PROGRAM-DATE-TIME:")){const a=r.replace("#EXT-X-PROGRAM-DATE-TIME:","").trim(),l=new Date(a);if(!isNaN(l.getTime()))return Rn(l,"Europe/Sarajevo")}}return null}function Qn(e,t){const n=e.split(`
16
+ `);let r=!1;for(const a of n){const l=a.trim();if(l.startsWith("#EXT-X-STREAM-INF:")){r=!0;continue}if(r&&!l.startsWith("#")){if(l.startsWith("http"))return l;{const u=new URL(t);return new URL(l,u.origin+u.pathname.substring(0,u.pathname.lastIndexOf("/"))+"/").toString()}}}return null}function qn(e){return e.replace("playlist.m3u8","playlist_fmp4_dvr.m3u8")}async function $n(e){try{const t=qn(e);console.log("Converting to DVR URL:",t);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch master playlist: ${n.status} ${n.statusText}`);const r=await n.text(),a=Qn(r,t);if(!a)throw new Error("No chunklist URL found in master playlist");console.log("Found chunklist URL:",a);const l=await fetch(a);if(!l.ok)throw new Error(`Failed to fetch chunklist: ${l.status} ${l.statusText}`);const u=await l.text(),s=Jn(u);return s?console.log("Successfully detected start time:",s.toISOString()):console.log(" No start time found in chunklist"),s}catch(t){return console.error("Error getting start time from HLS URL:",t),null}}function er(n){var r=n,{url:e}=r,t=re(r,["url"]);const[a,l]=f.useState(!0),u=U(d=>d.startDate),s=U(d=>d.setStartDate),c=f.useCallback(async()=>{const d=await $n(e);d&&s(d)},[e,s]);return f.useEffect(()=>{(async()=>{l(!0),await c(),l(!1)})()},[c]),Ce(c,u?null:5e3),a?null:i.jsx(tr,A({},t))}function tr({children:e,messages:t}){const n=U(u=>u.startDate),r=h(u=>u.isStarted);return Xn(r?null:5e3),n?Date.now()<n.getTime()?i.jsx(nr,{startDate:n,title:t.eventNotStarted,message:t.eventStartingSoon}):i.jsx(i.Fragment,{children:e}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:t.unableToPlay})})}function nr({startDate:e,title:t,message:n}){const r=e.getTime()-Date.now(),a=Math.floor(r/(1e3*60*60)),l=Math.floor(r%(1e3*60*60)/(1e3*60));return a||l?i.jsxs("div",{className:oe.playerNotice,children:[i.jsx("h3",{className:oe.playerNoticeTitle,children:t}),i.jsxs("p",{className:oe.playerNoticeText,children:["(",a>0?`${a}h ${l}m`:`${l}m`,")"]})]}):i.jsx("div",{className:oe.playerNotice,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:n})})}function wt({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=()=>e("play",void 0),r=()=>e("pause",void 0),a=()=>e("resume",void 0),l=()=>e("restart",void 0),u=()=>e("ended",void 0),s=()=>e("seeking",void 0),c=()=>e("seeked",void 0),d=_=>e("volumeChange",_),v=_=>e("fullscreenChange",_),T=_=>e("qualityChange",_),y=_=>e("loadedMetadata",_),M=()=>e("loadStart",void 0),b=()=>e("playing",void 0),S=()=>e("waiting",void 0),L=()=>e("error",void 0);return t.on("play",n),t.on("pause",r),t.on("resume",a),t.on("restart",l),t.on("ended",u),t.on("seeking",s),t.on("seeked",c),t.on("volumeChange",d),t.on("fullscreenChange",v),t.on("qualityChange",T),t.on("loadedMetadata",y),t.on("loadStart",M),t.on("playing",b),t.on("waiting",S),t.on("error",L),()=>{t.off("play",n),t.off("pause",r),t.off("resume",a),t.off("restart",l),t.off("ended",u),t.off("seeking",s),t.off("seeked",c),t.off("volumeChange",d),t.off("fullscreenChange",v),t.off("qualityChange",T),t.off("loadedMetadata",y),t.off("loadStart",M),t.off("playing",b),t.off("waiting",S),t.off("error",L)}},[e,t]),null}const Ct=(e,t=0)=>parseInt(Math.max(0,(Date.now()-(e+t*1e3))/1e3).toFixed(0)),Tt=(e,t)=>Math.max(0,(Date.now()-e-t*1e3)/1e3),rr=(e,t)=>Math.max(0,(t-e)/1e3),or=(e,t=0)=>{const r=t<0?0:t,a=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"],l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(r))}${a[l]}`};function sr({isAuto:e,level:t,levels:n}){const r=n.length,a=[];return r>1&&a.push({sid:"quality-level-auto",label:"Auto",value:-1,selected:e||t===-1}),n.sort(function(l,u){const s=l.height||l.bitrate||0,c=u.height||u.bitrate||0;return s===c?0:s>c?1:-1}),n.map(l=>{const{bitrate:u,height:s,index:c}=l;a.push({sid:`quality-level-${c}`,label:s?`${s}p`:or(u),value:c,selected:r===1||!e&&c===t})}),a}function ar({callback:e}){const t=U(l=>l.delay),n=U(l=>l.startDate),r=n?n.getTime():0,a=h(l=>l.eventEmitter);return f.useEffect(()=>{const l=()=>e("timeUpdate",{currentTime:Tt(r,t),duration:-1});return a.on("timeUpdate",l),()=>{a.off("timeUpdate",l)}},[e,t,a,r]),i.jsx(wt,{callback:e})}function _t(){const e=h(s=>s.exitFullscreen),t=h(s=>s.isFullscreen),n=h(s=>s.isFullscreenReady),r=h(s=>s.requestFullscreen),a=h(s=>s.setVolume),l=h(s=>s.volume),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowUp":a(l+10<100?l+10:100),c=!0;break;case"ArrowDown":a(l-10>0?l-10:0),c=!0;break;case"KeyM":a(l===0?100:0),c=!0;break;case"KeyF":n&&(t?e():r(),c=!0);break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),null}function ir(){const e=U(s=>s.delay),t=h(s=>s.isPlaying),n=h(s=>s.pause),r=h(s=>s.getPauseTimeDiff),a=h(s=>s.play),l=U(s=>s.setDelay),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e+10),c=!0;break;case"ArrowRight":l(e-10>0?e-10:0),c=!0;break;case"Space":if(t)n();else{const d=r();d&&l(e+d),a()}c=!0;break}c&&s.preventDefault()}},[e,r,t,n,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(_t,{})}function Et({children:e}){return i.jsx(Yn,{children:e})}function cr({children:e}){return i.jsx(Kn,{children:i.jsx(Et,{children:e})})}const lr=50,ur=1e4;function dr({url:e,isLive:t,messages:n}){const r=f.useRef(null),a=h(w=>w.level),l=h(w=>w.levels),u=h(w=>w.setLevel),s=h(w=>w.setLevels),c=h(w=>w.logLevel),d=h(w=>w.techRef),v=h(w=>w.setError),T=f.useRef(0),y=f.useRef(null),M=f.useCallback(w=>{if(r.current&&(r.current.nextLevel=w,u(null),l)){const E=l.map(g=>pe(A({},g),{selected:g.value===w}));s(E)}},[l,u,s]),b=f.useCallback(()=>{const w=d.current;if(!w)return;console.log("[Player][HLS] MEDIA_ATTACHING");const E=document.createElement("source");E.src=e,E.type="application/vnd.apple.mpegurl",E.dataset.id="original-stream",w.appendChild(E),w.disableRemotePlayback=!1},[e,d]),S=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] MANIFEST_LOADED"),v(null),y.current&&(clearTimeout(y.current),y.current=null),T.current=0;const w=r.current.levels,E=r.current.currentLevel,g=r.current.autoLevelEnabled;s(sr({levels:w.map((x,C)=>{const{bitrate:Z,height:O,width:F}=x;return{bitrate:Z,height:O,index:C,width:F}}),level:E,isAuto:g}))},[v,s]),L=f.useCallback(()=>{if(!r.current)return;console.log("[Player][HLS] LEVEL_SWITCHED");const w=r.current.levels,E=r.current.currentLevel;if(w[E]?JSON.stringify(w[E]):null){let x="";w[E].height?x=`${w[E].height}p`:w[E].bitrate&&(x=`${w[E].bitrate}bps`),c(x)}},[c]),_=f.useCallback((w,E)=>{if(r.current&&E.fatal){let g,x="UNKNOWN_ERROR";switch(E.type){case q.ErrorTypes.NETWORK_ERROR:g=n.unableToPlay,console.log("[Player][HLS] NETWORK_ERROR",E),t?(T.current<lr&&(y.current&&clearTimeout(y.current),T.current+=1,y.current=setTimeout(()=>{if(r.current)try{console.log("[Player][HLS] Retrying stream..."),r.current.loadSource(e)}catch(C){console.error("[Player][HLS] Retry failed:",C)}},ur)),x="LIVE_MANIFEST_LOAD_ERROR"):(r.current.startLoad(),x="NETWORK_ERROR"),v({message:g,code:x,tech:"hls"});break;case q.ErrorTypes.MEDIA_ERROR:r.current.recoverMediaError();break}}},[t,e,v,n]),D=f.useCallback(()=>{const w=d.current;if(!w)return;const E={startLevel:-1,maxBufferSize:30*1024*1024};Ln?(E.backBufferLength=-1,E.enableWorker=!1):t?E.backBufferLength=10:E.backBufferLength=60;try{console.log("[Player][HLS] URL",e),console.log("[Player][HLS] Config",JSON.stringify(E)),console.log("[Player][HLS] Version",q.version),r.current=new q(E),r.current.on(q.Events.MEDIA_ATTACHING,b),r.current.on(q.Events.MANIFEST_LOADED,S),r.current.on(q.Events.LEVEL_SWITCHED,L),r.current.on(q.Events.ERROR,_),r.current.attachMedia(w),r.current.loadSource(e)}catch(g){throw new Error(`Error initializing Hls: ${g}`)}},[b,S,L,_,t,d,e]),I=f.useCallback(()=>{r.current&&(r.current.off(q.Events.MEDIA_ATTACHING,b),r.current.off(q.Events.MANIFEST_LOADED,S),r.current.off(q.Events.LEVEL_SWITCHED,L),r.current.off(q.Events.ERROR,_),r.current.destroy(),r.current=null);const w=d.current;w&&Array.from(w.children).filter(g=>{var x;return((x=g.dataset)==null?void 0:x.id)==="original-stream"}).forEach(g=>w.removeChild(g)),y.current&&(clearTimeout(y.current),y.current=null),T.current=0},[b,L,S,_,d]);return f.useEffect(()=>{a!==null&&M(a)},[a,M]),f.useEffect(()=>(q.isSupported()&&D(),I),[I,D]),null}const fr=50,hr=1e4;function mr({url:e,isLive:t,messages:n}){const r=h(v=>v.techRef),a=h(v=>v.setError),l=f.useRef(0),u=f.useRef(null),s=f.useCallback(()=>{const v=r.current;v&&(v.src=e,v.load())},[e,r]),c=f.useCallback(()=>{if(!r.current)return;const T=n.unableToPlay,y=t?"LIVE_MANIFEST_LOAD_ERROR":"NETWORK_ERROR";console.log("[Player][Native HLS] ERROR",{message:T,code:y}),t&&l.current<fr?(u.current&&clearTimeout(u.current),l.current+=1,u.current=setTimeout(()=>{console.log("[Player][Native HLS] Retrying stream..."),s()},hr)):t||s(),a({message:T,code:y,tech:"native"})},[t,n.unableToPlay,a,r,s]),d=f.useCallback(()=>{a(null),u.current&&(clearTimeout(u.current),u.current=null),l.current=0},[a]);return f.useEffect(()=>{const v=r.current;if(v)return v.addEventListener("error",c),v.addEventListener("loadeddata",d),v.src=e,v.load(),()=>{v.removeEventListener("error",c),v.removeEventListener("loadeddata",d),u.current&&(clearTimeout(u.current),u.current=null),l.current=0}},[e,c,d,r]),null}const pr={playerVideo:"_playerVideo_wc0sm_1"};function Rt({url:e,isLive:t,isMuted:n=!1,messages:r}){const a=h(C=>C.destroy),l=h(C=>C.handleDurationChange),u=h(C=>C.handleEnd),s=h(C=>C.handleLoadedMetadata),c=h(C=>C.handleLoadStart),d=h(C=>C.handlePause),v=h(C=>C.handlePlay),T=h(C=>C.handlePlaying),y=h(C=>C.handleSeeked),M=h(C=>C.handleSeeking),b=h(C=>C.handleTimeUpdate),S=h(C=>C.handleWaiting),L=h(C=>C.handleVolumeChange),_=h(C=>C.handleError),D=h(C=>C.techRef),I=f.useRef(null),w=()=>t?{onTimeUpdate:E}:{onDurationChange:l,onSeeked:y,onSeeking:M,onTimeUpdate:E},E=()=>{(!I.current||Date.now()-I.current>=1e3)&&(b(),I.current=Date.now())},g=w(),x=f.useMemo(()=>typeof document!="undefined"&&document.createElement("video").canPlayType("application/vnd.apple.mpegurl")!=="",[]);return f.useEffect(()=>()=>{a()},[a]),i.jsxs(i.Fragment,{children:[Ue&&x?i.jsx(mr,{isLive:t,url:e,messages:r}):i.jsx(dr,{isLive:t,url:e,messages:r}),i.jsx("video",A({ref:D,className:pr.playerVideo,playsInline:!0,controls:!1,muted:n,preload:"auto",crossOrigin:"anonymous",onEnded:u,onError:_,onLoadedMetadata:s,onLoadStart:c,onPause:d,onPlay:v,onPlaying:T,onWaiting:S,onVolumeChange:L,tabIndex:-1},g))]})}function vr({url:e,messages:t}){const[n,r]=f.useState(null),a=U(u=>u.delay),l=f.useCallback(async()=>{r(a?e.replace("-live","-catchup").replace("playlist.m3u8",`playlist_fmp4_dvr_timeshift-${a}.m3u8`):e)},[a,e]);return f.useEffect(()=>{const u=requestAnimationFrame(()=>l());return()=>cancelAnimationFrame(u)},[l]),n?i.jsx(Rt,{url:n,isLive:!0,messages:t}):null}function yr({url:e}){return h(n=>n.isStarted)?i.jsx(gr,{url:e}):null}function gr({url:e}){const t=U(l=>l.setViewerCount),n=f.useRef(null),r=l=>{try{return new URL(l).pathname.split("/").filter(d=>d.length>0)[0]||null}catch(u){return console.error("Failed to extract URI from player URL:",u),null}},a=f.useCallback(async()=>{var c;const l=r(e);if(!l){console.error("Could not extract URI from URL:",e);return}n.current&&n.current.abort(),n.current=new AbortController;const s=`https://${e.includes("staging")?"stg":"prd"}-fitnessanny.spectar.tv/analytics-api/v1/token-info/uri/${l}`;try{const d=await fetch(s,{signal:n.current.signal});if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);const T=(c=(await d.json()).count)!=null?c:0;t(T)}catch(d){if(d.name==="AbortError")return;console.error("Failed to fetch viewer count:",d),t(null)}},[t,e]);return f.useEffect(()=>(a(),()=>{n.current&&n.current.abort()}),[a,e]),Ce(a,15e3),null}function wr(e,{defaultValue:t=!1,initializeWithValue:n=!0}={}){const r=s=>typeof window=="undefined"?t:window.matchMedia(s).matches,[a,l]=f.useState(()=>n?r(e):t);function u(){l(r(e))}return ft(()=>{if(typeof window=="undefined")return;const s=window.matchMedia(e);return u(),s.addListener?s.addListener(u):s.addEventListener("change",u),()=>{s.removeListener?s.removeListener(u):s.removeEventListener("change",u)}},[e]),a}const ue={playbackButton:"_playbackButton_lgsgw_1",seekIndicator:"_seekIndicator_lgsgw_23",seekIndicatorLeft:"_seekIndicatorLeft_lgsgw_49",seekIndicatorRight:"_seekIndicatorRight_lgsgw_53",seekIndicatorVisible:"_seekIndicatorVisible_lgsgw_57"},Cr=10;function xt(s){var c=s,{className:e,onClick:t,onForwardSeek:n,onBackwardSeek:r,maxForwardTime:a,maxBackwardTime:l}=c,u=re(c,["className","onClick","onForwardSeek","onBackwardSeek","maxForwardTime","maxBackwardTime"]);return wr("(pointer: coarse)")?i.jsx(_r,A({className:e,maxForwardTime:a,maxBackwardTime:l,onForwardSeek:n,onBackwardSeek:r},u)):i.jsx(Tr,A({className:e,onClick:t},u))}function Tr(r){var a=r,{className:e,onClick:t}=a,n=re(a,["className","onClick"]);const l=f.useRef(null),u=h(S=>S.exitFullscreen),s=h(S=>S.isFullscreen),c=h(S=>S.requestFullscreen),d=h(S=>S.resetIdle),v=S=>{M()?(y(),s?u():c()):T(S)},T=S=>{l.current=window.setTimeout(()=>{t==null||t(S),y()},200)},y=()=>{l.current!==null&&(window.clearTimeout(l.current),l.current=null)},M=()=>l.current!==null,b=()=>{d()};return f.useEffect(()=>()=>{y()},[]),i.jsx("button",A({onClick:v,onMouseMove:b,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},n))}function _r(u){var s=u,{className:e,maxForwardTime:t,maxBackwardTime:n,onForwardSeek:r,onBackwardSeek:a}=s,l=re(s,["className","maxForwardTime","maxBackwardTime","onForwardSeek","onBackwardSeek"]);const c=f.useRef(null),d=f.useRef({single:null,indicator:null,accumulate:null}),v=f.useRef(null),T=f.useRef(0),y=f.useRef(null),[M,b]=f.useState({visible:!1,direction:null,time:0}),S=h(g=>g.isIdle),L=h(g=>g.setIsIdle),_=h(g=>g.resetIdle),D=(g,x)=>g<x/2?"backward":"forward",I=g=>{if(!v.current)return;const x=g.changedTouches[0];if(!x)return;const C=Date.now(),Z=v.current.getBoundingClientRect(),O=x.clientX-Z.left,F=x.clientY-Z.top;if(O<0||O>Z.width||F<0||F>Z.height)return;const $=c.current,X=$?C-$.time:1/0,K=D(O,Z.width),ae=y.current!==null&&y.current===K&&$!==null&&X<700&&Math.abs(O-$.x)<100;if($!==null&&y.current===null&&X<300&&Math.abs(O-$.x)<50||ae){g.preventDefault(),g.stopPropagation(),d.current.single&&(window.clearTimeout(d.current.single),d.current.single=null),_(),(y.current===null||y.current!==K)&&(T.current=0,y.current=K);const ne=K==="backward"?n:t;T.current=Math.min(T.current+Cr,ne!=null?ne:1/0),w(K,T.current),d.current.accumulate&&window.clearTimeout(d.current.accumulate),d.current.accumulate=window.setTimeout(()=>{const G=T.current;G>0&&(y.current==="backward"?a==null||a(G):r==null||r(G),_()),T.current=0,y.current=null,c.current=null,E(),d.current.accumulate=null},500),c.current={time:C,x:O}}else{c.current={time:C,x:O},d.current.single&&window.clearTimeout(d.current.single);const ne=y.current!==null?700:350;d.current.single=window.setTimeout(()=>{if(y.current===null){d.current.single=null;const G=S;L(!G),G&&_()}c.current=null},ne)}},w=(g,x)=>{x!==0&&(b({visible:!0,direction:g,time:x}),d.current.indicator&&window.clearTimeout(d.current.indicator),d.current.indicator=window.setTimeout(()=>{E()},700))},E=()=>{b({visible:!1,direction:null,time:0}),d.current.indicator&&(window.clearTimeout(d.current.indicator),d.current.indicator=null)};return f.useEffect(()=>{const g=d.current;return()=>{g!=null&&g.single&&window.clearTimeout(g.single),g!=null&&g.indicator&&window.clearTimeout(g.indicator),g!=null&&g.accumulate&&window.clearTimeout(g.accumulate)}},[]),i.jsxs(i.Fragment,{children:[i.jsx("button",A({ref:v,onTouchEnd:I,className:[ue.playbackButton,e].filter(Boolean).join(" "),"aria-label":"Player gestures"},l)),M.visible&&i.jsxs("div",{className:`${ue.seekIndicator} ${ue.seekIndicatorVisible} ${M.direction==="backward"?ue.seekIndicatorLeft:ue.seekIndicatorRight}`,children:[M.direction==="backward"?"-":"+",Te(M.time)]})]})}function Er(){const e=h(c=>c.isPlaying),t=h(c=>c.pause),n=h(c=>c.getPauseTimeDiff),r=h(c=>c.play),a=U(c=>c.delay),l=U(c=>c.setDelay),u=U(c=>c.startDate),s=u?u.getTime():0;return i.jsx(xt,{onClick:()=>{if(e)t();else{const c=n();c&&l(a+c),r()}},onBackwardSeek:c=>{const d=a+c;l(d)},onForwardSeek:c=>{const d=Math.max(0,a-c);l(d)},maxBackwardTime:Math.floor(s),maxForwardTime:Math.floor(a)})}const St={playerButton:"_playerButton_izwqq_1",playerButtonCircle:"_playerButtonCircle_izwqq_42"},ie=f.forwardRef((a,r)=>{var l=a,{shape:e="circle",className:t}=l,n=re(l,["shape","className"]);const u=e==="circle"?St.playerButtonCircle:"",s=[St.playerButton,u,t].filter(Boolean).join(" ");return i.jsx("button",A({ref:r,className:s},n))});ie.displayName="PlayerButton";const be={liveIndicator:"_liveIndicator_1jczn_1",liveIndicatorHasDelay:"_liveIndicatorHasDelay_1jczn_9",liveIndicatorNoDelay:"_liveIndicatorNoDelay_1jczn_13"};function Rr(n){var r=n,{message:e}=r,t=re(r,["message"]);const a=h(d=>d.restart),l=U(d=>d.delay),u=U(d=>d.setDelay),s=()=>{l&&(a(),u(0))},c=l?`${be.liveIndicator} ${be.liveIndicatorHasDelay}`:`${be.liveIndicator} ${be.liveIndicatorNoDelay}`;return i.jsxs(ie,pe(A({onClick:s,shape:"square"},t),{children:[i.jsx("div",{className:c}),e||"Live"]}))}function bt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6 5H8V19H6V5ZM16 5H18V19H16V5Z"})})}function Pt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M19.376 12.4161L8.77735 19.4818C8.54759 19.635 8.23715 19.5729 8.08397 19.3432C8.02922 19.261 8 19.1645 8 19.0658V4.93433C8 4.65818 8.22386 4.43433 8.5 4.43433C8.59871 4.43433 8.69522 4.46355 8.77735 4.5183L19.376 11.584C19.6057 11.7372 19.6678 12.0477 19.5146 12.2774C19.478 12.3323 19.4309 12.3795 19.376 12.4161Z"})})}function xr(){const e=h(s=>s.isPlaying),t=h(s=>s.pause),n=h(s=>s.getPauseTimeDiff),r=h(s=>s.play),a=U(s=>s.delay),l=U(s=>s.setDelay),u=()=>{if(e)t();else{const s=n();s&&l(a+s),r()}};return i.jsx(ie,{onClick:u,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const se={progressSlider:"_progressSlider_hwzgf_1",tipContainer:"_tipContainer_hwzgf_7",tipContainerVisible:"_tipContainerVisible_hwzgf_17",tipContainerHidden:"_tipContainerHidden_hwzgf_22",tipContent:"_tipContent_hwzgf_27"},Pe={sliderRoot:"_sliderRoot_aeak6_1",sliderTrack:"_sliderTrack_aeak6_18",sliderRange:"_sliderRange_aeak6_28",sliderThumb:"_sliderThumb_aeak6_37"},Le=f.forwardRef((l,a)=>{var u=l,{max:e=100,min:t=0,className:n}=u,r=re(u,["max","min","className"]);return i.jsxs(Re.Root,pe(A({ref:a,min:t,max:e,"aria-label":"Player progress",className:[Pe.sliderRoot,n].filter(Boolean).join(" "),onKeyDown:s=>s.preventDefault()},r),{children:[i.jsx(Re.Track,{className:Pe.sliderTrack,children:i.jsx(Re.Range,{className:Pe.sliderRange})}),i.jsx(Re.Thumb,{className:Pe.sliderThumb})]}))});Le.displayName="PlayerSlider";function je(e){const t=e.getBoundingClientRect();return e.offsetWidth/e.offsetHeight>e.clientWidth/e.clientHeight?{left:t.left*100,right:t.right*100,top:t.top*100,bottom:t.bottom*100,width:t.width*100,height:t.height*100}:t}const Lt="vod-player-progress-bar";function Sr(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(0),[a,l]=f.useState(0),[u,s]=f.useState(!1),[c,d]=f.useState(-1),[v,T]=f.useState(-1),y=U(F=>F.delay),M=U(F=>F.startDate),b=M?M.getTime():0,S=new Date().getTime(),L=U(F=>F.setDelay),_=h(F=>F.isPlaying),D=h(F=>F.addIdleLock),I=h(F=>F.removeIdleLock),w=f.useCallback(()=>{r(Tt(b,y)),l(rr(b,S))},[y,S,b]),E=parseFloat((a?(v!==-1?v:n)/a*100:0).toFixed(1)),g=F=>{T(a*(F[0]/100)),D(Lt)},x=()=>{if(v!==-1){const F=Ct(b,v);L(F),T(-1),I(Lt)}},C=()=>s(!0),Z=()=>s(!1),O=f.useCallback(F=>{const $=e.current,X=t.current;if($&&X){const K=je($),ae=je(X),fe=(F.pageX||F.clientX)-K.left,ne=fe/K.width;if(ne<0)return;let G=fe-ae.width/2;G<0&&(G=0),G>K.width-ae.width&&(G=-1),X.style.left=G>-1?`${G}px`:"auto",X.style.right=G>-1?"auto":"0px";const _e=a-ne*a;d(_e>0?_e:0)}C()},[a]);return Ce(()=>w(),_?1e3:null),f.useEffect(()=>{const F=requestAnimationFrame(()=>w());return()=>cancelAnimationFrame(F)},[w]),i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[E],onPointerLeave:Z,onPointerDown:Z,onPointerMove:O,onValueChange:g,onValueCommit:x,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${u?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:`-${Te(c)}`})})]})}function br(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M22 12C22 17.5228 17.5229 22 12 22C6.4772 22 2 17.5228 2 12C2 6.47715 6.4772 2 12 2V4C7.5817 4 4 7.58172 4 12C4 16.4183 7.5817 20 12 20C16.4183 20 20 16.4183 20 12C20 9.53614 18.8862 7.33243 17.1346 5.86492L15 8V2L21 2L18.5535 4.44656C20.6649 6.28002 22 8.9841 22 12Z"})})}function Pr(){const e=U(a=>a.startDate),t=U(a=>a.setDelay),n=e?e.getTime():0,r=()=>t(Ct(n));return i.jsx(ie,{onClick:r,children:i.jsx(br,{})})}const ke={viewersContainer:"_viewersContainer_z1ihz_1",viewersIndicator:"_viewersIndicator_z1ihz_16",viewersIcon:"_viewersIcon_z1ihz_24",viewersCount:"_viewersCount_z1ihz_28"};function Lr(){const e=U(t=>t.viewerCount);return e?i.jsxs("div",{className:ke.viewersContainer,children:[i.jsx("span",{className:ke.viewersIndicator}),i.jsxs("svg",{className:ke.viewersIcon,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i.jsx("path",{d:"M8 7C9.10457 7 10 6.10457 10 5C10 3.89543 9.10457 3 8 3C6.89543 3 6 3.89543 6 5C6 6.10457 6.89543 7 8 7Z",fill:"currentColor"}),i.jsx("path",{d:"M8 8C5.79086 8 4 9.79086 4 12V13H12V12C12 9.79086 10.2091 8 8 8Z",fill:"currentColor"})]}),i.jsx("span",{className:ke.viewersCount,children:e.toLocaleString()})]}):null}function jt(){const e=h(n=>n.error);if(!e)return null;const t=e.code==="LIVE_MANIFEST_LOAD_ERROR";return i.jsx("div",{className:`${oe.playerNotice} ${t?oe.playerNoticeLowZIndex:""}`,children:i.jsx("h3",{className:oe.playerNoticeTitle,children:e.message})})}const Y={playerContainer:"_playerContainer_146tx_1",controlsTop:"_controlsTop_146tx_12",controlsBottom:"_controlsBottom_146tx_29",controlsContainer:"_controlsContainer_146tx_45",controlsRow:"_controlsRow_146tx_61",controlsSection:"_controlsSection_146tx_68",controlsSectionStart:"_controlsSectionStart_146tx_78",controlsSectionEnd:"_controlsSectionEnd_146tx_82"};function jr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M16 3H22V9H20V5H16V3ZM2 3H8V5H4V9H2V3ZM20 19V15H22V21H16V19H20ZM4 19H8V21H2V15H4V19Z"})})}function kr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M18 7H22V9H16V3H18V7ZM8 9H2V7H6V3H8V9ZM18 17V21H16V15H22V17H18ZM8 15V21H6V17H2V15H8Z"})})}function kt(){const e=h(d=>d.containerRef),t=h(d=>d.exitFullscreen),n=h(d=>d.isFullscreen),r=h(d=>d.requestFullscreen),a=h(d=>d.setIsFullscreen),l=h(d=>d.setIsFullscreenReady),u=h(d=>d.techRef),s=f.useCallback(d=>{d.stopPropagation(),a(jn())},[a]),c=()=>{n?t():r()};return f.useEffect(()=>{const d=Ue?u.current:e.current;if(d)return Dn(d,s)},[e,s,u]),f.useEffect(()=>{l(!0)},[l]),i.jsx(ie,{onClick:c,children:n?i.jsx(kr,{}):i.jsx(jr,{})})}const Ye={idleCheckContainer:"_idleCheckContainer_crh2s_1",idleCheckContainerIdle:"_idleCheckContainerIdle_crh2s_5",idleCheckContainerActive:"_idleCheckContainerActive_crh2s_11"},Ir=5*1e3;function It({children:e}){const t=f.useRef(null),n=h(y=>y.isIdle),r=h(y=>y.setIsIdle),a=f.useRef(null),u=h(y=>y.idleLocks).size,s=h(y=>y.eventEmitter),c=f.useCallback(()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null)},[]),d=f.useCallback(()=>{c(),a.current=window.setTimeout(()=>r(!0),Ir)},[c,r]);f.useEffect(()=>(r(!1),d(),()=>{c()}),[c,r,d]),f.useEffect(()=>{const y=()=>{r(!1),d()};return s.on("resetIdle",y),()=>{s.off("resetIdle",y)}},[s,r,d]);const v=n&&!u,T=`${Ye.idleCheckContainer} ${v?Ye.idleCheckContainerIdle:Ye.idleCheckContainerActive}`;return i.jsx("div",{ref:t,className:T,children:e})}const Dr={spinner:"_spinner_oo4hi_10"};function Nr(e){return i.jsx("div",A({className:Dr.spinner},e))}function Mr(e,t=500){const[n,r]=f.useState(e);return f.useEffect(()=>{const a=window.setTimeout(()=>r(e),t);return()=>{window.clearTimeout(a)}},[e,t]),n}const Fr={loadingContainer:"_loadingContainer_v9v7r_1"};function Dt(n){var r=n,{style:e}=r,t=re(r,["style"]);const a=h(u=>u.isLoading);return Mr(a,100)?i.jsx("div",pe(A({className:Fr.loadingContainer,style:e},t),{children:i.jsx(Nr,{})})):null}function Nt(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"})})}function Vr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M4 5V19H20V5H4ZM3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3ZM7.5 11.25H9.5V9H11V15H9.5V12.75H7.5V15H6V9H7.5V11.25ZM14.5 10.5V13.5H16C16.2761 13.5 16.5 13.2761 16.5 13V11C16.5 10.7239 16.2761 10.5 16 10.5H14.5ZM13 9H16C17.1046 9 18 9.89543 18 11V13C18 14.1046 17.1046 15 16 15H13V9Z"})})}const de={dropdownMenuContent:"_dropdownMenuContent_zi433_1",dropdownMenuItem:"_dropdownMenuItem_zi433_77",scrollAreaRoot:"_scrollAreaRoot_zi433_120",scrollAreaViewport:"_scrollAreaViewport_zi433_127",scrollAreaScrollbar:"_scrollAreaScrollbar_zi433_133",scrollAreaThumb:"_scrollAreaThumb_zi433_160"},Mt=ve.Root,Ft=ve.Trigger,Vt=ve.Portal,Ze=f.forwardRef((l,a)=>{var u=l,{sideOffset:e=4,className:t,children:n}=u,r=re(u,["sideOffset","className","children"]);return i.jsx(ve.Content,pe(A({ref:a,sideOffset:e,className:[de.dropdownMenuContent,t].filter(Boolean).join(" "),onOpenAutoFocus:s=>{s.preventDefault()},onCloseAutoFocus:s=>{s.preventDefault()}},r),{children:i.jsxs(xe.Root,{className:de.scrollAreaRoot,type:"always",scrollHideDelay:0,children:[i.jsx(xe.Viewport,{className:de.scrollAreaViewport,children:n}),i.jsx(xe.Scrollbar,{className:de.scrollAreaScrollbar,orientation:"vertical",children:i.jsx(xe.Thumb,{className:de.scrollAreaThumb})})]})}))});Ze.displayName="PlayerMenuContent";const Ke=f.forwardRef((a,r)=>{var l=a,{className:e,onClick:t}=l,n=re(l,["className","onClick"]);const u=c=>{t==null||t(c)},s=c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t==null||t(c))};return i.jsx(ve.Close,{asChild:!0,children:i.jsx("div",A({ref:r,className:[de.dropdownMenuItem,e].filter(Boolean).join(" "),role:"menuitem",tabIndex:0,onClick:u,onKeyDown:s},n))})});Ke.displayName="PlayerMenuItem";const At="quality";function Ot(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.levels),u=h(c=>c.setLevel),s=f.useCallback(c=>{t(c),c?r(At):a(At)},[r,a]);return!l||l.length===0?null:i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsx(ie,{children:i.jsx(Vr,{})})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ze,{side:"top",align:"end",children:l.map(c=>i.jsxs(Ke,{onClick:()=>u(c.value),children:[c.label,c.selected&&i.jsx(Nt,{})]},c.sid))})})]})}function Ar(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M6.60282 10.0001L10 7.22056V16.7796L6.60282 14.0001H3V10.0001H6.60282ZM2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"})})}function Or(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M13 7.22056L9.60282 10.0001H6V14.0001H9.60282L13 16.7796V7.22056ZM8.88889 16.0001H5C4.44772 16.0001 4 15.5524 4 15.0001V9.00007C4 8.44778 4.44772 8.00007 5 8.00007H8.88889L14.1834 3.66821C14.3971 3.49335 14.7121 3.52485 14.887 3.73857C14.9601 3.8279 15 3.93977 15 4.05519V19.9449C15 20.2211 14.7761 20.4449 14.5 20.4449C14.3846 20.4449 14.2727 20.405 14.1834 20.3319L8.88889 16.0001ZM18.8631 16.5911L17.4411 15.1691C18.3892 14.4376 19 13.2902 19 12.0001C19 10.5697 18.2493 9.31476 17.1203 8.60766L18.5589 7.16906C20.0396 8.26166 21 10.0187 21 12.0001C21 13.8422 20.1698 15.4905 18.8631 16.5911Z"})})}function Hr(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",children:i.jsx("path",{d:"M10 7.22056L6.60282 10.0001H3V14.0001H6.60282L10 16.7796V7.22056ZM5.88889 16.0001H2C1.44772 16.0001 1 15.5524 1 15.0001V9.00007C1 8.44778 1.44772 8.00007 2 8.00007H5.88889L11.1834 3.66821C11.3971 3.49335 11.7121 3.52485 11.887 3.73857C11.9601 3.8279 12 3.93977 12 4.05519V19.9449C12 20.2211 11.7761 20.4449 11.5 20.4449C11.3846 20.4449 11.2727 20.405 11.1834 20.3319L5.88889 16.0001ZM20.4142 12.0001L23.9497 15.5356L22.5355 16.9498L19 13.4143L15.4645 16.9498L14.0503 15.5356L17.5858 12.0001L14.0503 8.46454L15.4645 7.05032L19 10.5859L22.5355 7.05032L23.9497 8.46454L20.4142 12.0001Z"})})}const Ht={volumeContainer:"_volumeContainer_4d6jg_1",volumeSlider:"_volumeSlider_4d6jg_8"},Ut="volume";function Bt(){const e=h(s=>s.setVolume),t=h(s=>s.volume),n=h(s=>s.addIdleLock),r=h(s=>s.removeIdleLock),a=s=>{e(s[0]),n(Ut)},l=()=>{r(Ut)},u=()=>e(t?0:100);return i.jsxs("div",{className:Ht.volumeContainer,children:[i.jsx(ie,{onClick:u,className:"shrink-0",children:t?t>50?i.jsx(Ar,{}):i.jsx(Or,{}):i.jsx(Hr,{})}),i.jsx("div",{className:Ht.volumeSlider,children:i.jsx(Le,{value:[t],onValueChange:a,onValueCommit:l})})]})}function Ur(e){return i.jsx(cr,{children:i.jsx(Br,A({},e))})}function Br({url:e,messages:t={},onEvent:n}){var l,u,s,c;const r=h(d=>d.containerRef),a={eventNotStarted:"Event has not started yet.",eventStartingSoon:"Starting in few seconds...",unableToPlay:"Unable to play the live stream. Please try again later."};return f.useEffect(()=>{console.log(`[Player][Live] Version: ${Be.version}`)},[]),i.jsxs("div",{ref:r,className:Y.playerContainer,children:[i.jsxs(er,{url:e,messages:{eventNotStarted:(l=t==null?void 0:t.eventNotStarted)!=null?l:a.eventNotStarted,eventStartingSoon:(u=t==null?void 0:t.eventStartingSoon)!=null?u:a.eventStartingSoon,unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:a.unableToPlay},children:[i.jsx(vr,{url:e,messages:{unableToPlay:(c=t==null?void 0:t.unableToPlay)!=null?c:a.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(Er,{}),i.jsxs(It,{children:[i.jsx("div",{className:Y.controlsTop,children:i.jsx("div",{className:Y.controlsContainer,children:i.jsx("div",{className:Y.controlsRow,children:i.jsx(Lr,{})})})}),i.jsx("div",{className:Y.controlsBottom,children:i.jsxs("div",{className:Y.controlsContainer,children:[i.jsx(Sr,{}),i.jsxs("div",{className:Y.controlsRow,children:[i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionStart}`,children:[i.jsx(xr,{}),i.jsx(Pr,{}),i.jsx(Bt,{})]}),i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionEnd}`,children:[i.jsx(Rr,{message:t==null?void 0:t.live}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})]}),i.jsx(Gn,{url:e}),i.jsx(ir,{}),i.jsx(yr,{url:e})]}),n&&i.jsx(ar,{callback:n})]})}const Wr=[.5,.75,1,1.25,1.5,1.75,2],Wt="playback-rate";function zr(){const[e,t]=f.useState(!1),n=h(c=>c.containerRef),r=h(c=>c.addIdleLock),a=h(c=>c.removeIdleLock),l=h(c=>c.playbackRate),u=h(c=>c.setPlaybackRate),s=f.useCallback(c=>{t(c),c?r(Wt):a(Wt)},[r,a]);return i.jsxs(Mt,{open:e,onOpenChange:s,children:[i.jsx(Ft,{asChild:!0,children:i.jsxs(ie,{children:[l,"x"]})}),i.jsx(Vt,{container:n.current,children:i.jsx(Ze,{side:"top",align:"end",children:Wr.map(c=>i.jsxs(Ke,{onClick:()=>u(c),children:[c,"x",l===c&&i.jsx(Nt,{})]},c))})})]})}function Yr(){const e=h(u=>u.isPlaying),t=h(u=>u.pause),n=h(u=>u.play),r=h(u=>u.currentTime),a=h(u=>u.duration),l=h(u=>u.seek);return i.jsx(xt,{onClick:()=>{e?t():n()},onBackwardSeek:u=>{const s=Math.max(0,r-u);l(s)},onForwardSeek:u=>{const s=Math.min(r+u,a);l(s)},maxBackwardTime:Math.floor(r),maxForwardTime:Math.floor(a-r)})}function Zr(){const e=h(a=>a.isPlaying),t=h(a=>a.pause),n=h(a=>a.play),r=()=>{e?t():n()};return i.jsx(ie,{onClick:r,children:e?i.jsx(bt,{}):i.jsx(Pt,{})})}const zt="vod-player-progress-bar";function Kr(){const e=f.useRef(null),t=f.useRef(null),[n,r]=f.useState(!1),[a,l]=f.useState(-1),[u,s]=f.useState(-1),c=h(I=>I.currentTime),d=h(I=>I.duration),v=h(I=>I.seek),T=h(I=>I.addIdleLock),y=h(I=>I.removeIdleLock),M=parseFloat((d?(u!==-1?u:c)/d*100:0).toFixed(1)),b=I=>{s(d*(I[0]/100)),T(zt)},S=()=>{u!==-1&&(v(u),s(-1),y(zt))},L=()=>r(!0),_=()=>r(!1),D=f.useCallback(I=>{const w=e.current,E=t.current;if(w&&E){const g=je(w),x=je(E),C=(I.pageX||I.clientX)-g.left,Z=C/g.width;if(Z<0)return;let O=C-x.width/2;O<0&&(O=0),O>g.width-x.width&&(O=-1),E.style.left=O>-1?`${O}px`:"auto",E.style.right=O>-1?"auto":"0px",l(Z*d)}L()},[d]);return i.jsxs("div",{className:se.progressSlider,children:[i.jsx(Le,{ref:e,value:[M],onPointerLeave:_,onPointerDown:_,onPointerMove:D,onValueChange:b,onValueCommit:S,step:.1}),i.jsx("div",{ref:t,className:`${se.tipContainer} ${n?se.tipContainerVisible:se.tipContainerHidden}`,children:i.jsx("p",{className:se.tipContent,children:Te(a)})})]})}const Ie={remainingTimeContainer:"_remainingTimeContainer_1yyhb_1",remainingTime:"_remainingTime_1yyhb_1",remainingSeparator:"_remainingSeparator_1yyhb_17"};function Gr(){const e=h(n=>n.currentTime),t=h(n=>n.duration);return i.jsxs("div",{className:Ie.remainingTimeContainer,children:[i.jsx("p",{className:Ie.remainingTime,children:Te(e)}),i.jsx("p",{className:Ie.remainingSeparator}),i.jsx("p",{className:Ie.remainingTime,children:Te(t)})]})}function Xr({url:e}){const{video_id:t}=gt(e),n=t?Number(t):void 0;return n?i.jsx(vt,{kind:"vod",url:e,id:n}):null}function Jr({callback:e}){const t=h(n=>n.eventEmitter);return f.useEffect(()=>{const n=r=>e("timeUpdate",r);return t.on("timeUpdate",n),()=>{t.off("timeUpdate",n)}},[e,t]),i.jsx(wt,{callback:e})}function Qr(){const e=h(s=>s.currentTime),t=h(s=>s.duration),n=h(s=>s.isPlaying),r=h(s=>s.pause),a=h(s=>s.play),l=h(s=>s.seek),u=f.useCallback(s=>{let c=!1;if(!(s.target instanceof HTMLInputElement||s.ctrlKey)){switch(s.code){case"ArrowLeft":l(e-10>=0?e-10:0),c=!0;break;case"ArrowRight":l(e+10<t?e+10:t),c=!0;break;case"Space":n?r():a(),c=!0;break}c&&s.preventDefault()}},[e,t,n,r,a,l]);return f.useEffect(()=>(document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}),[u]),i.jsx(_t,{})}function qr(e){return i.jsx(Et,{children:i.jsx($r,A({},e))})}function $r({url:e,messages:t,onEvent:n,startTime:r}){var s;const a=h(c=>c.setStartTime),l=h(c=>c.containerRef),u={unableToPlay:"Unable to play the video. Please try again later."};return f.useEffect(()=>{r&&a(r)},[r,a]),f.useEffect(()=>{console.log(`[Player][VOD] Version: ${Be.version}`)},[]),i.jsxs("div",{ref:l,className:Y.playerContainer,children:[i.jsx(Rt,{url:e,isLive:!1,messages:{unableToPlay:(s=t==null?void 0:t.unableToPlay)!=null?s:u.unableToPlay}}),i.jsx(jt,{}),i.jsx(Dt,{}),i.jsx(Yr,{}),i.jsx(It,{children:i.jsx("div",{className:Y.controlsBottom,children:i.jsxs("div",{className:Y.controlsContainer,children:[i.jsx(Kr,{}),i.jsxs("div",{className:Y.controlsRow,children:[i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionStart}`,children:[i.jsx(Zr,{}),i.jsx(Bt,{}),i.jsx(Gr,{})]}),i.jsxs("div",{className:`${Y.controlsSection} ${Y.controlsSectionEnd}`,children:[i.jsx(zr,{}),i.jsx(Ot,{}),i.jsx(kt,{})]})]})]})})}),i.jsx(Qr,{}),i.jsx(Xr,{url:e}),n&&i.jsx(Jr,{callback:n})]})}k.LivePlayer=Ur,k.VodPlayer=qr,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
17
17
  //# sourceMappingURL=react-video-player.umd.js.map