@banou/stub 0.0.23 → 0.0.25

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.
Files changed (47) hide show
  1. package/build/assets/account-BENsgVNM.js +1 -0
  2. package/build/assets/account-DlIk6xHa.js +1 -0
  3. package/build/assets/api-BdTgLphT-N3l6mbjo.js +3 -0
  4. package/build/assets/api-D1AUDaGk.js +1 -0
  5. package/build/assets/build-CQLpK1BK.js +1 -0
  6. package/build/assets/embed-BiH-YCjQ.js +1461 -0
  7. package/build/assets/index-js0hDSG0.js +2126 -0
  8. package/build/assets/lib-Co-0V6DV.js +71 -0
  9. package/build/assets/{lib-account-DncELSPq.js → lib-account-BUymp__o.js} +12 -12
  10. package/build/assets/lib-account-zcRp2Stn.js +2 -0
  11. package/build/assets/{lib-api-BdTgLphT-CAZBNIQ5.js → lib-api-BdTgLphT-DSr8Qbeb.js} +353 -367
  12. package/build/assets/lib-api-MaBk5T3E.js +2 -0
  13. package/build/assets/{lib-rolldown-runtime-B1bRi_D7.js → lib-rolldown-runtime-Cb76FRpK.js} +2 -2
  14. package/build/assets/{lib-worker-0qYIS3eh.js → lib-worker-BGozEgr9.js} +148 -140
  15. package/build/assets/{lib-worker-Cv77f0ZX.js → lib-worker-GYQJyD7j.js} +1 -1
  16. package/build/assets/lib-worker-index-B4F7kvUH.js +2126 -0
  17. package/build/assets/main-CSyC6ryz.css +1 -0
  18. package/build/assets/main-CzEKJyQ-.js +3844 -0
  19. package/build/assets/remote-CVVOdyaq.js +1 -0
  20. package/build/assets/remote-VQoP8ehb.js +1 -0
  21. package/build/assets/uri-DvH8-88e.js +1 -0
  22. package/build/assets/{worker-BCl_Bm_R.js → worker-BwFHZ688.js} +1 -1
  23. package/build/assets/{worker-BsQDcd-k.js → worker-CT1T8vTt.js} +1 -1
  24. package/build/embed.html +8 -39
  25. package/build/index.html +9 -9
  26. package/build/index.js +2664 -2655
  27. package/package.json +10 -8
  28. package/build/.well-known/fkn.json +0 -1
  29. package/build/_headers +0 -5
  30. package/build/assets/account-B0kxAr97.js +0 -1
  31. package/build/assets/account-DjnuxpAV.js +0 -1
  32. package/build/assets/api-BdTgLphT-QGKmIqNg.js +0 -3
  33. package/build/assets/api-DsRXk6Ul.js +0 -1
  34. package/build/assets/build-BuC_lDPE.js +0 -1
  35. package/build/assets/embed-k24RBb_R.js +0 -1461
  36. package/build/assets/index-CPsp3E-B.js +0 -1964
  37. package/build/assets/lib-BqoXHewM.js +0 -71
  38. package/build/assets/lib-account-cGGxEwWz.js +0 -2
  39. package/build/assets/lib-api-Bi9f-0mj.js +0 -2
  40. package/build/assets/lib-worker-index-rcCwnCgE.js +0 -1964
  41. package/build/assets/main-Cpi6zSh1.js +0 -3844
  42. package/build/assets/main-DZ0Ws1xk.css +0 -1
  43. package/build/assets/remote-CW2xewp5.js +0 -1
  44. package/build/assets/remote-DNcNpuT3.js +0 -1
  45. package/build/assets/uri-BYw9k-7q.js +0 -1
  46. package/build/fkn.json +0 -1
  47. package/fkn.json +0 -1
@@ -1,1461 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/remote-DNcNpuT3.js","assets/remote-CW2xewp5.js","assets/build-BuC_lDPE.js"])))=>i.map(i=>d[i]);
2
- import{a as e,c as t,l as n,m as r,s as i,t as a,u as o}from"./lib-BqoXHewM.js";import{$ as s,F as c,G as l,H as u,I as d,J as f,K as p,M as m,P as h,Q as g,R as _,U as v,V as y,X as b,Y as x,Z as S,_ as C,at as w,d as T,et as E,f as D,g as O,h as k,i as A,it as j,j as M,l as N,m as P,nt as F,ot as ee,p as te,q as I,rt as L,tt as ne,u as R,y as z}from"./uri-BYw9k-7q.js";import{n as re}from"./remote-CW2xewp5.js";w(),g();var ie={};(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 ie},set exports(e){ie=e}});var B=ie,ae=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}},oe=class extends Error{constructor(e){super(),this.name=`AbortError`,this.message=e}},se=e=>globalThis.DOMException===void 0?new oe(e):new DOMException(e),ce=e=>{let t=e.reason===void 0?se(`This operation was aborted.`):e.reason;return t instanceof Error?t:se(t)};function le(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(ce(e)),e.addEventListener(`abort`,()=>{o(ce(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 ae(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 ue(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 de=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)},fe,pe=class{constructor(){fe.set(this,[])}enqueue(e,t){t={priority:0,...t};let n={priority:t.priority,run:e};if(this.size&&de(this,fe,`f`)[this.size-1].priority>=t.priority){de(this,fe,`f`).push(n);return}let r=ue(de(this,fe,`f`),n,(e,t)=>t.priority-e.priority);de(this,fe,`f`).splice(r,0,n)}dequeue(){return de(this,fe,`f`).shift()?.run}filter(e){return de(this,fe,`f`).filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return de(this,fe,`f`).length}};fe=new WeakMap;var V=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},H=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)},U,me,he,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze=new ae,Be=class extends Error{},Ve=class extends B{constructor(e){if(super(),U.add(this),me.set(this,void 0),he.set(this,void 0),ge.set(this,0),_e.set(this,void 0),ve.set(this,void 0),ye.set(this,0),be.set(this,void 0),xe.set(this,void 0),Se.set(this,void 0),Ce.set(this,void 0),we.set(this,0),Te.set(this,void 0),Ee.set(this,void 0),De.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:pe,...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})`);V(this,me,e.carryoverConcurrencyCount,`f`),V(this,he,e.intervalCap===1/0||e.interval===0,`f`),V(this,_e,e.intervalCap,`f`),V(this,ve,e.interval,`f`),V(this,Se,new e.queueClass,`f`),V(this,Ce,e.queueClass,`f`),this.concurrency=e.concurrency,this.timeout=e.timeout,V(this,De,e.throwOnTimeout===!0,`f`),V(this,Ee,e.autoStart===!1,`f`)}get concurrency(){return H(this,Te,`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})`);V(this,Te,e,`f`),H(this,U,`m`,Le).call(this)}async add(e,t={}){return new Promise((n,r)=>{H(this,Se,`f`).enqueue(async()=>{var i,a;V(this,we,(i=H(this,we,`f`),i++,i),`f`),V(this,ge,(a=H(this,ge,`f`),a++,a),`f`);try{if(t.signal?.aborted){r(new Be(`The task was aborted.`));return}let i=await(this.timeout===void 0&&t.timeout===void 0?e({signal:t.signal}):le(Promise.resolve(e({signal:t.signal})),t.timeout===void 0?this.timeout:t.timeout,()=>{(t.throwOnTimeout===void 0?H(this,De,`f`):t.throwOnTimeout)&&r(ze)}));n(i),this.emit(`completed`,i)}catch(e){r(e),this.emit(`error`,e)}H(this,U,`m`,Ae).call(this)},t),H(this,U,`m`,Pe).call(this),this.emit(`add`)})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return H(this,Ee,`f`)?(V(this,Ee,!1,`f`),H(this,U,`m`,Le).call(this),this):this}pause(){V(this,Ee,!0,`f`)}clear(){V(this,Se,new(H(this,Ce,`f`)),`f`)}async onEmpty(){H(this,Se,`f`).size!==0&&await H(this,U,`m`,Re).call(this,`empty`)}async onSizeLessThan(e){H(this,Se,`f`).size<e||await H(this,U,`m`,Re).call(this,`next`,()=>H(this,Se,`f`).size<e)}async onIdle(){H(this,we,`f`)===0&&H(this,Se,`f`).size===0||await H(this,U,`m`,Re).call(this,`idle`)}get size(){return H(this,Se,`f`).size}sizeBy(e){return H(this,Se,`f`).filter(e).length}get pending(){return H(this,we,`f`)}get isPaused(){return H(this,Ee,`f`)}};me=new WeakMap,he=new WeakMap,ge=new WeakMap,_e=new WeakMap,ve=new WeakMap,ye=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,U=new WeakSet,Oe=function(){return H(this,he,`f`)||H(this,ge,`f`)<H(this,_e,`f`)},ke=function(){return H(this,we,`f`)<H(this,Te,`f`)},Ae=function(){var e;V(this,we,(e=H(this,we,`f`),e--,e),`f`),H(this,U,`m`,Pe).call(this),this.emit(`next`)},je=function(){this.emit(`empty`),H(this,we,`f`)===0&&this.emit(`idle`)},Me=function(){H(this,U,`m`,Ie).call(this),H(this,U,`m`,Fe).call(this),V(this,xe,void 0,`f`)},Ne=function(){let e=Date.now();if(H(this,be,`f`)===void 0){let t=H(this,ye,`f`)-e;if(t<0)V(this,ge,H(this,me,`f`)?H(this,we,`f`):0,`f`);else return H(this,xe,`f`)===void 0&&V(this,xe,setTimeout(()=>{H(this,U,`m`,Me).call(this)},t),`f`),!0}return!1},Pe=function(){if(H(this,Se,`f`).size===0)return H(this,be,`f`)&&clearInterval(H(this,be,`f`)),V(this,be,void 0,`f`),H(this,U,`m`,je).call(this),!1;if(!H(this,Ee,`f`)){let e=!H(this,U,`a`,Ne);if(H(this,U,`a`,Oe)&&H(this,U,`a`,ke)){let t=H(this,Se,`f`).dequeue();return t?(this.emit(`active`),t(),e&&H(this,U,`m`,Fe).call(this),!0):!1}}return!1},Fe=function(){H(this,he,`f`)||H(this,be,`f`)!==void 0||(V(this,be,setInterval(()=>{H(this,U,`m`,Ie).call(this)},H(this,ve,`f`)),`f`),V(this,ye,Date.now()+H(this,ve,`f`),`f`))},Ie=function(){H(this,ge,`f`)===0&&H(this,we,`f`)===0&&H(this,be,`f`)&&(clearInterval(H(this,be,`f`)),V(this,be,void 0,`f`)),V(this,ge,H(this,me,`f`)?H(this,we,`f`):0,`f`),H(this,U,`m`,Le).call(this)},Le=function(){for(;H(this,U,`m`,Pe).call(this););},Re=async function(e,t){return new Promise(n=>{let r=()=>{t&&!t()||(this.off(e,r),n())};this.on(e,r)})};var He=Object.defineProperty,W=(e,t)=>{let n={};for(var r in e)He(n,r,{get:e[r],enumerable:!0});return t||He(n,Symbol.toStringTag,{value:`Module`}),n},Ue=`__OSRA_KEY__`,We=`__OSRA_DEFAULT_KEY__`,Ge=`__OSRA_BOX__`,Ke=()=>globalThis.browser??globalThis.chrome,qe=()=>Ke()?.runtime,Je=(e,t)=>dt(e)&&e.__OSRA_KEY__===t,Ye=(e,t)=>{if(e){if(e.aborted){t();return}e.addEventListener(`abort`,t,{once:!0})}},Xe=({listener:e,transport:t,remoteName:n,key:r=We,origin:i=`*`,unregisterSignal:a})=>{if(a?.aborted)return;let o=kt(t)?t.receive:t;if(typeof o==`function`){let t=o((t,i)=>{a?.aborted||Je(t,r)&&(n&&t.name!==n||e(t,i))});typeof t==`function`&&Ye(a,t);return}if(ht(o)||gt(o)||vt(o)||yt(o)){let t=(t,i)=>{let o=(t,a)=>{Je(t,r)&&(n&&t.name!==n||e(t,{port:i,sender:a}))};t.addListener(o),Ye(a,()=>t.removeListener(o))};if(ht(o))t(o.onMessage);else if(vt(o)){let e=e=>t(e.onMessage,e);o.addListener(e),Ye(a,()=>o.removeListener(e))}else yt(o)?t(o):t(o.onMessage);return}let s=lt(o)?o.port:o,c=i!==`*`&&bt(o),l=t=>{let a=t.data;if(typeof a==`string`)try{a=JSON.parse(a)}catch{return}Je(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(),Ye(a,()=>s.removeEventListener(`message`,l))},Ze=(e,t,n=`*`,r=[])=>{let i=kt(e)?e.emit:e;if(typeof i==`function`)i(t,r);else if(bt(i))i.postMessage(t,n,r);else if(gt(i))i.postMessage(t);else if(ht(i))i.sendMessage(t)?.catch?.(e=>{if(!String(e?.message).includes(`Receiving end does not exist`))throw e});else if(it(i)){let e=JSON.stringify(t);i.readyState===WebSocket.CONNECTING?i.addEventListener(`open`,()=>i.send(e),{once:!0}):i.send(e)}else lt(i)?i.port.postMessage(t,r):i.postMessage(t,r)},Qe=globalThis.Float16Array,$e={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float16Array:Qe,Float32Array,Float64Array,BigInt64Array,BigUint64Array},et=Object.values($e),tt=e=>{let t=e.constructor.name;if(t in $e)return t;for(let[t,n]of Object.entries($e))if(n&&e instanceof n)return t;throw Error(`Unknown typed array type`)},nt=e=>{let t=$e[e];if(!t)throw Error(`Unknown typed array type`);return t},rt=e=>et.some(t=>!!t&&e instanceof t),it=e=>e instanceof WebSocket,at=e=>!!globalThis.ServiceWorkerContainer&&e instanceof ServiceWorkerContainer,ot=e=>!!globalThis.ServiceWorker&&e instanceof ServiceWorker,st=e=>!!globalThis.Worker&&e instanceof Worker,ct=e=>{let t=globalThis.DedicatedWorkerGlobalScope;return!!t&&e instanceof t},lt=e=>!!globalThis.SharedWorker&&e instanceof SharedWorker,ut=e=>e instanceof MessagePort,dt=e=>!!e&&typeof e==`object`&&`__OSRA_KEY__`in e&&!!e.__OSRA_KEY__,ft=(e,t)=>{for(let n of t)if(n&&e instanceof n)return!0;return!1},pt=e=>ft(e,[globalThis.SharedArrayBuffer]),mt=e=>ft(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]),ht=e=>{let t=qe();return t?e===t:!1},gt=(e,t=!1)=>!e||typeof e!=`object`||bt(e)||!(`name`in e)||!(`disconnect`in e)||!(`postMessage`in e)?!1:t?`sender`in e&&`onMessage`in e&&`onDisconnect`in e:!0,_t=e=>!!e&&typeof e==`object`&&!bt(e)&&`addListener`in e&&`hasListener`in e&&`removeListener`in e,vt=e=>{let t=qe();return t?e===t.onConnect||e===t.onConnectExternal:!1},yt=e=>_t(e),bt=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}}},xt=e=>it(e)||gt(e)||ht(e),St=e=>it(e)||gt(e)||vt(e)||yt(e)||ht(e),Ct=e=>!!e&&typeof e==`object`&&!bt(e)&&`isJson`in e&&e.isJson===!0||xt(e)||St(e),wt=e=>bt(e)||xt(e)||ot(e)||st(e)||ct(e)||lt(e)||ut(e)||Dt(e),Tt=e=>bt(e)||St(e)||at(e)||st(e)||ct(e)||lt(e)||ut(e)||Ot(e),Et=e=>{if(!e||typeof e!=`object`||bt(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Dt=e=>!Et(e)||!(`emit`in e)?!1:wt(e.emit)||typeof e.emit==`function`,Ot=e=>!Et(e)||!(`receive`in e)?!1:Tt(e.receive)||typeof e.receive==`function`,kt=e=>Dt(e)||Ot(e),G={[Ge]:`revivable`},At=e=>!!e&&typeof e==`object`&&`__OSRA_BOX__`in e&&e.__OSRA_BOX__===`revivable`,jt=(e,t)=>Ct(t.transport)?{base64Buffer:new Uint8Array(e).toBase64()}:{arrayBuffer:e},Mt=e=>`arrayBuffer`in e?e.arrayBuffer:Uint8Array.fromBase64(e.base64Buffer).buffer,Nt=W({box:()=>It,isType:()=>Ft,revive:()=>Lt,type:()=>Pt}),Pt=`arrayBuffer`,Ft=e=>e instanceof ArrayBuffer,It=(e,t)=>({...G,type:Pt,...jt(e,t)}),Lt=(e,t)=>Mt(e),Rt=W({box:()=>Vt,isType:()=>Bt,revive:()=>Ht,type:()=>zt}),zt=`date`,Bt=e=>e instanceof Date,Vt=(e,t)=>({...G,type:zt,ISOString:e.toISOString()}),Ht=(e,t)=>new Date(e.ISOString),Ut=W({box:()=>Kt,isType:()=>Gt,revive:()=>qt,type:()=>Wt}),Wt=`headers`,Gt=e=>e instanceof Headers,Kt=(e,t)=>({...G,type:Wt,entries:[...e.entries()]}),qt=(e,t)=>new Headers(e.entries),Jt=W({box:()=>Qt,isType:()=>Zt,revive:()=>$t,type:()=>Yt}),Yt=`error`,Xt={Error,TypeError,RangeError,SyntaxError,ReferenceError,EvalError,URIError},Zt=e=>e instanceof Error,Qt=(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:Yt,name:e.name,message:e.message,stack:e.stack||e.toString(),...n?{cause:ta(e.cause,t)}:{},...r?{errors:ta(e.errors,t)}:{},...i?{isDOMException:!0}:{}}},$t=(e,t)=>{let n=e.cause===void 0?void 0:na(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(na(e.errors,t),e.message,r);else{let t=Xt[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},en=W({box:()=>rn,isType:()=>nn,revive:()=>an,type:()=>tn}),tn=`typedArray`,nn=rt,rn=(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:tn,typedArrayType:tt(e),...jt(n,t)}},an=(e,t)=>new(nt(e.typedArrayType))(Mt(e)),on=new WeakMap,sn=new WeakSet,cn=(e,t)=>{if(sn.has(e))return t(),()=>{};let n=on.get(e);return n||on.set(e,n=new Set),n.add(t),()=>n.delete(t)},ln=e=>{if(sn.has(e))return;sn.add(e);let t=on.get(e);if(t){on.delete(e);for(let e of t)try{e()}catch{}}},un=W({box:()=>vn,isType:()=>_n,revive:()=>yn,transfer:()=>gn,type:()=>dn}),dn=`transfer`,fn=Symbol.for(`osra.transfer`),pn=e=>typeof e==`object`&&!!e,mn=e=>pn(e)&&fn in e&&e[fn]===!0,hn=e=>pn(e)?ArrayBuffer.isView(e)?!0:ft(e,[globalThis.ArrayBuffer,globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.VideoFrame,globalThis.AudioData]):!1,gn=e=>hn(e)?{[fn]:!0,value:e}:e,_n=e=>mn(e),vn=(e,t)=>({...G,type:dn,inner:ta(e.value,t),degraded:Ct(t.transport)}),yn=(e,t)=>na(e.inner,t),bn=e=>ft(e,[globalThis.MessagePort,globalThis.ReadableStream,globalThis.WritableStream,globalThis.TransformStream,globalThis.OffscreenCanvas,globalThis.MediaSourceHandle,globalThis.MediaStreamTrack,globalThis.MIDIAccess,globalThis.RTCDataChannel,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream]),xn=e=>At(e)&&e.type===`transfer`,Sn=e=>{let t=[],n=new WeakSet,r=(e,i)=>{if(!(!e||typeof e!=`object`)&&!n.has(e)&&(n.add(e),!pt(e))){if(xn(e)){r(e.inner,i||!e.degraded);return}if(bn(e)){t.push(e);return}if(mt(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},Cn=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`))})}},wn=class{port1;port2;constructor(){let e=new Cn,t=new Cn;e._peer=t,t._peer=e,this.port1=e,this.port2=t}},Tn=new FinalizationRegistry(e=>{try{e()}catch{}}),En=(e,t)=>{let n={};return Tn.register(e,t,n),()=>Tn.unregister(n)},Dn=W({box:()=>Wn,createRevivableChannel:()=>qn,init:()=>zn,isType:()=>Bn,revive:()=>Gn,type:()=>On}),On=`messagePort`,kn=2048,An=128,jn=1024,Mn=new WeakMap,Nn=e=>{let t=Mn.get(e);if(!t)throw Error(`osra message-port: connection state missing; did init() run?`);return t},Pn=(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},Fn=(e,t)=>{let n=e.ports.get(t);if(n&&!n.handler&&e.pendingPorts--,e.ports.delete(t),e.tombstones.size>=An){let t=e.tombstones.values().next().value;t!==void 0&&e.tombstones.delete(t)}e.tombstones.add(t)},In=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)},Ln=(e,t)=>Pn(Nn(e),t).outSeq++,Rn=(e,t,n)=>{let r=Nn(e);if(r.tombstones.has(t)){setTimeout(()=>n({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t}));return}let i=Pn(r,t);i.handler||r.pendingPorts--,i.handler=n,In(i)},zn=e=>{let t={ports:new Map,tombstones:new Set,pendingPorts:0};Mn.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>=jn)return;r=Pn(t,n.portId)}if(!(n.seq<r.nextSeq)){if(r.buffer.size>=kn&&!(n.seq===r.nextSeq&&r.handler)){r.buffer.clear(),Fn(t,n.portId),r.handler?.({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:n.portId});return}r.buffer.set(n.seq,n),In(r)}}),cn(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})},Bn=e=>e instanceof MessagePort||e instanceof Cn,Vn=(e,t)=>{try{let n=Nn(e).ports.get(t);e.sendMessage({type:`message-port-close`,remoteUuid:e.remoteUuid,portId:t,seq:n?n.outSeq++:0})}catch{}},Hn=(e,t,n)=>{n?e.postMessage(t):e.postMessage(t,Sn(t))},Un=(e,t,n)=>()=>{let r=e.deref();r&&Vn(r,n);let i=t.deref();i&&Fn(i,n)},Wn=(e,t,n)=>{let r=e instanceof Cn;if(!r&&!Ct(t.transport))return{...G,type:On,port:e,...n?.autoBox?{autoBox:!0}:{}};let i=Nn(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&&Fn(e,o),m?.();let t=s.deref();t?.removeEventListener(`message`,p),t instanceof Cn&&(t._onClose=void 0)},f=e=>{if(e.type===`message-port-close`){d(),a.dispatchEvent(new Event(`close`)),a.close();return}Hn(a,na(e.data,t),!1)};function p({data:e}){t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:ta(e,t),portId:o,seq:Ln(t,o)})}let m=En(a,Un(c,l,o));return a.addEventListener(`message`,p),a.start(),a instanceof Cn&&(a._onClose=()=>{u||(Vn(t,o),d())}),Rn(t,o,f),{...G,type:On,portId:o,synthetic:r}},Gn=(e,t)=>`port`in e?e.autoBox?Kn(e.port,t):e.port:Jn(e.portId,t,e.synthetic),Kn=(e,t)=>{let n=new EventTarget,r=({data:e})=>{n.dispatchEvent(new MessageEvent(`message`,{data:na(e,t)}))},i=()=>{n.dispatchEvent(new Event(`close`))};return e.addEventListener(`message`,r),e.addEventListener(`close`,i),n.postMessage=(n,r)=>{let i=ta(n,t),a=Sn(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},qn=e=>{if(Ct(e.transport)){let{port1:t,port2:n}=new wn;return{localPort:t,boxedRemote:Wn(n,e)}}let{port1:t,port2:n}=new MessageChannel;return{localPort:Kn(t,e),boxedRemote:Wn(n,e,{autoBox:!0})}},Jn=(e,t,n)=>{let r=Nn(t),{port1:i,port2:a}=n?new wn:new MessageChannel,o=new WeakRef(i),s=new WeakRef(a),c=!1,l=()=>{if(c)return;c=!0,Fn(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&&Hn(r,na(e.data,t),n)},d=({data:n})=>{t.sendMessage({type:`message`,remoteUuid:t.remoteUuid,data:ta(n,t),portId:e,seq:Ln(t,e)})},f=En(i,()=>{Vn(t,e),l()});return i instanceof Cn&&(i._onClose=()=>{c||(Vn(t,e),l())}),a.addEventListener(`message`,d),a.start(),Rn(t,e,u),i},Yn=W({box:()=>er,isType:()=>$n,revive:()=>tr,type:()=>Xn}),Xn=`promise`,Zn=e=>e instanceof Promise,Qn=new Set,$n=e=>e instanceof Promise,er=(e,t)=>{if(!Zn(e))throw TypeError(`Expected Promise`);let{localPort:n,boxedRemote:r}=qn(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:Xn,port:r}},tr=(e,t)=>{let n=Gn(e.port,t);Qn.add(n);let r=`portId`in e.port;return new Promise((e,i)=>{let a=()=>{n.close(),Qn.delete(n),o()},o=r?cn(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()})},nr=W({box:()=>or,isType:()=>ar,revive:()=>sr,type:()=>rr}),rr=`function`,ir=new Set,ar=e=>typeof e==`function`,or=(e,t)=>{let{port1:n,port2:r}=new wn;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 ta(n,t)}catch(e){return ta({type:`throw`,error:e},t)}})();r.postMessage(a,Sn(a)),queueMicrotask(()=>{try{r.close()}catch{}})})()}),n.start(),{...G,type:rr,port:Wn(r,t)}},sr=(e,t)=>{let n=Gn(e.port,t);return((...e)=>new Promise((r,i)=>{let{port1:a,port2:o}=new wn;ir.add(a);let s=()=>{a.close(),ir.delete(a),c()},c=cn(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=ta([o,e],t);n.postMessage(l,Sn(l))}))},cr=W({MAX_CREDIT_WINDOW:()=>64,box:()=>mr,isType:()=>ur,revive:()=>vr,type:()=>lr}),lr=`readableStream`,ur=e=>e instanceof ReadableStream,dr=2,fr=8,pr=4*1024*1024,mr=(e,t)=>{let{localPort:n,boxedRemote:r}=qn(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:lr,credit:!0,port:r}},hr=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,gr=e=>{let t=!1,n=0,r,i=[],a=!1,o=!1,s,c,l=()=>r===void 0?fr:Math.max(dr,Math.min(64,Math.floor(pr/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=hr(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())}})},_r=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())}})},vr=(e,t)=>{let n=Gn(e.port,t);return n.start(),e.credit?gr(n):_r(n)},yr=W({box:()=>Sr,isType:()=>xr,revive:()=>Cr,type:()=>br}),br=`writableStream`,xr=e=>e instanceof WritableStream,Sr=(e,t)=>{let{localPort:n,boxedRemote:r}=qn(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:br,port:r}},Cr=(e,t)=>{let n=Gn(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})})},wr=W({box:()=>Or,isType:()=>Er,revive:()=>kr,type:()=>Tr}),Tr=`abortSignal`,Er=e=>e instanceof AbortSignal,Dr=new WeakMap,Or=(e,t)=>{if(e.aborted)return{...G,type:Tr,aborted:!0,reason:ta(e.reason,t)};let{localPort:n,boxedRemote:r}=qn(t),i=()=>{n.postMessage({type:`abort`,reason:e.reason}),n.close(),a()},a=cn(t,()=>{e.removeEventListener(`abort`,i),n.close()});return e.addEventListener(`abort`,i,{once:!0}),{...G,type:Tr,aborted:!1,reason:void 0,port:r}},kr=(e,t)=>{let n=new AbortController;if(e.aborted||e.port===void 0)return n.abort(na(e.reason,t)),n.signal;let r=Gn(e.port,t);return Dr.set(n.signal,r),r.start(),r.addEventListener(`message`,({data:e})=>{e.type===`abort`&&(n.abort(na(e.reason,t)),Dr.delete(n.signal),r.close())}),n.signal},Ar=W({box:()=>Nr,isType:()=>Mr,revive:()=>Pr,type:()=>jr}),jr=`response`,Mr=e=>e instanceof Response,Nr=(e,t)=>({...G,type:jr,status:e.status,statusText:e.statusText,headers:Kt(e.headers,t),body:e.body?mr(e.body,t):null,url:e.url,redirected:e.redirected}),Pr=(e,t)=>{if(e.status===0)return Response.error();let n=qt(e.headers,t),r=e.body?vr(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},Fr=W({box:()=>Rr,isType:()=>Lr,revive:()=>zr,type:()=>Ir}),Ir=`request`,Lr=e=>e instanceof Request,Rr=(e,t)=>({...G,type:Ir,method:e.method,url:e.url,headers:Kt(e.headers,t),body:e.body?mr(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:Or(e.signal,t)}),zr=(e,t)=>{let n=qt(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:kr(e.signal,t)};return e.mode!==`navigate`&&(r.mode=e.mode),e.body&&(r.body=vr(e.body,t),r.duplex=`half`),new Request(e.url,r)},Br=W({box:()=>ei,boxByReference:()=>ti,identity:()=>Jr,isType:()=>Qr,revive:()=>ni,type:()=>Vr}),Vr=`identity`,Hr=Symbol.for(`osra.identity`),Ur=e=>e!==null&&(typeof e==`object`||typeof e==`function`),Wr=e=>{if(e===null)return!1;let t=typeof e;return t===`object`||t===`function`?!0:t===`symbol`?Symbol.keyFor(e)===void 0:!1},Gr=e=>Ur(e)&&Hr in e&&e[Hr]===!0,Kr=new WeakMap,qr=e=>{if(Gr(e))return e;let t=Kr.get(e);if(t)return t;let n={[Hr]:!0,value:e};return Kr.set(e,n),n},Jr=e=>Ur(e)?qr(e):e,Yr=new WeakMap,Xr=e=>{let t=Yr.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 Yr.set(e,o),Zr(e,o),cn(e,()=>{o.receiveCache.clear(),o.idToSent.clear()}),o},Zr=(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&&Wr(n)&&t.revivedToId.delete(n)}))},Qr=e=>Gr(e),$r=(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}},ei=(e,t)=>{let n=Xr(t),r=e.value,i=ta(r,t);if(!Wr(r))return{...G,type:Vr,id:globalThis.crypto.randomUUID(),inner:i};let{id:a,isExisting:o}=$r(r,n);return o?{...G,type:Vr,id:a}:{...G,type:Vr,id:a,inner:i}},ti=(e,t,n)=>{let{id:r,isExisting:i}=$r(e,Xr(n));return i?{...G,type:Vr,id:r}:{...G,type:Vr,id:r,inner:t}},ni=(e,t)=>{let n=Xr(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=na(e.inner,t);return n.receiveCache.set(e.id,a),Wr(a)&&n.revivedToId.set(a,e.id),a},ri=W({box:()=>ai,isType:()=>ii,revive:()=>oi,type:()=>`map`}),ii=e=>e instanceof Map,ai=(e,t)=>({...G,type:`map`,entries:Array.from(e,([e,n])=>[ta(e,t),ta(n,t)])}),oi=(e,t)=>new Map(e.entries.map(([e,n])=>[na(e,t),na(n,t)])),si=W({box:()=>li,isType:()=>ci,revive:()=>ui,type:()=>`set`}),ci=e=>e instanceof Set,li=(e,t)=>({...G,type:`set`,values:Array.from(e,e=>ta(e,t))}),ui=(e,t)=>new Set(e.values.map(e=>na(e,t))),di=W({box:()=>mi,isType:()=>pi,revive:()=>hi,type:()=>fi}),fi=`bigint`,pi=e=>typeof e==`bigint`,mi=(e,t)=>({...G,type:fi,value:e.toString()}),hi=(e,t)=>BigInt(e.value),gi=W({box:()=>yi,isType:()=>vi,revive:()=>bi,type:()=>_i}),_i=`event`,vi=e=>e instanceof Event,yi=(e,t)=>({...G,type:_i,eventType:e.type,bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed,...e instanceof CustomEvent?{detail:ta(e.detail,t)}:{}}),bi=(e,t)=>{let n={bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed};return`detail`in e?new CustomEvent(e.eventType,{...n,detail:na(e.detail,t)}):new Event(e.eventType,n)},xi=W({box:()=>wi,isType:()=>Ci,revive:()=>Oi,type:()=>Si}),Si=`eventTarget`,Ci=e=>e instanceof EventTarget,wi=(e,t)=>{let n=[],r=e=>typeof e==`boolean`?e:!!e?.capture;return{...G,type:Si,addListener:or((t,i,a)=>{n.push({eventType:t,listener:i,capture:r(a)}),e.addEventListener(t,i,a)},t),removeListener:or((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:or(()=>{for(let{eventType:t,listener:r,capture:i}of n.splice(0))e.removeEventListener(t,r,{capture:i})},t)}},Ti=new WeakMap,Ei=e=>{if(typeof e==`function`)return e;let t=Ti.get(e);return t||Ti.set(e,t=t=>e.handleEvent(t)),t},Di=(e,t,n,r)=>e.find(e=>e.eventType===t&&e.listener===n&&e.capture===r),Oi=(e,t)=>{let n=sr(e.addListener,t),r=sr(e.removeListener,t),i=sr(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=Ei(t),a=typeof r==`boolean`?r:!!r?.capture;if(Di(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,Jr(c),r).catch(()=>{})}}),Object.defineProperty(a,"removeEventListener",{value:(e,t,n)=>{if(t===null)return;let i=Ei(t),a=typeof n==`boolean`?n:!!n?.capture,c=Di(o,e,i,a);c&&(s(c),r(e,Jr(c.wire),{capture:a}).catch(()=>{}))}}),En(a,()=>{i().catch(()=>{})}),a},ki=W({box:()=>Mi,isType:()=>ji,revive:()=>Ni,type:()=>Ai}),Ai=`symbol`,ji=e=>typeof e==`symbol`,Mi=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?ti(e,{...G,type:Ai,description:e.description},t):{...G,type:Ai,registryKey:n}},Ni=(e,t)=>`registryKey`in e?Symbol.for(e.registryKey):Symbol(e.description),Pi=W({box:()=>Li,isType:()=>Ii,revive:()=>Ri,type:()=>Fi}),Fi=`asyncIterator`,Ii=e=>!e||typeof e!=`object`||typeof ReadableStream<`u`&&e instanceof ReadableStream?!1:typeof e[Symbol.asyncIterator]==`function`,Li=(e,t)=>{let n=e[Symbol.asyncIterator]();return{...G,type:Fi,next:or((e=>n.next(e)),t),return:or((e=>n.return?.(e)??Promise.resolve({done:!0,value:e})),t),throw:or((e=>n.throw?.(e)??Promise.reject(e)),t)}},Ri=(e,t)=>{let n=sr(e.next,t),r=sr(e.return,t),i=sr(e.throw,t),a={next:(...e)=>n(...e),return:e=>r(e),throw:e=>i(e),[Symbol.asyncIterator]:()=>a};return a},zi=[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],Bi=[globalThis.CropTarget,globalThis.EncodedAudioChunk,globalThis.EncodedVideoChunk,globalThis.FencedFrameConfig,globalThis.GPUCompilationInfo,globalThis.GPUCompilationMessage,globalThis.GPUPipelineError,globalThis.RTCEncodedAudioFrame,globalThis.RTCEncodedVideoFrame,globalThis.WebTransportError],Vi={type:`clonable`,capableOnly:!0,isType:e=>ft(e,zi)||ft(e,Bi),box:(e,t)=>e,revive:(e,t)=>e},Hi=[globalThis.ImageBitmap,globalThis.OffscreenCanvas,globalThis.WritableStream,globalThis.TransformStream,globalThis.MediaStreamTrack,globalThis.RTCDataChannel],Ui=[globalThis.AudioData,globalThis.VideoFrame,globalThis.MediaSourceHandle,globalThis.MIDIAccess,globalThis.WebTransportReceiveStream,globalThis.WebTransportSendStream],Wi={type:`transferable`,capableOnly:!0,isType:e=>ft(e,Hi)||ft(e,Ui),box:(e,t)=>e,revive:(e,t)=>e},Gi={type:`blob`,capableOnly:!0,isType:e=>typeof Blob<`u`&&e instanceof Blob,box:(e,t)=>{if(Ct(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},Ki=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},qi=[un,Br,Nt,Rt,Ut,Jt,en,Yn,nr,Dn,cr,yr,wr,Ar,Fr,ri,si,di,ki,gi,Pi,{type:`nonFiniteNumber`,isType:e=>typeof e==`number`&&!Number.isFinite(e),box:(e,t)=>Ct(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)=>Ct(t.transport)?{...G,type:`undefined`}:e,revive:(e,t)=>void 0},Vi,Wi,Gi,xi,{type:`unclonable`,isType:e=>{if(typeof e!=`object`||!e||Array.isArray(e)||Ki(e))return!1;try{return structuredClone(e),!1}catch{return!0}},box:(e,t)=>({...G,type:`unclonable`}),revive:(e,t)=>({})}],Ji=(e,t)=>t.find(t=>t.isType(e)),Yi=(e,t)=>t.find(t=>t.type===e.type),Xi=e=>!!e&&typeof e==`object`&&Object.getPrototypeOf(e)===Object.prototype,Zi=(e,t)=>Array.isArray(e)?e.map(e=>t(e)):Xi(e)?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)])):e,Qi=new WeakSet,$i=new WeakSet,ea=e=>e!==null&&(typeof e==`object`||typeof e==`function`),ta=(e,t)=>{if(At(e))return e;let n=ea(e);if(n){if(Qi.has(e))throw TypeError(`osra: cannot serialize a circular structure - break the cycle or send the container by reference`);Qi.add(e)}try{let n=Ji(e,t.revivableModules);return n?n.box(e,t):Zi(e,e=>ta(e,t))}finally{n&&Qi.delete(e)}},na=(e,t)=>{let n=ea(e);if(n){if($i.has(e))throw TypeError(`osra: cannot revive a circular structure`);$i.add(e)}try{if(At(e)){let n=Yi(e,t.revivableModules);if(n)return n.revive(e,t)}return Zi(e,e=>na(e,t))}finally{n&&$i.delete(e)}},ra=W({init:()=>oa,startBidirectionalConnection:()=>aa,type:()=>ia}),ia=`bidirectional`,aa=({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:ta(t,o)}),{revivableContext:o,remoteValue:s.then(e=>na(e,o))}},oa=e=>{if(!(wt(e.transport)&&Tt(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=aa({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),ln(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=aa({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()},sa=()=>new EventTarget,ca=e=>{let t=kt(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&&Ct(n)||r!==void 0&&Ct(r),...n===void 0?{}:{emit:n},...r===void 0?{}:{receive:r}}},la=e=>e?e(qi):qi,ua=32,da=()=>{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>ua&&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())}}}}},fa=(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})},pa=Symbol.for(`osra.context`),ma=e=>typeof e==`object`&&!!e&&pa in e,ha=[ra],ga=(e,{transport:t,name:n,remoteName:r,key:i=We,origin:a=`*`,unregisterSignal:o,revivableModules:s,uuid:c,remoteUuid:l,connection:u=({value:e})=>e})=>{let d=u,f=ca(t);if(!(wt(f)&&Tt(f))){let e=da();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(()=>{}),fa(t,e,d)}let p=la(s),m=new Map,h=new Set,g=da(),{promise:_,resolve:v,reject:y}=Promise.withResolvers();_.catch(()=>{});let b=c??globalThis.crypto.randomUUID(),x=(e,t=a)=>{let r={[Ue]:i,name:n,uuid:b,...e};Ze(f,r,t,Sn(r))},S=(e,t)=>{o?.aborted||x(e,t)},C=sa(),w={transport:f,valueFor:t=>ma(e)?e[pa](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}),ln(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:sa,unregisterSignal:o};if(Xe({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(),fa(_,g,d);o?.addEventListener(`abort`,()=>{for(let[e,t]of m)x({type:`close`,remoteUuid:e}),ln(t.connection.revivableContext);m.clear(),g.close(),y(o.reason)},{once:!0});for(let e of ha)e.init(w);return fa(_,g,d)},_a=(e,t)=>ga(e,t),va=e=>new Promise((t,n)=>{if(e.aborted)return n();e.addEventListener(`abort`,()=>{n()})}),ya=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 _a({},{transport:c}),u=await l({publicPath:e,length:i,bufferSize:a,audioStreamIndex:o}),d=new Ve({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?gn(n):n,rejected:!1}},()=>({resolved:new Uint8Array().buffer,rejected:!0})),va(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}),va(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()}}},ba=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await ya({...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)}},xa=async e=>{let{worker:t,remuxer:n,wasmRead:r,addTask:i,destroy:a}=await ya({...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}},Sa=typeof HTMLVideoElement<`u`?HTMLVideoElement.prototype:{},Ca=`getVideoPlaybackQuality`in Sa||`webkitDecodedFrameCount`in Sa||`mozPresentedFrames`in Sa||`mozPaintedFrames`in Sa;if(!(`requestVideoFrameCallback`in Sa)&&Ca&&typeof requestAnimationFrame==`function`){Sa._rvfcpolyfillmap={};let e=`getVideoPlaybackQuality`in Sa?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});Sa.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},Sa.cancelVideoFrameCallback=function(e){cancelAnimationFrame(this._rvfcpolyfillmap[e]),delete this._rvfcpolyfillmap[e]}}var wa={bt709:`BT709`,bt470bg:`BT601`,smpte170m:`BT601`},Ta={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`}},Ea=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=wa[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='${Ta[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 Da(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 Oa(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 ka=`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 Aa(e){for(var t,n={},r=0;r<ka.length;r++){var i=ka[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=Oa(m[0])),m.length===2&&(n.clip.scale=m[0]*1,n.clip.drawing=Oa(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(Aa)},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 ja(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(Aa)}function Ma(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=ja(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?Oa(t[r+1]):[]})}return{raw:e,combined:n.map(function(e){return e.text}).join(``),parsed:n}}function Na(e){var t=e.split(`:`);return t[0]*3600+t[1]*60+t[2]*1}function Pa(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]=Na(s);break;case`Effect`:i[o]=Da(s);break;case`Text`:i[o]=Ma(s);break;default:i[o]=s}}return i}var Fa=[`Name`,`Fontname`,`Fontsize`,`PrimaryColour`,`SecondaryColour`,`OutlineColour`,`BackColour`,`Bold`,`Italic`,`Underline`,`StrikeOut`,`ScaleX`,`ScaleY`,`Spacing`,`Angle`,`BorderStyle`,`Outline`,`Shadow`,`Alignment`,`MarginL`,`MarginR`,`MarginV`,`Encoding`],Ia=[`Layer`,`Start`,`End`,`Style`,`Name`,`MarginL`,`MarginR`,`MarginV`,`Effect`,`Text`];function La(e){var t=Fa.concat(Ia);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 Ra(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={},r[e]=n[t],r})))}function za(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=La(a)),/^Style\s*:/i.test(a)&&t.styles.style.push(Ra(a,t.styles.format))),r===3&&(/^Format\s*:/i.test(a)&&(t.events.format=La(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(Pa(d,t.events.format))}}}return t}var Ba={M:`m`,L:`l`,C:`b`};function Va(e){return e.instructions.map(function(e){var t,n=e.type,r=e.points;return(t=[Ba[n]]).concat.apply(t,r.map(function(e){return[e.x,e.y]})).join(` `)}).join(` `)}var Ha=function(e){return function(t){return function(n){return``+t+e+`&H`+n+`&`}}},Ua=Ha(`c`),Wa=Ha(`a`),Ga={c1:Ua(1),c2:Ua(2),c3:Ua(3),c4:Ua(4),a1:Wa(1),a2:Wa(2),a3:Wa(3),a4:Wa(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+`,`)+Va(e.drawing))+`)`},t:function(e){return e.map(function(e){return`t(`+[e.t1,e.t2,e.accel,Ka(e.tag)]+`)`}).join(`\\`)}};function Ka(e){return Object.keys(e).map(function(t){return`\\`+(Ga[t]||(function(e){return``+t+e}))(e[t])}).join(``)}var qa=e=>Array(e.buffered.length).fill(void 0).map((t,n)=>({index:n,start:e.buffered.start(n),end:e.buffered.end(n)})),Ja=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})}),Ya=(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),Ja(e))),unbufferRange:(t,n)=>r(()=>t>=n?Promise.resolve():(e.remove(t,n),Ja(e))),updateTimestampOffset:t=>r(async()=>{e.timestampOffset=t}),endOfStream:()=>r(async()=>{if(!(t.readyState!==`open`||e.updating))try{t.endOfStream()}catch{}})}},Xa=(e,t)=>e.createEvent(t),Za=e=>e===void 0?void 0:new URL(e,document.baseURI).toString(),Qa=e=>new Date(e).toISOString().slice(11,22),$a=1,eo=e=>new Map(za(e).styles.style.map((e,t)=>[e.Name,t+$a])),to=(e,t)=>{let n=t.replace(/^\*+/,``),r=n.toLowerCase()==="default"?`Default`:n;return e.styles.get(r)??e.styles.get(`Default`)??0},no=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:eo(e.content)}:(console.warn(`subtitle stream ${e.streamIndex} has no Events format, ignoring the track`),null)},ro=(e,t)=>{let[n,r]=t.content.split(`,`),i=Number(n),a=`Dialogue: ${r},${Qa(t.start)},${Qa(t.end)},${t.content.replace(`${i},${r},`,``)}`,o=za(`${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:to(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}}},io=e=>{let{video:t,canvas:n,workerUrl:r}=e,i=Za(e.wasmUrl),a=Za(e.legacyWasmUrl),o=Za(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 Ea({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=no(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=ro(e,t);if(n.has(r.index))continue;n.set(r.index,r),f===t.streamIndex&&s&&Xa(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()??[])Xa(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}}},ao=class extends Error{mediaElement=!0;constructor(e,t){super(e,t),this.name=`MediaElementError`}},oo=e=>!!e&&typeof e==`object`&&e.mediaElement===!0,so=-20,co=60,lo=30,uo=-5,fo=20,po=5,mo=15e3,ho=1,go=3,_o=12,vo=200,yo=250,bo=25e5,xo=e=>{let{worker:t}=e,n=setTimeout(()=>t.terminate(),2e3);e.destroy().catch(()=>{}).finally(()=>{clearTimeout(n),t.terminate()})},So=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=bo,audioStreamIndex:f,onReady:p,onError:m,onRecovered:h,onSeek:g,onSubtitleStreams:_,onAudioStreams:v}=e,y=await ba({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(()=>xo(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=io({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`))},mo),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}=Ya(T,C);await E(e.data),e.subtitles?.length&&a.pushFragments(e.subtitles),p?.();let A=!1,j=!1,M=0,N,P=()=>N??t.currentTime,F=!1,ee=0,te=0,I=null,L=0,ne=0,R=!1,z=0,re=(e,t,n=!1)=>{let r=e?.message===`Cancelled`;t&&r||(console.error(e),!(R&&!n)&&(R=!0,m?.(r?Error(`Reading the video file failed`,{cause:e}):e)))},ie=async(e=!1)=>{if(M>0&&!e)return;let n=t.currentTime,r=e?uo:so,i=e?fo:co;for(let{start:e,end:t}of qa(T))e<n+r&&await D(e,n+r),t>n+i&&await D(n+i,t)},B=()=>{let e=qa(T);if(!e.length)return!0;let t=P(),n=e.find(e=>e.start<=t+ho&&t<e.end);return n&&n.end>=t+co?!1:!n||n.end<t+lo},ae=()=>{let e=t.currentTime;return qa(T).find(t=>t.start<=e+ho&&e<t.end)},oe=()=>{let e=ae();return!!e&&e.end>=ne-.1},se=()=>{let e=qa(T).map(e=>e.end);e.length&&(ne=Math.max(ne,...e))},ce=async e=>{j=!0,I=null,L=0,z=e;let t=++te;try{let{data:n,pts:r,subtitles:i,finished:o}=await y.seek(e);if(x||t!==te||(o&&(F=!0),i?.length&&a.pushFragments(i),await O(r),x||t!==te))return;n.byteLength&&(await E(n),se())}catch(e){re(e,x||t!==te)}finally{t===te&&(j=!1)}},le=async()=>{let e=I;if(e)try{await E(e),se(),I===e&&(I=null,L=0)}catch(n){if(I!==e)return;if(n?.name===`QuotaExceededError`){let n=await ie(!0).then(()=>!0,()=>!1);if(I!==e)return;if(n){F=!1,await ce(ae()?.end??t.currentTime);return}}if(L+=1,L<po)return;throw I=null,n}},ue=async()=>{if(A||j||_e!==void 0||x||!I&&(F||!B()))return;let e=++ee,t=te,n=()=>x||e!==ee||t!==te;A=!0;try{if(!I){let{data:e,subtitles:t,finished:r}=await y.read();if(n()||(r&&(F=!0),t?.length&&a.pushFragments(t),!e.byteLength))return;I=e,L=0}await le(),!n()&&R&&(R=!1,h?.())}catch(e){re(e,n())}finally{e===ee&&(A=!1)}},de=e=>e>=z&&!!ae(),fe=e=>qa(T).some(t=>t.start<=e+ho&&e<t.end),pe=e=>{let t=qa(T).find(t=>t.start<=e+ho&&e<t.end);return t?t.end-e:0},V=async e=>{if(!x&&!(pe(e)>=go)){F=!1,M++,N=e;try{fe(e)||await ce(e);let t=te;for(let n=0;n<_o&&!(x||t!==te||F||pe(e)>=go);n++){let t=pe(e);if(await ue(),pe(e)<=t)break}}finally{M--,N===e&&(N=void 0)}}},H=0,U=null,me,he=e=>{let t=performance.now(),n=t-H;if(n>=vo){H=t,U=null,g?.(e);return}U=e,!me&&(me=setTimeout(()=>{me=void 0;let e=U;U=null,!(e===null||x)&&(H=performance.now(),g?.(e))},vo-n))};b.push(()=>{me&&clearTimeout(me)});let ge=0,_e;b.push(()=>{_e&&clearTimeout(_e)});let ve=()=>{let n=t.currentTime,r=e.info.input.duration||t.duration;r>0&&he(Math.min(Math.max(n/r,0),1));let i=performance.now(),a=i-ge<yo;if(ge=i,!de(n)&&!(j&&Math.abs(n-z)<.001)){if(F=!1,_e&&clearTimeout(_e),!a){_e=void 0,ce(n);return}_e=setTimeout(()=>{if(_e=void 0,x)return;let e=t.currentTime;de(e)||(F=!1,ce(e))},yo)}};t.addEventListener(`seeking`,ve),b.push(()=>t.removeEventListener(`seeking`,ve));let ye=!1,be=()=>{if(ye)return;ye=!0;let e=t.error;re(new ao(`the media element failed: ${e?.message??`unknown`}`,{cause:e}),!1,!0)};t.addEventListener(`error`,be),b.push(()=>t.removeEventListener(`error`,be));let xe=setInterval(()=>{ye||t.error||(ie().catch(()=>{}),ue().catch(e=>re(e,!1)),F&&!I&&oe()&&C.readyState===`open`&&k().catch(()=>{}))},100);return b.push(()=>clearInterval(xe)),{destroy:S,prepareSeek:V,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}},Co=5,wo=500,To=320,Eo=1e6,Do=3,Oo=1e4,ko=async e=>{let{publicPath:t,workerUrl:n,length:r,read:i,onThumbnails:a,width:o=To}=e,s=await xa({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??Co,n/wo),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)+Eo,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`)),Oo))]),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>=Do})};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=[],xo(s)}}}catch(e){throw xo(s),e}},Ao=1280,jo=1920,Mo=250,No=100,Po=()=>typeof HTMLCanvasElement<`u`&&`captureStream`in HTMLCanvasElement.prototype,Fo=()=>typeof document<`u`&&typeof HTMLVideoElement<`u`&&typeof HTMLVideoElement.prototype.requestPictureInPicture==`function`&&!!document.pictureInPictureEnabled,Io=()=>typeof HTMLVideoElement<`u`&&`mozCaptureStream`in HTMLVideoElement.prototype,Lo=()=>Po()?Fo()?`window`:Io()?`burn-in`:null:null,Ro=e=>{let{video:t,canvas:n}=e,r=e.mode??Lo()??`window`,i=e.maxWidth??(r===`burn-in`?jo:Ao),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,No)})).catch(()=>{}).finally(()=>{e.pause(),setTimeout(()=>{l=!1},No)})},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()},Mo),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 zo(e){return typeof e==`string`}function Bo(e){return typeof e==`number`}function K(e){return typeof e==`function`}function Vo(e){return e===null}function q(e){return e===void 0}function Ho(e){return typeof e==`object`&&!!e}function Uo(e,t){let n={...t};for(let t in e)q(e[t])||(n[t]=e[t]);return n}function Wo(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}var Go=Object.prototype.hasOwnProperty;function Ko(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(!Go.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var qo=new Map,Jo=new Set;function Yo(e){return e.trim().replaceAll(`_`,`-`).toLowerCase()}function Xo(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 Zo(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 Qo(e){return Xo(Yo(e))}function $o(e){let t=Qo(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=Zo(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 es(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n],i=qo.get(r);i&&Object.assign(t,i)}return t}function ts(e){return es($o(e))}function ns(e){return Jo.add(e),()=>{Jo.delete(e)}}function rs(e){return typeof e==`string`?e:e.text}function is(e){return Ho(e)&&`key`in e&&`text`in e}var as=/\{([^{}]+)\}/g;function os(e,t){return t?e.replace(as,(e,n)=>Object.hasOwn(t,n)?String(t[n]):e):e}function ss(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):os(rs(e),t??n)}function cs(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,os(o??(i?t.text:s)??String(a),c)}}u();var ls=L(null);L(void 0);function us(){let e=s(ls),[t,n]=ne(e=>e+1,0);x(()=>ns(()=>n()),[]);let r=E(()=>cs(ts(`en`),`en`),[t]);return e?e.translator:r}function ds(){return s(ls)?.locale??`en`}function fs(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function ps(e){let t=e.composedPath();return t.length>0?t[0]:e.target}function ms(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 hs(e=document){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}function gs(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}var _s=[`button`,`input`,`select`,`textarea`,`a[href]`,`[role="button"]`,`[role="menu"]`,`[role="menuitem"]`,`[role="menuitemcheckbox"]`,`[role="menuitemradio"]`,`[role="slider"]`,`[data-interactive]`].join(`,`),vs=[`textarea`,`select`,`input:not([type])`,...[`text`,`search`,`url`,`tel`,`email`,`password`,`number`].map(e=>`input[type="${e}"]`),`[contenteditable]:not([contenteditable="false"])`].join(`,`);function ys(e){return e.matches(vs)}function bs(e){let t=ps(e);return t instanceof Element&&ys(t)}function xs(e){let t=ps(e);return t instanceof Element?t.closest(_s)!==null:!1}var Ss=new Set([` `,`Enter`]),Cs=`button,a[href],[role="slider"],[role="button"]`;function ws(e){if(!Ss.has(e.key))return!1;let t=ps(e);return t instanceof Element&&t.matches(Cs)}function J(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Ts(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var Es={sideOffset:0,boundaryOffset:0},Ds={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Os(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 ks(e,t,n,r,i=Es){let a=r.side,o=Ds[a],s=a===`top`||a===`bottom`?t.height:t.width,c=Os(e,n,a,i);return c>=s?a:Os(e,n,o,i)>c?o:a}function As(e){try{e?.showPopover?.()}catch{}}function js(e){try{e?.hidePopover?.()}catch{}}function Ms(e){return e instanceof Node&&e.nodeType===11&&`host`in e}function Ns(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 Ps(e){return e.kind===`captions`||e.kind===`subtitles`}function Fs(e,t){if(!(e instanceof HTMLElement))return null;for(let n of e.querySelectorAll(`track`))if(n.track===t)return n;return null}function Is(e,t){return e.textTracks?Array.from(e.textTracks).filter(t).sort(Ls):[]}function Ls(e,t){return e.kind>t.kind?1:e.kind<t.kind?-1:0}function Rs(e){let t=[];for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function zs(e,t){let n=t;for(;n;){if(n===e||e.contains(n))return!0;let t=n.getRootNode();n=Ms(t)?t.host:n.parentNode}return!1}function Bs(){return`WebKitPlaybackTargetAvailabilityEvent`in globalThis}function Vs(e){return Bs()&&`webkitCurrentPlaybackTargetIsWireless`in e}u();function Hs(e,t){if(K(e))return e(t);e!=null&&(e.current=t)}function Us(...e){let t=e.flat();return e=>{let n=t.map(t=>Hs(t,e));if(n.some(K))return()=>{for(let e=0;e<n.length;e++){let r=n[e];K(r)?r():Hs(t[e],null)}}}}function Ws(...e){return b(Us(...e),[...e])}u();function Gs(e,t,n,r=Ko){let i=p(void 0),a=()=>{let e=n(t());return i.current!==void 0&&r(i.current,e)?i.current:(i.current=e,e)};return h(e,a,a)}function Ks(e){return e}function qs(...e){}function Js(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 Ys(e,t,n){return Gs(t=>e.subscribe(t),()=>e.current,t??Ks,n)}var Xs=()=>qs;function Zs(e,t,n){return Gs(t?t=>e.subscribe(t):Xs,t?()=>e.state:()=>e,t??Ks,n)}u();var Qs=L(null),$s=()=>{},ec={state:{},subscribe:()=>$s};function tc({value:e,children:t}){return z(Qs.Provider,{value:e,children:t})}function nc(){let e=s(Qs);if(!e)throw Error(`usePlayerContext must be used within a Player Provider`);return e}function rc(e){let{store:t}=nc();return Zs(t,e)}function ic(e){let t=s(Qs),n=Zs(t?.store??ec,t?e:void 0);return t?n:void 0}function ac(){let{media:e}=nc();return e}function oc(){let{container:e}=nc();return e}function sc(){return s(Qs)?.container??null}function cc(){return s(Qs)?.popupGroup}function lc(){return s(Qs)?.setMedia}function uc(){return s(Qs)?.setContainer}function dc(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 fc=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),dc([this.#e.signal,t.signal])}};function pc(...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 mc=class extends Error{code;cause;constructor(e,t){super(t?.message??e),this.name=`StoreError`,this.code=e,this.cause=t?.cause}};function hc(){throw new mc(`NO_TARGET`)}function gc(){throw new mc(`DESTROYED`)}var _c={target:hc,signals:new fc,get:hc,set:hc};function vc(e){let t=e.state(_c),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return Wo(e,n)}:()=>void 0,{displayName:e.name})}function yc(){return e=>e}var bc=!1;function xc(){bc||(bc=!0,queueMicrotask(Cc))}var Sc=new Set;function Cc(){bc=!1;for(let e of Sc)e.flush();Sc.clear()}var wc=Object.prototype.hasOwnProperty,Tc=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(!wc.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 qs;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,Sc.add(this),xc()}};function Ec(e){return new Tc(e)}var Dc=Symbol.for(`@videojs/store`);function Oc(){return(e,t={})=>{let n=null,r=!1,i=new AbortController,a=new fc,o;function s(){r&&gc(),n||hc()}let c=e.state({target:()=>(s(),n),signals:a,get:()=>o.current,set:e=>o.patch(e)});o=Ec(c);let l={[Dc]:!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&&gc(),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(){Vo(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 kc=yc();function Ac(e,t){if(arguments.length===1)return kc(e);let{name:n,state:r,attach:i}=e,a=e=>kc({...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 jc=Object.freeze({length:0,start:()=>0,end:()=>0}),Mc=Object.assign(new EventTarget,{length:0,*[Symbol.iterator](){},getTrackById:()=>null}),Nc=new EventTarget;Object.freeze({});var Pc=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 Fc(e){return e.readyState>=1}function Ic(e){if(!Ho(e))return!1;let t=e;return!q(t.paused)&&!q(t.ended)&&K(t.pause)}function Lc(e){if(!Ho(e))return!1;let t=e;return!q(t.currentTime)&&!q(t.duration)&&!q(t.seeking)}function Rc(e){if(!Ho(e))return!1;let t=e;return!q(t.src)&&!q(t.currentSrc)&&!q(t.readyState)&&K(t.load)}function zc(e){if(!Ho(e))return!1;let t=e;return!q(t.volume)&&!q(t.muted)}function Bc(e){return Ho(e)?!q(e.playbackRate):!1}function Vc(e){if(!Ho(e))return!1;let t=e;return!q(t.buffered)&&t.buffered!==jc&&!q(t.seekable)&&t.seekable!==jc}function Hc(e){return Ho(e)?!q(e.error):!1}function Uc(e){if(!Ho(e))return!1;let t=e;return!q(t.textTracks)&&t.textTracks!==Mc}function Wc(e){return Ho(e)?!q(e.videoRenditions):!1}function Gc(e){return Ho(e)?!q(e.audioTracks):!1}function Kc(e){if(!Ho(e))return!1;let t=e;return!q(t.videoWidth)&&!q(t.videoHeight)}function qc(e){if(!Ho(e))return!1;let t=e;return Ho(t.remote)&&t.remote!==Nc}function Jc(e){return Ho(e)?!q(e.streamType):!1}function Yc(e){if(!Ho(e))return!1;let t=e;return!q(t.liveEdgeStart)&&!q(t.targetLiveWindow)}function Xc(e){return Ho(e)&&`querySelectorAll`in e&&K(e.querySelectorAll)}var Zc={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`};function Qc(e,t){return e.id||String(t)}function $c(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 el=Ac({name:`audioTrack`,state:({target:e})=>({audioTrackList:[],selectAudioTrack(t){let{media:n}=e();if(!Gc(n))return;let r=[...n.audioTracks],i=r.find((e,n)=>Qc(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=()=>Gc(r)?r.audioTracks:null,s=(e=o())=>{n({audioTrackList:e?[...e].map($c):[]})},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})}}),tl=Ac({name:`buffer`,state:()=>({buffered:[],seekable:[]}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Vc(r))return;let i=()=>n({buffered:Rs(r.buffered),seekable:Rs(r.seekable)});i(),J(r,`progress`,i,{signal:t}),J(r,`emptied`,i,{signal:t})}});function nl(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 rl=250,il=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 xs(e)?!1: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>rl||xs(e))return;let n=e.pointerType,r=e.clientX,i=this.#e,a=this.#t,o={resolve:e=>cl(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}}},al=new WeakMap;function ol(e){return al.get(e)}function sl(e){let t=al.get(e);return t||(t=new il(e),al.set(e,t)),t}function cl(e,t,n,r,i){let a=i.getBoundingClientRect(),o=ll(e,t,n),s=o.size>0?nl(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 ll(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 ul(e){let t=e;if(Ho(t.remote)&&`state`in t.remote&&`prompt`in t.remote)return t.remote}function dl(e){return ul(e)?.state===`connected`}function fl(e){return ul(e)?.state===`connecting`}async function pl(e){let t=ul(e);if(!t)throw new DOMException(`Remote playback not supported`,`NotSupportedError`);return t.prompt()}var ml=2e3,hl=250,gl=500,_l=Ac({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(!Ic(i)||Vo(a))return;let o=e=>e||i.paused||dl(i)||fl(i),s;function c(){clearTimeout(s),s=void 0}function l(){c(),s=setTimeout(d,ml)}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<gl;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<hl){if(ol(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}),qc(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()}}),vl=Ac({name:`error`,state:({set:e})=>({error:null,dismissError(){e({error:null})}}),attach({target:e,signal:t,set:n}){let{media:r}=e;Hc(r)&&(J(r,`error`,()=>n({error:r.error}),{signal:t}),J(r,`emptied`,()=>n({error:null}),{signal:t}))}});function yl(){let e=document;return e.fullscreenEnabled||e.webkitFullscreenEnabled?!0:K(document.createElement(`video`).webkitSetPresentationMode)}function bl(){let e=document;return e.fullscreenElement??e.webkitFullscreenElement??null}function xl(e){if(!(e instanceof Element))return!1;try{return e.matches(`:fullscreen`)}catch{return!1}}function Sl(e,t){if(t.webkitPresentationMode===`fullscreen`)return!0;let n=bl();return n&&(n===e||n===t)||xl(e)||xl(t)?!0:t.isFullscreen??!1}async function Cl(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 wl(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 Tl(){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 El(e){return e.webkitPresentationMode===`picture-in-picture`||document.pictureInPictureElement===e?!0:e.isPictureInPicture??!1}async function Dl(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 Ol(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 kl=Ac({name:`fullscreen`,state:({target:e})=>({fullscreen:!1,fullscreenAvailability:`unavailable`,async requestFullscreen(){let{media:t,container:n}=e();return El(t)&&await Ol(t),Cl(n,t)},async exitFullscreen(){let{media:t}=e();return wl(t)},async toggleFullscreen(){let{media:t,container:n}=e();return Sl(n,t)?wl(t):(El(t)&&await Ol(t),Cl(n,t))}}),attach({target:e,signal:t,set:n}){let{media:r,container:i}=e;n({fullscreenAvailability:yl()?`available`:`unsupported`});let a=()=>n({fullscreen:Sl(i,r)});a(),J(document,`fullscreenchange`,a,{signal:t}),J(document,`webkitfullscreenchange`,a,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,a,{signal:t})}}),Al=Ac({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Yc(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})}}),jl=Ac({name:`pip`,state:({target:e})=>({pip:!1,pipAvailability:`unavailable`,async requestPictureInPicture(){let{media:t,container:n}=e();return Sl(n,t)&&await wl(t),Dl(t)},async exitPictureInPicture(){let{media:t}=e();return Ol(t)},async togglePictureInPicture(){let{media:t,container:n}=e();return El(t)?Ol(t):(Sl(n,t)&&await wl(t),Dl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;n({pipAvailability:Tl()?`available`:`unsupported`});let i=()=>n({pip:El(r)});i(),J(r,`enterpictureinpicture`,i,{signal:t}),J(r,`leavepictureinpicture`,i,{signal:t}),`webkitPresentationMode`in r&&J(r,`webkitpresentationmodechanged`,i,{signal:t})}}),Ml=Ac({name:`playback`,state:({target:e})=>({paused:!0,ended:!1,started:!1,waiting:!1,play(){return e().media.play()},pause(){let{media:t}=e();Ic(t)&&t.pause()},togglePaused(){let t=e().media;return Ic(t)?t.paused?(t.play(),!0):(t.pause(),!1):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Ic(r)||!Lc(r)||!Rc(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})}}),Nl=[.2,.5,.7,1,1.2,1.5,1.7,2],Pl=Ac({name:`playbackRate`,state:({target:e})=>({playbackRates:Nl,playbackRate:1,setPlaybackRate(t){let{media:n}=e();Bc(n)&&(n.playbackRate=t)}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Bc(r))return;let i=()=>n({playbackRate:r.playbackRate});i(),J(r,`ratechange`,i,{signal:t})}}),Fl=`auto`;function Il(e,t){return e.id||String(t)}function Ll(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 Rl(e){return e.width&&e.height?Math.min(e.width,e.height):e.height??e.width}var zl=Ac({name:`quality`,state:({target:e})=>({videoRenditionList:[],activeVideoRendition:null,selectVideoRendition(t){let{media:n}=e();if(!Wc(n))return;if(t===Fl){n.videoRenditions.selectedIndex=-1;return}let r=[...n.videoRenditions].findIndex((e,n)=>Il(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=()=>Wc(r)?r.videoRenditions:null,s=e=>{if(!e)return null;let t=[...e],n=t.find(e=>e.active);if(n)return n;if(!Kc(r)||!r.videoWidth&&!r.videoHeight)return null;let i=Rl({width:r.videoWidth||void 0,height:r.videoHeight||void 0}),a=t.filter(e=>Rl(e)===i);return a.length===1?a[0]:null},c=(e=o())=>{let t=s(e);n({videoRenditionList:e?[...e].map(Ll):[],activeVideoRendition:t?Ll(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})}}),Bl=Ac({name:`remotePlayback`,state:({target:e})=>({remotePlaybackState:`disconnected`,remotePlaybackAvailability:`unsupported`,async toggleRemotePlayback(){let{media:t,container:n}=e();return dl(t)?pl(t):(Sl(n,t)&&await wl(t),await pl(t))}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!qc(r))return;if(Vs(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(()=>{})})}}),Vl=Ac({name:`source`,state:({target:e,signals:t})=>({source:null,canPlay:!1,loadSource(n){t.clear();let{media:r}=e();return Rc(r)?(r.src=n,r.load(),n):n}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!Rc(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})}}),Hl=Ac({name:`streamType`,state:()=>({streamType:Zc.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(Jc(r)){let e=()=>n({streamType:r.streamType});e(),J(r,`streamtypechange`,e,{signal:t});return}if(!Lc(r))return;let i=()=>{let{duration:e}=r;return e===1/0?Zc.LIVE:Number.isFinite(e)&&e>0?Zc.ON_DEMAND:Zc.UNKNOWN},a=()=>n({streamType:i()});a(),J(r,`durationchange`,a,{signal:t}),J(r,`loadedmetadata`,a,{signal:t}),J(r,`emptied`,a,{signal:t}),Vc(r)&&J(r,`progress`,a,{signal:t})}});function Ul(e,t){return e.id||`track:${t}:${e.kind}:${e.language}:${e.label}`}var Wl=Ac({name:`textTrack`,state:({target:e})=>({chaptersCues:[],thumbnailCues:[],thumbnailTrackSrc:null,textTrackList:[],subtitlesShowing:!1,toggleSubtitles(t){let{media:n}=e();if(!Uc(n))return!1;let r=Is(n,Ps);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(!Uc(n))return;let r=Array.from(n.textTracks).map((e,t)=>({index:t,track:e})).filter(({track:e})=>Ps(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})=>Ul(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(!Uc(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:Ul(i,n),kind:i.kind,label:i.label,language:i.language,mode:i.mode}),Ps(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=Fs(r,t)?.src??null);let d=Xc(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})}}),Gl={seek:Symbol.for(`@videojs/seek`)},Kl=Ac({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(Gl.seek);if(!Lc(i)||!Rc(i))return 0;if(!Fc(i)&&!await ms(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 ms(i,`seeked`,{signal:a}).catch(qs),i.currentTime}}),attach({target:e,signal:t,set:n,get:r}){let{media:i}=e;if(!Lc(i))return;let a=()=>{let{duration:e}=i;if(e===1/0&&Vc(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})}}),ql=.25,Jl=Ac({name:`volume`,state:({target:e})=>({volume:1,muted:!1,volumeAvailability:`unavailable`,setVolume(t){let{media:n}=e();if(!zc(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 zc(t)?(t.muted||t.volume===0?(t.muted=!1,t.volume===0&&(t.volume=ql)):t.muted=!0,t.muted):!1}}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!zc(r))return;n({volumeAvailability:Yl()});let i=()=>n({volume:r.volume,muted:r.muted});i(),J(r,`volumechange`,i,{signal:t})}});function Yl(){let e=document.createElement(`video`);try{return e.volume=.5,e.volume===.5?`available`:`unsupported`}catch{return`unsupported`}}vc(el);var Xl=vc(tl),Zl=vc(_l),Ql=vc(vl),$l=vc(kl);vc(Al);var eu=vc(jl),tu=vc(Ml),nu=vc(Pl);vc(zl),vc(Bl),vc(Vl),vc(Hl);var ru=vc(Wl),iu=vc(Kl),au=vc(Jl),ou={seekStep({store:e,value:t}){if(q(t))return;let n=iu(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(q(t))return;let n=au(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=nu(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=nu(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])}},su={seekStep:ou.seekStep,volumeStep:ou.volumeStep,speedUp:ou.speedUp,speedDown:ou.speedDown};function cu(e){return su[e]||(({store:t})=>{let n=t.state[e];K(n)&&n()})}var lu=200,uu=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<lu){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)},lu);return}e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},du=new WeakMap;function fu(e){let t=du.get(e);return t||(t=new uu,du.set(e,t),t)}function pu(e,t,n){return sl(e).add({type:`tap`,recognizer:fu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function mu(e,t,n){return sl(e).add({type:`doubletap`,recognizer:fu(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function hu(e){return e.startsWith(`toggle`)}var gu={togglePaused({store:e}){let t=tu(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){au(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=$l(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){ru(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=eu(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:ou.seekStep,volumeStep:ou.volumeStep,speedUp:ou.speedUp,speedDown:ou.speedDown,seekToPercent({store:e,value:t,key:n}){let r=iu(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 _u(e){return gu[e]}var vu={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},yu={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},bu=[`ctrl`,`shift`,`alt`,`meta`];function xu(e){return e.map(e=>{let t=[];for(let n of bu)e.modifiers.has(n)&&t.push(vu[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function Su(e){let t=[];for(let n of bu)e.modifiers.has(n)&&t.push(yu[n]);return t.push(Cu(e.originalKey)),t.join(`+`)}function Cu(e){return e.length===1?e.toUpperCase():e}var wu=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:Eu(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:xu(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`||ws(e)||e.defaultPrevented)return;let t=bs(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(Ou(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:Su(e.parsed[0])}#h(){for(let e of this.#o)e()}},Tu=new Set([`shift`,`ctrl`,`alt`,`meta`]);function Eu(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(Ts()?`meta`:`ctrl`):Tu.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function Du(e){return e.length===1&&!/[a-z]/i.test(e)}function Ou(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=Du(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 ku=new WeakMap;function Au(e){let t=ku.get(e);return t||(t=new wu(e),ku.set(e,t)),t}function ju(e,t){return Au(e).add(t)}var Mu=[Ml,Pl,zl,el,Jl,Kl,Vl,tl,kl,jl,Bl,_l,Wl,vl];function Nu(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 Pu(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=Nu({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 Fu(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 Iu=`group`;function Lu(e){let t=hs(e.ownerDocument);(!t||t===e.ownerDocument.body||!zs(e,t))&&e.focus({preventScroll:!0})}var Ru={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function zu(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function Bu(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=Nu({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():!0}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||(js(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&&js(i),i=e,e&&u.current.active&&As(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Vu(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 Hu(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 Vu(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Uu(e){let t=document.documentElement.getBoundingClientRect();return e?Hu(t,e.getBoundingClientRect()):t}function Wu(e,t={}){if(!e)return null;if(!zo(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 Gu={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 Ku(e,t,n){return Math.max(t,Math.min(n,e))}function qu(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 Ju={sideOffset:0,alignOffset:0,boundaryOffset:0},Yu={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Xu(e){return`${Ku(e,0,1/0)}px`}function Zu(e,t,n,r){let i=n-r;return i<t?t:Ku(e,t,i)}function Qu(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 $u(e,t,n,r,i,a,o=Gu){if(gs())return{...ed(e,t,o,n,i,a),...n&&i?td(n,i,t,a,o):{}};if(n&&r){let e=a??Ju;return{position:`fixed`,margin:`0`,...nd(n,r,t,e,i),...i?td(n,i,t,e,o):{}}}return{}}function ed(e,t,n=Gu,r,i,a=Ju){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=Yu[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=Qu(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}=Qu(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 td(e,t,n,r=Ju,i=Gu){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]=Xu(t-r.sideOffset),a[i.availableWidth]=Xu(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=Xu(t-r.sideOffset),a[i.availableHeight]=Xu(d-u)}return a}function nd(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=Zu(d,i.left+e,i.right-e,t.width):l=Zu(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 rd(e,t=Gu){let n=getComputedStyle(e);return{sideOffset:Ns(e,n.getPropertyValue(t.sideOffset)),alignOffset:Ns(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Ns(e,n.getPropertyValue(t.boundaryOffset))}}function id(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Vu(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 ad(){let e=null;return{open(t){e!==t&&(e?.close(`group-open`),e=t)},close(t){e===t&&(e=null)}}}function od(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)?Ku(i*100,0,100):0}function sd(e){let t=Ec({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?Js(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(Vo(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=od(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(!Vo(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=od(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=od(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),Vo(s)))return;let n=od(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){Vo(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=qu(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;break}c!==null&&(n.preventDefault(),c=Ku(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 cd={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function ld(e){return{[cd.fill]:`${e.fillPercent.toFixed(3)}%`,[cd.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function ud(e){return{...ld(e),[cd.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function dd(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${cd.pointer}) - ${n}px)`:`min(max(0px, calc(var(${cd.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var fd=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 pd(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new fd,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 md={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function hd(e){let t={transition:e.transition,onOpenChange(t,n){let r=md[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=Bu(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 gd(){let e=Ec({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&&(vd(i),_d(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();yd(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 _d(e){e&&e.offsetHeight}function vd(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function yd(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(qs,qs)}function bd(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=Ku(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function xd(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 Sd(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??Cd(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function Cd(e){return`data-${e.toLowerCase()}`}var wd={key:`container.label`,text:`Media player`};u();var Td=_(function({children:e,tabIndex:t=0,role:n=Iu,"aria-label":r,"aria-labelledby":i,...a},o){let s=uc(),c=us(),l=p(null),u=Ws(o,l);x(()=>(s?.(l.current),()=>s?.(null)),[s]);let d=e=>{a.onPointerUp?.(e);let t=l.current;t&&Lu(t)};return z(`div`,{ref:u,role:n,tabIndex:t,...r!==void 0||i!==void 0?{"aria-label":r,"aria-labelledby":i}:{"aria-label":c(wd)},...a,onPointerUp:d,children:e})});u();function Y(e){let t=p(e);return t.current=e,t}u();function Ed(e,t,n){let r=p(null),i=Y(t),a=Y(n);x(()=>(r.current===null?i.current?.():(clearTimeout(r.current),r.current=null),()=>{r.current=setTimeout(()=>{a.current?.(),e.destroy()},0)}),[e])}u();function Dd(e){function t({children:t}){let[n,r]=S(()=>Oc()(pc(...e.features))),[i]=S(()=>ad()),[a,o]=S(null),[s,c]=S(null);return Ed(n),x(()=>{if(a){if(n.destroyed){r(Oc()(pc(...e.features)));return}return n.attach({media:a,container:s})}},[a,s,n]),z(tc,{value:E(()=>({store:n,media:a,setMedia:o,container:s,setContainer:c,popupGroup:i}),[n,a,s,i]),children:t})}function n(e){let{store:t}=nc();return Zs(t,e)}return{Provider:t,Container:Td,usePlayer:n,useMedia:ac}}function Od(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function kd(e,t){return Od(e)&&(typeof t==`function`||t===void 0)}function Ad(e,t){return t?e?n=>{t(n),e(n)}:t:e}function jd(e,t){return t&&e?`${t} ${e}`:t||e}function Md(e,t){return t?e?{...e,...t}:t:e}function Nd(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=jd(e.className,r):n===`style`?e.style=Md(e.style,r):kd(n,r)?e[n]=Ad(e[n],r):e[n]=r}return e}function Pd(...e){let t={};for(let n of e)t=Nd(t,n);return t}u();function Fd(e,t){return K(e)?e(t):e}function Id(e,t){return K(e)?e(t):e}function Ld(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=Fd(r,o),d=Id(i,o),f=Pd(l?Sd(o,l):{},...Array.isArray(c)?c:c?[c]:[]);if(u!==void 0&&(f.className=f.className?`${f.className} ${u}`:u),d!==void 0&&(f.style=f.style?{...f.style,...d}:d),K(a)){let e=Us(s,f.ref);return a({...f,ref:e},o)}if(v(a)){let e=Ld(a),t=Us(s,f.ref,e),n=Pd(f,a.props);return n.ref=t,y(a,n)}return f.ref=Us(s,f.ref),j(e,f)}u();function Rd(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=b(e=>{},[t]);return{getButtonProps:b(e=>Pd(Fu({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}u();function zd(e,t){let n=oc(),[r,i]=S({});return x(()=>{if(!n||!e){i({});return}let r=Au(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}u(),L(null).Provider,L(null).Provider,L(null).Provider,L(null).Provider;var Bd=L(!1);Bd.Provider;function Vd(){return s(Bd)}L(null).Provider,u();var Hd=L(null),Ud=Hd.Provider;function Wd(){let e=s(Hd);if(!e)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return e}function Gd(){return s(Hd)}u();function Kd(e,t){return e.getLabelParams?.(t)}function qd(e){let{displayName:t,core:n,stateAttrMap:r,selector:i,action:a,hotkeyAction:o,hotkeyValue:s,tooltipLabel:c,isSupported:u}=e,d=new Set(Object.keys(n.defaultProps)),f=_(function(e,f){let{render:p,className:m,style:h,...g}=e,_={},v={};for(let e of Object.keys(g))d.has(e)?_[e]=g[e]:v[e]=g[e];let y=Gd(),b=Vd(),x=y?.setContent,C=rc(i),w=zd(o,s?.(_)),T=us(),[E]=S(()=>new n);d.has(`menuTrigger`)&&q(_.menuTrigger)&&(_.menuTrigger=b),E.setProps(_);let{getButtonProps:D,buttonRef:O}=Rd({displayName:t,onActivate:()=>{Promise.resolve(a(E,C)).catch(e=>{})},isDisabled:()=>!!_.disabled||!C});C&&E.setMedia(C);let k=C?E.getState():null,A=k?u?.(k)??!0:!1,j=k&&A?ss(E.getLabel(k),T,Kd(E,k)):void 0,M=k&&A?c?.(E,k)??j:void 0;if(l(()=>{if(x)return x(M?{label:M,shortcut:w.shortcut}:void 0),()=>x(void 0)},[x,M,w.shortcut]),!C||!k||!A)return null;let N=E.getAttrs(k),P=N[`aria-label`],F={...N,...is(P)?{"aria-label":ss(P,T,Kd(E,k))}:void 0,"aria-keyshortcuts":w.aria};return X(`button`,{render:p,className:m,style:h},{state:k,stateAttrMap:r,ref:[f,O],props:[D(),F,v]})});return f.displayName=t,f}function Jd(e,t){return K(e)?e(t)||void 0:e||void 0}var Yd=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,...zu(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},Xd={open:`data-open`,...Ru},Zd=class e{static defaultProps={delay:500};state=Ec({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=Uo(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)}},Qd={visible:`data-visible`},$d=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},ef={visible:`data-visible`,userActive:`data-user-active`},tf=class extends Yd{setProps(){}},nf=`common.`,rf={key:`${nf}empty`,text:``},af={key:`${nf}ok`,text:`OK`},of=`errors.`,sf={key:`${of}aborted`,text:`You stopped media playback before it finished.`},cf={key:`${of}network`,text:`This media could not be loaded due to a network or server issue.`},lf={key:`${of}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},uf={key:`${of}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},df={key:`${of}encrypted`,text:`This media could not be played because it could not be decrypted.`},ff={key:`${of}title`,text:`Something went wrong.`},pf={key:`${of}unexpected`,text:`An unexpected error occurred.`},mf={[Pc.MEDIA_ERR_ABORTED]:sf,[Pc.MEDIA_ERR_NETWORK]:cf,[Pc.MEDIA_ERR_DECODE]:lf,[Pc.MEDIA_ERR_SRC_NOT_SUPPORTED]:uf,[Pc.MEDIA_ERR_ENCRYPTED]:df,[Pc.MEDIA_ERR_CUSTOM]:rf},hf={[Pc.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function gf(e){return e>=Pc.MEDIA_ERR_ABORTED&&e<=Pc.MEDIA_ERR_ENCRYPTED}function _f(){return ff}function vf(){return af}function yf(e,t){if(e){let t=mf[e.code],n=e.message?.trim();if(n){let r=Pc.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=hf[e.code];return t&&gf(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||pf}var bf=`fullscreen.`,xf={key:`${bf}enter`,text:`Enter fullscreen`},Sf={key:`${bf}exit`,text:`Exit fullscreen`},Cf=class e{static defaultProps={label:``,disabled:!1};state=Ec({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){return Jd(this.#e.label,e)||(e.fullscreen?Sf:xf)}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:rs(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()}},wf={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Tf={key:`playback.rate`,text:`Playback rate {rate}`},Ef=`volume.`,Df={key:`${Ef}mutedValue`,text:`{percent}, muted`};`${Ef}`;var Of={key:`${Ef}label`,text:`Volume`};`${Ef}`;var kf=Intl.DurationFormat,Af=new Map;function jf(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 Mf(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Nf(e){let t=Array.isArray(e)?e[0]:e;return t?t===`en`||t.startsWith(`en-`):!0}function Pf(e,t=`long`,n){let r=`${Mf(e)}:${t}:${n??``}`,i=Af.get(r);return i||(i=kf?new kf(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):jf(t,n),Af.set(r,i)),i}function Ff(e){return Bo(e)&&Number.isFinite(e)}function If(e,t){if(!Ff(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=Ff(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=Pf(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Lf(e){if(!Ff(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 Rf(e,t){if(!Ff(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=Pf(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):Nf(t?.locale)?`${c} remaining`:c}return c}var zf=`buttons.`,Bf={key:`${zf}play`,text:`Play`},Vf={key:`${zf}pause`,text:`Pause`},Hf={key:`${zf}replay`,text:`Replay`},Uf={key:`${zf}mute`,text:`Mute`},Wf={key:`${zf}unmute`,text:`Unmute`},Gf=class e{static defaultProps={label:``,disabled:!1};state=Ec({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){return Jd(this.#e.label,e)||(e.muted?Wf:Uf)}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:Kf(e)}),this.state.patch({label:rs(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function Kf(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var qf={muted:`data-muted`,volumeLevel:`data-volume-level`},Jf=`pip.`,Yf={key:`${Jf}enter`,text:`Enter picture-in-picture`},Xf={key:`${Jf}exit`,text:`Exit picture-in-picture`},Zf=class e{static defaultProps={label:``,disabled:!1};state=Ec({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){return Jd(this.#e.label,e)||(e.pip?Xf:Yf)}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:rs(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()}},Qf={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},$f=class e{static defaultProps={label:``,disabled:!1};state=Ec({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){return Jd(this.#e.label,e)||(e.ended?Hf:e.paused?Bf:Vf)}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:rs(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()}}},ep={paused:`data-paused`,ended:`data-ended`,started:`data-started`},tp=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=Ec({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){let t=Jd(this.#e.label,e);return t===void 0?Tf:t}getLabelParams(e){if(Jd(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:rs(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)}},np={rate:`data-rate`},rp=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=Uo(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,...zu(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}}},ip={open:`data-open`,side:`data-side`,align:`data-align`,...Ru},ap=`seek.`,op={key:`${ap}forward`,text:`Seek forward {seconds} seconds`},sp={key:`${ap}backward`,text:`Seek backward {seconds} seconds`},cp=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=Ec({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=Uo(t,e.defaultProps)}getLabel(e){let t=Jd(this.#e.label,e);return t===void 0?e.direction===`backward`?sp:op:t}getLabelParams(e){if(Jd(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:rs(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},lp={seeking:`data-seeking`,direction:`data-direction`},up=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=Uo(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 Jd(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 qu(Ku(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Ku(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)}},dp={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},fp={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function pp(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&&Bo(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Bo(l.w)&&(u.width=l.w),Bo(l.h)&&(u.height=l.h),Bo(l.x)&&Bo(l.y)&&(u.coords={x:l.x,y:l.y}),u}function mp(e,t){let n=[];for(let r of e){let e=pp(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 hp=`time.`,gp={key:`${hp}current`,text:`Current time`},_p={key:`${hp}duration`,text:`Duration`},vp={key:`${hp}remaining`,text:`Remaining`},yp={key:`${hp}remainingSuffix`,text:`{duration} remaining`},bp={key:`${hp}showElapsed`,text:`{duration}. Show elapsed time.`},xp={key:`${hp}showDuration`,text:`{duration}. Show duration.`},Sp={key:`${hp}showRemaining`,text:`{duration}. Show remaining time.`},Cp={key:`${hp}position`,text:`{current} of {duration}`},wp={current:bp,duration:xp,remaining:Sp},Tp={current:gp,duration:_p,remaining:vp},Ep=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=Uo(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 If(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Rf(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Lf(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=Jd(this.#e.label,e);return n===void 0?this.#e.toggle?wp[this.#o(t,e.type)]:Tp[this.#e.type]:n}getLabelParams(e){return Jd(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()}}},Dp={type:`data-type`},Op={key:`slider.seek`,text:`Seek`},kp=class e extends up{static defaultProps={...up.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=Uo(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)||Op}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Rf(e):Rf(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?Cp: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)}}},Ap={...dp,seeking:`data-seeking`},jp=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=Uo(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,...zu(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},Mp={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`},Np={open:`data-open`,side:`data-side`,align:`data-align`,...Ru},Pp=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=Uo(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()}},Fp=new Map;function Ip(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Lp(e){let t=Ip(e),n=Fp.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),Fp.set(t,n)}catch{return}return n}function Rp(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function zp(e,t){let n=!Bo(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Lp(t)??Lp(void 0);if(e)return e.format(n)}catch{}return Rp(n)}var Bp=class e extends up{static defaultProps={...up.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(Uo(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)||Of}getValueText(e){return e.muted?Df:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:zp(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Vp={...dp,availability:`data-availability`};u();var Hp=L(null),Up=Hp.Provider;function Wp(){let e=s(Hp);if(!e)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return e}var Gp=Object.defineProperty,Kp=(e,t)=>{let n={};for(var r in e)Gp(n,r,{get:e[r],enumerable:!0});return t||Gp(n,Symbol.toStringTag,{value:`Module`}),n};u();var qp=_(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=Wp(),c=b(()=>{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]})});u();function Jp(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=_(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 Yp=Jp({displayName:`AlertDialogDescription`,tag:`p`,useContext:Wp,getProps:e=>({id:e.descriptionId})});u();var Xp=_(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=Wp(),l=Ws(i,b(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});u();var Zp=/[^a-zA-Z0-9_-]/g;function Qp(e){let t=I().replace(Zp,``);return e?`${e}-${t}`:t}u();function $p({open:e,defaultOpen:t=Yd.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=S(()=>new Yd),o=e!==void 0,s=Y(n),c=Y(r),[l]=S(()=>{let e=Pu({transition:gd(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=Qp(`alert-dialog-title`),d=Qp(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),x(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),Ed(l);let f=Ys(l.input);return a.setInput(f),z(Up,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:Xd},children:i})}var em=Jp({displayName:`AlertDialogTitle`,tag:`h2`,useContext:Wp,getProps:e=>({id:e.titleId})}),tm=Kp({Close:()=>qp,Description:()=>Yp,Popup:()=>Xp,Root:()=>$p,Title:()=>em});u();var nm=_(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=rc(tu),[c]=S(()=>new Zd);Ed(c),c.setProps({delay:a}),s&&c.update(s);let l=h(e=>c.state.subscribe(e),()=>c.state.current,()=>c.state.current);return s?X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:Qd,ref:[t],props:[o]}):null});u();var rm=L(null),im=rm.Provider;function am(){let e=s(rm);if(!e)throw Error(`Controls compound components must be used within a Controls.Root`);return e}function om(){return s(rm)}u();var sm=_(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=am(),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]})});u();var cm=_(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=rc(Zl),[c]=S(()=>new $d);if(!s)return null;c.setMedia(s);let l=c.getState();return z(im,{value:{state:l,stateAttrMap:ef},children:X(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:ef,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),lm=Kp({Group:()=>sm,Root:()=>cm});u();var um=L(null),dm=um.Provider;function fm(){let e=s(um);if(!e)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return e}u();var pm=_(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=us(),{dialog:c,state:l,stateAttrMap:u}=Wp(),d=b(()=>{r||c.close()},[c,r]),f=i??ss(vf(),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]})});u();var mm=_(function({render:e,className:t,style:n,children:r,...i},a){let o=us(),{state:s,stateAttrMap:c}=Wp(),{lastError:l}=fm(),u=yf(l),d=r??ss(u,o);return X(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});u();function hm({children:e}){let[t]=S(()=>new tf),n=rc(Ql),r=p(n?.error??null);n?.error&&(r.current=n.error);let i=Y(n),[a]=S(()=>Pu({transition:gd(),onOpenChange:e=>{e||i.current?.dismissError()}})),o=Qp(`error-dialog-title`),s=Qp(`error-dialog-desc`);t.setTitleId(o),t.setDescriptionId(s),x(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),Ed(a);let c=Ys(a.input);t.setInput(c);let l=t.getState();return n?z(dm,{value:{lastError:r.current},children:z(Up,{value:{core:t,dialog:a,state:l,stateAttrMap:Xd},children:e})}):null}u();var gm=_(function({render:e,className:t,style:n,children:r,...i},a){let o=us(),{state:s,stateAttrMap:c}=Wp(),l=r??ss(_f(),o);return X(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),_m=Kp({Close:()=>pm,Description:()=>mm,Popup:()=>Xp,Root:()=>hm,Title:()=>gm}),vm=qd({displayName:`FullscreenButton`,core:Cf,stateAttrMap:wf,selector:$l,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});u();function ym({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=rc(),s=oc();return x(()=>{if(!s||!e||!t||a)return;let c=cu(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`?mu(s,l,u):pu(s,l,u)},[s,o,e,t,n,r,i,a]),null}var bm=ym;u();function xm(){let[,e]=ne(e=>e+1,0);return e}u();function Sm(e){let t=Y(e),n=p(null),r=p(null),i=xm(),[a]=S(()=>sd({getElement:()=>n.current,getThumbElement:()=>r.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>n.current?fs(n.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?.()}));Ed(a);let o=Ys(a.input),s=e.computeState(o);return l(()=>{s.thumbAlignment===`edge`&&n.current&&r.current&&i()},[s.thumbAlignment]),{state:s,cssVars:e.getCSSVars(a.adjustForAlignment(s)),rootRef:b(e=>{n.current=e},[]),thumbRef:b(e=>{r.current=e},[]),rootProps:a.rootProps,rootStyle:a.rootStyle,thumbProps:a.thumbProps}}u();function Cm({keys:e,action:t,value:n,disabled:r,target:i}){let a=rc(),o=oc();return x(()=>{if(!o||!e||!t||r)return;let s=_u(t);if(s)return ju(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!hu(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var wm=Cm;u();function Tm(e){let t=e.side,[n,r]=S({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=E(()=>i===t?e:{...e,side:i},[i,e,t]),o=b(e=>r(n=>n.preferred===t&&n.side===e?n:{preferred:t,side:e}),[t]);return x(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var Em=qd({displayName:`MuteButton`,core:Gf,stateAttrMap:qf,selector:au,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),Dm=qd({displayName:`PiPButton`,core:Zf,stateAttrMap:Qf,selector:eu,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),Om=qd({displayName:`PlayButton`,core:$f,stateAttrMap:ep,selector:tu,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),km=qd({displayName:`PlaybackRateButton`,core:tp,stateAttrMap:np,selector:nu,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});u();var Am=L(null),jm=Am.Provider;function Mm(){let e=s(Am);if(!e)throw Error(`Popover compound components must be used within a Popover.Root`);return e}var Nm=Jp({displayName:`PopoverArrow`,tag:`div`,useContext:Mm,staticProps:{"aria-hidden":`true`}});u();var Pm={position:`fixed`,inset:`auto`,margin:0},Fm=_(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,preferredSide:c,setPositionedSide:u,stateAttrMap:d,anchorName:f,popupId:m,boundary:h,container:g}=Mm(),_=p(null),v=Ws(i,b(e=>{o.setPopupElement(e),e&&gs()&&e.style.setProperty(`position-anchor`,`--${f}`)},[o,f]),_),y=E(()=>({side:c,align:s.align}),[c,s.align]),x=E(()=>{if(!gs())return null;let{positionAnchor:e,...t}=$u(f,y);return t},[f,y]),[C,w]=S(null);l(()=>{if(!s.open){w(null);return}function e(){let e=o.triggerElement,t=_.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Wu(h,{container:g,root:r}),a=id(t,y.side),s=Uu(i),c=rd(t),l=ks(n,a,s,y,c),{positionAnchor:d,...p}=$u(f,{...y,side:l},n,gs()?void 0:a,s,c);w(p),u(l)}e();let t=o.triggerElement,n=_.current,r=n?Wu(h,{container:g,root:n.getRootNode()}):null,i=0;function a(t){t&&xd(t,_.current)||(cancelAnimationFrame(i),i=requestAnimationFrame(e))}a();let c=typeof ResizeObserver==`function`?new ResizeObserver(()=>{a()}):null;return t&&c&&c.observe(t),n&&c&&c.observe(n),r&&c&&c.observe(r),window.addEventListener(`scroll`,a,{capture:!0,passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(i),c?.disconnect(),window.removeEventListener(`scroll`,a,!0),window.removeEventListener(`resize`,a)}},[s.open,f,y,o,h,g,u]);let T=C??x??Pm;if(!s.open)return null;let{onFocusOut:D,...O}=o.popupProps;return X(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:d,ref:v,props:[{id:m,style:T,...a.getPopupAttrs(s)},{...O,onBlur:D},r]})});u();function Im({open:e,defaultOpen:t=rp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=rp.defaultProps.openOnHover,delay:a=rp.defaultProps.delay,closeDelay:o=rp.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=sc(),d=cc(),f=om(),[p]=S(()=>new rp(l));p.setProps(l);let m=!q(e),h=Y(n),g=Y(r),_=Y(l.closeOnEscape),v=Y(l.closeOnOutsideClick),y=Y(i),b=Y(a),C=Y(o),w=Y(d),[T]=S(()=>{let e=Bu({transition:gd(),onOpenChange:(e,t)=>{h.current?.(e,t)},onOpenChangeComplete:e=>{g.current?.(e)},closeOnEscape:()=>_.current??rp.defaultProps.closeOnEscape,closeOnOutsideClick:()=>v.current??rp.defaultProps.closeOnOutsideClick,openOnHover:()=>y.current,delay:()=>b.current,closeDelay:()=>C.current,group:()=>w.current});return!m&&t&&e.open(`click`),e}),E=Qp(),D=Qp(`popup`);x(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open(`click`):T.close(`click`))},[e,T]),x(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),Ed(T);let O=Ys(T.input);p.setInput(O);let{state:k,preferredSide:A,setPositionedSide:j}=Tm(p.getState());return z(jm,{value:{core:p,popover:T,state:k,preferredSide:A,setPositionedSide:j,stateAttrMap:ip,anchorName:E,popupId:D,boundary:s,container:u},children:c})}u();var Lm=_(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=Mm(),d=b(e=>{o.setTriggerElement(e),e&&gs()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:p,...m}=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)},{...m,onFocus:f,onBlur:p},r]})}),Rm=Kp({Arrow:()=>Nm,Popup:()=>Fm,Root:()=>Im,Trigger:()=>Lm}),zm=qd({displayName:`SeekButton`,core:cp,stateAttrMap:lp,selector:iu,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:cp.defaultProps.seconds});u();var Bm=_(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:o,crossOrigin:s,loading:c,fetchPriority:l,...u}=e,[d]=S(()=>new fd),f=p(null),m=p(null),h=ic(ru),[,g]=S(0),[_]=S(()=>pd({getContainer:()=>f.current,getImg:()=>m.current,onStateChange:()=>g(e=>e+1)}));Ed(_,()=>_.connect());let v=E(()=>o&&o.length>0?o:h&&h.thumbnailCues.length>0?mp(h.thumbnailCues,h.thumbnailTrackSrc??void 0):[],[o,h]),y=E(()=>d.findActiveThumbnail(v,a),[d,v,a]);_.updateSrc(y?.url);let b=d.getState(_.loading,_.error,y),x={overflow:`hidden`},C;if(y&&_.naturalWidth&&_.naturalHeight){let e=_.readConstraints(),t=d.resize(y,_.naturalWidth,_.naturalHeight,e);t&&(x={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},C={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:b,stateAttrMap:fp,ref:[t,f],props:[d.getAttrs(b),{style:x},u,{children:z(`img`,{ref:m,alt:``,"aria-hidden":`true`,decoding:`async`,src:y?.url,crossOrigin:s===``||s===null?void 0:s,loading:c,style:C,fetchPriority:l})}]})});u();var Vm=L(null);function Hm({value:e,children:t}){return z(Vm.Provider,{value:e,children:t})}function Um(){let e=s(Vm);if(!e)throw Error(`Slider compound components must be used within a Slider.Root`);return e}var Wm=Jp({displayName:`SliderBuffer`,tag:`div`,useContext:Um}),Gm=Jp({displayName:`SliderFill`,tag:`div`,useContext:Um});u();var Km=_(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...o}=e,s=Um(),{state:c}=s,l=p(null),[u,d]=S(0);x(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(([e])=>{d(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let f=dd(u,a);return X(`div`,{render:n,className:r,style:i},{state:c,stateAttrMap:s.stateAttrMap,ref:[t,l],props:[{style:f},o]})});u();var qm=_(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:h,onDragStart:g,onDragEnd:_,...v}=e,[y]=S(()=>new up),b=us();y.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f});let{state:x,cssVars:C,rootRef:w,thumbRef:T,rootProps:E,rootStyle:D,thumbProps:O}=Sm({computeState:e=>(y.setInput(e),y.getSliderState(p)),getPercent:()=>y.percentFromValue(p),getStepPercent:()=>y.getStepPercent(),getLargeStepPercent:()=>y.getLargeStepPercent(),orientation:u,disabled:d,adjustPercent:(e,t,n)=>y.adjustPercentForAlignment(e,t,n),getCSSVars:ld,onValueChange:e=>m?.(y.valueFromPercent(e)),onValueCommit:e=>h?.(y.valueFromPercent(e)),onDragStart:g,onDragEnd:_});return z(Hm,{value:{state:x,pointerValue:y.valueFromPercent(x.pointerPercent),thumbRef:T,thumbProps:O,stateAttrMap:dp,getAttrs:e=>{let t=y.getAttrs(e);return{...t,"aria-label":ss(t[`aria-label`],b)}},formatValue:void 0},children:X(`div`,{render:n,className:r,style:i},{state:x,stateAttrMap:dp,ref:[t,w],props:[{style:{...C,...D}},E,v]})})});u();var Jm=_(function(e,t){let{render:n,className:r,style:i,...a}=e,o=Um(),{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]})});u();var Ym=_(function(e,t){let{pointerValue:n}=Um();return z(Bm,{ref:t,...e,time:n})}),Xm=Jp({displayName:`SliderTrack`,tag:`div`,useContext:Um});u();var Zm=_(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=Um(),{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]})}),Qm=Kp({Buffer:()=>Wm,Fill:()=>Gm,Preview:()=>Km,Root:()=>qm,Thumb:()=>Jm,Thumbnail:()=>Ym,Track:()=>Xm,Value:()=>Zm});u();var $m=_(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]})});u();var eh=_(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]})});u(),w();var th=_(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=rc(iu),d=us(),f=ds(),[p]=S(()=>new Ep),m=a??Ep.defaultProps.type,[h,g]=S(m);if(x(()=>{g(m)},[m,c]),p.setProps({type:h,negativeSign:o,label:s,toggle:c}),!u)return null;p.setMedia(u);let _=p.getState(),v=p.getAttrs(_,m),y=p.getLabelParams(_)?{duration:_.type===`remaining`?ss(yp,d,{duration:Rf(Math.abs(_.seconds),{locale:f})}):Rf(Math.abs(_.seconds),{locale:f})}:void 0,b=_.negative?z(ee,{children:[z(`span`,{"aria-hidden":`true`,children:o??Ep.defaultProps.negativeSign}),_.text]}):_.text,C=()=>{g(e=>m===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},w=e=>{e.defaultPrevented||C()},T=e=>{e.defaultPrevented||!ws(e.nativeEvent)||(e.preventDefault(),!e.repeat&&C())};return X(`time`,{render:n,className:r,style:i},{state:_,stateAttrMap:Dp,ref:[t],props:[{dateTime:_.datetime,children:b,...v,"aria-label":ss(v[`aria-label`],d,y),...c?{onClick:w,onKeyDown:T}:void 0},l]})}),nh=Kp({Group:()=>$m,Separator:()=>eh,Value:()=>th});u();var rh=()=>Promise.resolve(0),ih=_(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=kp.defaultProps.changeThrottle,step:s=kp.defaultProps.step,largeStep:c=kp.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:m,...h}=e,g=rc(iu),_=rc(Xl),v=rc(tu),y=us(),b=ds(),[C]=S(()=>new kp);C.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:m,changeThrottle:o}),C.setFormatLocale(b);let w=Y(g&&_?{...g,..._}:null),T=Y(v);x(()=>()=>C.endDrag(T.current),[C]);let E=g?.duration??0,{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:M,thumbProps:N}=Sm({computeState:e=>(C.setInput(e),!g||!_?C.setMedia({currentTime:0,duration:0,seeking:!1,seek:rh,buffered:[],seekable:[]}):C.setMedia({...g,..._}),C.getState()),getPercent:()=>E>0?(g?.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:ud,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 g?z(Hm,{value:{state:D,pointerValue:C.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:N,stateAttrMap:Ap,getAttrs:e=>{let t=C.getAttrs(e);return{...t,"aria-label":ss(t[`aria-label`],y),"aria-valuetext":ss(t[`aria-valuetext`],y,C.getValueTextParams(e))}},formatValue:e=>If(e,E)},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Ap,ref:[t,k],props:[{style:{...O,...M}},j,h]})}):null}),ah=Kp({Buffer:()=>Wm,Fill:()=>Gm,Preview:()=>Km,Root:()=>ih,Thumb:()=>Jm,Track:()=>Xm,Value:()=>Zm}),oh=Jp({displayName:`TooltipArrow`,tag:`div`,useContext:Wd,staticProps:{"aria-hidden":`true`}});u();var sh=_(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Wd(),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}]})});u();var ch=_(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Wd(),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});u(),w();var lh={position:`fixed`,inset:`auto`,margin:0},uh=_(function({render:e,className:t,style:n,children:r,...i},a){let{core:o,tooltip:s,state:c,preferredSide:u,setPositionedSide:d,stateAttrMap:f,anchorName:m,popupId:h,boundary:g,container:_}=Wd(),v=p(null),y=Ws(a,b(e=>{s.setPopupElement(e),e&&gs()&&e.style.setProperty(`position-anchor`,`--${m}`)},[s,m]),v),x=E(()=>({side:u,align:c.align}),[u,c.align]),C=E(()=>{if(!gs())return null;let{positionAnchor:e,...t}=$u(m,x,void 0,void 0,void 0,void 0,Mp);return t},[m,x]),[w,T]=S(null);l(()=>{if(!c.open){T(null);return}function e(){let e=s.triggerElement,t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Wu(g,{container:_,root:r}),a=id(t,x.side),o=Uu(i),c=rd(t,Mp),l=ks(n,a,o,x,c),{positionAnchor:u,...f}=$u(m,{...x,side:l},n,gs()?void 0:a,o,c,Mp);T(f),d(l)}e();let t=s.triggerElement,n=v.current,r=n?Wu(g,{container:_,root:n.getRootNode()}):null,i=0;function a(t){t&&xd(t,v.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)}},[c.open,m,x,s,g,_,d]);let D=w??C??lh;if(!c.open)return null;let O=r===void 0?z(ee,{children:[z(sh,{}),z(ch,{})]}):r,{onFocusOut:k,...A}=s.popupProps;return X(`div`,{render:e,className:t,style:n},{state:c,stateAttrMap:f,ref:y,props:[{id:h,style:D,...o.getPopupAttrs(c)},{children:O},{...A,onBlur:k},i]})});u();var dh=L(null),fh=dh.Provider;function ph(){return s(dh)?.group}u();function mh({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=S(()=>new Pp({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),z(fh,{value:{group:i},children:r})}u();function hh({open:e,defaultOpen:t=jp.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=jp.defaultProps.delay,closeDelay:a=jp.defaultProps.closeDelay,disableHoverablePopup:o=jp.defaultProps.disableHoverablePopup,disabled:s=jp.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=sc(),f=om(),[p]=S(()=>new jp(u));p.setProps(u);let m=!q(e),h=ph(),g=Y(n),_=Y(r),v=Y(i),y=Y(a),b=Y(o),C=Y(s),w=Y(h),[T]=S(()=>{let e=hd({transition:gd(),onOpenChange:(e,t)=>{g.current?.(e,t)},onOpenChangeComplete:e=>{_.current?.(e)},delay:()=>v.current,closeDelay:()=>y.current,disableHoverablePopup:()=>b.current,disabled:()=>C.current,group:()=>w.current});return!m&&t&&e.open(),e}),[E,D]=S(),O=Qp(),k=Qp(`tooltip`);x(()=>{if(q(e))return;let{active:t}=T.input.current;e!==t&&(e?T.open():T.close())},[e,T]),x(()=>{q(f?.state.visible)||f.state.visible||T.close(`imperative-action`)},[f?.state.visible,T]),Ed(T);let A=Ys(T.input);p.setInput(A);let{state:j,preferredSide:M,setPositionedSide:N}=Tm(p.getState());return z(Ud,{value:{core:p,tooltip:T,state:j,preferredSide:M,setPositionedSide:N,stateAttrMap:Np,anchorName:O,popupId:k,content:E,setContent:D,boundary:c,container:d},children:l})}u();var gh=_(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=Wd(),l=b(e=>{a.setTriggerElement(e),e&&gs()&&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]})}),_h=Kp({Arrow:()=>oh,Label:()=>sh,Popup:()=>uh,Provider:()=>mh,Root:()=>hh,Shortcut:()=>ch,Trigger:()=>gh});u();var vh={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},yh=_(function(e,t){let{render:n,className:r,style:i,label:a,orientation:o,step:s=Bp.defaultProps.step,largeStep:c=Bp.defaultProps.largeStep,wheelStep:l=Bp.defaultProps.wheelStep,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:m,...h}=e,g=rc(au),_=us(),v=ds(),[y]=S(()=>new Bp);y.setProps({label:a,orientation:o,step:s,largeStep:c,wheelStep:l,disabled:u,thumbAlignment:d}),y.setFormatLocale(v);let x=Y(g),C=Y(u),w=()=>(x.current?.volume??0)*100,T=()=>y.getStepPercent(),E=e=>x.current?.setVolume(e/100),{state:D,cssVars:O,rootRef:k,thumbRef:A,rootProps:j,rootStyle:M,thumbProps:N}=Sm({computeState:e=>(y.setInput(e),y.setMedia(g??vh),y.getState()),getPercent:w,getStepPercent:T,getLargeStepPercent:()=>y.getLargeStepPercent(),orientation:o,disabled:u,adjustPercent:(e,t,n)=>y.adjustPercentForAlignment(e,t,n),getCSSVars:ld,onValueChange:E,onValueCommit:E,onDragStart:f,onDragEnd:m}),[P]=S(()=>bd({isDisabled:()=>!!C.current||!x.current,getPercent:()=>(x.current?.volume??0)*100,getStepPercent:()=>y.getWheelStepPercent(),onValueChange:e=>x.current?.setVolume(e/100)})),F=p(null),ee=b(e=>{F.current?.(),F.current=null,e&&(F.current=J(e,`wheel`,P.onWheel,{passive:!1}))},[P]);return g?z(Hm,{value:{state:D,pointerValue:y.valueFromPercent(D.pointerPercent),thumbRef:A,thumbProps:N,stateAttrMap:Vp,getAttrs:e=>{let t=y.getAttrs(e);return{...t,"aria-label":ss(t[`aria-label`],_),"aria-valuetext":ss(t[`aria-valuetext`],_,y.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:X(`div`,{render:n,className:r,style:i},{state:D,stateAttrMap:Vp,ref:[t,k,ee],props:[{style:{...O,...M}},j,h]})}):null}),bh=Kp({Fill:()=>Gm,Preview:()=>Km,Root:()=>yh,Thumb:()=>Jm,Track:()=>Xm,Value:()=>Zm}),xh=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Sh=o(((e,t)=>{var n=xh();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}})),Ch=o(((e,t)=>{t.exports=Sh()()}));u();var Z=r(Ch());function wh(){return wh=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},wh.apply(this,arguments)}function Th(e,t){if(e==null)return{};var n=Eh(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 Eh(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Dh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Th(e,[`color`,`size`]);return c.createElement(`svg`,wh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.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`}),c.createElement(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),c.createElement(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`}))});Dh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Dh.displayName=`AlertTriangle`,u();function Oh(){return Oh=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},Oh.apply(this,arguments)}function kh(e,t){if(e==null)return{};var n=Ah(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 Ah(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var jh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=kh(e,[`color`,`size`]);return c.createElement(`svg`,Oh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polyline`,{points:`20 6 9 17 4 12`}))});jh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},jh.displayName=`Check`,u();function Mh(){return Mh=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},Mh.apply(this,arguments)}function Nh(e,t){if(e==null)return{};var n=Ph(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 Ph(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Fh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Nh(e,[`color`,`size`]);return c.createElement(`svg`,Mh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polyline`,{points:`15 18 9 12 15 6`}))});Fh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Fh.displayName=`ChevronLeft`,u();function Ih(){return Ih=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},Ih.apply(this,arguments)}function Lh(e,t){if(e==null)return{};var n=Rh(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 Rh(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var zh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Lh(e,[`color`,`size`]);return c.createElement(`svg`,Ih({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polyline`,{points:`9 18 15 12 9 6`}))});zh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},zh.displayName=`ChevronRight`,u();function Bh(){return Bh=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},Bh.apply(this,arguments)}function Vh(e,t){if(e==null)return{};var n=Hh(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 Hh(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Uh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Vh(e,[`color`,`size`]);return c.createElement(`svg`,Bh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),c.createElement(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`}))});Uh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Uh.displayName=`Copy`,u();function Wh(){return Wh=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},Wh.apply(this,arguments)}function Gh(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{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var qh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Gh(e,[`color`,`size`]);return c.createElement(`svg`,Wh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.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`}))});qh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},qh.displayName=`Maximize`,u();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 Yh(e,t){if(e==null)return{};var n=Xh(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 Xh(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Zh=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Yh(e,[`color`,`size`]);return c.createElement(`svg`,Jh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.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`}))});Zh.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Zh.displayName=`Minimize`,u();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 $h(e,t){if(e==null)return{};var n=eg(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 eg(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var tg=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=$h(e,[`color`,`size`]);return c.createElement(`svg`,Qh({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),c.createElement(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`}))});tg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},tg.displayName=`Pause`,u();function ng(){return ng=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},ng.apply(this,arguments)}function rg(e,t){if(e==null)return{};var n=ig(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 ig(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var ag=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=rg(e,[`color`,`size`]);return c.createElement(`svg`,ng({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polygon`,{points:`5 3 19 12 5 21 5 3`}))});ag.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},ag.displayName=`Play`,u();function og(){return og=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},og.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{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var lg=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=sg(e,[`color`,`size`]);return c.createElement(`svg`,og({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polyline`,{points:`1 4 1 10 7 10`}),c.createElement(`path`,{d:`M3.51 15a9 9 0 1 0 2.13-9.36L1 10`}))});lg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},lg.displayName=`RotateCcw`,u();function ug(){return ug=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},ug.apply(this,arguments)}function dg(e,t){if(e==null)return{};var n=fg(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 fg(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var pg=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=dg(e,[`color`,`size`]);return c.createElement(`svg`,ug({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`circle`,{cx:`12`,cy:`12`,r:`3`}),c.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`}))});pg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},pg.displayName=`Settings`,u();function mg(){return mg=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},mg.apply(this,arguments)}function hg(e,t){if(e==null)return{};var n=gg(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 gg(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var _g=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=hg(e,[`color`,`size`]);return c.createElement(`svg`,mg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),c.createElement(`path`,{d:`M15.54 8.46a5 5 0 0 1 0 7.07`}))});_g.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},_g.displayName=`Volume1`,u();function vg(){return vg=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},vg.apply(this,arguments)}function yg(e,t){if(e==null)return{};var n=bg(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 bg(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var xg=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=yg(e,[`color`,`size`]);return c.createElement(`svg`,vg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),c.createElement(`path`,{d:`M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07`}))});xg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},xg.displayName=`Volume2`,u();function Sg(){return Sg=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},Sg.apply(this,arguments)}function Cg(e,t){if(e==null)return{};var n=wg(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 wg(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Tg=_(function(e,t){var n=e.color,r=n===void 0?`currentColor`:n,i=e.size,a=i===void 0?24:i,o=Cg(e,[`color`,`size`]);return c.createElement(`svg`,Sg({ref:t,xmlns:`http://www.w3.org/2000/svg`,width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,stroke:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`},o),c.createElement(`polygon`,{points:`11 5 6 9 2 9 2 15 6 15 11 19 11 5`}),c.createElement(`line`,{x1:`23`,y1:`9`,x2:`17`,y2:`15`}),c.createElement(`line`,{x1:`17`,y1:`9`,x2:`23`,y2:`15`}))});Tg.propTypes={color:Z.default.string,size:Z.default.oneOfType([Z.default.string,Z.default.number])},Tg.displayName=`VolumeX`;var Eg=o(((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})()}));i(),u();var Dg=r(Eg(),1),Og=`react-tooltip-core-styles`,kg=`react-tooltip-base-styles`,Ag={core:!1,base:!1};function jg({css:e,id:n=kg,type:r=`base`,ref:i}){if(!e||typeof document>`u`||Ag[r]||r===`core`&&t!==void 0&&(t==null?void 0:{})?.REACT_TOOLTIP_DISABLE_CORE_STYLES||r!==`base`&&t!==void 0&&(t==null?void 0:{})?.REACT_TOOLTIP_DISABLE_BASE_STYLES)return;r===`core`&&(n=Og),i||={};let{insertAt:a}=i;if(document.getElementById(n))return;let o=document.head||document.getElementsByTagName(`head`)[0],s=document.createElement(`style`);s.id=n,s.type=`text/css`,a===`top`&&o.firstChild?o.insertBefore(s,o.firstChild):o.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e)),Ag[r]=!0}var Mg=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r=`top`,offset:i=10,strategy:a=`absolute`,middlewares:o=[O(Number(i)),k({fallbackAxisSideDirection:`start`}),C({padding:5})],border:s,arrowSize:c=8})=>{if(!e||t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};let l=o;return n?(l.push(D({element:n,padding:5})),P(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}}))):P(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})))},Ng=(e,t)=>!(`CSS`in window&&`supports`in window.CSS)||window.CSS.supports(e,t),Pg=(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},Fg=e=>e!==null&&!Array.isArray(e)&&typeof e==`object`,Ig=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every(((e,n)=>Ig(e,t[n])));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Fg(e)||!Fg(t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every((n=>Ig(e[n],t[n])))},Lg=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`}))},Rg=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Lg(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},zg=typeof window<`u`?l:x,Bg=e=>{e.current&&=(clearTimeout(e.current),null)},Vg=`DEFAULT_TOOLTIP_ID`,Hg={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Ug=L({getTooltipData:()=>Hg});function Wg(e=Vg){return s(Ug).getTooltipData(e)}var Gg={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`},Kg={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`},qg=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i=`dark`,anchorId:a,anchorSelect:o,place:s=`top`,offset:l=10,events:u=[`hover`],openOnClick:d=!1,positionStrategy:m=`absolute`,middlewares:h,wrapper:g,delayShow:_=0,delayHide:v=0,float:y=!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:ee,disableTooltip:I,content:L,contentWrapperRef:ne,isOpen:R,defaultIsOpen:z=!1,setIsOpen:re,previousActiveAnchor:ie,activeAnchor:B,setActiveAnchor:ae,border:oe,opacity:se,arrowColor:ce,arrowSize:le=8,role:ue=`tooltip`})=>{let de=p(null),fe=p(null),pe=p(null),V=p(null),H=p(null),[U,me]=S({tooltipStyles:{},tooltipArrowStyles:{},place:s}),[he,ge]=S(!1),[_e,ve]=S(!1),[ye,be]=S(null),xe=p(!1),Se=p(null),{anchorRefs:Ce,setActiveAnchor:we}=Wg(t),Te=p(!1),[Ee,De]=S([]),Oe=p(!1),ke=d||u.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})),zg((()=>(Oe.current=!0,()=>{Oe.current=!1})),[]);let Pe=e=>{Oe.current&&(e&&ve(!0),setTimeout((()=>{Oe.current&&(re?.(e),R===void 0&&ge(e))}),10))};x((()=>{if(t){if(he){n(ie);let r=e(B),i=[...new Set([...r,t])].filter(Boolean).join(` `);B?.setAttribute(`aria-describedby`,i)}else n(B);return()=>{n(B),n(ie)}}function e(e){return(e?.getAttribute(`aria-describedby`))?.split(` `)||[]}function n(n){let r=e(n).filter((e=>e!==t));r.length?n?.setAttribute(`aria-describedby`,r.join(` `)):n?.removeAttribute(`aria-describedby`)}}),[B,he,t,ie]),x((()=>{if(R===void 0)return()=>null;R&&ve(!0);let e=setTimeout((()=>{ge(R)}),10);return()=>{clearTimeout(e)}}),[R]),x((()=>{if(he!==xe.current)if(Bg(H),xe.current=he,he)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`));H.current=setTimeout((()=>{ve(!1),be(null),ee?.()}),e+25)}}),[he]);let Fe=e=>{me((t=>Ig(t,e)?t:e))},Ie=(e=_)=>{Bg(pe),_e?Pe(!0):pe.current=setTimeout((()=>{Pe(!0)}),e)},Le=(e=v)=>{Bg(V),V.current=setTimeout((()=>{Te.current||Pe(!1)}),e)},Re=e=>{if(!e)return;let t=e.currentTarget??e.target;if(!t?.isConnected)return ae(null),void we({current:null});_?Ie():Pe(!0),ae(t),we({current:t}),Bg(V)},ze=()=>{T?Le(v||100):v?Le():Pe(!1),Bg(pe)},Be=({x:e,y:t})=>{Mg({place:ye?.place??s,offset:l,elementReference:{getBoundingClientRect:()=>({x:e,y:t,width:0,height:0,top:t,left:e,right:e,bottom:t})},tooltipReference:de.current,tooltipArrowReference:fe.current,strategy:m,middlewares:h,border:oe,arrowSize:le}).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(!he)return;let t=e.target;t.isConnected&&(de.current?.contains(t)||[document.querySelector(`[id='${a}']`),...Ee].some((e=>e?.contains(t)))||(Pe(!1),Bg(pe)))},W=Pg(Re,50,!0),Ue=Pg(ze,50,!0),We=e=>{Ue.cancel(),W(e)},Ge=()=>{W.cancel(),Ue()},Ke=b((()=>{let e=ye?.position??P;e?Be(e):y?Se.current&&Be(Se.current):B!=null&&B.isConnected&&Mg({place:ye?.place??s,offset:l,elementReference:B,tooltipReference:de.current,tooltipArrowReference:fe.current,strategy:m,middlewares:h,border:oe,arrowSize:le}).then((e=>{Oe.current&&Fe(e)}))}),[he,B,L,N,s,ye?.place,l,m,P,ye?.position,y,le]);x((()=>{var e,t;let n=new Set(Ce);Ee.forEach((e=>{I!=null&&I(e)||n.add({current:e})}));let r=document.querySelector(`[id='${a}']`);r&&!I?.(r)&&n.add({current:r});let i=()=>{Pe(!1)},o=Rg(B),s=Rg(de.current);Ne.scroll&&(window.addEventListener(`scroll`,i),o?.addEventListener(`scroll`,i),s?.addEventListener(`scroll`,i));let c=null;Ne.resize?window.addEventListener(`resize`,i):B&&de.current&&(c=te(B,de.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&&B?.contains(e.target)),f=e=>{he&&d(e)||Re(e)},p=e=>{he&&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:We}):h.includes(e)&&u.push({event:e,listener:f}))})),Object.entries(Me).forEach((([e,t])=>{t&&(m.includes(e)?u.push({event:e,listener:Ge}):h.includes(e)&&u.push({event:e,listener:p}))})),y&&u.push({event:`pointermove`,listener:Ve});let g=()=>{Te.current=!0},_=()=>{Te.current=!1,ze()},v=T&&(Me.mouseout||Me.mouseleave);return v&&((e=de.current)==null||e.addEventListener(`mouseover`,g),(t=de.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),o?.removeEventListener(`scroll`,i),s?.removeEventListener(`scroll`,i)),Ne.resize?window.removeEventListener(`resize`,i):c?.(),Ne.clickOutsideAnchor&&window.removeEventListener(`click`,He),Ne.escape&&window.removeEventListener(`keydown`,l),v&&((e=de.current)==null||e.removeEventListener(`mouseover`,g),(t=de.current)==null||t.removeEventListener(`mouseout`,_)),u.forEach((({event:e,listener:t})=>{n.forEach((n=>{var r;(r=n.current)==null||r.removeEventListener(e,t)}))}))}}),[B,Ke,_e,Ce,Ee,k,A,j,ke,_,v]),x((()=>{let e=ye?.anchorSelect??o??``;!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`);let n=new MutationObserver((n=>{let r=[],i=[];n.forEach((n=>{if(n.type===`attributes`&&n.attributeName===`data-tooltip-id`&&(n.target.getAttribute(`data-tooltip-id`)===t?r.push(n.target):n.oldValue===t&&i.push(n.target)),n.type===`childList`){if(B){let t=[...n.removedNodes].filter((e=>e.nodeType===1));if(e)try{i.push(...t.filter((t=>t.matches(e)))),i.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}t.some((e=>!!(e?.contains)?.call(e,B)&&(ve(!1),Pe(!1),ae(null),Bg(pe),Bg(V),!0)))}if(e)try{let t=[...n.addedNodes].filter((e=>e.nodeType===1));r.push(...t.filter((t=>t.matches(e)))),r.push(...t.flatMap((t=>[...t.querySelectorAll(e)])))}catch{}}})),(r.length||i.length)&&De((e=>[...e.filter((e=>!i.includes(e))),...r]))}));return n.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-tooltip-id`],attributeOldValue:!0}),()=>{n.disconnect()}}),[t,o,ye?.anchorSelect,B]),x((()=>{Ke()}),[Ke]),x((()=>{if(!ne?.current)return()=>null;let e=new ResizeObserver((()=>{setTimeout((()=>Ke()))}));return e.observe(ne.current),()=>{e.disconnect()}}),[L,ne?.current]),x((()=>{let e=document.querySelector(`[id='${a}']`),t=[...Ee,e];B&&t.includes(B)||ae(Ee[0]??e)}),[a,Ee,B]),x((()=>(z&&Pe(!0),()=>{Bg(pe),Bg(V)})),[]),x((()=>{let e=ye?.anchorSelect??o;if(!e&&t&&(e=`[data-tooltip-id='${t.replace(/'/g,`\\'`)}']`),e)try{let t=Array.from(document.querySelectorAll(e));De(t)}catch{De([])}}),[t,o,ye?.anchorSelect]),x((()=>{pe.current&&(Bg(pe),Ie(_))}),[_]);let qe=ye?.content??L,Je=he&&Object.keys(U.tooltipStyles).length>0;return f(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:B,place:U.place,isOpen:!!(_e&&!C&&qe&&Je)}))),_e&&!C&&qe?c.createElement(g,{id:t,role:ue,className:(0,Dg.default)(`react-tooltip`,Gg.tooltip,Kg.tooltip,Kg[i],n,`react-tooltip__place-${U.place}`,Gg[Je?`show`:`closing`],Je?`react-tooltip__show`:`react-tooltip__closing`,m===`fixed`&&Gg.fixed,T&&Gg.clickable),onTransitionEnd:e=>{Bg(H),he||e.propertyName!==`opacity`||(ve(!1),be(null),ee?.())},style:{...N,...U.tooltipStyles,opacity:se!==void 0&&Je?se:void 0},ref:de},c.createElement(g,{className:(0,Dg.default)(`react-tooltip-content-wrapper`,Gg.content,Kg.content)},qe),c.createElement(g,{className:(0,Dg.default)(`react-tooltip-arrow`,Gg.arrow,Kg.arrow,r,w&&Gg.noArrow),style:{...U.tooltipArrowStyles,background:ce?`linear-gradient(to right bottom, transparent 50%, ${ce} 50%)`:void 0,"--rt-arrow-size":`${le}px`},ref:fe})):null},Jg=({content:e})=>c.createElement(`span`,{dangerouslySetInnerHTML:{__html:e}}),Yg=c.forwardRef((({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:a,className:o,classNameArrow:s,variant:l=`dark`,place:u=`top`,offset:d=10,wrapper:f=`div`,children:m=null,events:h=[`hover`],openOnClick:g=!1,positionStrategy:_=`absolute`,middlewares:v,delayShow:y=0,delayHide:b=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:M,imperativeModeOnly:N=!1,style:P,position:F,isOpen:ee,defaultIsOpen:te=!1,disableStyleInjection:I=!1,border:L,opacity:ne,arrowColor:R,arrowSize:z,setIsOpen:re,afterShow:ie,afterHide:B,disableTooltip:ae,role:oe=`tooltip`},se)=>{let[ce,le]=S(r),[ue,de]=S(i),[fe,pe]=S(u),[V,H]=S(l),[U,me]=S(d),[he,ge]=S(y),[_e,ve]=S(b),[ye,be]=S(C),[xe,Se]=S(w),[Ce,we]=S(f),[Te,Ee]=S(h),[De,Oe]=S(_),[ke,Ae]=S(null),[je,Me]=S(null),Ne=p(null),Pe=p(I),{anchorRefs:Fe,activeAnchor:Ie}=Wg(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=>{pe(e??u)},content:e=>{le(e??r)},html:e=>{de(e??i)},variant:e=>{H(e??l)},offset:e=>{me(e===null?d:Number(e))},wrapper:e=>{we(e??f)},events:e=>{let t=e?.split(` `);Ee(t??h)},"position-strategy":e=>{Oe(e??_)},"delay-show":e=>{ge(e===null?y:Number(e))},"delay-hide":e=>{ve(e===null?b: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)}))};x((()=>{le(r)}),[r]),x((()=>{de(i)}),[i]),x((()=>{pe(u)}),[u]),x((()=>{H(l)}),[l]),x((()=>{me(d)}),[d]),x((()=>{ge(y)}),[y]),x((()=>{ve(b)}),[b]),x((()=>{be(C)}),[C]),x((()=>{Se(w)}),[w]),x((()=>{Oe(_)}),[_]),x((()=>{Pe.current!==I&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")}),[I]),x((()=>{typeof window<`u`&&window.dispatchEvent(new CustomEvent(`react-tooltip-inject-styles`,{detail:{disableCore:I===`core`,disableBase:I}}))}),[]),x((()=>{let r=new Set(Fe),i=n;if(!i&&e&&(i=`[data-tooltip-id='${e.replace(/'/g,`\\'`)}']`),i)try{document.querySelectorAll(i).forEach((e=>{r.add({current:e})}))}catch{console.warn(`[react-tooltip] "${i}" is not a valid CSS selector`)}let a=document.querySelector(`[id='${t}']`);if(a&&r.add({current:a}),!r.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,t,n]),x((()=>{P!=null&&P.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),L&&!Ng(`border`,`${L}`)&&console.warn(`[react-tooltip] "${L}" is not a valid \`border\`.`),P!=null&&P.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),ne&&!Ng(`opacity`,`${ne}`)&&console.warn(`[react-tooltip] "${ne}" is not a valid \`opacity\`.`)}),[]);let ze=m,Be=p(null);if(a){let e=a({content:je?.getAttribute(`data-tooltip-content`)||ce||null,activeAnchor:je});ze=e?c.createElement(`div`,{ref:Be,className:`react-tooltip-content-wrapper`},e):null}else ce&&(ze=ce);ue&&(ze=c.createElement(Jg,{content:ue}));let Ve={forwardRef:se,id:e,anchorId:t,anchorSelect:n,className:(0,Dg.default)(o,ke),classNameArrow:s,content:ze,contentWrapperRef:Be,place:fe,variant:V,offset:U,wrapper:Ce,events:Te,openOnClick:g,positionStrategy:De,middlewares:v,delayShow:he,delayHide:_e,float:ye,hidden:xe,noArrow:T,clickable:E,closeOnEsc:D,closeOnScroll:O,closeOnResize:k,openEvents:A,closeEvents:j,globalCloseEvents:M,imperativeModeOnly:N,style:P,position:F,isOpen:ee,defaultIsOpen:te,border:L,opacity:ne,arrowColor:R,arrowSize:z,setIsOpen:re,afterShow:ie,afterHide:B,disableTooltip:ae,activeAnchor:je,previousActiveAnchor:Ne.current,setActiveAnchor:e=>{Me((t=>(e!=null&&e.isSameNode(t)||(Ne.current=t),e)))},role:oe};return c.createElement(qg,{...Ve})}));typeof window<`u`&&window.addEventListener(`react-tooltip-inject-styles`,(e=>{e.detail.disableCore||jg({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||jg({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`})})),u();var Xg={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:()=>{}},Zg=Ac({name:`source`,state:()=>({...Xg}),attach({set:e}){e({setSourceState:t=>e(t),setHideUI:t=>e({hideUI:t})})}}),Qg=Dd({features:[...Mu,Zg],displayName:`MediaPlayer`}),Q=Qg.usePlayer,$g=e=>{if(!(!e||e===`und`))try{return new Intl.DisplayNames([navigator.language||`en`],{type:`language`,fallback:`none`}).of(e)||void 0}catch{return}},e_=e=>e?.replace(/_/g,` `).trim()||void 0,t_=e=>{let t=e.map(e=>$g(e.language)??e_(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=e_(e.title);return{track:e,label:(n[i]??0)>1&&a&&a!==i?`${i} (${a})`:i}})},n_=e=>t_(e).map(({track:e,label:t})=>({id:e.streamIndex,label:t})),r_=[0,250,1e3,3e3,1e4],i_=6e4,a_=500,o_=e=>e instanceof Error?e.message:String(e),s_=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(o_(n)),n=n?.cause}return t.length?t.join(`
5
- `):void 0},c_=(e,t,n)=>{let r=Q(),{read:i,size:a,publicPath:o=``,libavWorkerUrl:s=``,jassubWorkerUrl:c=``,jassubWasmUrl:l=``,jassubLegacyWasmUrl:u,defaultFontUrl:d,bufferSize:f,autoplay:m=!1,seekPrepareBudgetMs:h=a_}=n??{},[g,_]=S(void 0),[v,y]=S(0),C=p({count:0,at:0}),w=p(void 0);x(()=>(C.current={count:0,at:0},r.setSourceState({playbackErrors:[]}),()=>{w.current&&clearTimeout(w.current)}),[a]);let T=p(null),E=p(null),D=p(!1),O=p(i);O.current=i;let k=p(n?.onSeek);k.current=n?.onSeek;let A=p(n?.onPlaybackError);A.current=n?.onPlaybackError;let j=b(e=>{let t=typeof e==`number`?e:void 0;D.current=!0,r.setSourceState({selectedSubtitleTrack:t}),T.current?.selectSubtitleStream(t)},[r]),M=b(e=>{let t=T.current;if(!t||h<=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()},h);t.prepareSeek(e).catch(()=>{}).finally(()=>{clearTimeout(c),s()})},[r,h]),N=b(e=>{typeof e==`number`&&(r.setSourceState({selectedAudioTrack:e}),_(e))},[r]),P=Q(e=>e.setSourceState);x(()=>{P({selectSubtitleTrack:j,selectAudioTrack:N,requestSeek:M})},[P,j,N,M]),x(()=>{if(!e||!t||!a||!i)return;let n=!1;r.setSourceState({playbackError:null,ready:!1});let p=(t,n)=>{let i=Date.now(),a=o_(t),o=s_(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]})},h=e=>{if(n)return;let t=oo(e);if(p(e,t),t){let t=performance.now();t-C.current.at>i_&&(C.current={count:0,at:t});let n=r_[Math.min(C.current.count,r_.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(()=>y(e=>e+1),n);return}console.error(`playback failed`,e),r.setSourceState({playbackError:e}),A.current?.(e)};return(async()=>{try{let i=await So({videoElement:e,canvasElement:t,read:(e,t)=>O.current(e,t),length:a,publicPath:o,libavWorkerUrl:s,jassubWorkerUrl:c,jassubWasmUrl:l,jassubLegacyWasmUrl:u,defaultFontUrl:d,bufferSize:f,audioStreamIndex:g,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),m&&e.play().catch(()=>{})},onError:h,onRecovered:()=>{n||r.setSourceState({playbackError:null})},onSeek:e=>k.current?.(e),onSubtitleStreams:e=>{n||r.setSourceState({subtitleTracks:n_(e),...D.current?{}:{selectedSubtitleTrack:e[0]?.streamIndex}})},onAudioStreams:(e,t)=>{n||r.setSourceState({audioTracks:n_(e),selectedAudioTrack:t})}});if(n){i.destroy();return}T.current=i,r.setSourceState({indexes:i.indexes});let p=r.selectedSubtitleTrack;typeof p==`number`&&i.selectSubtitleStream(p)}catch(e){h(e)}})(),()=>{n=!0,E.current={time:e.currentTime,size:a},T.current?.destroy(),T.current=null,r.setSourceState({ready:!1})}},[r,e,t,a,o,s,c,l,u,d,f,g,m,v])},l_=5e3,u_=6e4,d_=({publicPath:e,workerUrl:t,length:n,read:r,downloadedRanges:i})=>{let[a,o]=S([]),s=p(null),c=p(r);c.current=r;let l=E(()=>i?.map(({startByteOffset:e,endByteOffset:t})=>[e,t]),[i?.map(({startByteOffset:e,endByteOffset:t})=>`${e}-${t}`).join(`,`)]),u=p(l);return u.current=l,x(()=>{if(!n||!r||!e||!t)return;let i=!1,a=null,l,d=l_,f=()=>{ko({publicPath:e,workerUrl:t,length:n,read:(e,t)=>c.current(e,t),onThumbnails:e=>{i||o(e)}}).then(e=>{if(i){e.destroy();return}a=e,s.current=e,e.update(u.current)},()=>{i||(l=setTimeout(f,d),d=Math.min(d*2,u_))})};return f(),()=>{i=!0,clearTimeout(l),s.current=null,a?.destroy(),o([])}},[n,e,t]),x(()=>{s.current?.update(l)},[l]),a},f_=(e,t)=>{let n=p(null),[r,i]=S(!1),[a]=S(()=>Lo());x(()=>{if(!e||!t||!a)return;let r=Ro({video:e,canvas:t,mode:a,onBurnedInChange:i});return n.current=r,()=>{r.destroy(),n.current=null,i(!1)}},[e,t,a]);let o=b(()=>{n.current?.toggle().catch(e=>{console.warn(`picture in picture was refused`,e)})},[]);return{toggle:e&&t&&a?o:null,mode:a,burnedIn:r}},p_={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
- `}},m_=M`
138
- top: unset !important;
139
- left: unset !important;
140
- width: 100%;
141
- height: 100%;
142
- margin: auto;
143
- pointer-events: none;
144
- `,h_=M`
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
- ${p_.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
- `,g_=M`
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: ${m`
190
- to { transform: rotate(360deg); }
191
- `} 0.8s linear infinite;
192
- }
193
- `,__=M`
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
- ${p_.bLarge.regular}
201
- text-shadow: 0 0 4px rgba(0, 0, 0, 1);
202
- pointer-events: none;
203
- `,v_=e=>e instanceof Error?e.message:typeof e==`string`?e:`Playback failed`,y_=({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 T(N,{children:[t?R(`div`,{className:`title`,css:h_,style:{...n?{opacity:`0`,pointerEvents:`none`}:{}},children:t}):void 0,(a?!i:o)&&!r?R(`div`,{css:g_}):void 0,r?R(`div`,{css:__,children:v_(r)}):void 0,R(`canvas`,{ref:e,css:m_})]})},b_=1e-4,x_=1,S_=e=>Math.max(b_,Math.min(x_,e))**2,C_=e=>Math.max(b_,Math.min(x_,e))**(x_/2),w_=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}`},T_=(e,t)=>`${w_(e)} / ${w_(t)}`,E_=e=>M`
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
- ${p_.bMedium.regular}
236
- }
237
-
238
- ${e===`sm`&&M`
239
- padding: calc(0.4 * var(--mp-unit))!important;
240
- `}
241
- ${e===`md`&&M`
242
- padding: calc(0.6 * var(--mp-unit))!important;
243
- `}
244
- ${e===`lg`&&M`
245
- padding: calc(1.2 * var(--mp-unit))!important;
246
- `}
247
- `,D_={x:-1,y:-1,anchors:0},O_=e=>{D_.x=e.clientX,D_.y=e.clientY},k_=()=>(D_.anchors++===0&&window.addEventListener(`pointermove`,O_,{capture:!0,passive:!0}),()=>{--D_.anchors===0&&window.removeEventListener(`pointermove`,O_,{capture:!0})}),A_=({id:e,toolTipText:t,text:n,delayShow:r=0,closeDelay:i=0,offset:a=20,tooltipPlace:o=`top`,disabled:s=!1,size:c=`md`})=>{let l=p(null),u=p(null);return x(()=>{let e=k_(),t=()=>{let e=l.current;if(!e)return;let{left:t,right:n,top:r,bottom:i}=e.getBoundingClientRect();D_.x>=t&&D_.x<n&&D_.y>=r&&D_.y<i||u.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)}},[]),T(N,{children:[R(`div`,{ref:l,"data-tooltip-id":e,"data-open":!0,"data-tooltip-offset":a,"data-tooltip-delay-show":r,"data-tooltip-delay-hide":i,"data-tooltip-place":o,children:n}),!s&&R(Yg,{ref:u,css:E_(c),id:e,noArrow:!0,children:t})]})},j_=({ref:e,onChange:t,orientation:n=`horizontal`,disabled:r=!1})=>{let[i,a]=S(!1),o=p(t);o.current=t;let s=p(null),c=b((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]),l=b(e=>{if(!(r||e.button>0)){s.current=e.pointerId;try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}a(!0),o.current(c(e.clientX,e.clientY))}},[r,c]),u=b(e=>{s.current===e.pointerId&&o.current(c(e.clientX,e.clientY))},[c]),d=b(e=>{if(s.current===e.pointerId){s.current=null;try{e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}a(!1)}},[]);return x(()=>{r&&(s.current=null,a(!1))},[r]),{dragging:i,handlers:{onPointerDown:l,onPointerMove:u,onPointerUp:d,onPointerCancel:d,style:{touchAction:`none`}}}},M_=M`
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
- ${p_.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
- `,N_=4,P_=()=>{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),o=Q(e=>e.indexes),s=Q(e=>e.thumbnails),c=Q(e=>e.thumbnailAt),l=p(null),[u,d]=S(void 0),[f,m]=S(void 0),h=p(void 0),g=p(0),_=p(void 0),v=p(void 0),y=p(!1),{dragging:b,handlers:C}=j_({ref:l,onChange:e=>{if(g.current+=1,_.current=e,v.current===void 0)v.current=e;else if(!y.current){let t=l.current?.getBoundingClientRect().width??0;Math.abs(e-v.current)*t>N_&&(y.current=!0)}d(e),h.current!==`mouse`&&m(e*r)}}),w=e=>{h.current=e.pointerType,g.current=0,v.current=void 0,y.current=!1,C.onPointerDown(e)},D=t=>{C.onPointerUp(t);let i=g.current>0?_.current:void 0;if(i!==void 0&&r){let t=i*r;n?n(t):e.seek(t)}g.current=0,y.current=!1,v.current=void 0,t.pointerType!==`mouse`&&m(void 0)},O=e=>{if(!l.current)return;let{left:t,right:n}=l.current.getBoundingClientRect();return Math.min(Math.max((e-t)/(n-t),0),1)*r},k=e=>{m(O(e.clientX))},A=()=>{l.current&&m(void 0)},j=e=>r?e/r*100:0,M=E(()=>a?.map((e,t)=>{if(!i||!r)return null;let n=o.filter(t=>e.startByteOffset<=t.pos&&t.pos<=e.endByteOffset),a=n.at(0),s=n.at(-1);if(!a||!s)return null;let c=a.timestamp/r,l=s.timestamp/r,u=Number((l-c).toFixed(2)),d=c*100;return R(`div`,{className:`loaded-part`,style:{transform:`scaleX(${u})`,marginLeft:`${d}%`}},t)})??[],[r,o.length,a?.map(({startByteOffset:e,endByteOffset:t})=>`${e}/${t}`).join(`,`)]),N=E(()=>{if(!f||f<0)return;let e=Math.floor(f/3600),t=Math.floor((f-e*3600)/60),n=Math.floor(f-e*3600-t*60);return`${e>0?`${e}:`:``}${t<10?`0`:``}${t}:${n<10?`0`:``}${n}`},[f]);x(()=>{u===void 0||!r||!b||!y.current||e.seek(u*r)},[e,b,u,r]);let P=E(()=>!r||typeof t!=`number`?0:t/r,[r,t]),F=E(()=>{if(f){if(c)return c(f);if(s.length)return s.find(({startTime:e,endTime:t})=>e<=f&&f<t)}},[s,c,f]);return T(`div`,{css:M_,ref:l,className:b?`progress-bar dragging`:`progress-bar`,onMouseMove:k,onMouseOut:A,children:[R(`div`,{className:`background-bar`}),f?R(`div`,{className:`cursor-time`,style:{left:`clamp(calc(3 * var(--mp-unit)), ${j(f)}%, calc(100% - calc(3 * var(--mp-unit))))`},children:N}):void 0,R(`div`,{className:`progress`}),R(`div`,{className:`loaded`,children:M}),R(`div`,{className:`hover`}),R(`div`,{className:`play-container`,children:R(`div`,{className:`play`,style:{transform:`scaleX(${P})`}})}),R(`div`,{className:`chapters`}),R(`div`,{className:`scrubber`}),R(`div`,{className:`padding`,...C,onPointerDown:w,onPointerUp:D,onPointerCancel:D}),R(`div`,{className:`thumbnail`,style:{left:`clamp(var(--thumbnail-half), ${j(f??1)}%, calc(100% - var(--thumbnail-half)))`},children:F?.url?R(`img`,{src:F.url}):void 0})]})},F_=`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`,I_={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`},L_=e=>T(`svg`,{...I_,...e,children:[R(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),R(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`})]}),R_=e=>T(`svg`,{...I_,...e,children:[R(`rect`,{x:`3`,y:`5`,width:`18`,height:`14`,rx:`2`,ry:`2`}),R(`path`,{d:`M7 15h4m4 0h2M7 11h2m4 0h4`}),R(`line`,{x1:`2`,y1:`2`,x2:`22`,y2:`22`})]}),z_=e=>T(`svg`,{...I_,...e,children:[R(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),R(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),R(`path`,{d:`M14.5 18.5h2m2 0h1`})]}),B_=e=>T(`svg`,{...I_,...e,children:[R(`path`,{d:`M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5`}),R(`rect`,{x:`12`,y:`13`,width:`10`,height:`8`,rx:`1`,ry:`1`}),R(`path`,{d:`M6 9h3m2 0h2`})]}),V_=M`
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
- ${p_.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
- ${p_.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
- ${p_.bSmall.regular}
543
- }
544
- }
545
- `,H_=({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 T(`div`,{onClick:()=>{l||r(e??void 0)},className:[a,l?`unavailable`:null].filter(Boolean).join(` `)||void 0,children:[R(`span`,{children:i}),R(`span`,{children:s?`…`:(n??null)===e?`✓`:``})]},e??`__off__`)};return T(`div`,{className:`popover track-list`,children:[T(`div`,{className:i?`back`:`back no-hover`,onClick:i,children:[i?R(Fh,{}):null,R(`span`,{children:e})]}),s?R(`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`))]})},U_=({onReset:e}={})=>{let t=p(null),[n,r]=S(!1),[i,a]=S(void 0),[o,s]=S(!1),c=p(e);c.current=e;let l=()=>{r(!1),c.current?.()};return x(()=>{let e=e=>{n&&t.current&&!t.current.contains(e.target)&&l()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),{open:n,toggle:()=>{r(e=>!e),s(!1),c.current?.()},close:l,containerRef:t,pending:i,failed:o,runSelect:(e,t)=>{if(i!==void 0)return;s(!1);let n;try{n=t()}catch(e){console.warn(`[media-player] track selection failed:`,e),s(!0);return}if(!(n instanceof Promise)){l();return}a(e),n.then(()=>{a(void 0),l()},e=>{console.warn(`[media-player] track selection failed:`,e),a(void 0),s(!0)})}}},W_=M`
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
- ${V_}
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
- ${p_.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
- ${p_.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
- ${p_.bSmall.regular}
630
- }
631
- }
632
- }
633
- `,G_=e=>new Date(e).toLocaleTimeString(),K_=e=>e===void 0||!Number.isFinite(e)?void 0:w_(Math.max(0,e)),q_=e=>e.reduce((e,t)=>e+t.count,0),J_=e=>e.map((e,t)=>{let n=K_(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
- `),Y_=()=>{let e=Q(e=>e.playbackErrors),{open:t,toggle:n,containerRef:r}=U_(),[i,a]=S(!1);if(e.length===0)return null;let o=()=>{navigator.clipboard?.writeText(J_(e)).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)},e=>console.warn(`[media-player] could not copy the errors:`,e))},s=`Playback errors (${q_(e)})`;return T(`div`,{css:W_,ref:r,children:[R(A_,{id:`errors`,disabled:t,text:R(`button`,{className:`errors`,type:`button`,onClick:n,"aria-label":s,"aria-expanded":t,children:R(Dh,{className:`alert-triangle`})}),toolTipText:R(`span`,{children:s})}),t&&T(`div`,{className:`popover error-list`,children:[T(`div`,{className:`back no-hover`,children:[R(`span`,{children:s}),T(`button`,{className:`copy`,type:`button`,onClick:o,"aria-label":`Copy the errors`,children:[R(i?jh:Uh,{}),R(`span`,{children:i?`Copied`:`Copy`})]})]}),e.map((e,t)=>T(`div`,{className:`entry no-hover`,children:[T(`span`,{className:`when`,children:[G_(e.at),e.count>1?` to ${G_(e.lastAt)}`:``,K_(e.atMediaTime)?` at ${K_(e.atMediaTime)}`:``,e.recovered?` recovered`:``,e.count>1?R(`span`,{className:`count`,children:`×${e.count}`}):null]}),R(`span`,{className:`what`,children:e.message}),e.detail?R(`span`,{className:`cause`,children:e.detail}):null]},`${e.at}-${t}`))]})]})},X_=M`
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
- `,Z_=()=>{let e=Q(),t=Q(e=>e.playbackRate),n=p(null),r=p(null),i=.25,a=3-i,o=(e,t=.05)=>Math.round(e/t)*t,s=o(t||1),c=e=>(e-i)/a*100,l=e=>o(i+e*a),{handlers:u}=j_({ref:r,onChange:t=>e.setPlaybackRate(l(t))}),d=t=>{t.preventDefault();let n=.05,r=s;r=t.deltaY<0?Math.min(3,r+n):Math.max(i,r-n),e.setPlaybackRate(r)};x(()=>{let e=n.current;return e&&e.addEventListener(`wheel`,d,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,d)}},[t]);let f=c(s);return T(`div`,{css:X_,children:[T(`div`,{children:[s.toFixed(2),`x`]}),R(`div`,{className:`playback-slider`,ref:n,...u,children:R(`div`,{ref:r,style:{background:`linear-gradient(to right,
690
- #fff 0% ${f}%,
691
- #3A3A3A ${f}% 100%
692
- )`},children:R(`div`,{className:`playback-handle`,style:{left:`${f}%`}})})})]})},Q_=M`
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
- ${V_}
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
- `,$_=()=>{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]=S(0),{open:s,toggle:c,containerRef:l,pending:u,failed:d,runSelect:f}=U_({onReset:()=>o(0)}),p=t=>{e.setPlaybackRate(t),o(0)},m=e=>{e!==void 0&&f(e,()=>i(e))},h=e=>()=>{o(e)};return T(`div`,{css:Q_,ref:l,children:[R(A_,{id:`settings`,disabled:s,text:R(`button`,{className:`settings`,type:`button`,onClick:c,"aria-label":`Settings`,"aria-expanded":s,children:R(pg,{})}),toolTipText:R(`span`,{children:`Settings`})}),s&&a===0&&T(`div`,{className:`popover menu`,children:[n.length>1?T(`div`,{onClick:h(2),children:[R(`div`,{children:`Audio`}),R(`div`,{children:R(zh,{})})]}):null,T(`div`,{onClick:h(1),children:[R(`div`,{children:`Playback speed`}),T(`div`,{children:[R(`span`,{className:`secondary`,children:t===1?`(Default)`:t.toFixed(2)}),R(zh,{})]})]})]}),s&&a===1&&T(`div`,{className:`popover playback-rate`,children:[T(`div`,{className:`back`,onClick:h(0),children:[R(Fh,{}),R(`span`,{children:`Playback speed`})]}),R(`div`,{className:`slider no-hover`,children:R(Z_,{})}),T(`div`,{className:`options no-hover`,children:[R(`div`,{onClick:()=>p(.5),children:`0.5x`}),R(`div`,{onClick:()=>p(1),children:`1x`}),R(`div`,{onClick:()=>p(1.5),children:`1.5x`}),R(`div`,{onClick:()=>p(2),children:`2x`})]})]}),s&&a===2&&R(H_,{title:`Audio`,tracks:n,selected:r,onSelect:m,onBack:h(0),pending:u,failed:d})]})},ev=M`
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
- ${V_}
768
- `,tv=()=>{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}=U_();if(e.length===0)return null;let u=t!==void 0;return T(`div`,{css:ev,ref:o,children:[R(A_,{id:`subtitles`,disabled:i,text:R(`button`,{className:`subtitles`,type:`button`,onClick:a,"aria-label":`Subtitles`,"aria-expanded":i,"aria-pressed":u,children:u?R(L_,{className:`captions`}):R(R_,{className:`captions-off`})}),toolTipText:R(`span`,{children:`Subtitles`})}),i&&R(H_,{title:`Subtitles`,tracks:e,selected:t,onSelect:e=>l(e??null,()=>n(e)),offLabel:r??`Disable`,pending:s,failed:c})]})},nv={primary:`#EAEBEE`,secondary:`#D0D0D9`,hover:`rgba(255, 255, 255, 0.13)`,borderPrimary:`#384F70`,backgroundTooltip:`#222222`},rv=M`
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
- `,iv=({value:e,onChange:t})=>{let n=Q(e=>e.volume),r=Q(e=>e.muted),i=p(null),a=p(null),{handlers:o}=j_({ref:a,onChange:t}),s=n=>{n.preventDefault();let r=.05,i=e;i=n.deltaY<0?Math.min(1,i+r):Math.max(0,i-r),t(i)};x(()=>{let e=i.current;return e&&e.addEventListener(`wheel`,s,{passive:!1}),()=>{e&&e.removeEventListener(`wheel`,s)}},[e]);let c=e*100,l=E(()=>Math.round(r?0:C_(n)*100),[n,r]);return R(A_,{id:`volume-slider`,text:R(`div`,{ref:i,css:rv,...o,children:R(`div`,{ref:a,style:{background:`linear-gradient(to right,
812
- #fff 0% ${c}%,
813
- #3A3A3A ${c}% 100%
814
- )`},children:R(`div`,{className:`volume-handle`,style:{left:`${e*100}%`}})})}),toolTipText:T(`div`,{className:`volume-value`,children:[l,`%`]})})},av=M`
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
- ${p_.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
- `,ov=({ref:e})=>{let t=Q(),n=Q(e=>e.volume),r=Q(e=>e.muted),i=E(()=>C_(n),[n]);return T(`div`,{css:av,children:[R(A_,{id:`sound`,text:R(`button`,{className:`sound`,type:`button`,onClick:()=>t.toggleMuted(),ref:e,"aria-label":`Mute`,"aria-pressed":r||n===0,children:R(r||n===0?Tg:n<=.5?_g:xg,{size:18,color:`#fff`})}),toolTipText:R(`span`,{children:r?`Unmute (m)`:`Mute (m)`})}),R(`div`,{className:`volume-slider-container`,children:R(`div`,{className:`volume-slider-background`,children:R(iv,{value:r?0:i,onChange:e=>{t.setVolume(S_(e))}})})})]})},sv=.05,cv=5,lv=M`
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
- `,uv=M`
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: ${nv.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
- ${p_.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
- `,dv=()=>{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]=S(null),p=s===`burn-in`,m=l.length>0,h=r>0&&n===r,g=b(({direction:t,stepSize:n})=>{let r=C_(e.volume),i=t===`up`?n:-n,a=Math.max(0,Math.min(1,r+i)),o=e.muted;e.setVolume(S_(a)),o&&!e.muted&&e.toggleMuted()},[e]);x(()=>{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`)g({direction:`up`,stepSize:sv});else if(n.key===`ArrowDown`)g({direction:`down`,stepSize:sv});else if(n.key===`ArrowRight`){if(!e.duration)return;t(Math.min(e.currentTime+cv,e.duration))}else n.key===`ArrowLeft`?t(Math.max(e.currentTime-cv,0)):i=!1;i&&n.preventDefault()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,g,u]);let _=b(e=>{e.preventDefault(),e.deltaY<0?g({direction:`up`,stepSize:sv}):g({direction:`down`,stepSize:sv})},[g]);return x(()=>{if(d)return d.addEventListener(`wheel`,_,{passive:!1}),()=>d.removeEventListener(`wheel`,_)},[d,_]),T(`div`,{css:uv,style:{...a?{opacity:`0`,pointerEvents:`none`}:{}},children:[R(P_,{}),T(`div`,{className:`actions`,children:[T(`div`,{className:`left`,children:[R(A_,{id:`play`,tooltipPlace:`top-start`,text:R(`button`,{className:`play`,type:`button`,onClick:()=>e.togglePaused(),"aria-label":h?`Replay`:t?`Play`:`Pause`,children:R(h?lg:t?ag:tg,{})}),toolTipText:R(`span`,{children:h?`Replay (k)`:t?`Play (k)`:`Pause (k)`})}),R(ov,{ref:f}),R(`div`,{className:`time`,children:T_(n,r)})]}),T(`div`,{className:`right`,children:[R(Y_,{}),R(tv,{}),R($_,{}),o?R(A_,{id:`picture-in-picture`,tooltipPlace:`top-end`,text:R(`button`,{className:`picture-in-picture`,type:`button`,onClick:o,disabled:p&&!m,"aria-label":p?`Put the subtitles in the video`:`Picture in picture`,"aria-pressed":p?c:void 0,children:p?R(c?z_:B_,{}):R(`img`,{src:F_,alt:``})}),toolTipText:T(`span`,{css:lv,children:[R(`span`,{className:`lead`,children:p?m?c?`Subtitles are in the picture`:`Put the subtitles in the picture`:`This file has no subtitles`:`Picture in picture`}),p&&m?R(`span`,{className:`hint`,children:`Then hover the video and click your browser's own pop out button`}):null]})}):null,R(A_,{id:`full-screen`,tooltipPlace:`top-end`,text:R(`button`,{className:`full-screen`,type:`button`,onClick:()=>e.toggleFullscreen(),"aria-label":`Full screen`,"aria-pressed":i,children:R(i?Zh:qh,{})}),toolTipText:R(`span`,{children:i?`Exit full screen (f)`:`Full screen (f)`})})]})]})]})},fv=9e3,pv=M`
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
- ${p_.bMedium.bold}
1053
- color: #fff;
1054
- }
1055
-
1056
- .body {
1057
- ${p_.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
- `,mv=()=>{let e=Q(e=>e.burnedInSubtitles),t=Q(e=>e.pictureInPictureMode),[n,r]=S(!1);return x(()=>{if(t!==`burn-in`||!e){r(!1);return}r(!0);let n=setTimeout(()=>r(!1),fv);return()=>clearTimeout(n)},[t,e]),t!==`burn-in`||!e?null:R(`div`,{css:pv,className:n?`show`:``,role:`status`,children:T(`div`,{className:`card`,children:[T(`div`,{className:`words`,children:[R(`div`,{className:`title`,children:`Subtitles are in the picture`}),R(`div`,{className:`body`,children:`Now hover the video and click your browser's own pop out button`})]}),R(`div`,{className:`arrow`,"aria-hidden":`true`,children:`→`})]})})},hv=3e3,gv=M`
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
- `,_v=M`
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
- `,vv=(e,t=``)=>d.toArray(e).flatMap((e,n)=>{let r=`${t}${v(e)&&e.key!=null?e.key:n}`;return v(e)&&e.type===ee?vv(e.props.children,`${r}/`):[{key:r,item:e}]}),yv=({ref:e,onVideoRef:t,onCanvasRef:n,overlay:r,controls:i,children:a})=>{let o=Q(),s=Q(e=>e.hideUI),c=Q(e=>e.setHideUI),l=p(void 0),u=p(`mouse`),d=p({x:-1,y:-1}),f=p(null);x(()=>()=>clearTimeout(l.current),[]);let m=t=>{f.current=t,typeof e==`function`?e(t):e&&(e.current=t)},h=()=>{if(u.current!==`mouse`)return!1;let{x:e,y:t}=d.current;if(!f.current||e<0)return!1;let n=document.elementFromPoint(e,t);return!!n&&f.current.contains(n)&&!n.closest(`.video`)},g=()=>{if(h()){l.current=setTimeout(g,hv);return}c(!0)},_=()=>{c(!1),clearTimeout(l.current),l.current=setTimeout(g,hv)};return T(`div`,{css:_v,ref:m,onPointerMove:e=>{u.current=e.pointerType,e.pointerType===`mouse`&&(d.current={x:e.clientX,y:e.clientY},_())},onPointerDown:e=>{u.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(l.current),c(!0))},className:s?`hide`:``,children:[R(y_,{onCanvasRef:n}),vv(r).map(({key:e,item:t})=>R(`div`,{css:gv,style:{...s?{opacity:`0`,visibility:`hidden`,pointerEvents:`none`}:{}},children:t},e)),i===!1?null:R(dv,{}),R(mv,{}),T(`div`,{className:`video`,onClick:()=>{if(u.current===`mouse`){o.togglePaused();return}s?_():(clearTimeout(l.current),c(!0))},children:[t?R(`video`,{ref:t,playsInline:!0}):null,a]})]})},bv=({options:t,children:n})=>{let r=`media`in t?t:null,i=r?null:t,{title:a}=t,{size:o,downloadedRanges:s,publicPath:c,libavWorkerUrl:l,read:u,thumbnailRead:d,thumbnailsEnabled:f}=i??{},m=lc(),h=uc(),[g,_]=S(null),[v,y]=S(null),b=r?.media??g;x(()=>(m?.(b),()=>m?.(null)),[b,m]);let{expose:C}=t,w=C===!0?{}:C||void 0,T=p(w);T.current=w;let E=w?w.id:void 0,D=w?w.origin:void 0,O=w?w.channel:void 0;x(()=>{if(!C||!b)return;let t,n=!1;return e(async()=>{let{exposePlayer:e}=await import(`./remote-DNcNpuT3.js`);return{exposePlayer:e}},__vite__mapDeps([0,1,2])).then(({exposePlayer:e})=>{n||(t=e(b,T.current??{}))}).catch(()=>{}),()=>{n=!0,t?.()}},[b,!!C,E,D,O]),c_(g,v,i);let k=d_({publicPath:c,workerUrl:l,length:f===!1?void 0:o,read:d??u,downloadedRanges:s}),A=r?.thumbnails?.all??k,{toggle:j,mode:M,burnedIn:N}=f_(g,v),P=Q(e=>e.setSourceState);x(()=>{P({title:a,size:o,downloadedRanges:s})},[P,a,o,s]);let F=r?.thumbnails?.at;x(()=>{P({thumbnails:A,thumbnailAt:F,togglePictureInPicture:j,pictureInPictureMode:M,burnedInSubtitles:N})},[P,A,F,j,M,N]);let ee=r?.subtitles?.selection,te=r?.audioTracks?.selection;return x(()=>{ee&&P({subtitleTracks:ee.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedSubtitleTrack:ee.selectedId??void 0,selectSubtitleTrack:e=>ee.select(e==null?null:String(e)),subtitleOffLabel:ee.offLabel})},[P,ee]),x(()=>{te&&P({audioTracks:te.options.map(({id:e,label:t,disabled:n})=>({id:e,label:t,disabled:n})),selectedAudioTrack:te.selectedId??void 0,selectAudioTrack:e=>te.select(String(e))})},[P,te]),R(yv,{ref:h,onVideoRef:r?void 0:_,onCanvasRef:y,overlay:t.overlay,controls:t.controls,children:n})},xv=M`
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
- `,Sv=e=>R(`div`,{css:xv,children:R(Qg.Provider,{children:R(bv,{options:e,children:e.children})})}),Cv=`[data-testid="track-selection-button"]`,wv=`[data-testid="audio-text-track-menu"]`,Tv=`.timeline-slider`,Ev=`[role="menu"]`,Dv=`[role="menuitemradio"]`,Ov=1e4,kv=2e4,Av=5e3,jv=100,Mv=`Opens Crunchyroll audio and subtitle choices.`,Nv=`Changes the Crunchyroll audio option you picked.`,Pv=`Changes the Crunchyroll subtitle option you picked.`,Fv=`Restores your place after changing Crunchyroll audio or subtitles.`,Iv=/^(off|none|disabled)$/i,Lv=e=>new Promise(t=>setTimeout(t,e)),Rv=()=>!1,zv=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Bv=(e,t)=>e.locator(wv).locator(Ev).nth(t===`audio`?0:1),Vv=e=>e.replace(/\s+/g,` `).trim(),Hv=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Vv(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=>Iv.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}:{}}},Uv=async(e,t)=>{zv(t);let n=e.locator(wv);if(await n.exists({timeout:1e3})){zv(t);return}zv(t),await e.locator(Cv).click({timeout:Ov,reason:Mv});let r=Date.now()+Ov;for(;Date.now()<r;){if(zv(t),await n.exists({timeout:1e3}))return;await Lv(jv)}throw Error(`Crunchyroll track menu did not open`)},Wv=async(e,t,n)=>{zv(n);let r=Bv(e,t).locator(Dv),i=await r.count({timeout:1e3});zv(n);let a=await Promise.all(Array.from({length:i},async(e,t)=>{zv(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:Vv(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}`}})},Gv=async(e,t)=>{let[n,r]=await Promise.all([Wv(e,`audio`,t),Wv(e,`subtitles`,t)]);return{audio:Hv(`audio`,n),subtitles:Hv(`subtitles`,r)}},Kv=async(e,t=Rv)=>(await Uv(e,t),Gv(e,t)),qv=async(e,t,n,r)=>(await Wv(e,t,r)).find(e=>n===null?Iv.test(e.label):e.id===n)?.index??-1,Jv=async(e,t,n,r)=>{let i=Date.now()+kv;for(;Date.now()<i;){zv(r),await Uv(e,r);let i=(await Wv(e,t,r)).find(e=>e.selected);if(i&&(n===null?Iv.test(i.label):i.id===n))return;await Lv(jv)}throw Error(`Crunchyroll did not apply the ${t} option`)},Yv=(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))},Xv=e=>({currentTime:e.currentTime,paused:e.paused,volume:e.volume,muted:e.muted,playbackRate:e.playbackRate}),Zv=(e,t,n=Fv)=>e.locator(Tv).fill(String(t),{timeout:kv,reason:n}),Qv=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(zv(n),!(e.currentSrc!==t||e.readyState<2));)await Lv(jv);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+kv;for(;Date.now()<i;){if(zv(n),e.readyState>=2)return!0;await Lv(jv)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},$v=async(e,t,n,r)=>{zv(r),t.volume=n.volume,t.muted=n.muted,t.playbackRate=n.playbackRate;let i=Yv(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await Zv(e,i);let a=Date.now()+kv;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)zv(r),await Lv(jv);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);zv(r),n.paused?t.pause():await t.play();let o=Date.now()+Av;for(;Date.now()<o&&t.paused!==n.paused;)zv(r),await Lv(jv);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},ey=async(e,t,n,r,i=Rv)=>{await Uv(e,i);let a=await qv(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);zv(i);let o=t.currentSrc,s=Xv(t);return await Bv(e,n).locator(Dv).nth(a).click({timeout:Ov,reason:n===`audio`?Nv:Pv}),await Jv(e,n,r,i),await Qv(t,o,i)&&await $v(e,t,s,i),Kv(e,i)},ty=`Seeks the video to the point you pick on the timeline.`,ny=(e,t)=>{Zv(e,t,ty).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},ry=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&ny(t,r),Reflect.set(e,n,r,i)}}),iy=({remote:e,frame:t,subtitles:n,audioTracks:r,controls:i,children:a})=>R(Sv,{expose:!0,media:E(()=>e&&t?ry(e,t):null,[e,t]),subtitles:n,audioTracks:r,controls:i,children:a});g();var ay=[`www.crunchyroll.com`,`crunchyroll.com`,`sso.crunchyroll.com`,`static.crunchyroll.com`],oy=`
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
- `,sy=`https://www.crunchyroll.com`,cy=`noaihdevm_6iyg0a8l0q`,ly=(e,t)=>{let{pathname:n,search:r}=new URL(e);return`https://sso.crunchyroll.com/authorize?${new URLSearchParams({client_id:cy,redirect_uri:`${sy}/callback`,response_type:`cookie`,state:t?`${n}${r}`:`/`})}`},uy=3e4,dy=6e5,fy=async()=>n()?`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)),n()?`extension`:`cloud`),py=async(e,t)=>{let n=Date.now()+uy;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=async(e,t)=>{let n=Date.now()+dy,r=0,i=0;for(;!t()&&Date.now()<n;){if(await new Promise(e=>setTimeout(e,1e3)),t())return`cancelled`;let[n,a,o]=await Promise.all([e.locator(`.shell-header`).exists().catch(()=>null),e.locator(`#user-menu-authenticated`).exists().catch(()=>null),e.locator(`#user-menu-anonymous`).exists().catch(()=>null)]);if(n===null&&a===null&&o===null){if(r+=1,i=0,r>=3)return`lost`;continue}if(r=0,n){i=0;continue}if(a)return`authed`;if(i=o&&a===!1?i+1:0,i>=3)return`backout`}return`timeout`},hy=3e4,gy=async(e,t)=>{let n=Date.now()+hy;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},_y=M`
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
- /* The cloud in-frame sign-in renders CR's own login form inside the frame,
1247
- so while that flow is active the frame must take the taps. Once the
1248
- session lands and the skin's video takes over, the frame goes back to
1249
- pointer-events: none. */
1250
- .cr-frame.interactive {
1251
- pointer-events: auto;
1252
- }
1253
-
1254
- .overlay {
1255
- position: absolute;
1256
- inset: 0;
1257
- display: flex;
1258
- flex-direction: column;
1259
- align-items: center;
1260
- justify-content: center;
1261
- gap: 1.6rem;
1262
- background: #000;
1263
- font-size: 1.4rem;
1264
- color: rgba(255, 255, 255, 0.8);
1265
- /* Above the skin's own layers (its controls/error dialog top out at
1266
- z-index 20) so the login/loading screen fully covers them. */
1267
- z-index: 30;
1268
- }
1269
-
1270
- .login-button {
1271
- padding: 0.8rem 2rem;
1272
- background: #f47521;
1273
- color: #fff;
1274
- border: none;
1275
- border-radius: 0.4rem;
1276
- font-size: 1.4rem;
1277
- font-weight: 600;
1278
- cursor: pointer;
1279
-
1280
- &:hover {
1281
- background: #e0651a;
1282
- }
1283
-
1284
- &:disabled {
1285
- opacity: 0.6;
1286
- cursor: default;
1287
- }
1288
- }
1289
- `,vy=({url:e})=>{let[t,r]=S(`detecting`),[i,o]=S(null),[s,c]=S(null),[l,u]=S(!0),[d,f]=S(!1),[m,h]=S(!1),[g,_]=S(),[v,y]=S(null),[C,w]=S(0),[D,O]=S(0),[k,A]=S(!1),[j,M]=S(!1),P=p(null),F=p(null),[ee,te]=S(),I=p(0),L=p({generation:0,tail:Promise.resolve()}),ne=p(!0),z=b(()=>{let e=I.current+1;return I.current=e,L.current={generation:e,tail:Promise.resolve()},te(void 0),e},[]),re=b((e,t)=>{if(L.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=L.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);x(()=>()=>{ne.current=!1,I.current+=1},[]),x(()=>{let e=!1;return fy().then(t=>{e||r(t)}),()=>{e=!0}},[]),x(()=>{if(!i||t===`detecting`)return;let e=!1;return a({iframe:i,domains:ay,permissions:[{category:`interaction`,reason:`Control the Crunchyroll player from this app`},{category:`storage`,reason:`Read the audio and subtitle track names`}]}).then(i=>{if(e)return;let a=n()?`extension`:`cloud`;if(a!==t){r(a);return}c(i)}).catch(t=>{e||(console.error(`Failed to attach Crunchyroll frame`,t),_(t?.message||`Failed to load player`),u(!1))}),()=>{e=!0}},[i,t]),x(()=>{if(!s)return;let n=!1,r=()=>n;return u(!0),_(void 0),f(!1),h(!1),y(null),z(),(async()=>{if(t===`cloud`){if(await s.goto(e,{waitUntil:`load`}),n)return;let{isLoggedIn:t}=await py(s,r);if(n)return;if(t){if(await s.addStyleTag({content:oy}),n)return;let e=await gy(s,r);if(n)return;if(u(!1),!e)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);y(e);return}u(!1),f(!0),h(!0),await s.goto(ly(e,!0),{waitUntil:`load`});let i=await my(s,r);if(n)return;if(h(!1),i===`backout`){f(!0),u(!1);return}if(i===`lost`)throw Error(`Lost the connection to the player frame`);if(i!==`authed`)throw Error(`Sign-in was not completed in time`);if(u(!0),f(!1),await s.goto(e,{waitUntil:`load`}),n)return;let{isLoggedIn:a}=await py(s,r);if(n)return;if(!a){u(!1),f(!0);return}if(await s.addStyleTag({content:oy}),n)return;let o=await gy(s,r);if(n)return;if(u(!1),!o)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);y(o);return}if(await s.goto(e,{waitUntil:`documentstart`}),n||(await s.addStyleTag({content:oy}),n))return;let{isLoggedIn:i}=await py(s,r);if(n)return;if(!i){u(!1),f(!0);return}let a=await gy(s,r);if(!n){if(u(!1),!a)throw Error(`The episode did not load a player. It may be unavailable or require a different plan.`);y(a)}})().catch(e=>{n||(console.error(`Failed to load Crunchyroll player`,e),_(e?.message||`Failed to load player`),u(!1),h(!1))}),()=>{n=!0}},[s,e,C,t,z]),x(()=>{if(!s||!v)return;let e=z(),t=!1,n=()=>t||!ne.current||e!==I.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await re(e,()=>Kv(s,n)),t=void 0,n()||(te(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}},[s,v,z,re]);let ie=I.current,B=b((e,t)=>{if(!s||!v)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!ne.current||ie!==I.current;return re(ie,async()=>{try{let r=await ey(s,v,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);te(r)}catch(e){if(!n())try{let e=await Kv(s,n);n()||te(e)}catch{}throw e}})},[s,v,re,ie]),ae=E(()=>ee?.subtitles&&{selection:{...ee.subtitles,select:e=>B(`subtitles`,e)}},[ee?.subtitles,B]),oe=E(()=>ee?.audio&&{selection:{...ee.audio,select:e=>B(`audio`,e)}},[ee?.audio,B]),se=b(()=>{if(P.current!==null)return;let t=globalThis.open(ly(e,!1),`_blank`,`width=500,height=700`);if(!t){M(!0),u(!1);return}M(!1),A(!0),F.current=t;let n=setInterval(()=>{t.closed&&(clearInterval(n),P.current===n&&(P.current=null),F.current===t&&(F.current=null),A(!1),w(e=>e+1))},500);P.current=n},[e]);x(()=>()=>{P.current!==null&&(clearInterval(P.current),P.current=null)},[]),x(()=>{P.current!==null&&(clearInterval(P.current),P.current=null,A(!1)),M(!1)},[e]);let ce=b(()=>{F.current!==null&&(F.current.close(),F.current=null),P.current!==null&&(clearInterval(P.current),P.current=null),c(null),_(void 0),y(null),z(),f(!1),M(!1),A(!1),u(!0),O(e=>e+1)},[z]),le=b(()=>{f(!1),u(!0),w(e=>e+1)},[]),ue=(l||g||j||d&&!m)&&T(`div`,{className:`overlay`,children:[d&&!g&&!j&&T(N,{children:[`You need to be logged in to Crunchyroll to watch this content.`,t===`extension`?R(`button`,{className:`login-button`,onClick:se,disabled:k,children:k?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):R(`button`,{className:`login-button`,onClick:le,children:`Try signing in again`})]}),j&&!g&&T(N,{children:[`The login popup was blocked. Allow popups for this page and try again.`,R(`button`,{className:`login-button`,onClick:se,children:`Open Crunchyroll Login Page`})]}),g&&T(N,{children:[g,R(`button`,{className:`login-button`,onClick:ce,children:`Retry`})]}),l&&!g&&!d&&`Loading Crunchyroll player...`]});return T(`div`,{css:_y,children:[t!==`detecting`&&R(iy,{remote:v,frame:s,subtitles:ae,audioTracks:oe,controls:!m,children:R(`iframe`,{ref:o,className:`cr-frame${m?` interactive`:``}`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${t}-${D}`)}),ue]})},yy=e=>e,by=yy(({className:e,children:t})=>R(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),xy=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Sy=yy(({className:e})=>T(by,{className:e,children:[R(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),R(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Cy=yy(({className:e})=>T(by,{className:e,children:[R(`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`}),R(`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`})]})),wy=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Ty=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Ey=yy(({className:e})=>R(by,{className:e,children:R(`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=yy(({className:e})=>T(by,{className:e,children:[R(`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`}),R(`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`})]})),Oy=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),ky=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Ay=yy(({className:e})=>T(by,{className:e,children:[R(`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`}),R(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),R(`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`})]})),jy=yy(({className:e})=>T(by,{className:e,children:[R(`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`}),R(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),R(`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`})]})),My=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Ny=yy(({className:e})=>T(by,{className:e,children:[R(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),R(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),R(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),R(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),R(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),R(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Py=yy(({className:e})=>R(by,{className:e,children:T(`g`,{fill:`currentColor`,children:[R(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:R(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:R(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:R(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:R(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:R(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:R(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:R(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),R(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:R(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),Fy=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Iy=yy(({className:e})=>R(by,{className:e,children:R(`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`})})),Ly=yy(({className:e})=>R(by,{className:e,children:R(`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`})}));g();var Ry=10,$=e=>e,zy=$(lm.Root),By=$(nm),Vy=$(_m.Root),Hy=$(tm.Popup),Uy=$(tm.Title),Wy=$(tm.Close),Gy=$(_m.Description),Ky=$(_h.Provider),qy=$(_h.Root),Jy=$(_h.Trigger),Yy=$(_h.Popup),Xy=$(Rm.Root),Zy=$(Rm.Trigger),Qy=$(Rm.Popup),$y=$(Om),eb=$(zm),tb=$(Em),nb=$(Dm),rb=$(vm),ib=$(km),ab=$(nh.Value),ob=$(ah.Root),sb=$(Qm.Track),cb=$(Qm.Fill),lb=$(Qm.Buffer),ub=$(Qm.Thumb),db=$(Qm.Value),fb=$(bh.Root),pb=$(wm),mb=$(bm),hb=$(Td),gb=({className:e,...t})=>R(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),_b=({selection:e,icon:t})=>{let[n,r]=S(!1),[i,a]=S(!1),[o,s]=S(!1);x(()=>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 T(Xy,{open:n,onOpenChange:e=>r(e),children:[R(Zy,{render:R(gb,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),R(Qy,{className:`media-surface media-popover media-popover--menu`,children:T(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[R(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return T(`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:[R(`span`,{className:`stub-menu__check`,children:n?R(Ly,{className:`media-icon`}):null}),R(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?R(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},vb=()=>T(Xy,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[R(Zy,{render:T(tb,{className:`media-button--mute`,render:R(gb,{}),children:[R(Ty,{className:`media-icon media-icon--volume-off`}),R(Ey,{className:`media-icon media-icon--volume-low`}),R(Dy,{className:`media-icon media-icon--volume-high`})]})}),R(Qy,{className:`media-surface media-popover media-popover--volume`,children:T(fb,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[R(sb,{className:`media-slider__track`,children:R(cb,{className:`media-slider__fill`})}),R(ub,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),yb=({capabilities:e,children:t,className:n,...r})=>T(hb,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,R(By,{render:e=>R(`div`,{...e,className:`media-buffering-indicator`,children:R(`div`,{className:`media-surface`,children:R(Py,{className:`media-icon`})})})}),R(Vy,{children:R(Hy,{className:`media-error`,children:T(`div`,{className:`media-error__dialog media-surface`,children:[T(`div`,{className:`media-error__content`,children:[R(Uy,{className:`media-error__title`,children:`Something went wrong.`}),R(Gy,{className:`media-error__description`})]}),R(`div`,{className:`media-error__actions`,children:R(Wy,{className:`media-button media-button--primary`,children:`OK`})})]})})}),R(zy,{className:`media-surface media-controls`,children:T(Ky,{children:[T(`div`,{className:`media-button-group`,children:[T(qy,{side:`top`,children:[R(Jy,{render:T($y,{className:`media-button--play`,render:R(gb,{}),children:[R(Cy,{className:`media-icon media-icon--restart`}),R(xy,{className:`media-icon media-icon--play`}),R(Sy,{className:`media-icon media-icon--pause`})]})}),R(Yy,{className:`media-surface media-tooltip`})]}),T(qy,{side:`top`,children:[R(Jy,{render:R(eb,{seconds:-10,className:`media-button--seek`,render:R(gb,{}),children:T(`span`,{className:`media-icon__container`,children:[R(wy,{className:`media-icon media-icon--seek media-icon--flipped`}),R(`span`,{className:`media-icon__label`,children:Ry})]})})}),T(Yy,{className:`media-surface media-tooltip`,children:[`Seek backward `,Ry,` seconds`]})]}),T(qy,{side:`top`,children:[R(Jy,{render:R(eb,{seconds:Ry,className:`media-button--seek`,render:R(gb,{}),children:T(`span`,{className:`media-icon__container`,children:[R(wy,{className:`media-icon media-icon--seek`}),R(`span`,{className:`media-icon__label`,children:Ry})]})})}),T(Yy,{className:`media-surface media-tooltip`,children:[`Seek forward `,Ry,` seconds`]})]})]}),T(`div`,{className:`media-time-controls`,children:[R(ab,{type:`current`,className:`media-time`}),T(ob,{className:`media-slider`,children:[T(sb,{className:`media-slider__track`,children:[R(cb,{className:`media-slider__fill`}),R(lb,{className:`media-slider__buffer`})]}),R(ub,{className:`media-slider__thumb`}),R(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:R(db,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),R(ab,{type:`duration`,className:`media-time`})]}),T(`div`,{className:`media-button-group`,children:[T(qy,{side:`top`,children:[R(Jy,{render:R(ib,{className:`media-button--playback-rate`,render:R(gb,{})})}),R(Yy,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),R(vb,{}),e?.subtitles&&R(_b,{selection:e.subtitles,icon:e.subtitles.selectedId?R(My,{className:`media-icon`}):R(Ny,{className:`media-icon`})},`subtitles`),e?.audioTracks&&R(_b,{selection:e.audioTracks,icon:R(Fy,{className:`media-icon`})},`audio`),e?.qualityLevels&&R(_b,{selection:e.qualityLevels,icon:R(Iy,{className:`media-icon`})},`quality`),T(qy,{side:`top`,children:[R(Jy,{render:T(nb,{className:`media-button--pip`,render:R(gb,{}),children:[R(Ay,{className:`media-icon media-icon--pip-enter`}),R(jy,{className:`media-icon media-icon--pip-exit`})]})}),R(Yy,{className:`media-surface media-tooltip`})]}),T(qy,{side:`top`,children:[R(Jy,{render:T(rb,{className:`media-button--fullscreen`,render:R(gb,{}),children:[R(Oy,{className:`media-icon media-icon--fullscreen-enter`}),R(ky,{className:`media-icon media-icon--fullscreen-exit`})]})}),R(Yy,{className:`media-surface media-tooltip`})]})]})]})}),R(`div`,{className:`media-overlay`}),R(pb,{keys:`Space`,action:`togglePaused`}),R(pb,{keys:`k`,action:`togglePaused`}),R(pb,{keys:`m`,action:`toggleMuted`}),R(pb,{keys:`f`,action:`toggleFullscreen`}),R(pb,{keys:`i`,action:`togglePictureInPicture`}),R(pb,{keys:`ArrowRight`,action:`seekStep`,value:5}),R(pb,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),R(pb,{keys:`l`,action:`seekStep`,value:10}),R(pb,{keys:`j`,action:`seekStep`,value:-10}),R(pb,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),R(pb,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),R(pb,{keys:`0-9`,action:`seekToPercent`}),R(pb,{keys:`Home`,action:`seekToPercent`,value:0}),R(pb,{keys:`End`,action:`seekToPercent`,value:100}),R(pb,{keys:`>`,action:`speedUp`}),R(pb,{keys:`<`,action:`speedDown`}),R(mb,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),R(mb,{type:`tap`,action:`toggleControls`,pointer:`touch`}),R(mb,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),R(mb,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),R(mb,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});g();var{Provider:bb}=Dd({features:Mu}),xb=e=>`media`in e?e:{media:e},Sb=({remote:e,frame:t,adapter:n})=>{let r=lc();return x(()=>{if(!r||!e||!t)return;let i=n?n(e,t):e;if(!i)return;let a=xb(i);r(a.media);let o=re(a.media);return()=>{o(),r(null),a.dispose?.()}},[e,t,n,r]),null},Cb=M`
1290
- position: absolute;
1291
- inset: 0;
1292
- border-radius: 0.8rem;
1293
- background: transparent !important;
1294
- &.media-default-skin--video {
1295
- background: transparent !important;
1296
- }
1297
-
1298
- .media-popover--menu {
1299
- padding: 0.4rem;
1300
- }
1301
-
1302
- /**
1303
- * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
1304
- *
1305
- * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
1306
- * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
1307
- * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
1308
- * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
1309
- * their specificity would just move the race to insertion order.
1310
- */
1311
- .stub-menu {
1312
- display: flex;
1313
- flex-direction: column;
1314
- min-width: 18rem;
1315
- max-height: 32rem;
1316
- overflow-y: auto;
1317
- }
1318
- .stub-menu__heading {
1319
- padding: 0.6rem 1rem 0.4rem;
1320
- font-size: 1.1rem;
1321
- font-weight: 600;
1322
- letter-spacing: 0.04em;
1323
- text-transform: uppercase;
1324
- opacity: 0.6;
1325
- }
1326
- .stub-menu__item {
1327
- display: flex;
1328
- align-items: center;
1329
- gap: 0.6rem;
1330
- width: 100%;
1331
- padding: 0.6rem 1rem;
1332
- border: none;
1333
- border-radius: 0.4rem;
1334
- background: transparent;
1335
- color: inherit;
1336
- font-size: 1.3rem;
1337
- text-align: left;
1338
- cursor: pointer;
1339
-
1340
- &:hover:not(:disabled) {
1341
- background: rgba(255, 255, 255, 0.12);
1342
- }
1343
- &:disabled {
1344
- opacity: 0.5;
1345
- cursor: default;
1346
- }
1347
- }
1348
- .stub-menu__check {
1349
- display: inline-flex;
1350
- width: 1.6rem;
1351
- flex: none;
1352
- }
1353
- .stub-menu__label {
1354
- flex: 1;
1355
- }
1356
- .stub-menu__description {
1357
- opacity: 0.6;
1358
- font-size: 1.1rem;
1359
- }
1360
- .media-button--error {
1361
- color: #f66;
1362
- }
1363
- `,wb=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>T(bb,{children:[R(Sb,{remote:e,frame:t,adapter:n}),R(yb,{capabilities:r,css:Cb,children:i})]}),Tb=`[data-uia="timeline"]`,Eb=`[data-uia="video-canvas"]`,Db=`[data-uia="player"]`,Ob=`Seeks the video to the point you pick on the timeline.`,kb=`Reveals the player controls so the timeline can be used.`,Ab=140,jb=2,Mb=12e3,Nb=26,Pb=110,Fb={"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"]`},Ib=e=>new Promise(t=>setTimeout(t,e)),Lb=e=>e<0?0:e>1?1:e,Rb=0,zb=()=>{let e=Rb*1.1;return Rb++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},Bb=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Eb).ensure(`hover`,{reason:kb}),t.locator(Db).ensure(`hover`,{reason:kb}),t.locator(Tb).ensure(`click`,{reason:Ob})])}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)<jb&&(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=Lb(n/r);o();let a=t.locator(Tb),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<Nb;e++){if(e%2==0&&(await t.locator(Eb).hover({position:zb(),reason:kb}).catch(()=>{}),await t.locator(Db).hover({position:zb(),reason:kb}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await Ib(Pb)}if(!c){let n=await Promise.all(Object.entries(Fb).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:Ob}).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))},Ab),i&&clearTimeout(i),i=setTimeout(()=>{n=null},Mb),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},Vb=({remote:e,frame:t,capabilities:n,children:r})=>R(wb,{remote:e,frame:t,adapter:Bb,capabilities:n,children:r});g();var Hb=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],Ub=`https://www.netflix.com/login`,Wb=`
1364
- html, body {
1365
- margin: 0 !important;
1366
- padding: 0 !important;
1367
- width: 100% !important;
1368
- height: 100% !important;
1369
- overflow: hidden !important;
1370
- background: #000 !important;
1371
- }
1372
- /* Truly-unwanted chrome - collapse it entirely. */
1373
- .watch-video--evidence-overlay-container,
1374
- .watch-video--skip-content,
1375
- .watch-video--nextEpisode-seamless-button,
1376
- .watch-video--back-container,
1377
- [data-uia="player-back-to-browse"],
1378
- [data-uia="control-nav-back"],
1379
- [data-uia="control-flag"] {
1380
- display: none !important;
1381
- pointer-events: none !important;
1382
- }
1383
- /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
1384
- [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
1385
- display:none here, or the scrubber loses its box and the seek no-ops - mirrors
1386
- Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
1387
- [data-uia="controls-standard"],
1388
- .watch-video--bottom-controls-container,
1389
- .PlayerControlsNeo__layout,
1390
- .PlayerControlsNeo__core-controls,
1391
- .PlayerControlsNeo__button-control-row {
1392
- opacity: 0 !important;
1393
- pointer-events: none !important;
1394
- }
1395
- [data-uia="timeline"],
1396
- [data-uia="timeline"] * {
1397
- pointer-events: auto !important;
1398
- }
1399
- .watch-video,
1400
- [data-uia="video-canvas"] {
1401
- position: fixed !important;
1402
- inset: 0 !important;
1403
- width: 100% !important;
1404
- height: 100% !important;
1405
- z-index: 9999999 !important;
1406
- }
1407
- .watch-video video,
1408
- [data-uia="video-canvas"] video {
1409
- width: 100% !important;
1410
- height: 100% !important;
1411
- object-fit: contain !important;
1412
- }
1413
- `,Gb=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`)},Kb=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},qb=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},Jb=M`
1414
- position: relative;
1415
- width: 100%;
1416
- height: 100%;
1417
- background: #000;
1418
- user-select: none;
1419
- -webkit-user-select: none;
1420
-
1421
- .nf-frame {
1422
- position: absolute;
1423
- inset: 0;
1424
- width: 100%;
1425
- height: 100%;
1426
- border: none;
1427
- background: #000;
1428
- /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
1429
- they belong to the skin's gesture layer stacked above it. */
1430
- pointer-events: none;
1431
- }
1432
-
1433
- .overlay {
1434
- position: absolute;
1435
- inset: 0;
1436
- display: flex;
1437
- flex-direction: column;
1438
- align-items: center;
1439
- justify-content: center;
1440
- gap: 1.6rem;
1441
- background: #000;
1442
- font-size: 1.4rem;
1443
- color: rgba(255, 255, 255, 0.8);
1444
- z-index: 30;
1445
- }
1446
-
1447
- .login-button {
1448
- padding: 0.8rem 2rem;
1449
- background: #e50914;
1450
- color: #fff;
1451
- border: none;
1452
- border-radius: 0.4rem;
1453
- font-size: 1.4rem;
1454
- font-weight: 600;
1455
- cursor: pointer;
1456
-
1457
- &:hover {
1458
- background: #c11119;
1459
- }
1460
- }
1461
- `,Yb={cr:vy,nf:({url:e})=>{let[t,r]=S(null),[i,o]=S(null),[s,c]=S(!0),[l,u]=S(!1),[d,f]=S(),[p,m]=S(null),[h,g]=S(0);x(()=>{if(!t)return;let e=!1;return(async()=>{for(let r=0;!e;r++)try{let r=await a({iframe:t,domains:Hb});if(e)return;if(!n()){f(`Netflix playback currently needs the FKN browser extension.`),c(!1);return}o(r);return}catch(t){if(e)return;if(r>=4){console.error(`Failed to attach Netflix frame`,t),f(t instanceof Error?t.message:`Failed to load player`),c(!1);return}await new Promise(e=>setTimeout(e,300*(r+1)))}})(),()=>{e=!0}},[t]),x(()=>{if(!i)return;let t=!1,n=()=>t;return c(!0),f(void 0),u(!1),m(null),(async()=>{if(await i.goto(e,{waitUntil:`load`}),await Gb(()=>i.addStyleTag({content:Wb})),t)return;c(!1);let r=await Kb(i);if(t)return;if(!r){u(!0);return}let a=await qb(i,n);t||!a||m(a)})().catch(e=>{t||(console.error(`Failed to load Netflix player`,e),f(e?.message??`Failed to load player`),c(!1))}),()=>{t=!0}},[i,e,h]);let _=b(()=>{let e=globalThis.open(Ub,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),g(e=>e+1))},500)},[]);return T(`div`,{css:Jb,children:[R(Vb,{remote:p,frame:i,children:R(`iframe`,{ref:r,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(l||d||s)&&T(`div`,{className:`overlay`,children:[l&&T(N,{children:[`You need to be logged in to Netflix to watch this content.`,R(`button`,{className:`login-button`,onClick:_,children:`Open Netflix Login Page`})]}),d&&!l&&d,s&&!d&&!l&&`Loading Netflix player...`]})]})}},Xb=e=>Yb[e],Zb=new URLSearchParams(globalThis.location.search),Qb=Zb.get(`mediaUri`),$b=Zb.get(`episodeUri`),ex=Zb.get(`sourceUri`),tx=Zb.get(`url`),nx=ex?A(ex).origin:void 0,rx=nx?Xb(nx):void 0;F(R(()=>!Qb||!$b||!ex||!tx||!rx?R(`div`,{children:`Unsupported or missing parameters`}):R(rx,{url:tx,mediaUri:Qb,episodeUri:$b,sourceUri:ex}),{}),document.getElementById(`app`));