@banou/stub 0.0.28 → 0.0.29

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,1460 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./remote-VQoP8ehb.js","./remote-CVVOdyaq.js","./build-CQLpK1BK.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,F as t,G as n,H as r,I as i,J as a,K as o,M as s,P as c,Q as l,R as u,U as d,V as f,X as p,Y as m,Z as h,_ as g,at as _,ct as v,d as y,et as b,f as x,ft as S,g as C,h as w,i as T,it as E,j as D,l as O,m as k,nt as A,ot as j,p as ee,q as M,rt as N,tt as P,u as F,y as I}from"./uri-DvH8-88e.js";import{c as L,i as R,l as te,o as ne,s as re,t as ie}from"./lib-Bh4uJuOl.js";import{n as ae}from"./remote-CVVOdyaq.js";_(),l();var z=new Set([`ExtensionOperationUnsupportedError`,`FrameWindowRefusedError`]),oe=async({url:e,domains:t,isSignedIn:n,pollMs:r=1e3})=>{let i=ie({window:{url:e},domains:t}),a;try{a=await i}catch(e){let t=e?.name;if(t===`FrameWindowBlockedError`)return`blocked`;if(t&&z.has(t))return console.warn(`[login-window] window mode was refused`,e),`unsupported`;if(te(e))return`closed`;throw e}let o=a.closed.then(()=>`closed`);for(;;){let e=await Promise.race([o,new Promise(e=>setTimeout(e,r)).then(()=>n(a)).catch(()=>!1)]);if(e===`closed`)return`closed`;if(e)return await a.close(),`authed`}},se={};(function(e){var t=Object.prototype.hasOwnProperty,n=`~`;function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if(typeof r!=`function`)throw TypeError(`The listener must be a function`);var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){--e._eventsCount===0?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}s.prototype.eventNames=function(){var e=[],r,i;if(this._eventsCount===0)return e;for(i in r=this._events)t.call(r,i)&&e.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,i),!0;case 5:return c.fn.call(c.context,t,r,i,a),!0;case 6:return c.fn.call(c.context,t,r,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,r);break;case 4:c[d].fn.call(c[d].context,t,r,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn===t&&(!i||s.once)&&(!r||s.context===r)&&o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=l.length===1?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})({get exports(){return se},set exports(e){se=e}});var ce=se,le=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},ue=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},de=e=>globalThis.DOMException===void 0?new ue(e):new DOMException(e),fe=e=>{let t=e.reason===void 0?de(`This operation was aborted.`):e.reason;return t instanceof Error?t:de(t)};function pe(e,t,n,r){let i,a=new Promise((a,o)=>{if(typeof t!=`number`||Math.sign(t)!==1)throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(t===1/0){a(e);return}if(r={customTimers:{setTimeout,clearTimeout},...r},r.signal){let{signal:e}=r;e.aborted&&o(fe(e)),e.addEventListener(`abort`,()=>{o(fe(e))})}i=r.customTimers.setTimeout.call(void 0,()=>{if(typeof n==`function`){try{a(n())}catch(e){o(e)}return}let r=typeof n==`string`?n:`Promise timed out after ${t} milliseconds`,i=n instanceof Error?n:new le(r);typeof e.cancel==`function`&&e.cancel(),o(i)},t),(async()=>{try{a(await e)}catch(e){o(e)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()});return a.clear=()=>{clearTimeout(i),i=void 0},a}function me(e,t,n){let r=0,i=e.length;for(;i>0;){let a=Math.trunc(i/2),o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}var he=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},ge,_e=class{constructor(){ge.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&he(this,ge,`f`)[this.size-1].priority>=t.priority){he(this,ge,`f`).push(n);return}let r=me(he(this,ge,`f`),n,(e,t)=>t.priority-e.priority);he(this,ge,`f`).splice(r,0,n)}dequeue(){return he(this,ge,`f`).shift()?.run}filter(e){return he(this,ge,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return he(this,ge,`f`).length}};ge=new WeakMap;var B=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},V=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},H,ve,ye,U,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=new le,Ue=class extends Error{},We=class extends ce{constructor(e){if(super(),H.add(this),ve.set(this,void 0),ye.set(this,void 0),U.set(this,0),be.set(this,void 0),xe.set(this,void 0),Se.set(this,0),Ce.set(this,void 0),we.set(this,void 0),Te.set(this,void 0),Ee.set(this,void 0),De.set(this,0),Oe.set(this,void 0),ke.set(this,void 0),Ae.set(this,void 0),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e={carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:_e,...e},!(typeof e.intervalCap==`number`&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??``}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??``}\` (${typeof e.interval})`);B(this,ve,e.carryoverConcurrencyCount,`f`),B(this,ye,e.intervalCap===1/0||e.interval===0,`f`),B(this,be,e.intervalCap,`f`),B(this,xe,e.interval,`f`),B(this,Te,new e.queueClass,`f`),B(this,Ee,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,B(this,Ae,e.throwOnTimeout===!0,`f`),B(this,ke,e.autoStart===!1,`f`)}get concurrency(){return V(this,Oe,`f`)}set concurrency(e){if(!(typeof e==`number`&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);B(this,Oe,e,`f`),V(this,H,`m`,Be).call(this)}async add(e,t={}){return new Promise((n,r)=>{V(this,Te,`f`).enqueue(async()=>{var i,a;B(this,De,(i=V(this,De,`f`),i++,i),`f`),B(this,U,(a=V(this,U,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Ue(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):pe(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?V(this,Ae,`f`):t.throwOnTimeout)&&r(He)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}V(this,H,`m`,Ne).call(this)},t),V(this,H,`m`,Le).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return V(this,ke,`f`)?(B(this,ke,!1,`f`),V(this,H,`m`,Be).call(this),this):this}pause(){B(this,ke,!0,`f`)}clear(){B(this,Te,new(V(this,Ee,`f`)),`f`)}async onEmpty(){V(this,Te,`f`).size!==0&&await V(this,H,`m`,Ve).call(this,`empty`)}async onSizeLessThan(e){V(this,Te,`f`).size<e||await V(this,H,`m`,Ve).call(this,`next`,()=>V(this,Te,`f`).size<e)}async onIdle(){(V(this,De,`f`)!==0||V(this,Te,`f`).size!==0)&&await V(this,H,`m`,Ve).call(this,`idle`)}get size(){return V(this,Te,`f`).size}sizeBy(e){return V(this,Te,`f`).filter(e).length}get pending(){return V(this,De,`f`)}get isPaused(){return V(this,ke,`f`)}};ve=new WeakMap,ye=new WeakMap,U=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ce=new WeakMap,we=new WeakMap,Te=new WeakMap,Ee=new WeakMap,De=new WeakMap,Oe=new WeakMap,ke=new WeakMap,Ae=new WeakMap,H=new WeakSet,je=function(){return V(this,ye,`f`)||V(this,U,`f`)<V(this,be,`f`)},Me=function(){return V(this,De,`f`)<V(this,Oe,`f`)},Ne=function(){var e;B(this,De,(e=V(this,De,`f`),e--,e),`f`),V(this,H,`m`,Le).call(this),this.emit(`next`)},Pe=function(){this.emit(`empty`),V(this,De,`f`)===0&&this.emit(`idle`)},Fe=function(){V(this,H,`m`,ze).call(this),V(this,H,`m`,Re).call(this),B(this,we,void 0,`f`)},Ie=function(){let e=Date.now();if(V(this,Ce,`f`)===void 0){let t=V(this,Se,`f`)-e;if(t<0)B(this,U,V(this,ve,`f`)?V(this,De,`f`):0,`f`);else return V(this,we,`f`)===void 0&&B(this,we,setTimeout(()=>{V(this,H,`m`,Fe).call(this)},t),`f`),!0}return!1},Le=function(){if(V(this,Te,`f`).size===0)return V(this,Ce,`f`)&&clearInterval(V(this,Ce,`f`)),B(this,Ce,void 0,`f`),V(this,H,`m`,Pe).call(this),!1;if(!V(this,ke,`f`)){let e=!V(this,H,`a`,Ie);if(V(this,H,`a`,je)&&V(this,H,`a`,Me)){let t=V(this,Te,`f`).dequeue();return t?(this.emit(`active`),t(),e&&V(this,H,`m`,Re).call(this),!0):!1}}return!1},Re=function(){V(this,ye,`f`)||V(this,Ce,`f`)!==void 0||(B(this,Ce,setInterval(()=>{V(this,H,`m`,ze).call(this)},V(this,xe,`f`)),`f`),B(this,Se,Date.now()+V(this,xe,`f`),`f`))},ze=function(){V(this,U,`f`)===0&&V(this,De,`f`)===0&&V(this,Ce,`f`)&&(clearInterval(V(this,Ce,`f`)),B(this,Ce,void 0,`f`)),B(this,U,V(this,ve,`f`)?V(this,De,`f`):0,`f`),V(this,H,`m`,Be).call(this)},Be=function(){for(;V(this,H,`m`,Le).call(this););},Ve=async function(e,t){return new Promise(n=>{let r=()=>{(!t||t())&&(this.off(e,r),n())};this.on(e,r)})};var Ge=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)Ge(n,r,{get:e[r],enumerable:!0});return t||Ge(n,Symbol.toStringTag,{value:`Module`}),n},Ke=`__OSRA_KEY__`,qe=`__OSRA_DEFAULT_KEY__`,Je=`__OSRA_BOX__`,Ye=()=>globalThis.browser??globalThis.chrome,Xe=()=>Ye()?.runtime,Ze=(e,t)=>mt(e)&&e.__OSRA_KEY__===t,Qe=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},$e=({listener:e,transport:t,remoteName:n,key:r=qe,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=Mt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||Ze(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&Qe(a,t);return}if(vt(o)||yt(o)||xt(o)||St(o)){let t=(t,i)=>{let o=(t,a)=>{Ze(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),Qe(a,()=>t.removeListener(o))};if(vt(o))t(o.onMessage);else if(xt(o)){let e=e=>t(e.onMessage,e);o.addListener(e),Qe(a,()=>o.removeListener(e))}else St(o)?t(o):t(o.onMessage);return}let s=ft(o)?o.port:o,c=i!==`*`&&Ct(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}Ze(a,r)&&(n&&a.name!==n||c&&t.origin&&t.origin!==i||e(a,{receiveTransport:o,source:t.source,origin:t.origin}))};s.addEventListener(`message`,l),s instanceof MessagePort&&s.start(),Qe(a,()=>s.removeEventListener(`message`,l))},et=(e,t,n=`*`,r=[])=>{let i=Mt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(Ct(i))i.postMessage(t,n,r);else if(yt(i))i.postMessage(t);else if(vt(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(st(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else ft(i)?i.port.postMessage(t,r):i.postMessage(t,r)},tt=globalThis.Float16Array,nt={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:tt,Float32Array,Float64Array,BigInt64Array,BigUint64Array},rt=Object.values(nt),it=e=>{let t=e.constructor.name;if(t in nt)return t;for(let[t,n]of Object.entries(nt))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},at=e=>{let t=nt[e];if(!t)throw Error(`Unknown typed array type`);return t},ot=e=>rt.some(t=>!!t&&e instanceof t),st=e=>e instanceof WebSocket,ct=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,lt=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,ut=e=>!!globalThis.Worker&&e instanceof Worker,dt=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},ft=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,pt=e=>e instanceof MessagePort,mt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,ht=(e,t)=>{for(let n of t)if(n&&e instanceof n)return!0;return!1},gt=e=>ht(e,[globalThis.SharedArrayBuffer]),_t=e=>ht(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),vt=e=>{let t=Xe();return t?e===t:!1},yt=(e,t=!1)=>!e||typeof e!=`object`||Ct(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:!t||`sender`in e&&`onMessage`in e&&`onDisconnect`in e,bt=e=>!!e&&typeof e==`object`&&!Ct(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,xt=e=>{let t=Xe();return t?e===t.onConnect||e===t.onConnectExternal:!1},St=e=>bt(e),Ct=e=>{if(!e||typeof e!=`object`)return!1;try{return`window`in e&&e.window===e}catch{try{return`closed`in e&&typeof e.closed==`boolean`&&`close`in e&&typeof e.close==`function`}catch{return!1}}},wt=e=>st(e)||yt(e)||vt(e),Tt=e=>st(e)||yt(e)||xt(e)||St(e)||vt(e),Et=e=>!!e&&typeof e==`object`&&!Ct(e)&&`isJson`in e&&e.isJson===!0||wt(e)||Tt(e),Dt=e=>Ct(e)||wt(e)||lt(e)||ut(e)||dt(e)||ft(e)||pt(e)||At(e),Ot=e=>Ct(e)||Tt(e)||ct(e)||ut(e)||dt(e)||ft(e)||pt(e)||jt(e),kt=e=>{if(!e||typeof e!=`object`||Ct(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},At=e=>!kt(e)||!(`emit`in e)?!1:Dt(e.emit)||typeof e.emit==`function`,jt=e=>!kt(e)||!(`receive`in e)?!1:Ot(e.receive)||typeof e.receive==`function`,Mt=e=>At(e)||jt(e),G={[Je]:`revivable`},Nt=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,Pt=(e,t)=>Et(t.transport)?{base64Buffer:new Uint8Array(e).toBase64()}:{arrayBuffer:e},Ft=e=>`arrayBuffer`in e?e.arrayBuffer:Uint8Array.fromBase64(e.base64Buffer).buffer,It=W({box:()=>zt,isType:()=>Rt,revive:()=>Bt,type:()=>Lt}),Lt=`arrayBuffer`,Rt=e=>e instanceof ArrayBuffer,zt=(e,t)=>({...G,type:Lt,...Pt(e,t)}),Bt=(e,t)=>Ft(e),Vt=W({box:()=>Wt,isType:()=>Ut,revive:()=>Gt,type:()=>Ht}),Ht=`date`,Ut=e=>e instanceof Date,Wt=(e,t)=>({...G,type:Ht,ISOString:e.toISOString()}),Gt=(e,t)=>new Date(e.ISOString),Kt=W({box:()=>Yt,isType:()=>Jt,revive:()=>Xt,type:()=>qt}),qt=`headers`,Jt=e=>e instanceof Headers,Yt=(e,t)=>({...G,type:qt,entries:[...e.entries()]}),Xt=(e,t)=>new Headers(e.entries),Zt=W({box:()=>tn,isType:()=>en,revive:()=>nn,type:()=>Qt}),Qt=`error`,$t={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},en=e=>e instanceof Error,tn=(e,t)=>{let n=`cause`in e&&e.cause!==void 0,r=typeof AggregateError<`u`&&e instanceof AggregateError,i=typeof DOMException<`u`&&e instanceof DOMException;return{...G,type:Qt,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:ia(e.cause,t)}:{},...r?{errors:ia(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},nn=(e,t)=>{let n=e.cause===void 0?void 0:aa(e.cause,t),r=n===void 0?void 0:{cause:n};if(e.isDOMException&&typeof DOMException<`u`){let t=new DOMException(e.message,e.name);if(e.stack)try{Object.defineProperty(t,"stack",{value:e.stack,configurable:!0})}catch{}return t}let i;if(e.errors!==void 0&&typeof AggregateError<`u`)i=AggregateError(aa(e.errors,t),e.message,r);else{let t=$t[e.name]??Error;i=r===void 0?new t(e.message):new t(e.message,r)}return e.name&&i.name!==e.name&&(i.name=e.name),e.stack&&(i.stack=e.stack),i},rn=W({box:()=>sn,isType:()=>on,revive:()=>cn,type:()=>an}),an=`typedArray`,on=ot,sn=(e,t)=>{let n=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return{...G,type:an,typedArrayType:it(e),...Pt(n,t)}},cn=(e,t)=>new(at(e.typedArrayType))(Ft(e)),ln=new WeakMap,un=new WeakSet,dn=(e,t)=>{if(un.has(e))return t(),()=>{};let n=ln.get(e);return n||ln.set(e,n=new Set),n.add(t),()=>n.delete(t)},fn=e=>{if(un.has(e))return;un.add(e);let t=ln.get(e);if(t){ln.delete(e);for(let e of t)try{e()}catch{}}},pn=W({box:()=>xn,isType:()=>bn,revive:()=>Sn,transfer:()=>yn,type:()=>mn}),mn=`transfer`,hn=Symbol.for(`osra.transfer`),gn=e=>typeof e==`object`&&!!e,_n=e=>gn(e)&&hn in e&&e[hn]===!0,vn=e=>gn(e)?ArrayBuffer.isView(e)?!0:ht(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,yn=e=>vn(e)?{[hn]:!0,value:e}:e,bn=e=>_n(e),xn=(e,t)=>({...G,type:mn,inner:ia(e.value,t),degraded:Et(t.transport)}),Sn=(e,t)=>aa(e.inner,t),Cn=e=>ht(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),wn=e=>Nt(e)&&e.type===`transfer`,Tn=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(e&&typeof e==`object`&&!n.has(e)&&(n.add(e),!gt(e))){if(wn(e)){r(e.inner,i||!e.degraded);return}if(Cn(e)){t.push(e);return}if(_t(e)){i&&t.push(e);return}if(!ArrayBuffer.isView(e)){if(Array.isArray(e)){for(let t of e)r(t,i);return}for(let t of Object.values(e))r(t,i)}}};return r(e,!1),t},En=class{_listeners=new Map;addEventListener(e,t,n){if(!t)return;let r=this._listeners.get(e);r||(r=new Map,this._listeners.set(e,r)),r.has(t)||r.set(t,typeof n==`object`&&!!n?.once)}removeEventListener(e,t,n){t&&this._listeners.get(e)?.delete(t)}_peer;_queue=[];_started=!1;_closed=!1;_onClose;_onmessage=null;get onmessage(){return this._onmessage}set onmessage(e){this._onmessage=e,e!==null&&this.start()}onmessageerror=null;dispatchEvent(e){e.type===`message`?this._onmessage?.call(this,e):e.type===`messageerror`&&this.onmessageerror?.call(this,e);let t=this._listeners.get(e.type);if(t)for(let[n,r]of[...t])r&&t.delete(n),typeof n==`function`?n.call(this,e):n.handleEvent(e);return!0}postMessage(e,t){let n=this._peer;!n||n._closed||queueMicrotask(()=>{if(n._closed)return;let t=new MessageEvent(`message`,{data:e});n._started?n.dispatchEvent(t):n._queue.push(t)})}start(){if(!this._started){this._started=!0;for(let e of this._queue.splice(0))this.dispatchEvent(e)}}close(){if(this._closed)return;this._closed=!0,this._queue.length=0,this._onClose?.();let e=this._peer;e&&!e._closed&&queueMicrotask(()=>{e._closed||e.dispatchEvent(new Event(`close`))})}},Dn=class{port1;port2;constructor(){let e=new En,t=new En;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},On=new FinalizationRegistry(e=>{try{e()}catch{}}),kn=(e,t)=>{let n={};return On.register(e,t,n),()=>On.unregister(n)},An=W({box:()=>qn,createRevivableChannel:()=>Xn,init:()=>Hn,isType:()=>Un,revive:()=>Jn,type:()=>jn}),jn=`messagePort`,Mn=2048,Nn=128,Pn=1024,Fn=new WeakMap,In=e=>{let t=Fn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Ln=(e,t)=>{let n=e.ports.get(t);return n||(n={nextSeq:0,buffer:new Map,outSeq:0},e.ports.set(t,n),e.pendingPorts++),n},Rn=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=Nn){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},zn=e=>{if(e.handler)for(let t=e.buffer.get(e.nextSeq);t!==void 0;t=e.buffer.get(e.nextSeq))e.buffer.delete(e.nextSeq),e.nextSeq++,e.handler(t)},Bn=(e,t)=>Ln(In(e),t).outSeq++,Vn=(e,t,n)=>{let r=In(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=Ln(r,t);i.handler||r.pendingPorts--,i.handler=n,zn(i)},Hn=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Fn.set(e,t),e.eventTarget.addEventListener(`message`,({detail:n})=>{if(n.type!==`message`&&n.type!==`message-port-close`||t.tombstones.has(n.portId))return;let r=t.ports.get(n.portId);if(n.seq===void 0){r?.handler?.(n);return}if(!r){if(t.pendingPorts>=Pn)return;r=Ln(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=Mn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Rn(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),zn(r)}}),dn(e,()=>{for(let[n,r]of[...t.ports])r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n});t.ports.clear(),t.tombstones.clear(),t.pendingPorts=0})},Un=e=>e instanceof MessagePort||e instanceof En,Wn=(e,t)=>{try{let n=In(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},Gn=(e,t,n)=>{n?e.postMessage(t):e.postMessage(t,Tn(t))},Kn=(e,t,n)=>()=>{let r=e.deref();r&&Wn(r,n);let i=t.deref();i&&Rn(i,n)},qn=(e,t,n)=>{let r=e instanceof En;if(!r&&!Et(t.transport))return{...G,type:jn,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=In(t),a=e,o=globalThis.crypto.randomUUID(),s=new WeakRef(a),c=new WeakRef(t),l=new WeakRef(i),u=!1,d=()=>{if(u)return;u=!0;let e=l.deref();e&&Rn(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof En&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}Gn(a,aa(e.data,t),!1)};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:ia(e,t),portId:o,seq:Bn(t,o)})}let m=kn(a,Kn(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof En&&(a._onClose=()=>{u||(Wn(t,o),d())}),Vn(t,o,f),{...G,type:jn,portId:o,synthetic:r}},Jn=(e,t)=>`port`in e?e.autoBox?Yn(e.port,t):e.port:Zn(e.portId,t,e.synthetic),Yn=(e,t)=>{let n=new EventTarget,r=({data:e})=>{n.dispatchEvent(new MessageEvent(`message`,{data:aa(e,t)}))},i=()=>{n.dispatchEvent(new Event(`close`))};return e.addEventListener(`message`,r),e.addEventListener(`close`,i),n.postMessage=(n,r)=>{let i=ia(n,t),a=Tn(i),o=Array.isArray(r)?r:[];e.postMessage(i,o.length?[...a,...o]:a)},n.start=()=>e.start(),n.close=()=>{e.removeEventListener(`message`,r),e.removeEventListener(`close`,i),e.close()},n},Xn=e=>{if(Et(e.transport)){let{port1:t,port2:n}=new Dn;return{localPort:t,boxedRemote:qn(n,e)}}let{port1:t,port2:n}=new MessageChannel;return{localPort:Yn(t,e),boxedRemote:qn(n,e,{autoBox:!0})}},Zn=(e,t,n)=>{let r=In(t),{port1:i,port2:a}=n?new Dn:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=()=>{if(c)return;c=!0,Rn(r,e);let t=s.deref();t?.removeEventListener(`message`,d),t?.close(),f?.()},u=e=>{if(e.type===`message-port-close`){l();let e=o.deref();e?.dispatchEvent(new Event(`close`)),e?.close();return}if(!o.deref()){l();return}let r=s.deref();r&&Gn(r,aa(e.data,t),n)},d=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:ia(n,t),portId:e,seq:Bn(t,e)})},f=kn(i,()=>{Wn(t,e),l()});return i instanceof En&&(i._onClose=()=>{c||(Wn(t,e),l())}),a.addEventListener(`message`,d),a.start(),Vn(t,e,u),i},Qn=W({box:()=>rr,isType:()=>nr,revive:()=>ir,type:()=>$n}),$n=`promise`,er=e=>e instanceof Promise,tr=new Set,nr=e=>e instanceof Promise,rr=(e,t)=>{if(!er(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=Xn(t),i=e=>{n.postMessage(e),n.close()};return e.then(e=>i({type:`resolve`,data:e})).catch(e=>i({type:`reject`,error:e})),{...G,type:$n,port:r}},ir=(e,t)=>{let n=Jn(e.port,t);tr.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a=()=>{n.close(),tr.delete(n),o()},o=r?dn(t,()=>{i(Error(`osra: connection closed`)),a()}):()=>{};n.addEventListener(`message`,({data:t})=>{t.type===`resolve`?e(t.data):i(t.error),a()},{once:!0}),n.start()})},ar=W({box:()=>lr,isType:()=>cr,revive:()=>ur,type:()=>or}),or=`function`,sr=new Set,cr=e=>typeof e==`function`,lr=(e,t)=>{let{port1:n,port2:r}=new Dn;return n.addEventListener(`message`,({data:n})=>{let[r,i]=n;(async()=>{let n;try{n={type:`return`,value:await e(...i)}}catch(e){n={type:`throw`,error:e}}let a=(()=>{try{return ia(n,t)}catch(e){return ia({type:`throw`,error:e},t)}})();r.postMessage(a,Tn(a)),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:or,port:qn(r,t)}},ur=(e,t)=>{let n=Jn(e.port,t);return((...e)=>new Promise((r,i)=>{let{port1:a,port2:o}=new Dn;sr.add(a);let s=()=>{a.close(),sr.delete(a),c()},c=dn(t,()=>{i(Error(`osra: connection closed`)),s()});a.addEventListener(`message`,({data:e})=>{let t=e;t.type===`return`?r(t.value):i(t.error),s()},{once:!0}),a.start();let l=ia([o,e],t);n.postMessage(l,Tn(l))}))},dr=W({MAX_CREDIT_WINDOW:()=>64,box:()=>_r,isType:()=>pr,revive:()=>xr,type:()=>fr}),fr=`readableStream`,pr=e=>e instanceof ReadableStream,mr=2,hr=8,gr=4194304,_r=(e,t)=>{let{localPort:n,boxedRemote:r}=Xn(t),i=e.getReader(),a=0,o=!1,s=!1,c=e=>{s=!0;try{n.postMessage(e)}catch{}n.close()},l=async()=>{if(!(o||s)){for(o=!0;a>0;){let e;try{e=await i.read()}catch(e){s||c({type:`error`,error:e});return}if(s)return;if(e.done){c({type:`end`});return}a--;try{n.postMessage({type:`chunk`,value:e.value})}catch(e){c({type:`error`,error:e}),i.cancel(e).catch(()=>{});return}}o=!1}};return n.addEventListener(`message`,({data:e})=>{e instanceof Promise||!(`type`in e)||(e.type===`pull`?n.postMessage(i.read()):e.type===`credit`?(a+=e.n,l()):e.type===`cancel`&&(s=!0,i.cancel(e.reason).catch(()=>{}),n.close()))}),n.addEventListener(`close`,()=>{s||(s=!0,i.cancel(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:fr,credit:!0,port:r}},vr=e=>ArrayBuffer.isView(e)||e instanceof ArrayBuffer?e.byteLength:typeof e==`string`?e.length*2:typeof Blob<`u`&&e instanceof Blob?e.size:void 0,yr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?hr:Math.max(mr,Math.min(64,Math.floor(gr/r))),u=()=>{let t=l(),r=n+i.length;if(r>t/2)return;let a=t-r;n+=a,e.postMessage({type:`credit`,n:a})},d=()=>{t=!0,queueMicrotask(()=>e.close())},f=e=>{if(o=!0,s=e,!c||i.length)return;let t=c;c=void 0,d(),t.reject(e)};return new ReadableStream({start:()=>{e.addEventListener(`message`,({data:o})=>{if(!(o instanceof Promise||!(`type`in o))){if(o.type===`chunk`){if(t)return;if(n<=0){i.length=0,f(Error(`osra: stream exceeded its credit window`)),queueMicrotask(()=>e.close());return}n--;let a=vr(o.value);if(a!==void 0&&(r=r===void 0?a:r*.875+a*.125),c){let e=c;c=void 0,e.controller.enqueue(o.value),e.resolve()}else i.push(o.value)}else if(o.type===`end`){if(t||(a=!0,!c||i.length))return;let e=c;c=void 0,d(),e.controller.close(),e.resolve()}else if(o.type===`error`){if(t)return;f(o.error)}}}),e.addEventListener(`close`,()=>{t||a||o||f(Error(`osra: connection closed`))},{once:!0})},pull:e=>{if(!t){if(i.length){e.enqueue(i.shift()),!a&&!o&&u();return}if(a){d(),e.close();return}return o?(d(),Promise.reject(s)):(u(),new Promise((t,n)=>{c={controller:e,resolve:t,reject:n}}))}},cancel:n=>{t=!0,i.length=0;let r=c;c=void 0,r?.resolve(),e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},br=e=>{let t=!1;return new ReadableStream({start:n=>{e.addEventListener(`close`,()=>{if(!t){t=!0;try{n.error(Error(`osra: connection closed`))}catch{}}},{once:!0})},pull:n=>new Promise((r,i)=>{e.addEventListener(`message`,({data:a})=>{a instanceof Promise&&a.then(i=>{i.done?(t=!0,n.close(),e.postMessage({type:`cancel`}),queueMicrotask(()=>e.close())):n.enqueue(i.value),r()}).catch(e=>{t=!0,i(e)})},{once:!0}),e.postMessage({type:`pull`})}),cancel:n=>{t=!0,e.postMessage({type:`cancel`,reason:n}),queueMicrotask(()=>e.close())}})},xr=(e,t)=>{let n=Jn(e.port,t);return n.start(),e.credit?yr(n):br(n)},Sr=W({box:()=>Tr,isType:()=>wr,revive:()=>Er,type:()=>Cr}),Cr=`writableStream`,wr=e=>e instanceof WritableStream,Tr=(e,t)=>{let{localPort:n,boxedRemote:r}=Xn(t),i=e.getWriter(),a=!1,o=(e,t)=>e.then(()=>n.postMessage({type:`ack`})).catch(e=>n.postMessage({type:`err`,error:e?.message??String(e)})).then(()=>{t&&(a=!0,queueMicrotask(()=>n.close()))});return n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`write`?o(i.write(e.chunk),!1):e.type===`close`?o(i.close(),!0):e.type===`abort`&&o(i.abort(e.reason),!0))}),n.addEventListener(`close`,()=>{a||(a=!0,i.abort(Error(`osra: connection closed`)).catch(()=>{}))},{once:!0}),n.start(),{...G,type:Cr,port:r}},Er=(e,t)=>{let n=Jn(e.port,t);n.start();let r=new Set,i=!1;n.addEventListener(`close`,()=>{i=!0;let e=Error(`osra: connection closed`);for(let t of[...r])t(e);r.clear()},{once:!0});let a=Promise.resolve(),o=e=>{let t=a.then(()=>new Promise((t,a)=>{if(i){a(Error(`osra: connection closed`));return}let o=e=>{r.delete(a),e()};r.add(a),n.addEventListener(`message`,({data:e})=>{!e||typeof e!=`object`||!(`type`in e)||(e.type===`ack`?o(t):e.type===`err`&&o(()=>a(Error(e.error))))},{once:!0}),n.postMessage(e)}));return a=t.catch(()=>{}),t};return new WritableStream({write:e=>o({type:`write`,chunk:e}),close:()=>o({type:`close`}),abort:e=>o({type:`abort`,reason:e})})},Dr=W({box:()=>jr,isType:()=>kr,revive:()=>Mr,type:()=>Or}),Or=`abortSignal`,kr=e=>e instanceof AbortSignal,Ar=new WeakMap,jr=(e,t)=>{if(e.aborted)return{...G,type:Or,aborted:!0,reason:ia(e.reason,t)};let{localPort:n,boxedRemote:r}=Xn(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=dn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:Or,aborted:!1,reason:void 0,port:r}},Mr=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(aa(e.reason,t)),n.signal;let r=Jn(e.port,t);return Ar.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(aa(e.reason,t)),Ar.delete(n.signal),r.close())}),n.signal},Nr=W({box:()=>Ir,isType:()=>Fr,revive:()=>Lr,type:()=>Pr}),Pr=`response`,Fr=e=>e instanceof Response,Ir=(e,t)=>({...G,type:Pr,status:e.status,statusText:e.statusText,headers:Yt(e.headers,t),body:e.body?_r(e.body,t):null,url:e.url,redirected:e.redirected}),Lr=(e,t)=>{if(e.status===0)return Response.error();let n=Xt(e.headers,t),r=e.body?xr(e.body,t):null,i=e.status===101||e.status===204||e.status===205||e.status===304;r&&i&&r.cancel().catch(()=>{});let a=new Response(i?null:r,{status:e.status,statusText:e.statusText,headers:n});return e.url&&Object.defineProperty(a,"url",{value:e.url,configurable:!0}),e.redirected&&Object.defineProperty(a,"redirected",{value:!0,configurable:!0}),a},Rr=W({box:()=>Vr,isType:()=>Br,revive:()=>Hr,type:()=>zr}),zr=`request`,Br=e=>e instanceof Request,Vr=(e,t)=>({...G,type:zr,method:e.method,url:e.url,headers:Yt(e.headers,t),body:e.body?_r(e.body,t):null,credentials:e.credentials,cache:e.cache,mode:e.mode,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:jr(e.signal,t)}),Hr=(e,t)=>{let n=Xt(e.headers,t),r={method:e.method,headers:n,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,integrity:e.integrity,keepalive:e.keepalive,signal:Mr(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=xr(e.body,t),r.duplex=`half`),new Request(e.url,r)},Ur=W({box:()=>ri,boxByReference:()=>ii,identity:()=>Zr,isType:()=>ti,revive:()=>ai,type:()=>Wr}),Wr=`identity`,Gr=Symbol.for(`osra.identity`),Kr=e=>e!==null&&(typeof e==`object`||typeof e==`function`),qr=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`||t===`symbol`&&Symbol.keyFor(e)===void 0},Jr=e=>Kr(e)&&Gr in e&&e[Gr]===!0,Yr=new WeakMap,Xr=e=>{if(Jr(e))return e;let t=Yr.get(e);if(t)return t;let n={[Gr]:!0,value:e};return Yr.set(e,n),n},Zr=e=>Kr(e)?Xr(e):e,Qr=new WeakMap,$r=e=>{let t=Qr.get(e);if(t)return t;let n=new WeakMap,r=new Map,i=new Map,a=new WeakMap,o={sendIds:n,idToSent:r,sendRegistry:new FinalizationRegistry(t=>{r.delete(t);try{e.sendMessage({type:`identity-dispose`,remoteUuid:e.remoteUuid,id:t})}catch{}}),receiveCache:i,revivedToId:a,listenerInstalled:!1};return Qr.set(e,o),ei(e,o),dn(e,()=>{o.receiveCache.clear(),o.idToSent.clear()}),o},ei=(e,t)=>{t.listenerInstalled||(t.listenerInstalled=!0,e.eventTarget.addEventListener(`message`,({detail:e})=>{if(e?.type!==`identity-dispose`)return;let n=t.receiveCache.get(e.id);t.receiveCache.delete(e.id),n!==void 0&&qr(n)&&t.revivedToId.delete(n)}))},ti=e=>Jr(e),ni=(e,t)=>{let n=t.sendIds.get(e);if(n!==void 0)return{id:n,isExisting:!0};let r=t.revivedToId.get(e);if(r!==void 0)return{id:r,isExisting:!0};let i=globalThis.crypto.randomUUID();return t.sendIds.set(e,i),t.idToSent.set(i,new WeakRef(e)),t.sendRegistry.register(e,i),{id:i,isExisting:!1}},ri=(e,t)=>{let n=$r(t),r=e.value,i=ia(r,t);if(!qr(r))return{...G,type:Wr,id:globalThis.crypto.randomUUID(),inner:i};let{id:a,isExisting:o}=ni(r,n);return o?{...G,type:Wr,id:a}:{...G,type:Wr,id:a,inner:i}},ii=(e,t,n)=>{let{id:r,isExisting:i}=ni(e,$r(n));return i?{...G,type:Wr,id:r}:{...G,type:Wr,id:r,inner:t}},ai=(e,t)=>{let n=$r(t),r=n.receiveCache.get(e.id);if(r!==void 0)return r;let i=n.idToSent.get(e.id)?.deref();if(i!==void 0)return i;if(!(`inner`in e)||e.inner===void 0)throw Error(`osra identity: received id=${e.id} with no inner payload and no cached value`);let a=aa(e.inner,t);return n.receiveCache.set(e.id,a),qr(a)&&n.revivedToId.set(a,e.id),a},oi=W({box:()=>ci,isType:()=>si,revive:()=>li,type:()=>`map`}),si=e=>e instanceof Map,ci=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[ia(e,t),ia(n,t)])}),li=(e,t)=>new Map(e.entries.map(([e,n])=>[aa(e,t),aa(n,t)])),ui=W({box:()=>fi,isType:()=>di,revive:()=>pi,type:()=>`set`}),di=e=>e instanceof Set,fi=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>ia(e,t))}),pi=(e,t)=>new Set(e.values.map(e=>aa(e,t))),mi=W({box:()=>_i,isType:()=>gi,revive:()=>vi,type:()=>hi}),hi=`bigint`,gi=e=>typeof e==`bigint`,_i=(e,t)=>({...G,type:hi,value:e.toString()}),vi=(e,t)=>BigInt(e.value),yi=W({box:()=>Si,isType:()=>xi,revive:()=>Ci,type:()=>bi}),bi=`event`,xi=e=>e instanceof Event,Si=(e,t)=>({...G,type:bi,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:ia(e.detail,t)}:{}}),Ci=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:aa(e.detail,t)}):new Event(e.eventType,n)},wi=W({box:()=>Di,isType:()=>Ei,revive:()=>ji,type:()=>Ti}),Ti=`eventTarget`,Ei=e=>e instanceof EventTarget,Di=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Ti,addListener:lr((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:lr((t,i,a)=>{let o=r(a),s=n.findIndex(e=>e.eventType===t&&e.listener===i&&e.capture===o);s!==-1&&n.splice(s,1),e.removeEventListener(t,i,a)},t),removeAllListeners:lr(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Oi=new WeakMap,ki=e=>{if(typeof e==`function`)return e;let t=Oi.get(e);return t||Oi.set(e,t=t=>e.handleEvent(t)),t},Ai=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),ji=(e,t)=>{let n=ur(e.addListener,t),r=ur(e.removeListener,t),i=ur(e.removeAllListeners,t),a=new EventTarget,o=[],s=e=>{let t=o.indexOf(e);t!==-1&&o.splice(t,1)};return Object.defineProperty(a,"addEventListener",{value:(e,t,r)=>{if(t===null)return;let i=ki(t),a=typeof r==`boolean`?r:!!r?.capture;if(Ai(o,e,i,a))return;let c=typeof r==`object`&&r?.once?e=>(s(l),i(e)):i,l={eventType:e,listener:i,capture:a,wire:c};o.push(l),(typeof r==`object`?r?.signal:void 0)?.addEventListener(`abort`,()=>s(l),{once:!0}),n(e,Zr(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=ki(t),a=typeof n==`boolean`?n:!!n?.capture,c=Ai(o,e,i,a);c&&(s(c),r(e,Zr(c.wire),{capture:a}).catch(()=>{}))}}),kn(a,()=>{i().catch(()=>{})}),a},Mi=W({box:()=>Fi,isType:()=>Pi,revive:()=>Ii,type:()=>Ni}),Ni=`symbol`,Pi=e=>typeof e==`symbol`,Fi=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?ii(e,{...G,type:Ni,description:e.description},t):{...G,type:Ni,registryKey:n}},Ii=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),Li=W({box:()=>Bi,isType:()=>zi,revive:()=>Vi,type:()=>Ri}),Ri=`asyncIterator`,zi=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Bi=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:Ri,next:lr((e=>n.next(e)),t),return:lr((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:lr((e=>n.throw?.(e)??Promise.reject(e)),t)}},Vi=(e,t)=>{let n=ur(e.next,t),r=ur(e.return,t),i=ur(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},Hi=[globalThis.File,globalThis.FileList,globalThis.RegExp,globalThis.DataView,globalThis.ImageData,globalThis.FormData,globalThis.DOMException,globalThis.DOMMatrix,globalThis.DOMMatrixReadOnly,globalThis.DOMPoint,globalThis.DOMPointReadOnly,globalThis.DOMQuad,globalThis.DOMRect,globalThis.DOMRectReadOnly,globalThis.CryptoKey,globalThis.FileSystemHandle,globalThis.FileSystemFileHandle,globalThis.FileSystemDirectoryHandle,globalThis.RTCCertificate],Ui=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],Wi={type:`clonable`,capableOnly:!0,isType:e=>ht(e,Hi)||ht(e,Ui),box:(e,t)=>e,revive:(e,t)=>e},Gi=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Ki=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],qi={type:`transferable`,capableOnly:!0,isType:e=>ht(e,Gi)||ht(e,Ki),box:(e,t)=>e,revive:(e,t)=>e},Ji={type:`blob`,capableOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Et(t.transport))throw TypeError(`osra: Blob is only supported on structured-clone transports, send an ArrayBuffer or Uint8Array instead`);return e},revive:(e,t)=>e},Yi=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Xi=[pn,Ur,It,Vt,Kt,Zt,rn,Qn,ar,An,dr,Sr,Dr,Nr,Rr,oi,ui,mi,Mi,yi,Li,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Et(t.transport)?{...G,type:`nonFiniteNumber`,value:String(e)}:e,revive:(e,t)=>Number(e.value)},{type:`undefined`,isType:e=>e===void 0,box:(e,t)=>Et(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},Wi,qi,Ji,wi,{type:`unclonable`,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Yi(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],Zi=(e,t)=>t.find(t=>t.isType(e)),Qi=(e,t)=>t.find(t=>t.type===e.type),$i=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,ea=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):$i(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,ta=new WeakSet,na=new WeakSet,ra=e=>e!==null&&(typeof e==`object`||typeof e==`function`),ia=(e,t)=>{if(Nt(e))return e;let n=ra(e);if(n){if(ta.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);ta.add(e)}try{let n=Zi(e,t.revivableModules);return n?n.box(e,t):ea(e,e=>ia(e,t))}finally{n&&ta.delete(e)}},aa=(e,t)=>{let n=ra(e);if(n){if(na.has(e))throw TypeError(`osra: cannot revive a circular structure`);na.add(e)}try{if(Nt(e)){let n=Qi(e,t.revivableModules);if(n)return n.revive(e,t)}return ea(e,e=>aa(e,t))}finally{n&&na.delete(e)}},oa=W({init:()=>la,startBidirectionalConnection:()=>ca,type:()=>sa}),sa=`bidirectional`,ca=({transport:e,value:t,remoteUuid:n,eventTarget:r,send:i,revivableModules:a})=>{let o={transport:e,remoteUuid:n,sendMessage:i,eventTarget:r,revivableModules:a};for(let e of a)e.init?.(o);let{promise:s,resolve:c}=Promise.withResolvers();return r.addEventListener(`message`,function e({detail:t}){t.type===`init`&&(c(t.data),r.removeEventListener(`message`,e))}),i({type:`init`,remoteUuid:n,data:ia(t,o)}),{revivableContext:o,remoteValue:s.then(e=>aa(e,o))}},la=e=>{if(!(Dt(e.transport)&&Ot(e.transport)))return;if(e.protocolEventTarget.addEventListener(`message`,({detail:{message:t,peer:n}})=>{if(t.type===`announce`){if(!t.remoteUuid){e.sendMessage({type:`announce`,remoteUuid:t.uuid});return}if(t.remoteUuid!==e.getUuid()||e.connectionContexts.has(t.uuid))return;e.sendMessage({type:`announce`,remoteUuid:t.uuid});let r=e.createConnectionEventTarget(),i={...n(),abort:()=>e.abortConnection(t.uuid)},a;try{let n=e.valueFor(i);if(e.claimPendingAbort(t.uuid)){e.sendMessage({type:`close`,remoteUuid:t.uuid});return}a=ca({transport:e.transport,value:n,remoteUuid:t.uuid,eventTarget:r,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t.uuid}),e.rejectRemoteValue(n);return}let o={type:`bidirectional`,eventTarget:r,connection:a};e.connectionContexts.set(t.uuid,o),o.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}if(t.type===`close`){if(t.remoteUuid!==e.getUuid())return;let n=e.connectionContexts.get(t.uuid);if(!n)return;e.connectionContexts.delete(t.uuid),fn(n.connection.revivableContext),e.rejectRemoteValue(Error(`osra: peer closed the connection`));return}if(t.remoteUuid!==e.getUuid())return;let r=e.connectionContexts.get(t.uuid);r&&r.eventTarget.dispatchEvent(new CustomEvent(`message`,{detail:t}))}),e.presetRemoteUuid!==void 0){let t=e.presetRemoteUuid,n=e.createConnectionEventTarget(),r,i;try{i={abort:()=>e.abortConnection(t)};let a=e.valueFor(i);if(e.claimPendingAbort(t)){e.sendMessage({type:`close`,remoteUuid:t});return}r=ca({transport:e.transport,value:a,remoteUuid:e.presetRemoteUuid,eventTarget:n,send:t=>e.sendMessage(t),revivableModules:e.revivableModules})}catch(n){e.sendMessage({type:`close`,remoteUuid:t}),e.rejectRemoteValue(n);return}let a={type:`bidirectional`,eventTarget:n,connection:r};e.connectionContexts.set(e.presetRemoteUuid,a),a.connection.remoteValue.then(t=>e.addConnection(i,t),t=>e.rejectRemoteValue(t));return}let t=50,n,r=()=>{if(!(e.unregisterSignal?.aborted||e.connectionContexts.size>0)){try{e.sendMessage({type:`announce`},`*`)}catch{}n=setTimeout(r,t),t=Math.min(t*2,1e3)}};e.unregisterSignal?.addEventListener(`abort`,()=>clearTimeout(n),{once:!0}),r()},ua=()=>new EventTarget,da=e=>{let t=Mt(e),n=t?e.emit:e,r=t?e.receive:e;return{isJson:t&&`isJson`in e&&e.isJson!==void 0?e.isJson:n!==void 0&&Et(n)||r!==void 0&&Et(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},fa=e=>e?e(Xi):Xi,pa=32,ma=()=>{let e=[],t=new Set,n=!1,r=()=>({value:void 0,done:!0});return{push:r=>{if(!n){if(t.size===0){e.push(r),e.length>pa&&e.shift();return}for(let e of t){let t=e.wake;if(t){e.wake=void 0,t({value:r,done:!1});continue}e.buffered.push(r)}}},close:()=>{n=!0;for(let e of t){let t=e.wake;e.wake=void 0,t?.(r())}},iterate:()=>{let i={buffered:[...e]};t.add(i);let a=!1;return{[Symbol.asyncIterator](){return this},next:()=>{if(a)return Promise.resolve(r());let e=i.buffered.shift();return e?Promise.resolve({value:e,done:!1}):n?Promise.resolve(r()):new Promise(e=>{i.wake=e})},return:()=>{a=!0,t.delete(i);let e=i.wake;return i.wake=void 0,e?.(r()),Promise.resolve(r())}}}}},ha=(e,t,n)=>{let r=e.then(n);r.catch(()=>{});let i=()=>{let e=t.iterate();return{[Symbol.asyncIterator](){return this},next:()=>e.next().then(e=>e.done?{value:void 0,done:!0}:{value:n(e.value),done:!1}),return:()=>e.return?.()??Promise.resolve({value:void 0,done:!0})}};return Object.assign(r,{[Symbol.asyncIterator]:i})},ga=Symbol.for(`osra.context`),_a=e=>typeof e==`object`&&!!e&&ga in e,va=[oa],ya=(e,{transport:t,name:n,remoteName:r,key:i=qe,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=da(t);if(!(Dt(f)&&Ot(f))){let e=ma();e.close();let t=Promise.reject(Error(`osra: transport must be able to both emit and receive to establish a connection; pass a bidirectional platform transport or a custom { emit, receive } pair`));return t.catch(()=>{}),ha(t,e,d)}let p=fa(s),m=new Map,h=new Set,g=ma(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Ke]:i,name:n,uuid:b,...e};et(f,r,t,Tn(r))},S=(e,t)=>{o?.aborted||x(e,t)},C=ua(),w={transport:f,valueFor:t=>_a(e)?e[ga](t):e,revivableModules:p,connectionContexts:m,getUuid:()=>b,presetRemoteUuid:l,sendMessage:S,protocolEventTarget:C,rejectRemoteValue:y,abortConnection:e=>{let t=m.get(e);if(!t){h.add(e);return}m.delete(e),x({type:`close`,remoteUuid:e}),fn(t.connection.revivableContext),y(Error(`osra: connection aborted`))},claimPendingAbort:e=>h.delete(e),addConnection:(e,t)=>{let n={value:t,context:e};v(n),g.push(n)},createConnectionEventTarget:ua,unregisterSignal:o};if($e({listener:(e,t)=>{e.uuid!==b&&C.dispatchEvent(new CustomEvent(`message`,{detail:{message:e,peer:()=>({...t.origin?{origin:t.origin}:{},...t.source?{source:t.source}:{},...t.port?{port:t.port}:{},...t.sender?{sender:t.sender}:{}})}}))},transport:f,remoteName:r,key:i,origin:a,unregisterSignal:o}),o?.aborted)return y(o.reason),g.close(),ha(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),fn(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of va)e.init(w);return ha(_,g,d)},ba=(e,t)=>ya(e,t),xa=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),Sa=async({publicPath:e,workerUrl:t,workerOptions:n,read:r,length:i,bufferSize:a,audioStreamIndex:o,transferReads:s=!0})=>{let c=new Worker(t,n),{makeRemuxer:l}=await ba({},{transport:c}),u=await l({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o}),d=new We({concurrency:1}),f=!1,p=(e,t)=>{f||!s||e.byteLength>0||t>=i||(f=!0,console.warn(`libav-wasm: read(${t}) returned 0 bytes, ${i-t} bytes before the end of the file. Reads are transferred, so the buffer read() returns is detached in the caller and handing back bytes you keep returns that same detached buffer. Return a copy, or pass transferReads: false.`))},m=e=>(t,n)=>e.signal.aborted?Promise.resolve({resolved:new Uint8Array().buffer,rejected:!0}):Promise.race([r(Number(t),Number(n)).then(e=>{p(e,Number(t));let n=new Uint8Array(e).buffer;return{resolved:s?yn(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),xa(e.signal).then(()=>({resolved:new Uint8Array().buffer,rejected:!0}),()=>({resolved:new Uint8Array().buffer,rejected:!0}))]),h=[];return{worker:c,remuxer:u,wasmRead:m,addTask:e=>{let t=[...h];h=[],d.clear(),t.forEach(e=>e.abort());let n=new AbortController;return h=[...h,n],Promise.race([d.add(async()=>e(n),{signal:n.signal}),xa(n.signal).then(()=>Promise.reject(Error(`Cancelled`)),()=>Promise.reject(Error(`Cancelled`)))])},destroy:async()=>{let e=[...h];h=[],d.clear(),e.forEach(e=>e.abort()),await u.destroy(),c.terminate()}}},Ca=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Sa({...e,bufferSize:e.bufferSize??25e5});return{worker:t,init:()=>i(e=>n.init(r(e))),destroy:a,seek:e=>i(t=>n.seek(r(t),e)),read:()=>i(e=>n.read(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),setAudioStreamIndex:e=>n.setAudioStreamIndex(e)}},wa=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await Sa({...e,bufferSize:e.bufferSize??1e6});return{worker:t,init:()=>i(e=>n.initThumbnail(r(e))),readKeyframe:e=>i(t=>n.readKeyframe(r(t),e)),destroy:a}},Ta=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},Ea=`getVideoPlaybackQuality`in Ta||`webkitDecodedFrameCount`in Ta||`mozPresentedFrames`in Ta||`mozPaintedFrames`in Ta;if(!(`requestVideoFrameCallback`in Ta)&&Ea&&typeof requestAnimationFrame==`function`){Ta._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in Ta?e=>{let{totalFrameDelay:t,totalVideoFrames:n,droppedVideoFrames:r}=e.getVideoPlaybackQuality();return{presentedFrames:n-r,totalFrameDelay:t}}:e=>({presentedFrames:e.mozPresentedFrames||e.mozPaintedFrames||e.webkitDecodedFrameCount-(e.webkitDroppedFrameCount||0),totalFrameDelay:e.mozFrameDelay||0});Ta.requestVideoFrameCallback=function(t){let n=performance.now(),r=e(this),i=r.presentedFrames,a=(o,s)=>{let c=e(this),l=c.presentedFrames;if(l>i){let e=c.totalFrameDelay-r.totalFrameDelay||0,i=s-o;t(s,{presentationTime:s+e*1e3,expectedDisplayTime:s+i,width:this.videoWidth,height:this.videoHeight,mediaTime:Math.max(0,this.currentTime||0)+i/1e3,presentedFrames:l,processingDuration:e}),delete this._rvfcpolyfillmap[n]}else this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(s,e))};return this._rvfcpolyfillmap[n]=requestAnimationFrame(e=>a(n,e)),n},Ta.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var Da={bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Oa={BT601:{BT709:`1.0863 -0.0723 -0.014 0 0 0.0965 0.8451 0.0584 0 0 -0.0141 -0.0277 1.0418`},BT709:{BT601:`0.9137 0.0784 0.0079 0 0 -0.1049 1.1722 -0.0671 0 0 0.0096 0.0322 0.9582`},FCC:{BT709:`1.0873 -0.0736 -0.0137 0 0 0.0974 0.8494 0.0531 0 0 -0.0127 -0.0251 1.0378`,BT601:`1.001 -0.0008 -0.0002 0 0 0.0009 1.005 -0.006 0 0 0.0013 0.0027 0.996`},SMPTE240M:{BT709:`0.9993 0.0006 0.0001 0 0 -0.0004 0.9812 0.0192 0 0 -0.0034 -0.0114 1.0148`,BT601:`0.913 0.0774 0.0096 0 0 -0.1051 1.1508 -0.0456 0 0 0.0063 0.0207 0.973`}},ka=class e extends EventTarget{constructor(t){if(super(),!globalThis.Worker)throw this.destroy(`Worker not supported`);if(!t)throw this.destroy(`No options provided`);this._loaded=new Promise(e=>{this._init=e});let n=e._test();if(this._onDemandRender=`requestVideoFrameCallback`in HTMLVideoElement.prototype&&(t.onDemandRender??!0),this._offscreenRender=`transferControlToOffscreen`in HTMLCanvasElement.prototype&&!t.canvas&&(t.offscreenRender??!0),this.timeOffset=t.timeOffset||0,this._video=t.video,this._videoHeight=0,this._videoWidth=0,this._videoColorSpace=null,this._canvas=t.canvas,this._video&&!this._canvas)this._canvasParent=document.createElement(`div`),this._canvasParent.className=`JASSUB`,this._canvasParent.style.position=`relative`,this._canvas=this._createCanvas(),this._video.insertAdjacentElement(`afterend`,this._canvasParent);else if(!this._canvas)throw this.destroy(`Don't know where to render: you should give video or canvas in options.`);if(this._bufferCanvas=document.createElement(`canvas`),this._bufferCtx=this._bufferCanvas.getContext(`2d`),!this._bufferCtx)throw this.destroy(`Canvas rendering not supported`);this._canvasctrl=this._offscreenRender?this._canvas.transferControlToOffscreen():this._canvas,this._ctx=!this._offscreenRender&&this._canvasctrl.getContext(`2d`),this._lastRenderTime=0,this.debug=!!t.debug,this.prescaleFactor=t.prescaleFactor||1,this.prescaleHeightLimit=t.prescaleHeightLimit||1080,this.maxRenderHeight=t.maxRenderHeight||0,this._boundResize=this.resize.bind(this),this._boundTimeUpdate=this._timeupdate.bind(this),this._boundSetRate=this.setRate.bind(this),this._boundUpdateColorSpace=this._updateColorSpace.bind(this),this._video&&this.setVideo(t.video),this._onDemandRender&&(this.busy=!1,this._lastDemandTime=null),this._worker=new Worker(t.workerUrl||`jassub-worker.js`),this._worker.onmessage=e=>this._onmessage(e),this._worker.onerror=e=>this._error(e),n.then(()=>{this._worker.postMessage({target:`init`,wasmUrl:e._supportsSIMD&&t.modernWasmUrl?t.modernWasmUrl:t.wasmUrl??`jassub-worker.wasm`,legacyWasmUrl:t.legacyWasmUrl??`jassub-worker.wasm.js`,asyncRender:typeof createImageBitmap<`u`&&(t.asyncRender??!0),onDemandRender:this._onDemandRender,width:this._canvasctrl.width||0,height:this._canvasctrl.height||0,blendMode:t.blendMode||`js`,subUrl:t.subUrl,subContent:t.subContent||null,fonts:t.fonts||[],availableFonts:t.availableFonts||{"liberation sans":`./default.woff2`},fallbackFont:t.fallbackFont||`liberation sans`,debug:this.debug,targetFps:t.targetFps||24,dropAllAnimations:t.dropAllAnimations,dropAllBlur:t.dropAllBlur,libassMemoryLimit:t.libassMemoryLimit||0,libassGlyphLimit:t.libassGlyphLimit||0,useLocalFonts:typeof queryLocalFonts<`u`&&(t.useLocalFonts??!0),hasBitmapBug:e._hasBitmapBug}),this._offscreenRender===!0&&this.sendMessage(`offscreenCanvas`,null,[this._canvasctrl])})}_createCanvas(){return this._canvas=document.createElement(`canvas`),this._canvas.style.display=`block`,this._canvas.style.position=`absolute`,this._canvas.style.pointerEvents=`none`,this._canvasParent.appendChild(this._canvas),this._canvas}static _supportsSIMD=null;static _hasAlphaBug=null;static _hasBitmapBug=null;static _testSIMD(){if(e._supportsSIMD===null)try{e._supportsSIMD=WebAssembly.validate(Uint8Array.of(0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11))}catch{e._supportsSIMD=!1}}static async _testImageBugs(){if(e._hasBitmapBug!==null)return;let t=document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`Canvas rendering not supported`);if(typeof ImageData.prototype.constructor==`function`)try{new ImageData(new Uint8ClampedArray([0,0,0,0]),1,1)}catch{console.log(`Detected that ImageData is not constructable despite browser saying so`),self.ImageData=function(e,t,r){let i=n.createImageData(t,r);return e&&i.data.set(e),i}}let r=document.createElement(`canvas`),i=r.getContext(`2d`,{willReadFrequently:!0});if(!i)throw Error(`Canvas rendering not supported`);t.width=r.width=1,t.height=r.height=1,n.clearRect(0,0,1,1),i.clearRect(0,0,1,1);let a=i.getImageData(0,0,1,1).data;n.putImageData(new ImageData(new Uint8ClampedArray([0,255,0,0]),1,1),0,0),i.drawImage(t,0,0);let o=i.getImageData(0,0,1,1).data;if(e._hasAlphaBug=a[1]!==o[1],e._hasAlphaBug&&console.log(`Detected a browser having issue with transparent pixels, applying workaround`),typeof createImageBitmap<`u`){let t=new Uint8ClampedArray([255,0,255,0,255]).subarray(1,5);i.drawImage(await createImageBitmap(new ImageData(t,1)),0,0);let{data:n}=i.getImageData(0,0,1,1);e._hasBitmapBug=!1;for(let[r,i]of n.entries())if(Math.abs(t[r]-i)>15){e._hasBitmapBug=!0,console.log(`Detected a browser having issue with partial bitmaps, applying workaround`);break}}else e._hasBitmapBug=!1;t.remove(),r.remove()}static async _test(){e._testSIMD(),await e._testImageBugs()}resize(e=0,t=0,n=0,r=0,i=this._video?.paused){if((!e||!t)&&this._video){let i=this._getVideoPosition(),a=null;if(this._videoWidth){let e=this._video.videoWidth/this._videoWidth,t=this._video.videoHeight/this._videoHeight;a=this._computeCanvasSize((i.width||0)/e,(i.height||0)/t)}else a=this._computeCanvasSize(i.width||0,i.height||0);e=a.width,t=a.height,this._canvasParent&&(n=i.y-(this._canvasParent.getBoundingClientRect().top-this._video.getBoundingClientRect().top),r=i.x),this._canvas.style.width=i.width+`px`,this._canvas.style.height=i.height+`px`}this._canvas.style.top=n+`px`,this._canvas.style.left=r+`px`,i&&this.busy===!1?this.busy=!0:i=!1,this.sendMessage(`canvas`,{width:e,height:t,videoWidth:this._videoWidth||this._video.videoWidth,videoHeight:this._videoHeight||this._video.videoHeight,force:i})}_getVideoPosition(e=this._video.videoWidth,t=this._video.videoHeight){let n=e/t,{offsetWidth:r,offsetHeight:i}=this._video,a=r/i;e=r,t=i,a>n?e=Math.floor(i*n):t=Math.floor(r/n);let o=(r-e)/2,s=(i-t)/2;return{width:e,height:t,x:o,y:s}}_computeCanvasSize(e=0,t=0){let n=this.prescaleFactor<=0?1:this.prescaleFactor,r=self.devicePixelRatio||1;if(t<=0||e<=0)e=0,t=0;else{let i=n<1?-1:1,a=t*r;i*a*n<=i*this.prescaleHeightLimit?a*=n:i*a<i*this.prescaleHeightLimit&&(a=this.prescaleHeightLimit),this.maxRenderHeight>0&&a>this.maxRenderHeight&&(a=this.maxRenderHeight),e*=a/t,t=a}return{width:e,height:t}}_timeupdate({type:e}){let t={seeking:!0,waiting:!0,playing:!1}[e];t!=null&&(this._playstate=t),this.setCurrentTime(this._video.paused||this._playstate,this._video.currentTime+this.timeOffset)}setVideo(e){e instanceof HTMLVideoElement?(this._removeListeners(),this._video=e,this._onDemandRender?this._video.requestVideoFrameCallback(this._handleRVFC.bind(this)):(this._playstate=e.paused,e.addEventListener(`timeupdate`,this._boundTimeUpdate,!1),e.addEventListener(`progress`,this._boundTimeUpdate,!1),e.addEventListener(`waiting`,this._boundTimeUpdate,!1),e.addEventListener(`seeking`,this._boundTimeUpdate,!1),e.addEventListener(`playing`,this._boundTimeUpdate,!1),e.addEventListener(`ratechange`,this._boundSetRate,!1),e.addEventListener(`resize`,this._boundResize,!1)),`VideoFrame`in window&&(e.addEventListener(`loadedmetadata`,this._boundUpdateColorSpace,!1),e.readyState>2&&this._updateColorSpace()),e.videoWidth>0&&this.resize(),typeof ResizeObserver<`u`&&(this._ro||=new ResizeObserver(()=>this.resize()),this._ro.observe(e))):this._error(`Video element invalid!`)}runBenchmark(){this.sendMessage(`runBenchmark`)}setTrackByUrl(e){this.sendMessage(`setTrackByUrl`,{url:e}),this._reAttachOffscreen(),this._ctx&&(this._ctx.filter=`none`)}setTrack(e){this.sendMessage(`setTrack`,{content:e}),this._reAttachOffscreen(),this._ctx&&(this._ctx.filter=`none`)}freeTrack(){this.sendMessage(`freeTrack`)}setIsPaused(e){this.sendMessage(`video`,{isPaused:e})}setRate(e){this.sendMessage(`video`,{rate:e})}setCurrentTime(e,t,n){this.sendMessage(`video`,{isPaused:e,currentTime:t,rate:n,colorSpace:this._videoColorSpace})}createEvent(e){this.sendMessage(`createEvent`,{event:e})}setEvent(e,t){this.sendMessage(`setEvent`,{event:e,index:t})}removeEvent(e){this.sendMessage(`removeEvent`,{index:e})}getEvents(e){this._fetchFromWorker({target:`getEvents`},(t,{events:n})=>{e(t,n)})}styleOverride(e){this.sendMessage(`styleOverride`,{style:e})}disableStyleOverride(){this.sendMessage(`disableStyleOverride`)}createStyle(e){this.sendMessage(`createStyle`,{style:e})}setStyle(e,t){this.sendMessage(`setStyle`,{style:e,index:t})}removeStyle(e){this.sendMessage(`removeStyle`,{index:e})}getStyles(e){this._fetchFromWorker({target:`getStyles`},(t,{styles:n})=>{e(t,n)})}addFont(e){this.sendMessage(`addFont`,{font:e})}setDefaultFont(e){this.sendMessage(`defaultFont`,{font:e})}_sendLocalFont(e){try{queryLocalFonts().then(t=>{let n=t?.find(t=>t.fullName.toLowerCase()===e);n&&n.blob().then(e=>{e.arrayBuffer().then(e=>{this.addFont(new Uint8Array(e))})})})}catch(e){console.warn(`Local fonts API:`,e)}}_getLocalFont({font:e}){try{navigator?.permissions?.query?navigator.permissions.query({name:`local-fonts`}).then(t=>{t.state===`granted`&&this._sendLocalFont(e)}):this._sendLocalFont(e)}catch(e){console.warn(`Local fonts API:`,e)}}_unbusy(){this._lastDemandTime?this._demandRender(this._lastDemandTime):this.busy=!1}_handleRVFC(e,{mediaTime:t,width:n,height:r}){if(this._destroyed)return null;this.busy?this._lastDemandTime={mediaTime:t,width:n,height:r}:(this.busy=!0,this._demandRender({mediaTime:t,width:n,height:r})),this._video.requestVideoFrameCallback(this._handleRVFC.bind(this))}_demandRender({mediaTime:e,width:t,height:n}){this._lastDemandTime=null,(t!==this._videoWidth||n!==this._videoHeight)&&(this._videoWidth=t,this._videoHeight=n,this.resize()),this.sendMessage(`demand`,{time:e+this.timeOffset})}_detachOffscreen(){if(!this._offscreenRender||this._ctx)return null;this._canvas.remove(),this._createCanvas(),this._canvasctrl=this._canvas,this._ctx=this._canvasctrl.getContext(`2d`),this.sendMessage(`detachOffscreen`),this.busy=!1,this.resize(0,0,0,0,!0)}_reAttachOffscreen(){if(!this._offscreenRender||!this._ctx)return null;this._canvas.remove(),this._createCanvas(),this._canvasctrl=this._canvas.transferControlToOffscreen(),this._ctx=!1,this.sendMessage(`offscreenCanvas`,null,[this._canvasctrl]),this.resize(0,0,0,0,!0)}_updateColorSpace(){this._video.requestVideoFrameCallback(()=>{try{let e=new VideoFrame(this._video);this._videoColorSpace=Da[e.colorSpace.matrix],e.close(),this.sendMessage(`getColorSpace`)}catch(e){console.warn(e)}})}_verifyColorSpace({subtitleColorSpace:e,videoColorSpace:t=this._videoColorSpace}){e&&t&&e!==t&&(this._detachOffscreen(),this._ctx.filter=`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='f'><feColorMatrix type='matrix' values='${Oa[e][t]} 0 0 0 0 0 1 0'/></filter></svg>#f")`)}_render({images:e,asyncRender:t,times:n,width:r,height:i,colorSpace:a}){this._unbusy(),this.debug&&(n.IPCTime=Date.now()-n.JSRenderTime),(this._canvasctrl.width!==r||this._canvasctrl.height!==i)&&(this._canvasctrl.width=r,this._canvasctrl.height=i,this._verifyColorSpace({subtitleColorSpace:a})),this._ctx.clearRect(0,0,this._canvasctrl.width,this._canvasctrl.height);for(let n of e)n.image&&(t?(this._ctx.drawImage(n.image,n.x,n.y),n.image.close()):(this._bufferCanvas.width=n.w,this._bufferCanvas.height=n.h,this._bufferCtx.putImageData(new ImageData(this._fixAlpha(new Uint8ClampedArray(n.image)),n.w,n.h),0,0),this._ctx.drawImage(this._bufferCanvas,n.x,n.y)));if(this.debug){n.JSRenderTime=Date.now()-n.JSRenderTime-n.IPCTime;let t=0,r=n.bitmaps||e.length;delete n.bitmaps;for(let e in n)t+=n[e];console.log(`Bitmaps: `+r+` Total: `+(t|0)+`ms`,n)}}_fixAlpha(t){if(e._hasAlphaBug)for(let e=3;e<t.length;e+=4)t[e]=t[e]>1?t[e]:1;return t}_ready(){this._init(),this.dispatchEvent(new CustomEvent(`ready`))}async sendMessage(e,t={},n){await this._loaded,n?this._worker.postMessage({target:e,transferable:n,...t},[...n]):this._worker.postMessage({target:e,...t})}_fetchFromWorker(e,t){try{let n=e.target,r=setTimeout(()=>{a(Error(`Error: Timeout while try to fetch `+n))},5e3),i=({data:e})=>{e.target===n&&(t(null,e),this._worker.removeEventListener(`message`,i),this._worker.removeEventListener(`error`,a),clearTimeout(r))},a=e=>{t(e),this._worker.removeEventListener(`message`,i),this._worker.removeEventListener(`error`,a),clearTimeout(r)};this._worker.addEventListener(`message`,i),this._worker.addEventListener(`error`,a),this._worker.postMessage(e)}catch(e){this._error(e)}}_console({content:e,command:t}){console[t].apply(console,JSON.parse(e))}_onmessage({data:e}){this[`_`+e.target]&&this[`_`+e.target](e)}_error(e){let t=e instanceof Error?e:e instanceof ErrorEvent?e.error:Error(e),n=e instanceof Event?new ErrorEvent(e.type,e):new ErrorEvent(`error`,{error:t});return this.dispatchEvent(n),console.error(t),t}_removeListeners(){this._video&&(this._ro&&this._ro.unobserve(this._video),this._ctx&&(this._ctx.filter=`none`),this._video.removeEventListener(`timeupdate`,this._boundTimeUpdate),this._video.removeEventListener(`progress`,this._boundTimeUpdate),this._video.removeEventListener(`waiting`,this._boundTimeUpdate),this._video.removeEventListener(`seeking`,this._boundTimeUpdate),this._video.removeEventListener(`playing`,this._boundTimeUpdate),this._video.removeEventListener(`ratechange`,this._boundSetRate),this._video.removeEventListener(`resize`,this._boundResize),this._video.removeEventListener(`loadedmetadata`,this._boundUpdateColorSpace))}destroy(e){return e&&=this._error(e),this._video&&this._canvasParent&&this._video.parentNode?.removeChild(this._canvasParent),this._destroyed=!0,this._removeListeners(),this.sendMessage(`destroy`),this._worker?.terminate(),e}};function Aa(e){var t=e.toLowerCase().trim().split(/\s*;\s*/);return t[0]===`banner`?{name:t[0],delay:t[1]*1||0,leftToRight:t[2]*1||0,fadeAwayWidth:t[3]*1||0}:/^scroll\s/.test(t[0])?{name:t[0],y1:Math.min(t[1]*1,t[2]*1),y2:Math.max(t[1]*1,t[2]*1),delay:t[3]*1||0,fadeAwayHeight:t[4]*1||0}:e===``?null:{name:e}}function ja(e){return e?e.toLowerCase().replace(/([+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/g,` $1 `).replace(/([mnlbspc])/g,` $1 `).trim().replace(/\s+/g,` `).split(/\s(?=[mnlbspc])/).map(function(e){return e.split(` `).filter(function(e,t){return!(t&&isNaN(e*1))})}):[]}var Ma=`b.i.u.s.fsp.k.K.kf.ko.kt.fe.q.p.pbo.a.an.fscx.fscy.fax.fay.frx.fry.frz.fr.be.blur.bord.xbord.ybord.shad.xshad.yshad`.split(`.`).map(function(e){return{name:e,regex:RegExp(`^`+e+`-?\\d`)}});function Na(e){for(var t,n={},r=0;r<Ma.length;r++){var i=Ma[r],a=i.name;if(i.regex.test(e))return n[a]=e.slice(a.length)*1,n}if(/^fn/.test(e))n.fn=e.slice(2);else if(/^r/.test(e))n.r=e.slice(1);else if(/^fs[\d+-]/.test(e))n.fs=e.slice(2);else if(/^\d?c&?H?[0-9a-fA-F]+|^\d?c$/.test(e)){var o=e.match(/^(\d?)c&?H?(\w*)/),s=o[1],c=o[2];n[`c`+(s||1)]=c&&(`000000`+c).slice(-6)}else if(/^\da&?H?[0-9a-fA-F]+/.test(e)){var l=e.match(/^(\d)a&?H?([0-9a-f]+)/i),u=l[1],d=l[2];n[`a`+u]=(`00`+d).slice(-2)}else if(/^alpha&?H?[0-9a-fA-F]+/.test(e))t=e.match(/^alpha&?H?([0-9a-f]+)/i),n.alpha=t[1],n.alpha=(`00`+n.alpha).slice(-2);else if(/^(?:pos|org|move|fad|fade)\([^)]+/.test(e)){var f=e.match(/^(\w+)\((.*?)\)?$/),p=f[1];n[p]=f[2].trim().split(/\s*,\s*/).map(Number)}else if(/^i?clip\([^)]+/.test(e)){var m=e.match(/^i?clip\((.*?)\)?$/)[1].trim().split(/\s*,\s*/);n.clip={inverse:/iclip/.test(e),scale:1,drawing:null,dots:null},m.length===1&&(n.clip.drawing=ja(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=ja(m[1])),m.length===4&&(n.clip.dots=m.map(Number))}else if(/^t\(/.test(e)){var h=e.match(/^t\((.*?)\)?$/)[1].trim().replace(/\\.*/,function(e){return e.replace(/,/g,`
3
- `)}).split(/\s*,\s*/);if(!h[0])return n;n.t={t1:0,t2:0,accel:1,tags:h[h.length-1].replace(/\n/g,`,`).split(`\\`).slice(1).map(Na)},h.length===2&&(n.t.accel=h[0]*1),h.length===3&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1),h.length===4&&(n.t.t1=h[0]*1,n.t.t2=h[1]*1,n.t.accel=h[2]*1)}return n}function Pa(e){for(var t=[],n=0,r=``,i=e.split(`\\`).slice(1).concat(``).join(`\\`),a=0;a<i.length;a++){var o=i[a];o===`(`&&n++,o===`)`&&n--,n<0&&(n=0),!n&&o===`\\`?(r&&t.push(r),r=``):r+=o}return t.map(Na)}function Fa(e){var t=e.split(/{(.*?)}/),n=[];t[0].length&&n.push({tags:[],text:t[0],drawing:[]});for(var r=1;r<t.length;r+=2){var i=Pa(t[r]),a=i.reduce(function(e,t){return t.p===void 0?e:!!t.p},!1);n.push({tags:i,text:a?``:t[r+1],drawing:a?ja(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function Ia(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function La(e,t){var n=e.split(`,`);if(n.length>t.length){var r=n.slice(t.length-1).join();n=n.slice(0,t.length-1),n.push(r)}for(var i={},a=0;a<n.length;a++){var o=t[a],s=n[a].trim();switch(o){case`Layer`:case`MarginL`:case`MarginR`:case`MarginV`:i[o]=s*1;break;case`Start`:case`End`:i[o]=Ia(s);break;case`Effect`:i[o]=Aa(s);break;case`Text`:i[o]=Fa(s);break;default:i[o]=s}}return i}var Ra=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],za=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function Ba(e){var t=Ra.concat(za);return e.match(/Format\s*:\s*(.*)/i)[1].split(/\s*,\s*/).map(function(e){return t.find(function(t){return t.toLowerCase()===e.toLowerCase()})||e})}function Va(e,t){var n=e.match(/Style\s*:\s*(.*)/i)[1].split(/\s*,\s*/);return Object.assign.apply(Object,[{}].concat(t.map(function(e,t){var r={};return r[e]=n[t],r})))}function Ha(e){for(var t={info:{},styles:{format:[],style:[]},events:{format:[],comment:[],dialogue:[]}},n=e.split(/\r?\n/),r=0,i=0;i<n.length;i++){var a=n[i].trim();if(!/^;/.test(a)&&(/^\[Script Info\]/i.test(a)?r=1:/^\[V4\+? Styles\]/i.test(a)?r=2:/^\[Events\]/i.test(a)?r=3:/^\[.*\]/.test(a)&&(r=0),r!==0)){if(r===1&&/:/.test(a)){var o=a.match(/(.*?)\s*:\s*(.*)/),s=o[1],c=o[2];t.info[s]=c}if(r===2&&(/^Format\s*:/i.test(a)&&(t.styles.format=Ba(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(Va(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=Ba(a)),/^(?:Comment|Dialogue)\s*:/i.test(a))){var l=a.match(/^(\w+?)\s*:\s*(.*)/i),u=l[1],d=l[2];t.events[u.toLowerCase()].push(La(d,t.events.format))}}}return t}var Ua={M:`m`,L:`l`,C:`b`};function Wa(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[Ua[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var Ga=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},Ka=Ga(`c`),qa=Ga(`a`),Ja={c1:Ka(1),c2:Ka(2),c3:Ka(3),c4:Ka(4),a1:qa(1),a2:qa(2),a3:qa(3),a4:qa(4),pos:function(e){return`pos(`+[e.x,e.y]+`)`},org:function(e){return`org(`+[e.x,e.y]+`)`},move:function(e){return`move(`+[e.x1,e.y1,e.x2,e.y2,e.t1,e.t2]+`)`},fade:function(e){return e.type===`fad`?`fad(`+[e.t1,e.t2]+`)`:`fade(`+[e.a1,e.a2,e.a3,e.t1,e.t2,e.t3,e.t4]+`)`},clip:function(e){return(e.inverse?`i`:``)+`clip(`+(e.dots?``+[e.dots.x1,e.dots.y1,e.dots.x2,e.dots.y2]:(e.scale===1?``:e.scale+`,`)+Wa(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,Ya(e.tag)]+`)`}).join(`\\`)}};function Ya(e){return Object.keys(e).map(function(t){return`\\`+(Ja[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var Xa=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),Za=e=>new Promise((t,n)=>{let r=()=>{e.removeEventListener(`updateend`,i),e.removeEventListener(`abort`,i),e.removeEventListener(`error`,a)},i=()=>{r(),t()},a=e=>{r(),n(Error(`The browser rejected a media segment`,{cause:e}))};e.addEventListener(`updateend`,i,{once:!0}),e.addEventListener(`abort`,i,{once:!0}),e.addEventListener(`error`,a,{once:!0})}),Qa=(e,t)=>{let n=Promise.resolve(),r=e=>{let t=n.then(e,e);return n=t.catch(()=>{}),t};return{appendBuffer:t=>r(()=>(e.appendBuffer(t),Za(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),Za(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},$a=(e,t)=>e.createEvent(t),eo=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),to=e=>new Date(e).toISOString().slice(11,22),no=1,ro=e=>new Map(Ha(e).styles.style.map((e,t)=>[e.Name,t+no])),io=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},ao=e=>{let t=e.content.match(/\r?\n\[Events\]\r?\nFormat: (.*)/)?.[0];return t?{type:`header`,streamIndex:e.streamIndex,content:e.content,eventsContent:t,styles:ro(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},oo=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${to(t.start)},${to(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=Ha(`${e.eventsContent}\r\n${a}`).events.dialogue[0];if(!o)throw Error(`dialogue event is undefined`);return{type:`dialogue`,streamIndex:t.streamIndex,index:i,assEvent:{...o,Style:io(e,o.Style),Effect:o.Effect??``,Text:o.Text.raw,Duration:(o.End-o.Start)*1e3,Start:o.Start*1e3,End:o.End*1e3,ReadOrder:i,_index:i}}},so=e=>{let{video:t,canvas:n,workerUrl:r}=e,i=eo(e.wasmUrl),a=eo(e.legacyWasmUrl),o=eo(e.defaultFontUrl),s,c=[],l=new Map,u=[],d=new Map,f,p=e.onStreams,m=setInterval(()=>{s?.setCurrentTime(t.paused,t.currentTime,t.playbackRate)},100),h=()=>s?.setRate(t.playbackRate),g=e=>{s=new ka({onDemandRender:!1,video:t,canvas:n,subContent:e.content,workerUrl:r,modernWasmUrl:i,...a?{wasmUrl:a}:{},fonts:c.map(([,e])=>e),availableFonts:{...Object.fromEntries(c),...o?{"liberation sans":o}:{}}}),t.removeEventListener(`ratechange`,s._boundSetRate),t.addEventListener(`ratechange`,h)};return{pushAttachments:e=>{c=[...c,...e.map(e=>[e.filename,new Uint8Array(e.data)])]},pushFragments:e=>{for(let t of e)if(t.type===`header`){if(l.has(t.streamIndex))continue;let e=ao(t);if(!e)continue;l.set(t.streamIndex,e),u.push({streamIndex:t.streamIndex,title:t.title,language:t.language}),p?.([...u]),f===void 0&&(f=t.streamIndex),s||g(e)}else{let e=l.get(t.streamIndex);if(!e)continue;let n=d.get(t.streamIndex);n||(n=new Map,d.set(t.streamIndex,n));let r=oo(e,t);if(n.has(r.index))continue;n.set(r.index,r),f===t.streamIndex&&s&&$a(s,r.assEvent)}},selectStream:e=>{let n=e??-1;if(n===f||!s)return;f=n,s.freeTrack();let r=l.get(n);if(r){s.setTrack(r.content);for(let e of d.get(n)?.values()??[])$a(s,e.assEvent);s.setCurrentTime(t.paused,t.currentTime,t.playbackRate)}},getStreams:()=>[...u],getSelectedStream:()=>f,setOnStreams:e=>{p=e},destroy:()=>{clearInterval(m),t.removeEventListener(`ratechange`,h),s?.destroy(),s=void 0}}},co=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},lo=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,uo=-20,fo=60,po=30,mo=-5,ho=20,go=5,_o=15e3,vo=1,yo=3,bo=12,xo=200,So=250,Co=25e5,wo=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},To=async e=>{let{videoElement:t,canvasElement:n,read:r,length:i,publicPath:a,libavWorkerUrl:o,jassubWorkerUrl:s,jassubWasmUrl:c,jassubLegacyWasmUrl:l,defaultFontUrl:u,bufferSize:d=Co,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await Ca({publicPath:a,workerUrl:o,workerOptions:{type:`module`},bufferSize:d,length:i,audioStreamIndex:f,read:r}),b=[],x=!1,S=()=>{if(!x){x=!0;for(let e of[...b].reverse())try{e()}catch{}}};b.push(()=>wo(y));try{let e=await y.init(),r=e.audioStreams??[],i=r.some(e=>e.streamIndex===f)?f:r[0]?.streamIndex??-1;v?.(r,i);let a=so({video:t,canvas:n,workerUrl:s,wasmUrl:c,legacyWasmUrl:l,defaultFontUrl:u,onStreams:_});if(b.push(()=>a.destroy()),e.attachments?.length&&a.pushAttachments(e.attachments),!e.info.output.videoMimeType)throw Error(`The video codec in this file could not be identified`);let o=[e.info.output.videoMimeType,e.info.output.audioMimeType].filter(Boolean).join(`,`),d=`video/mp4; codecs="${o}"`;if(!MediaSource.isTypeSupported(d))throw Error(`This browser cannot play the codecs in this file: ${o}`);let C=new MediaSource,w=URL.createObjectURL(C);b.push(()=>URL.revokeObjectURL(w)),t.src=w,b.push(()=>{try{t.pause()}catch{}t.removeAttribute(`src`),t.load()});let T=await new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(Error(`The MediaSource never opened`))},_o),i=()=>{clearTimeout(r),C.removeEventListener(`sourceopen`,a),C.removeEventListener(`sourceclose`,o),C.removeEventListener(`error`,o)},a=()=>{try{let n=C.addSourceBuffer(d);n.mode=`segments`;let r=e.info.input.duration;Number.isFinite(r)&&r>0&&(C.duration=r),i(),t(n)}catch(e){i(),n(e)}},o=()=>{i(),n(Error(`The MediaSource closed before a SourceBuffer could be created`))};C.addEventListener(`sourceopen`,a,{once:!0}),C.addEventListener(`sourceclose`,o,{once:!0}),C.addEventListener(`error`,o,{once:!0})}),{appendBuffer:E,unbufferRange:D,updateTimestampOffset:O,endOfStream:k}=Qa(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,j=!1,ee=0,M,N=()=>M??t.currentTime,P=!1,F=0,I=0,L=null,R=0,te=0,ne=!1,re=0,ie=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),(!ne||n)&&(ne=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},ae=async(e=!1)=>{if(ee>0&&!e)return;let n=t.currentTime,r=e?mo:uo,i=e?ho:fo;for(let{start:e,end:t}of Xa(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},z=()=>{let e=Xa(T);if(!e.length)return!0;let t=N(),n=e.find(e=>e.start<=t+vo&&t<e.end);return n&&n.end>=t+fo?!1:!n||n.end<t+po},oe=()=>{let e=t.currentTime;return Xa(T).find(t=>t.start<=e+vo&&e<t.end)},se=()=>{let e=oe();return!!e&&e.end>=te-.1},ce=()=>{let e=Xa(T).map(e=>e.end);e.length&&(te=Math.max(te,...e))},le=async e=>{j=!0,L=null,R=0,re=e;let t=++I;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==I||(o&&(P=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==I))return;n.byteLength&&(await E(n),ce())}catch(e){ie(e,x||t!==I)}finally{t===I&&(j=!1)}},ue=async()=>{let e=L;if(e)try{await E(e),ce(),L===e&&(L=null,R=0)}catch(n){if(L!==e)return;if(n?.name===`QuotaExceededError`){let n=await ae(!0).then(()=>!0,()=>!1);if(L!==e)return;if(n){P=!1,await le(oe()?.end??t.currentTime);return}}if(R+=1,R<go)return;throw L=null,n}},de=async()=>{if(A||j||ve!==void 0||x||!L&&(P||!z()))return;let e=++F,t=I,n=()=>x||e!==F||t!==I;A=!0;try{if(!L){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(P=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;L=e,R=0}await ue(),!n()&&ne&&(ne=!1,h?.())}catch(e){ie(e,n())}finally{e===F&&(A=!1)}},fe=e=>e>=re&&!!oe(),pe=e=>Xa(T).some(t=>t.start<=e+vo&&e<t.end),me=e=>{let t=Xa(T).find(t=>t.start<=e+vo&&e<t.end);return t?t.end-e:0},he=async e=>{if(!x&&!(me(e)>=yo)){P=!1,ee++,M=e;try{pe(e)||await le(e);let t=I;for(let n=0;n<bo&&!(x||t!==I||P||me(e)>=yo);n++){let t=me(e);if(await de(),me(e)<=t)break}}finally{ee--,M===e&&(M=void 0)}}},ge=0,_e=null,B,V=e=>{let t=performance.now(),n=t-ge;if(n>=xo){ge=t,_e=null,g?.(e);return}_e=e,!B&&(B=setTimeout(()=>{B=void 0;let e=_e;_e=null,!(e===null||x)&&(ge=performance.now(),g?.(e))},xo-n))};b.push(()=>{B&&clearTimeout(B)});let H=0,ve;b.push(()=>{ve&&clearTimeout(ve)});let ye=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&V(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-H<So;if(H=i,!fe(n)&&!(j&&Math.abs(n-re)<.001)){if(P=!1,ve&&clearTimeout(ve),!a){ve=void 0,le(n);return}ve=setTimeout(()=>{if(ve=void 0,x)return;let e=t.currentTime;fe(e)||(P=!1,le(e))},So)}};t.addEventListener(`seeking`,ye),b.push(()=>t.removeEventListener(`seeking`,ye));let U=!1,be=()=>{if(U)return;U=!0;let e=t.error;ie(new co(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,be),b.push(()=>t.removeEventListener(`error`,be));let xe=setInterval(()=>{U||t.error||(ae().catch(()=>{}),de().catch(e=>ie(e,!1)),P&&!L&&se()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(xe)),{destroy:S,prepareSeek:he,videoElement:t,selectSubtitleStream:e=>a.selectStream(e),indexes:e.indexes??[],duration:e.info.input.duration,videoMimeType:e.info.output.videoMimeType,audioMimeType:e.info.output.audioMimeType}}catch(e){throw S(),e}},Eo=5,Do=500,Oo=320,ko=1e6,Ao=3,jo=1e4,Mo=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=Oo}=e,s=await wa({publicPath:t,workerUrl:n,workerOptions:{type:`module`},length:r,read:i});try{let t=await s.init(),n=t.duration,i=Math.max(e.interval??Eo,n/Do),c=[];for(let[e,a]of t.indexes.entries()){let o=c.at(-1);o&&a.timestamp-o.timestamp<i||c.push({timestamp:a.timestamp,endTime:n,startByte:a.pos,endByte:Math.min((t.indexes[e+1]?.pos??r)+ko,r),done:!1,attempts:0})}for(let[e,t]of c.entries())t.endTime=c[e+1]?.timestamp??n;c.length>1&&c.at(-1).timestamp>n-i*2&&c.pop();let l=[],u=!1,d=Promise.resolve(),f=()=>{let e=[];for(let[t,n]of l.entries()){n.startTime-(e.at(-1)?.endTime??0)>.01&&e.push({url:``,startTime:e.at(-1)?.endTime??0,endTime:n.startTime}),e.push(n);let r=l[t+1];r&&r.startTime-n.endTime>.01&&e.push({url:``,startTime:n.endTime,endTime:r.startTime})}let t=e.at(-1)?.endTime??0;n-t>.01&&e.push({url:``,startTime:t,endTime:n}),a(e)},p=e=>{e.done=!0,d=d.then(async()=>{if(u)return;let t=await Promise.race([s.readKeyframe(e.timestamp),new Promise((e,t)=>setTimeout(()=>t(Error(`timed out`)),jo))]),n=await createImageBitmap(new Blob([t],{type:`image/png`})),r=new OffscreenCanvas(o,Math.max(1,Math.round(n.height*(o/n.width))));r.getContext(`2d`).drawImage(n,0,0,r.width,r.height),n.close();let i=await r.convertToBlob({type:`image/webp`,quality:.7});u||(l=[...l,{url:URL.createObjectURL(i),startTime:e.timestamp,endTime:e.endTime}].sort((e,t)=>e.startTime-t.startTime),f())}).catch(()=>{e.attempts+=1,e.done=e.attempts>=Ao})};return f(),{update:e=>{if(!u)for(let t of c)t.done||(!e||e.some(([e,n])=>e<=t.startByte&&t.endByte<=n))&&p(t)},destroy:()=>{u=!0;for(let e of l)URL.revokeObjectURL(e.url);l=[],wo(s)}}}catch(e){throw wo(s),e}},No=1280,Po=1920,Fo=250,Io=100,Lo=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Ro=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,zo=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Bo=()=>Lo()?Ro()?`window`:zo()?`burn-in`:null:null,Vo=e=>{let{video:t,canvas:n}=e,r=e.mode??Bo()??`window`,i=e.maxWidth??(r===`burn-in`?Po:No),a,o,s,c=!1,l=!1,u=!1,d=!1,f,p=()=>r===`burn-in`?!!a:!!a&&document.pictureInPictureElement===a.mirror,m=(e,r)=>{r.drawImage(t,0,0,e.width,e.height),n.width>0&&n.height>0&&r.drawImage(n,0,0,e.width,e.height)},h=()=>{a&&m(a.composite,a.context)},g=`requestVideoFrameCallback`in t,_=()=>{h(),v()},v=()=>{d||!a||(o=g?t.requestVideoFrameCallback(_):requestAnimationFrame(_))},y=()=>{o!==void 0&&(g?t.cancelVideoFrameCallback(o):cancelAnimationFrame(o)),s!==void 0&&clearInterval(s),o=void 0,s=void 0},b=()=>{`mediaSession`in navigator&&(navigator.mediaSession.playbackState=t.paused?`paused`:`playing`)},x=()=>{c||l||!t.paused||t.play().catch(()=>{})},S=()=>{c||l||(t.paused||t.pause(),r!==`burn-in`&&(c=!0,a?.mirror.play().catch(()=>{}).finally(()=>{c=!1})))},C=()=>{b(),a?.mirror.play().catch(()=>{})},w=()=>{b(),r===`burn-in`&&a?.mirror.pause()},T=()=>{if(r!==`burn-in`||!a||!t.paused||l)return;l=!0;let{mirror:e}=a;h(),e.play().then(()=>new Promise(e=>{setTimeout(e,Io)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},Io)})},E=[[`play`,()=>{t.play().catch(()=>{})}],[`pause`,()=>t.pause()]],D=e=>{if(`mediaSession`in navigator)for(let[t,n]of E)try{navigator.mediaSession.setActionHandler(t,e?n:null)}catch{}},O=()=>{if(y(),D(!1),t.removeEventListener(`play`,C),t.removeEventListener(`pause`,w),t.removeEventListener(`seeked`,T),!a){f?.();return}let{stream:e,mirror:n}=a;n.removeEventListener(`play`,x),n.removeEventListener(`pause`,S),n.removeEventListener(`leavepictureinpicture`,k);for(let t of e.getTracks())t.stop();n.remove(),a=void 0,f?.()},k=()=>O(),A=e=>{let r=t.style.opacity,i=n.style.display;e.style.cssText=`position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000;z-index:1`,t.style.opacity=`0`,n.style.display=`none`,f=()=>{f=void 0,t.style.opacity=r,n.style.display=i}},j=async()=>{let n=Math.min(t.videoWidth||i,i),o=Math.round(n*((t.videoHeight||9)/(t.videoWidth||16))),c=document.createElement(`canvas`);c.width=n,c.height=o;let l=c.getContext(`2d`);if(!l)throw Error(`the picture in picture composite has no 2d context`);let u=document.createElement(`video`);u.muted=!0,u.playsInline=!0,r===`burn-in`?A(u):u.style.cssText=`position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;left:-1px;top:-1px`,m(c,l);let f={composite:c,context:l,stream:c.captureStream(),mirror:u};if(a=f,u.srcObject=f.stream,(e.container??t.parentElement??document.body).appendChild(u),v(),s=setInterval(()=>{t.paused&&h()},Fo),u.play().catch(()=>{}),u.readyState===0&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(t,1e3);u.addEventListener(`loadedmetadata`,t,{once:!0})}),d||a!==f){u.remove();return}if(u.addEventListener(`play`,x),u.addEventListener(`pause`,S),u.addEventListener(`leavepictureinpicture`,k),t.addEventListener(`play`,C),t.addEventListener(`pause`,w),t.addEventListener(`seeked`,T),D(!0),b(),r===`burn-in`){t.paused&&u.pause(),e.onBurnedInChange?.(!0);return}await u.requestPictureInPicture()};return{toggle:async()=>{if(!(d||u)){u=!0;try{if(p()){if(r===`burn-in`){O(),e.onBurnedInChange?.(!1);return}await document.exitPictureInPicture().catch(()=>{});return}r!==`burn-in`&&document.pictureInPictureElement&&await document.exitPictureInPicture().catch(()=>{});try{await j()}catch(t){console.warn(`subtitle compositing for picture in picture failed`,t),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}finally{u=!1}}},mode:r,destroy:()=>{d=!0,r!==`burn-in`&&p()&&document.exitPictureInPicture().catch(()=>{}),O(),r===`burn-in`&&e.onBurnedInChange?.(!1)}}};function Ho(e){return typeof e==`string`}function Uo(e){return typeof e==`number`}function K(e){return typeof e==`function`}function Wo(e){return e===null}function q(e){return e===void 0}function Go(e){return typeof e==`object`&&!!e}function Ko(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function qo(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var Jo=Object.prototype.hasOwnProperty;function Yo(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Jo.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Xo=new Map,Zo=new Set;function Qo(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function $o(e){let t=e.indexOf(`-x-`),n=(t===-1?e:e.slice(0,t)).indexOf(`-u-`);return n===-1?e:e.slice(0,n)+(t===-1?``:e.slice(t))}function es(e){if(e[0]!==`zh`)return;let t=e.find(e=>e===`hant`||e===`hans`);return t===`hant`?`zh-tw`:t===`hans`?`zh-cn`:void 0}function ts(e){return $o(Qo(e))}function ns(e){let t=ts(e);if(!t)return[`en`];let n=t.split(`-`).filter(Boolean),r=[];for(let e=n.length;e>=1;e--)r.push(n.slice(0,e).join(`-`));let i=es(n),a=r.indexOf(`zh`);i&&a!==-1&&r.splice(a,0,i);let o=[],s=new Set;for(let e of r)s.has(e)||(s.add(e),o.push(e));return s.has(`en`)||o.push(`en`),o}function rs(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=Xo.get(r);i&&Object.assign(t,i)}return t}function is(e){return rs(ns(e))}function as(e){return Zo.add(e),()=>{Zo.delete(e)}}function os(e){return typeof e==`string`?e:e.text}function ss(e){return Go(e)&&`key`in e&&`text`in e}var cs=/\{([^{}]+)\}/g;function ls(e,t){return t?e.replace(cs,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function us(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):ls(os(e),t??n)}function ds(e,t){return(t,n)=>{let r=n,i=typeof t!=`string`,a=i?t.key:t,o=e[a],s=r?.default,c=r?{...r}:void 0;return c&&delete c.default,ls(o??(i?t.text:s)??String(a),c)}}r();var fs=N(null);N(void 0);function ps(){let t=e(fs),[n,r]=P(e=>e+1,0);m(()=>as(()=>r()),[]);let i=b(()=>ds(is(`en`),`en`),[n]);return t?t.translator:i}function ms(){return e(fs)?.locale??`en`}function hs(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function gs(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function _s(e,t,n){return new Promise((r,i)=>{let a=()=>{i(n?.signal?.reason??`Aborted`)};if(n?.signal?.aborted){a();return}n?.signal?.addEventListener(`abort`,a,{once:!0}),e.addEventListener(t,e=>{n?.signal?.removeEventListener(`abort`,a),r(e)},{...n,once:!0})})}function vs(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function ys(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var bs=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),xs=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function Ss(e){return e.matches(xs)}function Cs(e){let t=gs(e);return t instanceof Element&&Ss(t)}function ws(e){let t=gs(e);return t instanceof Element&&t.closest(bs)!==null}var Ts=new Set([` `,`Enter`]),Es=`button,a[href],[role="slider"],[role="button"]`;function Ds(e){if(!Ts.has(e.key))return!1;let t=gs(e);return t instanceof Element&&t.matches(Es)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Os(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var ks={sideOffset:0,boundaryOffset:0},As={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function js(e,t,n,r){let i=r.boundaryOffset??0;switch(n){case`top`:return e.top-t.top-i-r.sideOffset;case`bottom`:return t.bottom-e.bottom-i-r.sideOffset;case`left`:return e.left-t.left-i-r.sideOffset;case`right`:return t.right-e.right-i-r.sideOffset}}function Ms(e,t,n,r,i=ks){let a=r.side,o=As[a],s=a===`top`||a===`bottom`?t.height:t.width,c=js(e,n,a,i);return c>=s?a:js(e,n,o,i)>c?o:a}function Ns(e){try{e?.showPopover?.()}catch{}}function Ps(e){try{e?.hidePopover?.()}catch{}}function Fs(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Is(e,t){let n=t.trim();if(!n)return 0;let r=Number.parseFloat(n);if(!Number.isNaN(r)&&(/^-?\d*\.?\d+$/.test(n)||n.endsWith(`px`)))return r;let i=e.ownerDocument,a=i?.documentElement;if(!Number.isNaN(r)&&n.endsWith(`rem`))return r*(a&&Number.parseFloat(getComputedStyle(a).fontSize)||16);if(!Number.isNaN(r)&&n.endsWith(`em`))return r*(e instanceof HTMLElement&&Number.parseFloat(getComputedStyle(e).fontSize)||16);if(!i)return Number.isNaN(r)?0:r;let o=i.createElement(`div`);if(o.style.position=`absolute`,o.style.visibility=`hidden`,o.style.pointerEvents=`none`,o.style.inlineSize=n,!o.style.inlineSize)return 0;o.style.blockSize=`0`,o.style.padding=`0`,o.style.border=`0`,o.style.inset=`0`;let s=getComputedStyle(e);o.style.fontSize=s.fontSize;for(let e=0;e<s.length;e++){let t=s.item(e);t.startsWith(`--`)&&o.style.setProperty(t,s.getPropertyValue(t))}let c=i.body??i.documentElement;if(!c)return Number.isNaN(r)?0:r;if(c.appendChild(o),getComputedStyle(o).inlineSize===`auto`)return o.remove(),0;let l=o.getBoundingClientRect().width;return o.remove(),Number.isFinite(l)?l:Number.isNaN(r)?0:r}function Ls(e){return e.kind===`captions`||e.kind===`subtitles`}function Rs(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function zs(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Bs):[]}function Bs(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Vs(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Hs(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Fs(t)?t.host:n.parentNode}return!1}function Us(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function Ws(e){return Us()&&`webkitCurrentPlaybackTargetIsWireless`in e}r();function Gs(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function Ks(...e){let t=e.flat();return e=>{let n=t.map(t=>Gs(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():Gs(t[e],null)}}}}function qs(...e){return p(Ks(...e),[...e])}r();function Js(e,t,n,r=Yo){let i=o(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return c(e,a,a)}function Ys(e){return e}function Xs(...e){}function Zs(e,t,n){let r=n?.leading??!1,i=null,a,o=!1;function s(){i=setTimeout(()=>{i=null,o&&(o=!1,e(...a),s())},t)}let c=(...n)=>{if(a=n,r)i===null?(e(...a),s()):o=!0;else{if(i!==null)return;i=setTimeout(()=>{i=null,e(...a)},t)}};return c.cancel=()=>{i!==null&&(clearTimeout(i),i=null),o=!1},c}function Qs(e,t,n){return Js(t=>e.subscribe(t),()=>e.current,t??Ys,n)}var $s=()=>Xs;function ec(e,t,n){return Js(t?t=>e.subscribe(t):$s,t?()=>e.state:()=>e,t??Ys,n)}r();var tc=N(null),nc=()=>{},rc={state:{},subscribe:()=>nc};function ic({value:e,children:t}){return I(tc.Provider,{value:e,children:t})}function ac(){let t=e(tc);if(!t)throw Error(`usePlayerContext must be used within a Player Provider`);return t}function oc(e){let{store:t}=ac();return ec(t,e)}function sc(t){let n=e(tc),r=ec(n?.store??rc,n?t:void 0);return n?r:void 0}function cc(){let{media:e}=ac();return e}function lc(){let{container:e}=ac();return e}function uc(){return e(tc)?.container??null}function dc(){return e(tc)?.popupGroup}function fc(){return e(tc)?.setMedia}function pc(){return e(tc)?.setContainer}function mc(e){if(`any`in AbortSignal)return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted)return t.abort(n.reason),t.signal;n.addEventListener(`abort`,()=>t.abort(n.reason),{signal:t.signal})}return t.signal}var hc=class{#e=new AbortController;#t=new Map;get base(){return this.#e.signal}clear(){for(let e of this.#t.values())e.abort();this.#t.clear()}reset(){this.clear(),this.#e.abort(),this.#e=new AbortController}supersede(e){this.#t.get(e)?.abort();let t=new AbortController;return this.#t.set(e,t),mc([this.#e.signal,t.signal])}};function gc(...e){return{state:t=>{let n=e.map(e=>e.state(t));return Object.assign({},...n)},attach:t=>{for(let n of e)try{n.attach?.(t)}catch(e){t.reportError(e)}}}}var _c=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function vc(){throw new _c(`NO_TARGET`)}function yc(){throw new _c(`DESTROYED`)}var bc={target:vc,signals:new hc,get:vc,set:vc};function xc(e){let t=e.state(bc),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return qo(e,n)}:()=>void 0,{displayName:e.name})}function Sc(){return e=>e}var Cc=!1;function wc(){Cc||(Cc=!0,queueMicrotask(Ec))}var Tc=new Set;function Ec(){Cc=!1;for(let e of Tc)e.flush();Tc.clear()}var Dc=Object.prototype.hasOwnProperty,Oc=class{#e;#t=new Set;#n=!1;constructor(e){this.#e=Object.freeze({...e})}get current(){return this.#e}patch(e){let t={...this.#e},n=!1;for(let r in e){if(!Dc.call(e,r))continue;let i=e[r];Object.is(this.#e[r],i)||(t[r]=i,n=!0)}n&&(this.#e=Object.freeze(t),this.#r())}subscribe(e,t){let n=t?.signal;if(n?.aborted)return Xs;if(this.#t.add(e),!n)return()=>this.#t.delete(e);let r=()=>this.#t.delete(e);return n.addEventListener(`abort`,r,{once:!0}),()=>{n.removeEventListener(`abort`,r),this.#t.delete(e)}}flush(){if(this.#n){this.#n=!1;for(let e of this.#t)e()}}#r(){this.#n=!0,Tc.add(this),wc()}};function kc(e){return new Oc(e)}var Ac=Symbol.for(`@videojs/store`);function jc(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new hc,o;function s(){r&&yc(),n||vc()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=kc(c);let l={[Ac]:!0,get $state(){return o},get target(){return n},get destroyed(){return r},get state(){return o.current},attach:u,destroy:f,subscribe:p};for(let e of Object.keys(c))Object.defineProperty(l,e,{get:()=>o.current[e],enumerable:!0});try{t.onSetup?.({store:l,signal:i.signal})}catch(e){m(e)}return l;function u(i){r&&yc(),a.reset(),n=i;let s={target:i,signal:a.base,get:()=>o.current,set:e=>o.patch(e),reportError:m,store:{get state(){return o.current},subscribe:p}};try{e.attach?.(s)}catch(e){m(e)}try{t.onAttach?.({store:l,target:i,signal:a.base})}catch(e){m(e)}return d}function d(){Wo(n)||(a.reset(),n=null,o.patch(c))}function f(){r||(r=!0,d(),i.abort())}function p(e,t){return o.subscribe(e,t)}function m(e){t.onError?t.onError({store:l,error:e}):console.error(`[vjs-store]`,e)}}}var Mc=Sc();function Nc(e,t){if(arguments.length===1)return Mc(e);let{name:n,state:r,attach:i}=e,a=e=>Mc({...q(n)?{}:{name:n},state:t=>r(t,e),...i?{attach:t=>i(t,e)}:{}}),o=a(t),s=(e=>q(e)?o:a(e));return s.state=o.state,o.attach&&(s.attach=o.attach),q(n)||Object.defineProperty(s,"name",{value:n}),s}var Pc=Object.freeze({length:0,start:()=>0,end:()=>0}),Fc=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Ic=new EventTarget;Object.freeze({});var Lc=class e extends Error{static MEDIA_ERR_ABORTED=1;static MEDIA_ERR_NETWORK=2;static MEDIA_ERR_DECODE=3;static MEDIA_ERR_SRC_NOT_SUPPORTED=4;static MEDIA_ERR_ENCRYPTED=5;static MEDIA_ERR_CUSTOM=100;static defaultMessages={1:`You stopped media playback before it finished.`,2:`This media could not be loaded due to a network or server issue.`,3:`This media could not be played. It may be corrupted, or your browser may not support its format.`,4:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`,5:`This media could not be played because it could not be decrypted.`};name;code;context;fatal;data;constructor(t,n=e.MEDIA_ERR_CUSTOM,r,i){super(t),this.name=`MediaError`,this.code=n,this.context=i,this.fatal=r??(n>=e.MEDIA_ERR_NETWORK&&n<=e.MEDIA_ERR_ENCRYPTED),this.message||=e.defaultMessages[this.code]??``}};function Rc(e){return e.readyState>=1}function zc(e){if(!Go(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Bc(e){if(!Go(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function Vc(e){if(!Go(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function Hc(e){if(!Go(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function Uc(e){return Go(e)?!q(e.playbackRate):!1}function Wc(e){if(!Go(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==Pc&&!q(t.seekable)&&t.seekable!==Pc}function Gc(e){return Go(e)?!q(e.error):!1}function Kc(e){if(!Go(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Fc}function qc(e){return Go(e)?!q(e.videoRenditions):!1}function Jc(e){return Go(e)?!q(e.audioTracks):!1}function Yc(e){if(!Go(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function Xc(e){if(!Go(e))return!1;let t=e;return Go(t.remote)&&t.remote!==Ic}function Zc(e){return Go(e)?!q(e.streamType):!1}function Qc(e){if(!Go(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function $c(e){return Go(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var el={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function tl(e,t){return e.id||String(t)}function nl(e){return{...e.id!==void 0&&{id:e.id},...e.kind!==void 0&&{kind:e.kind},label:e.label,language:e.language,enabled:e.enabled}}var rl=Nc({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Jc(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>tl(e,n)===t);if(i)for(let e of r)e.enabled=e===i}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>Jc(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map(nl):[]})},c=()=>{let e=o();if(e===i){s(e);return}a?.abort(),a=new AbortController,i=e,i&&(J(i,`addtrack`,()=>s(i),{signal:a.signal}),J(i,`removetrack`,()=>s(i),{signal:a.signal}),J(i,`change`,()=>s(i),{signal:a.signal})),s(i)};c(),J(r,`loadstart`,c,{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),il=Nc({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Wc(r))return;let i=()=>n({buffered:Vs(r.buffered),seekable:Vs(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function al(e,t,n){if(n.size===0)return null;let r=e-t.left,i=t.width;if(i===0)return null;let a=r/i;return n.size===2&&n.has(`left`)&&n.has(`right`)?a<.5?`left`:`right`:n.size===3?a<1/3?`left`:a<2/3?`center`:`right`:n.has(`left`)&&a<.5?`left`:n.has(`right`)&&a>=.5?`right`:n.has(`center`)&&(n.size===1||a>=1/3&&a<2/3)?`center`:null}var ol=250,sl=class{#e;#t=[];#n=new Set;#r=null;#i=new Set;constructor(e){this.#e=e}get bindings(){return this.#t}subscribe(e){return this.#i.add(e),()=>this.#i.delete(e)}claimsTap(e,t){return!ws(e)&&this.#t.some(n=>n.type===`tap`&&n.action===t&&(!n.pointer||n.pointer===e.pointerType))}add(e){let t={...e,onActivate:t=>{if(this.#i.size>0){let n={type:e.type,source:`gesture`,action:e.action,value:e.value,region:e.region,pointer:e.pointer,event:t};for(let e of this.#i)try{e(n)}catch{}}e.onActivate(t)}};this.#t.push(t),this.#n.add(t.recognizer),this.#a();let n=!1;return()=>{if(n)return;n=!0;let e=this.#t.indexOf(t);e!==-1&&this.#t.splice(e,1),this.#o()}}#a(){if(this.#r)return;this.#r=new AbortController;let{signal:e}=this.#r,t=0;J(this.#e,`pointerdown`,e=>{e.button===0&&(t=Date.now())},{signal:e}),J(this.#e,`pointerup`,e=>{if(e.button!==0||Date.now()-t>ol||ws(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>dl(a,e,n,r,i)};for(let t of this.#n)t.handleUp(o,e)},{signal:e})}#o(){if(!(this.#t.length>0)){for(let e of this.#n)e.reset();this.#n.clear(),this.#r?.abort(),this.#r=null}}},cl=new WeakMap;function ll(e){return cl.get(e)}function ul(e){let t=cl.get(e);return t||(t=new sl(e),cl.set(e,t)),t}function dl(e,t,n,r,i){let a=i.getBoundingClientRect(),o=fl(e,t,n),s=o.size>0?al(r,a,o):null,c=[];for(let r of e)if(!r.disabled&&r.type===t&&!(r.pointer&&r.pointer!==n)){if(r.region){if(r.region!==s)continue}else if(s!==null)continue;c.push(r)}return c}function fl(e,t,n){let r=new Set;for(let i of e)i.disabled||i.type===t&&(i.pointer&&i.pointer!==n||i.region&&r.add(i.region));return r}function pl(e){let t=e;if(Go(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function ml(e){return pl(e)?.state===`connected`}function hl(e){return pl(e)?.state===`connecting`}async function gl(e){let t=pl(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var _l=2e3,vl=250,yl=500,bl=Nc({name:`controls`,state:({get:e,set:t})=>({userActive:!0,controlsVisible:!0,toggleControls(){let n=!e().userActive;return t({userActive:n,controlsVisible:n}),n}}),attach({target:e,signal:t,get:n,set:r}){let{media:i,container:a}=e;if(!zc(i)||Wo(a))return;let o=e=>e||i.paused||ml(i)||hl(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,_l)}function u(){n().userActive||r({userActive:!0,controlsVisible:!0}),l()}function d(){c(),r({userActive:!1,controlsVisible:o(!1)})}r({toggleControls(){return n().controlsVisible?d():u(),n().controlsVisible}});let f=0,p=0,m=()=>p>0&&Date.now()-p<yl;function h(e){f=Date.now(),e.pointerType===`touch`&&(p=f)}function g(e){if(e.pointerType===`touch`&&(p=Date.now()),e.pointerType===`touch`&&Date.now()-f<vl){if(ll(a)?.claimsTap(e,`toggleControls`))return;let t=[i,a].includes(e.target);n().controlsVisible&&t?d():u()}else u()}let _=()=>{let{userActive:e}=n();r({controlsVisible:o(e)}),!i.paused&&e&&l()};function v(e){if(e.pointerType===`touch`){n().userActive&&l();return}u()}if(J(a,`pointermove`,v,{signal:t}),J(a,`pointerdown`,h,{signal:t}),J(a,`pointerup`,g,{signal:t}),J(a,`keyup`,u,{signal:t}),J(a,`focusin`,()=>{m()||u()},{signal:t}),J(a,`mouseleave`,()=>{m()||d()},{signal:t}),J(i,`play`,_,{signal:t}),J(i,`pause`,_,{signal:t}),J(i,`ended`,_,{signal:t}),Xc(i)){let e=()=>{let{userActive:e}=n();r({controlsVisible:o(e)})};J(i.remote,`connect`,e,{signal:t}),J(i.remote,`connecting`,e,{signal:t}),J(i.remote,`disconnect`,e,{signal:t})}t.addEventListener(`abort`,c,{once:!0}),l()}}),xl=Nc({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;Gc(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function Sl(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function Cl(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function wl(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Tl(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=Cl();return n&&(n===e||n===t)||wl(e)||wl(t)?!0:t.isFullscreen??!1}async function El(e,t){let n=document;if(e&&(n.fullscreenEnabled||n.webkitFullscreenEnabled)){let t=e;if(K(t.requestFullscreen))return t.requestFullscreen();if(K(t.webkitRequestFullscreen))return t.webkitRequestFullscreen()}let r=t;if(K(r.webkitSetPresentationMode)){r.webkitSetPresentationMode(`fullscreen`);return}let i=t;if(K(i.requestFullscreen))return i.requestFullscreen()}async function Dl(e){let t=document,n=e;if(n.webkitPresentationMode===`fullscreen`&&K(n.webkitSetPresentationMode)){n.webkitSetPresentationMode(`inline`);return}if(K(t.exitFullscreen))return t.exitFullscreen();if(K(t.webkitExitFullscreen))return t.webkitExitFullscreen();let r=e;if(K(r.exitFullscreen))return r.exitFullscreen()}function Ol(){if(document.pictureInPictureEnabled){let e=/.*Version\/.*Safari\/.*/.test(navigator.userAgent),t=typeof matchMedia==`function`&&matchMedia(`(display-mode: standalone)`).matches;return!e||!t}return K(document.createElement(`video`).webkitSetPresentationMode)}function kl(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Al(e){let t=e;if(K(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`picture-in-picture`);return}let n=e;if(K(n.requestPictureInPicture))return n.requestPictureInPicture()}async function jl(e){let t=e;if(t.webkitPresentationMode===`picture-in-picture`&&K(t.webkitSetPresentationMode)){t.webkitSetPresentationMode(`inline`);return}if(K(document.exitPictureInPicture))return document.exitPictureInPicture();let n=e;if(K(n.exitPictureInPicture))return n.exitPictureInPicture()}var Ml=Nc({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return kl(t)&&await jl(t),El(n,t)},async exitFullscreen(){let{media:t}=e();return Dl(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Tl(n,t)?Dl(t):(kl(t)&&await jl(t),El(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:Sl()?`available`:`unsupported`});let a=()=>n({fullscreen:Tl(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Nl=Nc({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Qc(r))return;let i=()=>n({liveEdgeStart:r.liveEdgeStart,targetLiveWindow:r.targetLiveWindow});i(),J(r,`targetlivewindowchange`,i,{signal:t}),J(r,`streamtypechange`,i,{signal:t}),J(r,`loadedmetadata`,i,{signal:t}),J(r,`canplay`,i,{signal:t}),J(r,`progress`,i,{signal:t}),J(r,`durationchange`,i,{signal:t}),J(r,`timeupdate`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}}),Pl=Nc({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Tl(n,t)&&await Dl(t),Al(t)},async exitPictureInPicture(){let{media:t}=e();return jl(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return kl(t)?jl(t):(Tl(n,t)&&await Dl(t),Al(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Ol()?`available`:`unsupported`});let i=()=>n({pip:kl(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Fl=Nc({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();zc(t)&&t.pause()},togglePaused(){let t=e().media;return zc(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!zc(r)||!Bc(r)||!Vc(r))return;let i=()=>n({paused:r.paused,ended:r.ended,started:!r.paused||r.currentTime>0,waiting:r.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&!r.paused});i(),J(r,`emptied`,i,{signal:t}),J(r,`play`,i,{signal:t}),J(r,`pause`,i,{signal:t}),J(r,`ended`,i,{signal:t}),J(r,`playing`,i,{signal:t}),J(r,`waiting`,i,{signal:t}),J(r,`seeked`,i,{signal:t})}}),Il=[.2,.5,.7,1,1.2,1.5,1.7,2],Ll=Nc({name:`playbackRate`,state:({target:e})=>({playbackRates:Il,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Uc(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Uc(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Rl=`auto`;function zl(e,t){return e.id||String(t)}function Bl(e){return{...e.id!==void 0&&{id:e.id},...e.width!==void 0&&{width:e.width},...e.height!==void 0&&{height:e.height},...e.bitrate!==void 0&&{bitrate:e.bitrate},...e.frameRate!==void 0&&{frameRate:e.frameRate},...e.codec!==void 0&&{codec:e.codec},selected:e.selected}}function Vl(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var Hl=Nc({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!qc(n))return;if(t===Rl){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>zl(e,n)===t);r!==-1&&(n.videoRenditions.selectedIndex=r)}}),attach({target:e,signal:t,set:n}){let{media:r}=e,i=null,a=null,o=()=>qc(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Yc(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Vl({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Vl(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Bl):[],activeVideoRendition:t?Bl(t):null})},l=()=>{let e=o();if(e===i){c(e);return}a?.abort(),a=new AbortController,i=e,i&&(J(i,`addrendition`,()=>c(i),{signal:a.signal}),J(i,`removerendition`,()=>c(i),{signal:a.signal}),J(i,`change`,()=>c(i),{signal:a.signal}),J(i,`activechange`,()=>c(i),{signal:a.signal})),c(i)};l(),J(r,`loadstart`,l,{signal:t}),J(r,`resize`,()=>c(i),{signal:t}),t.addEventListener(`abort`,()=>a?.abort(),{once:!0})}}),Ul=Nc({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return ml(t)?gl(t):(Tl(n,t)&&await Dl(t),await gl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Xc(r))return;if(Ws(r)){let e=()=>{n({remotePlaybackState:r.webkitCurrentPlaybackTargetIsWireless?`connected`:`disconnected`})};J(r,`webkitplaybacktargetavailabilitychanged`,e=>{let{availability:t}=e;n({remotePlaybackAvailability:t===`available`?`available`:`unavailable`})},{signal:t}),J(r,`webkitcurrentplaybacktargetiswirelesschanged`,e,{signal:t}),e();return}let i=()=>n({remotePlaybackState:r.remote.state});i(),J(r.remote,`connect`,i,{signal:t}),J(r.remote,`connecting`,i,{signal:t}),J(r.remote,`disconnect`,i,{signal:t}),r.remote.watchAvailability(e=>{n({remotePlaybackAvailability:e?`available`:`unavailable`})}).catch(()=>{n({remotePlaybackAvailability:`unsupported`})}),t.addEventListener(`abort`,()=>{r.remote?.cancelWatchAvailability?.().catch(()=>{})})}}),Wl=Nc({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Vc(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Vc(r))return;let i=()=>n({source:r.currentSrc||r.src||null,canPlay:r.readyState>=HTMLMediaElement.HAVE_ENOUGH_DATA});i(),J(r,`canplay`,i,{signal:t}),J(r,`canplaythrough`,i,{signal:t}),J(r,`loadstart`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}}),Gl=Nc({name:`streamType`,state:()=>({streamType:el.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(Zc(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Bc(r))return;let i=()=>{let{duration:e}=r;return e===1/0?el.LIVE:Number.isFinite(e)&&e>0?el.ON_DEMAND:el.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),Wc(r)&&J(r,`progress`,a,{signal:t})}});function Kl(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var ql=Nc({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Kc(n))return!1;let r=zs(n,Ls);if(!r.length)return!1;let i=r.some(e=>e.mode===`showing`),a=t??!i;for(let e of r)e.mode=a?`showing`:`disabled`;return a},selectSubtitlesTrack(t){let{media:n}=e();if(!Kc(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Ls(e));if(!r.length)return;if(t===`off`){for(let{track:e}of r)e.mode=`disabled`;return}let i=r.find(({index:e,track:n})=>Kl(n,e)===t)?.track;if(i)for(let{track:e}of r)e.mode=e===i?`showing`:`disabled`}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Kc(r))return;let i=null,a=()=>{i?.abort(),i=new AbortController;let e=null,t=null,o=[],s=!1;for(let n=0;n<r.textTracks.length;n++){let i=r.textTracks[n];!e&&i.kind===`chapters`&&(e=i),!t&&i.kind===`metadata`&&i.label===`thumbnails`&&(t=i),o.push({id:Kl(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Ls(i)&&i.mode===`showing`&&(s=!0)}let c=e?.cues?Array.from(e.cues):[],l=t?.cues?Array.from(t.cues):[],u=null;t&&(u=Rs(r,t)?.src??null);let d=$c(r)&&r.querySelectorAll(`track`)||[],f=r instanceof HTMLElement&&r.shadowRoot?.querySelectorAll(`track`)||[];for(let e of[...d,...f])e.track?.cues?.length||J(e,`load`,a,{signal:i.signal});n({chaptersCues:c,thumbnailCues:l,thumbnailTrackSrc:u,textTrackList:o,subtitlesShowing:s})};a();let o=r.textTracks;o instanceof EventTarget&&(J(o,`addtrack`,a,{signal:t}),J(o,`removetrack`,a,{signal:t}),J(o,`change`,a,{signal:t})),J(r,`loadstart`,a,{signal:t}),t.addEventListener(`abort`,()=>i?.abort(),{once:!0})}}),Jl={seek:Symbol.for(`@videojs/seek`)},Yl=Nc({name:`time`,state:({target:e,signals:t,set:n})=>({currentTime:0,duration:0,seeking:!1,async seek(r){let{media:i}=e(),a=t.supersede(Jl.seek);if(!Bc(i)||!Vc(i))return 0;if(!Rc(i)&&!await _s(i,`loadedmetadata`,{signal:a}).catch(()=>!1))return i.currentTime;let o=Math.max(0,Math.min(r,i.duration||1/0));return n({currentTime:o,seeking:!0}),i.currentTime=o,await _s(i,`seeked`,{signal:a}).catch(Xs),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Bc(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Wc(i)){let{seekable:e}=i;return e.length>0?e.end(e.length-1):0}return Number.isFinite(e)?e:0},o=()=>n({currentTime:i.currentTime,duration:a(),seeking:i.seeking}),s=()=>{r().seeking||o()};o(),J(i,`timeupdate`,s,{signal:t}),J(i,`durationchange`,o,{signal:t}),J(i,`seeking`,o,{signal:t}),J(i,`seeked`,o,{signal:t}),J(i,`loadedmetadata`,o,{signal:t}),J(i,`emptied`,o,{signal:t}),J(i,`progress`,s,{signal:t})}}),Xl=.25,Zl=Nc({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!Hc(n))return 0;let r=Math.max(0,Math.min(1,t));return r>0&&n.muted&&(n.muted=!1),n.volume=r,n.volume},toggleMuted(){let{media:t}=e();return Hc(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=Xl)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Hc(r))return;n({volumeAvailability:Ql()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function Ql(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}xc(rl);var $l=xc(il),eu=xc(bl),tu=xc(xl),nu=xc(Ml);xc(Nl);var ru=xc(Pl),iu=xc(Fl),au=xc(Ll);xc(Hl),xc(Ul),xc(Wl),xc(Gl);var ou=xc(ql),su=xc(Yl),cu=xc(Zl),lu={seekStep({store:e,value:t}){if(q(t))return;let n=su(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=cu(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=au(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<0||i>=n.length-1?0:i+1;t.setPlaybackRate(n[a])},speedDown({store:e}){let t=au(e.state);if(!t)return;let{playbackRates:n,playbackRate:r}=t,i=n.indexOf(r),a=i<=0?n.length-1:i-1;t.setPlaybackRate(n[a])}},uu={seekStep:lu.seekStep,volumeStep:lu.volumeStep,speedUp:lu.speedUp,speedDown:lu.speedDown};function du(e){return uu[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var fu=200,pu=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<fu){this.#n(),this.#e=0,e.resolve(`doubletap`)[0]?.onActivate(t);return}this.#e=n,this.#n(),this.#t=setTimeout(()=>{this.#t=null,this.#e=0,e.resolve(`tap`)[0]?.onActivate(t)},fu);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},mu=new WeakMap;function hu(e){let t=mu.get(e);return t||(t=new pu,mu.set(e,t),t)}function gu(e,t,n){return ul(e).add({type:`tap`,recognizer:hu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function _u(e,t,n){return ul(e).add({type:`doubletap`,recognizer:hu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function vu(e){return e.startsWith(`toggle`)}var yu={togglePaused({store:e}){let t=iu(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){cu(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=nu(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){ou(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=ru(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:lu.seekStep,volumeStep:lu.volumeStep,speedUp:lu.speedUp,speedDown:lu.speedDown,seekToPercent({store:e,value:t,key:n}){let r=su(e.state);if(!r||r.duration<=0)return;let i;if(!q(t))i=t;else if(n>=`0`&&n<=`9`)i=Number(n)*10;else return;r.seek(i/100*r.duration)}};function bu(e){return yu[e]}var xu={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},Su={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},Cu=[`ctrl`,`shift`,`alt`,`meta`];function wu(e){return e.map(e=>{let t=[];for(let n of Cu)e.modifiers.has(n)&&t.push(xu[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Tu(e){let t=[];for(let n of Cu)e.modifiers.has(n)&&t.push(Su[n]);return t.push(Eu(e.originalKey)),t.join(`+`)}function Eu(e){return e.length===1?e.toUpperCase():e}var Du=class{#e;#t=[];#n=0;#r=null;#i=null;#a=new Set;#o=new Set;#s=!1;constructor(e){this.#e=e}subscribe(e){return this.#a.add(e),()=>this.#a.delete(e)}subscribeShortcutChanges(e){return this.#o.add(e),()=>this.#o.delete(e)}add(e){let t={parsed:ku(e.keys),options:e,id:this.#n++};this.#t.push(t),this.#c(),e.target===`document`?this.#u():this.#l(),this.#h();let n=!1;return()=>{if(n)return;n=!0;let e=this.#t.indexOf(t);e!==-1&&this.#t.splice(e,1),this.#d(),this.#h()}}getAriaKeys(e){return this.getShortcut(e).aria}getShortcut(e,t){let n=this.#p(e,t);if(!n.length)return{};let r=n.flatMap(e=>e.parsed),i=n[n.length-1];return{aria:wu(r),shortcut:this.#m(i)}}destroy(){this.#s||(this.#s=!0,this.#r?.abort(),this.#r=null,this.#i?.abort(),this.#i=null,this.#t=[],this.#h(),this.#a.clear(),this.#o.clear())}#c(){this.#t.sort((e,t)=>{let n=t.parsed[0].modifiers.size-e.parsed[0].modifiers.size;return n===0?e.id-t.id:n})}#l(){this.#r||(this.#r=new AbortController,J(this.#e,`keydown`,this.#f,{signal:this.#r.signal}))}#u(){this.#i||(this.#i=new AbortController,J(document,`keydown`,this.#f,{signal:this.#i.signal}))}#d(){let e=this.#t.some(e=>e.options.target!==`document`),t=this.#t.some(e=>e.options.target===`document`);e||(this.#r?.abort(),this.#r=null),t||(this.#i?.abort(),this.#i=null)}#f=e=>{if(e.key===`Unidentified`||Ds(e)||e.defaultPrevented)return;let t=Cs(e);for(let n of this.#t){let{options:r,parsed:i}=n;if(!r.disabled&&!(e.repeat&&r.repeatable===!1)&&r.target===`document`==(e.currentTarget===document)){for(let n of i)if(ju(n,e)&&!(t&&n.modifiers.size===0)){if(this.#a.size>0){let t={source:`hotkey`,action:r.action,value:r.value,event:e};for(let e of this.#a)try{e(t)}catch{}}e.preventDefault(),r.onActivate(e,n.originalKey);return}}}};#p(e,t){return this.#t.filter(n=>n.options.disabled||n.options.action!==e?!1:q(t)?!0:n.options.value===t).sort((e,t)=>e.id-t.id)}#m(e){return e.options.keys===`0-9`?e.options.keys:Tu(e.parsed[0])}#h(){for(let e of this.#o)e()}},Ou=new Set([`shift`,`ctrl`,`alt`,`meta`]);function ku(e){if(e===`0-9`)return Array.from({length:10},(e,t)=>({modifiers:new Set,key:String(t),originalKey:String(t)}));let t=e.split(`+`),n=t.pop(),r=new Set;for(let e of t){let t=e.toLowerCase();t===`mod`?r.add(Os()?`meta`:`ctrl`):Ou.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Au(e){return e.length===1&&!/[a-z]/i.test(e)}function ju(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Au(t.key),r=n?t.shiftKey&&e.modifiers.has(`shift`):t.shiftKey,i=n?t.altKey&&e.modifiers.has(`alt`):t.altKey;return r===e.modifiers.has(`shift`)&&t.ctrlKey===e.modifiers.has(`ctrl`)&&i===e.modifiers.has(`alt`)&&t.metaKey===e.modifiers.has(`meta`)}var Mu=new WeakMap;function Nu(e){let t=Mu.get(e);return t||(t=new Du(e),Mu.set(e,t)),t}function Pu(e,t){return Nu(e).add(t)}var Fu=[Fl,Ll,Hl,rl,Zl,Yl,Wl,il,Ml,Pl,Ul,bl,ql,xl];function Iu(e){let{transition:t}=e,n=t.state,r=new AbortController,i=null;function a(){if(r.signal.aborted)return null;let{active:e,status:i}=n.current;return e&&i!==`ending`?null:(i===`ending`&&t.cancel(),t.open())}function o(e){let{active:i,status:a}=n.current;return r.signal.aborted||!i||a===`ending`?null:t.close(e)}function s(){if(c(),typeof document>`u`)return;i=new AbortController;let{signal:t}=i;J(document,`keydown`,l,{signal:t}),e.onDocumentActive?.(t)}function c(){i?.abort(),i=null}function l(t){t.key===`Escape`&&(t.defaultPrevented||n.current.active&&(e.closeOnEscape?.()??!0)&&e.onEscapeDismiss(t))}let u=n.subscribe(()=>{n.current.active?s():c()});r.signal.addEventListener(`abort`,()=>{u(),t.destroy(),c()});function d(){r.signal.aborted||r.abort()}return{input:n,open:a,close:o,signal:r.signal,destroy:d}}function Lu(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Iu({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.stopPropagation(),c()}}),o=a.input;function s(){r=document.activeElement;let i=a.open();i&&(t(!0),requestAnimationFrame(()=>{!a.signal.aborted&&o.current.active&&n?.focus()}),i.then(()=>{!a.signal.aborted&&o.current.active&&e.onOpenChangeComplete?.(!0)}))}function c(){let i=a.close(n);i&&(t(!1),i.then(()=>{a.signal.aborted||(r&&=(r.focus(),null),e.onOpenChangeComplete?.(!1))}))}function l(){if(u(),!n)return;i=new AbortController;let{signal:e}=i;J(n,`click`,d,{signal:e})}function u(){i?.abort(),i=null}function d(e){e.target instanceof HTMLButtonElement&&c()}function f(e){n=e,l()}return a.signal.addEventListener(`abort`,()=>{u(),n=null,r=null}),{input:o,open:s,close:c,setElement:f,destroy:a.destroy}}function Ru(e){let{onActivate:t,isDisabled:n}=e;return{role:`button`,tabIndex:0,onClick(e){if(n()){e.preventDefault();return}t(e)},onPointerDown(e){n()&&e.preventDefault()},onMouseDown(e){n()&&e.preventDefault()},onKeyDown(e){if(e.target===e.currentTarget){if(n()){e.key!==`Tab`&&e.preventDefault();return}e.key===`Enter`?(e.preventDefault(),t(e)):e.key===` `&&e.preventDefault()}},onKeyUp(e){e.target===e.currentTarget&&(n()||e.key===` `&&t(e))}}}var zu=`group`;function Bu(e){let t=vs(e.ownerDocument);(!t||t===e.ownerDocument.body||!Hs(e,t))&&e.focus({preventScroll:!0})}var Vu={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function Hu(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function Uu(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Iu({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.preventDefault(),x(`escape`,e)},onDocumentActive(e){J(document,`pointerdown`,w,{capture:!0,signal:e})}}),u=l.input,d={close(e){x(e)}};function f(){a!==null&&(clearTimeout(a),a=null)}function p(){return globalThis.matchMedia?.(`(hover: hover)`)?.matches??!1}function m(){return p()?globalThis.matchMedia?.(`(pointer: fine)`)?.matches??!1:!1}function h(){return!e.openOnHover?.()||p()}function g(){s=!1,c!==null&&(clearTimeout(c),c=null)}function _(){s=!0,c!==null&&clearTimeout(c),c=setTimeout(g,500)}function v(){return s?(g(),!0):!1}function y(){return r?r.hasAttribute(`disabled`)?!0:r.getAttribute(`aria-disabled`)===`true`:!1}function b(n,r){let i=l.open();i&&(e.group?.()?.open(d),t(!0,r?{reason:n,event:r}:{reason:n}),i.then(()=>{!l.signal.aborted&&u.current.active&&e.onOpenChangeComplete?.(!0)}))}function x(n,r){let a=l.close(i);a&&(e.group?.()?.close(d),t(!1,r?{reason:n,event:r}:{reason:n}),a.then(()=>{l.signal.aborted||(Ps(i),e.onOpenChangeComplete?.(!1))}))}function S(e=`click`){b(e)}function C(e=`click`){x(e)}function w(e){if(!n()||!u.current.active)return;let t=e.composedPath();if(r&&t.includes(r)||i&&t.includes(i)){_();return}g(),x(`outside-click`,e)}l.signal.addEventListener(`abort`,()=>{e.group?.()?.close(d),f(),g(),o.clear(),r=null,i=null});let T={onClick(e){h()&&(y()||(u.current.active&&u.current.status!==`ending`?x(`click`,e):b(`click`,e)))},onPointerEnter(t){if(!e.openOnHover?.()||!p()||(f(),u.current.active))return;let n=e.delay?.()??300;a=setTimeout(()=>b(`hover`),n)},onPointerLeave(t){if(!e.openOnHover?.()||!p()||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onFocusIn(t){if(e.openOnHover?.()){if(!m())return;b(`focus`)}},onFocusOut(t){let n=t.relatedTarget;n&&(r?.contains(n)||i?.contains(n))||e.openOnHover?.()&&x(`blur`)}},E={onPointerEnter(t){e.openOnHover?.()&&f()},onPointerLeave(t){if(!e.openOnHover?.()||o.size>0||(f(),!u.current.active))return;let n=e.closeDelay?.()??0;a=setTimeout(()=>x(`hover`),n)},onGotPointerCapture(e){o.add(e.pointerId)},onLostPointerCapture(e){o.delete(e.pointerId)},onFocusOut(e){let t=e.relatedTarget;if(!(t&&(r?.contains(t)||i?.contains(t)))&&!v()){if(t!==null){x(`blur`);return}requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(!u.current.active||u.current.status===`ending`||u.current.status===`starting`)return;let e=document.activeElement;e&&(r?.contains(e)||i?.contains(e))||x(`blur`)})})}}};function D(e){r=e}function O(e){!e&&i&&u.current.active&&Ps(i),i=e,e&&u.current.active&&Ns(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Wu(e,t,n,r){let i=e+n,a=t+r;return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e,toJSON(){return{x:e,y:t,width:n,height:r,top:t,right:i,bottom:a,left:e}}}}function Gu(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return Wu(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Ku(e){let t=document.documentElement.getBoundingClientRect();return e?Gu(t,e.getBoundingClientRect()):t}function qu(e,t={}){if(!e)return null;if(!Ho(e))return e;if(e===`viewport`)return null;if(e===`container`)return t.container??null;try{return(t.root??document).querySelector(e)}catch{return null}}var Ju={sideOffset:`--media-popover-side-offset`,alignOffset:`--media-popover-align-offset`,boundaryOffset:`--media-popover-boundary-offset`,anchorWidth:`--media-popover-anchor-width`,anchorHeight:`--media-popover-anchor-height`,availableWidth:`--media-popover-available-width`,availableHeight:`--media-popover-available-height`};function Yu(e,t,n){return Math.max(t,Math.min(n,e))}function Xu(e,t,n){let r=Math.round((e-n)/t)*t+n,i=`${t}`.indexOf(`.`);return i===-1?r:Number(r.toFixed(`${t}`.length-i-1))}var Zu={sideOffset:0,alignOffset:0,boundaryOffset:0},Qu={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function $u(e){return`${Yu(e,0,1/0)}px`}function ed(e,t,n,r){let i=n-r;return i<t?t:Yu(e,t,i)}function td(e,t,n,r,i,a,o,s){let c=a===`start`?e+o:a===`end`?t+o:e+n/2+o,l=a===`start`?`0px`:a===`end`?`-100%`:`-50%`;return{base:`${c}px`,translate:`clamp(${r+s-c}px, ${l}, calc(${i-s-c}px - 100%))`}}function nd(e,t,n,r,i,a,o=Ju){if(ys())return{...rd(e,t,o,n,i,a),...n&&i?id(n,i,t,a,o):{}};if(n&&r){let e=a??Zu;return{position:`fixed`,margin:`0`,...ad(n,r,t,e,i),...i?id(n,i,t,e,o):{}}}return{}}function rd(e,t,n=Ju,r,i,a=Zu){let o=`var(${n.sideOffset}, 0px)`,s=`var(${n.alignOffset}, 0px)`,{side:c,align:l}=t,u=a.boundaryOffset??0,d={positionAnchor:`--${e}`,position:`fixed`,inset:`auto`,margin:`0`,justifySelf:`normal`,alignSelf:`normal`,marginInlineStart:`0`,marginBlockStart:`0`,translate:`none`},f=Qu[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=td(r.left,r.right,r.width,i.left,i.right,l,a.alignOffset,u);return d.left=e,d.translate=`${t} 0`,d}l===`start`?d.left=`calc(anchor(left) + ${s})`:l===`end`?d.right=`calc(anchor(right) + ${s})`:(d.justifySelf=`anchor-center`,d.marginInlineStart=s)}else{if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=td(r.top,r.bottom,r.height,i.top,i.bottom,l,a.alignOffset,u);return d.top=e,d.translate=`0 ${t}`,d}l===`start`?d.top=`calc(anchor(top) + ${s})`:l===`end`?d.bottom=`calc(anchor(bottom) + ${s})`:(d.alignSelf=`anchor-center`,d.marginBlockStart=s)}return d}function id(e,t,n,r=Zu,i=Ju){let a={},{side:o}=n,s=r.boundaryOffset??0,c=t.left+s,l=t.right-s,u=t.top+s,d=t.bottom-s;if(a[i.anchorWidth]=`${e.width}px`,a[i.anchorHeight]=`${e.height}px`,o===`top`||o===`bottom`){let t=o===`top`?e.top-u:d-e.bottom;a[i.availableHeight]=$u(t-r.sideOffset),a[i.availableWidth]=$u(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=$u(t-r.sideOffset),a[i.availableHeight]=$u(d-u)}return a}function ad(e,t,n,r={sideOffset:0,alignOffset:0},i){let{side:a,align:o}=n,{sideOffset:s,alignOffset:c}=r,l=0,u,d=0,f;if(a===`top`?u=`calc(100% - ${e.top}px + ${s}px)`:a===`bottom`?l=e.bottom+s:a===`left`?f=`calc(100% - ${e.left}px + ${s}px)`:d=e.right+s,a===`top`||a===`bottom`?d=o===`start`?e.left+c:o===`end`?e.right-t.width+c:e.left+(e.width-t.width)/2+c:l=o===`start`?e.top+c:o===`end`?e.bottom-t.height+c:e.top+(e.height-t.height)/2+c,i){let e=r.boundaryOffset??0;a===`top`||a===`bottom`?d=ed(d,i.left+e,i.right-e,t.width):l=ed(l,i.top+e,i.bottom-e,t.height)}return{top:a===`top`?`auto`:`${l}px`,bottom:u??`auto`,left:a===`left`?`auto`:`${d}px`,right:f??`auto`}}function od(e,t=Ju){let n=getComputedStyle(e);return{sideOffset:Is(e,n.getPropertyValue(t.sideOffset)),alignOffset:Is(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Is(e,n.getPropertyValue(t.boundaryOffset))}}function sd(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Wu(n.left,n.top,t===`left`||t===`right`?Math.max(r,e.scrollWidth):r,t===`top`||t===`bottom`?Math.max(i,e.scrollHeight):i)}function cd(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function ld(e,t,n,r){let i;return i=n===`vertical`?1-(e.clientY-t.top)/t.height:r?(t.right-e.clientX)/t.width:(e.clientX-t.left)/t.width,Number.isFinite(i)?Yu(i*100,0,100):0}function ud(e){let t=kc({pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1}),n=new AbortController,r=e.changeThrottle??0,i=!1,a=!1,o=null,s=null,c=0,l=!1,u=r>0?Zs(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(Wo(s))return;let t=s;s=null;try{e.getElement().releasePointerCapture(t)}catch{}}function p(){i?(l||e.onValueCommit?.(c),i=!1,t.patch({dragging:!1,pointing:!1}),e.onDragEnd?.()):t.patch({pointing:!1}),l=!1,m()}function m(){u?.cancel(),s=null,o=null}let h={onPointerDown(n){if(e.isDisabled())return;n.stopPropagation(),n.preventDefault();let r=e.getElement();o=r.getBoundingClientRect(),a=e.isRTL(),l=!1,f(),s=n.pointerId,r.setPointerCapture(n.pointerId);let u=ld(n,o,e.getOrientation(),a);i=!0,c=u,t.patch({pointing:!0,dragging:!0,pointerPercent:u,dragPercent:u}),e.onDragStart?.(),e.onValueChange?.(u),e.getThumbElement?.()?.focus({preventScroll:!0,focusVisible:!1})},onPointerMove(n){if(e.isDisabled())return;if(!Wo(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=ld(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=ld(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),Wo(s)))return;let n=ld(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){Wo(s)&&t.patch({pointing:!1})},onLostPointerCapture(){p()}},g={onKeyDown(n){if(e.isDisabled()){n.key!==`Tab`&&n.preventDefault();return}let r=e.getStepPercent(),i=e.getLargeStepPercent(),a=Xu(e.getPercent(),r,0),o=e.isRTL()?-1:1,s=n.shiftKey?i:r,c=null;switch(n.key){case`ArrowRight`:c=a+s*o;break;case`ArrowLeft`:c=a-s*o;break;case`ArrowUp`:c=a+s;break;case`ArrowDown`:c=a-s;break;case`PageUp`:c=a+i;break;case`PageDown`:c=a-i;break;case`Home`:c=0;break;case`End`:c=100}c!==null&&(n.preventDefault(),c=Yu(c,0,100),t.patch({pointerPercent:c,dragPercent:c}),e.onValueChange?.(c),e.onValueCommit?.(c))},onFocus(){t.patch({focused:!0})},onBlur(){t.patch({focused:!1})}};function _(t){if(!e.adjustPercent||t.thumbAlignment!==`edge`)return t;let n=e.getElement(),r=e.getThumbElement?.();if(!r)return t;let i=t.orientation===`horizontal`,a=i?r.offsetWidth:r.offsetHeight,o=i?n.offsetWidth:n.offsetHeight;return{...t,fillPercent:e.adjustPercent(t.fillPercent,a,o),pointerPercent:e.adjustPercent(t.pointerPercent,a,o)}}let v=null;return e.onResize&&(v=new ResizeObserver(()=>e.onResize()),v.observe(e.getElement())),{input:t,rootProps:h,rootStyle:{touchAction:`none`,userSelect:`none`},thumbProps:g,adjustForAlignment:_,destroy(){n.signal.aborted||(n.abort(),v?.disconnect(),f(),m())}}}var dd={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function fd(e){return{[dd.fill]:`${e.fillPercent.toFixed(3)}%`,[dd.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function pd(e){return{...fd(e),[dd.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function md(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${dd.pointer}) - ${n}px)`:`min(max(0px, calc(var(${dd.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var hd=class{findActiveThumbnail(e,t){if(e.length===0)return;let n=0,r=e.length-1,i;for(;n<=r;){let a=n+r>>>1,o=e[a];t>=o.startTime?(i=o,n=a+1):r=a-1}return i}parseConstraints(e){let t=parseFloat(e.minWidth),n=parseFloat(e.maxWidth),r=parseFloat(e.minHeight),i=parseFloat(e.maxHeight);return{minWidth:Number.isFinite(t)?t:0,maxWidth:Number.isFinite(n)?n:1/0,minHeight:Number.isFinite(r)?r:0,maxHeight:Number.isFinite(i)?i:1/0}}calculateScale(e,t,n){let{minWidth:r,maxWidth:i,minHeight:a,maxHeight:o}=n,s=Math.min(i/e,o/t),c=Math.max(r/e,a/t);return Number.isFinite(s)&&s<1?s:Number.isFinite(c)&&c>1?c:1}resize(e,t,n,r){let i=e.width??t,a=e.height??n;if(!i||!a)return;let o=this.calculateScale(i,a,r),s=e.coords?.x??0,c=e.coords?.y??0,l=o===1?0:1;return{scale:o,containerWidth:Math.max(0,Math.floor(i*o)-l*2),containerHeight:Math.max(0,Math.floor(a*o)-l*2),imageWidth:Math.ceil(t*o),imageHeight:Math.ceil(n*o),offsetX:Math.ceil(s*o)+l,offsetY:Math.ceil(c*o)+l}}getState(e,t,n){return{loading:e,error:t,hidden:!e&&!n}}getAttrs(e){return{role:`img`,"aria-hidden":`true`}}};function gd(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new hd,a=new AbortController,o=a.signal,s=!1,c=!1,l=0,u=0,d=``,f=!1,p=null;function m(){let e=n();e&&(l=e.naturalWidth,u=e.naturalHeight),s=!1,c=!1,r()}function h(){s=!1,c=!0,r()}function g(e){J(e,`load`,m,{signal:o}),J(e,`error`,h,{signal:o})}function _(){if(!f){let e=n();e&&(g(e),f=!0)}if(!p){let e=t();e&&(p=new ResizeObserver(r),p.observe(e))}}function v(e){_();let t=e??``;t!==d&&(d=t,t?(s=!0,c=!1):(s=!1,c=!1,l=0,u=0))}function y(){_();let e=n();e?.complete&&d&&(e.naturalWidth>0?(l=e.naturalWidth,u=e.naturalHeight,s=!1,c=!1):(s=!1,c=!0),r())}function b(){a.abort(),p?.disconnect(),p=null}return{get loading(){return s},get error(){return c},get naturalWidth(){return l},get naturalHeight(){return u},readConstraints(){let e=t();return e?i.parseConstraints(getComputedStyle(e)):{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0}},updateSrc:v,connect:y,destroy:b}}var _d={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function vd(e){let t={transition:e.transition,onOpenChange(t,n){let r=_d[n.reason];if(!r)return;let i=e.group?.();t?i?.notifyOpen():i?.notifyClose();let a=n.event?{reason:r,event:n.event}:{reason:r};e.onOpenChange(t,a)},closeOnEscape:()=>!0,closeOnOutsideClick:()=>!1,openOnHover:()=>!0,delay:()=>{let t=e.group?.();return t?.shouldSkipDelay()?0:e.delay?.()??t?.delay??600},closeDelay:()=>{let t=e.group?.();return e.closeDelay?.()??t?.closeDelay??0}};e.onOpenChangeComplete&&(t.onOpenChangeComplete=e.onOpenChangeComplete);let n=Uu(t),r=!1,{onClick:i,...a}=n.triggerProps,o={...a,onPointerDown(){r=!0},onPointerEnter(t){e.disabled?.()||t.pointerType!==`touch`&&a.onPointerEnter(t)},onFocusIn(t){if(!e.disabled?.()){if(r){r=!1;return}a.onFocusIn(t)}}},s={...n.popupProps,onPointerEnter(t){e.disableHoverablePopup?.()||n.popupProps.onPointerEnter(t)}};return{...n,triggerProps:o,popupProps:s,get triggerElement(){return n.triggerElement},open:()=>n.open(`hover`),close:(e=`hover`)=>n.close(e)}}function yd(){let e=kc({active:!1,status:`idle`}),t=!1,n=0,r=0;function i(i=null){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0;let a=e.current.active;return a&&e.patch({status:`idle`}),e.patch({active:!0,status:`starting`}),new Promise(o=>{n=requestAnimationFrame(()=>{n=0,a&&(xd(i),bd(i)),r=requestAnimationFrame(()=>{if(r=0,t||!e.current.active)return o();e.patch({status:`idle`}),o()})})})}function a(i){return cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.patch({status:`ending`}),new Promise(a=>{n=requestAnimationFrame(()=>{n=0,r=requestAnimationFrame(()=>{if(r=0,t)return a();Sd(i).finally(()=>{if(t||e.current.status!==`ending`)return a();e.patch({active:!1,status:`idle`}),a()})})})})}function o(){cancelAnimationFrame(n),cancelAnimationFrame(r),n=0,r=0,e.current.status!==`idle`&&e.patch({status:`idle`})}return{state:e,open:i,close:a,cancel:o,destroy(){t||(t=!0,o())}}}function bd(e){e&&e.offsetHeight}function xd(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function Sd(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(Xs,Xs)}function Cd(e){return{onWheel(t){if(e.isDisabled())return;let n=Math.sign(t.deltaY);if(n===0)return;t.preventDefault();let r=e.getStepPercent(),i=Yu(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function wd(e,t){if(!t)return!1;if(K(e.composedPath))return e.composedPath().includes(t);let n=e.target;return n instanceof Node&&t.contains(n)}function Td(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??Ed(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function Ed(e){return`data-${e.toLowerCase()}`}var Dd={key:`container.label`,text:`Media player`};r();var Od=u(function({children:e,tabIndex:t=0,role:n=zu,"aria-label":r,"aria-labelledby":i,...a},s){let c=pc(),l=ps(),u=o(null),d=qs(s,u);m(()=>(c?.(u.current),()=>c?.(null)),[c]);let f=e=>{a.onPointerUp?.(e);let t=u.current;t&&Bu(t)};return I(`div`,{ref:d,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":l(Dd)},...a,onPointerUp:f,children:e})});r();function Y(e){let t=o(e);return t.current=e,t}r();function kd(e,t,n){let r=o(null),i=Y(t),a=Y(n);m(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}r();function Ad(e){function t({children:t}){let[n,r]=h(()=>jc()(gc(...e.features))),[i]=h(()=>cd()),[a,o]=h(null),[s,c]=h(null);return kd(n),m(()=>{if(a){if(n.destroyed){r(jc()(gc(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),I(ic,{value:b(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=ac();return ec(t,e)}return{Provider:t,Container:Od,usePlayer:n,useMedia:cc}}function jd(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function Md(e,t){return jd(e)&&(typeof t==`function`||t===void 0)}function Nd(e,t){return t?e?n=>{t(n),e(n)}:t:e}function Pd(e,t){return t&&e?`${t} ${e}`:t||e}function Fd(e,t){return t?e?{...e,...t}:t:e}function Id(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=Pd(e.className,r):n===`style`?e.style=Fd(e.style,r):e[n]=Md(n,r)?Nd(e[n],r):r}return e}function Ld(...e){let t={};for(let n of e)t=Id(t,n);return t}r();function Rd(e,t){return K(e)?e(t):e}function zd(e,t){return K(e)?e(t):e}function Bd(e){let t=e;return t.ref??t.props?.ref}function X(e,t,n){let{className:r,style:i,render:a}=t,{state:o,ref:s,props:c,stateAttrMap:l}=n,u=Rd(r,o),p=zd(i,o),m=Ld(l?Td(o,l):{},...Array.isArray(c)?c:c?[c]:[]);if(u!==void 0&&(m.className=m.className?`${m.className} ${u}`:u),p!==void 0&&(m.style=m.style?{...m.style,...p}:p),K(a)){let e=Ks(s,m.ref);return a({...m,ref:e},o)}if(d(a)){let e=Bd(a),t=Ks(s,m.ref,e),n=Ld(m,a.props);return n.ref=t,f(a,n)}return m.ref=Ks(s,m.ref),E(e,m)}r();function Vd(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=p(e=>{},[t]);return{getButtonProps:p(e=>Ld(Ru({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}r();function Hd(e,t){let n=lc(),[r,i]=h({});return m(()=>{if(!n||!e){i({});return}let r=Nu(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}r(),N(null).Provider,N(null).Provider,N(null).Provider,N(null).Provider;var Ud=N(!1);Ud.Provider;function Wd(){return e(Ud)}N(null).Provider,r();var Gd=N(null),Kd=Gd.Provider;function qd(){let t=e(Gd);if(!t)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return t}function Jd(){return e(Gd)}r();function Yd(e,t){return e.getLabelParams?.(t)}function Xd(e){let{displayName:t,core:r,stateAttrMap:i,selector:a,action:o,hotkeyAction:s,hotkeyValue:c,tooltipLabel:l,isSupported:d}=e,f=new Set(Object.keys(r.defaultProps)),p=u(function(e,u){let{render:p,className:m,style:g,..._}=e,v={},y={};for(let e of Object.keys(_))f.has(e)?v[e]=_[e]:y[e]=_[e];let b=Jd(),x=Wd(),S=b?.setContent,C=oc(a),w=Hd(s,c?.(v)),T=ps(),[E]=h(()=>new r);f.has(`menuTrigger`)&&q(v.menuTrigger)&&(v.menuTrigger=x),E.setProps(v);let{getButtonProps:D,buttonRef:O}=Vd({displayName:t,onActivate:()=>{Promise.resolve(o(E,C)).catch(e=>{})},isDisabled:()=>!!v.disabled||!C});C&&E.setMedia(C);let k=C?E.getState():null,A=k?d?.(k)??!0:!1,j=k&&A?us(E.getLabel(k),T,Yd(E,k)):void 0,ee=k&&A?l?.(E,k)??j:void 0;if(n(()=>{if(S)return S(ee?{label:ee,shortcut:w.shortcut}:void 0),()=>S(void 0)},[S,ee,w.shortcut]),!C||!k||!A)return null;let M=E.getAttrs(k),N=M[`aria-label`],P={...M,...ss(N)?{"aria-label":us(N,T,Yd(E,k))}:void 0,"aria-keyshortcuts":w.aria};return X(`button`,{render:p,className:m,style:g},{state:k,stateAttrMap:i,ref:[u,O],props:[D(),P,y]})});return p.displayName=t,p}function Zd(e,t){return K(e)?e(t)||void 0:e||void 0}var Qd=class{static defaultProps={open:!1,defaultOpen:!1};setProps(e){}#e=null;#t=void 0;#n=void 0;setInput(e){this.#e=e}setTitleId(e){this.#t=e}setDescriptionId(e){this.#n=e}getState(){let e=this.#e;return{open:e.active,status:e.status,titleId:this.#t,descriptionId:this.#n,...Hu(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},$d={open:`data-open`,...Vu},ef=class e{static defaultProps={delay:500};state=kc({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=Ko(t,e.defaultProps)}destroy(){this.#n()}update(e){let t=e.waiting&&!e.paused;t&&!this.state.current.visible&&!this.#t?this.#t=setTimeout(()=>{this.#t=null,this.state.patch({visible:!0})},this.#e.delay):t||(this.#n(),this.state.patch({visible:!1}))}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}},tf={visible:`data-visible`},nf=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},rf={visible:`data-visible`,userActive:`data-user-active`},af=class extends Qd{setProps(){}},of=`common.`,sf={key:`${of}empty`,text:``},cf={key:`${of}ok`,text:`OK`},lf=`errors.`,uf={key:`${lf}aborted`,text:`You stopped media playback before it finished.`},df={key:`${lf}network`,text:`This media could not be loaded due to a network or server issue.`},ff={key:`${lf}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},pf={key:`${lf}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},mf={key:`${lf}encrypted`,text:`This media could not be played because it could not be decrypted.`},hf={key:`${lf}title`,text:`Something went wrong.`},gf={key:`${lf}unexpected`,text:`An unexpected error occurred.`},_f={[Lc.MEDIA_ERR_ABORTED]:uf,[Lc.MEDIA_ERR_NETWORK]:df,[Lc.MEDIA_ERR_DECODE]:ff,[Lc.MEDIA_ERR_SRC_NOT_SUPPORTED]:pf,[Lc.MEDIA_ERR_ENCRYPTED]:mf,[Lc.MEDIA_ERR_CUSTOM]:sf},vf={[Lc.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function yf(e){return e>=Lc.MEDIA_ERR_ABORTED&&e<=Lc.MEDIA_ERR_ENCRYPTED}function bf(){return hf}function xf(){return cf}function Sf(e,t){if(e){let t=_f[e.code],n=e.message?.trim();if(n){let r=Lc.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=vf[e.code];return t&&yf(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||gf}var Cf=`fullscreen.`,wf={key:`${Cf}enter`,text:`Enter fullscreen`},Tf={key:`${Cf}exit`,text:`Exit fullscreen`},Ef=class e{static defaultProps={label:``,disabled:!1};state=kc({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){return Zd(this.#e.label,e)||(e.fullscreen?Tf:wf)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.fullscreenAvailability;return this.state.patch({fullscreen:e.fullscreen,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.fullscreen?e.exitFullscreen():e.requestFullscreen()}},Df={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Of={key:`playback.rate`,text:`Playback rate {rate}`},kf=`volume.`,Af={key:`${kf}mutedValue`,text:`{percent}, muted`};`${kf}`;var jf={key:`${kf}label`,text:`Volume`};`${kf}`;var Mf=Intl.DurationFormat,Nf=new Map;function Pf(e,t){if(e===`digital`){let e=e=>String(e).padStart(2,`0`);return{format:n=>{let r=`${e(n.minutes??0)}:${e(n.seconds??0)}`;return t===`always`||n.hours!==void 0?`${n.hours??0}:${r}`:r}}}let n=[[`hours`,`hour`],[`minutes`,`minute`],[`seconds`,`second`]];return{format:e=>n.filter(([t])=>e[t]!==void 0).map(([t,n])=>{let r=e[t]??0;return`${r} ${n}${r===1?``:`s`}`}).join(`, `)}}function Ff(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function If(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function Lf(e,t=`long`,n){let r=`${Ff(e)}:${t}:${n??``}`,i=Nf.get(r);return i||(i=Mf?new Mf(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):Pf(t,n),Nf.set(r,i)),i}function Rf(e){return Uo(e)&&Number.isFinite(e)}function zf(e,t){if(!Rf(e))return`0:00`;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s=Rf(t??0)?Math.abs(t??0):0,c=Math.floor(s/3600),l=Math.floor(s/60%60),u=i>0||c>0,d=u||l>=10,f=u?{hours:i,minutes:a,seconds:o}:{minutes:a,seconds:o},p=Lf(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Bf(e){if(!Rf(e))return`PT0S`;let t=Math.abs(e),n=Math.floor(t/3600),r=Math.floor(t/60%60),i=Math.floor(t%60),a=`PT`;return n>0&&(a+=`${n}H`),r>0&&(a+=`${r}M`),(i>0||a===`PT`)&&(a+=`${i}S`),a}function Vf(e,t){if(!Rf(e))return``;let n=e<0,r=Math.floor(Math.abs(e)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=r%60,s={};i>0&&(s.hours=i),a>0&&(s.minutes=a),(o>0||i===0&&a===0)&&(s.seconds=o);let c=Lf(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):If(t?.locale)?`${c} remaining`:c}return c}var Hf=`buttons.`,Uf={key:`${Hf}play`,text:`Play`},Wf={key:`${Hf}pause`,text:`Pause`},Gf={key:`${Hf}replay`,text:`Replay`},Kf={key:`${Hf}mute`,text:`Mute`},qf={key:`${Hf}unmute`,text:`Unmute`},Jf=class e{static defaultProps={label:``,disabled:!1};state=kc({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){return Zd(this.#e.label,e)||(e.muted?qf:Kf)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({muted:e.muted||e.volume===0,volumeLevel:Yf(e)}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function Yf(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var Xf={muted:`data-muted`,volumeLevel:`data-volume-level`},Zf=`pip.`,Qf={key:`${Zf}enter`,text:`Enter picture-in-picture`},$f={key:`${Zf}exit`,text:`Exit picture-in-picture`},ep=class e{static defaultProps={label:``,disabled:!1};state=kc({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){return Zd(this.#e.label,e)||(e.pip?$f:Qf)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":e.disabled?`true`:void 0,hidden:e.hidden?``:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=e.pipAvailability;return this.state.patch({pip:e.pip,availability:t,disabled:this.#e.disabled||t!==`available`,hidden:t!==`available`}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(this.setMedia(e),!this.getState().disabled)return e.pip?e.exitPictureInPicture():e.requestPictureInPicture()}},tp={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},np=class e{static defaultProps={label:``,disabled:!1};state=kc({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){return Zd(this.#e.label,e)||(e.ended?Gf:e.paused?Uf:Wf)}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({paused:e.paused,ended:e.ended,started:e.started}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}async toggle(e){if(!this.#e.disabled){if(e.paused||e.ended)return e.play();e.pause()}}},rp={paused:`data-paused`,ended:`data-ended`,started:`data-started`},ip=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=kc({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){let t=Zd(this.#e.label,e);return t===void 0?Of:t}getLabelParams(e){if(Zd(this.#e.label,e)===void 0)return{rate:e.rate}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t;return this.state.patch({rate:e.playbackRate}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}cycle(e){if(this.#e.disabled||this.#e.menuTrigger)return;let{playbackRates:t,playbackRate:n}=e;if(t.length===0)return;let r=t.indexOf(n),i=r===-1?t.find(e=>e>n)??t[0]:t[(r+1)%t.length];e.setPlaybackRate(i)}},ap={rate:`data-rate`},op=class e{static defaultProps={side:`top`,align:`center`,modal:!1,closeOnEscape:!0,closeOnOutsideClick:!0,open:!1,defaultOpen:!1,openOnHover:!1,delay:300,closeDelay:0};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,modal:this.#e.modal,...Hu(e.status)}}getTriggerAttrs(e,t){return{"aria-expanded":e.open&&e.status!==`ending`?`true`:`false`,"aria-haspopup":`dialog`,"aria-controls":t}}getPopupAttrs(e){return{popover:`manual`,role:`dialog`,"aria-modal":e.modal===!0?`true`:void 0}}},sp={open:`data-open`,side:`data-side`,align:`data-align`,...Vu},cp=`seek.`,lp={key:`${cp}forward`,text:`Seek forward {seconds} seconds`},up={key:`${cp}backward`,text:`Seek backward {seconds} seconds`},dp=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=kc({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}getLabel(e){let t=Zd(this.#e.label,e);return t===void 0?e.direction===`backward`?up:lp:t}getLabelParams(e){if(Zd(this.#e.label,e)===void 0)return{seconds:Math.abs(this.#e.seconds)}}getAttrs(e){return{"aria-label":this.getLabel(e),"aria-disabled":this.#e.disabled?`true`:void 0}}setMedia(e){this.#t=e}getState(){let e=this.#t,t=this.#e.seconds<0?`backward`:`forward`;return this.state.patch({seeking:e.seeking,direction:t}),this.state.patch({label:os(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},fp={seeking:`data-seeking`,direction:`data-direction`},pp=class e{static defaultProps={label:``,step:1,largeStep:10,orientation:`horizontal`,disabled:!1,thumbAlignment:`center`,value:0,min:0,max:100};static defaultInput={pointerPercent:0,dragPercent:0,dragging:!1,pointing:!1,focused:!1};#e={...e.defaultProps};#t={...e.defaultInput};get props(){return this.#e}get input(){return this.#t}constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}setInput(e){this.#t=e}getSliderState(e){let{orientation:t,disabled:n,thumbAlignment:r}=this.#e,{pointerPercent:i,dragging:a,pointing:o,focused:s}=this.#t;return{value:e,fillPercent:this.percentFromValue(e),pointerPercent:i,dragging:a,pointing:o,interactive:a||o||s,orientation:t,disabled:n,thumbAlignment:r}}getLabel(e){return Zd(this.#e.label,e)||``}getAttrs(e){return{role:`slider`,tabIndex:e.disabled?-1:0,autoComplete:`off`,"aria-label":this.getLabel(e),"aria-valuemin":this.#e.min,"aria-valuemax":this.#e.max,"aria-valuenow":e.value,"aria-orientation":e.orientation,"aria-disabled":e.disabled?`true`:void 0}}valueFromPercent(e){let{min:t,max:n,step:r}=this.#e;return Xu(Yu(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Yu(t+e/100*(n-t),t,n)}percentFromValue(e){let{min:t,max:n}=this.#e;return n===t?0:(e-t)/(n-t)*100}getStepPercent(){let{step:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}getLargeStepPercent(){let{largeStep:e,min:t,max:n}=this.#e,r=n-t;return r>0?e/r*100:0}adjustPercentForAlignment(e,t,n){if(this.#e.thumbAlignment===`center`||n===0)return e;let r=t/n*100/2,i=r,a=100-r;return i+e/100*(a-i)}},mp={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},hp={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function gp(e,t){let n=e.trim().split(`#`),r=n[0]??``,i=n[1],a=t?new URL(r,t).href:r;if(!i)return{url:a};let o=i.indexOf(`=`);if(o===-1)return{url:a};let s=i.slice(0,o),c=i.slice(o+1).split(`,`).map(Number),l={};for(let e=0;e<s.length;e++){let t=s[e],n=c[e];t&&Uo(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Uo(l.w)&&(u.width=l.w),Uo(l.h)&&(u.height=l.h),Uo(l.x)&&Uo(l.y)&&(u.coords={x:l.x,y:l.y}),u}function _p(e,t){let n=[];for(let r of e){let e=gp(r.text,t),i={url:e.url,startTime:r.startTime,endTime:r.endTime};e.width&&(i.width=e.width),e.height&&(i.height=e.height),e.coords&&(i.coords=e.coords),n.push(i)}return n}var vp=`time.`,yp={key:`${vp}current`,text:`Current time`},bp={key:`${vp}duration`,text:`Duration`},xp={key:`${vp}remaining`,text:`Remaining`},Sp={key:`${vp}remainingSuffix`,text:`{duration} remaining`},Cp={key:`${vp}showElapsed`,text:`{duration}. Show elapsed time.`},wp={key:`${vp}showDuration`,text:`{duration}. Show duration.`},Tp={key:`${vp}showRemaining`,text:`{duration}. Show remaining time.`},Ep={key:`${vp}position`,text:`{current} of {duration}`},Dp={current:Cp,duration:wp,remaining:Tp},Op={current:yp,duration:bp,remaining:xp},kp=class e{static defaultProps={type:`current`,negativeSign:`-`,label:``,toggle:!1};#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}setMedia(e){this.#t=e}#n(){let e=this.#t,{type:t}=this.#e;switch(t){case`current`:return e.currentTime;case`duration`:return e.duration;case`remaining`:return e.currentTime-e.duration;default:return 0}}#r(){let e=this.#t,t=this.#n();return zf(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Vf(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Bf(Math.abs(e))}#o(e,t){return e===`current`?t===`remaining`?`current`:`remaining`:t===`duration`?`remaining`:`duration`}getLabel(e,t=this.#e.type){let n=Zd(this.#e.label,e);return n===void 0?this.#e.toggle?Dp[this.#o(t,e.type)]:Op[this.#e.type]:n}getLabelParams(e){return Zd(this.#e.label,e)===void 0&&this.#e.toggle?{duration:e.phrase}:void 0}getAttrs(e,t=this.#e.type){return{"aria-label":this.getLabel(e,t),role:this.#e.toggle?`button`:void 0,tabIndex:this.#e.toggle?0:void 0}}getState(){let e=this.#n();return{type:this.#e.type,seconds:e,negative:this.#e.type===`remaining`&&e<0,text:this.#r(),phrase:this.#i(),datetime:this.#a()}}},Ap={type:`data-type`},jp={key:`slider.seek`,text:`Seek`},Mp=class e extends pp{static defaultProps={...pp.defaultProps,label:``,changeThrottle:100,pauseOnDrag:!1};#e={...e.defaultProps};#t=null;#n;#r=!1;constructor(e){super(),e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps),super.setProps({...t,min:0})}setMedia(e){this.#t=e}setFormatLocale(e){this.#n=e}getState(){let{duration:e,currentTime:t,seeking:n,buffered:r}=this.#t;super.setProps({...this.#e,min:0,max:e});let i=super.getSliderState(t),a=r.length>0?r[r.length-1][1]:0,o=e>0?a/e*100:0;return{...i,currentTime:t,duration:e,seeking:n,bufferPercent:o}}getLabel(e){return super.getLabel(e)||jp}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Vf(e):Vf(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?Ep:this.getValueTextParams(e).current}getValueTextParams(e){let t=this.#a(this.#i(e));return Number.isFinite(e.duration)?{current:t,duration:this.#a(e.duration)}:{current:t}}startDrag(e){this.#r=!1,this.#e.pauseOnDrag&&e&&!e.paused&&(this.#r=!0,e.pause())}endDrag(e){this.#r&&e?.play().catch(()=>{}),this.#r=!1}getAttrs(e){let t=super.getAttrs(e),n=this.#i(e);return{...t,"aria-valuenow":n,"aria-valuetext":this.getValueText(e)}}},Np={...mp,seeking:`data-seeking`},Pp=class e{static defaultProps={side:`top`,align:`center`,open:!1,defaultOpen:!1,delay:600,closeDelay:0,disableHoverablePopup:!0,disabled:!1};#e={...e.defaultProps};constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}#t=null;setInput(e){this.#t=e}getState(){let e=this.#t;return{open:e.active,status:e.status,side:this.#e.side,align:this.#e.align,...Hu(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Fp={sideOffset:`--media-tooltip-side-offset`,alignOffset:`--media-tooltip-align-offset`,boundaryOffset:`--media-tooltip-boundary-offset`,anchorWidth:`--media-tooltip-anchor-width`,anchorHeight:`--media-tooltip-anchor-height`,availableWidth:`--media-tooltip-available-width`,availableHeight:`--media-tooltip-available-height`},Ip={open:`data-open`,side:`data-side`,align:`data-align`,...Vu},Lp=class e{static defaultProps={delay:600,closeDelay:0,timeout:400};#e={...e.defaultProps};#t=0;#n=!1;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Ko(t,e.defaultProps)}get delay(){return this.#e.delay}get closeDelay(){return this.#e.closeDelay}shouldSkipDelay(){return this.#n?!0:Date.now()-this.#t<this.#e.timeout}notifyOpen(){this.#n=!0}notifyClose(){this.#n=!1,this.#t=Date.now()}},Rp=new Map;function zp(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Bp(e){let t=zp(e),n=Rp.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Rp.set(t,n)}catch{return}return n}function Vp(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function Hp(e,t){let n=!Uo(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Bp(t)??Bp(void 0);if(e)return e.format(n)}catch{}return Vp(n)}var Up=class e extends pp{static defaultProps={...pp.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(Ko(t,e.defaultProps))}setMedia(e){this.#e=e}setFormatLocale(e){this.#t=e}getState(){let e=this.#e,{volume:t,muted:n}=e,r=n||t===0,{dragging:i,dragPercent:a}=this.input,o=t*100,s=i?this.valueFromPercent(a):o,c=super.getSliderState(s);return{...c,fillPercent:r?0:c.fillPercent,volume:t,muted:r,availability:e.volumeAvailability}}getWheelStepPercent(){let e=this.props,t=e.max-e.min;return t>0?e.wheelStep/t*100:0}getLabel(e){return super.getLabel(e)||jf}getValueText(e){return e.muted?Af:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:Hp(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Wp={...mp,availability:`data-availability`};r();var Gp=N(null),Kp=Gp.Provider;function qp(){let t=e(Gp);if(!t)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return t}var Jp=Object.defineProperty,Yp=(e,t)=>{let n={};for(var r in e)Jp(n,r,{get:e[r],enumerable:!0});return t||Jp(n,Symbol.toStringTag,{value:`Module`}),n};r();var Xp=u(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=qp(),c=p(()=>{r||o.close()},[o,r]);return X(`button`,{render:e,className:t,style:n},{state:s,ref:[a],props:[{type:`button`,disabled:r,onClick:c},i]})});r();function Zp(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=u(function(e,t){let{render:o,className:s,style:c,...l}=e,u=r(),d=a?.(u.state);return X(n,{render:o,className:s,style:c},{state:u.state,stateAttrMap:u.stateAttrMap,ref:t,props:[i,d,l].filter(Boolean)})});return o.displayName=t,o}var Qp=Zp({displayName:`AlertDialogDescription`,tag:`p`,useContext:qp,getProps:e=>({id:e.descriptionId})});r();var $p=u(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=qp(),l=qs(i,p(e=>{o.setElement(e)},[o]));return s.open?X(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:l,props:[{tabIndex:-1,...a.getAttrs(s)},r]}):null});r();var em=/[^a-zA-Z0-9_-]/g;function tm(e){let t=M().replace(em,``);return e?`${e}-${t}`:t}r();function nm({open:e,defaultOpen:t=Qd.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=h(()=>new Qd),o=e!==void 0,s=Y(n),c=Y(r),[l]=h(()=>{let e=Lu({transition:yd(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=tm(`alert-dialog-title`),d=tm(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),m(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),kd(l);let f=Qs(l.input);return a.setInput(f),I(Kp,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:$d},children:i})}var rm=Zp({displayName:`AlertDialogTitle`,tag:`h2`,useContext:qp,getProps:e=>({id:e.titleId})}),im=Yp({Close:()=>Xp,Description:()=>Qp,Popup:()=>$p,Root:()=>nm,Title:()=>rm});r();var am=u(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=oc(iu),[l]=h(()=>new ef);kd(l),l.setProps({delay:a}),s&&l.update(s);let u=c(e=>l.state.subscribe(e),()=>l.state.current,()=>l.state.current);return s?X(`div`,{render:n,className:r,style:i},{state:u,stateAttrMap:tf,ref:[t],props:[o]}):null});r();var om=N(null),sm=om.Provider;function cm(){let t=e(om);if(!t)throw Error(`Controls compound components must be used within a Controls.Root`);return t}function lm(){return e(om)}r();var um=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=cm(),l=o[`aria-label`]||o[`aria-labelledby`]?`group`:void 0;return X(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:c,ref:[t],props:[{role:l,children:a},o]})});r();var dm=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=oc(eu),[c]=h(()=>new nf);if(!s)return null;c.setMedia(s);let l=c.getState();return I(sm,{value:{state:l,stateAttrMap:rf},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:rf,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),fm=Yp({Group:()=>um,Root:()=>dm});r();var pm=N(null),mm=pm.Provider;function hm(){let t=e(pm);if(!t)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return t}r();var gm=u(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=ps(),{dialog:c,state:l,stateAttrMap:u}=qp(),d=p(()=>{r||c.close()},[c,r]),f=i??us(xf(),s);return X(`button`,{render:e,className:t,style:n},{state:l,stateAttrMap:u,ref:o,props:[{type:`button`,disabled:r,onClick:d,children:f},a]})});r();var _m=u(function({render:e,className:t,style:n,children:r,...i},a){let o=ps(),{state:s,stateAttrMap:c}=qp(),{lastError:l}=hm(),u=Sf(l),d=r??us(u,o);return X(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});r();function vm({children:e}){let[t]=h(()=>new af),n=oc(tu),r=o(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=h(()=>Lu({transition:yd(),onOpenChange:e=>{e||i.current?.dismissError()}})),s=tm(`error-dialog-title`),c=tm(`error-dialog-desc`);t.setTitleId(s),t.setDescriptionId(c),m(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),kd(a);let l=Qs(a.input);t.setInput(l);let u=t.getState();return n?I(mm,{value:{lastError:r.current},children:I(Kp,{value:{core:t,dialog:a,state:u,stateAttrMap:$d},children:e})}):null}r();var ym=u(function({render:e,className:t,style:n,children:r,...i},a){let o=ps(),{state:s,stateAttrMap:c}=qp(),l=r??us(bf(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),bm=Yp({Close:()=>gm,Description:()=>_m,Popup:()=>$p,Root:()=>vm,Title:()=>ym}),xm=Xd({displayName:`FullscreenButton`,core:Ef,stateAttrMap:Df,selector:nu,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});r();function Sm({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=oc(),s=lc();return m(()=>{if(!s||!e||!t||a)return;let c=du(t);if(!c)return;let l=e=>{c({store:o,value:n,event:e})},u={pointer:r,region:i,action:t,value:n};return e===`doubletap`?_u(s,l,u):gu(s,l,u)},[s,o,e,t,n,r,i,a]),null}var Cm=Sm;r();function wm(){let[,e]=P(e=>e+1,0);return e}r();function Tm(e){let t=Y(e),r=o(null),i=o(null),a=wm(),[s]=h(()=>ud({getElement:()=>r.current,getThumbElement:()=>i.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>r.current?hs(r.current):!1,isDisabled:()=>t.current.disabled??!1,getPercent:()=>t.current.getPercent(),getStepPercent:()=>t.current.getStepPercent(),getLargeStepPercent:()=>t.current.getLargeStepPercent(),changeThrottle:t.current.changeThrottle,adjustPercent:t.current.adjustPercent,onValueChange:e=>t.current.onValueChange?.(e),onValueCommit:e=>t.current.onValueCommit?.(e),onDragStart:()=>t.current.onDragStart?.(),onDragEnd:()=>t.current.onDragEnd?.()}));kd(s);let c=Qs(s.input),l=e.computeState(c);return n(()=>{l.thumbAlignment===`edge`&&r.current&&i.current&&a()},[l.thumbAlignment]),{state:l,cssVars:e.getCSSVars(s.adjustForAlignment(l)),rootRef:p(e=>{r.current=e},[]),thumbRef:p(e=>{i.current=e},[]),rootProps:s.rootProps,rootStyle:s.rootStyle,thumbProps:s.thumbProps}}r();function Em({keys:e,action:t,value:n,disabled:r,target:i}){let a=oc(),o=lc();return m(()=>{if(!o||!e||!t||r)return;let s=bu(t);if(s)return Pu(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!vu(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var Dm=Em;r();function Om(e){let t=e.side,[n,r]=h({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=b(()=>i===t?e:{...e,side:i},[i,e,t]),o=p(e=>r(n=>n.preferred===t&&n.side===e?n:{preferred:t,side:e}),[t]);return m(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var km=Xd({displayName:`MuteButton`,core:Jf,stateAttrMap:Xf,selector:cu,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Am=Xd({displayName:`PiPButton`,core:ep,stateAttrMap:tp,selector:ru,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),jm=Xd({displayName:`PlayButton`,core:np,stateAttrMap:rp,selector:iu,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),Mm=Xd({displayName:`PlaybackRateButton`,core:ip,stateAttrMap:ap,selector:au,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});r();var Nm=N(null),Pm=Nm.Provider;function Fm(){let t=e(Nm);if(!t)throw Error(`Popover compound components must be used within a Popover.Root`);return t}var Im=Zp({displayName:`PopoverArrow`,tag:`div`,useContext:Fm,staticProps:{"aria-hidden":`true`}});r();var Lm={position:`fixed`,inset:`auto`,margin:0},Rm=u(function({render:e,className:t,style:r,...i},a){let{core:s,popover:c,state:l,preferredSide:u,setPositionedSide:d,stateAttrMap:f,anchorName:m,popupId:g,boundary:_,container:v}=Fm(),y=o(null),x=qs(a,p(e=>{c.setPopupElement(e),e&&ys()&&e.style.setProperty(`position-anchor`,`--${m}`)},[c,m]),y),S=b(()=>({side:u,align:l.align}),[u,l.align]),C=b(()=>{if(!ys())return null;let{positionAnchor:e,...t}=nd(m,S);return t},[m,S]),[w,T]=h(null);n(()=>{if(!l.open){T(null);return}function e(){let e=c.triggerElement,t=y.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=qu(_,{container:v,root:r}),a=sd(t,S.side),o=Ku(i),s=od(t),l=Ms(n,a,o,S,s),{positionAnchor:u,...f}=nd(m,{...S,side:l},n,ys()?void 0:a,o,s);T(f),d(l)}e();let t=c.triggerElement,n=y.current,r=n?qu(_,{container:v,root:n.getRootNode()}):null,i=0;function a(t){t&&wd(t,y.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[l.open,m,S,c,_,v,d]);let E=w??C??Lm;if(!l.open)return null;let{onFocusOut:D,...O}=c.popupProps;return X(`div`,{render:e,className:t,style:r},{state:l,stateAttrMap:f,ref:x,props:[{id:g,style:E,...s.getPopupAttrs(l)},{...O,onBlur:D},i]})});r();function zm({open:e,defaultOpen:t=op.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=op.defaultProps.openOnHover,delay:a=op.defaultProps.delay,closeDelay:o=op.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=uc(),d=dc(),f=lm(),[p]=h(()=>new op(l));p.setProps(l);let g=!q(e),_=Y(n),v=Y(r),y=Y(l.closeOnEscape),b=Y(l.closeOnOutsideClick),x=Y(i),S=Y(a),C=Y(o),w=Y(d),[T]=h(()=>{let e=Uu({transition:yd(),onOpenChange:(e,t)=>{_.current?.(e,t)},onOpenChangeComplete:e=>{v.current?.(e)},closeOnEscape:()=>y.current??op.defaultProps.closeOnEscape,closeOnOutsideClick:()=>b.current??op.defaultProps.closeOnOutsideClick,openOnHover:()=>x.current,delay:()=>S.current,closeDelay:()=>C.current,group:()=>w.current});return!g&&t&&e.open(`click`),e}),E=tm(),D=tm(`popup`);m(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open(`click`):T.close(`click`))},[e,T]),m(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),kd(T);let O=Qs(T.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=Om(p.getState());return I(Pm,{value:{core:p,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:sp,anchorName:E,popupId:D,boundary:s,container:u},children:c})}r();var Bm=u(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=Fm(),d=p(e=>{o.setTriggerElement(e),e&&ys()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:m,...h}=o.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:[i,d],props:[{type:`button`,...a.getTriggerAttrs(s,u)},{...h,onFocus:f,onBlur:m},r]})}),Vm=Yp({Arrow:()=>Im,Popup:()=>Rm,Root:()=>zm,Trigger:()=>Bm}),Hm=Xd({displayName:`SeekButton`,core:dp,stateAttrMap:fp,selector:su,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:dp.defaultProps.seconds});r();var Um=u(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:s,crossOrigin:c,loading:l,fetchPriority:u,...d}=e,[f]=h(()=>new hd),p=o(null),m=o(null),g=sc(ou),[,_]=h(0),[v]=h(()=>gd({getContainer:()=>p.current,getImg:()=>m.current,onStateChange:()=>_(e=>e+1)}));kd(v,()=>v.connect());let y=b(()=>s&&s.length>0?s:g&&g.thumbnailCues.length>0?_p(g.thumbnailCues,g.thumbnailTrackSrc??void 0):[],[s,g]),x=b(()=>f.findActiveThumbnail(y,a),[f,y,a]);v.updateSrc(x?.url);let S=f.getState(v.loading,v.error,x),C={overflow:`hidden`},w;if(x&&v.naturalWidth&&v.naturalHeight){let e=v.readConstraints(),t=f.resize(x,v.naturalWidth,v.naturalHeight,e);t&&(C={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},w={width:t.imageWidth,height:t.imageHeight,maxWidth:`none`,transform:t.offsetX||t.offsetY?`translate(-${t.offsetX}px, -${t.offsetY}px)`:void 0})}return X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:hp,ref:[t,p],props:[f.getAttrs(S),{style:C},d,{children:I(`img`,{ref:m,alt:``,"aria-hidden":`true`,decoding:`async`,src:x?.url,crossOrigin:c===``||c===null?void 0:c,loading:l,style:w,fetchPriority:u})}]})});r();var Wm=N(null);function Gm({value:e,children:t}){return I(Wm.Provider,{value:e,children:t})}function Km(){let t=e(Wm);if(!t)throw Error(`Slider compound components must be used within a Slider.Root`);return t}var qm=Zp({displayName:`SliderBuffer`,tag:`div`,useContext:Km}),Jm=Zp({displayName:`SliderFill`,tag:`div`,useContext:Km});r();var Ym=u(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...s}=e,c=Km(),{state:l}=c,u=o(null),[d,f]=h(0);m(()=>{let e=u.current;if(!e)return;let t=new ResizeObserver(([e])=>{f(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let p=md(d,a);return X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:[t,u],props:[{style:p},s]})});r();var Xm=u(function(e,t){let{render:n,className:r,style:i,label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f,value:p=0,onValueChange:m,onValueCommit:g,onDragStart:_,onDragEnd:v,...y}=e,[b]=h(()=>new pp),x=ps();b.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f});let{state:S,cssVars:C,rootRef:w,thumbRef:T,rootProps:E,rootStyle:D,thumbProps:O}=Tm({computeState:e=>(b.setInput(e),b.getSliderState(p)),getPercent:()=>b.percentFromValue(p),getStepPercent:()=>b.getStepPercent(),getLargeStepPercent:()=>b.getLargeStepPercent(),orientation:u,disabled:d,adjustPercent:(e,t,n)=>b.adjustPercentForAlignment(e,t,n),getCSSVars:fd,onValueChange:e=>m?.(b.valueFromPercent(e)),onValueCommit:e=>g?.(b.valueFromPercent(e)),onDragStart:_,onDragEnd:v});return I(Gm,{value:{state:S,pointerValue:b.valueFromPercent(S.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:mp,getAttrs:e=>{let t=b.getAttrs(e);return{...t,"aria-label":us(t[`aria-label`],x)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:S,stateAttrMap:mp,ref:[t,w],props:[{style:{...C,...D}},E,y]})})});r();var Zm=u(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Km(),{state:s,thumbRef:c,thumbProps:l,getAttrs:u}=o,d=u(s);return X(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:o.stateAttrMap,ref:[t,c],props:[d,l,a]})});r();var Qm=u(function(e,t){let{pointerValue:n}=Km();return I(Um,{ref:t,...e,time:n})}),$m=Zp({displayName:`SliderTrack`,tag:`div`,useContext:Km});r();var eh=u(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=Km(),{state:l,pointerValue:u,formatValue:d}=c,f=a===`pointer`?u:l.value,p=o?o(f):d?d(f,a):String(Math.round(f));return X(`output`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:t,props:[{"aria-live":`off`,children:p},s]})}),th=Yp({Buffer:()=>qm,Fill:()=>Jm,Preview:()=>Ym,Root:()=>Xm,Thumb:()=>Zm,Thumbnail:()=>Qm,Track:()=>$m,Value:()=>eh});r();var nh=u(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return X(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{children:a},o]})});r();var rh=u(function(e,t){let{render:n,className:r,style:i,children:a=`/`,...o}=e;return X(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{"aria-hidden":`true`,children:a},o]})});r(),_();var ih=u(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=oc(su),d=ps(),f=ms(),[p]=h(()=>new kp),g=a??kp.defaultProps.type,[_,v]=h(g);if(m(()=>{v(g)},[g,c]),p.setProps({type:_,negativeSign:o,label:s,toggle:c}),!u)return null;p.setMedia(u);let y=p.getState(),b=p.getAttrs(y,g),x=p.getLabelParams(y)?{duration:y.type===`remaining`?us(Sp,d,{duration:Vf(Math.abs(y.seconds),{locale:f})}):Vf(Math.abs(y.seconds),{locale:f})}:void 0,S=y.negative?I(j,{children:[I(`span`,{"aria-hidden":`true`,children:o??kp.defaultProps.negativeSign}),y.text]}):y.text,C=()=>{v(e=>g===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},w=e=>{e.defaultPrevented||C()},T=e=>{!e.defaultPrevented&&Ds(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:y,stateAttrMap:Ap,ref:[t],props:[{dateTime:y.datetime,children:S,...b,"aria-label":us(b[`aria-label`],d,x),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),ah=Yp({Group:()=>nh,Separator:()=>rh,Value:()=>ih});r();var oh=()=>Promise.resolve(0),sh=u(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=Mp.defaultProps.changeThrottle,step:s=Mp.defaultProps.step,largeStep:c=Mp.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:g,..._}=e,v=oc(su),y=oc($l),b=oc(iu),x=ps(),S=ms(),[C]=h(()=>new Mp);C.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:g,changeThrottle:o}),C.setFormatLocale(S);let w=Y(v&&y?{...v,...y}:null),T=Y(b);m(()=>()=>C.endDrag(T.current),[C]);let E=v?.duration??0,{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:ee,thumbProps:M}=Tm({computeState:e=>(C.setInput(e),!v||!y?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:oh,buffered:[],seekable:[]}):C.setMedia({...v,...y}),C.getState()),getPercent:()=>E>0?(v?.currentTime??0)/E*100:0,getStepPercent:()=>C.getStepPercent(),getLargeStepPercent:()=>C.getLargeStepPercent(),orientation:l,disabled:u,changeThrottle:o,adjustPercent:(e,t,n)=>C.adjustPercentForAlignment(e,t,n),getCSSVars:pd,onValueCommit:e=>{let t=w.current;t&&t.seek(C.rawValueFromPercent(e))},onDragStart:()=>{C.startDrag(T.current),f?.()},onDragEnd:()=>{C.endDrag(T.current),p?.()}});return v?I(Gm,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Np,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":us(t[`aria-label`],x),"aria-valuetext":us(t[`aria-valuetext`],x,C.getValueTextParams(e))}},formatValue:e=>zf(e,E)},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Np,ref:[t,k],props:[{style:{...O,...ee}},j,_]})}):null}),ch=Yp({Buffer:()=>qm,Fill:()=>Jm,Preview:()=>Ym,Root:()=>sh,Thumb:()=>Zm,Track:()=>$m,Value:()=>eh}),lh=Zp({displayName:`TooltipArrow`,tag:`div`,useContext:qd,staticProps:{"aria-hidden":`true`}});r();var uh=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=qd(),l=r===void 0?c?.label??``:r;return X(`span`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]})});r();var dh=u(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=qd(),l=r??c?.shortcut??null;return l?X(`kbd`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]}):null});r(),_();var fh={position:`fixed`,inset:`auto`,margin:0},ph=u(function({render:e,className:t,style:r,children:i,...a},s){let{core:c,tooltip:l,state:u,preferredSide:d,setPositionedSide:f,stateAttrMap:m,anchorName:g,popupId:_,boundary:v,container:y}=qd(),x=o(null),S=qs(s,p(e=>{l.setPopupElement(e),e&&ys()&&e.style.setProperty(`position-anchor`,`--${g}`)},[l,g]),x),C=b(()=>({side:d,align:u.align}),[d,u.align]),w=b(()=>{if(!ys())return null;let{positionAnchor:e,...t}=nd(g,C,void 0,void 0,void 0,void 0,Fp);return t},[g,C]),[T,E]=h(null);n(()=>{if(!u.open){E(null);return}function e(){let e=l.triggerElement,t=x.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=qu(v,{container:y,root:r}),a=sd(t,C.side),o=Ku(i),s=od(t,Fp),c=Ms(n,a,o,C,s),{positionAnchor:u,...d}=nd(g,{...C,side:c},n,ys()?void 0:a,o,s,Fp);E(d),f(c)}e();let t=l.triggerElement,n=x.current,r=n?qu(v,{container:y,root:n.getRootNode()}):null,i=0;function a(t){t&&wd(t,x.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let o=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&o&&o.observe(t),n&&o&&o.observe(n),r&&o&&o.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),o?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[u.open,g,C,l,v,y,f]);let D=T??w??fh;if(!u.open)return null;let O=i===void 0?I(j,{children:[I(uh,{}),I(dh,{})]}):i,{onFocusOut:k,...A}=l.popupProps;return X(`div`,{render:e,className:t,style:r},{state:u,stateAttrMap:m,ref:S,props:[{id:_,style:D,...c.getPopupAttrs(u)},{children:O},{...A,onBlur:k},a]})});r();var mh=N(null),hh=mh.Provider;function gh(){return e(mh)?.group}r();function _h({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=h(()=>new Lp({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),I(hh,{value:{group:i},children:r})}r();function vh({open:e,defaultOpen:t=Pp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=Pp.defaultProps.delay,closeDelay:a=Pp.defaultProps.closeDelay,disableHoverablePopup:o=Pp.defaultProps.disableHoverablePopup,disabled:s=Pp.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=uc(),f=lm(),[p]=h(()=>new Pp(u));p.setProps(u);let g=!q(e),_=gh(),v=Y(n),y=Y(r),b=Y(i),x=Y(a),S=Y(o),C=Y(s),w=Y(_),[T]=h(()=>{let e=vd({transition:yd(),onOpenChange:(e,t)=>{v.current?.(e,t)},onOpenChangeComplete:e=>{y.current?.(e)},delay:()=>b.current,closeDelay:()=>x.current,disableHoverablePopup:()=>S.current,disabled:()=>C.current,group:()=>w.current});return!g&&t&&e.open(),e}),[E,D]=h(),O=tm(),k=tm(`tooltip`);m(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open():T.close())},[e,T]),m(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),kd(T);let A=Qs(T.input);p.setInput(A);let{state:j,preferredSide:ee,setPositionedSide:M}=Om(p.getState());return I(Kd,{value:{core:p,tooltip:T,state:j,preferredSide:ee,setPositionedSide:M,stateAttrMap:Ip,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}r();var yh=u(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=qd(),l=p(e=>{a.setTriggerElement(e),e&&ys()&&e.style.setProperty(`anchor-name`,`--${c}`)},[a,c]),{onFocusIn:u,onFocusOut:d,...f}=a.triggerProps;return X(`button`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:[i,l],props:[{type:`button`},{...f,onFocus:u,onBlur:d},r]})}),bh=Yp({Arrow:()=>lh,Label:()=>uh,Popup:()=>ph,Provider:()=>_h,Root:()=>vh,Shortcut:()=>dh,Trigger:()=>yh});r();var xh={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},Sh=u(function(e,t){let{render:n,className:r,style:i,label:a,orientation:s,step:c=Up.defaultProps.step,largeStep:l=Up.defaultProps.largeStep,wheelStep:u=Up.defaultProps.wheelStep,disabled:d,thumbAlignment:f,onDragStart:m,onDragEnd:g,..._}=e,v=oc(cu),y=ps(),b=ms(),[x]=h(()=>new Up);x.setProps({label:a,orientation:s,step:c,largeStep:l,wheelStep:u,disabled:d,thumbAlignment:f}),x.setFormatLocale(b);let S=Y(v),C=Y(d),w=()=>(S.current?.volume??0)*100,T=()=>x.getStepPercent(),E=e=>S.current?.setVolume(e/100),{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:ee,thumbProps:M}=Tm({computeState:e=>(x.setInput(e),x.setMedia(v??xh),x.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:s,disabled:d,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:fd,onValueChange:E,onValueCommit:E,onDragStart:m,onDragEnd:g}),[N]=h(()=>Cd({isDisabled:()=>!!C.current||!S.current,getPercent:()=>(S.current?.volume??0)*100,getStepPercent:()=>x.getWheelStepPercent(),onValueChange:e=>S.current?.setVolume(e/100)})),P=o(null),F=p(e=>{P.current?.(),P.current=null,e&&(P.current=J(e,`wheel`,N.onWheel,{passive:!1}))},[N]);return v?I(Gm,{value:{state:D,pointerValue:x.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:M,stateAttrMap:Wp,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":us(t[`aria-label`],y),"aria-valuetext":us(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Wp,ref:[t,k,F],props:[{style:{...O,...ee}},j,_]})}):null}),Ch=Yp({Fill:()=>Jm,Preview:()=>Ym,Root:()=>Sh,Thumb:()=>Zm,Track:()=>$m,Value:()=>eh}),wh=v(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Th=v(((e,t)=>{var n=wh();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Eh=v(((e,t)=>{t.exports=Th()()}));r();var Z=S(Eh());function Dh(){return Dh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Dh.apply(this,arguments)}function Oh(e,t){if(e==null)return{};var n=kh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ah=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Oh(e,[`color`,`size`]);return t.createElement(`svg`,Dh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z`}),t.createElement(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),t.createElement(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`}))});Ah.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Ah.displayName=`AlertTriangle`,r();function jh(){return jh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jh.apply(this,arguments)}function Mh(e,t){if(e==null)return{};var n=Nh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Ph=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Mh(e,[`color`,`size`]);return t.createElement(`svg`,jh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`20 6 9 17 4 12`}))});Ph.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Ph.displayName=`Check`,r();function Fh(){return Fh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fh.apply(this,arguments)}function Ih(e,t){if(e==null)return{};var n=Lh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Rh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Ih(e,[`color`,`size`]);return t.createElement(`svg`,Fh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`15 18 9 12 15 6`}))});Rh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Rh.displayName=`ChevronLeft`,r();function zh(){return zh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},zh.apply(this,arguments)}function Bh(e,t){if(e==null)return{};var n=Vh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Hh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Bh(e,[`color`,`size`]);return t.createElement(`svg`,zh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`9 18 15 12 9 6`}))});Hh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Hh.displayName=`ChevronRight`,r();function Uh(){return Uh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Uh.apply(this,arguments)}function Wh(e,t){if(e==null)return{};var n=Gh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Kh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Wh(e,[`color`,`size`]);return t.createElement(`svg`,Uh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),t.createElement(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`}))});Kh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Kh.displayName=`Copy`,r();function qh(){return qh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qh.apply(this,arguments)}function Jh(e,t){if(e==null)return{};var n=Yh(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yh(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Xh=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Jh(e,[`color`,`size`]);return t.createElement(`svg`,qh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3`}))});Xh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Xh.displayName=`Maximize`,r();function Zh(){return Zh=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Zh.apply(this,arguments)}function Qh(e,t){if(e==null)return{};var n=$h(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $h(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var eg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Qh(e,[`color`,`size`]);return t.createElement(`svg`,Zh({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3`}))});eg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},eg.displayName=`Minimize`,r();function tg(){return tg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},tg.apply(this,arguments)}function ng(e,t){if(e==null)return{};var n=rg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ig=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=ng(e,[`color`,`size`]);return t.createElement(`svg`,tg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),t.createElement(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`}))});ig.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},ig.displayName=`Pause`,r();function ag(){return ag=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ag.apply(this,arguments)}function og(e,t){if(e==null)return{};var n=sg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var cg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=og(e,[`color`,`size`]);return t.createElement(`svg`,ag({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`5 3 19 12 5 21 5 3`}))});cg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},cg.displayName=`Play`,r();function lg(){return lg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},lg.apply(this,arguments)}function ug(e,t){if(e==null)return{};var n=dg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var fg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=ug(e,[`color`,`size`]);return t.createElement(`svg`,lg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polyline`,{points:`1 4 1 10 7 10`}),t.createElement(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`}))});fg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},fg.displayName=`RotateCcw`,r();function pg(){return pg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},pg.apply(this,arguments)}function mg(e,t){if(e==null)return{};var n=hg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var gg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=mg(e,[`color`,`size`]);return t.createElement(`svg`,pg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`circle`,{cx:`12`,cy:`12`,r:`3`}),t.createElement(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`}))});gg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},gg.displayName=`Settings`,r();function _g(){return _g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_g.apply(this,arguments)}function vg(e,t){if(e==null)return{};var n=yg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var bg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=vg(e,[`color`,`size`]);return t.createElement(`svg`,_g({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}))});bg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},bg.displayName=`Volume1`,r();function xg(){return xg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},xg.apply(this,arguments)}function Sg(e,t){if(e==null)return{};var n=Cg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Cg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var wg=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Sg(e,[`color`,`size`]);return t.createElement(`svg`,xg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07`}))});wg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},wg.displayName=`Volume2`,r();function Tg(){return Tg=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Tg.apply(this,arguments)}function Eg(e,t){if(e==null)return{};var n=Dg(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Dg(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Og=u(function(e,n){var r=e.color,i=r===void 0?`currentColor`:r,a=e.size,o=a===void 0?24:a,s=Eg(e,[`color`,`size`]);return t.createElement(`svg`,Tg({ref:n,xmlns:`http://www.w3.org/2000/svg`,width:o,height:o,viewBox:`0 0 24 24`,fill:`none`,stroke:i,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},s),t.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),t.createElement(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),t.createElement(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`}))});Og.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Og.displayName=`VolumeX`;var kg=v(((e,t)=>{(function(){var e={}.hasOwnProperty;function n(){for(var e=``,t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=i(e,r(n)))}return e}function r(t){if(typeof t==`string`||typeof t==`number`)return t;if(typeof t!=`object`)return``;if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes(`[native code]`))return t.toString();var r=``;for(var a in t)e.call(t,a)&&t[a]&&(r=i(r,a));return r}function i(e,t){return t?e?e+` `+t:e+t:e}t!==void 0&&t.exports?(n.default=n,t.exports=n):typeof define==`function`&&typeof define.amd==`object`&&define.amd?define(`classnames`,[],function(){return n}):window.classNames=n})()}));ne(),r();var Ag=S(kg(),1),jg=`react-tooltip-core-styles`,Mg=`react-tooltip-base-styles`,Ng={core:!1,base:!1};function Pg({css:e,id:t=Mg,type:n=`base`,ref:r}){if(!e||typeof document>`u`||Ng[n]||n===`core`&&re!==void 0&&(re==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||n!==`base`&&re!==void 0&&(re==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;n===`core`&&(t=jg),r||={};let{insertAt:i}=r;if(document.getElementById(t))return;let a=document.head||document.getElementsByTagName(`head`)[0],o=document.createElement(`style`);o.id=t,o.type=`text/css`,i===`top`&&a.firstChild?a.insertBefore(o,a.firstChild):a.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e)),Ng[n]=!0}var Fg=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[C(Number(i)),w({fallbackAxisSideDirection:`start`}),g({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(x({element:n,padding:5})),k(e,t,{placement:r,strategy:a,middleware:l}).then((({x:e,y:t,placement:n,middlewareData:r})=>{let i={left:`${e}px`,top:`${t}px`,border:s},{x:a,y:o}=r.arrow??{x:0,y:0},l={top:`bottom`,right:`left`,bottom:`top`,left:`right`}[n.split(`-`)[0]]??`bottom`,u=s&&{borderBottom:s,borderRight:s},d=0;if(s){let e=`${s}`.match(/(\d+)px/);d=e?.[1]?Number(e[1]):1}return{tooltipStyles:i,tooltipArrowStyles:{left:a==null?``:`${a}px`,top:o==null?``:`${o}px`,right:``,bottom:``,...u,[l]:`-${c/2+d-1}px`},place:n}}))):k(e,t,{placement:`bottom`,strategy:a,middleware:l}).then((({x:e,y:t,placement:n})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{},place:n})))},Ig=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),Lg=(e,t,n)=>{let r=null,i=function(...i){let a=()=>{r=null,n||e.apply(this,i)};n&&!r&&(e.apply(this,i),r=setTimeout(a,t)),n||(r&&clearTimeout(r),r=setTimeout(a,t))};return i.cancel=()=>{r&&=(clearTimeout(r),null)},i},Rg=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,zg=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>zg(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Rg(e)||!Rg(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>zg(e[n],t[n])))},Bg=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;let t=getComputedStyle(e);return[`overflow`,`overflow-x`,`overflow-y`].some((e=>{let n=t.getPropertyValue(e);return n===`auto`||n===`scroll`}))},Vg=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Bg(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Hg=typeof window<`u`?n:m,Ug=e=>{e.current&&=(clearTimeout(e.current),null)},Wg=`DEFAULT_TOOLTIP_ID`,Gg={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Kg=N({getTooltipData:()=>Gg});function qg(t=Wg){return e(Kg).getTooltipData(t)}var Jg={tooltip:`core-styles-module_tooltip__3vRRp`,fixed:`core-styles-module_fixed__pcSol`,arrow:`core-styles-module_arrow__cvMwQ`,content:`core-styles-module_content__BRKdB`,noArrow:`core-styles-module_noArrow__xock6`,clickable:`core-styles-module_clickable__ZuTTB`,show:`core-styles-module_show__Nt9eE`,closing:`core-styles-module_closing__sGnxF`},Yg={tooltip:`styles-module_tooltip__mnnfp`,content:`styles-module_content__ydYdI`,arrow:`styles-module_arrow__K0L3T`,dark:`styles-module_dark__xNqje`,light:`styles-module_light__Z6W-X`,success:`styles-module_success__A2AKt`,warning:`styles-module_warning__SCK0X`,error:`styles-module_error__JvumD`,info:`styles-module_info__BWdHW`},Xg=({forwardRef:e,id:n,className:r,classNameArrow:i,variant:s=`dark`,anchorId:c,anchorSelect:l,place:u=`top`,offset:d=10,events:f=[`hover`],openOnClick:g=!1,positionStrategy:_=`absolute`,middlewares:v,wrapper:y,delayShow:b=0,delayHide:x=0,float:S=!1,hidden:C=!1,noArrow:w=!1,clickable:T=!1,closeOnEsc:E=!1,closeOnScroll:D=!1,closeOnResize:O=!1,openEvents:k,closeEvents:A,globalCloseEvents:j,imperativeModeOnly:M,style:N,position:P,afterShow:F,afterHide:I,disableTooltip:L,content:R,contentWrapperRef:te,isOpen:ne,defaultIsOpen:re=!1,setIsOpen:ie,previousActiveAnchor:ae,activeAnchor:z,setActiveAnchor:oe,border:se,opacity:ce,arrowColor:le,arrowSize:ue=8,role:de=`tooltip`})=>{let fe=o(null),pe=o(null),me=o(null),he=o(null),ge=o(null),[_e,B]=h({tooltipStyles:{},tooltipArrowStyles:{},place:u}),[V,H]=h(!1),[ve,ye]=h(!1),[U,be]=h(null),xe=o(!1),Se=o(null),{anchorRefs:Ce,setActiveAnchor:we}=qg(n),Te=o(!1),[Ee,De]=h([]),Oe=o(!1),ke=g||f.includes(`click`),Ae=ke||k?.click||k?.dblclick||k?.mousedown,je=k?{...k}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!k&&ke&&Object.assign(je,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});let Me=A?{...A}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!A&&ke&&Object.assign(Me,{mouseleave:!1,blur:!1,mouseout:!1});let Ne=j?{...j}:{escape:E||!1,scroll:D||!1,resize:O||!1,clickOutsideAnchor:Ae||!1};M&&(Object.assign(je,{mouseover:!1,focus:!1,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Me,{mouseout:!1,blur:!1,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(Ne,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Hg((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]);let Pe=e=>{Oe.current&&(e&&ye(!0),setTimeout((()=>{Oe.current&&(ie?.(e),ne===void 0&&H(e))}),10))};m((()=>{if(n){if(V){t(ae);let r=e(z),i=[...new Set([...r,n])].filter(Boolean).join(` `);z?.setAttribute(`aria-describedby`,i)}else t(z);return()=>{t(z),t(ae)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function t(t){let r=e(t).filter((e=>e!==n));r.length?t?.setAttribute(`aria-describedby`,r.join(` `)):t?.removeAttribute(`aria-describedby`)}}),[z,V,n,ae]),m((()=>{if(ne===void 0)return()=>null;ne&&ye(!0);let e=setTimeout((()=>{H(ne)}),10);return()=>{clearTimeout(e)}}),[ne]),m((()=>{if(V!==xe.current){if(Ug(ge),xe.current=V,V)F?.();else{let e=(e=>{let t=e.match(/^([\d.]+)(ms|s)$/);if(!t)return 0;let[,n,r]=t;return Number(n)*(r===`ms`?1:1e3)})(getComputedStyle(document.body).getPropertyValue(`--rt-transition-show-delay`));ge.current=setTimeout((()=>{ye(!1),be(null),I?.()}),e+25)}}}),[V]);let Fe=e=>{B((t=>zg(t,e)?t:e))},Ie=(e=b)=>{Ug(me),ve?Pe(!0):me.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=x)=>{Ug(he),he.current=setTimeout((()=>{Te.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return oe(null),void we({current:null});b?Ie():Pe(!0),oe(t),we({current:t}),Ug(he)},ze=()=>{T?Le(x||100):x?Le():Pe(!1),Ug(me)},Be=({x:e,y:t})=>{Fg({place:U?.place??u,offset:d,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:fe.current,tooltipArrowReference:pe.current,strategy:_,middlewares:v,border:se,arrowSize:ue}).then((e=>{Fe(e)}))},Ve=e=>{if(!e)return;let t=e,n={x:t.clientX,y:t.clientY};Be(n),Se.current=n},He=e=>{if(!V)return;let t=e.target;t.isConnected&&(fe.current?.contains(t)||[document.querySelector(`[id='${c}']`),...Ee].some((e=>e?.contains(t)))||(Pe(!1),Ug(me)))},Ue=Lg(Re,50,!0),We=Lg(ze,50,!0),Ge=e=>{We.cancel(),Ue(e)},W=()=>{Ue.cancel(),We()},Ke=p((()=>{let e=U?.position??P;e?Be(e):S?Se.current&&Be(Se.current):z!=null&&z.isConnected&&Fg({place:U?.place??u,offset:d,elementReference:z,tooltipReference:fe.current,tooltipArrowReference:pe.current,strategy:_,middlewares:v,border:se,arrowSize:ue}).then((e=>{Oe.current&&Fe(e)}))}),[V,z,R,N,u,U?.place,d,_,P,U?.position,S,ue]);m((()=>{var e,t;let n=new Set(Ce);Ee.forEach((e=>{L!=null&&L(e)||n.add({current:e})}));let r=document.querySelector(`[id='${c}']`);r&&!(L!=null&&L(r))&&n.add({current:r});let i=()=>{Pe(!1)},a=Vg(z),o=Vg(fe.current);Ne.scroll&&(window.addEventListener(`scroll`,i),a?.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i));let s=null;Ne.resize?window.addEventListener(`resize`,i):z&&fe.current&&(s=ee(z,fe.current,Ke,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));let l=e=>{e.key===`Escape`&&Pe(!1)};Ne.escape&&window.addEventListener(`keydown`,l),Ne.clickOutsideAnchor&&window.addEventListener(`click`,He);let u=[],d=e=>!!(e?.target&&z?.contains(e.target)),f=e=>{V&&d(e)||Re(e)},p=e=>{V&&d(e)&&ze()},m=[`mouseover`,`mouseout`,`mouseenter`,`mouseleave`,`focus`,`blur`],h=[`click`,`dblclick`,`mousedown`,`mouseup`];Object.entries(je).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Me).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:W}):h.includes(e)&&u.push({event:e,listener:p}))})),S&&u.push({event:`pointermove`,listener:Ve});let g=()=>{Te.current=!0},_=()=>{Te.current=!1,ze()},v=T&&(Me.mouseout||Me.mouseleave);return v&&((e=fe.current)==null||e.addEventListener(`mouseover`,g),(t=fe.current)==null||t.addEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.addEventListener(e,t)}))})),()=>{var e,t;Ne.scroll&&(window.removeEventListener(`scroll`,i),a?.removeEventListener(`scroll`,i),o?.removeEventListener(`scroll`,i)),Ne.resize?window.removeEventListener(`resize`,i):s?.(),Ne.clickOutsideAnchor&&window.removeEventListener(`click`,He),Ne.escape&&window.removeEventListener(`keydown`,l),v&&((e=fe.current)==null||e.removeEventListener(`mouseover`,g),(t=fe.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[z,Ke,ve,Ce,Ee,k,A,j,ke,b,x]),m((()=>{let e=U?.anchorSelect??l??``;!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`);let t=new MutationObserver((t=>{let r=[],i=[];t.forEach((t=>{if(t.type===`attributes`&&t.attributeName===`data-tooltip-id`&&(t.target.getAttribute(`data-tooltip-id`)===n?r.push(t.target):t.oldValue===n&&i.push(t.target)),t.type===`childList`){if(z){let n=[...t.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...n.filter((t=>t.matches(e)))),i.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}n.some((e=>!!(e?.contains)?.call(e,z)&&(ye(!1),Pe(!1),oe(null),Ug(me),Ug(he),!0)))}if(e)try{let n=[...t.addedNodes].filter((e=>e.nodeType===1));r.push(...n.filter((t=>t.matches(e)))),r.push(...n.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&De((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{t.disconnect()}}),[n,l,U?.anchorSelect,z]),m((()=>{Ke()}),[Ke]),m((()=>{if(!te?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Ke()))}));return e.observe(te.current),()=>{e.disconnect()}}),[R,te?.current]),m((()=>{let e=document.querySelector(`[id='${c}']`),t=[...Ee,e];z&&t.includes(z)||oe(Ee[0]??e)}),[c,Ee,z]),m((()=>(re&&Pe(!0),()=>{Ug(me),Ug(he)})),[]),m((()=>{let e=U?.anchorSelect??l;if(!e&&n&&(e=`[data-tooltip-id='${n.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));De(t)}catch{De([])}}),[n,l,U?.anchorSelect]),m((()=>{me.current&&(Ug(me),Ie(b))}),[b]);let qe=U?.content??R,Je=V&&Object.keys(_e.tooltipStyles).length>0;return a(e,(()=>({open:e=>{if(e?.anchorSelect)try{document.querySelector(e.anchorSelect)}catch{console.warn(`[react-tooltip] "${e.anchorSelect}" is not a valid CSS selector`);return}be(e??null),e?.delay?Ie(e.delay):Pe(!0)},close:e=>{e?.delay?Le(e.delay):Pe(!1)},activeAnchor:z,place:_e.place,isOpen:!!(ve&&!C&&qe&&Je)}))),ve&&!C&&qe?t.createElement(y,{id:n,role:de,className:(0,Ag.default)(`react-tooltip`,Jg.tooltip,Yg.tooltip,Yg[s],r,`react-tooltip__place-${_e.place}`,Jg[Je?`show`:`closing`],Je?`react-tooltip__show`:`react-tooltip__closing`,_===`fixed`&&Jg.fixed,T&&Jg.clickable),onTransitionEnd:e=>{Ug(ge),V||e.propertyName!==`opacity`||(ye(!1),be(null),I?.())},style:{...N,..._e.tooltipStyles,opacity:ce!==void 0&&Je?ce:void 0},ref:fe},t.createElement(y,{className:(0,Ag.default)(`react-tooltip-content-wrapper`,Jg.content,Yg.content)},qe),t.createElement(y,{className:(0,Ag.default)(`react-tooltip-arrow`,Jg.arrow,Yg.arrow,i,w&&Jg.noArrow),style:{..._e.tooltipArrowStyles,background:le?`linear-gradient(to right bottom, transparent 50%, ${le} 50%)`:void 0,"--rt-arrow-size":`${ue}px`},ref:pe})):null},Zg=({content:e})=>t.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),Qg=t.forwardRef((({id:e,anchorId:n,anchorSelect:r,content:i,html:a,render:s,className:c,classNameArrow:l,variant:u=`dark`,place:d=`top`,offset:f=10,wrapper:p=`div`,children:g=null,events:_=[`hover`],openOnClick:v=!1,positionStrategy:y=`absolute`,middlewares:b,delayShow:x=0,delayHide:S=0,float:C=!1,hidden:w=!1,noArrow:T=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:O=!1,closeOnResize:k=!1,openEvents:A,closeEvents:j,globalCloseEvents:ee,imperativeModeOnly:M=!1,style:N,position:P,isOpen:F,defaultIsOpen:I=!1,disableStyleInjection:L=!1,border:R,opacity:te,arrowColor:ne,arrowSize:re,setIsOpen:ie,afterShow:ae,afterHide:z,disableTooltip:oe,role:se=`tooltip`},ce)=>{let[le,ue]=h(i),[de,fe]=h(a),[pe,me]=h(d),[he,ge]=h(u),[_e,B]=h(f),[V,H]=h(x),[ve,ye]=h(S),[U,be]=h(C),[xe,Se]=h(w),[Ce,we]=h(p),[Te,Ee]=h(_),[De,Oe]=h(y),[ke,Ae]=h(null),[je,Me]=h(null),Ne=o(null),Pe=o(L),{anchorRefs:Fe,activeAnchor:Ie}=qg(e),Le=e=>e?.getAttributeNames().reduce(((t,n)=>(n.startsWith(`data-tooltip-`)&&(t[n.replace(/^data-tooltip-/,``)]=e?.getAttribute(n)??null),t)),{}),Re=e=>{let t={place:e=>{me(e??d)},content:e=>{ue(e??i)},html:e=>{fe(e??a)},variant:e=>{ge(e??u)},offset:e=>{B(e===null?f:Number(e))},wrapper:e=>{we(e??p)},events:e=>{let t=e?.split(` `);Ee(t??_)},"position-strategy":e=>{Oe(e??y)},"delay-show":e=>{H(e===null?x:Number(e))},"delay-hide":e=>{ye(e===null?S:Number(e))},float:e=>{be(e===null?C:e===`true`)},hidden:e=>{Se(e===null?w:e===`true`)},"class-name":e=>{Ae(e)}};Object.values(t).forEach((e=>e(null))),Object.entries(e).forEach((([e,n])=>{var r;(r=t[e])==null||r.call(t,n)}))};m((()=>{ue(i)}),[i]),m((()=>{fe(a)}),[a]),m((()=>{me(d)}),[d]),m((()=>{ge(u)}),[u]),m((()=>{B(f)}),[f]),m((()=>{H(x)}),[x]),m((()=>{ye(S)}),[S]),m((()=>{be(C)}),[C]),m((()=>{Se(w)}),[w]),m((()=>{Oe(y)}),[y]),m((()=>{Pe.current!==L&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[L]),m((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:L===`core`,disableBase:L}}))}),[]),m((()=>{let t=new Set(Fe),i=r;if(!i&&e&&(i=`[data-tooltip-id='${e.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((e=>{t.add({current:e})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${n}']`);if(a&&t.add({current:a}),!t.size)return()=>null;let o=je??a??Ie.current,s=new MutationObserver((e=>{e.forEach((e=>{if(!o||e.type!==`attributes`||!e.attributeName?.startsWith(`data-tooltip-`))return;let t=Le(o);Re(t)}))})),c={attributes:!0,childList:!1,subtree:!1};if(o){let e=Le(o);Re(e),s.observe(o,c)}return()=>{s.disconnect()}}),[Fe,Ie,je,n,r]),m((()=>{N!=null&&N.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),R&&!Ig(`border`,`${R}`)&&console.warn(`[react-tooltip] "${R}" is not a valid \`border\`.`),N!=null&&N.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),te&&!Ig(`opacity`,`${te}`)&&console.warn(`[react-tooltip] "${te}" is not a valid \`opacity\`.`)}),[]);let ze=g,Be=o(null);if(s){let e=s({content:je?.getAttribute(`data-tooltip-content`)||le||null,activeAnchor:je});ze=e?t.createElement(`div`,{ref:Be,className:`react-tooltip-content-wrapper`},e):null}else le&&(ze=le);de&&(ze=t.createElement(Zg,{content:de}));let Ve={forwardRef:ce,id:e,anchorId:n,anchorSelect:r,className:(0,Ag.default)(c,ke),classNameArrow:l,content:ze,contentWrapperRef:Be,place:pe,variant:he,offset:_e,wrapper:Ce,events:Te,openOnClick:v,positionStrategy:De,middlewares:b,delayShow:V,delayHide:ve,float:U,hidden:xe,noArrow:T,clickable:E,closeOnEsc:D,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:j,globalCloseEvents:ee,imperativeModeOnly:M,style:N,position:P,isOpen:F,defaultIsOpen:I,border:R,opacity:te,arrowColor:ne,arrowSize:re,setIsOpen:ie,afterShow:ae,afterHide:z,disableTooltip:oe,activeAnchor:je,previousActiveAnchor:Ne.current,setActiveAnchor:e=>{Me((t=>(e!=null&&e.isSameNode(t)||(Ne.current=t),e)))},role:se};return t.createElement(Xg,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||Pg({css:`:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1;-webkit-backface-visibility:hidden;backface-visibility:hidden}.core-styles-module_content__BRKdB{position:relative;z-index:1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`,type:`core`}),e.detail.disableBase||Pg({css:`
4
- .styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;width:max-content}.styles-module_content__ydYdI{background:inherit;border-radius:inherit;padding:8px 16px}.styles-module_arrow__K0L3T{width:var(--rt-arrow-size);height:var(--rt-arrow-size)}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:`base`})})),r();var $g={indexes:[],thumbnails:[],subtitleTracks:[],selectedSubtitleTrack:void 0,selectSubtitleTrack:()=>{},audioTracks:[],selectedAudioTrack:void 0,selectAudioTrack:()=>{},hideUI:!1,setHideUI:()=>{},togglePictureInPicture:null,pictureInPictureMode:null,burnedInSubtitles:!1,playbackError:null,playbackErrors:[],ready:!1,setSourceState:()=>{}},e_=Nc({name:`source`,state:()=>({...$g}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),t_=Ad({features:[...Fu,e_],displayName:`MediaPlayer`}),Q=t_.usePlayer,n_=e=>{if(e&&e!==`und`)try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},r_=e=>e?.replace(/_/g,` `).trim()||void 0,i_=e=>{let t=e.map(e=>n_(e.language)??r_(e.title)??`Track ${e.streamIndex}`),n=t.reduce((e,t)=>({...e,[t]:(e[t]??0)+1}),{});return e.map((e,r)=>{let i=t[r],a=r_(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},a_=e=>i_(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),o_=[0,250,1e3,3e3,1e4],s_=6e4,c_=500,l_=e=>e instanceof Error?e.message:String(e),u_=e=>{let t=[],n=e?.cause;for(let e=0;n!=null&&e<8;e++){if(typeof MediaError<`u`&&n instanceof MediaError){t.push(`MediaError code ${n.code}${n.message?`: ${n.message}`:``}`);break}t.push(l_(n)),n=n?.cause}return t.length?t.join(`
5
- `):void 0},d_=(e,t,n)=>{let r=Q(),{read:i,size:a,publicPath:s=``,libavWorkerUrl:c=``,jassubWorkerUrl:l=``,jassubWasmUrl:u=``,jassubLegacyWasmUrl:d,defaultFontUrl:f,bufferSize:g,autoplay:_=!1,seekPrepareBudgetMs:v=c_}=n??{},[y,b]=h(void 0),[x,S]=h(0),C=o({count:0,at:0}),w=o(void 0);m(()=>(C.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{w.current&&clearTimeout(w.current)}),[a]);let T=o(null),E=o(null),D=o(!1),O=o(i);O.current=i;let k=o(n?.onSeek);k.current=n?.onSeek;let A=o(n?.onPlaybackError);A.current=n?.onPlaybackError;let j=p(e=>{let t=typeof e==`number`?e:void 0;D.current=!0,r.setSourceState({selectedSubtitleTrack:t}),T.current?.selectSubtitleStream(t)},[r]),ee=p(e=>{let t=T.current;if(!t||v<=0){r.seek(e);return}let n=typeof window<`u`&&window.__mediaPlayerSeekDebug,i=performance.now(),a=!1,o=`prepared`,s=()=>{if(!a&&(a=!0,r.seek(e),n)){let n=t.videoElement,r=0;if(n)for(let t=0;t<n.buffered.length;t++)n.buffered.start(t)<=e+1&&e<n.buffered.end(t)&&(r=n.buffered.end(t)-e);console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now()-i)}ms via ${o}, runway ${r.toFixed(1)}s${o===`deadline`?` (EXPOSED: moved before its data was ready)`:``}`)}},c=setTimeout(()=>{o=`deadline`,s()},v);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(c),s()})},[r,v]),M=p(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),b(e))},[r]),N=Q(e=>e.setSourceState);m(()=>{N({selectSubtitleTrack:j,selectAudioTrack:M,requestSeek:ee})},[N,j,M,ee]),m(()=>{if(!e||!t||!a||!i)return;let n=!1;r.setSourceState({playbackError:null,ready:!1});let o=(t,n)=>{let i=Date.now(),a=l_(t),o=u_(t),s=r.playbackErrors,c=s[s.length-1];if(c&&c.message===a&&c.detail===o&&c.recovered===n){let e={...c,count:c.count+1,lastAt:i};r.setSourceState({playbackErrors:[...s.slice(0,-1),e]});return}let l={at:i,lastAt:i,count:1,atMediaTime:Number.isFinite(e.currentTime)?e.currentTime:void 0,message:a,detail:o,recovered:n};r.setSourceState({playbackErrors:[...s,l]})},p=e=>{if(n)return;let t=lo(e);if(o(e,t),t){let t=performance.now();t-C.current.at>s_&&(C.current={count:0,at:t});let n=o_[Math.min(C.current.count,o_.length-1)];C.current={count:C.current.count+1,at:t},console.warn(`the media element failed; rebuilding the pipeline${n?` in ${n}ms`:``}`,e),w.current&&clearTimeout(w.current),w.current=setTimeout(()=>S(e=>e+1),n);return}console.error(`playback failed`,e),r.setSourceState({playbackError:e}),A.current?.(e)};return(async()=>{try{let i=await To({videoElement:e,canvasElement:t,read:(e,t)=>O.current(e,t),length:a,publicPath:s,libavWorkerUrl:c,jassubWorkerUrl:l,jassubWasmUrl:u,jassubLegacyWasmUrl:d,defaultFontUrl:f,bufferSize:g,audioStreamIndex:y,onReady:()=>{if(n)return;r.setSourceState({ready:!0});let t=E.current;E.current=null,t&&t.size===a&&t.time>0&&(e.currentTime=t.time),_&&e.play().catch(()=>{})},onError:p,onRecovered:()=>{n||r.setSourceState({playbackError:null})},onSeek:e=>k.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:a_(e),...D.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:a_(e),selectedAudioTrack:t})}});if(n){i.destroy();return}T.current=i,r.setSourceState({indexes:i.indexes});let o=r.selectedSubtitleTrack;typeof o==`number`&&i.selectSubtitleStream(o)}catch(e){p(e)}})(),()=>{n=!0,E.current={time:e.currentTime,size:a},T.current?.destroy(),T.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,s,c,l,u,d,f,g,y,_,x])},f_=5e3,p_=6e4,m_=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,s]=h([]),c=o(null),l=o(r);l.current=r;let u=b(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),d=o(u);return d.current=u,m(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,o,u=f_,f=()=>{Mo({publicPath:e,workerUrl:t,length:n,read:(e,t)=>l.current(e,t),onThumbnails:e=>{i||s(e)}}).then(e=>{if(i){e.destroy();return}a=e,c.current=e,e.update(d.current)},()=>{i||(o=setTimeout(f,u),u=Math.min(u*2,p_))})};return f(),()=>{i=!0,clearTimeout(o),c.current=null,a?.destroy(),s([])}},[n,e,t]),m(()=>{c.current?.update(u)},[u]),a},h_=(e,t)=>{let n=o(null),[r,i]=h(!1),[a]=h(()=>Bo());m(()=>{if(!e||!t||!a)return;let r=Vo({video:e,canvas:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let s=p(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?s:null,mode:a,burnedIn:r}},g_={headings:{large:`
6
- font-weight: 600;
7
- font-size: calc(2.8 * var(--mp-unit));
8
- line-height: calc(3.4 * var(--mp-unit));
9
- @media (min-width: 960px) {
10
- font-size: calc(3.4 * var(--mp-unit));
11
- line-height: calc(4.1 * var(--mp-unit));
12
- }
13
- `,medium:`
14
- font-weight: 600;
15
- font-size: calc(2.4 * var(--mp-unit));
16
- line-height: calc(2.9 * var(--mp-unit));
17
- @media (min-width: 960px) {
18
- font-size: calc(2.8 * var(--mp-unit));
19
- line-height: calc(3.4 * var(--mp-unit));
20
- }
21
- `,small:`
22
- font-weight: 500;
23
- font-size: calc(1.8 * var(--mp-unit));
24
- line-height: calc(1.9 * var(--mp-unit));
25
- @media (min-width: 960px) {
26
- font-size: calc(1.8 * var(--mp-unit));
27
- line-height: calc(2.2 * var(--mp-unit));
28
- }
29
- @media (min-width: 2560px) {
30
- font-size: calc(2.2 * var(--mp-unit));
31
- line-height: calc(2.6 * var(--mp-unit));
32
- }
33
- `,extraSmall:`
34
- font-weight: 500;
35
- font-size: calc(1.4 * var(--mp-unit));
36
- line-height: calc(1.7 * var(--mp-unit));
37
- @media (min-width: 960px) {
38
- font-size: calc(1.6 * var(--mp-unit));
39
- line-height: calc(1.9 * var(--mp-unit));
40
- }
41
- `},bLarge:{bold:`
42
- font-weight: 600;
43
- font-size: calc(1.4 * var(--mp-unit));
44
- line-height: calc(2 * var(--mp-unit));
45
- @media (min-width: 960px) {
46
- font-size: calc(1.6 * var(--mp-unit));
47
- line-height: calc(2.2 * var(--mp-unit));
48
- }
49
- `,medium:`
50
- font-weight: 500;
51
- font-size: calc(1.4 * var(--mp-unit));
52
- line-height: calc(2 * var(--mp-unit));
53
- @media (min-width: 960px) {
54
- font-size: calc(1.6 * var(--mp-unit));
55
- line-height: calc(2.2 * var(--mp-unit));
56
- }
57
- `,regular:`
58
- font-weight: 400;
59
- font-size: calc(1.4 * var(--mp-unit));
60
- line-height: calc(2 * var(--mp-unit));
61
- @media (min-width: 960px) {
62
- font-size: calc(1.6 * var(--mp-unit));
63
- line-height: calc(2.2 * var(--mp-unit));
64
- }
65
- `},bMedium:{bold:`
66
- font-weight: 600;
67
- font-size: calc(1.2 * var(--mp-unit));
68
- line-height: calc(1.7 * var(--mp-unit));
69
- @media (min-width: 960px) {
70
- font-size: calc(1.4 * var(--mp-unit));
71
- line-height: calc(2 * var(--mp-unit));
72
- }
73
- `,medium:`
74
- font-weight: 500;
75
- font-size: calc(1.2 * var(--mp-unit));
76
- line-height: calc(1.7 * var(--mp-unit));
77
- @media (min-width: 960px) {
78
- font-size: calc(1.4 * var(--mp-unit));
79
- line-height: calc(2 * var(--mp-unit));
80
- }
81
- `,regular:`
82
- font-weight: 400;
83
- font-size: calc(1.2 * var(--mp-unit));
84
- line-height: calc(1.7 * var(--mp-unit));
85
- @media (min-width: 960px) {
86
- font-size: calc(1.4 * var(--mp-unit));
87
- line-height: calc(2 * var(--mp-unit));
88
- }
89
- `},bSmall:{bold:`
90
- font-weight: 600;
91
- font-size: calc(1 * var(--mp-unit));
92
- line-height: calc(1.4 * var(--mp-unit));
93
- @media (min-width: 960px) {
94
- font-size: calc(1.2 * var(--mp-unit));
95
- line-height: calc(1.7 * var(--mp-unit));
96
- }
97
- `,medium:`
98
- font-weight: 500;
99
- font-size: calc(1 * var(--mp-unit));
100
- line-height: calc(1.4 * var(--mp-unit));
101
- @media (min-width: 960px) {
102
- font-size: calc(1.2 * var(--mp-unit));
103
- line-height: calc(1.7 * var(--mp-unit));
104
- }
105
- `,regular:`
106
- font-weight: 400;
107
- font-size: calc(1 * var(--mp-unit));
108
- line-height: calc(1.4 * var(--mp-unit));
109
- @media (min-width: 960px) {
110
- font-size: calc(1.2 * var(--mp-unit));
111
- line-height: calc(1.7 * var(--mp-unit));
112
- }
113
- `},bExtraSmall:{bold:`
114
- font-weight: 600;
115
- font-size: calc(0.8 * var(--mp-unit));
116
- line-height: calc(1.1 * var(--mp-unit));
117
- @media (min-width: 960px) {
118
- font-size: calc(1 * var(--mp-unit));
119
- line-height: calc(1.4 * var(--mp-unit));
120
- }
121
- `,medium:`
122
- font-weight: 500;
123
- font-size: calc(0.8 * var(--mp-unit));
124
- line-height: calc(1.1 * var(--mp-unit));
125
- @media (min-width: 960px) {
126
- font-size: calc(1 * var(--mp-unit));
127
- line-height: calc(1.4 * var(--mp-unit));
128
- }
129
- `,regular:`
130
- font-weight: 400;
131
- font-size: calc(0.8 * var(--mp-unit));
132
- line-height: calc(1.1 * var(--mp-unit));
133
- @media (min-width: 960px) {
134
- font-size: calc(1 * var(--mp-unit));
135
- line-height: calc(1.4 * var(--mp-unit));
136
- }
137
- `}},__=D`
138
- top: unset !important;
139
- left: unset !important;
140
- width: 100%;
141
- height: 100%;
142
- margin: auto;
143
- pointer-events: none;
144
- `,v_=D`
145
- position: absolute;
146
- top: 0;
147
- left: 0;
148
- width: 100%;
149
- padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
150
- /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
151
- padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
152
- ${g_.headings.small}
153
- color: white;
154
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
155
- z-index: 2;
156
- pointer-events: none;
157
-
158
- /* one line with an ellipsis until there is width to wrap, since a release filename would
159
- otherwise run to four lines on a phone */
160
- white-space: nowrap;
161
- overflow: hidden;
162
- text-overflow: ellipsis;
163
-
164
- @media (min-width: 768px) {
165
- padding: calc(2.4 * var(--mp-unit));
166
- padding-top: calc(calc(2.4 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
167
- white-space: normal;
168
- overflow: visible;
169
- }
170
-
171
- background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
172
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
173
- `,y_=D`
174
- position: absolute;
175
- inset: 0;
176
- z-index: 2;
177
- display: flex;
178
- justify-content: center;
179
- align-items: center;
180
- pointer-events: none;
181
-
182
- ::after {
183
- content: '';
184
- width: calc(4 * var(--mp-unit));
185
- height: calc(4 * var(--mp-unit));
186
- border-radius: 50%;
187
- border: 3px solid rgba(255, 255, 255, 0.25);
188
- border-top-color: #fff;
189
- animation: ${s`
190
- to { transform: rotate(360deg); }
191
- `} 0.8s linear infinite;
192
- }
193
- `,b_=D`
194
- position: absolute;
195
- inset: auto 0 20%;
196
- z-index: 3;
197
- padding: 0 calc(2 * var(--mp-unit));
198
- text-align: center;
199
- color: #fff;
200
- ${g_.bLarge.regular}
201
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
202
- pointer-events: none;
203
- `,x_=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,S_=({onCanvasRef:e})=>{let t=Q(e=>e.title),n=Q(e=>e.hideUI),r=Q(e=>e.playbackError),i=Q(e=>e.ready),a=Q(e=>e.size),o=Q(e=>e.waiting);return y(O,{children:[t?F(`div`,{className:`title`,css:v_,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,(a?!i:o)&&!r?F(`div`,{css:y_}):void 0,r?F(`div`,{css:b_,children:x_(r)}):void 0,F(`canvas`,{ref:e,css:__})]})},C_=1e-4,w_=1,T_=e=>Math.max(C_,Math.min(w_,e))**2,E_=e=>Math.max(C_,Math.min(w_,e))**(w_/2),D_=e=>{if(e===void 0)return`0:00`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${n<10?`0`:``}${n}:${r<10?`0`:``}${r}`:`${n}:${r<10?`0`:``}${r}`},O_=(e,t)=>`${D_(e)} / ${D_(t)}`,k_=e=>D`
204
- display: flex;
205
- justify-content: flex-start;
206
-
207
- /*
208
- * Bounded here rather than at each call site.
209
- *
210
- * react-tooltip's own chip rule carries width: max-content, so with nothing opposing it a chip
211
- * grows to the widest UNWRAPPED line of its content: a two sentence tooltip measured 1178px
212
- * through this component. Both declarations are load bearing, since a bound with no wrapping only
213
- * moves the overflow inside a narrow box. 26 units is the width control-bar.tsx was already
214
- * imposing on its own two line tooltip by hand, so nothing in the bar changes shape.
215
- */
216
- max-width: min(calc(26 * var(--mp-unit)), calc(100vw - calc(2.4 * var(--mp-unit))));
217
- white-space: normal;
218
- overflow-wrap: anywhere;
219
- text-align: left;
220
-
221
- /*
222
- * The radius carries !important for the same reason the paddings below do.
223
- *
224
- * react-tooltip injects its stylesheet from a passive effect while emotion inserts through
225
- * useInsertionEffect, which runs earlier, so react-tooltip's sheet lands in the head LAST at
226
- * exactly this specificity and wins every tie. Its own radius is 3px, which is what was drawn
227
- * here until this was stated.
228
- */
229
- border-radius: calc(0.4 * var(--mp-unit))!important;
230
- user-select: none;
231
-
232
- z-index: 3;
233
-
234
- * {
235
- ${g_.bMedium.regular}
236
- }
237
-
238
- ${e===`sm`&&D`
239
- padding: calc(0.4 * var(--mp-unit))!important;
240
- `}
241
- ${e===`md`&&D`
242
- padding: calc(0.6 * var(--mp-unit))!important;
243
- `}
244
- ${e===`lg`&&D`
245
- padding: calc(1.2 * var(--mp-unit))!important;
246
- `}
247
- `,A_={x:-1,y:-1,anchors:0},j_=e=>{A_.x=e.clientX,A_.y=e.clientY},M_=()=>(A_.anchors++===0&&window.addEventListener(`pointermove`,j_,{capture:!0,passive:!0}),()=>{--A_.anchors===0&&window.removeEventListener(`pointermove`,j_,{capture:!0})}),N_=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:i=0,offset:a=20,tooltipPlace:s=`top`,disabled:c=!1,size:l=`md`})=>{let u=o(null),d=o(null);return m(()=>{let e=M_(),t=()=>{let e=u.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();A_.x>=t&&A_.x<n&&A_.y>=r&&A_.y<i||d.current?.close()},n=[`fullscreenchange`,`webkitfullscreenchange`];for(let e of n)document.addEventListener(e,t);return()=>{e();for(let e of n)document.removeEventListener(e,t)}},[]),y(O,{children:[F(`div`,{ref:u,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":a,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":i,"data-tooltip-place":s,children:n}),!c&&F(Qg,{ref:d,css:k_(l),id:e,noArrow:!0,children:t})]})},P_=({ref:e,onChange:t,orientation:n=`horizontal`,disabled:r=!1})=>{let[i,a]=h(!1),s=o(t);s.current=t;let c=o(null),l=p((t,r)=>{let i=e.current;if(!i)return 0;let{left:a,right:o,top:s,bottom:c}=i.getBoundingClientRect(),l=n===`horizontal`?(t-a)/(o-a):(c-r)/(c-s);return Math.min(Math.max(l,0),1)},[e,n]),u=p(e=>{if(!(r||e.button>0)){c.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}a(!0),s.current(l(e.clientX,e.clientY))}},[r,l]),d=p(e=>{c.current===e.pointerId&&s.current(l(e.clientX,e.clientY))},[l]),f=p(e=>{if(c.current===e.pointerId){c.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}a(!1)}},[]);return m(()=>{r&&(c.current=null,a(!1))},[r]),{dragging:i,handlers:{onPointerDown:u,onPointerMove:d,onPointerUp:f,onPointerCancel:f,style:{touchAction:`none`}}}},F_=D`
248
- position: relative;
249
- height: calc(.4 * var(--mp-unit));
250
-
251
- --thumbnail-width: calc(25 * var(--mp-unit));
252
- --thumbnail-half: calc(12.5 * var(--mp-unit));
253
-
254
- transition: transform .2s ease-in-out;
255
-
256
- margin: 0 12px;
257
- @media (min-width: 768px) {
258
- margin: 0 16px;
259
- }
260
- @media (min-width: 2560px) {
261
- margin: 0 24px;
262
- }
263
-
264
- user-select: none;
265
- cursor: pointer;
266
-
267
- :hover {
268
- .background-bar {
269
- transform: scaleY(1.5);
270
- }
271
- .loaded {
272
- transform: scaleY(1.5);
273
- top: calc(-.1 * var(--mp-unit));
274
- }
275
- .play-container {
276
- transform: scaleY(1.5);
277
- }
278
- }
279
-
280
-
281
- .background-bar {
282
- position: absolute;
283
- inset: 0;
284
- background-color: hsla(0, 100%, 100%, .2);
285
- }
286
-
287
- .cursor-time {
288
- display: flex;
289
- justify-content: center;
290
-
291
- /* The seekbar's other hover affordance, the thumbnail below, gets a rounded box and a drop
292
- shadow. A source that ships no thumbnails, which is every source whose media the player does
293
- not own, leaves this readout as the entire preview, so it carries the same treatment instead
294
- of sitting as bare text on the picture. The ink comes from the player root. */
295
- background-color: rgba(28, 28, 28, .95);
296
- border-radius: calc(.4 * var(--mp-unit));
297
- padding: 0 calc(.6 * var(--mp-unit));
298
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
299
-
300
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
301
- ${g_.bMedium.bold}
302
-
303
- position: absolute;
304
- /* Anchored on its bottom edge rather than its top: now that it has a background its height
305
- follows the font size, and a top-anchored box would grow downward into the track. */
306
- bottom: calc(1.2 * var(--mp-unit));
307
- /* Sized to its content, replacing a fixed 5 unit box that \`1:04:09\` overflows. Transparent, that
308
- overflow was invisible; filled, it would not be. */
309
- width: max-content;
310
- white-space: nowrap;
311
- transform: translateX(-50%);
312
-
313
- pointer-events: none;
314
- }
315
-
316
- .loaded {
317
- transform-origin: 0 0;
318
- position: absolute;
319
- bottom: 0;
320
- height: calc(.4 * var(--mp-unit));
321
- width: 100%;
322
- .loaded-part {
323
- transform-origin: 0 0;
324
- bottom: 0;
325
- height: calc(.4 * var(--mp-unit));
326
- width: 100%;
327
- position: absolute;
328
- background-color: hsla(0, 100%, 100%, .4);
329
- }
330
- }
331
-
332
- .play-container {
333
- position: absolute;
334
- bottom: 0;
335
- width: 100%;
336
- height: calc(.4 * var(--mp-unit));
337
- }
338
-
339
- .play {
340
- transform-origin: 0 0;
341
- background-color: #f03;
342
- position: absolute;
343
- bottom: 0;
344
- height: calc(.4 * var(--mp-unit));
345
- width: 100%;
346
- }
347
-
348
- .padding {
349
- position: absolute;
350
- bottom: -7.5px;
351
- height: calc(2 * var(--mp-unit));
352
- width: 100%;
353
- }
354
-
355
- .thumbnail {
356
- display: flex;
357
- justify-content: center;
358
-
359
- position: absolute;
360
- top: calc(calc(-3.4375 * var(--mp-unit)) - var(--thumbnail-width) * 9/16);
361
- height: calc(var(--thumbnail-width) * 9/16);
362
- width: var(--thumbnail-width);
363
-
364
- margin-left: calc(var(--thumbnail-half) * -1);
365
- pointer-events: none;
366
-
367
- img {
368
- border-radius: calc(.4 * var(--mp-unit));
369
- box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
370
-
371
- width: 100%;
372
- height: 100%;
373
- object-fit: cover;
374
- }
375
- }
376
-
377
- /* a thumb is far wider than a cursor, so the hit strip grows to 44px and the track thickens */
378
- @media (pointer: coarse) {
379
- height: calc(.6 * var(--mp-unit));
380
-
381
- /* press feedback, coarse only: a finger has no hover, so without this the bar gives no sign
382
- it is being dragged */
383
- &.dragging {
384
- .background-bar, .loaded, .play-container {
385
- transform: scaleY(1.5);
386
- }
387
- }
388
-
389
- .loaded {
390
- height: calc(.6 * var(--mp-unit));
391
- .loaded-part {
392
- height: calc(.6 * var(--mp-unit));
393
- }
394
- }
395
-
396
- .play-container {
397
- height: calc(.6 * var(--mp-unit));
398
- }
399
-
400
- .play {
401
- height: calc(.6 * var(--mp-unit));
402
- }
403
-
404
- /* grows upward into the video: centred, it would hang over the control row and win hit
405
- testing against taps meant for play, mute and fullscreen */
406
- .padding {
407
- height: 44px;
408
- bottom: 0;
409
- }
410
- }
411
-
412
- /* the clamp only holds the preview inside the bar while the bar is the wider of the two, so
413
- below that the preview is narrowed instead */
414
- @media (max-width: 480px) {
415
- --thumbnail-width: calc(18 * var(--mp-unit));
416
- --thumbnail-half: calc(9 * var(--mp-unit));
417
- }
418
- `,I_=4,L_=()=>{let e=Q(),t=Q(e=>e.currentTime),n=Q(e=>e.requestSeek),r=Q(e=>e.duration),i=Q(e=>e.size),a=Q(e=>e.downloadedRanges),s=Q(e=>e.indexes),c=Q(e=>e.thumbnails),l=Q(e=>e.thumbnailAt),u=o(null),[d,f]=h(void 0),[p,g]=h(void 0),_=o(void 0),v=o(0),x=o(void 0),S=o(void 0),C=o(!1),{dragging:w,handlers:T}=P_({ref:u,onChange:e=>{if(v.current+=1,x.current=e,S.current===void 0)S.current=e;else if(!C.current){let t=u.current?.getBoundingClientRect().width??0;Math.abs(e-S.current)*t>I_&&(C.current=!0)}f(e),_.current!==`mouse`&&g(e*r)}}),E=e=>{_.current=e.pointerType,v.current=0,S.current=void 0,C.current=!1,T.onPointerDown(e)},D=t=>{T.onPointerUp(t);let i=v.current>0?x.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}v.current=0,C.current=!1,S.current=void 0,t.pointerType!==`mouse`&&g(void 0)},O=e=>{if(!u.current)return;let{left:t,right:n}=u.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},k=e=>{g(O(e.clientX))},A=()=>{u.current&&g(void 0)},j=e=>r?e/r*100:0,ee=b(()=>a?.map((e,t)=>{if(!i||!r)return null;let n=s.filter(t=>e.startByteOffset<=t.pos&&t.pos<=e.endByteOffset),a=n.at(0),o=n.at(-1);if(!a||!o)return null;let c=a.timestamp/r,l=o.timestamp/r,u=Number((l-c).toFixed(2)),d=c*100;return F(`div`,{className:`loaded-part`,style:{transform:`scaleX(${u})`,marginLeft:`${d}%`}},t)})??[],[r,s.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]),M=b(()=>{if(!p||p<0)return;let e=Math.floor(p/3600),t=Math.floor((p-e*3600)/60),n=Math.floor(p-e*3600-t*60);return`${e>0?`${e}:`:``}${t<10?`0`:``}${t}:${n<10?`0`:``}${n}`},[p]);m(()=>{d===void 0||!r||!w||!C.current||e.seek(d*r)},[e,w,d,r]);let N=b(()=>!r||typeof t!=`number`?0:t/r,[r,t]),P=b(()=>{if(p){if(l)return l(p);if(c.length)return c.find(({startTime:e,endTime:t})=>e<=p&&p<t)}},[c,l,p]);return y(`div`,{css:F_,ref:u,className:w?`progress-bar dragging`:`progress-bar`,onMouseMove:k,onMouseOut:A,children:[F(`div`,{className:`background-bar`}),p?F(`div`,{className:`cursor-time`,style:{left:`clamp(calc(3 * var(--mp-unit)), ${j(p)}%, calc(100% - calc(3 * var(--mp-unit))))`},children:M}):void 0,F(`div`,{className:`progress`}),F(`div`,{className:`loaded`,children:ee}),F(`div`,{className:`hover`}),F(`div`,{className:`play-container`,children:F(`div`,{className:`play`,style:{transform:`scaleX(${N})`}})}),F(`div`,{className:`chapters`}),F(`div`,{className:`scrubber`}),F(`div`,{className:`padding`,...T,onPointerDown:E,onPointerUp:D,onPointerCancel:D}),F(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${j(p??1)}%, calc(100% - var(--thumbnail-half)))`},children:P?.url?F(`img`,{src:P.url}):void 0})]})},R_=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e`,z_={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},B_=e=>y(`svg`,{...z_,...e,children:[F(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),F(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),V_=e=>y(`svg`,{...z_,...e,children:[F(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),F(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),F(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),H_=e=>y(`svg`,{...z_,...e,children:[F(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),F(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),F(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),U_=e=>y(`svg`,{...z_,...e,children:[F(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),F(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),F(`path`,{d:`M6 9h3m2 0h2`})]}),W_=D`
419
- .popover {
420
- position: absolute;
421
- /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
422
- bar, so a menu centred on it puts its own edges wherever the button happens to sit: with no
423
- picture-in-picture button, which is every source whose media the player does not own, an edge
424
- landed outside the box, and the root's \`overflow: hidden\` cut it off, taking the rows under it
425
- out of reach. The inset matches the bar's own padding so the menu lines up with the last button. */
426
- right: calc(12px + env(safe-area-inset-right, 0px));
427
- bottom: calc(100% + 8px);
428
-
429
- overflow-y: auto;
430
- width: 180px;
431
- /* \`100%\` is the control bar, which is the width of the PLAYER. The old \`100vw\` was the viewport,
432
- which equals the player only when the player is the whole document, and it is the wrong kind of
433
- guard besides: a max-width shrinks the box, it never moves it back inside. */
434
- max-width: calc(100% - 24px);
435
- /* Sized to its rows, capped at what fits. A fixed height left the settings menu two thirds empty
436
- once subtitles moved out to its own button, and a long track list scrolls at the cap either way. */
437
- height: max-content;
438
- /* The room actually above the bar. A short player had the top of the menu clipped by that same
439
- \`overflow: hidden\`. With no size container in the ancestry this resolves against the small
440
- viewport, so it can only ever shrink the box, never grow it. */
441
- max-height: min(160px, calc(100cqh - 100% - 16px));
442
- @media (min-width: 768px) {
443
- right: calc(16px + env(safe-area-inset-right, 0px));
444
- width: 250px;
445
- max-width: calc(100% - 32px);
446
- }
447
- @media (min-width: 2560px) {
448
- right: calc(24px + env(safe-area-inset-right, 0px));
449
- max-width: calc(100% - 48px);
450
- }
451
-
452
- display: flex;
453
- flex-direction: column;
454
-
455
- border-radius: 8px;
456
- background-color: rgba(28,28,28,0.95);
457
- ${g_.bMedium.regular}
458
-
459
- z-index: 4;
460
-
461
- > div {
462
- display: flex;
463
- align-items: center;
464
- justify-content: space-between;
465
-
466
- color: #fff;
467
- outline: none;
468
-
469
- padding: 8px 6px 8px 12px;
470
-
471
- width: 100%;
472
- /* rows keep their own height inside the fixed height column, so a long page scrolls rather than
473
- squashing every row into it */
474
- flex-shrink: 0;
475
- @media (pointer: coarse) {
476
- box-sizing: border-box;
477
- min-height: 44px;
478
- }
479
-
480
- :first-of-type {
481
- border-radius: 8px 8px 0 0;
482
- }
483
- :last-of-type {
484
- border-radius: 0 0 8px 8px;
485
- }
486
- &:not(.no-hover) {
487
- cursor: pointer;
488
- }
489
- &:not(.no-hover):hover {
490
- background-color: rgba(255,255,255,.1);
491
- }
492
-
493
- > div {
494
- display: flex;
495
- align-items: center;
496
- justify-content: center;
497
-
498
- .secondary {
499
- color: #eee;
500
- ${g_.bSmall.regular}
501
- }
502
- }
503
- }
504
-
505
- .back {
506
- display: flex;
507
- align-items: center;
508
- justify-content: flex-start;
509
- border-bottom: 1px solid #4D4D4E;
510
-
511
- svg {
512
- transform: translateX(-4px);
513
- transition: transform 0.2s ease-in-out;
514
- }
515
-
516
- :hover {
517
- svg {
518
- transform: translateX(-8px);
519
- }
520
- }
521
- }
522
- }
523
-
524
- .track-list {
525
- .description {
526
- word-break: break-word;
527
- }
528
-
529
- /* Dimmed and inert, but still listed. A source that names a track it cannot serve right now is
530
- saying the track exists, and dropping the row would read as the source having nothing. */
531
- .unavailable {
532
- opacity: 0.5;
533
- cursor: default;
534
- :hover {
535
- background-color: transparent;
536
- }
537
- }
538
-
539
- .failed {
540
- border-bottom: 1px solid #4D4D4E;
541
- color: #f66;
542
- ${g_.bSmall.regular}
543
- }
544
- }
545
- `,G_=({title:e,tracks:t,selected:n,onSelect:r,onBack:i,offLabel:a,pending:o,failed:s})=>{let c=o!==void 0,l=(e,i,a)=>{let s=c&&o===e,l=c||t.find(t=>t.id===e)?.disabled;return y(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[F(`span`,{children:i}),F(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return y(`div`,{className:`popover track-list`,children:[y(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?F(Rh,{}):null,F(`span`,{children:e})]}),s?F(`div`,{className:`no-hover failed`,children:`Could not switch. Try again.`}):null,a?l(null,a):null,t.map(({id:e,label:t})=>l(e,t,`description`))]})},K_=({onReset:e}={})=>{let t=o(null),[n,r]=h(!1),[i,a]=h(void 0),[s,c]=h(!1),l=o(e);l.current=e;let u=()=>{r(!1),l.current?.()};return m(()=>{let e=e=>{n&&t.current&&!t.current.contains(e.target)&&u()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),{open:n,toggle:()=>{r(e=>!e),c(!1),l.current?.()},close:u,containerRef:t,pending:i,failed:s,runSelect:(e,t)=>{if(i!==void 0)return;c(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),c(!0);return}if(!(n instanceof Promise)){u();return}a(e),n.then(()=>{a(void 0),u()},e=>{console.warn(`[media-player] track selection failed:`,e),a(void 0),c(!0)})}}},q_=D`
546
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
547
- which is the width of the player box, so it can be clamped to it. */
548
- position: static;
549
-
550
- .errors {
551
- /* the icon keeps its size, the pressable box grows around it */
552
- @media (pointer: coarse) {
553
- box-sizing: border-box;
554
- justify-content: center;
555
-
556
- min-width: 44px;
557
- min-height: 44px;
558
- }
559
- }
560
-
561
- ${W_}
562
-
563
- .popover.error-list {
564
- /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
565
- decoder message that has been ellipsized is not worth copying. */
566
- width: 420px;
567
- max-height: min(300px, calc(100cqh - 100% - 16px));
568
-
569
- /* track-menu's header is a left-aligned label row; here it carries a control too, so the two
570
- ends go to the two ends */
571
- .back {
572
- justify-content: space-between;
573
- gap: 8px;
574
- }
575
-
576
- .copy {
577
- /* sits in the header row, which track-menu styles as .back */
578
- display: flex;
579
- align-items: center;
580
- gap: 6px;
581
-
582
- background: none;
583
- border: none;
584
- padding: 4px 6px;
585
- border-radius: 4px;
586
-
587
- color: #fff;
588
- cursor: pointer;
589
- ${g_.bSmall.regular}
590
-
591
- &:hover {
592
- background-color: rgba(255,255,255,.1);
593
- }
594
-
595
- svg {
596
- width: 14px;
597
- height: 14px;
598
- }
599
- }
600
-
601
- .entry {
602
- /* one failure is a block of text, so it stacks instead of sitting on one line */
603
- display: flex;
604
- flex-direction: column;
605
- align-items: flex-start;
606
- gap: 2px;
607
-
608
- .when {
609
- color: #bbb;
610
- ${g_.bSmall.regular}
611
-
612
- /* the one part of the line worth scanning for, so it is the one part at full brightness */
613
- .count {
614
- margin-left: 6px;
615
- color: #fff;
616
- }
617
- }
618
-
619
- .what {
620
- /* the decoder's own words, which are long and must not be cut */
621
- overflow-wrap: anywhere;
622
- white-space: pre-wrap;
623
- }
624
-
625
- .cause {
626
- color: #ddd;
627
- overflow-wrap: anywhere;
628
- white-space: pre-wrap;
629
- ${g_.bSmall.regular}
630
- }
631
- }
632
- }
633
- `,J_=e=>new Date(e).toLocaleTimeString(),Y_=e=>e===void 0||!Number.isFinite(e)?void 0:D_(Math.max(0,e)),X_=e=>e.reduce((e,t)=>e+t.count,0),Z_=e=>e.map((e,t)=>{let n=Y_(e.atMediaTime),r=e.count>1?`${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}`:new Date(e.at).toISOString();return[`${t+1}. ${r}${n?` (at ${n})`:``}${e.recovered?` [recovered]`:``}`,e.message,e.detail].filter(Boolean).join(`
634
- `)}).join(`
635
-
636
- `),Q_=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=K_(),[i,a]=h(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(Z_(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${X_(e)})`;return y(`div`,{css:q_,ref:r,children:[F(N_,{id:`errors`,disabled:t,text:F(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:F(Ah,{className:`alert-triangle`})}),toolTipText:F(`span`,{children:s})}),t&&y(`div`,{className:`popover error-list`,children:[y(`div`,{className:`back no-hover`,children:[F(`span`,{children:s}),y(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[F(i?Ph:Kh,{}),F(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>y(`div`,{className:`entry no-hover`,children:[y(`span`,{className:`when`,children:[J_(e.at),e.count>1?` to ${J_(e.lastAt)}`:``,Y_(e.atMediaTime)?` at ${Y_(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?F(`span`,{className:`count`,children:`×${e.count}`}):null]}),F(`span`,{className:`what`,children:e.message}),e.detail?F(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},$_=D`
637
- display: flex;
638
- align-items: center;
639
- justify-content: center;
640
- flex-direction: column;
641
- width: 100%;
642
-
643
- .playback-slider {
644
- display: flex;
645
- align-items: center;
646
-
647
- padding: 8px 4px;
648
- margin: 0 2px;
649
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
650
- @media (pointer: coarse) {
651
- padding: 20px 8px;
652
- }
653
-
654
- cursor: pointer;
655
-
656
- > div {
657
- position: relative;
658
-
659
- background: #ccc;
660
- border-radius: 4px;
661
-
662
- width: 120px;
663
- max-width: 100%;
664
- height: 3px;
665
- @media (min-width: 768px) {
666
- height: 4px;
667
- }
668
- }
669
-
670
- .playback-handle {
671
- position: absolute;
672
-
673
-
674
- background: #ffffff;
675
- border-radius: 50%;
676
- transform: translateX(-50%);
677
- pointer-events: none;
678
-
679
- width: 10px;
680
- height: 10px;
681
- top: -3.5px;
682
- @media (min-width: 768px) {
683
- width: 12px;
684
- height: 12px;
685
- top: -4px;
686
- }
687
- }
688
- }
689
- `,ev=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=o(null),r=o(null),i=.25,a=2.75,s=(e,t=.05)=>Math.round(e/t)*t,c=s(t||1),l=e=>(e-i)/a*100,u=e=>s(i+e*a),{handlers:d}=P_({ref:r,onChange:t=>e.setPlaybackRate(u(t))}),f=t=>{t.preventDefault();let n=.05,r=c;r=t.deltaY<0?Math.min(3,r+n):Math.max(i,r-n),e.setPlaybackRate(r)};m(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,f,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,f)}},[t]);let p=l(c);return y(`div`,{css:$_,children:[y(`div`,{children:[c.toFixed(2),`x`]}),F(`div`,{className:`playback-slider`,ref:n,...d,children:F(`div`,{ref:r,style:{background:`linear-gradient(to right,
690
- #fff 0% ${p}%,
691
- #3A3A3A ${p}% 100%
692
- )`},children:F(`div`,{className:`playback-handle`,style:{left:`${p}%`}})})})]})},tv=D`
693
- /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
694
- as wide as the player box and can therefore be clamped to it. The outside-click check uses
695
- \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
696
- tooltips already resolve against the control bar with no positioned wrapper of their own. */
697
- position: static;
698
-
699
- .settings {
700
- /* the icon keeps its size, the pressable box grows around it */
701
- @media (pointer: coarse) {
702
- box-sizing: border-box;
703
- justify-content: center;
704
-
705
- min-width: 44px;
706
- min-height: 44px;
707
- }
708
- }
709
-
710
- ${W_}
711
-
712
- .playback-rate {
713
- .slider {
714
- width: 100%;
715
- }
716
- .options {
717
- display: grid;
718
- grid-template-columns: 1fr 1fr 1fr 1fr;
719
- align-items: center;
720
-
721
- padding: 8px 12px;
722
- /* four presets across a 180px popover leave targets 34px wide, so a finger gets two rows of two
723
- until the popover is wide enough for the row of four */
724
- @media (pointer: coarse) {
725
- grid-template-columns: 1fr 1fr;
726
- }
727
- @media (pointer: coarse) and (min-width: 768px) {
728
- grid-template-columns: 1fr 1fr 1fr 1fr;
729
- }
730
-
731
- > div {
732
- display: flex;
733
- align-items: center;
734
- border-radius: 4px;
735
-
736
- padding: 8px 6px;
737
- height: 100%;
738
- @media (pointer: coarse) {
739
- box-sizing: border-box;
740
- min-height: 44px;
741
- }
742
-
743
- cursor: pointer;
744
- :hover {
745
- background-color: rgba(255,255,255,.1);
746
- }
747
- }
748
- }
749
- }
750
-
751
- `,nv=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=Q(e=>e.audioTracks),r=Q(e=>e.selectedAudioTrack),i=Q(e=>e.selectAudioTrack),[a,o]=h(0),{open:s,toggle:c,containerRef:l,pending:u,failed:d,runSelect:f}=K_({onReset:()=>o(0)}),p=t=>{e.setPlaybackRate(t),o(0)},m=e=>{e!==void 0&&f(e,()=>i(e))},g=e=>()=>{o(e)};return y(`div`,{css:tv,ref:l,children:[F(N_,{id:`settings`,disabled:s,text:F(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:F(gg,{})}),toolTipText:F(`span`,{children:`Settings`})}),s&&a===0&&y(`div`,{className:`popover menu`,children:[n.length>1?y(`div`,{onClick:g(2),children:[F(`div`,{children:`Audio`}),F(`div`,{children:F(Hh,{})})]}):null,y(`div`,{onClick:g(1),children:[F(`div`,{children:`Playback speed`}),y(`div`,{children:[F(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),F(Hh,{})]})]})]}),s&&a===1&&y(`div`,{className:`popover playback-rate`,children:[y(`div`,{className:`back`,onClick:g(0),children:[F(Rh,{}),F(`span`,{children:`Playback speed`})]}),F(`div`,{className:`slider no-hover`,children:F(ev,{})}),y(`div`,{className:`options no-hover`,children:[F(`div`,{onClick:()=>p(.5),children:`0.5x`}),F(`div`,{onClick:()=>p(1),children:`1x`}),F(`div`,{onClick:()=>p(1.5),children:`1.5x`}),F(`div`,{onClick:()=>p(2),children:`2x`})]})]}),s&&a===2&&F(G_,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:g(0),pending:u,failed:d})]})},rv=D`
752
- /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
753
- which is the width of the player box, so it can be clamped to it. */
754
- position: static;
755
-
756
- .subtitles {
757
- /* the icon keeps its size, the pressable box grows around it */
758
- @media (pointer: coarse) {
759
- box-sizing: border-box;
760
- justify-content: center;
761
-
762
- min-width: 44px;
763
- min-height: 44px;
764
- }
765
- }
766
-
767
- ${W_}
768
- `,iv=()=>{let e=Q(e=>e.subtitleTracks),t=Q(e=>e.selectedSubtitleTrack),n=Q(e=>e.selectSubtitleTrack),r=Q(e=>e.subtitleOffLabel),{open:i,toggle:a,containerRef:o,pending:s,failed:c,runSelect:l}=K_();if(e.length===0)return null;let u=t!==void 0;return y(`div`,{css:rv,ref:o,children:[F(N_,{id:`subtitles`,disabled:i,text:F(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?F(B_,{className:`captions`}):F(V_,{className:`captions-off`})}),toolTipText:F(`span`,{children:`Subtitles`})}),i&&F(G_,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},av={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},ov=D`
769
- display: flex;
770
- align-items: center;
771
-
772
- padding: 16px 4px;
773
- margin: 0 2px;
774
- /* a finger needs a 44px band to press, so the padding grows while the track stays 3px */
775
- @media (pointer: coarse) {
776
- padding: 22px 4px;
777
- }
778
-
779
- cursor: pointer;
780
-
781
- > div {
782
- position: relative;
783
-
784
- background: #ccc;
785
- border-radius: 4px;
786
-
787
- width: 80px;
788
- height: 3px;
789
- /* the control bar has under 360px to fit every button once the slider is always open, so the
790
- track lends some of its length back on a phone and takes it again on anything wider */
791
- @media (pointer: coarse) {
792
- width: 64px;
793
- }
794
- @media (pointer: coarse) and (min-width: 768px) {
795
- width: 80px;
796
- }
797
- }
798
-
799
- .volume-handle {
800
- position: absolute;
801
- top: -3.5px;
802
-
803
- background: #ffffff;
804
- border-radius: 50%;
805
- transform: translateX(-50%);
806
- pointer-events: none;
807
-
808
- width: 10px;
809
- height: 10px;
810
- }
811
- `,sv=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=o(null),a=o(null),{handlers:s}=P_({ref:a,onChange:t}),c=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};m(()=>{let e=i.current;return e&&e.addEventListener(`wheel`,c,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,c)}},[e]);let l=e*100,u=b(()=>Math.round(r?0:E_(n)*100),[n,r]);return F(N_,{id:`volume-slider`,text:F(`div`,{ref:i,css:ov,...s,children:F(`div`,{ref:a,style:{background:`linear-gradient(to right,
812
- #fff 0% ${l}%,
813
- #3A3A3A ${l}% 100%
814
- )`},children:F(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:y(`div`,{className:`volume-value`,children:[u,`%`]})})},cv=D`
815
- position: relative;
816
- display: flex;
817
- align-items: center;
818
-
819
- .volume-slider-container {
820
- display: flex;
821
- align-items: center;
822
-
823
- width: 0;
824
- margin-right: 0;
825
- overflow: hidden;
826
- pointer-events: none;
827
-
828
- transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
829
- -webkit-transition: margin .2s cubic-bezier(0.4,0,1,1), width .2s cubic-bezier(0.4,0,1,1);
830
-
831
- .volume-slider-background {
832
- display: flex;
833
- flex-direction: row;
834
- align-items: center;
835
-
836
- border-radius: 4px;
837
-
838
- .volume-value {
839
- ${g_.bMedium.regular};
840
- color: #ffffff;
841
- }
842
- }
843
- }
844
-
845
- &:hover .volume-slider-container {
846
- width: calc(9 * var(--mp-unit));
847
-
848
- transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
849
- -webkit-transition: margin .2s cubic-bezier(0,0,0.2,1), width .2s cubic-bezier(0,0,0.2,1);
850
-
851
- pointer-events: auto;
852
- }
853
-
854
- /* a touch screen has no hover, so the slider stays open there and the button only mutes */
855
- @media (pointer: coarse) {
856
- /* auto, not a fixed rem: the container keeps overflow: hidden, so a narrower fixed width
857
- silently clips the track and makes the clipped part unhittable */
858
- .volume-slider-container,
859
- &:hover .volume-slider-container {
860
- width: auto;
861
-
862
- pointer-events: auto;
863
- }
864
-
865
- /* a 44px press target around an 18px icon, floored here because the control bar sets the
866
- padding at a higher specificity */
867
- .sound {
868
- /* border-box explicitly, since a consumer reset cannot be assumed */
869
- box-sizing: border-box;
870
- justify-content: center;
871
-
872
- min-width: 44px;
873
- min-height: 44px;
874
- }
875
- }
876
-
877
- `,lv=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=b(()=>E_(n),[n]);return y(`div`,{css:cv,children:[F(N_,{id:`sound`,text:F(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:F(r||n===0?Og:n<=.5?bg:wg,{size:18,color:`#fff`})}),toolTipText:F(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),F(`div`,{className:`volume-slider-container`,children:F(`div`,{className:`volume-slider-background`,children:F(sv,{value:r?0:i,onChange:e=>{t.setVolume(T_(e))}})})})]})},uv=.05,dv=5,fv=D`
878
- display: flex;
879
- flex-direction: column;
880
- gap: calc(0.4 * var(--mp-unit));
881
-
882
- .hint {
883
- opacity: 0.72;
884
- font-size: 0.9em;
885
- }
886
- `,pv=D`
887
- position: absolute;
888
- bottom: 0;
889
- width: 100%;
890
-
891
- background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.15) 70%, transparent 100%);
892
- transition: opacity 0.1s cubic-bezier(.4,0,1,1);
893
-
894
- .actions {
895
- display: flex;
896
- justify-content: space-between;
897
-
898
- /* repeated per breakpoint: nested at-rules are hoisted after the rule, so a shorthand inside a
899
- media query would override a longhand above it and silently drop the safe-area inset */
900
- padding: 6px calc(12px + env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
901
- @media (min-width: 768px) {
902
- padding: 8px calc(16px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px));
903
- }
904
- @media (min-width: 2560px) {
905
- padding: 8px calc(24px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
906
- }
907
-
908
- .left, .right {
909
- display: flex;
910
- align-items: center;
911
-
912
- button {
913
- display: flex;
914
- align-items: center;
915
-
916
- outline: none;
917
- border: none;
918
- background: none;
919
-
920
- svg {
921
- width: 18px;
922
- height: 18px;
923
- @media (min-width: 768px) {
924
- width: 24px;
925
- height: 24px;
926
- }
927
- @media (min-width: 2560px) {
928
- width: 28px;
929
- height: 28px;
930
- }
931
- }
932
-
933
- svg {
934
- stroke: #fff;
935
- }
936
-
937
- /* Reads as unavailable rather than absent, so the bar does not reflow when tracks land. */
938
- &:disabled {
939
- cursor: default;
940
- opacity: .4;
941
- }
942
- }
943
-
944
- .play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
945
- display: flex;
946
- align-items: center;
947
-
948
- height: 100%;
949
-
950
- border-radius: 4px;
951
- user-select: none;
952
-
953
- padding: 8px;
954
- @media (min-width: 768px) {
955
- padding: 8px 12px;
956
- }
957
- @media (min-width: 2560px) {
958
- padding: 8px 12px;
959
- }
960
- }
961
-
962
- .play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
963
- border-radius: 4px;
964
-
965
- padding: 8px;
966
- @media (min-width: 768px) {
967
- padding: 8px 12px;
968
- }
969
- @media (min-width: 2560px) {
970
- padding: 8px 12px;
971
- }
972
-
973
- cursor: pointer;
974
-
975
- :hover {
976
- background-color: ${av.hover};
977
- }
978
-
979
- /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
980
- window still has a mouse */
981
- @media (pointer: coarse) {
982
- /* border-box explicitly, since a consumer reset cannot be assumed */
983
- box-sizing: border-box;
984
- min-width: 44px;
985
- min-height: 44px;
986
- justify-content: center;
987
- }
988
- }
989
- }
990
-
991
- .left {
992
- .time {
993
- ${g_.bMedium.regular}
994
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
995
- }
996
- }
997
- .right {
998
- .picture-in-picture {
999
- img {
1000
- width: 22px;
1001
- height: 22px;
1002
- @media (min-width: 768px) {
1003
- width: 28px;
1004
- height: 28px;
1005
- }
1006
- @media (min-width: 2560px) {
1007
- width: 32px;
1008
- height: 32px;
1009
- }
1010
- }
1011
- }
1012
- }
1013
- }
1014
- `,mv=()=>{let e=Q(),t=Q(e=>e.paused),n=Q(e=>e.currentTime),r=Q(e=>e.duration),i=Q(e=>e.fullscreen),a=Q(e=>e.hideUI),o=Q(e=>e.togglePictureInPicture),s=Q(e=>e.pictureInPictureMode),c=Q(e=>e.burnedInSubtitles),l=Q(e=>e.subtitleTracks),u=Q(e=>e.requestSeek),[d,f]=h(null),g=s===`burn-in`,_=l.length>0,v=r>0&&n===r,b=p(({direction:t,stepSize:n})=>{let r=E_(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(T_(a)),o&&!e.muted&&e.toggleMuted()},[e]);m(()=>{let t=t=>u?u(t):e.seek(t),n=n=>{let r=n.target;if(r?.isContentEditable||/^(input|textarea|select)$/i.test(r?.tagName??``))return;let i=!0;if(n.key===`f`)e.toggleFullscreen();else if(n.key===`k`)e.togglePaused();else if(n.key===` `)e.togglePaused();else if(n.key===`m`)e.toggleMuted();else if(n.key===`ArrowUp`)b({direction:`up`,stepSize:uv});else if(n.key===`ArrowDown`)b({direction:`down`,stepSize:uv});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+dv,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-dv,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,b,u]);let x=p(e=>{e.preventDefault(),e.deltaY<0?b({direction:`up`,stepSize:uv}):b({direction:`down`,stepSize:uv})},[b]);return m(()=>{if(d)return d.addEventListener(`wheel`,x,{passive:!1}),()=>d.removeEventListener(`wheel`,x)},[d,x]),y(`div`,{css:pv,style:{...a?{opacity:`0`,pointerEvents:`none`}:{}},children:[F(L_,{}),y(`div`,{className:`actions`,children:[y(`div`,{className:`left`,children:[F(N_,{id:`play`,tooltipPlace:`top-start`,text:F(`button`,{className:`play`,type:`button`,onClick:()=>e.togglePaused(),"aria-label":v?`Replay`:t?`Play`:`Pause`,children:F(v?fg:t?cg:ig,{})}),toolTipText:F(`span`,{children:v?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),F(lv,{ref:f}),F(`div`,{className:`time`,children:O_(n,r)})]}),y(`div`,{className:`right`,children:[F(Q_,{}),F(iv,{}),F(nv,{}),o?F(N_,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:F(`button`,{className:`picture-in-picture`,type:`button`,onClick:o,disabled:g&&!_,"aria-label":g?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":g?c:void 0,children:g?F(c?H_:U_,{}):F(`img`,{src:R_,alt:``})}),toolTipText:y(`span`,{css:fv,children:[F(`span`,{className:`lead`,children:g?_?c?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),g&&_?F(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,F(N_,{id:`full-screen`,tooltipPlace:`top-end`,text:F(`button`,{className:`full-screen`,type:`button`,onClick:()=>e.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":i,children:F(i?eg:Xh,{})}),toolTipText:F(`span`,{children:i?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},hv=9e3,gv=D`
1015
- position: absolute;
1016
- inset: 0;
1017
- z-index: 2;
1018
- pointer-events: none;
1019
-
1020
- .card {
1021
- position: absolute;
1022
- /* Where Firefox draws its own toggle: right aligned, a little past the middle of the height. */
1023
- top: 52%;
1024
- right: calc(7 * var(--mp-unit));
1025
- transform: translateY(-50%);
1026
-
1027
- display: flex;
1028
- align-items: center;
1029
- gap: calc(1.2 * var(--mp-unit));
1030
-
1031
- max-width: min(calc(42 * var(--mp-unit)), 60%);
1032
- padding: calc(1.4 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
1033
- border-radius: calc(0.8 * var(--mp-unit));
1034
- background-color: rgba(20, 20, 22, 0.94);
1035
- box-shadow: 0 0 calc(2 * var(--mp-unit)) rgba(0, 0, 0, 0.6);
1036
-
1037
- opacity: 0;
1038
- transition: opacity 0.25s ease;
1039
- }
1040
-
1041
- &.show .card {
1042
- opacity: 1;
1043
- }
1044
-
1045
- .words {
1046
- display: flex;
1047
- flex-direction: column;
1048
- gap: calc(0.3 * var(--mp-unit));
1049
- }
1050
-
1051
- .title {
1052
- ${g_.bMedium.bold}
1053
- color: #fff;
1054
- }
1055
-
1056
- .body {
1057
- ${g_.bSmall.regular}
1058
- color: rgba(255, 255, 255, 0.75);
1059
- }
1060
-
1061
- /* Points at the edge the browser's control lives on, which is the whole message. */
1062
- .arrow {
1063
- flex: none;
1064
- font-size: calc(2.6 * var(--mp-unit));
1065
- line-height: 1;
1066
- color: #fff;
1067
- }
1068
- `,_v=()=>{let e=Q(e=>e.burnedInSubtitles),t=Q(e=>e.pictureInPictureMode),[n,r]=h(!1);return m(()=>{if(t!==`burn-in`||!e){r(!1);return}r(!0);let n=setTimeout(()=>r(!1),hv);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:F(`div`,{css:gv,className:n?`show`:``,role:`status`,children:y(`div`,{className:`card`,children:[y(`div`,{className:`words`,children:[F(`div`,{className:`title`,children:`Subtitles are in the picture`}),F(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),F(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},vv=3e3,yv=D`
1069
- position: absolute;
1070
- inset: 0;
1071
- z-index: 2;
1072
- /* Never eats a click: click-to-pause still reaches the video underneath, and an item that needs a
1073
- pointer (a tooltip anchor, a button) sets \`pointer-events: auto\` on itself. */
1074
- pointer-events: none;
1075
- /* visibility, not only opacity: an item that took pointer events back would otherwise stay
1076
- hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
1077
- not, and transitioning it holds the item on screen for the length of the fade. */
1078
- transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
1079
- `,bv=D`
1080
- position: relative;
1081
- background-color: black;
1082
- display: flex;
1083
- justify-content: center;
1084
- align-items: center;
1085
- height: 100%;
1086
- width: 100%;
1087
-
1088
- & > div:not(:last-of-type) {
1089
- position: absolute;
1090
- z-index: 2;
1091
- }
1092
-
1093
- canvas {
1094
- height: 100%;
1095
- width: 100%;
1096
- pointer-events: none;
1097
- position: absolute;
1098
- z-index: 1;
1099
- }
1100
-
1101
- .video, video {
1102
- height: 100%;
1103
- width: 100%;
1104
- background-color: black;
1105
- object-fit: contain;
1106
- }
1107
-
1108
- &.hide {
1109
- cursor: none;
1110
- }
1111
- `,xv=(e,t=``)=>i.toArray(e).flatMap((e,n)=>{let r=`${t}${d(e)&&e.key!=null?e.key:n}`;return d(e)&&e.type===j?xv(e.props.children,`${r}/`):[{key:r,item:e}]}),Sv=({ref:e,onVideoRef:t,onCanvasRef:n,overlay:r,controls:i,children:a})=>{let s=Q(),c=Q(e=>e.hideUI),l=Q(e=>e.setHideUI),u=o(void 0),d=o(`mouse`),f=o({x:-1,y:-1}),p=o(null);m(()=>()=>clearTimeout(u.current),[]);let h=t=>{p.current=t,typeof e==`function`?e(t):e&&(e.current=t)},g=()=>{if(d.current!==`mouse`)return!1;let{x:e,y:t}=f.current;if(!p.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&p.current.contains(n)&&!n.closest(`.video`)},_=()=>{if(g()){u.current=setTimeout(_,vv);return}l(!0)},v=()=>{l(!1),clearTimeout(u.current),u.current=setTimeout(_,vv)};return y(`div`,{css:bv,ref:h,onPointerMove:e=>{d.current=e.pointerType,e.pointerType===`mouse`&&(f.current={x:e.clientX,y:e.clientY},v())},onPointerDown:e=>{d.current=e.pointerType},onMouseOut:e=>{let t=e.relatedTarget;if(t&&e.currentTarget.contains(t))return;let{left:n,right:r,top:i,bottom:a}=e.currentTarget.getBoundingClientRect();e.clientX>=n&&e.clientX<r&&e.clientY>=i&&e.clientY<a||(clearTimeout(u.current),l(!0))},className:c?`hide`:``,children:[F(S_,{onCanvasRef:n}),xv(r).map(({key:e,item:t})=>F(`div`,{css:yv,style:{...c?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:F(mv,{}),F(_v,{}),y(`div`,{className:`video`,onClick:()=>{if(d.current===`mouse`){s.togglePaused();return}c?v():(clearTimeout(u.current),l(!0))},children:[t?F(`video`,{ref:t,playsInline:!0}):null,a]})]})},Cv=({options:e,children:t})=>{let n=`media`in e?e:null,r=n?null:e,{title:i}=e,{size:a,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:d,thumbnailsEnabled:f}=r??{},p=fc(),g=pc(),[_,v]=h(null),[y,b]=h(null),x=n?.media??_;m(()=>(p?.(x),()=>p?.(null)),[x,p]);let{expose:S}=e,C=S===!0?{}:S||void 0,w=o(C);w.current=C;let T=C?C.id:void 0,E=C?C.origin:void 0,D=C?C.channel:void 0;m(()=>{if(!S||!x)return;let e,t=!1;return R(async()=>{let{exposePlayer:e}=await import(`./remote-VQoP8ehb.js`);return{exposePlayer:e}},__vite__mapDeps([0,1,2]),import.meta.url).then(({exposePlayer:n})=>{t||(e=n(x,w.current??{}))}).catch(()=>{}),()=>{t=!0,e?.()}},[x,!!S,T,E,D]),d_(_,y,r);let O=m_({publicPath:c,workerUrl:l,length:f===!1?void 0:a,read:d??u,downloadedRanges:s}),k=n?.thumbnails?.all??O,{toggle:A,mode:j,burnedIn:ee}=h_(_,y),M=Q(e=>e.setSourceState);m(()=>{M({title:i,size:a,downloadedRanges:s})},[M,i,a,s]);let N=n?.thumbnails?.at;m(()=>{M({thumbnails:k,thumbnailAt:N,togglePictureInPicture:A,pictureInPictureMode:j,burnedInSubtitles:ee})},[M,k,N,A,j,ee]);let P=n?.subtitles?.selection,I=n?.audioTracks?.selection;return m(()=>{P&&M({subtitleTracks:P.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:P.selectedId??void 0,selectSubtitleTrack:e=>P.select(e==null?null:String(e)),subtitleOffLabel:P.offLabel})},[M,P]),m(()=>{I&&M({audioTracks:I.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:I.selectedId??void 0,selectAudioTrack:e=>I.select(String(e))})},[M,I]),F(Sv,{ref:g,onVideoRef:n?void 0:v,onCanvasRef:b,overlay:e.overlay,controls:e.controls,children:t})},wv=D`
1112
- /**
1113
- * The chrome's whole scale, in one place.
1114
- *
1115
- * Everything inside is sized against this rather than against \`rem\`, because \`rem\` is root
1116
- * relative and a library cannot own the host page's root font. The old contract was that the host
1117
- * set \`html { font-size: 62.5% }\`, which silently rendered every control 1.6x too large in any app
1118
- * that did not, and could not be met by an app whose own screens are sized against the default.
1119
- * Override it on the player element to rescale the whole chrome.
1120
- */
1121
- --mp-unit: 10px;
1122
-
1123
- /**
1124
- * The chrome's own typeface, for exactly the reason the unit above exists.
1125
- *
1126
- * \`font-family\` inherits, and this library declared it nowhere, so every label drew in whatever the
1127
- * embedding document happened to set, and in the UA's serif where it set nothing. Not hypothetical:
1128
- * stub mounts the player in a second document, \`embed.html\`, which sets no font and loads no face,
1129
- * and the entire settings menu came out in Times New Roman.
1130
- *
1131
- * Named faces only, no bundled webfont. The chrome is a handful of short labels, so a font request
1132
- * on the critical path of a document whose job is to paint video buys a round trip and a flash of
1133
- * unstyled text for nothing.
1134
- *
1135
- * Read through \`var()\` so a host with a brand face sets \`--mp-font-family\` on any ancestor and it
1136
- * inherits in. A bare \`font-family\` on the host can no longer reach the chrome: this declaration is
1137
- * on the player element itself and beats anything inherited.
1138
- */
1139
- font-family: var(
1140
- --mp-font-family,
1141
- system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
1142
- 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji'
1143
- );
1144
-
1145
- /**
1146
- * The chrome's default ink, same argument again.
1147
- *
1148
- * Most text here names its own colour, but the two time readouts do not: the elapsed/duration pair
1149
- * and the seekbar's hover time carry a font token and a black text-shadow and nothing else.
1150
- * Inherited from a host that declares none that resolves to \`canvastext\`, which is black text under
1151
- * a black halo on a dark gradient.
1152
- */
1153
- color: #fff;
1154
-
1155
- /**
1156
- * The settings menu scrolls, and a UA that has not been told the surface is dark paints that
1157
- * scrollbar in its light theme: a white track down the side of a #1c1c1c menu. Declared here rather
1158
- * than asked of the host, so it reaches the menu and nothing outside the player.
1159
- */
1160
- color-scheme: dark;
1161
-
1162
- /**
1163
- * The other half of owning the chrome's own scale.
1164
- *
1165
- * Every control here is authored against a border box, which this library's dev app sets globally
1166
- * and a host page has no reason to. Shipped without it, anything that is \`width: 100%\` AND carries
1167
- * padding overflows its own box: the top bar ran 32px past the player and clipped the right end of
1168
- * whatever the app had put there. Scoped to the player's subtree so it cannot reach the host's
1169
- * layout, and only \`box-sizing\`, because zeroing margins here would reach the app's own content.
1170
- */
1171
- &, & *, & *::before, & *::after {
1172
- box-sizing: border-box;
1173
- }
1174
-
1175
- display: flex;
1176
- justify-content: center;
1177
- background-color: #111;
1178
- height: 100%;
1179
- width: 100%;
1180
- overflow: hidden;
1181
- `,Tv=e=>F(`div`,{css:wv,children:F(t_.Provider,{children:F(Cv,{options:e,children:e.children})})}),Ev=`[data-testid="track-selection-button"]`,Dv=`[data-testid="audio-text-track-menu"]`,Ov=`.timeline-slider`,kv=`[role="menu"]`,Av=`[role="menuitemradio"]`,jv=1e4,Mv=2e4,Nv=5e3,Pv=100,Fv=`Opens Crunchyroll audio and subtitle choices.`,Iv=`Changes the Crunchyroll audio option you picked.`,Lv=`Changes the Crunchyroll subtitle option you picked.`,Rv=`Restores your place after changing Crunchyroll audio or subtitles.`,zv=/^(off|none|disabled)$/i,Bv=e=>new Promise(t=>setTimeout(t,e)),Vv=()=>!1,Hv=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Uv=(e,t)=>e.locator(Dv).locator(kv).nth(t===`audio`?0:1),Wv=e=>e.replace(/\s+/g,` `).trim(),Gv=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Wv(e.label)})).filter(e=>e.label).map(e=>[e.id,e])).values()],r=n.find(e=>e.selected);if(!r)return;let i=e===`subtitles`?n.find(e=>zv.test(e.label)):void 0,a=n.filter(e=>e!==i).map(e=>({id:e.id,label:e.label,disabled:e.disabled||void 0}));if(!(a.length<2&&!i)&&a.length)return{options:a,selectedId:r===i?null:r.id,...i?{offLabel:i.label}:{}}},Kv=async(e,t)=>{Hv(t);let n=e.locator(Dv);if(await n.exists({timeout:1e3})){Hv(t);return}Hv(t),await e.locator(Ev).click({timeout:jv,reason:Fv});let r=Date.now()+jv;for(;Date.now()<r;){if(Hv(t),await n.exists({timeout:1e3}))return;await Bv(Pv)}throw Error(`Crunchyroll track menu did not open`)},qv=async(e,t,n)=>{Hv(n);let r=Uv(e,t).locator(Av),i=await r.count({timeout:1e3});Hv(n);let a=await Promise.all(Array.from({length:i},async(e,t)=>{Hv(n);let i=r.nth(t),[a,o,s]=await Promise.all([i.getAttribute(`aria-label`,{timeout:1e3}),i.getAttribute(`aria-checked`,{timeout:1e3}),i.getAttribute(`aria-disabled`,{timeout:1e3})]);return{label:Wv(a??``),index:t,selected:o===`true`,disabled:s===`true`}})),o=new Map;for(let e of a)o.set(e.label,(o.get(e.label)??0)+1);let s=new Map;return a.map(e=>{let t=(s.get(e.label)??0)+1;return s.set(e.label,t),{...e,id:o.get(e.label)===1?e.label:`${e.label}#${t}`}})},Jv=async(e,t)=>{let[n,r]=await Promise.all([qv(e,`audio`,t),qv(e,`subtitles`,t)]);return{audio:Gv(`audio`,n),subtitles:Gv(`subtitles`,r)}},Yv=async(e,t=Vv)=>(await Kv(e,t),Jv(e,t)),Xv=async(e,t,n,r)=>(await qv(e,t,r)).find(e=>n===null?zv.test(e.label):e.id===n)?.index??-1,Zv=async(e,t,n,r)=>{let i=Date.now()+Mv;for(;Date.now()<i;){Hv(r),await Kv(e,r);let i=(await qv(e,t,r)).find(e=>e.selected);if(i&&(n===null?zv.test(i.label):i.id===n))return;await Bv(Pv)}throw Error(`Crunchyroll did not apply the ${t} option`)},Qv=(e,t)=>{let n=Number.isFinite(e)?Math.max(0,e):0;return!Number.isFinite(t)||t<=0?n:Math.min(n,Math.max(0,t-.1))},$v=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),ey=(e,t,n=Rv)=>e.locator(Ov).fill(String(t),{timeout:Mv,reason:n}),ty=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Hv(n),!(e.currentSrc!==t||e.readyState<2));)await Bv(Pv);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Mv;for(;Date.now()<i;){if(Hv(n),e.readyState>=2)return!0;await Bv(Pv)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},ny=async(e,t,n,r)=>{Hv(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=Qv(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await ey(e,i);let a=Date.now()+Mv;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Hv(r),await Bv(Pv);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Hv(r),n.paused?t.pause():await t.play();let o=Date.now()+Nv;for(;Date.now()<o&&t.paused!==n.paused;)Hv(r),await Bv(Pv);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},ry=async(e,t,n,r,i=Vv)=>{await Kv(e,i);let a=await Xv(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Hv(i);let o=t.currentSrc,s=$v(t);return await Uv(e,n).locator(Av).nth(a).click({timeout:jv,reason:n===`audio`?Iv:Lv}),await Zv(e,n,r,i),await ty(t,o,i)&&await ny(e,t,s,i),Yv(e,i)},iy=`Seeks the video to the point you pick on the timeline.`,ay=(e,t)=>{ey(e,t,iy).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},oy=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&ay(t,r),Reflect.set(e,n,r,i)}}),sy=({remote:e,frame:t,subtitles:n,audioTracks:r,children:i})=>{let a=b(()=>e&&t?oy(e,t):null,[e,t]);return F(Tv,{expose:!0,media:a,subtitles:n,audioTracks:r,children:i})};l();var cy=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],ly=`
1182
- html, body {
1183
- margin: 0 !important;
1184
- padding: 0 !important;
1185
- width: 100% !important;
1186
- height: 100% !important;
1187
- background: #000 !important;
1188
- }
1189
- *:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
1190
- display: none !important;
1191
- }
1192
- div[data-testid="player-controls-root"] {
1193
- display: none !important;
1194
- }
1195
- .video-player-wrapper,
1196
- .video-player,
1197
- .player-container,
1198
- .video-player-wrapper > *,
1199
- .video-player > *,
1200
- .player-container > * {
1201
- position: absolute !important;
1202
- inset: 0 !important;
1203
- width: 100% !important;
1204
- height: 100% !important;
1205
- z-index: 9999999;
1206
- }
1207
- .video-player-wrapper video,
1208
- .video-player video,
1209
- .player-container video {
1210
- width: 100% !important;
1211
- height: 100% !important;
1212
- object-fit: contain !important;
1213
- }
1214
- .video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
1215
- display: none !important;
1216
- }
1217
- .timeline-container,
1218
- .timeline-container *,
1219
- .timeline-slider {
1220
- opacity: 0 !important;
1221
- pointer-events: none !important;
1222
- }
1223
- `,uy=`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:`noaihdevm_6iyg0a8l0q`,redirect_uri:`https://www.crunchyroll.com/callback`,response_type:`cookie`,state:`/`})}`,dy=3e4,fy=async()=>L()?`extension`:(document.readyState!==`complete`&&await new Promise(e=>{let t=()=>{clearTimeout(n),e()},n=setTimeout(()=>{window.removeEventListener(`load`,t),e()},1e4);window.addEventListener(`load`,t,{once:!0})}),await new Promise(e=>setTimeout(e,300)),L()?`extension`:`cloud`),py=async(e,t)=>{let n=Date.now()+dy;for(;!t()&&Date.now()<n;){if(await e.locator(`.shell-header`).exists()){await new Promise(e=>setTimeout(e,100));continue}if(t())throw Error(`Login state check timed out`);let[n,r]=await Promise.all([e.locator(`#user-menu-anonymous`).exists(),e.locator(`#user-menu-authenticated`).exists()]);if(r||n)return{isLoggedIn:r,isLoggedOut:n};await new Promise(e=>setTimeout(e,100))}throw Error(`Login state check timed out`)},my=3e4,hy=async(e,t)=>{let n=Date.now()+my;for(;!t()&&Date.now()<n;){try{if(await e.locator(`video`).exists())return t()?null:await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,100))}return null},gy=D`
1224
- position: relative;
1225
- width: 100%;
1226
- height: 100%;
1227
- background: #000;
1228
- /* The double-tap-to-fullscreen gesture otherwise word-selects the
1229
- skin's labels/time readouts, flashing them blue. Player chrome isn't
1230
- meant to be selected, so suppress it across the whole player. */
1231
- user-select: none;
1232
- -webkit-user-select: none;
1233
-
1234
- .cr-frame {
1235
- position: absolute;
1236
- inset: 0;
1237
- width: 100%;
1238
- height: 100%;
1239
- border: none;
1240
- background: #000;
1241
- /* CR's own chrome is hidden, so the iframe must not swallow clicks -
1242
- taps belong to the videojs gesture layer stacked above it. */
1243
- pointer-events: none;
1244
- }
1245
-
1246
- .overlay {
1247
- position: absolute;
1248
- inset: 0;
1249
- display: flex;
1250
- flex-direction: column;
1251
- align-items: center;
1252
- justify-content: center;
1253
- gap: 1.6rem;
1254
- background: #000;
1255
- font-size: 1.4rem;
1256
- color: rgba(255, 255, 255, 0.8);
1257
- /* Above the skin's own layers (its controls/error dialog top out at
1258
- z-index 20) so the login/loading screen fully covers them. */
1259
- z-index: 30;
1260
- }
1261
-
1262
- .login-button {
1263
- padding: 0.8rem 2rem;
1264
- background: #f47521;
1265
- color: #fff;
1266
- border: none;
1267
- border-radius: 0.4rem;
1268
- font-size: 1.4rem;
1269
- font-weight: 600;
1270
- cursor: pointer;
1271
-
1272
- &:hover {
1273
- background: #e0651a;
1274
- }
1275
-
1276
- &:disabled {
1277
- opacity: 0.6;
1278
- cursor: default;
1279
- }
1280
- }
1281
-
1282
- .login-note {
1283
- max-width: 36rem;
1284
- font-size: 1.2rem;
1285
- text-align: center;
1286
- color: rgba(255, 255, 255, 0.6);
1287
- }
1288
- `,_y=({url:e})=>{let[t,n]=h(`detecting`),[r,i]=h(null),[a,s]=h(null),[c,l]=h(!0),[u,d]=h(!1),[f,g]=h(),[_,v]=h(null),[x,S]=h(0),[C,w]=h(0),[T,E]=h(!1),[D,k]=h(!1),A=o(null),j=o(null),[ee,M]=h(!1),N=o(!1),[P,I]=h(),R=o(0),te=o({generation:0,tail:Promise.resolve()}),ne=o(!0),re=p(()=>{let e=R.current+1;return R.current=e,te.current={generation:e,tail:Promise.resolve()},I(void 0),e},[]),ae=p((e,t)=>{if(te.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=te.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);m(()=>()=>{ne.current=!1,R.current+=1},[]),m(()=>{let e=!1;return fy().then(t=>{e||n(t)}),()=>{e=!0}},[]),m(()=>{if(!r||t===`detecting`)return;let e=!1;return ie({iframe:r,domains:cy,permissions:[{category:`interaction`,reason:`Control the Crunchyroll player from this app`},{category:`storage`,reason:`Read the audio and subtitle track names`}]}).then(r=>{if(e)return;let i=L()?`extension`:`cloud`;if(i!==t){n(i);return}s(r)}).catch(t=>{e||(console.error(`Failed to attach Crunchyroll frame`,t),g(t?.message||`Failed to load player`),l(!1))}),()=>{e=!0}},[r,t]),m(()=>{if(!a)return;let n=!1,r=()=>n;return l(!0),g(void 0),d(!1),v(null),re(),(async()=>{if(t===`cloud`){if(await a.goto(e,{waitUntil:`load`}),n)return;let{isLoggedIn:t}=await py(a,r);if(n)return;if(!t){l(!1),d(!0);return}if(await a.addStyleTag({content:ly}),n)return;let i=await hy(a,r);if(n)return;if(l(!1),!i)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);v(i);return}if(await a.goto(e,{waitUntil:`documentstart`}),n||(await a.addStyleTag({content:ly}),n))return;let{isLoggedIn:i}=await py(a,r);if(n)return;if(!i){l(!1),d(!0);return}let o=await hy(a,r);if(!n){if(l(!1),!o)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);v(o)}})().catch(e=>{n||(console.error(`Failed to load Crunchyroll player`,e),g(e?.message||`Failed to load player`),l(!1))}),()=>{n=!0}},[a,e,x,t,re]),m(()=>{if(!a||!_)return;let e=re(),t=!1,n=()=>t||!ne.current||e!==R.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await ae(e,()=>Yv(a,n)),t=void 0,n()||(I(r),r.audio&&r.subtitles))return}catch(e){t=e}await new Promise(e=>setTimeout(e,500))}if(!r&&t)throw t})().then(()=>{},e=>{n()||console.warn(`[cr] track discovery failed:`,e)}),()=>{t=!0}},[a,_,re,ae]);let z=R.current,se=p((e,t)=>{if(!a||!_)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!ne.current||z!==R.current;return ae(z,async()=>{try{let r=await ry(a,_,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);I(r)}catch(e){if(!n())try{let e=await Yv(a,n);n()||I(e)}catch{}throw e}})},[a,_,ae,z]),ce=b(()=>P?.subtitles&&{selection:{...P.subtitles,select:e=>se(`subtitles`,e)}},[P?.subtitles,se]),le=b(()=>P?.audio&&{selection:{...P.audio,select:e=>se(`audio`,e)}},[P?.audio,se]),ue=p(()=>{if(A.current!==null)return;let e=globalThis.open(uy,`_blank`,`width=500,height=700`);if(!e){k(!0),l(!1);return}k(!1),E(!0),j.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),A.current===t&&(A.current=null),j.current===e&&(j.current=null),E(!1),S(e=>e+1))},500);A.current=t},[]),de=p(()=>{if(N.current)return;N.current=!0;let e=oe({url:uy,domains:cy,isSignedIn:e=>e.locator(`#user-menu-authenticated`).exists()});k(!1),M(!0),e.then(e=>{if(ne.current){if(e===`blocked`){k(!0);return}if(e===`unsupported`){g(`The Crunchyroll sign-in window could not be opened here.`);return}d(!1),l(!0),S(e=>e+1)}},e=>{ne.current&&(console.error(`Crunchyroll sign-in window failed`,e),g(e?.message||`The sign-in window failed`))}).finally(()=>{N.current=!1,ne.current&&M(!1)})},[]);m(()=>()=>{A.current!==null&&(clearInterval(A.current),A.current=null)},[]),m(()=>{A.current!==null&&(clearInterval(A.current),A.current=null,E(!1)),k(!1)},[e]);let fe=p(()=>{j.current!==null&&(j.current.close(),j.current=null),A.current!==null&&(clearInterval(A.current),A.current=null),s(null),g(void 0),v(null),re(),d(!1),k(!1),E(!1),l(!0),w(e=>e+1)},[re]),pe=(c||f||D||u)&&y(`div`,{className:`overlay`,children:[u&&!f&&!D&&y(O,{children:[`You need to be logged in to Crunchyroll to watch this content.`,t===`extension`?F(`button`,{className:`login-button`,onClick:ue,disabled:T,children:T?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):y(O,{children:[F(`button`,{className:`login-button`,onClick:de,disabled:ee,children:ee?`Finish signing in the window...`:`Sign in to Crunchyroll`}),F(`span`,{className:`login-note`,children:`Sign-in happens in a window served through FKN, so your browser will not autofill saved passwords or offer passkeys there.`})]})]}),D&&!f&&y(O,{children:[`The login popup was blocked. Allow popups for this page and try again.`,F(`button`,{className:`login-button`,onClick:t===`extension`?ue:de,children:`Open Crunchyroll Login Page`})]}),f&&y(O,{children:[f,F(`button`,{className:`login-button`,onClick:fe,children:`Retry`})]}),c&&!f&&!u&&`Loading Crunchyroll player...`]});return y(`div`,{css:gy,children:[t!==`detecting`&&F(sy,{remote:_,frame:a,subtitles:ce,audioTracks:le,children:F(`iframe`,{ref:i,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${t}-${C}`)}),pe]})},vy=e=>e,yy=vy(({className:e,children:t})=>F(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),by=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`m14.051 10.723-7.985 4.964a1.98 1.98 0 0 1-2.758-.638A2.06 2.06 0 0 1 3 13.964V4.036C3 2.91 3.895 2 5 2c.377 0 .747.109 1.066.313l7.985 4.964a2.057 2.057 0 0 1 .627 2.808c-.16.257-.373.475-.627.637`})})),xy=vy(({className:e})=>y(yy,{className:e,children:[F(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),F(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Sy=vy(({className:e})=>y(yy,{className:e,children:[F(`path`,{fill:`currentColor`,d:`M9 17a8 8 0 0 1-8-8h2a6 6 0 1 0 1.287-3.713l1.286 1.286A.25.25 0 0 1 5.396 7H1.25A.25.25 0 0 1 1 6.75V2.604a.25.25 0 0 1 .427-.177l1.438 1.438A8 8 0 1 1 9 17`}),F(`path`,{fill:`currentColor`,d:`m11.61 9.639-3.331 2.07a.826.826 0 0 1-1.15-.266.86.86 0 0 1-.129-.452V6.849C7 6.38 7.374 6 7.834 6c.158 0 .312.045.445.13l3.331 2.071a.858.858 0 0 1 0 1.438`})]})),Cy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M1 9c0 2.21.895 4.21 2.343 5.657l1.414-1.414a6 6 0 1 1 8.956-7.956l-1.286 1.286a.25.25 0 0 0 .177.427h4.146a.25.25 0 0 0 .25-.25V2.604a.25.25 0 0 0-.427-.177l-1.438 1.438A8 8 0 0 0 1 9`})})),wy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752M14.5 7.586l-1.768-1.768a1 1 0 1 0-1.414 1.414L13.085 9l-1.767 1.768a1 1 0 0 0 1.414 1.414l1.768-1.768 1.768 1.768a1 1 0 0 0 1.414-1.414L15.914 9l1.768-1.768a1 1 0 0 0-1.414-1.414z`})})),Ty=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})})),Ey=vy(({className:e})=>y(yy,{className:e,children:[F(`path`,{fill:`currentColor`,d:`M15.6 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4C15.4 5.9 16 7.4 16 9s-.6 3.1-1.8 4.3c-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7`}),F(`path`,{fill:`currentColor`,d:`M.714 6.008h3.072l4.071-3.857c.5-.376 1.143 0 1.143.601V15.28c0 .602-.643.903-1.143.602l-4.071-3.858H.714c-.428 0-.714-.3-.714-.752V6.76c0-.451.286-.752.714-.752m10.568.59a.91.91 0 0 1 0-1.316.91.91 0 0 1 1.316 0c1.203 1.203 1.47 2.216 1.522 3.208q.012.255.011.51c0 1.16-.358 2.733-1.533 3.803a.7.7 0 0 1-.298.156c-.382.106-.873-.011-1.018-.156a.91.91 0 0 1 0-1.316c.57-.57.995-1.551.995-2.487 0-.944-.26-1.667-.995-2.402`})]})),Dy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M9.57 3.617A1 1 0 0 0 8.646 3H4c-.552 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1 1 1 0 0 0 .706-.293l4.647-4.647a1 1 0 0 0 .216-1.089m4.812 4.812a1 1 0 0 0-1.089.217l-4.647 4.647a.998.998 0 0 0 .708 1.706H14c.552 0 1-.449 1-1V9.353a1 1 0 0 0-.618-.924`})})),Oy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M7.883 1.93a.99.99 0 0 0-1.09.217L2.146 6.793A.998.998 0 0 0 2.853 8.5H7.5c.551 0 1-.449 1-1V2.854a1 1 0 0 0-.617-.924m7.263 7.57H10.5c-.551 0-1 .449-1 1v4.646a.996.996 0 0 0 1.001 1.001 1 1 0 0 0 .706-.293l4.646-4.646a.998.998 0 0 0-.707-1.707z`})})),ky=vy(({className:e})=>y(yy,{className:e,children:[F(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.035A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.035.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),F(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),F(`path`,{fill:`currentColor`,d:`M7.129 5.547a.6.6 0 0 0-.656.13L3.677 8.473A.6.6 0 0 0 4.102 9.5h2.796c.332 0 .602-.27.602-.602V6.103a.6.6 0 0 0-.371-.556`})]})),Ay=vy(({className:e})=>y(yy,{className:e,children:[F(`path`,{fill:`currentColor`,d:`M13 2a4 4 0 0 1 4 4v2.036A3.5 3.5 0 0 0 16.5 8H15V6.273C15 5.018 13.96 4 12.679 4H4.32C3.04 4 2 5.018 2 6.273v5.454C2 12.982 3.04 14 4.321 14H6v1.5q0 .255.036.5H4a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4z`}),F(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),F(`path`,{fill:`currentColor`,d:`M4.871 10.454a.6.6 0 0 0 .656-.131l2.796-2.796A.6.6 0 0 0 7.898 6.5H5.102a.603.603 0 0 0-.602.602v2.795a.6.6 0 0 0 .371.556`})]})),jy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M15 2a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3zM4 11a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2zM4 8a1 1 0 0 0 0 2h1a1 1 0 0 0 0-2zm4 0a1 1 0 0 0 0 2h3a1 1 0 1 0 0-2zm6 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2`})})),My=vy(({className:e})=>y(yy,{className:e,children:[F(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),F(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),F(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),F(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Ny=vy(({className:e})=>F(yy,{className:e,children:y(`g`,{fill:`currentColor`,children:[F(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:F(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),F(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:F(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),Py=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M9 2a1 1 0 0 1 1 1v12a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm4 3a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zM5 5a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zm8 4a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1zM5 9a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1z`})})),Fy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M3 5a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm0 4a1 1 0 0 1 1-1h10a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zm1 3a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2H4z`})})),Iy=vy(({className:e})=>F(yy,{className:e,children:F(`path`,{fill:`currentColor`,d:`M14.53 4.53a.75.75 0 0 0-1.06-1.06L7 9.94 4.53 7.47a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l7-7z`})}));l();var Ly=10,$=e=>e,Ry=$(fm.Root),zy=$(am),By=$(bm.Root),Vy=$(im.Popup),Hy=$(im.Title),Uy=$(im.Close),Wy=$(bm.Description),Gy=$(bh.Provider),Ky=$(bh.Root),qy=$(bh.Trigger),Jy=$(bh.Popup),Yy=$(Vm.Root),Xy=$(Vm.Trigger),Zy=$(Vm.Popup),Qy=$(jm),$y=$(Hm),eb=$(km),tb=$(Am),nb=$(xm),rb=$(Mm),ib=$(ah.Value),ab=$(ch.Root),ob=$(th.Track),sb=$(th.Fill),cb=$(th.Buffer),lb=$(th.Thumb),ub=$(th.Value),db=$(Ch.Root),fb=$(Dm),pb=$(Cm),mb=$(Od),hb=({className:e,...t})=>F(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),gb=({selection:e,icon:t})=>{let[n,r]=h(!1),[i,a]=h(!1),[o,s]=h(!1);m(()=>s(!1),[e.selectedId]);let c=[...e.offLabel?[{id:null,label:e.offLabel}]:[],...e.options],l=t=>{if(t===e.selectedId){r(!1);return}s(!1),a(!0),Promise.resolve().then(()=>e.onSelect(t)).then(()=>r(!1)).catch(t=>{console.warn(`[player] ${e.label} selection failed:`,t),s(!0)}).finally(()=>a(!1))};return y(Yy,{open:n,onOpenChange:e=>r(e),children:[F(Xy,{render:F(hb,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),F(Zy,{className:`media-surface media-popover media-popover--menu`,children:y(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[F(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return y(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":n,className:`stub-menu__item${n?` stub-menu__item--active`:``}`,disabled:i||`disabled`in t&&t.disabled,onClick:()=>l(t.id),children:[F(`span`,{className:`stub-menu__check`,children:n?F(Iy,{className:`media-icon`}):null}),F(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?F(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},_b=()=>y(Yy,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[F(Xy,{render:y(eb,{className:`media-button--mute`,render:F(hb,{}),children:[F(wy,{className:`media-icon media-icon--volume-off`}),F(Ty,{className:`media-icon media-icon--volume-low`}),F(Ey,{className:`media-icon media-icon--volume-high`})]})}),F(Zy,{className:`media-surface media-popover media-popover--volume`,children:y(db,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[F(ob,{className:`media-slider__track`,children:F(sb,{className:`media-slider__fill`})}),F(lb,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),vb=({capabilities:e,children:t,className:n,...r})=>y(mb,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,F(zy,{render:e=>F(`div`,{...e,className:`media-buffering-indicator`,children:F(`div`,{className:`media-surface`,children:F(Ny,{className:`media-icon`})})})}),F(By,{children:F(Vy,{className:`media-error`,children:y(`div`,{className:`media-error__dialog media-surface`,children:[y(`div`,{className:`media-error__content`,children:[F(Hy,{className:`media-error__title`,children:`Something went wrong.`}),F(Wy,{className:`media-error__description`})]}),F(`div`,{className:`media-error__actions`,children:F(Uy,{className:`media-button media-button--primary`,children:`OK`})})]})})}),F(Ry,{className:`media-surface media-controls`,children:y(Gy,{children:[y(`div`,{className:`media-button-group`,children:[y(Ky,{side:`top`,children:[F(qy,{render:y(Qy,{className:`media-button--play`,render:F(hb,{}),children:[F(Sy,{className:`media-icon media-icon--restart`}),F(by,{className:`media-icon media-icon--play`}),F(xy,{className:`media-icon media-icon--pause`})]})}),F(Jy,{className:`media-surface media-tooltip`})]}),y(Ky,{side:`top`,children:[F(qy,{render:F($y,{seconds:-10,className:`media-button--seek`,render:F(hb,{}),children:y(`span`,{className:`media-icon__container`,children:[F(Cy,{className:`media-icon media-icon--seek media-icon--flipped`}),F(`span`,{className:`media-icon__label`,children:Ly})]})})}),y(Jy,{className:`media-surface media-tooltip`,children:[`Seek backward `,Ly,` seconds`]})]}),y(Ky,{side:`top`,children:[F(qy,{render:F($y,{seconds:Ly,className:`media-button--seek`,render:F(hb,{}),children:y(`span`,{className:`media-icon__container`,children:[F(Cy,{className:`media-icon media-icon--seek`}),F(`span`,{className:`media-icon__label`,children:Ly})]})})}),y(Jy,{className:`media-surface media-tooltip`,children:[`Seek forward `,Ly,` seconds`]})]})]}),y(`div`,{className:`media-time-controls`,children:[F(ib,{type:`current`,className:`media-time`}),y(ab,{className:`media-slider`,children:[y(ob,{className:`media-slider__track`,children:[F(sb,{className:`media-slider__fill`}),F(cb,{className:`media-slider__buffer`})]}),F(lb,{className:`media-slider__thumb`}),F(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:F(ub,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),F(ib,{type:`duration`,className:`media-time`})]}),y(`div`,{className:`media-button-group`,children:[y(Ky,{side:`top`,children:[F(qy,{render:F(rb,{className:`media-button--playback-rate`,render:F(hb,{})})}),F(Jy,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),F(_b,{}),e?.subtitles&&F(gb,{selection:e.subtitles,icon:e.subtitles.selectedId?F(jy,{className:`media-icon`}):F(My,{className:`media-icon`})},`subtitles`),e?.audioTracks&&F(gb,{selection:e.audioTracks,icon:F(Py,{className:`media-icon`})},`audio`),e?.qualityLevels&&F(gb,{selection:e.qualityLevels,icon:F(Fy,{className:`media-icon`})},`quality`),y(Ky,{side:`top`,children:[F(qy,{render:y(tb,{className:`media-button--pip`,render:F(hb,{}),children:[F(ky,{className:`media-icon media-icon--pip-enter`}),F(Ay,{className:`media-icon media-icon--pip-exit`})]})}),F(Jy,{className:`media-surface media-tooltip`})]}),y(Ky,{side:`top`,children:[F(qy,{render:y(nb,{className:`media-button--fullscreen`,render:F(hb,{}),children:[F(Dy,{className:`media-icon media-icon--fullscreen-enter`}),F(Oy,{className:`media-icon media-icon--fullscreen-exit`})]})}),F(Jy,{className:`media-surface media-tooltip`})]})]})]})}),F(`div`,{className:`media-overlay`}),F(fb,{keys:`Space`,action:`togglePaused`}),F(fb,{keys:`k`,action:`togglePaused`}),F(fb,{keys:`m`,action:`toggleMuted`}),F(fb,{keys:`f`,action:`toggleFullscreen`}),F(fb,{keys:`i`,action:`togglePictureInPicture`}),F(fb,{keys:`ArrowRight`,action:`seekStep`,value:5}),F(fb,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),F(fb,{keys:`l`,action:`seekStep`,value:10}),F(fb,{keys:`j`,action:`seekStep`,value:-10}),F(fb,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),F(fb,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),F(fb,{keys:`0-9`,action:`seekToPercent`}),F(fb,{keys:`Home`,action:`seekToPercent`,value:0}),F(fb,{keys:`End`,action:`seekToPercent`,value:100}),F(fb,{keys:`>`,action:`speedUp`}),F(fb,{keys:`<`,action:`speedDown`}),F(pb,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),F(pb,{type:`tap`,action:`toggleControls`,pointer:`touch`}),F(pb,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),F(pb,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),F(pb,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});l();var{Provider:yb}=Ad({features:Fu}),bb=e=>`media`in e?e:{media:e},xb=({remote:e,frame:t,adapter:n})=>{let r=fc();return m(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=bb(i);r(a.media);let o=ae(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},Sb=D`
1289
- position: absolute;
1290
- inset: 0;
1291
- border-radius: 0.8rem;
1292
- background: transparent !important;
1293
- &.media-default-skin--video {
1294
- background: transparent !important;
1295
- }
1296
-
1297
- .media-popover--menu {
1298
- padding: 0.4rem;
1299
- }
1300
-
1301
- /**
1302
- * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
1303
- *
1304
- * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
1305
- * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
1306
- * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
1307
- * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
1308
- * their specificity would just move the race to insertion order.
1309
- */
1310
- .stub-menu {
1311
- display: flex;
1312
- flex-direction: column;
1313
- min-width: 18rem;
1314
- max-height: 32rem;
1315
- overflow-y: auto;
1316
- }
1317
- .stub-menu__heading {
1318
- padding: 0.6rem 1rem 0.4rem;
1319
- font-size: 1.1rem;
1320
- font-weight: 600;
1321
- letter-spacing: 0.04em;
1322
- text-transform: uppercase;
1323
- opacity: 0.6;
1324
- }
1325
- .stub-menu__item {
1326
- display: flex;
1327
- align-items: center;
1328
- gap: 0.6rem;
1329
- width: 100%;
1330
- padding: 0.6rem 1rem;
1331
- border: none;
1332
- border-radius: 0.4rem;
1333
- background: transparent;
1334
- color: inherit;
1335
- font-size: 1.3rem;
1336
- text-align: left;
1337
- cursor: pointer;
1338
-
1339
- &:hover:not(:disabled) {
1340
- background: rgba(255, 255, 255, 0.12);
1341
- }
1342
- &:disabled {
1343
- opacity: 0.5;
1344
- cursor: default;
1345
- }
1346
- }
1347
- .stub-menu__check {
1348
- display: inline-flex;
1349
- width: 1.6rem;
1350
- flex: none;
1351
- }
1352
- .stub-menu__label {
1353
- flex: 1;
1354
- }
1355
- .stub-menu__description {
1356
- opacity: 0.6;
1357
- font-size: 1.1rem;
1358
- }
1359
- .media-button--error {
1360
- color: #f66;
1361
- }
1362
- `,Cb=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>y(yb,{children:[F(xb,{remote:e,frame:t,adapter:n}),F(vb,{capabilities:r,css:Sb,children:i})]}),wb=`[data-uia="timeline"]`,Tb=`[data-uia="video-canvas"]`,Eb=`[data-uia="player"]`,Db=`Seeks the video to the point you pick on the timeline.`,Ob=`Reveals the player controls so the timeline can be used.`,kb=140,Ab=2,jb=12e3,Mb=26,Nb=110,Pb={"still-watching":`[data-uia="interrupt-autoplay-continue"], [data-uia="interrupter-title"]`,"next-episode":`[data-uia="next-episode-seamless-button"], [data-uia="next-episode-seamless-button-draining"]`,error:`[data-uia="error-container"], [data-uia="nfp-error"]`},Fb=e=>new Promise(t=>setTimeout(t,e)),Ib=e=>e<0?0:e>1?1:e,Lb=0,Rb=()=>{let e=Lb*1.1;return Lb++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},zb=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Tb).ensure(`hover`,{reason:Ob}),t.locator(Eb).ensure(`hover`,{reason:Ob}),t.locator(wb).ensure(`click`,{reason:Db})])}catch(e){a=!1,console.warn(`[nf] permission request failed:`,e)}}},s=()=>{if(n==null)return;let t=e.currentTime;Number.isFinite(t)&&Math.abs(t-n)<Ab&&(n=null,i&&clearTimeout(i))};e.addEventListener(`timeupdate`,s);let c=async n=>{let r=e.duration;if(!Number.isFinite(r)||r<=0){console.warn(`[nf] seek: duration unknown`,r);return}let i=Ib(n/r);o();let a=t.locator(wb),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<Mb;e++){if(e%2==0&&(await t.locator(Tb).hover({position:Rb(),reason:Ob}).catch(()=>{}),await t.locator(Eb).hover({position:Rb(),reason:Ob}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await Fb(Nb)}if(!c){let n=await Promise.all(Object.entries(Pb).map(async([e,n])=>await t.locator(n).exists().catch(()=>!1)?e:``)).then(e=>e.filter(Boolean).join(`, `)).catch(()=>``);if(console.warn(`[nf] seek aborted: controls never revealed${n?` (blocked by ${n})`:``}`),s)try{await e.pause()}catch{}return}if(await a.click({position:{x:i,y:.5},reason:Db}).catch(e=>console.warn(`[nf] timeline click failed:`,e?.message??e)),s)try{await e.pause()}catch{}};return{media:new Proxy(e,{get(e,t,r){return t===`currentTime`&&n!=null?n:Reflect.get(e,t,r)},set(e,t,a,o){return t===`currentTime`&&typeof a==`number`&&Number.isFinite(a)?(n=a,r&&clearTimeout(r),r=setTimeout(()=>{c(a).catch(e=>console.warn(`[nf] timeline seek failed:`,e))},kb),i&&clearTimeout(i),i=setTimeout(()=>{n=null},jb),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},Bb=({remote:e,frame:t,capabilities:n,children:r})=>F(Cb,{remote:e,frame:t,adapter:zb,capabilities:n,children:r});l();var Vb=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],Hb=`https://www.netflix.com/login`,Ub=`
1363
- html, body {
1364
- margin: 0 !important;
1365
- padding: 0 !important;
1366
- width: 100% !important;
1367
- height: 100% !important;
1368
- overflow: hidden !important;
1369
- background: #000 !important;
1370
- }
1371
- /* Truly-unwanted chrome - collapse it entirely. */
1372
- .watch-video--evidence-overlay-container,
1373
- .watch-video--skip-content,
1374
- .watch-video--nextEpisode-seamless-button,
1375
- .watch-video--back-container,
1376
- [data-uia="player-back-to-browse"],
1377
- [data-uia="control-nav-back"],
1378
- [data-uia="control-flag"] {
1379
- display: none !important;
1380
- pointer-events: none !important;
1381
- }
1382
- /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
1383
- [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
1384
- display:none here, or the scrubber loses its box and the seek no-ops - mirrors
1385
- Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
1386
- [data-uia="controls-standard"],
1387
- .watch-video--bottom-controls-container,
1388
- .PlayerControlsNeo__layout,
1389
- .PlayerControlsNeo__core-controls,
1390
- .PlayerControlsNeo__button-control-row {
1391
- opacity: 0 !important;
1392
- pointer-events: none !important;
1393
- }
1394
- [data-uia="timeline"],
1395
- [data-uia="timeline"] * {
1396
- pointer-events: auto !important;
1397
- }
1398
- .watch-video,
1399
- [data-uia="video-canvas"] {
1400
- position: fixed !important;
1401
- inset: 0 !important;
1402
- width: 100% !important;
1403
- height: 100% !important;
1404
- z-index: 9999999 !important;
1405
- }
1406
- .watch-video video,
1407
- [data-uia="video-canvas"] video {
1408
- width: 100% !important;
1409
- height: 100% !important;
1410
- object-fit: contain !important;
1411
- }
1412
- `,Wb=async(e,t=10,n=500)=>{for(let r=0;r<t;r++)try{return await e()}catch(e){if(r===t-1||!(e instanceof Error)||!e.message.includes(`not registered`))throw e;await new Promise(e=>setTimeout(e,n))}throw Error(`unreachable`)},Gb=async e=>{for(let t=0;t<50;t++){if(await e.locator(`[data-uia="header"] a[href*="/login"]`).exists())return!1;if(await e.locator(`.watch-video, [data-uia="video-canvas"]`).exists())return!0;await new Promise(e=>setTimeout(e,200))}return!1},Kb=async(e,t)=>{for(;!t();){try{if(await e.locator(`video`).exists())return await e.locator(`video`).videoElement()}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,200))}return null},qb=D`
1413
- position: relative;
1414
- width: 100%;
1415
- height: 100%;
1416
- background: #000;
1417
- user-select: none;
1418
- -webkit-user-select: none;
1419
-
1420
- .nf-frame {
1421
- position: absolute;
1422
- inset: 0;
1423
- width: 100%;
1424
- height: 100%;
1425
- border: none;
1426
- background: #000;
1427
- /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
1428
- they belong to the skin's gesture layer stacked above it. */
1429
- pointer-events: none;
1430
- }
1431
-
1432
- .overlay {
1433
- position: absolute;
1434
- inset: 0;
1435
- display: flex;
1436
- flex-direction: column;
1437
- align-items: center;
1438
- justify-content: center;
1439
- gap: 1.6rem;
1440
- background: #000;
1441
- font-size: 1.4rem;
1442
- color: rgba(255, 255, 255, 0.8);
1443
- z-index: 30;
1444
- }
1445
-
1446
- .login-button {
1447
- padding: 0.8rem 2rem;
1448
- background: #e50914;
1449
- color: #fff;
1450
- border: none;
1451
- border-radius: 0.4rem;
1452
- font-size: 1.4rem;
1453
- font-weight: 600;
1454
- cursor: pointer;
1455
-
1456
- &:hover {
1457
- background: #c11119;
1458
- }
1459
- }
1460
- `,Jb={cr:_y,nf:({url:e})=>{let[t,n]=h(null),[r,i]=h(null),[a,o]=h(!0),[s,c]=h(!1),[l,u]=h(),[d,f]=h(null),[g,_]=h(0);m(()=>{if(!t)return;let e=!1;return(async()=>{for(let n=0;!e;n++)try{let n=await ie({iframe:t,domains:Vb});if(e)return;if(!L()){u(`Netflix playback currently needs the FKN browser extension.`),o(!1);return}i(n);return}catch(t){if(e)return;if(n>=4){console.error(`Failed to attach Netflix frame`,t),u(t instanceof Error?t.message:`Failed to load player`),o(!1);return}await new Promise(e=>setTimeout(e,300*(n+1)))}})(),()=>{e=!0}},[t]),m(()=>{if(!r)return;let t=!1,n=()=>t;return o(!0),u(void 0),c(!1),f(null),(async()=>{if(await r.goto(e,{waitUntil:`load`}),await Wb(()=>r.addStyleTag({content:Ub})),t)return;o(!1);let i=await Gb(r);if(t)return;if(!i){c(!0);return}let a=await Kb(r,n);!t&&a&&f(a)})().catch(e=>{t||(console.error(`Failed to load Netflix player`,e),u(e?.message??`Failed to load player`),o(!1))}),()=>{t=!0}},[r,e,g]);let v=p(()=>{let e=globalThis.open(Hb,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),_(e=>e+1))},500)},[]);return y(`div`,{css:qb,children:[F(Bb,{remote:d,frame:r,children:F(`iframe`,{ref:n,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(s||l||a)&&y(`div`,{className:`overlay`,children:[s&&y(O,{children:[`You need to be logged in to Netflix to watch this content.`,F(`button`,{className:`login-button`,onClick:v,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})}},Yb=e=>Jb[e],Xb=new URLSearchParams(globalThis.location.search),Zb=Xb.get(`mediaUri`),Qb=Xb.get(`episodeUri`),$b=Xb.get(`sourceUri`),ex=Xb.get(`url`),tx=$b?T($b).origin:void 0,nx=tx?Yb(tx):void 0;A(F(()=>!Zb||!Qb||!$b||!ex||!nx?F(`div`,{children:`Unsupported or missing parameters`}):F(nx,{url:ex,mediaUri:Zb,episodeUri:Qb,sourceUri:$b}),{}),document.getElementById(`app`));