@banou/stub 0.0.59 → 0.0.61

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 (31) hide show
  1. package/README.md +2 -2
  2. package/build/assets/anime-index-CfrFapfs.js +1 -0
  3. package/build/assets/anime-seasons-C_bBHyot.js +1 -0
  4. package/build/assets/{country-D8hYH8v4.js → country-Bcvbkb-P.js} +6 -6
  5. package/build/assets/embed-Bx_qswl6.js +392 -0
  6. package/build/assets/{embed-title-DRzWo9Be.js → embed-title-BDqOXK5e.js} +1 -1
  7. package/build/assets/index-DBCCmq0V.js +2640 -0
  8. package/build/assets/lib-worker-Bi5r39Of.js +1 -0
  9. package/build/assets/{lib-worker--oXTPCmY.js → lib-worker-DL9oBuLM.js} +780 -772
  10. package/build/assets/lib-worker-anime-index-CfrFapfs.js +1 -0
  11. package/build/assets/lib-worker-anime-seasons-C_bBHyot.js +1 -0
  12. package/build/assets/lib-worker-index-BT14_KyK.js +2640 -0
  13. package/build/assets/main-B22RJp2Q.js +5846 -0
  14. package/build/assets/worker-KoBi1osA.js +1 -0
  15. package/build/assets/worker-rQdZfdAR.js +1 -0
  16. package/build/embed.html +4 -3
  17. package/build/index.html +5 -4
  18. package/build/index.js +11477 -9835
  19. package/fkn.json +1 -1
  20. package/package.json +11 -7
  21. package/build/assets/anime-index-BEkCRogm.js +0 -1
  22. package/build/assets/anime-seasons-OlRPaNUG.js +0 -1
  23. package/build/assets/embed-BG7xcwwQ.js +0 -392
  24. package/build/assets/index-AaeFL1HL.js +0 -2654
  25. package/build/assets/lib-worker-CAtrMpYx.js +0 -1
  26. package/build/assets/lib-worker-anime-index-BEkCRogm.js +0 -1
  27. package/build/assets/lib-worker-anime-seasons-OlRPaNUG.js +0 -1
  28. package/build/assets/lib-worker-index-C76K1LUo.js +0 -2654
  29. package/build/assets/main-DnIv6GDX.js +0 -5774
  30. package/build/assets/worker-CsKngzyA.js +0 -1
  31. package/build/assets/worker-CwdUYmJH.js +0 -1
@@ -0,0 +1,392 @@
1
+ import{C as e,g as t,i as n,l as r,m as i,o as a,p as o,s,t as c,u as l,y as u}from"./embed-title-BDqOXK5e.js";import{A as d,E as f,F as p,I as m,O as h,P as g,Q as _,R as v,U as y,X as b,Z as x,_ as S,b as C,g as w,j as T,k as E,w as D}from"./country-Bcvbkb-P.js";import{B as O,D as k,Q as ee,U as A,V as j,X as te,Z as M,a as ne,at as N,ct as re,dt as ie,et as ae,ft as P,ht as oe,it as F,lt as I,mt as se,nt as ce,o as L,ot as R,pt as z,q as B,r as le,s as V,st as ue,tt as H,ut as de}from"./player-volume-DTOJyhLh.js";import{A as U,B as fe,C as pe,D as me,E as he,F as ge,G as _e,H as ve,I as ye,J as be,K as xe,L as Se,M as Ce,N as we,O as Te,P as Ee,Q as De,R as Oe,S as ke,T as Ae,U as je,V as W,W as Me,X as Ne,Y as Pe,Z as Fe,_ as Ie,a as Le,b as Re,c as ze,d as Be,f as Ve,g as He,h as Ue,i as G,j as We,k as Ge,l as Ke,m as qe,n as Je,o as Ye,p as Xe,q as Ze,r as Qe,s as $e,t as et,u as tt,v as nt,w as rt,x as it,y as at,z as ot}from"./dist-B_MSi_-2.js";import{n as st}from"./remote-D8UjjUy7.js";se(),ue();var ct=e=>`https://static.crunchyroll.com/skip-events/production/${e}.json`,lt=e=>{try{return new URL(e).pathname.match(/\/watch\/([A-Z0-9]+)(?:\/|$)/)?.[1]}catch{return}},ut=[[`intro`,`Opening`],[`recap`,`Recap`],[`credits`,`Ending`],[`preview`,`Preview`]],dt=`Episode`,ft=e=>typeof e==`object`&&!!e&&!Array.isArray(e),pt=(e,t)=>{if(!ft(e))return[];let n=t!==void 0&&Number.isFinite(t)&&t>0?t:1/0,r=ut.flatMap(([t,r])=>{let i=e[t];if(!ft(i))return[];let{start:a,end:o}=i;if(typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o))return[];let s={start:Math.max(0,a),end:Math.min(o,n),title:r};return s.end>s.start?[s]:[]}).sort((e,t)=>e.start-t.start),i=[],a=0;for(let e of r){let t=Math.max(e.start,a);e.end<=t||(t>a&&i.push({start:a,end:t,title:dt}),i.push({start:t,end:e.end,title:e.title}),a=e.end)}return i.length&&n!==1/0&&a<n&&i.push({start:a,end:n,title:dt}),i},mt=new Set([403,404]),ht=async(e,t=p)=>{let n=await t(ct(e));if(!n.ok){if(await n.body?.cancel().catch(()=>{}),mt.has(n.status))return{};throw Error(`${ct(e)} answered ${n.status}`)}return n.json()},gt=e=>{let[t,n]=R();return F(()=>{if(n(e?.duration),!e)return;let t=()=>n(e.duration);return e.addEventListener(`durationchange`,t),e.addEventListener(`loadedmetadata`,t),()=>{e.removeEventListener(`durationchange`,t),e.removeEventListener(`loadedmetadata`,t)}},[e]),t},_t=[],vt=(e,t)=>{let n=lt(e),[r,i]=R(),a=gt(t);return F(()=>{if(!n)return;let e=!1;return ht(n).then(t=>{e||i({episodeId:n,events:t})},t=>{e||console.warn(`[cr] skip events unavailable:`,t)}),()=>{e=!0}},[n]),I(()=>{if(!r||r.episodeId!==n)return _t;let e=pt(r.events,a);return e.length?e:_t},[r,n,a])},yt=5e3,bt=async(e,t)=>{let n=await y.fetch(`${E}/auth/v1/token`,{method:`POST`,headers:{authorization:`Basic ${btoa(`cr_web:`)}`,"content-type":`application/x-www-form-urlencoded`},body:`grant_type=client_id&device_id=${crypto.randomUUID()}`,relay:t}),r=x(n),{access_token:i}=await n.json();if(!r||!i)throw Error(`Crunchyroll token through ${r}: ${n.status}`);let a=await y.fetch(`${E}/content/v2/cms/objects/${e}?ratings=true&locale=en-US`,{headers:{authorization:`Bearer ${i}`},relay:{id:r}});if(!a.ok&&a.status!==404)throw Error(`Crunchyroll episode through ${r}: ${a.status}`);return{relay:r,listed:a.ok}},xt=async(e,t)=>{let n=lt(e);if(!n)return[];let r=async()=>{let e=[];for(;;){let{relay:r,listed:i}=await bt(n,{exclude:[...t,...e]});if(i)return e;if(t.includes(r)||e.includes(r))return[];e.push(r)}},i,a=new Promise(e=>{i=setTimeout(e,yt,[])});return Promise.race([r().catch(()=>[]),a]).finally(()=>clearTimeout(i))};function K(e,t){let n={...t};for(let t in e)De(e[t])||(n[t]=e[t]);return n}function St(e,t){let n={};for(let r of t)Object.hasOwn(e,r)&&(n[r]=e[r]);return n}function Ct(e){return typeof e==`string`?e:e.text}function wt(e){return Ne(e)&&`key`in e&&`text`in e}function Tt(e,t,n){return typeof e==`string`?e:typeof t==`function`?t(e,n):xe(Ct(e),t??n)}function Et(e){let t=e.closest(`[dir]`)?.getAttribute(`dir`);return t?t.toLowerCase()===`rtl`:getComputedStyle(e).direction===`rtl`}function Dt(){return typeof CSS<`u`&&CSS.supports(`anchor-name: --a`)}function Ot(){return typeof navigator<`u`&&/mac/i.test(navigator.userAgent)}var kt={sideOffset:0,boundaryOffset:0},At={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function jt(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 Mt(e,t,n,r,i=kt){let a=r.side,o=At[a],s=a===`top`||a===`bottom`?t.height:t.width,c=jt(e,n,a,i);return c>=s?a:jt(e,n,o,i)>c?o:a}function Nt(e){try{e?.showPopover?.()}catch{}}function Pt(e){try{e?.hidePopover?.()}catch{}}function Ft(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 It(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 Lt(e,t,n){return Oe(t=>e.subscribe(t),()=>e.current,t??Se,n)}var Rt={target:Te,signals:new Ge,get:Te,set:Te};function q(e){let t=e.state(Rt),n=Object.keys(t),r=n[0];return Object.assign(r?e=>{if(r in e)return St(e,n)}:()=>void 0,{displayName:e.name})}var zt=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]??``}},Bt={ON_DEMAND:`on-demand`,LIVE:`live`,UNKNOWN:`unknown`},Vt=he({name:`live`,state:()=>({liveEdgeStart:NaN,targetLiveWindow:NaN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(!pe(r))return;let i=()=>n({liveEdgeStart:r.liveEdgeStart,targetLiveWindow:r.targetLiveWindow});i(),W(r,`targetlivewindowchange`,i,{signal:t}),W(r,`streamtypechange`,i,{signal:t}),W(r,`loadedmetadata`,i,{signal:t}),W(r,`canplay`,i,{signal:t}),W(r,`progress`,i,{signal:t}),W(r,`durationchange`,i,{signal:t}),W(r,`timeupdate`,i,{signal:t}),W(r,`emptied`,i,{signal:t})}}),Ht=he({name:`streamType`,state:()=>({streamType:Bt.UNKNOWN}),attach({target:e,signal:t,set:n}){let{media:r}=e;if(Ae(r)){let e=()=>n({streamType:r.streamType});e(),W(r,`streamtypechange`,e,{signal:t});return}if(!rt(r))return;let i=()=>{let{duration:e}=r;return e===1/0?Bt.LIVE:Number.isFinite(e)&&e>0?Bt.ON_DEMAND:Bt.UNKNOWN},a=()=>n({streamType:i()});a(),W(r,`durationchange`,a,{signal:t}),W(r,`loadedmetadata`,a,{signal:t}),W(r,`emptied`,a,{signal:t}),ke(r)&&W(r,`progress`,a,{signal:t})}});q(it);var Ut=q(Re),Wt=q(nt),Gt=q(Ie),Kt=q(He);q(Vt);var qt=q(Ue),Jt=q(qe),Yt=q(Xe);q(Ve),q(Be),q(tt),q(Ht);var Xt=q(Ke),Zt=q(ze),Qt=q($e),$t={seekStep({store:e,value:t}){if(De(t))return;let n=Zt(e.state);n&&n.seek(n.currentTime+t)},volumeStep({store:e,value:t}){if(De(t))return;let n=Qt(e.state);n&&n.setVolume(n.volume+t)},speedUp({store:e}){let t=Yt(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=Yt(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])}},en={seekStep:$t.seekStep,volumeStep:$t.volumeStep,speedUp:$t.speedUp,speedDown:$t.speedDown};function tn(e){return en[e]||(({store:t})=>{let n=t.state[e];Ze(n)&&n()})}var nn=200,rn=class{#e=0;#t=null;handleUp(e,t){if(e.resolve(`doubletap`).length>0){let n=Date.now();if(n-this.#e<nn){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)},nn)}else e.resolve(`tap`)[0]?.onActivate(t)}#n(){this.#t!==null&&(clearTimeout(this.#t),this.#t=null)}reset(){this.#n(),this.#e=0}},an=new WeakMap;function on(e){let t=an.get(e);return t||(t=new rn,an.set(e,t),t)}function sn(e,t,n){return at(e).add({type:`tap`,recognizer:on(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function cn(e,t,n){return at(e).add({type:`doubletap`,recognizer:on(e),onActivate:t,pointer:n?.pointer,region:n?.region,disabled:n?.disabled,action:n?.action,value:n?.value})}function ln(e){return e.startsWith(`toggle`)}var un={togglePaused({store:e}){let t=Jt(e.state);t&&(t.paused?t.play():t.pause())},toggleMuted({store:e}){Qt(e.state)?.toggleMuted()},toggleFullscreen({store:e}){let t=Kt(e.state);t&&(t.fullscreen?t.exitFullscreen():t.requestFullscreen())},toggleSubtitles({store:e}){Xt(e.state)?.toggleSubtitles()},togglePictureInPicture({store:e}){let t=qt(e.state);t&&(t.pip?t.exitPictureInPicture():t.requestPictureInPicture())},seekStep:$t.seekStep,volumeStep:$t.volumeStep,speedUp:$t.speedUp,speedDown:$t.speedDown,seekToPercent({store:e,value:t,key:n}){let r=Zt(e.state);if(!r||r.duration<=0)return;let i;if(!De(t))i=t;else if(n>=`0`&&n<=`9`)i=Number(n)*10;else return;r.seek(i/100*r.duration)}};function dn(e){return un[e]}var fn={shift:`Shift`,ctrl:`Control`,alt:`Alt`,meta:`Meta`},pn={shift:`Shift`,ctrl:`Ctrl`,alt:`Alt`,meta:`Meta`},mn=[`ctrl`,`shift`,`alt`,`meta`];function hn(e){return e.map(e=>{let t=[];for(let n of mn)e.modifiers.has(n)&&t.push(fn[n]);return t.push(e.originalKey),t.join(`+`)}).join(` `)}function gn(e){let t=[];for(let n of mn)e.modifiers.has(n)&&t.push(pn[n]);return t.push(_n(e.originalKey)),t.join(`+`)}function _n(e){return e.length===1?e.toUpperCase():e}var vn=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:bn(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:hn(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,W(this.#e,`keydown`,this.#f,{signal:this.#r.signal}))}#u(){this.#i||(this.#i=new AbortController,W(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`||je(e)||e.defaultPrevented)return;let t=ve(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(Sn(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:De(t)?!0:n.options.value===t).sort((e,t)=>e.id-t.id)}#m(e){return e.options.keys===`0-9`?e.options.keys:gn(e.parsed[0])}#h(){for(let e of this.#o)e()}},yn=new Set([`shift`,`ctrl`,`alt`,`meta`]);function bn(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(Ot()?`meta`:`ctrl`):yn.has(t)&&r.add(t)}return[{modifiers:r,key:n===`Space`?` `:n.toLowerCase(),originalKey:n}]}function xn(e){return e.length===1&&!/[a-z]/i.test(e)}function Sn(e,t){if(t.key===`Unidentified`||t.key.toLowerCase()!==e.key)return!1;let n=xn(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 Cn=new WeakMap;function wn(e){let t=Cn.get(e);return t||(t=new vn(e),Cn.set(e,t)),t}function Tn(e,t){return wn(e).add(t)}function En(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;W(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 Dn(e){let{onOpenChange:t}=e,n=null,r=null,i=null,a=En({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;W(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 On(e){let{onActivate:t,isDisabled:n}=e;return{role:`button`,tabIndex:0,onClick(e){n()?e.preventDefault():t(e)},onPointerDown(e){n()&&e.preventDefault()},onMouseDown(e){n()&&e.preventDefault()},onKeyDown(e){e.target===e.currentTarget&&(n()?e.key!==`Tab`&&e.preventDefault():e.key===`Enter`?(e.preventDefault(),t(e)):e.key===` `&&e.preventDefault())},onKeyUp(e){e.target===e.currentTarget&&(n()||e.key===` `&&t(e))}}}var kn={transitionStarting:`data-starting-style`,transitionEnding:`data-ending-style`};function An(e){return{transitionStarting:e===`starting`,transitionEnding:e===`ending`}}function jn(e){let{onOpenChange:t,closeOnOutsideClick:n}=e,r=null,i=null,a=null,o=new Set,s=!1,c=null,l=En({transition:e.transition,closeOnEscape:e.closeOnEscape,onEscapeDismiss(e){e.preventDefault(),x(`escape`,e)},onDocumentActive(e){W(document,`pointerdown`,w,{capture:!0,signal:e})}}),u=l.input,d={close(e){x(e)}};function f(){a!==null&&(clearTimeout(a),a=null)}function p(){return globalThis.matchMedia?.(`(hover: hover)`)?.matches??!1}function m(){return p()?globalThis.matchMedia?.(`(pointer: fine)`)?.matches??!1:!1}function h(){return!e.openOnHover?.()||p()}function g(){s=!1,c!==null&&(clearTimeout(c),c=null)}function _(){s=!0,c!==null&&clearTimeout(c),c=setTimeout(g,500)}function v(){return s?(g(),!0):!1}function y(){return r?r.hasAttribute(`disabled`)?!0:r.getAttribute(`aria-disabled`)===`true`:!1}function b(n,r){let i=l.open();i&&(e.group?.()?.open(d),t(!0,r?{reason:n,event:r}:{reason:n}),i.then(()=>{!l.signal.aborted&&u.current.active&&e.onOpenChangeComplete?.(!0)}))}function x(n,r){let a=l.close(i);a&&(e.group?.()?.close(d),t(!1,r?{reason:n,event:r}:{reason:n}),a.then(()=>{l.signal.aborted||(Pt(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();r&&t.includes(r)||i&&t.includes(i)?_():(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;t&&(r?.contains(t)||i?.contains(t))||v()||(t===null?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`)})}):x(`blur`))}};function D(e){r=e}function O(e){!e&&i&&u.current.active&&Pt(i),i=e,e&&u.current.active&&Nt(e)}return{input:u,triggerProps:T,popupProps:E,get triggerElement(){return r},setTriggerElement:D,setPopupElement:O,open:S,close:C,destroy:l.destroy}}function Mn(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 Nn(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 Mn(n,r,Math.max(0,i-n),Math.max(0,a-r))}function Pn(e){let t=document.documentElement.getBoundingClientRect();return e?Nn(t,e.getBoundingClientRect()):t}function Fn(e,t={}){if(!e)return null;if(!Fe(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 In={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 Ln(e,t,n){return Math.max(t,Math.min(n,e))}function Rn(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 zn={sideOffset:0,alignOffset:0,boundaryOffset:0},Bn={top:`bottom`,bottom:`top`,left:`right`,right:`left`};function Vn(e){return`${Ln(e,0,1/0)}px`}function Hn(e,t,n,r){let i=n-r;return i<t?t:Ln(e,t,i)}function Un(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 Wn(e,t,n,r,i,a,o=In){if(Dt())return{...Gn(e,t,o,n,i,a),...n&&i?Kn(n,i,t,a,o):{}};if(n&&r){let e=a??zn;return{position:`fixed`,margin:`0`,...qn(n,r,t,e,i),...i?Kn(n,i,t,e,o):{}}}return{}}function Gn(e,t,n=In,r,i,a=zn){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=Bn[c];if(c===`top`||c===`bottom`){if(d[f]=`calc(anchor(${c}) + ${o})`,r&&i){let{base:e,translate:t}=Un(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}=Un(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 Kn(e,t,n,r=zn,i=In){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]=Vn(t-r.sideOffset),a[i.availableWidth]=Vn(l-c)}else{let t=o===`left`?e.left-c:l-e.right;a[i.availableWidth]=Vn(t-r.sideOffset),a[i.availableHeight]=Vn(d-u)}return a}function qn(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=Hn(d,i.left+e,i.right-e,t.width):l=Hn(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 Jn(e,t=In){let n=getComputedStyle(e);return{sideOffset:Ft(e,n.getPropertyValue(t.sideOffset)),alignOffset:Ft(e,n.getPropertyValue(t.alignOffset)),boundaryOffset:Ft(e,n.getPropertyValue(t.boundaryOffset))}}function Yn(e,t){let n=e.getBoundingClientRect(),r=e.offsetWidth||n.width,i=e.offsetHeight||n.height;return Mn(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 Xn(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)?Ln(i*100,0,100):0}function Zn(e){let t=me({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?It(t=>e.onValueChange?.(t),r,{leading:!0}):null;function d(t,n){n&&u?u(t):e.onValueChange?.(t)}function f(){if(be(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=Xn(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(!be(s)){if(n.pointerType!==`touch`&&n.buttons===0){p();return}let r=Xn(n,o,e.getOrientation(),a);c=r,t.patch({dragPercent:r,pointerPercent:r}),d(r,!0);return}let r=Xn(n,e.getElement().getBoundingClientRect(),e.getOrientation(),e.isRTL());t.patch({pointing:!0,pointerPercent:r})},onPointerUp(t){if(e.isDisabled()||(t.stopPropagation(),be(s)))return;let n=Xn(t,o,e.getOrientation(),a);u?.cancel(),e.onValueChange?.(n),e.onValueCommit?.(n),l=!0},onPointerLeave(){be(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=Rn(e.getPercent(),r,0),o=e.isRTL()?-1:1,s=n.shiftKey?i:r,c=null;switch(n.key){case`ArrowRight`:c=a+s*o;break;case`ArrowLeft`:c=a-s*o;break;case`ArrowUp`:c=a+s;break;case`ArrowDown`:c=a-s;break;case`PageUp`:c=a+i;break;case`PageDown`:c=a-i;break;case`Home`:c=0;break;case`End`:c=100}c!==null&&(n.preventDefault(),c=Ln(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 Qn={fill:`--media-slider-fill`,pointer:`--media-slider-pointer`,buffer:`--media-slider-buffer`};function $n(e){return{[Qn.fill]:`${e.fillPercent.toFixed(3)}%`,[Qn.pointer]:`${e.pointerPercent.toFixed(3)}%`}}function er(e){return{...$n(e),[Qn.buffer]:`${e.bufferPercent.toFixed(3)}%`}}function tr(e,t){let n=e/2;return{position:`absolute`,left:t===`visible`?`calc(var(${Qn.pointer}) - ${n}px)`:`min(max(0px, calc(var(${Qn.pointer}) - ${n}px)), calc(100% - ${e}px))`,width:`max-content`,pointerEvents:`none`}}var nr=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 rr(e){let{getContainer:t,getImg:n,onStateChange:r}=e,i=new nr,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){W(e,`load`,m,{signal:o}),W(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 ir={hover:`hover`,focus:`focus`,escape:`escape`,blur:`blur`,"imperative-action":`imperative-action`};function ar(e){let t={transition:e.transition,onOpenChange(t,n){let r=ir[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=jn(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){e.disabled?.()||(r?r=!1: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 or(){let e=me({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&&(cr(i),sr(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();lr(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 sr(e){e&&e.offsetHeight}function cr(e){let t=e?.getAnimations?.({subtree:!0})??[];for(let e of t)e.cancel()}function lr(e){if(!e)return Promise.resolve();let t=e.getAnimations?.()??[];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(ye,ye)}function ur(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=Ln(e.getPercent()-n*r,0,100);e.onValueChange?.(i)}}}function dr(e,t){if(!t)return!1;if(Ze(e.composedPath))return e.composedPath().includes(t);let n=e.target;return n instanceof Node&&t.contains(n)}function fr(e,t){let n={};for(let r in e){if(t&&!(r in t))continue;let i=t?.[r]??pr(r),a=e[r];a===!0?n[i]=``:a&&(n[i]=String(a))}return n}function pr(e){return`data-${e.toLowerCase()}`}function mr(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90}function hr(e,t){return mr(e)&&(typeof t==`function`||t===void 0)}function gr(e,t){return t?e?n=>{t(n),e(n)}:t:e}function _r(e,t){return t&&e?`${t} ${e}`:t||e}function vr(e,t){return t?e?{...e,...t}:t:e}function yr(e,t){if(!t)return e;for(let n in t){let r=t[n];n===`className`?e.className=_r(e.className,r):n===`style`?e.style=vr(e.style,r):e[n]=hr(n,r)?gr(e[n],r):r}return e}function br(...e){let t={};for(let n of e)t=yr(t,n);return t}M();function xr(e,t){return Ze(e)?e(t):e}function Sr(e,t){return Ze(e)?e(t):e}function Cr(e){let t=e;return t.ref??t.props?.ref}function J(e,t,n){let{className:r,style:i,render:a}=t,{state:o,ref:s,props:c,stateAttrMap:l}=n,u=xr(r,o),d=Sr(i,o),f=br(l?fr(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),Ze(a)){let e=ot(s,f.ref);return a({...f,ref:e},o)}if(ee(a)){let e=Cr(a),t=ot(s,f.ref,e),n=br(f,a.props);return n.ref=t,te(a,n)}return f.ref=ot(s,f.ref),z(e,f)}M();function wr(e){let{displayName:t,onActivate:n,isDisabled:r}=e,i=N(e=>{},[t]);return{getButtonProps:N(e=>br(On({onActivate:n,isDisabled:r}),e),[n,r]),buttonRef:i}}M();function Tr(e,t){let n=U(),[r,i]=R({});return F(()=>{if(!n||!e){i({});return}let r=wn(n),a=()=>i(r.getShortcut(e,t));return a(),r.subscribeShortcutChanges(a)},[n,e,t]),r}M(),P(null).Provider,P(null).Provider,P(null).Provider,P(null).Provider;var Er=P(!1);Er.Provider;function Dr(){return re(Er)}P(null).Provider,M();var Or=P(null),kr=Or.Provider;function Ar(){let e=re(Or);if(!e)throw Error(`Tooltip compound components must be used within a Tooltip.Root`);return e}function jr(){return re(Or)}M();function Mr(e,t){return e.getLabelParams?.(t)}function Nr(e){let{displayName:t,core:n,stateAttrMap:r,selector:i,action:a,hotkeyAction:o,hotkeyValue:s,tooltipLabel:c,isSupported:l}=e,u=new Set(Object.keys(n.defaultProps)),d=B(function(e,d){let{render:f,className:p,style:m,...h}=e,g={},_={};for(let e of Object.keys(h))u.has(e)?g[e]=h[e]:_[e]=h[e];let v=jr(),y=Dr(),b=v?.setContent,x=ge(i),S=Tr(o,s?.(g)),C=_e(),[w]=R(()=>new n);u.has(`menuTrigger`)&&De(g.menuTrigger)&&(g.menuTrigger=y),w.setProps(g);let{getButtonProps:T,buttonRef:E}=wr({displayName:t,onActivate:()=>{Promise.resolve(a(w,x)).catch(e=>{})},isDisabled:()=>!!g.disabled||!x});x&&w.setMedia(x);let D=x?w.getState():null,O=D?l?.(D)??!0:!1,k=D&&O?Tt(w.getLabel(D),C,Mr(w,D)):void 0,ee=D&&O?c?.(w,D)??k:void 0;if(ae(()=>{if(b)return b(ee?{label:ee,shortcut:S.shortcut}:void 0),()=>b(void 0)},[b,ee,S.shortcut]),!x||!D||!O)return null;let A=w.getAttrs(D),j=A[`aria-label`],te={...A,...wt(j)?{"aria-label":Tt(j,C,Mr(w,D))}:void 0,"aria-keyshortcuts":S.aria};return J(`button`,{render:f,className:p,style:m},{state:D,stateAttrMap:r,ref:[d,E],props:[T(),te,_]})});return d.displayName=t,d}function Pr(e,t){return Ze(e)?e(t)||void 0:e||void 0}var Fr=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,...An(e.status)}}getAttrs(e){return{role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":e.titleId,"aria-describedby":e.descriptionId}}},Ir={open:`data-open`,...kn},Lr=class e{static defaultProps={delay:500};state=me({visible:!1});#e={...e.defaultProps};#t=null;setProps(t){this.#e=K(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)}},Rr={visible:`data-visible`},zr=class{#e=null;setMedia(e){this.#e=e}getState(){let e=this.#e;return{visible:e.controlsVisible,userActive:e.userActive}}},Br={visible:`data-visible`,userActive:`data-user-active`},Vr=class extends Fr{setProps(){}},Hr=`common.`,Ur={key:`${Hr}empty`,text:``},Wr={key:`${Hr}ok`,text:`OK`},Gr=`errors.`,Kr={key:`${Gr}aborted`,text:`You stopped media playback before it finished.`},qr={key:`${Gr}network`,text:`This media could not be loaded due to a network or server issue.`},Jr={key:`${Gr}decode`,text:`This media could not be played. It may be corrupted, or your browser may not support its format.`},Yr={key:`${Gr}source`,text:`This media could not be loaded. It may be unavailable, or your browser may not support its format.`},Xr={key:`${Gr}encrypted`,text:`This media could not be played because it could not be decrypted.`},Zr={key:`${Gr}title`,text:`Something went wrong.`},Qr={key:`${Gr}unexpected`,text:`An unexpected error occurred.`},$r={[zt.MEDIA_ERR_ABORTED]:Kr,[zt.MEDIA_ERR_NETWORK]:qr,[zt.MEDIA_ERR_DECODE]:Jr,[zt.MEDIA_ERR_SRC_NOT_SUPPORTED]:Yr,[zt.MEDIA_ERR_ENCRYPTED]:Xr,[zt.MEDIA_ERR_CUSTOM]:Ur},ei={[zt.MEDIA_ERR_SRC_NOT_SUPPORTED]:[`Failed to open media`]};function ti(e){return e>=zt.MEDIA_ERR_ABORTED&&e<=zt.MEDIA_ERR_ENCRYPTED}function ni(){return Zr}function ri(){return Wr}function ii(e,t){if(e){let t=$r[e.code],n=e.message?.trim();if(n){let r=zt.defaultMessages[e.code];if(t&&r&&n===r)return t;let i=ei[e.code];return t&&ti(e.code)&&!e.context&&i?.includes(n)?t:n}if(t)return t}return t?.trim()||Qr}var ai=`fullscreen.`,oi={key:`${ai}enter`,text:`Enter fullscreen`},si={key:`${ai}exit`,text:`Exit fullscreen`},ci=class e{static defaultProps={label:``,disabled:!1};state=me({fullscreen:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){return Pr(this.#e.label,e)||(e.fullscreen?si:oi)}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:Ct(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()}},li={fullscreen:`data-fullscreen`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},ui={key:`playback.rate`,text:`Playback rate {rate}`},di=`volume.`,fi={key:`${di}mutedValue`,text:`{percent}, muted`},pi={key:`${di}label`,text:`Volume`},mi=Intl.DurationFormat,hi=new Map;function gi(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 _i(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function vi(e){let t=Array.isArray(e)?e[0]:e;return!t||t===`en`||t.startsWith(`en-`)}function yi(e,t=`long`,n){let r=`${_i(e)}:${t}:${n??``}`,i=hi.get(r);return i||(i=mi?new mi(e,n===void 0?{style:t}:{style:t,hoursDisplay:n}):gi(t,n),hi.set(r,i)),i}function bi(e){return Pe(e)&&Number.isFinite(e)}function xi(e,t){if(!bi(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=bi(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=yi(`en`,`digital`,u?`always`:`auto`).format(f);return d||(p=p.replace(/^0(?=\d:)/,``)),`${n?`-`:``}${p}`}function Si(e){if(!bi(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 Ci(e,t){if(!bi(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=yi(t?.locale,t?.style??`long`).format(s);if(n){let e=t?.formatRemaining;return e?e(c):vi(t?.locale)?`${c} remaining`:c}return c}var wi=`buttons.`,Ti={key:`${wi}play`,text:`Play`},Ei={key:`${wi}pause`,text:`Pause`},Di={key:`${wi}replay`,text:`Replay`},Oi={key:`${wi}mute`,text:`Mute`},ki={key:`${wi}unmute`,text:`Unmute`},Ai=class e{static defaultProps={label:``,disabled:!1};state=me({muted:!1,volumeLevel:`off`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){return Pr(this.#e.label,e)||(e.muted?ki:Oi)}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:ji(e)}),this.state.patch({label:Ct(this.getLabel(this.state.current))}),this.state.current}toggle(e){this.#e.disabled||e.toggleMuted()}};function ji(e){return e.muted||e.volume===0?`off`:e.volume<.5?`low`:e.volume<.75?`medium`:`high`}var Mi={muted:`data-muted`,volumeLevel:`data-volume-level`},Ni=`pip.`,Pi={key:`${Ni}enter`,text:`Enter picture-in-picture`},Fi={key:`${Ni}exit`,text:`Exit picture-in-picture`},Ii=class e{static defaultProps={label:``,disabled:!1};state=me({pip:!1,availability:`unavailable`,disabled:!0,hidden:!0,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){return Pr(this.#e.label,e)||(e.pip?Fi:Pi)}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:Ct(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()}},Li={pip:`data-pip`,availability:`data-availability`,disabled:`data-disabled`,hidden:`data-hidden`},Ri=class e{static defaultProps={label:``,disabled:!1};state=me({paused:!0,ended:!1,started:!1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){return Pr(this.#e.label,e)||(e.ended?Di:e.paused?Ti:Ei)}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:Ct(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()}}},zi={paused:`data-paused`,ended:`data-ended`,started:`data-started`},Bi=class e{static defaultProps={label:``,disabled:!1,menuTrigger:!1};state=me({rate:1,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){let t=Pr(this.#e.label,e);return t===void 0?ui:t}getLabelParams(e){if(Pr(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:Ct(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)}},Vi={rate:`data-rate`},Hi=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=K(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,...An(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}}},Ui={open:`data-open`,side:`data-side`,align:`data-align`,...kn},Wi=`seek.`,Gi={key:`${Wi}forward`,text:`Seek forward {seconds} seconds`},Ki={key:`${Wi}backward`,text:`Seek backward {seconds} seconds`},qi=class e{static defaultProps={seconds:30,label:``,disabled:!1};state=me({seeking:!1,direction:`forward`,label:``});#e={...e.defaultProps};#t=null;constructor(e){e&&this.setProps(e)}setProps(t){this.#e=K(t,e.defaultProps)}getLabel(e){let t=Pr(this.#e.label,e);return t===void 0?e.direction===`backward`?Ki:Gi:t}getLabelParams(e){if(Pr(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:Ct(this.getLabel(this.state.current))}),this.state.current}async seek(e){this.#e.disabled||await e.seek(e.currentTime+this.#e.seconds)}},Ji={seeking:`data-seeking`,direction:`data-direction`},Yi=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=K(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 Pr(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 Rn(Ln(t+e/100*(n-t),t,n),r,t)}rawValueFromPercent(e){let{min:t,max:n}=this.#e;return Ln(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)}},Xi={dragging:`data-dragging`,pointing:`data-pointing`,interactive:`data-interactive`,orientation:`data-orientation`,disabled:`data-disabled`},Zi={loading:`data-loading`,error:`data-error`,hidden:`data-hidden`};function Qi(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&&Pe(n)&&!Number.isNaN(n)&&(l[t]=n)}let u={url:a};return Pe(l.w)&&(u.width=l.w),Pe(l.h)&&(u.height=l.h),Pe(l.x)&&Pe(l.y)&&(u.coords={x:l.x,y:l.y}),u}function $i(e,t){let n=[];for(let r of e){let e=Qi(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 ea=`time.`,ta={key:`${ea}current`,text:`Current time`},na={key:`${ea}duration`,text:`Duration`},ra={key:`${ea}remaining`,text:`Remaining`},ia={key:`${ea}remainingSuffix`,text:`{duration} remaining`},aa={key:`${ea}showElapsed`,text:`{duration}. Show elapsed time.`},oa={key:`${ea}showDuration`,text:`{duration}. Show duration.`},sa={key:`${ea}showRemaining`,text:`{duration}. Show remaining time.`},ca={key:`${ea}position`,text:`{current} of {duration}`},la={current:aa,duration:oa,remaining:sa},ua={current:ta,duration:na,remaining:ra},da=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=K(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 xi(Math.abs(t),e.duration)}#i(){let{type:e}=this.#e,t=this.#n();return Ci(e===`remaining`?t<0?t:-Math.abs(t):t)}#a(){let e=this.#n();return Si(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=Pr(this.#e.label,e);return n===void 0?this.#e.toggle?la[this.#o(t,e.type)]:ua[this.#e.type]:n}getLabelParams(e){return Pr(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()}}},fa={type:`data-type`},pa={key:`slider.seek`,text:`Seek`},ma=class e extends Yi{static defaultProps={...Yi.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=K(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)||pa}#i(e){return e.dragging?this.rawValueFromPercent(e.pointerPercent):e.value}#a(e){return this.#n===void 0?Ci(e):Ci(e,{locale:this.#n})}getValueText(e){return Number.isFinite(e.duration)?ca: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)}}},ha={...Xi,seeking:`data-seeking`},ga=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=K(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,...An(e.status)}}getPopupAttrs(e){return{popover:`manual`,role:`presentation`}}},_a={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`},va={open:`data-open`,side:`data-side`,align:`data-align`,...kn},ya=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=K(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()}},ba=new Map;function xa(e){return e===void 0?``:Array.isArray(e)?e.join(`:`):e}function Sa(e){let t=xa(e),n=ba.get(t);if(!n)try{n=new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),ba.set(t,n)}catch{return}return n}function Ca(e){return`${Math.round(Math.min(1,Math.max(0,e))*100)}%`}function wa(e,t){let n=!Pe(e)||!Number.isFinite(e)?0:Math.min(1,Math.max(0,e));try{let e=Sa(t)??Sa(void 0);if(e)return e.format(n)}catch{}return Ca(n)}var Ta=class e extends Yi{static defaultProps={...Yi.defaultProps,label:``,wheelStep:5};#e=null;#t;constructor(e){super(),e&&this.setProps(e)}setProps(t){super.setProps(K(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)||pi}getValueText(e){return e.muted?fi:this.getValueTextParams(e).percent}getValueTextParams(e){return{percent:wa(e.value/100,this.#t)}}getAttrs(e){return{...super.getAttrs(e),"aria-valuetext":this.getValueText(e)}}},Ea={...Xi,availability:`data-availability`};M();var Da=P(null),Oa=Da.Provider;function ka(){let e=re(Da);if(!e)throw Error(`AlertDialog compound components must be used within an AlertDialog.Root`);return e}var Aa=Object.defineProperty,ja=(e,t)=>{let n={};for(var r in e)Aa(n,r,{get:e[r],enumerable:!0});return t||Aa(n,Symbol.toStringTag,{value:`Module`}),n};M();var Ma=B(function({render:e,className:t,style:n,disabled:r,...i},a){let{dialog:o,state:s}=ka(),c=N(()=>{r||o.close()},[o,r]);return J(`button`,{render:e,className:t,style:n},{state:s,ref:[a],props:[{type:`button`,disabled:r,onClick:c},i]})});M();function Na(e){let{displayName:t,tag:n,useContext:r,staticProps:i,getProps:a}=e,o=B(function(e,t){let{render:o,className:s,style:c,...l}=e,u=r(),d=a?.(u.state);return J(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 Pa=Na({displayName:`AlertDialogDescription`,tag:`p`,useContext:ka,getProps:e=>({id:e.descriptionId})});M();var Fa=B(function({render:e,className:t,style:n,...r},i){let{core:a,dialog:o,state:s,stateAttrMap:c}=ka(),l=fe(i,N(e=>{o.setElement(e)},[o]));return s.open?J(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:l,props:[{tabIndex:-1,...a.getAttrs(s)},r]}):null});M();var Ia=/[^a-zA-Z0-9_-]/g;function La(e){let t=ce().replace(Ia,``);return e?`${e}-${t}`:t}M();function Ra({open:e,defaultOpen:t=Fr.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,children:i}){let[a]=R(()=>new Fr),o=e!==void 0,s=G(n),c=G(r),[l]=R(()=>{let e=Dn({transition:or(),onOpenChange:e=>{s.current?.(e)},onOpenChangeComplete:e=>{c.current?.(e)}});return!o&&t&&e.open(),e}),u=La(`alert-dialog-title`),d=La(`alert-dialog-desc`);a.setTitleId(u),a.setDescriptionId(d),F(()=>{if(e===void 0)return;let{active:t}=l.input.current;e!==t&&(e?l.open():l.close())},[e,l]),Qe(l);let f=Lt(l.input);return a.setInput(f),k(Oa,{value:{core:a,dialog:l,state:a.getState(),stateAttrMap:Ir},children:i})}var za=Na({displayName:`AlertDialogTitle`,tag:`h2`,useContext:ka,getProps:e=>({id:e.titleId})}),Ba=ja({Close:()=>Ma,Description:()=>Pa,Popup:()=>Fa,Root:()=>Ra,Title:()=>za});M();var Va=B(function(e,t){let{render:n,className:r,style:i,delay:a,...o}=e,s=ge(Jt),[c]=R(()=>new Lr);Qe(c),c.setProps({delay:a}),s&&c.update(s);let l=A(e=>c.state.subscribe(e),()=>c.state.current,()=>c.state.current);return s?J(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:Rr,ref:[t],props:[o]}):null});M();var Ha=P(null),Ua=Ha.Provider;function Wa(){let e=re(Ha);if(!e)throw Error(`Controls compound components must be used within a Controls.Root`);return e}function Ga(){return re(Ha)}M();var Ka=B(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{state:s,stateAttrMap:c}=Wa(),l=o[`aria-label`]||o[`aria-labelledby`]?`group`:void 0;return J(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:c,ref:[t],props:[{role:l,children:a},o]})});M();var qa=B(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=ge(Wt),[c]=R(()=>new zr);if(!s)return null;c.setMedia(s);let l=c.getState();return k(Ua,{value:{state:l,stateAttrMap:Br},children:J(`div`,{render:n,className:r,style:i},{state:l,stateAttrMap:Br,ref:[t],props:[{children:a},o,{"data-interactive":``}]})})}),Ja=ja({Group:()=>Ka,Root:()=>qa});M();var Ya=P(null),Xa=Ya.Provider;function Za(){let e=re(Ya);if(!e)throw Error(`ErrorDialog compound components must be used within an ErrorDialog.Root`);return e}M();var Qa=B(function({render:e,className:t,style:n,disabled:r,children:i,...a},o){let s=_e(),{dialog:c,state:l,stateAttrMap:u}=ka(),d=N(()=>{r||c.close()},[c,r]),f=i??Tt(ri(),s);return J(`button`,{render:e,className:t,style:n},{state:l,stateAttrMap:u,ref:o,props:[{type:`button`,disabled:r,onClick:d,children:f},a]})});M();var $a=B(function({render:e,className:t,style:n,children:r,...i},a){let o=_e(),{state:s,stateAttrMap:c}=ka(),{lastError:l}=Za(),u=ii(l),d=r??Tt(u,o);return J(`p`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.descriptionId,children:d},i]})});M();function eo({children:e}){let[t]=R(()=>new Vr),n=ge(Gt),r=H(n?.error??null);n?.error&&(r.current=n.error);let i=G(n),[a]=R(()=>Dn({transition:or(),onOpenChange:e=>{e||i.current?.dismissError()}})),o=La(`error-dialog-title`),s=La(`error-dialog-desc`);t.setTitleId(o),t.setDescriptionId(s),F(()=>{let e=!!n?.error,{active:t}=a.input.current;e&&!t?a.open():!e&&t&&a.close()},[n?.error,a]),Qe(a);let c=Lt(a.input);t.setInput(c);let l=t.getState();return n?k(Xa,{value:{lastError:r.current},children:k(Oa,{value:{core:t,dialog:a,state:l,stateAttrMap:Ir},children:e})}):null}M();var to=B(function({render:e,className:t,style:n,children:r,...i},a){let o=_e(),{state:s,stateAttrMap:c}=ka(),l=r??Tt(ni(),o);return J(`h2`,{render:e,className:t,style:n},{state:s,stateAttrMap:c,ref:a,props:[{id:s.titleId,children:l},i]})}),no=ja({Close:()=>Qa,Description:()=>$a,Popup:()=>Fa,Root:()=>eo,Title:()=>to}),ro=Nr({displayName:`FullscreenButton`,core:ci,stateAttrMap:li,selector:Kt,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleFullscreen`,isSupported:e=>!e.hidden});M();function io({type:e,action:t,value:n,pointer:r,region:i,disabled:a}){let o=ge(),s=U();return F(()=>{if(!s||!e||!t||a)return;let c=tn(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`?cn(s,l,u):sn(s,l,u)},[s,o,e,t,n,r,i,a]),null}var ao=io;M();function oo(){let[,e]=de(e=>e+1,0);return e}M();function so(e){let t=G(e),n=H(null),r=H(null),i=oo(),[a]=R(()=>Zn({getElement:()=>n.current,getThumbElement:()=>r.current,getOrientation:()=>t.current.orientation??`horizontal`,isRTL:()=>n.current?Et(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?.()}));Qe(a);let o=Lt(a.input),s=e.computeState(o);return ae(()=>{s.thumbAlignment===`edge`&&n.current&&r.current&&i()},[s.thumbAlignment]),{state:s,cssVars:e.getCSSVars(a.adjustForAlignment(s)),rootRef:N(e=>{n.current=e},[]),thumbRef:N(e=>{r.current=e},[]),rootProps:a.rootProps,rootStyle:a.rootStyle,thumbProps:a.thumbProps}}M();function co({keys:e,action:t,value:n,disabled:r,target:i}){let a=ge(),o=U();return F(()=>{if(!o||!e||!t||r)return;let s=dn(t);if(s)return Tn(o,{keys:e,action:t,value:n,target:i,disabled:r,repeatable:!ln(t),onActivate:(e,t)=>{s({store:a,key:t,value:n})}})},[o,a,e,t,n,r,i]),null}var lo=co;M();function uo(e){let t=e.side,[n,r]=R({preferred:t,side:t}),i=e.open&&n.preferred===t?n.side:t,a=I(()=>i===t?e:{...e,side:i},[i,e,t]),o=N(e=>r(n=>n.preferred===t&&n.side===e?n:{preferred:t,side:e}),[t]);return F(()=>{e.open||o(t)},[e.open,t,o]),{state:a,preferredSide:t,setPositionedSide:o}}var fo=Nr({displayName:`MuteButton`,core:Ai,stateAttrMap:Mi,selector:Qt,action:(e,t)=>e.toggle(t),hotkeyAction:`toggleMuted`}),po=Nr({displayName:`PiPButton`,core:Ii,stateAttrMap:Li,selector:qt,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePictureInPicture`,isSupported:e=>!e.hidden}),mo=Nr({displayName:`PlayButton`,core:Ri,stateAttrMap:zi,selector:Jt,action:(e,t)=>e.toggle(t),hotkeyAction:`togglePaused`}),ho=Nr({displayName:`PlaybackRateButton`,core:Bi,stateAttrMap:Vi,selector:Yt,action:(e,t)=>e.cycle(t),hotkeyAction:`speedUp`});M();var go=P(null),_o=go.Provider;function vo(){let e=re(go);if(!e)throw Error(`Popover compound components must be used within a Popover.Root`);return e}var yo=Na({displayName:`PopoverArrow`,tag:`div`,useContext:vo,staticProps:{"aria-hidden":`true`}});M();var bo={position:`fixed`,inset:`auto`,margin:0},xo=B(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,preferredSide:c,setPositionedSide:l,stateAttrMap:u,anchorName:d,popupId:f,boundary:p,container:m}=vo(),h=H(null),g=fe(i,N(e=>{o.setPopupElement(e),e&&Dt()&&e.style.setProperty(`position-anchor`,`--${d}`)},[o,d]),h),_=I(()=>({side:c,align:s.align}),[c,s.align]),v=I(()=>{if(!Dt())return null;let{positionAnchor:e,...t}=Wn(d,_);return t},[d,_]),[y,b]=R(null);ae(()=>{if(!s.open){b(null);return}function e(){let e=o.triggerElement,t=h.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Fn(p,{container:m,root:r}),a=Yn(t,_.side),s=Pn(i),c=Jn(t),u=Mt(n,a,s,_,c),{positionAnchor:f,...g}=Wn(d,{..._,side:u},n,Dt()?void 0:a,s,c);b(g),l(u)}e();let t=o.triggerElement,n=h.current,r=n?Fn(p,{container:m,root:n.getRootNode()}):null,i=0;function a(t){t&&dr(t,h.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,d,_,o,p,m,l]);let x=y??v??bo;if(!s.open)return null;let{onFocusOut:S,...C}=o.popupProps;return J(`div`,{render:e,className:t,style:n},{state:s,stateAttrMap:u,ref:g,props:[{id:f,style:x,...a.getPopupAttrs(s)},{...C,onBlur:S},r]})});M();function So({open:e,defaultOpen:t=Hi.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,openOnHover:i=Hi.defaultProps.openOnHover,delay:a=Hi.defaultProps.delay,closeDelay:o=Hi.defaultProps.closeDelay,boundary:s=`container`,children:c,...l}){let u=Ce(),d=Ee(),f=Ga(),[p]=R(()=>new Hi(l));p.setProps(l);let m=!De(e),h=G(n),g=G(r),_=G(l.closeOnEscape),v=G(l.closeOnOutsideClick),y=G(i),b=G(a),x=G(o),S=G(d),[C]=R(()=>{let e=jn({transition:or(),onOpenChange:(e,t)=>{h.current?.(e,t)},onOpenChangeComplete:e=>{g.current?.(e)},closeOnEscape:()=>_.current??Hi.defaultProps.closeOnEscape,closeOnOutsideClick:()=>v.current??Hi.defaultProps.closeOnOutsideClick,openOnHover:()=>y.current,delay:()=>b.current,closeDelay:()=>x.current,group:()=>S.current});return!m&&t&&e.open(`click`),e}),w=La(),T=La(`popup`);F(()=>{if(De(e))return;let{active:t}=C.input.current;e!==t&&(e?C.open(`click`):C.close(`click`))},[e,C]),F(()=>{De(f?.state.visible)||f.state.visible||C.close(`imperative-action`)},[f?.state.visible,C]),Qe(C);let E=Lt(C.input);p.setInput(E);let{state:D,preferredSide:O,setPositionedSide:ee}=uo(p.getState());return k(_o,{value:{core:p,popover:C,state:D,preferredSide:O,setPositionedSide:ee,stateAttrMap:Ui,anchorName:w,popupId:T,boundary:s,container:u},children:c})}M();var Co=B(function({render:e,className:t,style:n,...r},i){let{core:a,popover:o,state:s,stateAttrMap:c,anchorName:l,popupId:u}=vo(),d=N(e=>{o.setTriggerElement(e),e&&Dt()&&e.style.setProperty(`anchor-name`,`--${l}`)},[o,l]),{onFocusIn:f,onFocusOut:p,...m}=o.triggerProps;return J(`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]})}),wo=ja({Arrow:()=>yo,Popup:()=>xo,Root:()=>So,Trigger:()=>Co}),To=Nr({displayName:`SeekButton`,core:qi,stateAttrMap:Ji,selector:Zt,action:(e,t)=>e.seek(t),hotkeyAction:`seekStep`,hotkeyValue:e=>typeof e.seconds==`number`?e.seconds:qi.defaultProps.seconds});M();var Eo=B(function(e,t){let{render:n,className:r,style:i,time:a=0,thumbnails:o,crossOrigin:s,loading:c,fetchPriority:l,...u}=e,[d]=R(()=>new nr),f=H(null),p=H(null),m=we(Xt),[,h]=R(0),[g]=R(()=>rr({getContainer:()=>f.current,getImg:()=>p.current,onStateChange:()=>h(e=>e+1)}));Qe(g,()=>g.connect());let _=I(()=>o&&o.length>0?o:m&&m.thumbnailCues.length>0?$i(m.thumbnailCues,m.thumbnailTrackSrc??void 0):[],[o,m]),v=I(()=>d.findActiveThumbnail(_,a),[d,_,a]);g.updateSrc(v?.url);let y=d.getState(g.loading,g.error,v),b={overflow:`hidden`},x;if(v&&g.naturalWidth&&g.naturalHeight){let e=g.readConstraints(),t=d.resize(v,g.naturalWidth,g.naturalHeight,e);t&&(b={overflow:`hidden`,width:t.containerWidth,height:t.containerHeight},x={width:t.imageWidth,height:t.imageHeight,maxWidth:`none`,transform:t.offsetX||t.offsetY?`translate(-${t.offsetX}px, -${t.offsetY}px)`:void 0})}return J(`div`,{render:n,className:r,style:i},{state:y,stateAttrMap:Zi,ref:[t,f],props:[d.getAttrs(y),{style:b},u,{children:k(`img`,{ref:p,alt:``,"aria-hidden":`true`,decoding:`async`,src:v?.url,crossOrigin:s===``||s===null?void 0:s,loading:c,style:x,fetchPriority:l})}]})});M();var Do=P(null);function Oo({value:e,children:t}){return k(Do.Provider,{value:e,children:t})}function ko(){let e=re(Do);if(!e)throw Error(`Slider compound components must be used within a Slider.Root`);return e}var Ao=Na({displayName:`SliderBuffer`,tag:`div`,useContext:ko}),jo=Na({displayName:`SliderFill`,tag:`div`,useContext:ko});M();var Mo=B(function(e,t){let{render:n,className:r,style:i,overflow:a=`clamp`,...o}=e,s=ko(),{state:c}=s,l=H(null),[u,d]=R(0);F(()=>{let e=l.current;if(!e)return;let t=new ResizeObserver(([e])=>{d(e.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]);let f=tr(u,a);return J(`div`,{render:n,className:r,style:i},{state:c,stateAttrMap:s.stateAttrMap,ref:[t,l],props:[{style:f},o]})});M();var No=B(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]=R(()=>new Yi),b=_e();y.setProps({label:a,min:o,max:s,step:c,largeStep:l,orientation:u,disabled:d,thumbAlignment:f});let{state:x,cssVars:S,rootRef:C,thumbRef:w,rootProps:T,rootStyle:E,thumbProps:D}=so({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:$n,onValueChange:e=>m?.(y.valueFromPercent(e)),onValueCommit:e=>h?.(y.valueFromPercent(e)),onDragStart:g,onDragEnd:_});return k(Oo,{value:{state:x,pointerValue:y.valueFromPercent(x.pointerPercent),thumbRef:w,thumbProps:D,stateAttrMap:Xi,getAttrs:e=>{let t=y.getAttrs(e);return{...t,"aria-label":Tt(t[`aria-label`],b)}},formatValue:void 0},children:J(`div`,{render:n,className:r,style:i},{state:x,stateAttrMap:Xi,ref:[t,C],props:[{style:{...S,...E}},T,v]})})});M();var Po=B(function(e,t){let{render:n,className:r,style:i,...a}=e,o=ko(),{state:s,thumbRef:c,thumbProps:l,getAttrs:u}=o,d=u(s);return J(`div`,{render:n,className:r,style:i},{state:s,stateAttrMap:o.stateAttrMap,ref:[t,c],props:[d,l,a]})});M();var Fo=B(function(e,t){let{pointerValue:n}=ko();return k(Eo,{ref:t,...e,time:n})}),Io=Na({displayName:`SliderTrack`,tag:`div`,useContext:ko});M();var Lo=B(function(e,t){let{render:n,className:r,style:i,type:a=`current`,format:o,...s}=e,c=ko(),{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 J(`output`,{render:n,className:r,style:i},{state:l,stateAttrMap:c.stateAttrMap,ref:t,props:[{"aria-live":`off`,children:p},s]})}),Ro=ja({Buffer:()=>Ao,Fill:()=>jo,Preview:()=>Mo,Root:()=>No,Thumb:()=>Po,Thumbnail:()=>Fo,Track:()=>Io,Value:()=>Lo});M();var zo=B(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return J(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{children:a},o]})});M();var Bo=B(function(e,t){let{render:n,className:r,style:i,children:a=`/`,...o}=e;return J(`span`,{render:n,className:r,style:i},{state:{},ref:[t],props:[{"aria-hidden":`true`,children:a},o]})});M(),se();var Vo=B(function(e,t){let{render:n,className:r,style:i,type:a,negativeSign:o,label:s,toggle:c=!1,...l}=e,u=ge(Zt),d=_e(),f=Me(),[p]=R(()=>new da),m=a??da.defaultProps.type,[h,g]=R(m);if(F(()=>{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`?Tt(ia,d,{duration:Ci(Math.abs(_.seconds),{locale:f})}):Ci(Math.abs(_.seconds),{locale:f})}:void 0,b=_.negative?k(oe,{children:[k(`span`,{"aria-hidden":`true`,children:o??da.defaultProps.negativeSign}),_.text]}):_.text,x=()=>{g(e=>m===`current`?e===`remaining`?`current`:`remaining`:e===`duration`?`remaining`:`duration`)},S=e=>{e.defaultPrevented||x()},C=e=>{!e.defaultPrevented&&je(e.nativeEvent)&&(e.preventDefault(),!e.repeat&&x())};return J(`time`,{render:n,className:r,style:i},{state:_,stateAttrMap:fa,ref:[t],props:[{dateTime:_.datetime,children:b,...v,"aria-label":Tt(v[`aria-label`],d,y),...c?{onClick:S,onKeyDown:C}:void 0},l]})}),Ho=ja({Group:()=>zo,Separator:()=>Bo,Value:()=>Vo});M();var Uo=()=>Promise.resolve(0),Wo=B(function(e,t){let{render:n,className:r,style:i,label:a,changeThrottle:o=ma.defaultProps.changeThrottle,step:s=ma.defaultProps.step,largeStep:c=ma.defaultProps.largeStep,orientation:l,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,pauseOnDrag:m,...h}=e,g=ge(Zt),_=ge(Ut),v=ge(Jt),y=_e(),b=Me(),[x]=R(()=>new ma);x.setProps({label:a,step:s,largeStep:c,orientation:l,disabled:u,thumbAlignment:d,pauseOnDrag:m,changeThrottle:o}),x.setFormatLocale(b);let S=G(g&&_?{...g,..._}:null),C=G(v);F(()=>()=>x.endDrag(C.current),[x]);let w=g?.duration??0,{state:T,cssVars:E,rootRef:D,thumbRef:O,rootProps:ee,rootStyle:A,thumbProps:j}=so({computeState:e=>(x.setInput(e),!g||!_?x.setMedia({currentTime:0,duration:0,seeking:!1,seek:Uo,buffered:[],seekable:[]}):x.setMedia({...g,..._}),x.getState()),getPercent:()=>w>0?(g?.currentTime??0)/w*100:0,getStepPercent:()=>x.getStepPercent(),getLargeStepPercent:()=>x.getLargeStepPercent(),orientation:l,disabled:u,changeThrottle:o,adjustPercent:(e,t,n)=>x.adjustPercentForAlignment(e,t,n),getCSSVars:er,onValueCommit:e=>{let t=S.current;t&&t.seek(x.rawValueFromPercent(e))},onDragStart:()=>{x.startDrag(C.current),f?.()},onDragEnd:()=>{x.endDrag(C.current),p?.()}});return g?k(Oo,{value:{state:T,pointerValue:x.valueFromPercent(T.pointerPercent),thumbRef:O,thumbProps:j,stateAttrMap:ha,getAttrs:e=>{let t=x.getAttrs(e);return{...t,"aria-label":Tt(t[`aria-label`],y),"aria-valuetext":Tt(t[`aria-valuetext`],y,x.getValueTextParams(e))}},formatValue:e=>xi(e,w)},children:J(`div`,{render:n,className:r,style:i},{state:T,stateAttrMap:ha,ref:[t,D],props:[{style:{...E,...A}},ee,h]})}):null}),Go=ja({Buffer:()=>Ao,Fill:()=>jo,Preview:()=>Mo,Root:()=>Wo,Thumb:()=>Po,Track:()=>Io,Value:()=>Lo}),Ko=Na({displayName:`TooltipArrow`,tag:`div`,useContext:Ar,staticProps:{"aria-hidden":`true`}});M();var qo=B(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Ar(),l=r===void 0?c?.label??``:r;return J(`span`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]})});M();var Jo=B(function({render:e,className:t,style:n,children:r,...i},a){let{state:o,stateAttrMap:s,content:c}=Ar(),l=r??c?.shortcut??null;return l?J(`kbd`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:a,props:[i,{children:l}]}):null});M(),se();var Yo={position:`fixed`,inset:`auto`,margin:0},Xo=B(function({render:e,className:t,style:n,children:r,...i},a){let{core:o,tooltip:s,state:c,preferredSide:l,setPositionedSide:u,stateAttrMap:d,anchorName:f,popupId:p,boundary:m,container:h}=Ar(),g=H(null),_=fe(a,N(e=>{s.setPopupElement(e),e&&Dt()&&e.style.setProperty(`position-anchor`,`--${f}`)},[s,f]),g),v=I(()=>({side:l,align:c.align}),[l,c.align]),y=I(()=>{if(!Dt())return null;let{positionAnchor:e,...t}=Wn(f,v,void 0,void 0,void 0,void 0,_a);return t},[f,v]),[b,x]=R(null);ae(()=>{if(!c.open){x(null);return}function e(){let e=s.triggerElement,t=g.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=t.getRootNode(),i=Fn(m,{container:h,root:r}),a=Yn(t,v.side),o=Pn(i),c=Jn(t,_a),l=Mt(n,a,o,v,c),{positionAnchor:d,...p}=Wn(f,{...v,side:l},n,Dt()?void 0:a,o,c,_a);x(p),u(l)}e();let t=s.triggerElement,n=g.current,r=n?Fn(m,{container:h,root:n.getRootNode()}):null,i=0;function a(t){t&&dr(t,g.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,f,v,s,m,h,u]);let S=b??y??Yo;if(!c.open)return null;let C=r===void 0?k(oe,{children:[k(qo,{}),k(Jo,{})]}):r,{onFocusOut:w,...T}=s.popupProps;return J(`div`,{render:e,className:t,style:n},{state:c,stateAttrMap:d,ref:_,props:[{id:p,style:S,...o.getPopupAttrs(c)},{children:C},{...T,onBlur:w},i]})});M();var Zo=P(null),Qo=Zo.Provider;function $o(){return re(Zo)?.group}M();function es({delay:e,closeDelay:t,timeout:n,children:r}){let[i]=R(()=>new ya({delay:e,closeDelay:t,timeout:n}));return i.setProps({delay:e,closeDelay:t,timeout:n}),k(Qo,{value:{group:i},children:r})}M();function ts({open:e,defaultOpen:t=ga.defaultProps.defaultOpen,onOpenChange:n,onOpenChangeComplete:r,delay:i=ga.defaultProps.delay,closeDelay:a=ga.defaultProps.closeDelay,disableHoverablePopup:o=ga.defaultProps.disableHoverablePopup,disabled:s=ga.defaultProps.disabled,boundary:c=`container`,children:l,...u}){let d=Ce(),f=Ga(),[p]=R(()=>new ga(u));p.setProps(u);let m=!De(e),h=$o(),g=G(n),_=G(r),v=G(i),y=G(a),b=G(o),x=G(s),S=G(h),[C]=R(()=>{let e=ar({transition:or(),onOpenChange:(e,t)=>{g.current?.(e,t)},onOpenChangeComplete:e=>{_.current?.(e)},delay:()=>v.current,closeDelay:()=>y.current,disableHoverablePopup:()=>b.current,disabled:()=>x.current,group:()=>S.current});return!m&&t&&e.open(),e}),[w,T]=R(),E=La(),D=La(`tooltip`);F(()=>{if(De(e))return;let{active:t}=C.input.current;e!==t&&(e?C.open():C.close())},[e,C]),F(()=>{De(f?.state.visible)||f.state.visible||C.close(`imperative-action`)},[f?.state.visible,C]),Qe(C);let O=Lt(C.input);p.setInput(O);let{state:ee,preferredSide:A,setPositionedSide:j}=uo(p.getState());return k(kr,{value:{core:p,tooltip:C,state:ee,preferredSide:A,setPositionedSide:j,stateAttrMap:va,anchorName:E,popupId:D,content:w,setContent:T,boundary:c,container:d},children:l})}M();var ns=B(function({render:e,className:t,style:n,...r},i){let{tooltip:a,state:o,stateAttrMap:s,anchorName:c}=Ar(),l=N(e=>{a.setTriggerElement(e),e&&Dt()&&e.style.setProperty(`anchor-name`,`--${c}`)},[a,c]),{onFocusIn:u,onFocusOut:d,...f}=a.triggerProps;return J(`button`,{render:e,className:t,style:n},{state:o,stateAttrMap:s,ref:[i,l],props:[{type:`button`},{...f,onFocus:u,onBlur:d},r]})}),rs=ja({Arrow:()=>Ko,Label:()=>qo,Popup:()=>Xo,Provider:()=>es,Root:()=>ts,Shortcut:()=>Jo,Trigger:()=>ns});M();var is={volume:0,muted:!1,volumeAvailability:`unsupported`,setVolume:()=>0,toggleMuted:()=>!1},as=B(function(e,t){let{render:n,className:r,style:i,label:a,orientation:o,step:s=Ta.defaultProps.step,largeStep:c=Ta.defaultProps.largeStep,wheelStep:l=Ta.defaultProps.wheelStep,disabled:u,thumbAlignment:d,onDragStart:f,onDragEnd:p,...m}=e,h=ge(Qt),g=_e(),_=Me(),[v]=R(()=>new Ta);v.setProps({label:a,orientation:o,step:s,largeStep:c,wheelStep:l,disabled:u,thumbAlignment:d}),v.setFormatLocale(_);let y=G(h),b=G(u),x=()=>(y.current?.volume??0)*100,S=()=>v.getStepPercent(),C=e=>y.current?.setVolume(e/100),{state:w,cssVars:T,rootRef:E,thumbRef:D,rootProps:O,rootStyle:ee,thumbProps:A}=so({computeState:e=>(v.setInput(e),v.setMedia(h??is),v.getState()),getPercent:x,getStepPercent:S,getLargeStepPercent:()=>v.getLargeStepPercent(),orientation:o,disabled:u,adjustPercent:(e,t,n)=>v.adjustPercentForAlignment(e,t,n),getCSSVars:$n,onValueChange:C,onValueCommit:C,onDragStart:f,onDragEnd:p}),[j]=R(()=>ur({isDisabled:()=>!!b.current||!y.current,getPercent:()=>(y.current?.volume??0)*100,getStepPercent:()=>v.getWheelStepPercent(),onValueChange:e=>y.current?.setVolume(e/100)})),te=H(null),M=N(e=>{te.current?.(),te.current=null,e&&(te.current=W(e,`wheel`,j.onWheel,{passive:!1}))},[j]);return h?k(Oo,{value:{state:w,pointerValue:v.valueFromPercent(w.pointerPercent),thumbRef:D,thumbProps:A,stateAttrMap:Ea,getAttrs:e=>{let t=v.getAttrs(e);return{...t,"aria-label":Tt(t[`aria-label`],g),"aria-valuetext":Tt(t[`aria-valuetext`],g,v.getValueTextParams(e))}},formatValue:e=>`${Math.round(e)}%`},children:J(`div`,{render:n,className:r,style:i},{state:w,stateAttrMap:Ea,ref:[t,E,M],props:[{style:{...T,...ee}},O,m]})}):null}),os=ja({Fill:()=>jo,Preview:()=>Mo,Root:()=>as,Thumb:()=>Po,Track:()=>Io,Value:()=>Lo});ue();var ss=({title:e,remote:t,children:n})=>{let r=I(()=>t?le(t):null,[t]);return F(()=>r?.hold(),[r]),F(()=>r?st(r.served(r.media)):void 0,[r]),L(et,{media:r?.media??null,title:e,children:n})},cs=({play:e,signIn:t,rent:n})=>/^\/(ap\/signin|ax\/claim)\b|\/auth-redirect\b/.test(location.pathname)?`signed-out`:document.querySelector(e)?`play`:document.querySelector(t)?`signed-out`:document.querySelector(n)?`rent`:`pending`,ls=({play:e})=>{let t=document.querySelector(e);if(!t)throw Object.assign(Error(`Prime Video Play is not on the page`),{name:`PrimeControlMissingError`});t.click()},us=({videos:e})=>[...document.querySelectorAll(e)].findIndex(e=>e.readyState>0);ue();var ds={play:`[data-testid="dp-atf-play-button"]`,signIn:l,rent:`[data-automation-id^="ab-"][data-automation-id*="tvod"]`},fs=`#dv-web-player video`,ps=`
2
+ html, body {
3
+ margin: 0 !important;
4
+ padding: 0 !important;
5
+ width: 100% !important;
6
+ height: 100% !important;
7
+ overflow: hidden !important;
8
+ background: #000 !important;
9
+ }
10
+ *:not(:has(#dv-web-player)):not(#dv-web-player):not(#dv-web-player *) {
11
+ display: none !important;
12
+ }
13
+ #dv-web-player {
14
+ position: fixed !important;
15
+ inset: 0 !important;
16
+ width: 100% !important;
17
+ height: 100% !important;
18
+ z-index: 9999999 !important;
19
+ }
20
+ #dv-web-player :has(video),
21
+ #dv-web-player video {
22
+ position: absolute !important;
23
+ inset: 0 !important;
24
+ width: 100% !important;
25
+ height: 100% !important;
26
+ transform: none !important;
27
+ }
28
+ #dv-web-player video {
29
+ object-fit: contain !important;
30
+ }
31
+ #dv-web-player *:not(:has(video)):not(video) {
32
+ opacity: 0 !important;
33
+ pointer-events: none !important;
34
+ }
35
+ `,ms=3e4,hs=3e4,gs=e=>{let t=new URL(e);return t.pathname===`/watch`&&(t.pathname=`/detail`),t.href},_s=async(e,t,n)=>{let r=Date.now()+n;for(;!t()&&Date.now()<r;){try{let t=await e();if(t!==void 0)return t}catch(e){if(e?.name===`LocatorUnsupportedError`)throw e}await new Promise(e=>setTimeout(e,200))}},vs=j`
36
+ to { transform: rotate(360deg); }
37
+ `,ys=O`
38
+ position: relative;
39
+ width: 100%;
40
+ height: 100%;
41
+ background: #000;
42
+ user-select: none;
43
+ -webkit-user-select: none;
44
+
45
+ .pv-frame {
46
+ position: absolute;
47
+ inset: 0;
48
+ width: 100%;
49
+ height: 100%;
50
+ border: none;
51
+ background: #000;
52
+ /* taps belong to the player's controls stacked above it */
53
+ pointer-events: none;
54
+ }
55
+
56
+ .overlay {
57
+ position: absolute;
58
+ inset: 0;
59
+ display: flex;
60
+ flex-direction: column;
61
+ align-items: center;
62
+ justify-content: center;
63
+ gap: 1.6rem;
64
+ background: #000;
65
+ font-size: 1.4rem;
66
+ color: rgba(255, 255, 255, 0.8);
67
+ z-index: 30;
68
+ }
69
+
70
+ .login-button {
71
+ padding: 0.8rem 2rem;
72
+ background: #00a8e1;
73
+ color: #fff;
74
+ border: none;
75
+ border-radius: 0.4rem;
76
+ font-size: 1.4rem;
77
+ font-weight: 600;
78
+ text-decoration: none;
79
+ cursor: pointer;
80
+
81
+ &:hover {
82
+ background: #0090c2;
83
+ }
84
+
85
+ &:disabled {
86
+ opacity: 0.6;
87
+ cursor: default;
88
+ }
89
+ }
90
+
91
+ .loading-spinner {
92
+ box-sizing: border-box;
93
+ width: calc(4 * var(--mp-unit, 10px));
94
+ height: calc(4 * var(--mp-unit, 10px));
95
+ border-radius: 50%;
96
+ border: 3px solid rgba(255, 255, 255, 0.25);
97
+ border-top-color: #fff;
98
+ animation: ${vs} 0.8s linear infinite;
99
+ }
100
+ `,bs=({url:e,title:a})=>{let s=t(e),[c,l]=R(`detecting`),[u,d]=R(null),[p,g]=R(null),[_,v]=R(!0),[y,b]=R(!1),[x,S]=R(!1),[C,T]=R(),[E,O]=R(null),[k,ee]=R(0),[A,j]=R(0),[te,M]=R(!1),[re,ie]=R(!1),ae=H(void 0),P=H(!0);F(()=>()=>{P.current=!1,clearInterval(ae.current)},[]),F(()=>{let e=!1;return h().then(t=>{e||l(t)}),()=>{e=!0}},[]),F(()=>{if(!u||c===`detecting`)return;let e=!1;return m({iframe:u,domains:[...r].sort((e,t)=>Number(t===s)-Number(e===s)),cookies:f(c),permissions:[{category:`evaluation`,reason:`Press Play on the episode and see whether you are signed in`}]}).then(t=>{e||g(t)}).catch(t=>{e||(console.error(`Failed to attach Prime Video frame`,t),T(t?.message||`Failed to load player`),v(!1))}),()=>{e=!0}},[u,c,s]),F(()=>{if(!p)return;let t=!1,r=()=>t;return v(!0),T(void 0),b(!1),S(!1),O(null),(async()=>{await p.goto(gs(e),{waitUntil:`commit`});let i=await _s(async()=>{let e=await p.evaluate(cs,ds);return e===`pending`?void 0:e},r,ms);if(t)return;if(i&&w.record(`prime`,i===`signed-out`?`signed-out`:`signed-in`),i===`signed-out`){v(!1),b(!0);return}if(i===`rent`){v(!1),S(!0),n();return}if(!i)throw Error(`Prime Video shows no Play button for this episode.`);await p.evaluate(ls,ds);let a=await _s(async()=>{let e=await p.evaluate(us,{videos:fs});return e<0?void 0:p.locator(fs).nth(e).videoElement()},r,hs);if(!t){if(!a)throw Error(`The episode did not load a player.`);await p.addStyleTag({content:ps}),!t&&(v(!1),O(a))}})().catch(e=>{t||(console.error(`Failed to load Prime Video player`,e),T(e?.message||`Failed to load player`),v(!1))}),()=>{t=!0}},[p,e,k]);let oe=N(()=>{g(null),T(void 0),O(null),b(!1),S(!1),ie(!1),v(!0),j(e=>e+1)},[]),I=N(()=>{ie(!1);let e=o(s);if(c===`extension`){let t=globalThis.open(e,`_blank`,`width=500,height=700`);if(!t)return ie(!0);M(!0),clearInterval(ae.current),ae.current=setInterval(()=>{t.closed&&(clearInterval(ae.current),M(!1),ee(e=>e+1))},500);return}let t=D({url:e,domains:r,isSignedIn:i});M(!0),t.then(e=>{if(P.current){if(e===`blocked`)return ie(!0);if(e===`unsupported`)return T(`The Prime Video sign-in window could not open here.`);if(e===`authed`)return oe();ee(e=>e+1)}},e=>{P.current&&(console.error(`Prime Video sign-in window failed`,e),T(e?.message||`The sign-in window failed`))}).finally(()=>{P.current&&M(!1)})},[c,oe,s]),se=L(`a`,{className:`login-button`,href:gs(e),target:`_blank`,rel:`noreferrer`,children:`Open on Prime Video`}),ce=(_||C||y||x)&&L(`div`,{className:`overlay`,children:C?V(ne,{children:[C,L(`button`,{className:`login-button`,onClick:oe,children:`Retry`}),se]}):y?V(ne,{children:[re?`Allow popups for this page to sign in.`:`Sign in to Prime Video to watch.`,L(`button`,{className:`login-button`,onClick:I,disabled:te,children:te?`Finish signing in the window...`:`Sign in to Prime Video`})]}):x?V(ne,{children:[`Prime Video offers this episode only to rent or buy here.`,se]}):L(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})});return V(`div`,{css:ys,children:[c!==`detecting`&&L(ss,{title:a,remote:E,children:L(`iframe`,{ref:d,className:`pv-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${c}-${A}`)}),ce]})},xs=({menu:e,section:t,option:n,sectionIndex:r})=>[...[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)??[]].map(e=>({label:e.getAttribute(`aria-label`)??``,selected:e.getAttribute(`aria-checked`)===`true`,disabled:e.getAttribute(`aria-disabled`)===`true`})),Ss=async({button:e,timeout:t})=>{let n=Date.now()+t,r=document.querySelector(e);for(;!r&&Date.now()<n;)await new Promise(e=>setTimeout(e,100)),r=document.querySelector(e);if(!r)throw Object.assign(Error(`Crunchyroll button is not on the page: ${e}`),{name:`CrunchyrollControlMissingError`});let i=r.getBoundingClientRect(),a={bubbles:!0,cancelable:!0,composed:!0,clientX:i.left+i.width/2,clientY:i.top+i.height/2,button:0},o={...a,pointerType:`mouse`,pointerId:1,isPrimary:!0};r.dispatchEvent(new PointerEvent(`pointerdown`,{...o,buttons:1})),r.dispatchEvent(new MouseEvent(`mousedown`,{...a,buttons:1})),r.dispatchEvent(new PointerEvent(`pointerup`,{...o,buttons:0})),r.dispatchEvent(new MouseEvent(`mouseup`,{...a,buttons:0})),r.dispatchEvent(new MouseEvent(`click`,{...a,buttons:0}))},Cs=({menu:e,section:t,option:n,sectionIndex:r,optionIndex:i})=>{let a=[...document.querySelectorAll(e)].flatMap(e=>[...e.querySelectorAll(t)])[r]?.querySelectorAll(n)[i];if(!a)throw Object.assign(Error(`Crunchyroll option ${i} is not in the menu: ${e}`),{name:`CrunchyrollControlMissingError`});let o=a.getBoundingClientRect(),s={bubbles:!0,cancelable:!0,composed:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2,button:0},c={...s,pointerType:`mouse`,pointerId:1,isPrimary:!0};a.dispatchEvent(new PointerEvent(`pointerdown`,{...c,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...s,buttons:1})),a.dispatchEvent(new PointerEvent(`pointerup`,{...c,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0})),a.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0}))},ws=async({timeline:e,time:t,timeout:n})=>{let r=Date.now()+n,i=document.querySelector(e);for(;!i&&Date.now()<r;)await new Promise(e=>setTimeout(e,100)),i=document.querySelector(e);if(i?.tagName!==`INPUT`)throw Object.assign(Error(`Crunchyroll timeline is not on the page`),{name:`CrunchyrollControlMissingError`});let a=i,o=Number(a.min||0),s=Number(a.max||100),c=a.getBoundingClientRect(),l=Math.max(0,Math.min(1,(t-o)/(s-o))),u={bubbles:!0,cancelable:!0,composed:!0,clientX:c.left+c.width*l,clientY:c.top+c.height/2,button:0},d={...u,pointerType:`mouse`,pointerId:1,isPrimary:!0},f=a.type===`range`&&Number.isFinite(o)&&Number.isFinite(s)&&s>o;f&&(a.dispatchEvent(new PointerEvent(`pointerdown`,{...d,buttons:1})),a.dispatchEvent(new MouseEvent(`mousedown`,{...u,buttons:1}))),a._valueTracker?.setValue(``),Object.getOwnPropertyDescriptor(Object.getPrototypeOf(a),`value`).set.call(a,String(t)),a.dispatchEvent(new Event(`input`,{bubbles:!0})),f&&(a.dispatchEvent(new PointerEvent(`pointerup`,{...d,buttons:0})),a.dispatchEvent(new MouseEvent(`mouseup`,{...u,buttons:0}))),a.dispatchEvent(new Event(`change`,{bubbles:!0}))},Ts=`stub:pictureinpicturerefused`,Es=({video:e})=>{let t=document.querySelector(e);if(!document.pictureInPictureEnabled||typeof t?.requestPictureInPicture!=`function`)return!1;let n=(e,t)=>e.dispatchEvent(new CustomEvent(`stub:pictureinpicturerefused`,{detail:`${t.name}: ${t.message}`})),r=t=>{if(!t.isTrusted||(t.stopImmediatePropagation(),t.type!==`click`))return;t.preventDefault();let r=document.querySelector(e);r&&(r.disablePictureInPicture=!1,r.requestPictureInPicture().catch(e=>n(r,e)))};for(let e of[`pointerdown`,`mousedown`,`pointerup`,`mouseup`,`click`,`dblclick`])window.addEventListener(e,r,!0);return!0},Ds=`[data-testid="track-selection-button"]`,Os=`[data-testid="audio-text-track-menu"]`,ks=`[data-testid="player-settings-menu-button"]`,As=`.timeline-slider`,js=`[role="menu"]`,Ms=`[role="menuitemradio"]`,Ns=1e4,Ps=2e3,Fs=2e4,Is=5e3,Ls=100,Rs=/^(off|none|disabled)$/i,zs={button:Ds,open:Os,menu:Os,section:js,option:Ms,timeout:Ns},Bs={button:ks,open:`${ks}[aria-expanded="true"]`,menu:`:has(> ${ks}) + [role="menu"]`,section:`${js}:has(${Ms})`,option:Ms,timeout:Ps},Vs={audio:{...zs,sectionIndex:0},subtitles:{...zs,sectionIndex:1},quality:{...Bs,sectionIndex:0}},Hs=e=>new Promise(t=>setTimeout(t,e)),Us=()=>!1,Y=e=>{if(e())throw Error(`Crunchyroll track operation cancelled`)},Ws=e=>e.replace(/\s+/g,` `).trim(),Gs=(e,t)=>{let n=[...new Map(t.map(e=>({...e,label:Ws(e.label)})).filter(e=>e.label).map(e=>[e.id,e])).values()],r=n.find(e=>e.selected);if(!r&&e!==`quality`)return;let i=e===`subtitles`?n.find(e=>Rs.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||r===i?null:r.id,...i?{offLabel:i.label}:{}}},Ks=async(e,{button:t,open:n,timeout:r},i)=>{Y(i);let a=e.locator(n);if(await a.exists({timeout:1e3})){Y(i);return}Y(i),await e.evaluate(Ss,{button:t,timeout:r});let o=Date.now()+r;for(;Date.now()<o;){if(Y(i),await a.exists({timeout:1e3}))return;await Hs(Ls)}throw Error(`Crunchyroll menu did not open: ${t}`)},qs=async(e,t,n)=>{Y(n);let r=await e.evaluate(xs,Vs[t]);Y(n);let i=r.map((e,t)=>({...e,label:Ws(e.label),index:t})),a=new Map;for(let e of i)a.set(e.label,(a.get(e.label)??0)+1);let o=new Map;return i.map(e=>{let t=(o.get(e.label)??0)+1;return o.set(e.label,t),{...e,id:a.get(e.label)===1?e.label:`${e.label}#${t}`}})},Js=async(e,t,n)=>Gs(t,await qs(e,t,n)),Ys=async(e,t)=>{try{return await e.locator(ks).exists({timeout:1e3})?(await Ks(e,Vs.quality,t),await Js(e,`quality`,t)):void 0}catch(e){if(t())throw e;return}},Xs=async(e,t=Us)=>{await Ks(e,Vs.audio,t);let[n,r]=await Promise.all([Js(e,`audio`,t),Js(e,`subtitles`,t)]);return{audio:n,subtitles:r,quality:await Ys(e,t)}},Zs=async(e,t,n,r)=>(await qs(e,t,r)).find(e=>n===null?Rs.test(e.label):e.id===n)?.index??-1,Qs=async(e,t,n,r)=>{let i=Date.now()+Fs;for(;Date.now()<i;){Y(r),await Ks(e,Vs[t],r);let i=(await qs(e,t,r)).find(e=>e.selected);if(i&&(n===null?Rs.test(i.label):i.id===n))return;await Hs(Ls)}throw Error(`Crunchyroll did not apply the ${t} option`)},$s=(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))},ec=e=>({currentTime:e.currentTime,paused:e.paused,playbackRate:e.playbackRate}),tc=(e,t)=>e.evaluate(ws,{timeline:As,time:t,timeout:Fs}),nc=async(e,t,n)=>{let r=Date.now()+5e3;for(;Date.now()<r&&(Y(n),!(e.currentSrc!==t||e.readyState<2));)await Hs(Ls);if(e.currentSrc===t&&e.readyState>=2)return!1;let i=Date.now()+Fs;for(;Date.now()<i;){if(Y(n),e.readyState>=2)return!0;await Hs(Ls)}throw Error(`Crunchyroll playback did not become ready after changing tracks`)},rc=async(e,t,n,r)=>{Y(r),t.playbackRate=n.playbackRate;let i=$s(n.currentTime,t.duration);Math.abs(t.currentTime-i)>2&&await tc(e,i);let a=Date.now()+Fs;for(;Date.now()<a&&(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2);)Y(r),await Hs(Ls);if(Math.abs(t.currentTime-i)>2||t.seeking||t.readyState<2)throw Error(`Crunchyroll playback position was not restored after changing tracks`);Y(r),n.paused?t.pause():await t.play();let o=Date.now()+Is;for(;Date.now()<o&&t.paused!==n.paused;)Y(r),await Hs(Ls);if(t.paused!==n.paused)throw Error(`Crunchyroll playback state was not restored after changing tracks`)},ic=async(e,t,n,r,i=Us)=>{await Ks(e,Vs[n],i);let a=await Zs(e,n,r,i);if(a<0)throw Error(`Crunchyroll ${n} option is no longer available`);Y(i);let o=t.currentSrc,s=ec(t);return await e.evaluate(Cs,{...Vs[n],optionIndex:a}),await Qs(e,n,r,i),n!==`quality`&&await nc(t,o,i)&&await rc(e,t,s,i),Xs(e,i)},ac=(e,t)=>{tc(e,t).catch(e=>console.warn(`[cr] timeline seek failed:`,e))},oc=(e,t)=>new Proxy(e,{set(e,n,r,i){return n===`currentTime`&&typeof r==`number`&&Number.isFinite(r)&&ac(t,r),Reflect.set(e,n,r,i)}});ue();var sc=({title:e,remote:t,frame:n,subtitles:r,audioTracks:i,quality:a,thumbnails:o,chapters:s,pictureInPicture:c,children:l})=>{let u=I(()=>t?le(t):null,[t]);F(()=>u?.hold(),[u]);let d=I(()=>u&&n?oc(u.media,n):null,[u,n]);return F(()=>u&&d?st(u.served(d)):void 0,[u,d]),L(et,{media:d,title:e,subtitles:r,audioTracks:i,quality:a,thumbnails:o,chapters:s,pictureInPicture:c,children:l})},cc=3e4,lc=async(e,t)=>{let n=Date.now()+cc,r=!1;for(;!t();){let i=await e.locator(`.shell-header`).exists();r||=i;let[a,o]=await Promise.all([e.locator(`#user-menu-anonymous`).exists(),e.locator(`#user-menu-authenticated`).exists()]);if(t())break;if(o)return{isLoggedIn:o,isLoggedOut:!1};let s=Date.now()>=n;if(a&&!i&&(r||s))return{isLoggedIn:o,isLoggedOut:a};if(s)break;await new Promise(e=>setTimeout(e,100))}throw Error(`Login state check timed out`)};ue();var uc=`video`,dc=(e,t,n)=>{let[r,i]=R(null);return F(()=>{if(!e||!t)return;let n=!1;(async()=>e.evaluate(Es,{video:uc}))().then(e=>{!n&&e&&i(t)},e=>{n||console.warn(`[cr] picture in picture unavailable:`,e)});let r=e=>console.warn(`[cr] picture in picture refused:`,e.detail);return t.addEventListener(Ts,r),()=>{n=!0,t.removeEventListener(Ts,r),i(null)}},[e,t]),I(()=>r&&r===t&&n?{onArmedChange:e=>{n.style.pointerEvents=e?`auto`:``}}:void 0,[r,t,n])},fc=class extends Error{name=`BifParseError`},pc=[137,66,73,70,13,10,26,10],mc=64,hc=8,gc=4294967295,_c=36e3,vc=e=>{if(e.byteLength<mc)throw new fc(`truncated header: ${e.byteLength} bytes`);let t=new DataView(e);if(pc.some((e,n)=>t.getUint8(n)!==e))throw new fc(`bad magic`);let n=t.getUint32(12,!0),r=t.getUint32(16,!0)||1e3;if(n>_c)throw new fc(`implausible frame count ${n}`);let i=mc+(n+1)*hc;if(i>e.byteLength)throw new fc(`truncated index: ${n} frames need ${i} bytes, have ${e.byteLength}`);let a=e=>t.getUint32(mc+e*hc,!0),o=e=>t.getUint32(mc+e*hc+4,!0);if(a(n)!==gc)throw new fc(`the index does not end on the 0xffffffff entry`);let s=[];for(let t=0;t<n;t+=1){let c=o(t),l=o(t+1);if(c<i||l<=c||l>e.byteLength)throw new fc(`image ${t} spans ${c}..${l}, outside ${i}..${e.byteLength}`);let u=a(t),d=t+1===n;if(!d&&a(t+1)<=u)throw new fc(`timestamps do not increase at image ${t}`);s.push({start:u*r,end:d?1/0:a(t+1)*r,bytes:new Uint8Array(e,c,l-c)})}return s},yc=(e,t)=>{if(!e.length||!Number.isFinite(t))return;let n=0,r=e.length-1;for(;n<r;){let i=Math.ceil((n+r)/2);e[i].start<=t?n=i:r=i-1}return e[n]},bc=async({waitMs:e,fetchMs:t,maxBytes:n})=>{let r=/^(?:https?:\/\/|\/)\S*\.bif(?:[?#]\S*)?$/i,i=e=>typeof e==`string`&&e.length<8192&&e.includes(`.bif`)&&r.test(e),a=(e,t)=>{try{return e?.[t]}catch{return}},o=e=>{let t=Object.keys(e).find(e=>e.startsWith(`__reactFiber$`)||e.startsWith(`__reactInternalInstance$`));return t?a(e,t):void 0},s=e=>{let t=[],n=new Set,r=[e,...Array.from(e.querySelectorAll(`*`)).slice(0,3e3)];for(let e of r){let r=o(e);for(let e=0;r&&e<40&&!n.has(r);e+=1){n.add(r);let e=a(a(r,`memoizedProps`),`value`);e&&typeof e==`object`&&t.push(e),r=a(r,`return`)}}return t},c=e=>{let t=new Set,n=e,r=0;for(let e=0;e<=8&&n.length;e+=1){let e=[];for(let o of n){if(t.has(o))continue;if(t.add(o),r+=1,r>2e4)return;let n;try{n=Object.keys(o).slice(0,500)}catch{continue}for(let t of n){let n=a(o,t);if(i(n))return n;n&&typeof n==`object`&&(n===window||typeof a(n,`nodeType`)==`number`||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||e.push(n))}}n=e}},l=e=>{let t=[];for(let n of e){let e=a(a(n,`volumeVM`),`_player`);if(!e||typeof e!=`object`)continue;let r=a(a(a(e,`playerOrchestrator`),`thumbnailOrchestrator`),`_currentBifUrl`);if(i(r))return{url:r,via:`named`};t.push(e)}let n=c(t.length?t:e);return n?{url:n,via:`search`}:void 0},u=async(e,r)=>{let i=new AbortController,a=setTimeout(()=>i.abort(),t);try{let t=await fetch(e,{signal:i.signal});if(!t.ok)return{none:`fetch-failed`,detail:`HTTP ${t.status}`};let a=Number(t.headers.get(`content-length`));if(a>n)return{none:`too-large`,detail:`${a} bytes`};let o=await t.arrayBuffer();return o.byteLength>n?{none:`too-large`,detail:`${o.byteLength} bytes`}:{bytes:o,via:r}}catch(e){return{none:`fetch-failed`,detail:String(e)}}finally{clearTimeout(a)}};try{let t=Date.now()+e,n=!1;for(;;){let e=document.querySelector(`.video-player-wrapper`);if(e?.querySelector(`video`)){n=!0;let t=l(s(e));if(t)return await u(t.url,t.via)}if(Date.now()>=t)return{none:n?`no-bif`:`no-player`};await new Promise(e=>setTimeout(e,500))}}catch(e){return{none:`failed`,detail:String(e)}}},xc={waitMs:1e4,fetchMs:15e3,maxBytes:31457280},Sc=e=>{let t=new Map,n=!1;return{at:r=>{if(n)return;let i=yc(e,r*1e3);if(!i)return;let a=t.get(i);return a||(a={url:URL.createObjectURL(new Blob([i.bytes],{type:`image/jpeg`})),startTime:i.start/1e3,endTime:i.end/1e3},t.set(i,a)),a},dispose:()=>{n=!0;for(let{url:e}of t.values())URL.revokeObjectURL(e);t.clear()}}},Cc=async e=>{let t=await e.evaluate(bc,xc);if(`none`in t)throw Error(`no BIF: ${t.none}${t.detail?` (${t.detail})`:``}`);let n=vc(t.bytes);if(!n.length)throw Error(`no BIF: the file has no images`);return Sc(n)},wc=async(e,t)=>{for(;!t();){if(await e.locator(`.erc-region-restricted, .erc-blocked-stream [data-t="unavailable-svg"], .erc-not-found`).exists().catch(()=>!1))return!0;await new Promise(e=>setTimeout(e,250))}return!1};ue();var Tc=C(()=>localStorage,new BroadcastChannel(S)),Ec=`
101
+ html, body {
102
+ margin: 0 !important;
103
+ padding: 0 !important;
104
+ width: 100% !important;
105
+ height: 100% !important;
106
+ background: #000 !important;
107
+ }
108
+ *:not(:has(.video-player-wrapper)):not(.video-player-wrapper):not(.video-player-wrapper *) {
109
+ display: none !important;
110
+ }
111
+ div[data-testid="player-controls-root"] {
112
+ display: none !important;
113
+ }
114
+ .video-player-wrapper,
115
+ .video-player,
116
+ .player-container,
117
+ .video-player-wrapper > *,
118
+ .video-player > *,
119
+ .player-container > * {
120
+ position: absolute !important;
121
+ inset: 0 !important;
122
+ width: 100% !important;
123
+ height: 100% !important;
124
+ z-index: 9999999;
125
+ }
126
+ .video-player-wrapper video,
127
+ .video-player video,
128
+ .player-container video {
129
+ width: 100% !important;
130
+ height: 100% !important;
131
+ object-fit: contain !important;
132
+ }
133
+ .video-player-wrapper *:not(:has(video)):not(video):not(:has(.timeline-slider)):not(.timeline-slider) {
134
+ display: none !important;
135
+ }
136
+ .timeline-container,
137
+ .timeline-container *,
138
+ .timeline-slider {
139
+ opacity: 0 !important;
140
+ pointer-events: none !important;
141
+ }
142
+ /* shows only where the frame takes pointer events: the player's picture in picture control, armed */
143
+ html, html * {
144
+ cursor: pointer !important;
145
+ }
146
+ `,Dc=`This episode is not available on Crunchyroll in your region. Try another source.`,Oc=3e4,kc=async(e,t)=>{let n=Date.now()+Oc;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},Ac=j`
147
+ to { transform: rotate(360deg); }
148
+ `,jc=O`
149
+ position: relative;
150
+ width: 100%;
151
+ height: 100%;
152
+ background: #000;
153
+ /* The double-tap-to-fullscreen gesture otherwise word-selects the
154
+ skin's labels/time readouts, flashing them blue. Player chrome isn't
155
+ meant to be selected, so suppress it across the whole player. */
156
+ user-select: none;
157
+ -webkit-user-select: none;
158
+
159
+ .cr-frame {
160
+ position: absolute;
161
+ inset: 0;
162
+ width: 100%;
163
+ height: 100%;
164
+ border: none;
165
+ background: #000;
166
+ /* CR's own chrome is hidden, so the iframe must not swallow clicks -
167
+ taps belong to the videojs gesture layer stacked above it. The one
168
+ exception is picture-in-picture.ts, which lifts this while the
169
+ player's picture in picture control is under the pointer. */
170
+ pointer-events: none;
171
+ }
172
+
173
+ .overlay {
174
+ position: absolute;
175
+ inset: 0;
176
+ display: flex;
177
+ flex-direction: column;
178
+ align-items: center;
179
+ justify-content: center;
180
+ gap: 1.6rem;
181
+ background: #000;
182
+ font-size: 1.4rem;
183
+ color: rgba(255, 255, 255, 0.8);
184
+ /* Above the skin's own layers (its controls/error dialog top out at
185
+ z-index 20) so the login/loading screen fully covers them. */
186
+ z-index: 30;
187
+ }
188
+
189
+ .login-button {
190
+ padding: 0.8rem 2rem;
191
+ background: #f47521;
192
+ color: #fff;
193
+ border: none;
194
+ border-radius: 0.4rem;
195
+ font-size: 1.4rem;
196
+ font-weight: 600;
197
+ cursor: pointer;
198
+
199
+ &:hover {
200
+ background: #e0651a;
201
+ }
202
+
203
+ &:disabled {
204
+ opacity: 0.6;
205
+ cursor: default;
206
+ }
207
+ }
208
+
209
+ /* @banou/media-player's own buffering spinner (overlay.tsx), same box and centre, so when the video
210
+ arrives still buffering the player's spinner takes over from this one without a jump */
211
+ .loading-spinner {
212
+ box-sizing: border-box;
213
+ width: calc(4 * var(--mp-unit, 10px));
214
+ height: calc(4 * var(--mp-unit, 10px));
215
+ border-radius: 50%;
216
+ border: 3px solid rgba(255, 255, 255, 0.25);
217
+ border-top-color: #fff;
218
+ animation: ${Ac} 0.8s linear infinite;
219
+ }
220
+ `,Mc=({url:e,title:t,triedRelays:r=[],unlistedRelays:i})=>{let[o,s]=R(`detecting`),[c,l]=R(null),[p,_]=R(null),[v,y]=R(!0),[S,C]=R(!1),[E,O]=R(),[k,ee]=R(!1),A=H(r),[j,te]=R(null),[M,re]=R(0),[ie,ae]=R(0),[P,oe]=R(!1),[se,ce]=R(!1),z=H(null),B=H(null),[le,ue]=R(!1),de=H(!1),[U,fe]=R(),[pe,me]=R(0),[he,ge]=R(),_e=vt(e,j),ve=dc(p,j,c),ye=H(0),be=H({generation:0,tail:Promise.resolve()}),xe=H(!0),Se=N(()=>{let e=ye.current+1;return ye.current=e,be.current={generation:e,tail:Promise.resolve()},fe(void 0),e},[]),Ce=N((e,t)=>{if(be.current.generation!==e)return Promise.reject(Error(`Crunchyroll track operation cancelled`));let n=be.current,r=n.tail.then(t);return n.tail=r.then(()=>{},()=>{}),r},[]);F(()=>()=>{xe.current=!1,ye.current+=1},[]),F(()=>{let e=!1;return h().then(t=>{e||s(t)}),()=>{e=!0}},[]),F(()=>{if(!c||o===`detecting`)return;let e=!1;return Promise.resolve(o===`cloud`?i:void 0).then(t=>{for(let e of t??[])A.current.includes(e)||(A.current=[...A.current,e]);if(!e)return m({iframe:c,domains:d,cookies:f(o),relay:A.current.length?{exclude:A.current}:void 0,permissions:[{category:`evaluation`,reason:`Switch audio, subtitles and quality, seek, show seek thumbnails and open picture in picture`}]})}).then(t=>{!e&&t&&_(t)}).catch(t=>{if(!e){if(y(!1),b(t))return ee(!0),n();console.error(`Failed to attach Crunchyroll frame`,t),O(t?.message||`Failed to load player`)}}),()=>{e=!0}},[c,o]);let we=N(()=>{_(null),O(void 0),te(null),Se(),C(!1),y(!0),ae(e=>e+1)},[Se]);F(()=>{if(!p)return;let t=!1,i=!1,s=()=>t||i;y(!0),O(void 0),C(!1),te(null),Se();let c=async()=>{o!==`cloud`&&await p.addStyleTag({content:Ec});let{isLoggedIn:e}=await lc(p,s);return s()?null:(w.record(`crunchyroll`,e?`signed-in`:`signed-out`),e?(o===`cloud`&&await p.addStyleTag({content:Ec}),s()?null:kc(p,s)):`signed-out`)};return(async()=>{if(await p.goto(e,{waitUntil:`commit`}),t)return;let o=c(),l=wc(p,s).then(async e=>e?`unavailable`:o),u=await Promise.race([o,l]).finally(()=>{i=!0});if(!t){if(u===`unavailable`){let e=x(p);if(e&&!A.current.includes(e)){A.current=[...A.current,e],we();return}y(!1),ee(!0),n()}else if(y(!1),u===`signed-out`)C(!0);else{if(!u)throw Error(`The episode did not load a player.`);for(let e of A.current)r.includes(e)||a(e);te(u)}}})().catch(e=>{t||(console.error(`Failed to load Crunchyroll player`,e),O(e?.message||`Failed to load player`),y(!1))}),()=>{t=!0}},[p,e,M,o,Se,we]),F(()=>{if(!p||!j)return;let e=Se(),t=!1,n=()=>t||!xe.current||e!==ye.current;return(async()=>{let t,r;for(let i=0;i<5&&!n();i+=1){try{if(r=await Ce(e,()=>Xs(p,n)),t=void 0,n()||(fe(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}},[p,j,Se,Ce]),F(()=>{if(!p||!j)return;let e=!1,t;return Cc(p).then(n=>{if(e)return n.dispose();t=n,ge(n)},t=>{e||console.warn(`[cr] seek thumbnails unavailable:`,t)}),()=>{e=!0,t?.dispose(),ge(void 0)}},[p,j]);let Te=ye.current,Ee=N((e,t)=>{if(!p||!j)return Promise.reject(Error(`Crunchyroll player is not ready`));let n=()=>!xe.current||Te!==ye.current;return me(e=>e+1),Ce(Te,async()=>{try{let r=await ic(p,j,e,t,n);if(n())throw Error(`Crunchyroll track operation cancelled`);fe(r)}catch(e){if(!n())try{let e=await Xs(p,n);n()||fe(e)}catch{}throw e}}).finally(()=>me(e=>e-1))},[p,j,Ce,Te]),De=I(()=>U?.subtitles&&{selection:{...U.subtitles,select:e=>Ee(`subtitles`,e)}},[U?.subtitles,Ee]),Oe=I(()=>U?.audio&&{selection:{...U.audio,select:e=>Ee(`audio`,e)}},[U?.audio,Ee]),ke=I(()=>U?.quality&&{selection:{...U.quality,select:e=>Ee(`quality`,e)}},[U?.quality,Ee]),Ae=I(()=>{let e=e=>e&&{ids:e.options.filter(e=>!e.disabled).map(e=>e.id),selected:e.selectedId};return{subtitles:e(U?.subtitles),audio:e(U?.audio),busy:pe>0}},[U,pe]);F(()=>u(Ae,(e,t)=>{Ee(e,t).catch(()=>{})}),[Ae,Ee]);let je=N(()=>{if(z.current!==null)return;let e=globalThis.open(T,`_blank`,`width=500,height=700`);if(!e){ce(!0),y(!1);return}ce(!1),oe(!0),B.current=e;let t=setInterval(()=>{e.closed&&(clearInterval(t),Tc.connect(`cr`),z.current===t&&(z.current=null),B.current===e&&(B.current=null),oe(!1),re(e=>e+1))},500);z.current=t},[]),W=N(()=>{if(de.current)return;de.current=!0;let e=D({url:T,domains:d,isSignedIn:g});ce(!1),ue(!0),e.then(e=>{e!==`blocked`&&Tc.connect(`cr`),xe.current&&(e===`blocked`?ce(!0):e===`unsupported`?O(`The Crunchyroll sign-in window could not be opened here.`):e===`authed`?we():(C(!1),y(!0),re(e=>e+1)))},e=>{xe.current&&(console.error(`Crunchyroll sign-in window failed`,e),O(e?.message||`The sign-in window failed`))}).finally(()=>{de.current=!1,xe.current&&ue(!1)})},[we]);F(()=>()=>{z.current!==null&&(clearInterval(z.current),z.current=null)},[]),F(()=>{z.current!==null&&(clearInterval(z.current),z.current=null,oe(!1)),ce(!1)},[e]);let Me=N(()=>{B.current!==null&&(B.current.close(),B.current=null),z.current!==null&&(clearInterval(z.current),z.current=null),ce(!1),oe(!1),we()},[we]),Ne=(v||E||se||S||k)&&V(`div`,{className:`overlay`,children:[k&&Dc,S&&!E&&!se&&V(ne,{children:[`Sign in to Crunchyroll to watch.`,o===`extension`?L(`button`,{className:`login-button`,onClick:je,disabled:P,children:P?`Finish signing in the popup...`:`Open Crunchyroll Login Page`}):L(`button`,{className:`login-button`,onClick:W,disabled:le,children:le?`Finish signing in the window...`:`Sign in to Crunchyroll`})]}),se&&!E&&V(ne,{children:[`The login popup was blocked. Allow popups for this page and try again.`,L(`button`,{className:`login-button`,onClick:o===`extension`?je:W,children:`Open Crunchyroll Login Page`})]}),E&&V(ne,{children:[E,L(`button`,{className:`login-button`,onClick:Me,children:`Retry`})]}),v&&!E&&!S&&L(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})]});return V(`div`,{css:jc,children:[o!==`detecting`&&L(sc,{title:t,remote:j,frame:p,subtitles:De,audioTracks:Oe,quality:ke,thumbnails:he,chapters:_e,pictureInPicture:ve,children:L(`iframe`,{ref:l,className:`cr-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`},`${o}-${ie}`)}),Ne]})},X=e=>e,Z=X(({className:e,children:t})=>L(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:18,height:18,fill:`none`,"aria-hidden":`true`,className:e,children:t})),Nc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Pc=X(({className:e})=>V(Z,{className:e,children:[L(`rect`,{width:5,height:14,x:2,y:2,fill:`currentColor`,rx:1.75}),L(`rect`,{width:5,height:14,x:11,y:2,fill:`currentColor`,rx:1.75})]})),Fc=X(({className:e})=>V(Z,{className:e,children:[L(`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`}),L(`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`})]})),Ic=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Lc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Rc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),zc=X(({className:e})=>V(Z,{className:e,children:[L(`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`}),L(`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`})]})),Bc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Vc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Hc=X(({className:e})=>V(Z,{className:e,children:[L(`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`}),L(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),L(`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`})]})),Uc=X(({className:e})=>V(Z,{className:e,children:[L(`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`}),L(`rect`,{width:10,height:7,x:8,y:10,fill:`currentColor`,rx:2}),L(`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`})]})),Wc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Gc=X(({className:e})=>V(Z,{className:e,children:[L(`rect`,{width:16,height:12,x:1,y:3,stroke:`currentColor`,strokeWidth:2,rx:3}),L(`rect`,{width:3,height:2,x:3,y:8,fill:`currentColor`,rx:1}),L(`rect`,{width:2,height:2,x:13,y:8,fill:`currentColor`,rx:1}),L(`rect`,{width:4,height:2,x:11,y:11,fill:`currentColor`,rx:1}),L(`rect`,{width:5,height:2,x:7,y:8,fill:`currentColor`,rx:1}),L(`rect`,{width:7,height:2,x:3,y:11,fill:`currentColor`,rx:1})]})),Kc=X(({className:e})=>L(Z,{className:e,children:V(`g`,{fill:`currentColor`,children:[L(`rect`,{width:2,height:5,x:8,y:.5,opacity:.5,rx:1,children:L(`animate`,{attributeName:`opacity`,begin:`0s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:2,height:5,x:12.243,y:2.257,opacity:.45,rx:1,transform:`rotate(45 13.243 4.757)`,children:L(`animate`,{attributeName:`opacity`,begin:`0.125s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:5,height:2,x:12.5,y:8,opacity:.4,rx:1,children:L(`animate`,{attributeName:`opacity`,begin:`0.25s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:5,height:2,x:10.743,y:12.243,opacity:.35,rx:1,transform:`rotate(45 13.243 13.243)`,children:L(`animate`,{attributeName:`opacity`,begin:`0.375s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:2,height:5,x:8,y:12.5,opacity:.3,rx:1,children:L(`animate`,{attributeName:`opacity`,begin:`0.5s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:2,height:5,x:3.757,y:10.743,opacity:.25,rx:1,transform:`rotate(45 4.757 13.243)`,children:L(`animate`,{attributeName:`opacity`,begin:`0.625s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:5,height:2,x:.5,y:8,opacity:.15,rx:1,children:L(`animate`,{attributeName:`opacity`,begin:`0.75s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})}),L(`rect`,{width:5,height:2,x:2.257,y:3.757,opacity:.1,rx:1,transform:`rotate(45 4.757 4.757)`,children:L(`animate`,{attributeName:`opacity`,begin:`0.875s`,calcMode:`linear`,dur:`1s`,repeatCount:`indefinite`,values:`1;0`})})]})})),qc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Jc=X(({className:e})=>L(Z,{className:e,children:L(`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`})})),Yc=X(({className:e})=>L(Z,{className:e,children:L(`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`})}));ue();var Xc=10,Q=e=>e,Zc=Q(Ja.Root),Qc=Q(Va),$c=Q(no.Root),el=Q(Ba.Popup),tl=Q(Ba.Title),nl=Q(Ba.Close),rl=Q(no.Description),il=Q(rs.Provider),al=Q(rs.Root),ol=Q(rs.Trigger),sl=Q(rs.Popup),cl=Q(wo.Root),ll=Q(wo.Trigger),ul=Q(wo.Popup),dl=Q(mo),fl=Q(To),pl=Q(fo),ml=Q(po),hl=Q(ro),gl=Q(ho),_l=Q(Ho.Value),vl=Q(Go.Root),yl=Q(Ro.Track),bl=Q(Ro.Fill),xl=Q(Ro.Buffer),Sl=Q(Ro.Thumb),Cl=Q(Ro.Value),wl=Q(os.Root),$=Q(lo),Tl=Q(ao),El=Q(Le),Dl=({className:e,...t})=>L(`button`,{type:`button`,className:`media-button media-button--subtle media-button--icon${e?` ${e}`:``}`,...t}),Ol=({selection:e,icon:t})=>{let[n,r]=R(!1),[i,a]=R(!1),[o,s]=R(!1);F(()=>s(!1),[e.selectedId]);let c=[...e.offLabel?[{id:null,label:e.offLabel}]:[],...e.options],l=t=>{t===e.selectedId?r(!1):(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 V(cl,{open:n,onOpenChange:e=>r(e),children:[L(ll,{render:L(Dl,{className:`media-button--menu${o?` media-button--error`:``}`,"aria-label":e.label}),children:t}),L(ul,{className:`media-surface media-popover media-popover--menu`,children:V(`div`,{className:`stub-menu`,role:`menu`,"aria-label":e.label,children:[L(`div`,{className:`stub-menu__heading`,children:e.label}),c.map(t=>{let n=t.id===e.selectedId;return V(`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:[L(`span`,{className:`stub-menu__check`,children:n?L(Yc,{className:`media-icon`}):null}),L(`span`,{className:`stub-menu__label`,children:t.label}),`description`in t&&t.description?L(`span`,{className:`stub-menu__description`,children:t.description}):null]},t.id??`__off__`)})]})})]})},kl=()=>V(cl,{openOnHover:!0,delay:200,closeDelay:100,side:`top`,children:[L(ll,{render:V(pl,{className:`media-button--mute`,render:L(Dl,{}),children:[L(Lc,{className:`media-icon media-icon--volume-off`}),L(Rc,{className:`media-icon media-icon--volume-low`}),L(zc,{className:`media-icon media-icon--volume-high`})]})}),L(ul,{className:`media-surface media-popover media-popover--volume`,children:V(wl,{className:`media-slider`,orientation:`vertical`,thumbAlignment:`edge`,children:[L(yl,{className:`media-slider__track`,children:L(bl,{className:`media-slider__fill`})}),L(Sl,{className:`media-slider__thumb media-slider__thumb--persistent`})]})})]}),Al=({capabilities:e,children:t,className:n,...r})=>V(El,{className:`media-default-skin media-default-skin--video${n?` ${n}`:``}`,...r,children:[t,L(Qc,{render:e=>L(`div`,{...e,className:`media-buffering-indicator`,children:L(`div`,{className:`media-surface`,children:L(Kc,{className:`media-icon`})})})}),L($c,{children:L(el,{className:`media-error`,children:V(`div`,{className:`media-error__dialog media-surface`,children:[V(`div`,{className:`media-error__content`,children:[L(tl,{className:`media-error__title`,children:`Something went wrong.`}),L(rl,{className:`media-error__description`})]}),L(`div`,{className:`media-error__actions`,children:L(nl,{className:`media-button media-button--primary`,children:`OK`})})]})})}),L(Zc,{className:`media-surface media-controls`,children:V(il,{children:[V(`div`,{className:`media-button-group`,children:[V(al,{side:`top`,children:[L(ol,{render:V(dl,{className:`media-button--play`,render:L(Dl,{}),children:[L(Fc,{className:`media-icon media-icon--restart`}),L(Nc,{className:`media-icon media-icon--play`}),L(Pc,{className:`media-icon media-icon--pause`})]})}),L(sl,{className:`media-surface media-tooltip`})]}),V(al,{side:`top`,children:[L(ol,{render:L(fl,{seconds:-10,className:`media-button--seek`,render:L(Dl,{}),children:V(`span`,{className:`media-icon__container`,children:[L(Ic,{className:`media-icon media-icon--seek media-icon--flipped`}),L(`span`,{className:`media-icon__label`,children:Xc})]})})}),V(sl,{className:`media-surface media-tooltip`,children:[`Seek backward `,Xc,` seconds`]})]}),V(al,{side:`top`,children:[L(ol,{render:L(fl,{seconds:Xc,className:`media-button--seek`,render:L(Dl,{}),children:V(`span`,{className:`media-icon__container`,children:[L(Ic,{className:`media-icon media-icon--seek`}),L(`span`,{className:`media-icon__label`,children:Xc})]})})}),V(sl,{className:`media-surface media-tooltip`,children:[`Seek forward `,Xc,` seconds`]})]})]}),V(`div`,{className:`media-time-controls`,children:[L(_l,{type:`current`,className:`media-time`}),V(vl,{className:`media-slider`,children:[V(yl,{className:`media-slider__track`,children:[L(bl,{className:`media-slider__fill`}),L(xl,{className:`media-slider__buffer`})]}),L(Sl,{className:`media-slider__thumb`}),L(`div`,{className:`media-surface media-thumbnail media-slider__preview`,children:L(Cl,{type:`pointer`,className:`media-time media-thumbnail__time`})})]}),L(_l,{type:`duration`,className:`media-time`})]}),V(`div`,{className:`media-button-group`,children:[V(al,{side:`top`,children:[L(ol,{render:L(gl,{className:`media-button--playback-rate`,render:L(Dl,{})})}),L(sl,{className:`media-surface media-tooltip`,children:`Toggle playback rate`})]}),L(kl,{}),e?.subtitles&&L(Ol,{selection:e.subtitles,icon:e.subtitles.selectedId?L(Wc,{className:`media-icon`}):L(Gc,{className:`media-icon`})},`subtitles`),e?.audioTracks&&L(Ol,{selection:e.audioTracks,icon:L(qc,{className:`media-icon`})},`audio`),e?.qualityLevels&&L(Ol,{selection:e.qualityLevels,icon:L(Jc,{className:`media-icon`})},`quality`),V(al,{side:`top`,children:[L(ol,{render:V(ml,{className:`media-button--pip`,render:L(Dl,{}),children:[L(Hc,{className:`media-icon media-icon--pip-enter`}),L(Uc,{className:`media-icon media-icon--pip-exit`})]})}),L(sl,{className:`media-surface media-tooltip`})]}),V(al,{side:`top`,children:[L(ol,{render:V(hl,{className:`media-button--fullscreen`,render:L(Dl,{}),children:[L(Bc,{className:`media-icon media-icon--fullscreen-enter`}),L(Vc,{className:`media-icon media-icon--fullscreen-exit`})]})}),L(sl,{className:`media-surface media-tooltip`})]})]})]})}),L(`div`,{className:`media-overlay`}),L($,{keys:`Space`,action:`togglePaused`}),L($,{keys:`k`,action:`togglePaused`}),L($,{keys:`m`,action:`toggleMuted`}),L($,{keys:`f`,action:`toggleFullscreen`}),L($,{keys:`i`,action:`togglePictureInPicture`}),L($,{keys:`ArrowRight`,action:`seekStep`,value:5}),L($,{keys:`ArrowLeft`,action:`seekStep`,value:-5}),L($,{keys:`l`,action:`seekStep`,value:10}),L($,{keys:`j`,action:`seekStep`,value:-10}),L($,{keys:`ArrowUp`,action:`volumeStep`,value:.05}),L($,{keys:`ArrowDown`,action:`volumeStep`,value:-.05}),L($,{keys:`0-9`,action:`seekToPercent`}),L($,{keys:`Home`,action:`seekToPercent`,value:0}),L($,{keys:`End`,action:`seekToPercent`,value:100}),L(Tl,{type:`tap`,action:`togglePaused`,pointer:`mouse`,region:`center`}),L(Tl,{type:`tap`,action:`toggleControls`,pointer:`touch`}),L(Tl,{type:`doubletap`,action:`seekStep`,value:-10,region:`left`}),L(Tl,{type:`doubletap`,action:`toggleFullscreen`,region:`center`}),L(Tl,{type:`doubletap`,action:`seekStep`,value:10,region:`right`})]});ue();var{Provider:jl}=Je({features:Ye}),Ml=e=>`media`in e?e:{media:e},Nl=({remote:e,frame:t,adapter:n})=>{let r=We();return F(()=>{if(!r||!e||!t)return;let i=le(e),a=n?n(i.media,t):i.media;if(!a)return;let o=Ml(a),s=i.hold();r(o.media);let c=st(i.served(o.media));return()=>{c(),s(),r(null),o.dispose?.()}},[e,t,n,r]),null},Pl=O`
221
+ position: absolute;
222
+ inset: 0;
223
+ border-radius: 0.8rem;
224
+ background: transparent !important;
225
+ &.media-default-skin--video {
226
+ background: transparent !important;
227
+ }
228
+
229
+ .media-popover--menu {
230
+ padding: 0.4rem;
231
+ }
232
+
233
+ /**
234
+ * The track menu is stub's own markup, so it carries a stub prefix rather than a media one.
235
+ *
236
+ * It was named \`media-menu\` when the skin had no menu of its own. videojs beta.26 added one, and
237
+ * upstream's nested \`.media-default-skin .media-menu .media-menu__item\` is specificity (0,3,0)
238
+ * against this file's (0,2,0), so it silently took over padding, gap, cursor and justification the
239
+ * moment the dependency moved. A prefix upstream will never mint is the only durable fix; matching
240
+ * their specificity would just move the race to insertion order.
241
+ */
242
+ .stub-menu {
243
+ display: flex;
244
+ flex-direction: column;
245
+ min-width: 18rem;
246
+ max-height: 32rem;
247
+ overflow-y: auto;
248
+ }
249
+ .stub-menu__heading {
250
+ padding: 0.6rem 1rem 0.4rem;
251
+ font-size: 1.1rem;
252
+ font-weight: 600;
253
+ letter-spacing: 0.04em;
254
+ text-transform: uppercase;
255
+ opacity: 0.6;
256
+ }
257
+ .stub-menu__item {
258
+ display: flex;
259
+ align-items: center;
260
+ gap: 0.6rem;
261
+ width: 100%;
262
+ padding: 0.6rem 1rem;
263
+ border: none;
264
+ border-radius: 0.4rem;
265
+ background: transparent;
266
+ color: inherit;
267
+ font-size: 1.3rem;
268
+ text-align: left;
269
+ cursor: pointer;
270
+
271
+ &:hover:not(:disabled) {
272
+ background: rgba(255, 255, 255, 0.12);
273
+ }
274
+ &:disabled {
275
+ opacity: 0.5;
276
+ cursor: default;
277
+ }
278
+ }
279
+ .stub-menu__check {
280
+ display: inline-flex;
281
+ width: 1.6rem;
282
+ flex: none;
283
+ }
284
+ .stub-menu__label {
285
+ flex: 1;
286
+ }
287
+ .stub-menu__description {
288
+ opacity: 0.6;
289
+ font-size: 1.1rem;
290
+ }
291
+ .media-button--error {
292
+ color: #f66;
293
+ }
294
+ `,Fl=({remote:e,frame:t,adapter:n,capabilities:r,children:i})=>V(jl,{children:[L(Nl,{remote:e,frame:t,adapter:n}),L(Al,{capabilities:r,css:Pl,children:i})]}),Il=`[data-uia="timeline"]`,Ll=`[data-uia="video-canvas"]`,Rl=`[data-uia="player"]`,zl=`Seeks the video to the point you pick on the timeline.`,Bl=`Reveals the player controls so the timeline can be used.`,Vl=140,Hl=2,Ul=12e3,Wl=26,Gl=110,Kl={"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"]`},ql=e=>new Promise(t=>setTimeout(t,e)),Jl=e=>e<0?0:e>1?1:e,Yl=0,Xl=()=>{let e=Yl*1.1;return Yl++,{x:.5+Math.cos(e)*.05,y:.5+Math.sin(e)*.05}},Zl=(e,t)=>{let n=null,r,i,a=!1,o=async()=>{if(!a){a=!0;try{await Promise.all([t.locator(Ll).ensure(`hover`,{reason:Bl}),t.locator(Rl).ensure(`hover`,{reason:Bl}),t.locator(Il).ensure(`click`,{reason:zl})])}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)<Hl&&(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=Jl(n/r);o();let a=t.locator(Il),s=e.paused===!0;if(s)try{await e.play()}catch{}let c=!1;for(let e=0;e<Wl;e++){if(e%2==0&&(await t.locator(Ll).hover({relativePosition:Xl(),reason:Bl}).catch(()=>{}),await t.locator(Rl).hover({relativePosition:Xl(),reason:Bl}).catch(()=>{})),await a.exists().catch(()=>!1)){c=!0;break}await ql(Gl)}if(!c){let n=await Promise.all(Object.entries(Kl).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{}}else if(await a.click({relativePosition:{x:i,y:.5},reason:zl}).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))},Vl),i&&clearTimeout(i),i=setTimeout(()=>{n=null},Ul),!0):Reflect.set(e,t,a,o)}}),dispose:()=>{e.removeEventListener(`timeupdate`,s),r&&clearTimeout(r),i&&clearTimeout(i)}}},Ql=({remote:e,frame:t,capabilities:n,children:r})=>L(Fl,{remote:e,frame:t,adapter:Zl,capabilities:n,children:r});ue();var $l=[`netflix.com`,`www.netflix.com`,`nflxvideo.net`,`nflxso.net`,`nflxext.com`,`nflximg.net`,`assets.nflxext.com`],eu=`https://www.netflix.com/login`,tu=`
295
+ html, body {
296
+ margin: 0 !important;
297
+ padding: 0 !important;
298
+ width: 100% !important;
299
+ height: 100% !important;
300
+ overflow: hidden !important;
301
+ background: #000 !important;
302
+ }
303
+ /* Truly-unwanted chrome - collapse it entirely. */
304
+ .watch-video--evidence-overlay-container,
305
+ .watch-video--skip-content,
306
+ .watch-video--nextEpisode-seamless-button,
307
+ .watch-video--back-container,
308
+ [data-uia="player-back-to-browse"],
309
+ [data-uia="control-nav-back"],
310
+ [data-uia="control-flag"] {
311
+ display: none !important;
312
+ pointer-events: none !important;
313
+ }
314
+ /* Keep the controls bar in LAYOUT (so the seek adapter can locate + click the
315
+ [data-uia="timeline"] scrubber) but invisible and inert to real taps. NEVER
316
+ display:none here, or the scrubber loses its box and the seek no-ops - mirrors
317
+ Crunchyroll's opacity:0 timeline trick. The skin draws the visible controls. */
318
+ [data-uia="controls-standard"],
319
+ .watch-video--bottom-controls-container,
320
+ .PlayerControlsNeo__layout,
321
+ .PlayerControlsNeo__core-controls,
322
+ .PlayerControlsNeo__button-control-row {
323
+ opacity: 0 !important;
324
+ pointer-events: none !important;
325
+ }
326
+ [data-uia="timeline"],
327
+ [data-uia="timeline"] * {
328
+ pointer-events: auto !important;
329
+ }
330
+ .watch-video,
331
+ [data-uia="video-canvas"] {
332
+ position: fixed !important;
333
+ inset: 0 !important;
334
+ width: 100% !important;
335
+ height: 100% !important;
336
+ z-index: 9999999 !important;
337
+ }
338
+ .watch-video video,
339
+ [data-uia="video-canvas"] video {
340
+ width: 100% !important;
341
+ height: 100% !important;
342
+ object-fit: contain !important;
343
+ }
344
+ `,nu=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`)},ru=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},iu=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},au=O`
345
+ position: relative;
346
+ width: 100%;
347
+ height: 100%;
348
+ background: #000;
349
+ user-select: none;
350
+ -webkit-user-select: none;
351
+
352
+ .nf-frame {
353
+ position: absolute;
354
+ inset: 0;
355
+ width: 100%;
356
+ height: 100%;
357
+ border: none;
358
+ background: #000;
359
+ /* Netflix's own chrome is hidden, so the iframe must not swallow taps -
360
+ they belong to the skin's gesture layer stacked above it. */
361
+ pointer-events: none;
362
+ }
363
+
364
+ .overlay {
365
+ position: absolute;
366
+ inset: 0;
367
+ display: flex;
368
+ flex-direction: column;
369
+ align-items: center;
370
+ justify-content: center;
371
+ gap: 1.6rem;
372
+ background: #000;
373
+ font-size: 1.4rem;
374
+ color: rgba(255, 255, 255, 0.8);
375
+ z-index: 30;
376
+ }
377
+
378
+ .login-button {
379
+ padding: 0.8rem 2rem;
380
+ background: #e50914;
381
+ color: #fff;
382
+ border: none;
383
+ border-radius: 0.4rem;
384
+ font-size: 1.4rem;
385
+ font-weight: 600;
386
+ cursor: pointer;
387
+
388
+ &:hover {
389
+ background: #c11119;
390
+ }
391
+ }
392
+ `,ou={cr:Mc,nf:({url:e})=>{let[t,n]=R(null),[r,i]=R(null),[a,o]=R(!0),[s,c]=R(!1),[l,u]=R(),[d,f]=R(null),[p,h]=R(0);F(()=>{if(!t)return;let e=!1;return(async()=>{for(let n=0;!e;n++)try{let n=await m({iframe:t,domains:$l,cookies:`native`});if(e)return;i(n);return}catch(t){if(e)return;if(!_()){u(`Netflix playback currently needs the FKN browser extension.`),o(!1);return}if(n>=4){console.error(`Failed to attach Netflix frame`,t),u(t instanceof Error?t.message:`Failed to load player`),o(!1);return}await new Promise(e=>setTimeout(e,300*(n+1)))}})(),()=>{e=!0}},[t]),F(()=>{if(!r)return;let t=!1,n=()=>t;return o(!0),u(void 0),c(!1),f(null),(async()=>{if(await r.goto(e,{waitUntil:`load`}),await nu(()=>r.addStyleTag({content:tu})),t)return;o(!1);let i=await ru(r);if(t)return;if(!i){c(!0);return}let a=await iu(r,n);!t&&a&&f(a)})().catch(e=>{t||(console.error(`Failed to load Netflix player`,e),u(e?.message??`Failed to load player`),o(!1))}),()=>{t=!0}},[r,e,p]);let g=N(()=>{let e=globalThis.open(eu,`_blank`,`width=500,height=700`);if(!e)return;let t=setInterval(()=>{e.closed&&(clearInterval(t),h(e=>e+1))},500)},[]);return V(`div`,{css:au,children:[L(Ql,{remote:d,frame:r,children:L(`iframe`,{ref:n,className:`nf-frame`,referrerPolicy:`no-referrer`,allow:`encrypted-media; autoplay; fullscreen;`})}),(s||l||a)&&V(`div`,{className:`overlay`,children:[s&&V(ne,{children:[`Sign in to Netflix to watch.`,L(`button`,{className:`login-button`,onClick:g,children:`Open Netflix Login Page`})]}),l&&!s&&l,a&&!l&&!s&&`Loading Netflix player...`]})]})},amazon:bs},su=e=>ou[e];ue(),v.onUpdateTaken(()=>{});var cu=new URLSearchParams(globalThis.location.search),lu=cu.get(`mediaUri`),uu=cu.get(`episodeUri`),du=cu.get(`sourceUri`),fu=cu.get(`url`),pu=s(cu),mu=du?e(du).origin:void 0,hu=mu?su(mu):void 0,gu=mu===`cr`&&fu&&!_()?xt(fu,pu):void 0;ie(L(()=>{let[e,t]=R();return F(()=>c(t),[]),!lu||!uu||!du||!fu||!hu?L(`div`,{children:`Unsupported or missing parameters`}):L(hu,{url:fu,mediaUri:lu,episodeUri:uu,sourceUri:du,title:e,triedRelays:pu,unlistedRelays:gu})},{}),document.getElementById(`app`));