@bazza-ui/react 0.1.0-canary.3 → 0.1.0-canary.4
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.
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/chunk-BGJJC6GX.cjs.map +1 -1
- package/dist/chunk-FWWOE2SW.cjs.map +1 -1
- package/dist/chunk-JSPKF52O.cjs.map +1 -1
- package/dist/chunk-M4G6J7DP.cjs.map +1 -1
- package/dist/combobox/index.cjs.map +1 -1
- package/dist/context-menu/index.cjs.map +1 -1
- package/dist/dropdown-menu/index.cjs.map +1 -1
- package/dist/internal/listbox/index.cjs.map +1 -1
- package/dist/internal/popup-menu/index.cjs.map +1 -1
- package/dist/select/index.cjs.map +1 -1
- package/dist/video-player/index.cjs +2 -2
- package/dist/video-player/index.cjs.map +1 -1
- package/dist/video-player/index.d.cts +4 -0
- package/dist/video-player/index.d.ts +4 -0
- package/dist/video-player/index.js +2 -2
- package/dist/video-player/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var _react = require('react'); var
|
|
2
|
-
`),o=a.length>0,l={active:o,cueText:r,cues:a},u={ref:n,"aria-live":"polite","aria-atomic":!0,role:"status",style:{pointerEvents:"none"},"data-active":o||void 0};return i?i(u,l):s?_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:s}):_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:r})});var er=Ie.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("CaptionsButton"),a=t.registeredTracks.length>0,r=t.activeTextTrack!==null,o={active:r,available:a,trackCount:t.registeredTracks.length},l=Ie.useCallback(f=>{if(_optionalChain([s, 'optionalCall', _2 => _2(f)]),!f.defaultPrevented){if(r)t.setTextTrack(null);else if(t.registeredTracks.length>0){let y=t.registeredTracks[0];_optionalChain([y, 'optionalAccess', _3 => _3.textTrack])&&t.setTextTrack(y.textTrack)}}},[s,t,r]),u={ref:n,type:"button","aria-label":r?"Disable captions":"Enable captions","aria-pressed":r,disabled:!a,"data-active":r||void 0,"data-available":a||void 0,onClick:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...c})});var tr=ie.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("CaptionsMenu"),a={registeredTracks:t.registeredTracks,activeTextTrack:t.activeTextTrack},r={ref:n,role:"menu","aria-label":"Captions","data-active":t.activeTextTrack!==null||void 0};return i?i(r,a):_jsxruntime.jsx.call(void 0, "div",{...r,...c,children:_nullishCoalesce(s, () => (_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, De,{track:null,children:"Off"}),t.registeredTracks.map(o=>_jsxruntime.jsx.call(void 0, De,{track:o.textTrack,children:o.label},o.id))]})))})}),De=ie.forwardRef(function(e,n){let{track:i,onClick:s,children:c,...t}=e,a=P("CaptionsMenuItem"),r=a.activeTextTrack===i,o=ie.useCallback(l=>{_optionalChain([s, 'optionalCall', _4 => _4(l)]),l.defaultPrevented||a.setTextTrack(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:c})});var Oe=(r=>(r.open="data-open",r.closed="data-closed",r.idle="data-idle",r.playing="data-playing",r.paused="data-paused",r.ended="data-ended",r.startingStyle="data-starting-style",r.endingStyle="data-ending-style",r))(Oe||{});function Xr(d){let e=[...d.getAnimations(),...Array.from(d.querySelectorAll("*")).flatMap(n=>n.getAnimations())];return e.length===0?Promise.resolve():Promise.all(e.map(n=>n.finished)).then(()=>{}).catch(()=>{})}function j(d){let{open:e,keepMounted:n=!1}=d,[i,s]=_.useState(e||n),[c,t]=_.useState(e?"starting":void 0),a=_.useRef(null),r=_.useRef(!1);return _.useEffect(()=>{if(e){r.current=!1,s(!0),t("starting");let o=requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(void 0)})});return()=>cancelAnimationFrame(o)}},[e]),_.useEffect(()=>{if(!e&&i&&!r.current){t("ending");let o=a.current;if(!o){t(void 0),n||s(!1);return}r.current=!0;let l=requestAnimationFrame(()=>{requestAnimationFrame(()=>{Xr(o).then(()=>{r.current&&(r.current=!1,t(void 0),n||s(!1))})})});return()=>{cancelAnimationFrame(l)}}},[e,i,n]),_.useEffect(()=>{n&&!i&&!e&&s(!0)},[n,i,e]),{mounted:i||n,transitionStatus:c,elementRef:a}}var rr=se.forwardRef(function(e,n){let{idleTimeout:i,keepMounted:s=!1,render:c,children:t,...a}=e,r=P("Controls"),l=(_nullishCoalesce(i, () => (r.idleTimeout)))===0||!r.idle,{mounted:u,transitionStatus:f,elementRef:y}=j({open:l,keepMounted:s}),R=se.useCallback(V=>{y.current=V,typeof n=="function"?n(V):n&&(n.current=V)},[n,y]),{onClick:g,...m}=a,x=se.useCallback(V=>{V.stopPropagation(),_optionalChain([g, 'optionalCall', _5 => _5(V)])},[g]),v={open:l,idle:r.idle,playing:r.playing,paused:r.paused,ended:r.ended},b={ref:R,onClick:x,"data-open":l||void 0,"data-closed":!l||void 0,"data-idle":r.idle||void 0,"data-playing":r.playing||void 0,"data-paused":r.paused||void 0,"data-ended":r.ended||void 0,"data-starting-style":f==="starting"||void 0,"data-ending-style":f==="ending"||void 0};return u?c?c(b,v):_jsxruntime.jsx.call(void 0, "div",{...b,...m,children:t}):null});var nr=G.forwardRef(function(e,n){let{render:i,onClick:s,children:c,...t}=e,a=P("FullscreenButton"),[r,o]=G.useState(!1);G.useEffect(()=>{o("fullscreenEnabled"in document&&document.fullscreenEnabled)},[]);let l=G.useCallback(y=>{_optionalChain([s, 'optionalCall', _6 => _6(y)]),y.defaultPrevented||a.toggleFullscreen()},[s,a]),u={fullscreen:a.fullscreen,supported:r},f={ref:n,type:"button","aria-label":a.fullscreen?"Exit fullscreen":"Enter fullscreen","aria-pressed":a.fullscreen,disabled:!r,"data-fullscreen":a.fullscreen||void 0,"data-supported":r||void 0,onClick:l};return i?i(f,u):_jsxruntime.jsx.call(void 0, "button",{...f,...t,children:c})});var or=Ae.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("MuteButton"),a={muted:t.muted,volume:t.volume},r=Ae.useCallback(m=>{_optionalChain([s, 'optionalCall', _7 => _7(m)]),m.defaultPrevented||t.toggleMute()},[s,t]),o=t.volume,l=t.muted,u=o===0||l,f=o>0&&!l,y=!l&&o>0&&o<.5,R=!l&&o>=.5,g={ref:n,type:"button","aria-label":t.muted?"Unmute":"Mute","aria-pressed":t.muted,"data-muted":l||void 0,"data-volume-off":u||void 0,"data-volume-on":f||void 0,"data-volume-low":y||void 0,"data-volume-high":R||void 0,onClick:r};return i?i(g,a):_jsxruntime.jsx.call(void 0, "button",{...g,...c})});var Fe=(u=>(u.open="data-open",u.closed="data-closed",u.playing="data-playing",u.paused="data-paused",u.ended="data-ended",u.waiting="data-waiting",u.seeking="data-seeking",u.fullscreen="data-fullscreen",u.pip="data-pip",u.startingStyle="data-starting-style",u.endingStyle="data-ending-style",u))(Fe||{});var ar=le.forwardRef(function(e,n){let{idleTimeout:i,keepMounted:s=!1,render:c,onClick:t,children:a,...r}=e,o=P("Overlay"),u=(_nullishCoalesce(i, () => (o.idleTimeout)))===0||!o.idle,{mounted:f,transitionStatus:y,elementRef:R}=j({open:u,keepMounted:s}),g=le.useCallback(b=>{R.current=b,typeof n=="function"?n(b):n&&(n.current=b)},[n,R]),m=le.useCallback(b=>{_optionalChain([t, 'optionalCall', _8 => _8(b)]),b.defaultPrevented||o.toggle()},[t,o]),x={playing:o.playing,paused:o.paused,ended:o.ended,waiting:o.waiting,seeking:o.seeking,fullscreen:o.fullscreen,pictureInPicture:o.pictureInPicture,open:u},v={ref:g,onClick:m,"data-playing":o.playing||void 0,"data-paused":o.paused||void 0,"data-ended":o.ended||void 0,"data-waiting":o.waiting||void 0,"data-seeking":o.seeking||void 0,"data-fullscreen":o.fullscreen||void 0,"data-pip":o.pictureInPicture||void 0,"data-open":u||void 0,"data-closed":!u||void 0,"data-starting-style":y==="starting"||void 0,"data-ending-style":y==="ending"||void 0};return f?c?c(v,x):_jsxruntime.jsx.call(void 0, "div",{...v,...r,children:a}):null});var ir=z.forwardRef(function(e,n){let{render:i,onClick:s,...c}=e,t=P("PictureInPictureButton"),[a,r]=z.useState(!1);z.useEffect(()=>{r("pictureInPictureEnabled"in document&&document.pictureInPictureEnabled)},[]);let o={pictureInPicture:t.pictureInPicture,supported:a},l=z.useCallback(f=>{_optionalChain([s, 'optionalCall', _9 => _9(f)]),f.defaultPrevented||t.togglePictureInPicture()},[s,t]),u={ref:n,type:"button","aria-label":t.pictureInPicture?"Exit picture-in-picture":"Enter picture-in-picture","aria-pressed":t.pictureInPicture,disabled:!a,"data-pip":t.pictureInPicture||void 0,"data-supported":a||void 0,onClick:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...c})});var sr=We.forwardRef(function(e,n){let{render:i,onClick:s,children:c,...t}=e,a=P("PlayButton"),r=We.useCallback(u=>{_optionalChain([s, 'optionalCall', _10 => _10(u)]),u.defaultPrevented||a.toggle()},[s,a]),o={playing:a.playing,paused:a.paused,ended:a.ended,waiting:a.waiting},l={ref:n,type:"button","aria-label":a.playing?"Pause":"Play","data-playing":a.playing||void 0,"data-paused":a.paused||void 0,"data-ended":a.ended||void 0,"data-waiting":a.waiting||void 0,onClick:r};return i?i(l,o):_jsxruntime.jsx.call(void 0, "button",{...l,...t,children:c})});var tn=[.25,.5,.75,1,1.25,1.5,1.75,2],lr=Qe.forwardRef(function(e,n){let{rates:i=tn,render:s,onClick:c,children:t,...a}=e,r=P("PlaybackRateButton"),o={playbackRate:r.playbackRate,rates:i},l=Qe.useCallback(f=>{if(_optionalChain([c, 'optionalCall', _11 => _11(f)]),!f.defaultPrevented){let R=(i.indexOf(r.playbackRate)+1)%i.length,g=_nullishCoalesce(_nullishCoalesce(i[R], () => (i[0])), () => (r.playbackRate));r.setPlaybackRate(g)}},[c,r,i]),u={ref:n,type:"button","aria-label":`Playback speed: ${r.playbackRate}x`,"data-rate":r.playbackRate,onClick:l};return s?s(u,o):_jsxruntime.jsx.call(void 0, "button",{...u,...a,children:_nullishCoalesce(t, () => (`${r.playbackRate}x`))})});var nn=[.25,.5,.75,1,1.25,1.5,1.75,2],ur=ue.forwardRef(function(e,n){let{rates:i=nn,render:s,children:c,...t}=e,a=P("PlaybackRateMenu"),r={playbackRate:a.playbackRate,rates:i},o={ref:n,role:"menu","aria-label":"Playback speed","data-rate":a.playbackRate};return s?s(o,r):_jsxruntime.jsx.call(void 0, "div",{...o,...t,children:_nullishCoalesce(c, () => (i.map(l=>_jsxruntime.jsx.call(void 0, st,{rate:l},l))))})}),st=ue.forwardRef(function(e,n){let{rate:i,onClick:s,children:c,...t}=e,a=P("PlaybackRateMenuItem"),r=a.playbackRate===i,o=ue.useCallback(l=>{_optionalChain([s, 'optionalCall', _12 => _12(l)]),l.defaultPrevented||a.setPlaybackRate(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:_nullishCoalesce(c, () => (`${i}x`))})});var _reactdom = require('react-dom'); var Pr = _interopRequireWildcard(_reactdom);function cr(d){let{children:e,container:n}=d,[i,s]=$e.useState(!1);if($e.useEffect(()=>(s(!0),()=>s(!1)),[]),!i)return null;let c=_nullishCoalesce(n, () => ((typeof document<"u"?document.body:null)));return c?_reactdom.createPortal.call(void 0, e,c):null}var dr=Ne.forwardRef(function(e,n){let{keepMounted:i=!1,render:s,children:c,...t}=e,a=P("Poster"),r=!a.canPlay,o=a.canPlay,{mounted:l,transitionStatus:u,elementRef:f}=j({open:r,keepMounted:i}),y=an(n,f),R={loading:r,loaded:o,transitionStatus:u},g={ref:y,"aria-hidden":!0,"data-loading":r||void 0,"data-loaded":o||void 0,"data-starting-style":u==="starting"||void 0,"data-ending-style":u==="ending"||void 0};return l?s?s(g,R):_jsxruntime.jsx.call(void 0, "div",{...g,...t,children:c}):null});function an(...d){return Ne.useCallback(e=>{for(let n of d)typeof n=="function"?n(e):n!=null&&(n.current=e)},d)}var pr=ce.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("QualityMenu"),a={qualities:t.qualities,activeQuality:t.activeQuality},r={ref:n,role:"menu","aria-label":"Video quality","data-quality":_nullishCoalesce(_optionalChain([t, 'access', _13 => _13.activeQuality, 'optionalAccess', _14 => _14.label]), () => (void 0))};return i?i(r,a):_jsxruntime.jsx.call(void 0, "div",{...r,...c,children:_nullishCoalesce(s, () => (t.qualities.map(o=>_jsxruntime.jsx.call(void 0, ut,{quality:o,children:o.label},o.label))))})}),ut=ce.forwardRef(function(e,n){let{quality:i,onClick:s,children:c,...t}=e,a=P("QualityMenuItem"),r=_optionalChain([a, 'access', _15 => _15.activeQuality, 'optionalAccess', _16 => _16.label])===i.label,o=ce.useCallback(l=>{_optionalChain([s, 'optionalCall', _17 => _17(l)]),l.defaultPrevented||a.setQuality(i)},[s,a,i]);return _jsxruntime.jsx.call(void 0, "button",{ref:n,type:"button",role:"menuitemradio","aria-checked":r,"data-active":r||void 0,...t,onClick:o,children:c})});var _e=(o=>(o.playing="data-playing",o.paused="data-paused",o.ended="data-ended",o.waiting="data-waiting",o.seeking="data-seeking",o.fullscreen="data-fullscreen",o.pip="data-pip",o.muted="data-muted",o.idle="data-idle",o))(_e||{});function fr(d,e){let n=ne(),i=je.useRef(n);i.current=n,je.useEffect(()=>{if(e==="none")return;let s=t=>{let a=t.target;if(a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)return;let r=i.current;switch(t.key){case" ":t.preventDefault(),r.toggle();break;case"f":case"F":t.preventDefault(),r.toggleFullscreen();break;case"ArrowUp":t.preventDefault(),r.setVolume(Math.min(r.volume+.1,1));break;case"ArrowDown":t.preventDefault(),r.setVolume(Math.max(r.volume-.1,0));break;case"ArrowRight":t.preventDefault(),r.seek(Math.min(r.currentTime+5,r.duration));break;case"ArrowLeft":t.preventDefault(),r.seek(Math.max(r.currentTime-5,0));break;default:return}r.resetIdle()};if(e==="global")return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s);let c=d.current;if(c)return c.addEventListener("keydown",s),()=>c.removeEventListener("keydown",s)},[e,d])}function Ue(d,e,n){let[i,s]=p.useState(e),c=d!==void 0,t=c?d:i,a=p.useCallback(r=>{let o=typeof r=="function"?r(t):r;c||s(o),_optionalChain([n, 'optionalCall', _18 => _18(o)])},[c,t,n]);return[t,a]}function ln({rootRef:d,videoRef:e,actionsRef:n,defaultPlaying:i=!1,defaultVolume:s=1,defaultMuted:c=!1,defaultPlaybackRate:t=1,playing:a,onPlayingChange:r,volume:o,onVolumeChange:l,muted:u,onMutedChange:f,playbackRate:y,onPlaybackRateChange:R,currentTime:g,onCurrentTimeChange:m,idleTimeout:x=3e3,preventIdleWhenPaused:v=!1,idle:b,onIdleChange:V,onEnded:C,onWaiting:B,onSeeking:D,onSeeked:q,onFullscreenChange:K,onPictureInPictureChange:T,children:W}){let O=p.useRef(1),[E,H]=p.useState("paused"),[Y,$]=p.useState(i?"play":"pause");p.useEffect(()=>{a!==void 0&&($(a?"play":"pause"),E!=="waiting"&&H(a?"playing":"paused"))},[a,E]);let[h,A]=Ue(o,s,l),[X,ae]=Ue(u,c,f),[fe,pt]=Ue(y,t,R),[Dr,Z]=Ue(b,!0,V),ee=p.useRef(null),me=p.useCallback(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),ft=p.useCallback(()=>{x!==0&&(me(),ee.current=setTimeout(()=>{Z(!0)},x))},[x,me,Z]),mt=p.useCallback(()=>{Z(!1),ft()},[Z,ft]),Pt=p.useCallback(()=>{me(),Z(!0)},[me,Z]);p.useEffect(()=>(x>0&&(ee.current=setTimeout(()=>{Z(!0)},x)),()=>{ee.current&&clearTimeout(ee.current)}),[]);let Rt=v&&E!=="playing"?!1:Dr,[yt,St]=p.useState(0),[Pe,bt]=p.useState(0),[kt,Or]=p.useState(null),[Re,Ar]=p.useState(null),[gt,Fr]=p.useState(!1),[vt,Tt]=p.useState(!1),[ye,Wr]=p.useState(!1),[Se,xt]=p.useState(!1),[ht,ot]=p.useState([]),[te,Qr]=p.useState(null),[Ct,be]=p.useState([]),[Mt,hn]=p.useState([]),[Et,$r]=p.useState(null);p.useEffect(()=>{g!==void 0&&e.current&&(e.current.currentTime=g)},[g,e]),p.useEffect(()=>{let k=()=>{let M=document.fullscreenElement===d.current;Wr(M),_optionalChain([K, 'optionalCall', _19 => _19(M)])};return document.addEventListener("fullscreenchange",k),()=>document.removeEventListener("fullscreenchange",k)},[K,d]),p.useEffect(()=>{let k=e.current;if(!k)return;let M=()=>{xt(!0),_optionalChain([T, 'optionalCall', _20 => _20(!0)])},F=()=>{xt(!1),_optionalChain([T, 'optionalCall', _21 => _21(!1)])};return k.addEventListener("enterpictureinpicture",M),k.addEventListener("leavepictureinpicture",F),()=>{k.removeEventListener("enterpictureinpicture",M),k.removeEventListener("leavepictureinpicture",F)}},[T,e]);let ke=p.useCallback(async()=>{e.current&&($("play"),await e.current.play(),H("playing"),_optionalChain([r, 'optionalCall', _22 => _22(!0)]))},[e,r]),ge=p.useCallback(()=>{e.current&&($("pause"),e.current.pause(),H("paused"),_optionalChain([r, 'optionalCall', _23 => _23(!1)]))},[e,r]),ve=p.useCallback(async()=>{E==="playing"?ge():await ke()},[E,ke,ge]),Te=p.useCallback(k=>{e.current&&(e.current.currentTime=k,St(k),_optionalChain([m, 'optionalCall', _24 => _24(k)]))},[m,e]),xe=p.useCallback(k=>{let M=Math.max(0,Math.min(1,k));e.current&&(e.current.volume=M),A(M)},[A,e]),Vt=p.useCallback(()=>{if(!(X||h===0))O.current=h,e.current&&(e.current.muted=!0),ae(!0);else{let M=O.current>0?O.current:1;e.current&&(e.current.volume=M,e.current.muted=!1),A(M),ae(!1)}},[X,h,ae,A,e]),he=p.useCallback(async()=>{_optionalChain([d, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.requestFullscreen])&&await d.current.requestFullscreen()},[d]),Ce=p.useCallback(async()=>{document.exitFullscreen&&await document.exitFullscreen()},[]),Me=p.useCallback(async()=>{ye?await Ce():await he()},[ye,he,Ce]),Ee=p.useCallback(async()=>{_optionalChain([e, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.requestPictureInPicture])&&await e.current.requestPictureInPicture()},[e]),Ve=p.useCallback(async()=>{document.pictureInPictureElement&&await document.exitPictureInPicture()},[]),Bt=p.useCallback(async()=>{Se?await Ve():await Ee()},[Se,Ee,Ve]),wt=p.useCallback(k=>{e.current&&(e.current.playbackRate=k),pt(k)},[pt,e]),Lt=p.useCallback(k=>{if(e.current){for(let M=0;M<e.current.textTracks.length;M++){let F=e.current.textTracks[M];F&&(F.mode="disabled")}k&&(k.mode="hidden")}Qr(k),be([])},[e]),It=p.useCallback(k=>{$r(k)},[]),Ht=p.useCallback(k=>{ot(M=>M.some(F=>F.id===k.id)?M:[...M,k])},[]),Dt=p.useCallback(k=>{ot(M=>M.filter(F=>F.id!==k))},[]),Ot=p.useCallback((k,M)=>{ot(F=>F.map(re=>re.id===k?{...re,textTrack:M}:re))},[]);p.useEffect(()=>{if(!te){be([]);return}let k=()=>{let M=te.activeCues;if(!M){be([]);return}let F=[];for(let re=0;re<M.length;re++){let Yt=M[re];Yt instanceof VTTCue&&F.push(Yt)}be(F)};return k(),te.addEventListener("cuechange",k),()=>{te.removeEventListener("cuechange",k)}},[te]),p.useImperativeHandle(n,()=>({toggle:ve,seek:Te,setVolume:xe,toggleFullscreen:Me}),[ve,Te,xe,Me]);let At=p.useCallback(()=>{if(e.current){let k=e.current.currentTime;St(k),_optionalChain([m, 'optionalCall', _29 => _29(k)])}},[m,e]),Ft=p.useCallback(()=>{e.current&&bt(e.current.duration)},[e]),Wt=p.useCallback(()=>{e.current&&Or(e.current.buffered)},[e]),Qt=p.useCallback(()=>{$("play"),H("playing"),_optionalChain([r, 'optionalCall', _30 => _30(!0)])},[r]),$t=p.useCallback(()=>{E!=="ended"&&(H("paused"),_optionalChain([r, 'optionalCall', _31 => _31(!1)]))},[E,r]),Nt=p.useCallback(()=>{$("pause"),H("ended"),_optionalChain([r, 'optionalCall', _32 => _32(!1)]),_optionalChain([C, 'optionalCall', _33 => _33()])},[r,C]),_t=p.useCallback(()=>{H("waiting"),_optionalChain([B, 'optionalCall', _34 => _34()])},[B]),jt=p.useCallback(()=>{if(E==="waiting"){let k=Y==="play"?"playing":"paused";H(k),_optionalChain([r, 'optionalCall', _35 => _35(k==="playing")])}Fr(!0)},[E,Y,r]),Ut=p.useCallback(()=>{Tt(!0),E==="ended"&&H("paused"),_optionalChain([D, 'optionalCall', _36 => _36()])},[E,D]),qt=p.useCallback(()=>{if(Tt(!1),e.current){let{currentTime:k,duration:M}=e.current;M>0&&M-k<.01&&H("ended")}_optionalChain([q, 'optionalCall', _37 => _37()])},[q,e]),Kt=p.useCallback(()=>{e.current&&(A(e.current.volume),ae(e.current.muted))},[A,ae,e]),Xt=p.useCallback(()=>{e.current&&bt(e.current.duration)},[e]),Nr=p.useMemo(()=>({playbackStatus:E,playbackIntent:Y,playing:E==="playing",paused:E==="paused",ended:E==="ended",waiting:E==="waiting",seeking:vt,canPlay:gt,currentTime:yt,duration:Pe,buffered:kt,hoverTime:Re,hoverProgress:Re!==null&&Pe>0?Re/Pe*100:null,volume:h,muted:X,fullscreen:ye,pictureInPicture:Se,idle:Rt,idleTimeout:x,preventIdleWhenPaused:v,registeredTracks:ht,activeTextTrack:te,activeCues:Ct,playbackRate:fe,qualities:Mt,activeQuality:Et,videoRef:e,rootRef:d,play:ke,pause:ge,toggle:ve,seek:Te,setVolume:xe,toggleMute:Vt,enterFullscreen:he,exitFullscreen:Ce,toggleFullscreen:Me,enterPictureInPicture:Ee,exitPictureInPicture:Ve,togglePictureInPicture:Bt,setPlaybackRate:wt,setTextTrack:Lt,setQuality:It,registerTrack:Ht,unregisterTrack:Dt,updateTrackRef:Ot,resetIdle:mt,setHoverTime:Ar,_handlers:{onTimeUpdate:At,onDurationChange:Ft,onProgress:Wt,onPlay:Qt,onPause:$t,onEnded:Nt,onWaiting:_t,onCanPlay:jt,onSeeking:Ut,onSeeked:qt,onVolumeChange:Kt,onLoadedMetadata:Xt,onRootMouseLeave:Pt}}),[E,Y,vt,gt,yt,Pe,kt,Re,h,X,ye,Se,Rt,x,v,ht,te,Ct,fe,Mt,Et,e,d,ke,ge,ve,Te,xe,Vt,he,Ce,Me,Ee,Ve,Bt,wt,Lt,It,Ht,Dt,Ot,mt,At,Ft,Wt,Qt,$t,Nt,_t,jt,Ut,qt,Kt,Xt,Pt]);return _jsxruntime.jsx.call(void 0, at.Provider,{value:Nr,children:W})}var mr=p.forwardRef(function(e,n){let{actionsRef:i,keyboardShortcuts:s="focused",defaultPlaying:c,defaultVolume:t,defaultMuted:a,defaultPlaybackRate:r,playing:o,onPlayingChange:l,volume:u,onVolumeChange:f,muted:y,onMutedChange:R,playbackRate:g,onPlaybackRateChange:m,currentTime:x,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:V,hideCursorWhenIdle:C="fullscreen",idle:B,onIdleChange:D,onEnded:q,onWaiting:K,onSeeking:T,onSeeked:W,onFullscreenChange:O,onPictureInPictureChange:E,children:H,...Y}=e,$=p.useRef(null),h=p.useRef(null);return _jsxruntime.jsx.call(void 0, ln,{actionsRef:i,defaultPlaying:c,defaultVolume:t,defaultMuted:a,defaultPlaybackRate:r,playing:o,onPlayingChange:l,volume:u,onVolumeChange:f,muted:y,onMutedChange:R,playbackRate:g,onPlaybackRateChange:m,currentTime:x,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:V,idle:B,onIdleChange:D,onEnded:q,onWaiting:K,onSeeking:T,onSeeked:W,onFullscreenChange:O,onPictureInPictureChange:E,rootRef:$,videoRef:h,children:_jsxruntime.jsx.call(void 0, un,{ref:n,rootRef:$,keyboardShortcuts:s,hideCursorWhenIdle:C,...Y,children:H})})}),un=p.forwardRef(function({rootRef:e,keyboardShortcuts:n,hideCursorWhenIdle:i,children:s,className:c,style:t,...a},r){let o=ne(),l=cn(r,e),u=p.useRef(null);fr(e,n);let f=p.useCallback(b=>{let{clientX:V,clientY:C}=b,B=u.current;B&&B.x===V&&B.y===C||(u.current={x:V,y:C},o.resetIdle())},[o]),y=p.useCallback(b=>{let{clientX:V,clientY:C}=b,B=u.current;B&&B.x===V&&B.y===C||(u.current={x:V,y:C},o.resetIdle())},[o]),R=p.useCallback(()=>{o._handlers.onRootMouseLeave()},[o._handlers]),g=p.useCallback(()=>{o.resetIdle()},[o]),m={"data-playing":o.playing||void 0,"data-paused":o.paused||void 0,"data-ended":o.ended||void 0,"data-waiting":o.waiting||void 0,"data-seeking":o.seeking||void 0,"data-fullscreen":o.fullscreen||void 0,"data-pip":o.pictureInPicture||void 0,"data-muted":o.muted||void 0,"data-idle":o.idle||void 0},x=i!==!1&&o.idle&&(i==="always"||i==="fullscreen"&&o.fullscreen),v=p.useId();return _jsxruntime.jsxs.call(void 0, "div",{ref:l,tabIndex:n==="focused"?0:void 0,className:c,style:t,"data-video-player-scope":v,...m,...a,onMouseMove:f,onMouseEnter:y,onMouseLeave:R,onClick:g,children:[x&&_jsxruntime.jsx.call(void 0, "style",{children:`[data-video-player-scope="${v}"], [data-video-player-scope="${v}"] * { cursor: none !important; }`}),s]})});function cn(...d){return p.useCallback(e=>{for(let n of d)typeof n=="function"?n(e):n!=null&&(n.current=e)},d)}var Ke=(t=>(t.progress="--seek-progress",t.buffered="--seek-buffered",t.currentTime="--seek-current-time",t.duration="--seek-duration",t.hoverProgress="--seek-hover-progress",t.hoverTime="--seek-hover-time",t))(Ke||{});var Xe=(s=>(s.seeking="data-seeking",s.hovering="data-hovering",s.pressing="data-pressing",s.dragging="data-dragging",s))(Xe||{});var _slider = require('@base-ui/react/slider');var _react2 = require('@floating-ui/react');var Ye=(s=>(s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Ye||{});var ct=S.createContext(null);function Rr(d){let e=S.useContext(ct);if(!e)throw new Error(`${d} must be used within SeekSlider`);return e}var yr=S.forwardRef(function(e,n){let{render:i,children:s,onPointerMove:c,onPointerLeave:t,onPointerDown:a,onValueCommitted:r,...o}=e,l=P("SeekSlider"),u=S.useRef(null),[f,y]=S.useState(null),[R,g]=S.useState(!1),[m,x]=S.useState(!1),v=S.useRef(!1);S.useEffect(()=>{if(!R)return;let h=()=>{g(!1),x(!1),v.current=!1};return window.addEventListener("pointerup",h),()=>window.removeEventListener("pointerup",h)},[R]);let b=l.duration>0?l.currentTime/l.duration*100:0,V=S.useCallback(h=>{let A=typeof h=="number"?h:h[0];A!==void 0&&(l.seek(A),l.resetIdle(),v.current&&x(!0))},[l]),C=S.useCallback(h=>{if(_optionalChain([c, 'optionalCall', _38 => _38(h)]),!u.current||l.duration===0)return;let A=u.current.getBoundingClientRect(),X=h.clientX-A.left,fe=Math.max(0,Math.min(1,X/A.width))*l.duration;l.setHoverTime(fe)},[c,l]),B=S.useCallback(h=>{_optionalChain([t, 'optionalCall', _39 => _39(h)]),l.setHoverTime(null)},[t,l]),D=S.useCallback(h=>{_optionalChain([a, 'optionalCall', _40 => _40(h)]),g(!0),v.current=!0},[a]),q=S.useCallback((h,A)=>{let X=typeof h=="number"?h:h[0];X!==void 0&&(_optionalChain([r, 'optionalCall', _41 => _41(X,A)]),g(!1),x(!1),v.current=!1)},[r]),K=S.useMemo(()=>{if(!l.buffered||l.buffered.length===0)return 0;for(let h=0;h<l.buffered.length;h++)if(l.buffered.start(h)<=l.currentTime&&l.currentTime<=l.buffered.end(h))return l.buffered.end(h);return l.buffered.end(0)},[l.buffered,l.currentTime]),T=l.duration>0?K/l.duration*100:0;S.useLayoutEffect(()=>{typeof n=="function"?n(u.current):n&&(n.current=u.current)});let W={currentTime:l.currentTime,duration:l.duration,progress:b,seeking:l.seeking,pressing:R,dragging:m,hoverTime:l.hoverTime,hoverProgress:l.hoverProgress},O=l.hoverProgress!==null,E=_nullishCoalesce(l.hoverProgress, () => (0)),H=S.useMemo(()=>({sliderRef:u,previewThumbElement:f,setPreviewThumbElement:y,hoverProgress:E,open:O}),[u,f,y,E,O]),Y={position:"relative","--seek-progress":`${b}%`,"--seek-buffered":`${T}%`,"--seek-current-time":l.currentTime,"--seek-duration":l.duration,"--seek-hover-progress":l.hoverProgress!==null?`${l.hoverProgress}%`:void 0,"--seek-hover-time":_nullishCoalesce(l.hoverTime, () => (void 0)),...o.style},$={"data-seeking":l.seeking||void 0,"data-hovering":l.hoverTime!==null||void 0,"data-pressing":R||void 0,"data-dragging":m||void 0,style:Y};return i?_jsxruntime.jsx.call(void 0, ct.Provider,{value:H,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:u,min:0,max:l.duration||100,step:.1,value:l.currentTime,onValueChange:V,onValueCommitted:q,onPointerMove:C,onPointerLeave:B,onPointerDown:D,"aria-label":"Seek",render:h=>i({...h,...$,style:{...h.style,...$.style}},W)})}):_jsxruntime.jsx.call(void 0, ct.Provider,{value:H,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:u,min:0,max:l.duration||100,step:.1,value:l.currentTime,onValueChange:V,onValueCommitted:q,onPointerMove:C,onPointerLeave:B,onPointerDown:D,"aria-label":"Seek",...$,...o,children:_nullishCoalesce(s, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{style:{position:"relative"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${T}%`}}),_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})})}),Sr=_slider.Slider.Control,br=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a={},r={position:"relative",...c},o={ref:n,style:r};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{render:l=>i({...l,...o},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:n,style:r,...t,children:s})}),kr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a=P("SeekSliderProgress"),o={progress:a.duration>0?a.currentTime/a.duration*100:0},l={height:"100%",...c},u={ref:n,style:l};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{render:f=>i({...f,...u,style:{...f.style,...l}},o)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:n,style:l,...t,children:s})}),gr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a={},r={ref:n,style:_nullishCoalesce(c, () => ({}))};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{render:o=>i({...o,...r,style:{...o.style,...c}},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:n,style:c,...t,children:s})}),vr=S.forwardRef(function(e,n){let{render:i,children:s,...c}=e,t=P("SeekSliderBuffered"),a=S.useMemo(()=>{if(!t.buffered||t.buffered.length===0)return 0;for(let f=0;f<t.buffered.length;f++)if(t.buffered.start(f)<=t.currentTime&&t.currentTime<=t.buffered.end(f))return t.buffered.end(f);return t.buffered.end(0)},[t.buffered,t.currentTime]),r=t.duration>0?a/t.duration*100:0,o={bufferedPercentage:r},l={position:"absolute",left:0,top:0,height:"100%",width:`${r}%`,...c.style},u={ref:n,style:l};return i?i(u,o):_jsxruntime.jsx.call(void 0, "div",{...u,...c,children:s})}),Tr=S.forwardRef(function(e,n){let{keepMounted:i=!1,render:s,children:c,...t}=e,a=P("SeekSliderPreviewThumb"),r=Rr("SeekSliderPreviewThumb"),o=a.hoverProgress!==null,l=S.useRef(0);a.hoverProgress!==null&&(l.current=a.hoverProgress);let u=_nullishCoalesce(a.hoverProgress, () => (l.current)),{mounted:f,transitionStatus:y,elementRef:R}=j({open:o,keepMounted:i}),g=S.useCallback(b=>{R.current=b,r.setPreviewThumbElement(b),typeof n=="function"?n(b):n&&(n.current=b)},[n,R,r]),m={open:o,transitionStatus:y,hoverProgress:u},x={position:"absolute",left:`${u}%`,transform:"translateX(-50%)",pointerEvents:"none",...t.style},v={ref:g,style:x,"data-open":o||void 0,"data-closed":!o||void 0,"data-starting-style":y==="starting"||void 0,"data-ending-style":y==="ending"||void 0};return f?s?s(v,m):_jsxruntime.jsx.call(void 0, "span",{...v,...t,children:c}):null}),xr=S.forwardRef(function(e,n){let{render:i,children:s,style:c,...t}=e,a=P("SeekSliderHover"),r=a.hoverProgress!==null,o=_nullishCoalesce(a.hoverProgress, () => (0)),l={hovering:r,hoverProgress:a.hoverProgress,hoverTime:a.hoverTime},u={position:"absolute",left:0,top:0,height:"100%",width:`${o}%`,pointerEvents:"none",...c},f={ref:n,style:u,"data-hovering":r||void 0};return i?i(f,l):_jsxruntime.jsx.call(void 0, "div",{...f,...t,children:s})});function Ge({children:d,container:e}){let n=P("SeekSliderPreviewTooltipPortal"),[i,s]=S.useState(!1);if(S.useEffect(()=>{s(!0)},[]),!i)return null;let c=_nullishCoalesce(_nullishCoalesce(e, () => (n.rootRef.current)), () => (document.body));return Pr.createPortal(d,c)}var ze=S.forwardRef(function(e,n){let{sideOffset:i=8,collisionPadding:s=0,collisionBoundary:c,keepMounted:t=!1,children:a,style:r,...o}=e,l=Rr("SeekSliderPreviewTooltipPositioner"),{previewThumbElement:u,open:f,hoverProgress:y}=l,[R,g]=S.useState(null),{refs:m,floatingStyles:x,update:v}=_react2.useFloating.call(void 0, {placement:"top",middleware:[_react2.offset.call(void 0, i),_react2.shift.call(void 0, {boundary:c,padding:s})]});S.useLayoutEffect(()=>{u&&m.setReference(u)},[u,m]),S.useEffect(()=>{if(f&&u&&R)return _react2.autoUpdate.call(void 0, u,R,v)},[f,u,R,v]),S.useLayoutEffect(()=>{f&&u&&R&&v()},[y,f,u,R,v]);let b=S.useCallback(C=>{m.setFloating(C),g(C),typeof n=="function"?n(C):n&&(n.current=C)},[m,n]);return(t||f)&&!!u?_jsxruntime.jsx.call(void 0, "div",{ref:b,style:{...x,...r},"data-seek-slider-preview-tooltip-positioner":!0,"data-open":f||void 0,"data-closed":!f||void 0,...o,children:a}):null}),Je=S.forwardRef(function(e,n){let{children:i,...s}=e;return _jsxruntime.jsx.call(void 0, "div",{ref:n,"data-seek-slider-preview-tooltip-popup":!0,...s,children:i})});function de({sideOffset:d,collisionPadding:e,collisionBoundary:n,keepMounted:i,container:s,children:c,...t}){return _jsxruntime.jsx.call(void 0, Ge,{container:s,children:_jsxruntime.jsx.call(void 0, ze,{sideOffset:d,collisionPadding:e,collisionBoundary:n,keepMounted:i,children:_jsxruntime.jsx.call(void 0, Je,{...t,children:c})})})}de.Portal=Ge;de.Positioner=ze;de.Popup=Je;var Ze=(i=>(i.loading="data-loading",i.ready="data-ready",i.error="data-error",i))(Ze||{});var hr=I.forwardRef(function(e,n){let{time:i,crossOrigin:s="anonymous",render:c,children:t,width:a,height:r,...o}=e,l=P("Thumbnail"),u=I.useRef(null),f=I.useRef(null),y=I.useRef(null),[R,g]=I.useState("idle"),[m,x]=I.useState({width:160,height:90}),v=i!==void 0?i:l.hoverTime,b=I.useMemo(()=>{let T=l.videoRef.current;return T?T.currentSrc||T.src:null},[l.videoRef]);I.useEffect(()=>{if(!b)return;let T=document.createElement("video");T.src=b,T.crossOrigin=s,T.preload="metadata",T.muted=!0,T.playsInline=!0;let W=()=>{x({width:T.videoWidth,height:T.videoHeight})},O=()=>{g("error")};return T.addEventListener("loadedmetadata",W),T.addEventListener("error",O),f.current=T,()=>{T.removeEventListener("loadedmetadata",W),T.removeEventListener("error",O),T.src="",f.current=null}},[b,s]),I.useEffect(()=>{let T=f.current,W=u.current;if(!T||!W||v===null||v===void 0||y.current!==null&&Math.abs(y.current-v)<.1)return;g("loading");let O=()=>{let E=W.getContext("2d");if(E)try{E.drawImage(T,0,0,W.width,W.height),y.current=v,g("ready")}catch (e2){g("error")}};return T.addEventListener("seeked",O,{once:!0}),T.currentTime=v,()=>{T.removeEventListener("seeked",O)}},[v]);let V=I.useCallback(T=>{u.current=T,typeof n=="function"?n(T):n&&(n.current=T)},[n]),C=m.width/m.height,B=_nullishCoalesce(a, () => (160)),D=_nullishCoalesce(r, () => (Math.round(B/C)));typeof B=="string"&&(B=160),typeof D=="string"&&(D=90);let q={loading:R==="loading",ready:R==="ready",error:R==="error",time:v,videoWidth:m.width,videoHeight:m.height},K={ref:V,width:B,height:D,"data-loading":R==="loading"||void 0,"data-ready":R==="ready"||void 0,"data-error":R==="error"||void 0};return c?c(K,q):_jsxruntime.jsx.call(void 0, "canvas",{...K,...o,children:t})});var et=(e=>(e.hovering="data-hovering",e))(et||{});var Cr=tt.forwardRef(function(e,n){let{format:i="current / duration",fixedWidth:s=!0,align:c="left",render:t,...a}=e,r=P("TimeDisplay"),o=tt.useRef(0);r.hoverTime!==null&&(o.current=r.hoverTime);let l=r.duration-r.currentTime,u=pe(r.currentTime),f=pe(r.duration),y=pe(l),R=r.hoverTime!==null?pe(r.hoverTime):pe(o.current),g={currentTime:r.currentTime,duration:r.duration,remaining:l,hoverTime:r.hoverTime,hovering:r.hoverTime!==null,formattedCurrent:u,formattedDuration:f,formattedRemaining:y,formattedHover:R},m=()=>{switch(i){case"current":return u;case"duration":return f;case"remaining":return`-${y}`;case"current / duration":return`${u} / ${f}`;case"current / remaining":return`${u} / -${y}`;case"hover":return R;default:return`${u} / ${f}`}},x=()=>{let b=bn(r.duration);switch(i){case"current":case"duration":case"hover":return b;case"remaining":return`-${b}`;case"current / duration":return`${b} / ${b}`;case"current / remaining":return`${b} / -${b}`;default:return`${b} / ${b}`}},v={ref:n,style:{position:s?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},"data-hovering":g.hovering||void 0};return t?t(v,g):_jsxruntime.jsx.call(void 0, "span",{ref:n,"data-hovering":g.hovering||void 0,...a,style:{position:s?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},children:s?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":!0,style:{visibility:"hidden"},children:x()}),_jsxruntime.jsx.call(void 0, "span",{style:Sn(c),children:m()})]}):m()})});function Sn(d){let e={position:"absolute"};switch(d){case"left":return{...e,left:0};case"right":return{...e,right:0};case"center":return{...e,left:"50%",transform:"translateX(-50%)"}}}function pe(d){if(!Number.isFinite(d)||Number.isNaN(d))return"0:00";let e=Math.floor(d/3600),n=Math.floor(d%3600/60),i=Math.floor(d%60);return e>0?`${e}:${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`:`${n}:${i.toString().padStart(2,"0")}`}function bn(d){if(!Number.isFinite(d)||Number.isNaN(d)||d<=0)return"0:00";let e=Math.floor(d/3600),n=Math.floor(d%3600/60);if(e>0){let s=String(e).length;return`${"0".repeat(s)}:00:00`}let i=String(n).length;return`${"0".repeat(i)}:00`}var Mr=N.forwardRef(function(e,n){let{kind:i="captions",src:s,label:c,srcLang:t,default:a,...r}=e,{registerTrack:o,unregisterTrack:l,updateTrackRef:u,setTextTrack:f}=P("Track"),y=N.useRef(null),R=N.useId(),g=N.useCallback(m=>{typeof n=="function"?n(m):n&&(n.current=m),y.current=m},[n]);return N.useEffect(()=>(o({id:R,kind:i,label:c,srcLang:t,src:s,textTrack:null}),()=>{l(R)}),[R,i,c,t,s,o,l]),N.useEffect(()=>{let m=y.current;if(!m)return;let x=()=>{m.track&&(m.track.mode="disabled",u(R,m.track),a&&f(m.track))};return m.track&&x(),m.addEventListener("load",x),()=>{m.removeEventListener("load",x)}},[R,a,u,f]),_jsxruntime.jsx.call(void 0, "track",{ref:g,kind:i,src:s,label:c,srcLang:t,default:a,...r})});var Er=oe.forwardRef(function(e,n){let{toggleOnClick:i=!0,onClick:s,...c}=e,t=P("Video"),a=oe.useRef(!1),r=oe.useCallback(u=>{typeof n=="function"?n(u):n&&(n.current=u),t.videoRef.current=u,u&&!a.current&&(a.current=!0,u.readyState>=1&&u.duration&&(t._handlers.onLoadedMetadata(),t._handlers.onDurationChange()),u.readyState>=3&&t._handlers.onCanPlay())},[n,t.videoRef,t._handlers]),o=oe.useCallback(u=>{_optionalChain([s, 'optionalCall', _42 => _42(u)]),!u.defaultPrevented&&i&&t.toggle()},[s,i,t]),l={"data-playing":t.playing||void 0,"data-paused":t.paused||void 0,"data-ended":t.ended||void 0,"data-waiting":t.waiting||void 0,"data-seeking":t.seeking||void 0};return _jsxruntime.jsx.call(void 0, "video",{ref:r,preload:"metadata",...l,...c,onClick:o,onTimeUpdate:t._handlers.onTimeUpdate,onDurationChange:t._handlers.onDurationChange,onProgress:t._handlers.onProgress,onPlay:t._handlers.onPlay,onPause:t._handlers.onPause,onEnded:t._handlers.onEnded,onWaiting:t._handlers.onWaiting,onCanPlay:t._handlers.onCanPlay,onSeeking:t._handlers.onSeeking,onSeeked:t._handlers.onSeeked,onVolumeChange:t._handlers.onVolumeChange,onLoadedMetadata:t._handlers.onLoadedMetadata})});var rt=(n=>(n.volume="--volume",n.volumePercentage="--volume-percentage",n))(rt||{});var nt=(s=>(s.muted="data-muted",s.volume="data-volume",s.pressing="data-pressing",s.dragging="data-dragging",s))(nt||{});var Vr=L.forwardRef(function(e,n){let{render:i,children:s,onPointerDown:c,...t}=e,a=P("VolumeSlider"),r=L.useRef(null),[o,l]=L.useState(!1),[u,f]=L.useState(!1),y=L.useRef(!1);L.useEffect(()=>{if(!o)return;let C=()=>{l(!1),f(!1),y.current=!1};return window.addEventListener("pointerup",C),()=>window.removeEventListener("pointerup",C)},[o]),L.useLayoutEffect(()=>{typeof n=="function"?n(r.current):n&&(n.current=r.current)});let R=a.volume*100,g={volume:a.volume,muted:a.muted,percentage:R,pressing:o,dragging:u},m=L.useCallback(C=>{let B=typeof C=="number"?C:C[0];if(B!==void 0){if(a.muted){let D=a.videoRef.current;D&&(D.muted=!1)}a.setVolume(B),a.resetIdle(),y.current&&f(!0)}},[a]),x=L.useCallback(C=>{_optionalChain([c, 'optionalCall', _43 => _43(C)]),l(!0),y.current=!0},[c]),v={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":o||void 0,"data-dragging":u||void 0},b={position:"relative","--volume":a.volume,"--volume-percentage":`${R}%`,...t.style},V={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":o||void 0,"data-dragging":u||void 0,style:b};return i?_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:r,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:x,"aria-label":"Volume",render:C=>i({...C,...V},g)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:r,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:x,"aria-label":"Volume",...v,...t,style:b,children:_nullishCoalesce(s, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{children:[_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})}),Br=_slider.Slider.Control,wr=L.forwardRef(function(e,n){let{style:i,...s}=e,c={position:"relative",...i};return _jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:n,style:c,...s})}),Lr=L.forwardRef(function(e,n){return _jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:n,...e})}),Ir=L.forwardRef(function(e,n){return _jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:n,...e})});exports.VideoPlayer = Hr; exports.useVideoPlayer = ne;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var _react = require('react'); var Ie = _interopRequireWildcard(_react); var He = _interopRequireWildcard(_react); var nr = _interopRequireWildcard(_react); var Oe = _interopRequireWildcard(_react); var ue = _interopRequireWildcard(_react); var ce = _interopRequireWildcard(_react); var q = _interopRequireWildcard(_react); var J = _interopRequireWildcard(_react); var Qe = _interopRequireWildcard(_react); var de = _interopRequireWildcard(_react); var Z = _interopRequireWildcard(_react); var Ne = _interopRequireWildcard(_react); var Ue = _interopRequireWildcard(_react); var pe = _interopRequireWildcard(_react); var _e = _interopRequireWildcard(_react); var je = _interopRequireWildcard(_react); var fe = _interopRequireWildcard(_react); var d = _interopRequireWildcard(_react); var Ke = _interopRequireWildcard(_react); var k = _interopRequireWildcard(_react); var H = _interopRequireWildcard(_react); var ot = _interopRequireWildcard(_react); var _ = _interopRequireWildcard(_react); var ie = _interopRequireWildcard(_react); var I = _interopRequireWildcard(_react);var lt=Ie.createContext(null);function R(c){let e=Ie.useContext(lt);if(!e)throw new Error(`<VideoPlayer.${c}> must be used within <VideoPlayer.Root>`);return e}function ae(){return R("useVideoPlayer")}var Qr={};_chunkM4G6J7DPcjs.a.call(void 0, Qr,{BufferedIndicator:()=>tr,Captions:()=>or,CaptionsButton:()=>ar,CaptionsDataAttributes:()=>De,CaptionsMenu:()=>ir,CaptionsMenuItem:()=>Fe,Controls:()=>sr,ControlsDataAttributes:()=>We,FullscreenButton:()=>lr,MuteButton:()=>ur,Overlay:()=>cr,OverlayDataAttributes:()=>$e,PictureInPictureButton:()=>dr,PlayButton:()=>pr,PlaybackRateButton:()=>fr,PlaybackRateMenu:()=>mr,PlaybackRateMenuItem:()=>ct,Portal:()=>Pr,Poster:()=>Rr,QualityMenu:()=>yr,QualityMenuItem:()=>pt,Root:()=>br,RootDataAttributes:()=>qe,SeekSlider:()=>Tr,SeekSliderBuffered:()=>Er,SeekSliderControl:()=>xr,SeekSliderCssVars:()=>Ge,SeekSliderDataAttributes:()=>ze,SeekSliderHover:()=>wr,SeekSliderPreviewThumb:()=>Vr,SeekSliderPreviewThumbDataAttributes:()=>Je,SeekSliderPreviewTooltip:()=>me,SeekSliderPreviewTooltipPopup:()=>tt,SeekSliderPreviewTooltipPortal:()=>Ze,SeekSliderPreviewTooltipPositioner:()=>et,SeekSliderProgress:()=>Cr,SeekSliderThumb:()=>Mr,SeekSliderTrack:()=>hr,Thumbnail:()=>Br,ThumbnailDataAttributes:()=>rt,TimeDisplay:()=>Lr,TimeDisplayDataAttributes:()=>nt,Track:()=>Ir,Video:()=>Hr,VolumeSlider:()=>Dr,VolumeSliderControl:()=>Or,VolumeSliderCssVars:()=>at,VolumeSliderDataAttributes:()=>it,VolumeSliderRange:()=>Fr,VolumeSliderThumb:()=>Wr,VolumeSliderTrack:()=>Ar,useTransitionStatus:()=>K,useVideoPlayer:()=>ae});var _jsxruntime = require('react/jsx-runtime');var tr=He.forwardRef(function(e,o){let{render:s,...l}=e,u=R("BufferedIndicator"),r=He.useMemo(()=>{if(!u.buffered||u.buffered.length===0)return 0;for(let n=0;n<u.buffered.length;n++)if(u.buffered.start(n)<=u.currentTime&&u.currentTime<=u.buffered.end(n))return u.buffered.end(n);return u.buffered.end(0)},[u.buffered,u.currentTime]),a=u.duration>0?r/u.duration*100:0,t={buffered:u.buffered,duration:u.duration,bufferedPercentage:a,bufferedEnd:r},i={"--buffered-percentage":`${a}%`,"--buffered-end":r,...l.style},p={ref:o,style:i,"aria-hidden":!0};return s?s(p,t):_jsxruntime.jsx.call(void 0, "div",{ref:o,"aria-hidden":"true",...l,style:i})});var De=(e=>(e.active="data-active",e))(De||{});var or=nr.forwardRef(function(e,o){let{render:s,children:l,...u}=e,a=R("Captions").activeCues,t=a.map(f=>f.text).join(`
|
|
2
|
+
`),i=a.length>0,p={active:i,cueText:t,cues:a},n={ref:o,"aria-live":"polite","aria-atomic":!0,role:"status",style:{pointerEvents:"none"},"data-active":i||void 0};return s?s(n,p):l?_jsxruntime.jsx.call(void 0, "div",{...n,...u,children:l}):_jsxruntime.jsx.call(void 0, "div",{...n,...u,children:t})});var ar=Oe.forwardRef(function(e,o){let{render:s,onClick:l,...u}=e,r=R("CaptionsButton"),a=r.registeredTracks.length>0,t=r.activeTextTrack!==null,i={active:t,available:a,trackCount:r.registeredTracks.length},p=Oe.useCallback(f=>{if(_optionalChain([l, 'optionalCall', _2 => _2(f)]),!f.defaultPrevented){if(t)r.setTextTrack(null);else if(r.registeredTracks.length>0){let S=r.registeredTracks[0];_optionalChain([S, 'optionalAccess', _3 => _3.textTrack])&&r.setTextTrack(S.textTrack)}}},[l,r,t]),n={ref:o,type:"button","aria-label":t?"Disable captions":"Enable captions","aria-pressed":t,disabled:!a,"data-active":t||void 0,"data-available":a||void 0,onClick:p};return s?s(n,i):_jsxruntime.jsx.call(void 0, "button",{...n,...u})});var ir=ue.forwardRef(function(e,o){let{render:s,children:l,...u}=e,r=R("CaptionsMenu"),a={registeredTracks:r.registeredTracks,activeTextTrack:r.activeTextTrack},t={ref:o,role:"menu","aria-label":"Captions","data-active":r.activeTextTrack!==null||void 0};return s?s(t,a):_jsxruntime.jsx.call(void 0, "div",{...t,...u,children:_nullishCoalesce(l, () => (_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, Fe,{track:null,children:"Off"}),r.registeredTracks.map(i=>_jsxruntime.jsx.call(void 0, Fe,{track:i.textTrack,children:i.label},i.id))]})))})}),Fe=ue.forwardRef(function(e,o){let{track:s,onClick:l,children:u,...r}=e,a=R("CaptionsMenuItem"),t=a.activeTextTrack===s,i=ue.useCallback(p=>{_optionalChain([l, 'optionalCall', _4 => _4(p)]),p.defaultPrevented||a.setTextTrack(s)},[l,a,s]);return _jsxruntime.jsx.call(void 0, "button",{ref:o,type:"button",role:"menuitemradio","aria-checked":t,"data-active":t||void 0,...r,onClick:i,children:u})});var We=(t=>(t.open="data-open",t.closed="data-closed",t.idle="data-idle",t.playing="data-playing",t.paused="data-paused",t.ended="data-ended",t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t))(We||{});function Zr(c){let e=[...c.getAnimations(),...Array.from(c.querySelectorAll("*")).flatMap(o=>o.getAnimations())];return e.length===0?Promise.resolve():Promise.all(e.map(o=>o.finished)).then(()=>{}).catch(()=>{})}function K(c){let{open:e,keepMounted:o=!1}=c,[s,l]=q.useState(e||o),[u,r]=q.useState(e?"starting":void 0),a=q.useRef(null),t=q.useRef(!1);return q.useEffect(()=>{if(e){t.current=!1,l(!0),r("starting");let i=requestAnimationFrame(()=>{requestAnimationFrame(()=>{r(void 0)})});return()=>cancelAnimationFrame(i)}},[e]),q.useEffect(()=>{if(!e&&s&&!t.current){r("ending");let i=a.current;if(!i){r(void 0),o||l(!1);return}t.current=!0;let p=requestAnimationFrame(()=>{requestAnimationFrame(()=>{Zr(i).then(()=>{t.current&&(t.current=!1,r(void 0),o||l(!1))})})});return()=>{cancelAnimationFrame(p)}}},[e,s,o]),q.useEffect(()=>{o&&!s&&!e&&l(!0)},[o,s,e]),{mounted:s||o,transitionStatus:u,elementRef:a}}var sr=ce.forwardRef(function(e,o){let{idleTimeout:s,keepMounted:l=!1,render:u,children:r,...a}=e,t=R("Controls"),p=(_nullishCoalesce(s, () => (t.idleTimeout)))===0||!t.idle,{mounted:n,transitionStatus:f,elementRef:S}=K({open:p,keepMounted:l}),y=ce.useCallback(E=>{S.current=E,typeof o=="function"?o(E):o&&(o.current=E)},[o,S]),{onClick:g,...m}=a,h=ce.useCallback(E=>{E.stopPropagation(),_optionalChain([g, 'optionalCall', _5 => _5(E)])},[g]),v={open:p,idle:t.idle,playing:t.playing,paused:t.paused,ended:t.ended},b={ref:y,onClick:h,"data-open":p||void 0,"data-closed":!p||void 0,"data-idle":t.idle||void 0,"data-playing":t.playing||void 0,"data-paused":t.paused||void 0,"data-ended":t.ended||void 0,"data-starting-style":f==="starting"||void 0,"data-ending-style":f==="ending"||void 0};return n?u?u(b,v):_jsxruntime.jsx.call(void 0, "div",{...b,...m,children:r}):null});var lr=J.forwardRef(function(e,o){let{render:s,onClick:l,children:u,...r}=e,a=R("FullscreenButton"),[t,i]=J.useState(!1);J.useEffect(()=>{i("fullscreenEnabled"in document&&document.fullscreenEnabled)},[]);let p=J.useCallback(S=>{_optionalChain([l, 'optionalCall', _6 => _6(S)]),S.defaultPrevented||a.toggleFullscreen()},[l,a]),n={fullscreen:a.fullscreen,supported:t},f={ref:o,type:"button","aria-label":a.fullscreen?"Exit fullscreen":"Enter fullscreen","aria-pressed":a.fullscreen,disabled:!t,"data-fullscreen":a.fullscreen||void 0,"data-supported":t||void 0,onClick:p};return s?s(f,n):_jsxruntime.jsx.call(void 0, "button",{...f,...r,children:u})});var ur=Qe.forwardRef(function(e,o){let{render:s,onClick:l,...u}=e,r=R("MuteButton"),a={muted:r.muted,volume:r.volume},t=Qe.useCallback(m=>{_optionalChain([l, 'optionalCall', _7 => _7(m)]),m.defaultPrevented||r.toggleMute()},[l,r]),i=r.volume,p=r.muted,n=i===0||p,f=i>0&&!p,S=!p&&i>0&&i<.5,y=!p&&i>=.5,g={ref:o,type:"button","aria-label":r.muted?"Unmute":"Mute","aria-pressed":r.muted,"data-muted":p||void 0,"data-volume-off":n||void 0,"data-volume-on":f||void 0,"data-volume-low":S||void 0,"data-volume-high":y||void 0,onClick:t};return s?s(g,a):_jsxruntime.jsx.call(void 0, "button",{...g,...u})});var $e=(n=>(n.open="data-open",n.closed="data-closed",n.playing="data-playing",n.paused="data-paused",n.ended="data-ended",n.waiting="data-waiting",n.seeking="data-seeking",n.fullscreen="data-fullscreen",n.pip="data-pip",n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n))($e||{});var cr=de.forwardRef(function(e,o){let{idleTimeout:s,keepMounted:l=!1,render:u,onClick:r,children:a,...t}=e,i=R("Overlay"),n=(_nullishCoalesce(s, () => (i.idleTimeout)))===0||!i.idle,{mounted:f,transitionStatus:S,elementRef:y}=K({open:n,keepMounted:l}),g=de.useCallback(b=>{y.current=b,typeof o=="function"?o(b):o&&(o.current=b)},[o,y]),m=de.useCallback(b=>{_optionalChain([r, 'optionalCall', _8 => _8(b)]),b.defaultPrevented||i.toggle()},[r,i]),h={playing:i.playing,paused:i.paused,ended:i.ended,waiting:i.waiting,seeking:i.seeking,fullscreen:i.fullscreen,pictureInPicture:i.pictureInPicture,open:n},v={ref:g,onClick:m,"data-playing":i.playing||void 0,"data-paused":i.paused||void 0,"data-ended":i.ended||void 0,"data-waiting":i.waiting||void 0,"data-seeking":i.seeking||void 0,"data-fullscreen":i.fullscreen||void 0,"data-pip":i.pictureInPicture||void 0,"data-open":n||void 0,"data-closed":!n||void 0,"data-starting-style":S==="starting"||void 0,"data-ending-style":S==="ending"||void 0};return f?u?u(v,h):_jsxruntime.jsx.call(void 0, "div",{...v,...t,children:a}):null});var dr=Z.forwardRef(function(e,o){let{render:s,onClick:l,...u}=e,r=R("PictureInPictureButton"),[a,t]=Z.useState(!1);Z.useEffect(()=>{t("pictureInPictureEnabled"in document&&document.pictureInPictureEnabled)},[]);let i={pictureInPicture:r.pictureInPicture,supported:a},p=Z.useCallback(f=>{_optionalChain([l, 'optionalCall', _9 => _9(f)]),f.defaultPrevented||r.togglePictureInPicture()},[l,r]),n={ref:o,type:"button","aria-label":r.pictureInPicture?"Exit picture-in-picture":"Enter picture-in-picture","aria-pressed":r.pictureInPicture,disabled:!a,"data-pip":r.pictureInPicture||void 0,"data-supported":a||void 0,onClick:p};return s?s(n,i):_jsxruntime.jsx.call(void 0, "button",{...n,...u})});var pr=Ne.forwardRef(function(e,o){let{render:s,onClick:l,children:u,...r}=e,a=R("PlayButton"),t=Ne.useCallback(n=>{_optionalChain([l, 'optionalCall', _10 => _10(n)]),n.defaultPrevented||a.toggle()},[l,a]),i={playing:a.playing,paused:a.paused,ended:a.ended,waiting:a.waiting},p={ref:o,type:"button","aria-label":a.playing?"Pause":"Play","data-playing":a.playing||void 0,"data-paused":a.paused||void 0,"data-ended":a.ended||void 0,"data-waiting":a.waiting||void 0,onClick:t};return s?s(p,i):_jsxruntime.jsx.call(void 0, "button",{...p,...r,children:u})});var sn=[.25,.5,.75,1,1.25,1.5,1.75,2],fr=Ue.forwardRef(function(e,o){let{rates:s=sn,render:l,onClick:u,children:r,...a}=e,t=R("PlaybackRateButton"),i={playbackRate:t.playbackRate,rates:s},p=Ue.useCallback(f=>{if(_optionalChain([u, 'optionalCall', _11 => _11(f)]),!f.defaultPrevented){let y=(s.indexOf(t.playbackRate)+1)%s.length,g=_nullishCoalesce(_nullishCoalesce(s[y], () => (s[0])), () => (t.playbackRate));t.setPlaybackRate(g)}},[u,t,s]),n={ref:o,type:"button","aria-label":`Playback speed: ${t.playbackRate}x`,"data-rate":t.playbackRate,onClick:p};return l?l(n,i):_jsxruntime.jsx.call(void 0, "button",{...n,...a,children:_nullishCoalesce(r, () => (`${t.playbackRate}x`))})});var un=[.25,.5,.75,1,1.25,1.5,1.75,2],mr=pe.forwardRef(function(e,o){let{rates:s=un,render:l,children:u,...r}=e,a=R("PlaybackRateMenu"),t={playbackRate:a.playbackRate,rates:s},i={ref:o,role:"menu","aria-label":"Playback speed","data-rate":a.playbackRate};return l?l(i,t):_jsxruntime.jsx.call(void 0, "div",{...i,...r,children:_nullishCoalesce(u, () => (s.map(p=>_jsxruntime.jsx.call(void 0, ct,{rate:p},p))))})}),ct=pe.forwardRef(function(e,o){let{rate:s,onClick:l,children:u,...r}=e,a=R("PlaybackRateMenuItem"),t=a.playbackRate===s,i=pe.useCallback(p=>{_optionalChain([l, 'optionalCall', _12 => _12(p)]),p.defaultPrevented||a.setPlaybackRate(s)},[l,a,s]);return _jsxruntime.jsx.call(void 0, "button",{ref:o,type:"button",role:"menuitemradio","aria-checked":t,"data-active":t||void 0,...r,onClick:i,children:_nullishCoalesce(u, () => (`${s}x`))})});var _reactdom = require('react-dom'); var gr = _interopRequireWildcard(_reactdom);function Pr(c){let{children:e,container:o}=c,[s,l]=_e.useState(!1);if(_e.useEffect(()=>(l(!0),()=>l(!1)),[]),!s)return null;let u=_nullishCoalesce(o, () => ((typeof document<"u"?document.body:null)));return u?_reactdom.createPortal.call(void 0, e,u):null}var Rr=je.forwardRef(function(e,o){let{keepMounted:s=!1,render:l,children:u,...r}=e,a=R("Poster"),t=!a.canPlay,i=a.canPlay,{mounted:p,transitionStatus:n,elementRef:f}=K({open:t,keepMounted:s}),S=dn(o,f),y={loading:t,loaded:i,transitionStatus:n},g={ref:S,"aria-hidden":!0,"data-loading":t||void 0,"data-loaded":i||void 0,"data-starting-style":n==="starting"||void 0,"data-ending-style":n==="ending"||void 0};return p?l?l(g,y):_jsxruntime.jsx.call(void 0, "div",{...g,...r,children:u}):null});function dn(...c){return je.useCallback(e=>{for(let o of c)typeof o=="function"?o(e):o!=null&&(o.current=e)},c)}var yr=fe.forwardRef(function(e,o){let{render:s,children:l,...u}=e,r=R("QualityMenu"),a={qualities:r.qualities,activeQuality:r.activeQuality},t={ref:o,role:"menu","aria-label":"Video quality","data-quality":_nullishCoalesce(_optionalChain([r, 'access', _13 => _13.activeQuality, 'optionalAccess', _14 => _14.label]), () => (void 0))};return s?s(t,a):_jsxruntime.jsx.call(void 0, "div",{...t,...u,children:_nullishCoalesce(l, () => (r.qualities.map(i=>_jsxruntime.jsx.call(void 0, pt,{quality:i,children:i.label},i.label))))})}),pt=fe.forwardRef(function(e,o){let{quality:s,onClick:l,children:u,...r}=e,a=R("QualityMenuItem"),t=_optionalChain([a, 'access', _15 => _15.activeQuality, 'optionalAccess', _16 => _16.label])===s.label,i=fe.useCallback(p=>{_optionalChain([l, 'optionalCall', _17 => _17(p)]),p.defaultPrevented||a.setQuality(s)},[l,a,s]);return _jsxruntime.jsx.call(void 0, "button",{ref:o,type:"button",role:"menuitemradio","aria-checked":t,"data-active":t||void 0,...r,onClick:i,children:u})});var qe=(i=>(i.playing="data-playing",i.paused="data-paused",i.ended="data-ended",i.waiting="data-waiting",i.seeking="data-seeking",i.fullscreen="data-fullscreen",i.pip="data-pip",i.muted="data-muted",i.idle="data-idle",i))(qe||{});function fn(c,e){return!(c instanceof HTMLElement)||c instanceof HTMLInputElement&&c.type==="range"&&e===" "?!1:c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable}function mn(c){return c==="ArrowRight"||c==="ArrowLeft"}function Sr(c,e){let o=ae(),s=Ke.useRef(o);s.current=o,Ke.useEffect(()=>{if(e==="none")return;let l=a=>{if(fn(a.target,a.key))return;let t=s.current;switch(a.key){case" ":a.preventDefault(),t.toggle();break;case"f":case"F":a.preventDefault(),t.toggleFullscreen();break;case"ArrowUp":a.preventDefault(),t.setVolume(Math.min(t.volume+.1,1));break;case"ArrowDown":a.preventDefault(),t.setVolume(Math.max(t.volume-.1,0));break;case"ArrowRight":a.preventDefault(),t.beginSeekInteraction(),t.seek(Math.min(t.currentTime+5,t.duration));break;case"ArrowLeft":a.preventDefault(),t.beginSeekInteraction(),t.seek(Math.max(t.currentTime-5,0));break;default:return}t.resetIdle()},u=a=>{mn(a.key)&&s.current.endSeekInteraction()};if(e==="global")return window.addEventListener("keydown",l),window.addEventListener("keyup",u),()=>{window.removeEventListener("keydown",l),window.removeEventListener("keyup",u)};let r=c.current;if(r)return r.addEventListener("keydown",l),r.addEventListener("keyup",u),()=>{r.removeEventListener("keydown",l),r.removeEventListener("keyup",u)}},[e,c])}function Xe(c,e,o){let[s,l]=d.useState(e),u=c!==void 0,r=u?c:s,a=d.useCallback(t=>{let i=typeof t=="function"?t(r):t;u||l(i),_optionalChain([o, 'optionalCall', _18 => _18(i)])},[u,r,o]);return[r,a]}function Pn({rootRef:c,videoRef:e,actionsRef:o,defaultPlaying:s=!1,defaultVolume:l=1,defaultMuted:u=!1,defaultPlaybackRate:r=1,playing:a,onPlayingChange:t,volume:i,onVolumeChange:p,muted:n,onMutedChange:f,playbackRate:S,onPlaybackRateChange:y,currentTime:g,onCurrentTimeChange:m,idleTimeout:h=3e3,preventIdleWhenPaused:v=!1,idle:b,onIdleChange:E,onEnded:M,onWaiting:V,onSeeking:O,onSeeked:Y,onFullscreenChange:j,onPictureInPictureChange:T,children:Q}){let A=d.useRef(1),F=d.useRef(!1),G=d.useRef(!1),[w,L]=d.useState("paused"),[N,z]=d.useState(s?"play":"pause");d.useEffect(()=>{a!==void 0&&(z(a?"play":"pause"),w!=="waiting"&&L(a?"playing":"paused"))},[a,w]);let[x,D]=Xe(i,l,p),[U,se]=Xe(n,u,f),[Re,Pt]=Xe(S,r,y),[$r,te]=Xe(b,!0,E),re=d.useRef(null),ye=d.useCallback(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),Rt=d.useCallback(()=>{h!==0&&(ye(),re.current=setTimeout(()=>{te(!0)},h))},[h,ye,te]),yt=d.useCallback(()=>{te(!1),Rt()},[te,Rt]),St=d.useCallback(()=>{ye(),te(!0)},[ye,te]);d.useEffect(()=>(h>0&&(re.current=setTimeout(()=>{te(!0)},h)),()=>{re.current&&clearTimeout(re.current)}),[]);let bt=v&&w!=="playing"?!1:$r,[kt,gt]=d.useState(0),[Se,vt]=d.useState(0),[Tt,Nr]=d.useState(null),[be,Ur]=d.useState(null),[xt,ht]=d.useState(!1),[Ct,le]=d.useState(!1),[ke,_r]=d.useState(!1),[ge,Mt]=d.useState(!1),[Et,st]=d.useState([]),[ne,jr]=d.useState(null),[Vt,ve]=d.useState([]),[wt,Ln]=d.useState([]),[Bt,qr]=d.useState(null);d.useEffect(()=>{g!==void 0&&e.current&&(e.current.currentTime=g)},[g,e]),d.useEffect(()=>{let P=()=>{let C=document.fullscreenElement===c.current;_r(C),_optionalChain([j, 'optionalCall', _19 => _19(C)])};return document.addEventListener("fullscreenchange",P),()=>document.removeEventListener("fullscreenchange",P)},[j,c]),d.useEffect(()=>{let P=e.current;if(!P)return;let C=()=>{Mt(!0),_optionalChain([T, 'optionalCall', _20 => _20(!0)])},W=()=>{Mt(!1),_optionalChain([T, 'optionalCall', _21 => _21(!1)])};return P.addEventListener("enterpictureinpicture",C),P.addEventListener("leavepictureinpicture",W),()=>{P.removeEventListener("enterpictureinpicture",C),P.removeEventListener("leavepictureinpicture",W)}},[T,e]);let Te=d.useCallback(async()=>{e.current&&(z("play"),await e.current.play(),L("playing"),_optionalChain([t, 'optionalCall', _22 => _22(!0)]))},[e,t]),xe=d.useCallback(()=>{e.current&&(z("pause"),e.current.pause(),L("paused"),_optionalChain([t, 'optionalCall', _23 => _23(!1)]))},[e,t]),he=d.useCallback(async()=>{w==="playing"?xe():await Te()},[w,Te,xe]),Ce=d.useCallback(P=>{e.current&&(e.current.currentTime=P,gt(P),_optionalChain([m, 'optionalCall', _24 => _24(P)]))},[m,e]),Lt=d.useCallback(()=>{let P=e.current;!P||F.current||(F.current=!0,G.current=N==="play",le(!0),G.current&&!P.paused&&P.pause())},[N,e]),It=d.useCallback(()=>{let P=e.current;if(!P||!F.current)return;let C=G.current&&N==="play";if(F.current=!1,G.current=!1,!C){le(!1);return}P.play().then(()=>{L("playing"),le(!1)}).catch(()=>{L("waiting"),le(!1)})},[N,e]),Me=d.useCallback(P=>{let C=Math.max(0,Math.min(1,P));e.current&&(e.current.volume=C),D(C)},[D,e]),Ht=d.useCallback(()=>{if(!(U||x===0))A.current=x,e.current&&(e.current.muted=!0),se(!0);else{let C=A.current>0?A.current:1;e.current&&(e.current.volume=C,e.current.muted=!1),D(C),se(!1)}},[U,x,se,D,e]),Ee=d.useCallback(async()=>{_optionalChain([c, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.requestFullscreen])&&await c.current.requestFullscreen()},[c]),Ve=d.useCallback(async()=>{document.exitFullscreen&&await document.exitFullscreen()},[]),we=d.useCallback(async()=>{ke?await Ve():await Ee()},[ke,Ee,Ve]),Be=d.useCallback(async()=>{_optionalChain([e, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.requestPictureInPicture])&&await e.current.requestPictureInPicture()},[e]),Le=d.useCallback(async()=>{document.pictureInPictureElement&&await document.exitPictureInPicture()},[]),Dt=d.useCallback(async()=>{ge?await Le():await Be()},[ge,Be,Le]),Ot=d.useCallback(P=>{e.current&&(e.current.playbackRate=P),Pt(P)},[Pt,e]),At=d.useCallback(P=>{if(e.current){for(let C=0;C<e.current.textTracks.length;C++){let W=e.current.textTracks[C];W&&(W.mode="disabled")}P&&(P.mode="hidden")}jr(P),ve([])},[e]),Ft=d.useCallback(P=>{qr(P)},[]),Wt=d.useCallback(P=>{st(C=>C.some(W=>W.id===P.id)?C:[...C,P])},[]),Qt=d.useCallback(P=>{st(C=>C.filter(W=>W.id!==P))},[]),$t=d.useCallback((P,C)=>{st(W=>W.map(oe=>oe.id===P?{...oe,textTrack:C}:oe))},[]);d.useEffect(()=>{if(!ne){ve([]);return}let P=()=>{let C=ne.activeCues;if(!C){ve([]);return}let W=[];for(let oe=0;oe<C.length;oe++){let er=C[oe];er instanceof VTTCue&&W.push(er)}ve(W)};return P(),ne.addEventListener("cuechange",P),()=>{ne.removeEventListener("cuechange",P)}},[ne]),d.useImperativeHandle(o,()=>({toggle:he,seek:Ce,setVolume:Me,toggleFullscreen:we}),[he,Ce,Me,we]);let Nt=d.useCallback(()=>{if(e.current){let P=e.current.currentTime;gt(P),_optionalChain([m, 'optionalCall', _29 => _29(P)])}},[m,e]),Ut=d.useCallback(()=>{e.current&&vt(e.current.duration)},[e]),_t=d.useCallback(()=>{e.current&&Nr(e.current.buffered)},[e]),jt=d.useCallback(()=>{z("play"),L("playing"),_optionalChain([t, 'optionalCall', _30 => _30(!0)])},[t]),qt=d.useCallback(()=>{F.current||w!=="ended"&&(L("paused"),_optionalChain([t, 'optionalCall', _31 => _31(!1)]))},[w,t]),Kt=d.useCallback(()=>{z("pause"),L("ended"),_optionalChain([t, 'optionalCall', _32 => _32(!1)]),_optionalChain([M, 'optionalCall', _33 => _33()])},[t,M]),Xt=d.useCallback(()=>{F.current||(L("waiting"),_optionalChain([V, 'optionalCall', _34 => _34()]))},[V]),Yt=d.useCallback(()=>{if(F.current){ht(!0);return}if(w==="waiting"){let P=N==="play"?"playing":"paused";L(P),_optionalChain([t, 'optionalCall', _35 => _35(P==="playing")])}ht(!0)},[w,N,t]),Gt=d.useCallback(()=>{le(!0),w==="ended"&&L("paused"),_optionalChain([O, 'optionalCall', _36 => _36()])},[w,O]),zt=d.useCallback(()=>{if(le(!1),e.current){let{currentTime:P,duration:C}=e.current;C>0&&C-P<.01&&L("ended")}_optionalChain([Y, 'optionalCall', _37 => _37()])},[Y,e]),Jt=d.useCallback(()=>{e.current&&(D(e.current.volume),se(e.current.muted))},[D,se,e]),Zt=d.useCallback(()=>{e.current&&vt(e.current.duration)},[e]),Kr=d.useMemo(()=>({playbackStatus:w,playbackIntent:N,playing:w==="playing",paused:w==="paused",ended:w==="ended",waiting:w==="waiting",seeking:Ct,canPlay:xt,currentTime:kt,duration:Se,buffered:Tt,hoverTime:be,hoverProgress:be!==null&&Se>0?be/Se*100:null,volume:x,muted:U,fullscreen:ke,pictureInPicture:ge,idle:bt,idleTimeout:h,preventIdleWhenPaused:v,registeredTracks:Et,activeTextTrack:ne,activeCues:Vt,playbackRate:Re,qualities:wt,activeQuality:Bt,videoRef:e,rootRef:c,play:Te,pause:xe,toggle:he,seek:Ce,setVolume:Me,toggleMute:Ht,enterFullscreen:Ee,exitFullscreen:Ve,toggleFullscreen:we,enterPictureInPicture:Be,exitPictureInPicture:Le,togglePictureInPicture:Dt,setPlaybackRate:Ot,setTextTrack:At,setQuality:Ft,registerTrack:Wt,unregisterTrack:Qt,updateTrackRef:$t,resetIdle:yt,setHoverTime:Ur,beginSeekInteraction:Lt,endSeekInteraction:It,_handlers:{onTimeUpdate:Nt,onDurationChange:Ut,onProgress:_t,onPlay:jt,onPause:qt,onEnded:Kt,onWaiting:Xt,onCanPlay:Yt,onSeeking:Gt,onSeeked:zt,onVolumeChange:Jt,onLoadedMetadata:Zt,onRootMouseLeave:St}}),[w,N,Ct,xt,kt,Se,Tt,be,x,U,ke,ge,bt,h,v,Et,ne,Vt,Re,wt,Bt,e,c,Te,xe,he,Ce,Me,Ht,Ee,Ve,we,Be,Le,Dt,Ot,At,Ft,Wt,Qt,$t,yt,Lt,It,Nt,Ut,_t,jt,qt,Kt,Xt,Yt,Gt,zt,Jt,Zt,St]);return _jsxruntime.jsx.call(void 0, lt.Provider,{value:Kr,children:Q})}var br=d.forwardRef(function(e,o){let{actionsRef:s,keyboardShortcuts:l="focused",defaultPlaying:u,defaultVolume:r,defaultMuted:a,defaultPlaybackRate:t,playing:i,onPlayingChange:p,volume:n,onVolumeChange:f,muted:S,onMutedChange:y,playbackRate:g,onPlaybackRateChange:m,currentTime:h,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:E,hideCursorWhenIdle:M="fullscreen",idle:V,onIdleChange:O,onEnded:Y,onWaiting:j,onSeeking:T,onSeeked:Q,onFullscreenChange:A,onPictureInPictureChange:F,children:G,...w}=e,L=d.useRef(null),N=d.useRef(null);return _jsxruntime.jsx.call(void 0, Pn,{actionsRef:s,defaultPlaying:u,defaultVolume:r,defaultMuted:a,defaultPlaybackRate:t,playing:i,onPlayingChange:p,volume:n,onVolumeChange:f,muted:S,onMutedChange:y,playbackRate:g,onPlaybackRateChange:m,currentTime:h,onCurrentTimeChange:v,idleTimeout:b,preventIdleWhenPaused:E,idle:V,onIdleChange:O,onEnded:Y,onWaiting:j,onSeeking:T,onSeeked:Q,onFullscreenChange:A,onPictureInPictureChange:F,rootRef:L,videoRef:N,children:_jsxruntime.jsx.call(void 0, Rn,{ref:o,rootRef:L,keyboardShortcuts:l,hideCursorWhenIdle:M,...w,children:G})})}),Rn=d.forwardRef(function({rootRef:e,keyboardShortcuts:o,hideCursorWhenIdle:s,children:l,className:u,style:r,...a},t){let i=ae(),p=yn(t,e),n=d.useRef(null);Sr(e,o);let f=d.useCallback(b=>{let{clientX:E,clientY:M}=b,V=n.current;V&&V.x===E&&V.y===M||(n.current={x:E,y:M},i.resetIdle())},[i]),S=d.useCallback(b=>{let{clientX:E,clientY:M}=b,V=n.current;V&&V.x===E&&V.y===M||(n.current={x:E,y:M},i.resetIdle())},[i]),y=d.useCallback(()=>{i._handlers.onRootMouseLeave()},[i._handlers]),g=d.useCallback(()=>{i.resetIdle()},[i]),m={"data-playing":i.playing||void 0,"data-paused":i.paused||void 0,"data-ended":i.ended||void 0,"data-waiting":i.waiting||void 0,"data-seeking":i.seeking||void 0,"data-fullscreen":i.fullscreen||void 0,"data-pip":i.pictureInPicture||void 0,"data-muted":i.muted||void 0,"data-idle":i.idle||void 0},h=s!==!1&&i.idle&&(s==="always"||s==="fullscreen"&&i.fullscreen),v=d.useId();return _jsxruntime.jsxs.call(void 0, "div",{ref:p,tabIndex:o==="focused"?0:void 0,className:u,style:r,"data-video-player-scope":v,...m,...a,onMouseMove:f,onMouseEnter:S,onMouseLeave:y,onClick:g,children:[h&&_jsxruntime.jsx.call(void 0, "style",{children:`[data-video-player-scope="${v}"], [data-video-player-scope="${v}"] * { cursor: none !important; }`}),l]})});function yn(...c){return d.useCallback(e=>{for(let o of c)typeof o=="function"?o(e):o!=null&&(o.current=e)},c)}var Ge=(r=>(r.progress="--seek-progress",r.buffered="--seek-buffered",r.currentTime="--seek-current-time",r.duration="--seek-duration",r.hoverProgress="--seek-hover-progress",r.hoverTime="--seek-hover-time",r))(Ge||{});var ze=(l=>(l.seeking="data-seeking",l.hovering="data-hovering",l.pressing="data-pressing",l.dragging="data-dragging",l))(ze||{});var _slider = require('@base-ui/react/slider');var _react2 = require('@floating-ui/react');var Je=(l=>(l.open="data-open",l.closed="data-closed",l.startingStyle="data-starting-style",l.endingStyle="data-ending-style",l))(Je||{});var ft=k.createContext(null);function vr(c){let e=k.useContext(ft);if(!e)throw new Error(`${c} must be used within SeekSlider`);return e}function kr(c){return c==="ArrowRight"||c==="ArrowLeft"}var Tr=k.forwardRef(function(e,o){let{render:s,children:l,onPointerMove:u,onPointerLeave:r,onPointerDown:a,onKeyUp:t,onValueCommitted:i,...p}=e,n=R("SeekSlider"),f=k.useRef(null),[S,y]=k.useState(null),[g,m]=k.useState(!1),[h,v]=k.useState(!1),b=k.useRef(!1);k.useEffect(()=>{if(!g)return;let x=()=>{m(!1),v(!1),b.current=!1,n.endSeekInteraction()};return window.addEventListener("pointerup",x),()=>window.removeEventListener("pointerup",x)},[g,n]);let E=n.duration>0?n.currentTime/n.duration*100:0,M=k.useCallback((x,D)=>{let U=typeof x=="number"?x:x[0];U!==void 0&&(D.reason==="keyboard"&&n.beginSeekInteraction(),n.seek(U),n.resetIdle(),b.current&&v(!0))},[n]),V=k.useCallback(x=>{if(_optionalChain([u, 'optionalCall', _38 => _38(x)]),!f.current||n.duration===0)return;let D=f.current.getBoundingClientRect(),U=x.clientX-D.left,Re=Math.max(0,Math.min(1,U/D.width))*n.duration;n.setHoverTime(Re)},[u,n]),O=k.useCallback(x=>{_optionalChain([r, 'optionalCall', _39 => _39(x)]),n.setHoverTime(null)},[r,n]),Y=k.useCallback(x=>{_optionalChain([a, 'optionalCall', _40 => _40(x)]),m(!0),b.current=!0,n.beginSeekInteraction()},[a,n]),j=k.useCallback(x=>{_optionalChain([t, 'optionalCall', _41 => _41(x)]),kr(x.key)&&n.endSeekInteraction()},[t,n]),T=k.useCallback((x,D)=>{let U=typeof x=="number"?x:x[0];U!==void 0&&(_optionalChain([i, 'optionalCall', _42 => _42(U,D)]),m(!1),v(!1),b.current=!1,!(D.reason==="keyboard"&&kr(D.event.key))&&n.endSeekInteraction())},[i,n]),Q=k.useMemo(()=>{if(!n.buffered||n.buffered.length===0)return 0;for(let x=0;x<n.buffered.length;x++)if(n.buffered.start(x)<=n.currentTime&&n.currentTime<=n.buffered.end(x))return n.buffered.end(x);return n.buffered.end(0)},[n.buffered,n.currentTime]),A=n.duration>0?Q/n.duration*100:0;k.useLayoutEffect(()=>{typeof o=="function"?o(f.current):o&&(o.current=f.current)});let F={currentTime:n.currentTime,duration:n.duration,progress:E,seeking:n.seeking,pressing:g,dragging:h,hoverTime:n.hoverTime,hoverProgress:n.hoverProgress},G=n.hoverProgress!==null,w=_nullishCoalesce(n.hoverProgress, () => (0)),L=k.useMemo(()=>({sliderRef:f,previewThumbElement:S,setPreviewThumbElement:y,hoverProgress:w,open:G}),[f,S,y,w,G]),N={position:"relative","--seek-progress":`${E}%`,"--seek-buffered":`${A}%`,"--seek-current-time":n.currentTime,"--seek-duration":n.duration,"--seek-hover-progress":n.hoverProgress!==null?`${n.hoverProgress}%`:void 0,"--seek-hover-time":_nullishCoalesce(n.hoverTime, () => (void 0)),...p.style},z={"data-seeking":n.seeking||void 0,"data-hovering":n.hoverTime!==null||void 0,"data-pressing":g||void 0,"data-dragging":h||void 0,style:N};return s?_jsxruntime.jsx.call(void 0, ft.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:f,min:0,max:n.duration||100,step:.1,value:n.currentTime,onValueChange:M,onValueCommitted:T,onPointerMove:V,onPointerLeave:O,onPointerDown:Y,onKeyUp:j,"aria-label":"Seek",render:x=>s({...x,...z,style:{...x.style,...z.style}},F)})}):_jsxruntime.jsx.call(void 0, ft.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:f,min:0,max:n.duration||100,step:.1,value:n.currentTime,onValueChange:M,onValueCommitted:T,onPointerMove:V,onPointerLeave:O,onPointerDown:Y,onKeyUp:j,"aria-label":"Seek",...z,...p,children:_nullishCoalesce(l, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{style:{position:"relative"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${A}%`}}),_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})})}),xr=_slider.Slider.Control,hr=k.forwardRef(function(e,o){let{render:s,children:l,style:u,...r}=e,a={},t={position:"relative",...u},i={ref:o,style:t};return s?_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{render:p=>s({...p,...i},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:o,style:t,...r,children:l})}),Cr=k.forwardRef(function(e,o){let{render:s,children:l,style:u,...r}=e,a=R("SeekSliderProgress"),i={progress:a.duration>0?a.currentTime/a.duration*100:0},p={height:"100%",...u},n={ref:o,style:p};return s?_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{render:f=>s({...f,...n,style:{...f.style,...p}},i)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:o,style:p,...r,children:l})}),Mr=k.forwardRef(function(e,o){let{render:s,children:l,style:u,...r}=e,a={},t={ref:o,style:_nullishCoalesce(u, () => ({}))};return s?_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{render:i=>s({...i,...t,style:{...i.style,...u}},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:o,style:u,...r,children:l})}),Er=k.forwardRef(function(e,o){let{render:s,children:l,...u}=e,r=R("SeekSliderBuffered"),a=k.useMemo(()=>{if(!r.buffered||r.buffered.length===0)return 0;for(let f=0;f<r.buffered.length;f++)if(r.buffered.start(f)<=r.currentTime&&r.currentTime<=r.buffered.end(f))return r.buffered.end(f);return r.buffered.end(0)},[r.buffered,r.currentTime]),t=r.duration>0?a/r.duration*100:0,i={bufferedPercentage:t},p={position:"absolute",left:0,top:0,height:"100%",width:`${t}%`,...u.style},n={ref:o,style:p};return s?s(n,i):_jsxruntime.jsx.call(void 0, "div",{...n,...u,children:l})}),Vr=k.forwardRef(function(e,o){let{keepMounted:s=!1,render:l,children:u,...r}=e,a=R("SeekSliderPreviewThumb"),t=vr("SeekSliderPreviewThumb"),i=a.hoverProgress!==null,p=k.useRef(0);a.hoverProgress!==null&&(p.current=a.hoverProgress);let n=_nullishCoalesce(a.hoverProgress, () => (p.current)),{mounted:f,transitionStatus:S,elementRef:y}=K({open:i,keepMounted:s}),g=k.useCallback(b=>{y.current=b,t.setPreviewThumbElement(b),typeof o=="function"?o(b):o&&(o.current=b)},[o,y,t]),m={open:i,transitionStatus:S,hoverProgress:n},h={position:"absolute",left:`${n}%`,transform:"translateX(-50%)",pointerEvents:"none",...r.style},v={ref:g,style:h,"data-open":i||void 0,"data-closed":!i||void 0,"data-starting-style":S==="starting"||void 0,"data-ending-style":S==="ending"||void 0};return f?l?l(v,m):_jsxruntime.jsx.call(void 0, "span",{...v,...r,children:u}):null}),wr=k.forwardRef(function(e,o){let{render:s,children:l,style:u,...r}=e,a=R("SeekSliderHover"),t=a.hoverProgress!==null,i=_nullishCoalesce(a.hoverProgress, () => (0)),p={hovering:t,hoverProgress:a.hoverProgress,hoverTime:a.hoverTime},n={position:"absolute",left:0,top:0,height:"100%",width:`${i}%`,pointerEvents:"none",...u},f={ref:o,style:n,"data-hovering":t||void 0};return s?s(f,p):_jsxruntime.jsx.call(void 0, "div",{...f,...r,children:l})});function Ze({children:c,container:e}){let o=R("SeekSliderPreviewTooltipPortal"),[s,l]=k.useState(!1);if(k.useEffect(()=>{l(!0)},[]),!s)return null;let u=_nullishCoalesce(_nullishCoalesce(e, () => (o.rootRef.current)), () => (document.body));return gr.createPortal(c,u)}var et=k.forwardRef(function(e,o){let{sideOffset:s=8,collisionPadding:l=0,collisionBoundary:u,keepMounted:r=!1,children:a,style:t,...i}=e,p=vr("SeekSliderPreviewTooltipPositioner"),{previewThumbElement:n,open:f,hoverProgress:S}=p,[y,g]=k.useState(null),{refs:m,floatingStyles:h,update:v}=_react2.useFloating.call(void 0, {placement:"top",middleware:[_react2.offset.call(void 0, s),_react2.shift.call(void 0, {boundary:u,padding:l})]});k.useLayoutEffect(()=>{n&&m.setReference(n)},[n,m]),k.useEffect(()=>{if(f&&n&&y)return _react2.autoUpdate.call(void 0, n,y,v)},[f,n,y,v]),k.useLayoutEffect(()=>{f&&n&&y&&v()},[S,f,n,y,v]);let b=k.useCallback(M=>{m.setFloating(M),g(M),typeof o=="function"?o(M):o&&(o.current=M)},[m,o]);return(r||f)&&!!n?_jsxruntime.jsx.call(void 0, "div",{ref:b,style:{...h,...t},"data-seek-slider-preview-tooltip-positioner":!0,"data-open":f||void 0,"data-closed":!f||void 0,...i,children:a}):null}),tt=k.forwardRef(function(e,o){let{children:s,...l}=e;return _jsxruntime.jsx.call(void 0, "div",{ref:o,"data-seek-slider-preview-tooltip-popup":!0,...l,children:s})});function me({sideOffset:c,collisionPadding:e,collisionBoundary:o,keepMounted:s,container:l,children:u,...r}){return _jsxruntime.jsx.call(void 0, Ze,{container:l,children:_jsxruntime.jsx.call(void 0, et,{sideOffset:c,collisionPadding:e,collisionBoundary:o,keepMounted:s,children:_jsxruntime.jsx.call(void 0, tt,{...r,children:u})})})}me.Portal=Ze;me.Positioner=et;me.Popup=tt;var rt=(s=>(s.loading="data-loading",s.ready="data-ready",s.error="data-error",s))(rt||{});var Br=H.forwardRef(function(e,o){let{time:s,crossOrigin:l="anonymous",render:u,children:r,width:a,height:t,...i}=e,p=R("Thumbnail"),n=H.useRef(null),f=H.useRef(null),S=H.useRef(null),[y,g]=H.useState("idle"),[m,h]=H.useState({width:160,height:90}),v=s!==void 0?s:p.hoverTime,b=H.useMemo(()=>{let T=p.videoRef.current;return T?T.currentSrc||T.src:null},[p.videoRef]);H.useEffect(()=>{if(!b)return;let T=document.createElement("video");T.src=b,T.crossOrigin=l,T.preload="metadata",T.muted=!0,T.playsInline=!0;let Q=()=>{h({width:T.videoWidth,height:T.videoHeight})},A=()=>{g("error")};return T.addEventListener("loadedmetadata",Q),T.addEventListener("error",A),f.current=T,()=>{T.removeEventListener("loadedmetadata",Q),T.removeEventListener("error",A),T.src="",f.current=null}},[b,l]),H.useEffect(()=>{let T=f.current,Q=n.current;if(!T||!Q||v===null||v===void 0||S.current!==null&&Math.abs(S.current-v)<.1)return;g("loading");let A=()=>{let F=Q.getContext("2d");if(F)try{F.drawImage(T,0,0,Q.width,Q.height),S.current=v,g("ready")}catch (e2){g("error")}};return T.addEventListener("seeked",A,{once:!0}),T.currentTime=v,()=>{T.removeEventListener("seeked",A)}},[v]);let E=H.useCallback(T=>{n.current=T,typeof o=="function"?o(T):o&&(o.current=T)},[o]),M=m.width/m.height,V=_nullishCoalesce(a, () => (160)),O=_nullishCoalesce(t, () => (Math.round(V/M)));typeof V=="string"&&(V=160),typeof O=="string"&&(O=90);let Y={loading:y==="loading",ready:y==="ready",error:y==="error",time:v,videoWidth:m.width,videoHeight:m.height},j={ref:E,width:V,height:O,"data-loading":y==="loading"||void 0,"data-ready":y==="ready"||void 0,"data-error":y==="error"||void 0};return u?u(j,Y):_jsxruntime.jsx.call(void 0, "canvas",{...j,...i,children:r})});var nt=(e=>(e.hovering="data-hovering",e))(nt||{});var Lr=ot.forwardRef(function(e,o){let{format:s="current / duration",fixedWidth:l=!0,align:u="left",render:r,...a}=e,t=R("TimeDisplay"),i=ot.useRef(0);t.hoverTime!==null&&(i.current=t.hoverTime);let p=t.duration-t.currentTime,n=Pe(t.currentTime),f=Pe(t.duration),S=Pe(p),y=t.hoverTime!==null?Pe(t.hoverTime):Pe(i.current),g={currentTime:t.currentTime,duration:t.duration,remaining:p,hoverTime:t.hoverTime,hovering:t.hoverTime!==null,formattedCurrent:n,formattedDuration:f,formattedRemaining:S,formattedHover:y},m=()=>{switch(s){case"current":return n;case"duration":return f;case"remaining":return`-${S}`;case"current / duration":return`${n} / ${f}`;case"current / remaining":return`${n} / -${S}`;case"hover":return y;default:return`${n} / ${f}`}},h=()=>{let b=Cn(t.duration);switch(s){case"current":case"duration":case"hover":return b;case"remaining":return`-${b}`;case"current / duration":return`${b} / ${b}`;case"current / remaining":return`${b} / -${b}`;default:return`${b} / ${b}`}},v={ref:o,style:{position:l?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},"data-hovering":g.hovering||void 0};return r?r(v,g):_jsxruntime.jsx.call(void 0, "span",{ref:o,"data-hovering":g.hovering||void 0,...a,style:{position:l?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},children:l?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":!0,style:{visibility:"hidden"},children:h()}),_jsxruntime.jsx.call(void 0, "span",{style:hn(u),children:m()})]}):m()})});function hn(c){let e={position:"absolute"};switch(c){case"left":return{...e,left:0};case"right":return{...e,right:0};case"center":return{...e,left:"50%",transform:"translateX(-50%)"}}}function Pe(c){if(!Number.isFinite(c)||Number.isNaN(c))return"0:00";let e=Math.floor(c/3600),o=Math.floor(c%3600/60),s=Math.floor(c%60);return e>0?`${e}:${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${o}:${s.toString().padStart(2,"0")}`}function Cn(c){if(!Number.isFinite(c)||Number.isNaN(c)||c<=0)return"0:00";let e=Math.floor(c/3600),o=Math.floor(c%3600/60);if(e>0){let l=String(e).length;return`${"0".repeat(l)}:00:00`}let s=String(o).length;return`${"0".repeat(s)}:00`}var Ir=_.forwardRef(function(e,o){let{kind:s="captions",src:l,label:u,srcLang:r,default:a,...t}=e,{registerTrack:i,unregisterTrack:p,updateTrackRef:n,setTextTrack:f}=R("Track"),S=_.useRef(null),y=_.useId(),g=_.useCallback(m=>{typeof o=="function"?o(m):o&&(o.current=m),S.current=m},[o]);return _.useEffect(()=>(i({id:y,kind:s,label:u,srcLang:r,src:l,textTrack:null}),()=>{p(y)}),[y,s,u,r,l,i,p]),_.useEffect(()=>{let m=S.current;if(!m)return;let h=()=>{m.track&&(m.track.mode="disabled",n(y,m.track),a&&f(m.track))};return m.track&&h(),m.addEventListener("load",h),()=>{m.removeEventListener("load",h)}},[y,a,n,f]),_jsxruntime.jsx.call(void 0, "track",{ref:g,kind:s,src:l,label:u,srcLang:r,default:a,...t})});var Hr=ie.forwardRef(function(e,o){let{toggleOnClick:s=!0,onClick:l,...u}=e,r=R("Video"),a=ie.useRef(!1),t=ie.useCallback(n=>{typeof o=="function"?o(n):o&&(o.current=n),r.videoRef.current=n,n&&!a.current&&(a.current=!0,n.readyState>=1&&n.duration&&(r._handlers.onLoadedMetadata(),r._handlers.onDurationChange()),n.readyState>=3&&r._handlers.onCanPlay())},[o,r.videoRef,r._handlers]),i=ie.useCallback(n=>{_optionalChain([l, 'optionalCall', _43 => _43(n)]),!n.defaultPrevented&&s&&r.toggle()},[l,s,r]),p={"data-playing":r.playing||void 0,"data-paused":r.paused||void 0,"data-ended":r.ended||void 0,"data-waiting":r.waiting||void 0,"data-seeking":r.seeking||void 0};return _jsxruntime.jsx.call(void 0, "video",{ref:t,preload:"metadata",...p,...u,onClick:i,onTimeUpdate:r._handlers.onTimeUpdate,onDurationChange:r._handlers.onDurationChange,onProgress:r._handlers.onProgress,onPlay:r._handlers.onPlay,onPause:r._handlers.onPause,onEnded:r._handlers.onEnded,onWaiting:r._handlers.onWaiting,onCanPlay:r._handlers.onCanPlay,onSeeking:r._handlers.onSeeking,onSeeked:r._handlers.onSeeked,onVolumeChange:r._handlers.onVolumeChange,onLoadedMetadata:r._handlers.onLoadedMetadata})});var at=(o=>(o.volume="--volume",o.volumePercentage="--volume-percentage",o))(at||{});var it=(l=>(l.muted="data-muted",l.volume="data-volume",l.pressing="data-pressing",l.dragging="data-dragging",l))(it||{});var Dr=I.forwardRef(function(e,o){let{render:s,children:l,onPointerDown:u,...r}=e,a=R("VolumeSlider"),t=I.useRef(null),[i,p]=I.useState(!1),[n,f]=I.useState(!1),S=I.useRef(!1);I.useEffect(()=>{if(!i)return;let M=()=>{p(!1),f(!1),S.current=!1};return window.addEventListener("pointerup",M),()=>window.removeEventListener("pointerup",M)},[i]),I.useLayoutEffect(()=>{typeof o=="function"?o(t.current):o&&(o.current=t.current)});let y=a.volume*100,g={volume:a.volume,muted:a.muted,percentage:y,pressing:i,dragging:n},m=I.useCallback(M=>{let V=typeof M=="number"?M:M[0];if(V!==void 0){if(a.muted){let O=a.videoRef.current;O&&(O.muted=!1)}a.setVolume(V),a.resetIdle(),S.current&&f(!0)}},[a]),h=I.useCallback(M=>{_optionalChain([u, 'optionalCall', _44 => _44(M)]),p(!0),S.current=!0},[u]),v={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":i||void 0,"data-dragging":n||void 0},b={position:"relative","--volume":a.volume,"--volume-percentage":`${y}%`,...r.style},E={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":i||void 0,"data-dragging":n||void 0,style:b};return s?_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:t,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:h,"aria-label":"Volume",render:M=>s({...M,...E},g)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:t,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:m,onPointerDown:h,"aria-label":"Volume",...v,...r,style:b,children:_nullishCoalesce(l, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{children:[_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})}),Or=_slider.Slider.Control,Ar=I.forwardRef(function(e,o){let{style:s,...l}=e,u={position:"relative",...s};return _jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:o,style:u,...l})}),Fr=I.forwardRef(function(e,o){return _jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:o,...e})}),Wr=I.forwardRef(function(e,o){return _jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:o,...e})});exports.VideoPlayer = Qr; exports.useVideoPlayer = ae;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","../../src/video-player/contexts/video-player-context.ts","../../src/video-player/hooks/use-video-player.ts","../../src/video-player/index.parts.ts","../../src/video-player/components/buffered-indicator/buffered-indicator.tsx","../../src/video-player/hooks/use-transition-status.ts"],"names":["VideoPlayerContext","useVideoPlayerContext","component","context","useVideoPlayer","index_parts_exports","__export","BufferedIndicator","Captions","CaptionsButton","CaptionsDataAttributes","CaptionsMenu","CaptionsMenuItem","Controls","ControlsDataAttributes","FullscreenButton","MuteButton","Overlay","OverlayDataAttributes","PictureInPictureButton","PlayButton","PlaybackRateButton","PlaybackRateMenu","PlaybackRateMenuItem","Portal","Poster","QualityMenu","QualityMenuItem","VideoPlayerRoot","RootDataAttributes","SeekSlider","SeekSliderBuffered","SeekSliderControl","SeekSliderCssVars","SeekSliderDataAttributes","SeekSliderHover","SeekSliderPreviewThumb","SeekSliderPreviewThumbDataAttributes","SeekSliderPreviewTooltip","SeekSliderPreviewTooltipPopup","SeekSliderPreviewTooltipPortal","SeekSliderPreviewTooltipPositioner","SeekSliderProgress","SeekSliderThumb","SeekSliderTrack","Thumbnail","ThumbnailDataAttributes","TimeDisplay","TimeDisplayDataAttributes","Track","Video","VolumeSlider","VolumeSliderControl","VolumeSliderCssVars","VolumeSliderDataAttributes","VolumeSliderRange","VolumeSliderThumb","VolumeSliderTrack","useTransitionStatus","props","forwardedRef","render","divProps","bufferedEnd","i","bufferedPercentage","state","style"],"mappings":"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","file":"/home/runner/work/ui/ui/packages/react/dist/video-player/index.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { VideoPlayerContextValue } from '../types.js'\n\nexport const VideoPlayerContext =\n React.createContext<VideoPlayerContextValue | null>(null)\n\nexport function useVideoPlayerContext(\n component: string,\n): VideoPlayerContextValue {\n const context = React.useContext(VideoPlayerContext)\n if (!context) {\n throw new Error(\n `<VideoPlayer.${component}> must be used within <VideoPlayer.Root>`,\n )\n }\n return context\n}\n","'use client'\n\nimport { useVideoPlayerContext } from '../contexts/video-player-context.js'\nimport type { VideoPlayerContextValue } from '../types.js'\n\n/**\n * Hook to access the VideoPlayer context from custom components.\n *\n * @example\n * ```tsx\n * function CustomControl() {\n * const { playing, toggle, currentTime, duration } = useVideoPlayer()\n *\n * return (\n * <div>\n * {playing ? 'Playing' : 'Paused'} - {currentTime}s / {duration}s\n * <button onClick={toggle}>Toggle</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useVideoPlayer(): VideoPlayerContextValue {\n return useVideoPlayerContext('useVideoPlayer')\n}\n","// ============================================================================\n// VideoPlayer Composable Parts\n// ============================================================================\n//\n// Import like: import * as VideoPlayer from './video-player/index.parts.js'\n//\n// Usage:\n// <VideoPlayer.Root>\n// <VideoPlayer.Video src=\"...\" />\n// <VideoPlayer.Controls>\n// <VideoPlayer.PlayButton />\n// <VideoPlayer.SeekSlider />\n// <VideoPlayer.TimeDisplay />\n// </VideoPlayer.Controls>\n// </VideoPlayer.Root>\n//\n\nexport { BufferedIndicator } from './components/buffered-indicator/buffered-indicator.js'\nexport { CaptionsDataAttributes } from './components/captions/captions.data-attributes.js'\nexport { Captions } from './components/captions/captions.js'\n// Captions\nexport { CaptionsButton } from './components/captions-button/captions-button.js'\nexport {\n CaptionsMenu,\n CaptionsMenuItem,\n} from './components/captions-menu/captions-menu.js'\nexport { ControlsDataAttributes } from './components/controls/controls.data-attributes.js'\nexport { Controls } from './components/controls/controls.js'\n// Display Controls\nexport { FullscreenButton } from './components/fullscreen-button/fullscreen-button.js'\nexport { MuteButton } from './components/mute-button/mute-button.js'\nexport { OverlayDataAttributes } from './components/overlay/overlay.data-attributes.js'\nexport { Overlay } from './components/overlay/overlay.js'\nexport { PictureInPictureButton } from './components/picture-in-picture-button/picture-in-picture-button.js'\n// Playback Controls\nexport { PlayButton } from './components/play-button/play-button.js'\n// Playback Rate\nexport { PlaybackRateButton } from './components/playback-rate-button/playback-rate-button.js'\nexport {\n PlaybackRateMenu,\n PlaybackRateMenuItem,\n} from './components/playback-rate-menu/playback-rate-menu.js'\n// Layout\nexport { Portal } from './components/portal/portal.js'\nexport { Poster } from './components/poster/poster.js'\n// Quality\nexport {\n QualityMenu,\n QualityMenuItem,\n} from './components/quality-menu/quality-menu.js'\n// Data Attributes & CSS Variables\nexport { RootDataAttributes } from './components/root/root.data-attributes.js'\n// Core\nexport { VideoPlayerRoot as Root } from './components/root/root.js'\nexport { SeekSliderCssVars } from './components/seek-slider/seek-slider.css-vars.js'\nexport { SeekSliderDataAttributes } from './components/seek-slider/seek-slider.data-attributes.js'\nexport {\n SeekSlider,\n SeekSliderBuffered,\n SeekSliderControl,\n SeekSliderHover,\n SeekSliderPreviewThumb,\n SeekSliderPreviewTooltip,\n SeekSliderPreviewTooltipPopup,\n SeekSliderPreviewTooltipPortal,\n SeekSliderPreviewTooltipPositioner,\n SeekSliderProgress,\n SeekSliderThumb,\n SeekSliderTrack,\n} from './components/seek-slider/seek-slider.js'\nexport { SeekSliderPreviewThumbDataAttributes } from './components/seek-slider/seek-slider-preview-thumb.data-attributes.js'\nexport { ThumbnailDataAttributes } from './components/thumbnail/thumbnail.data-attributes.js'\nexport { Thumbnail } from './components/thumbnail/thumbnail.js'\nexport { TimeDisplayDataAttributes } from './components/time-display/time-display.data-attributes.js'\nexport { TimeDisplay } from './components/time-display/time-display.js'\nexport { Track } from './components/track/track.js'\nexport { Video } from './components/video/video.js'\nexport { VolumeSliderCssVars } from './components/volume-slider/volume-slider.css-vars.js'\nexport { VolumeSliderDataAttributes } from './components/volume-slider/volume-slider.data-attributes.js'\n// Audio Controls\nexport {\n VolumeSlider,\n VolumeSliderControl,\n VolumeSliderRange,\n VolumeSliderThumb,\n VolumeSliderTrack,\n} from './components/volume-slider/volume-slider.js'\nexport {\n type TransitionStatus,\n type UseTransitionStatusOptions,\n type UseTransitionStatusReturn,\n useTransitionStatus,\n} from './hooks/use-transition-status.js'\n// Hooks\nexport { useVideoPlayer } from './hooks/use-video-player.js'\n// Types\nexport type {\n PlaybackIntent,\n PlaybackStatus,\n RenderProp,\n TrackInfo,\n VideoPlayerActions,\n VideoPlayerContextValue,\n VideoPlayerRootProps,\n VideoPlayerState,\n VideoQuality,\n VideoTextTrack,\n} from './types.js'\n","'use client'\n\nimport * as React from 'react'\nimport { useVideoPlayerContext } from '../../contexts/video-player-context.js'\nimport type { RenderProp } from '../../types.js'\n\n// ============================================================================\n// BufferedIndicator Props\n// ============================================================================\n\nexport interface BufferedIndicatorProps\n extends React.ComponentPropsWithRef<'div'> {\n render?: RenderProp<BufferedIndicatorRenderProps, BufferedIndicatorState>\n}\n\nexport interface BufferedIndicatorRenderProps {\n ref: React.Ref<HTMLElement>\n style: React.CSSProperties\n 'aria-hidden': true\n}\n\nexport interface BufferedIndicatorState {\n buffered: TimeRanges | null\n duration: number\n bufferedPercentage: number\n bufferedEnd: number\n}\n\n// ============================================================================\n// BufferedIndicator Component\n// ============================================================================\n\nexport const BufferedIndicator = React.forwardRef<\n HTMLDivElement,\n BufferedIndicatorProps\n>(function BufferedIndicator(props, forwardedRef) {\n const { render, ...divProps } = props\n const context = useVideoPlayerContext('BufferedIndicator')\n\n // Calculate buffered end position (for progress bar display)\n const bufferedEnd = React.useMemo(() => {\n if (!context.buffered || context.buffered.length === 0) return 0\n\n // Find the buffer range that contains current playback position\n for (let i = 0; i < context.buffered.length; i++) {\n if (\n context.buffered.start(i) <= context.currentTime &&\n context.currentTime <= context.buffered.end(i)\n ) {\n return context.buffered.end(i)\n }\n }\n\n // Fallback to end of first range\n return context.buffered.end(0)\n }, [context.buffered, context.currentTime])\n\n const bufferedPercentage =\n context.duration > 0 ? (bufferedEnd / context.duration) * 100 : 0\n\n const state: BufferedIndicatorState = {\n buffered: context.buffered,\n duration: context.duration,\n bufferedPercentage,\n bufferedEnd,\n }\n\n // CSS custom properties for styling\n const style = {\n '--buffered-percentage': `${bufferedPercentage}%`,\n '--buffered-end': bufferedEnd,\n ...divProps.style,\n } as React.CSSProperties\n\n const renderProps: BufferedIndicatorRenderProps = {\n ref: forwardedRef,\n style,\n 'aria-hidden': true,\n }\n\n if (render) {\n return render(renderProps, state)\n }\n\n return (\n <div ref={forwardedRef} aria-hidden=\"true\" {...divProps} style={style} />\n )\n})\n\n// ============================================================================\n// Namespace\n// ============================================================================\n\nexport namespace BufferedIndicator {\n export type Props = BufferedIndicatorProps\n export type State = BufferedIndicatorState\n}\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type TransitionStatus = 'starting' | 'ending' | undefined\n\nexport interface UseTransitionStatusOptions {\n /**\n * Whether the element should be visible/open.\n */\n open: boolean\n /**\n * Keep the element always mounted in the DOM, even when closed.\n * Only needed for JavaScript animation libraries (e.g., Framer Motion).\n * CSS transitions and animations work automatically without this.\n * @default false\n */\n keepMounted?: boolean\n}\n\nexport interface UseTransitionStatusReturn {\n /**\n * Whether the element should be rendered in the DOM.\n * Stays true during exit animations.\n */\n mounted: boolean\n /**\n * Current transition status:\n * - 'starting': First frame of enter animation\n * - 'ending': Exit animation in progress\n * - undefined: Idle state\n */\n transitionStatus: TransitionStatus\n /**\n * Ref to attach to the animated element.\n * Used to detect when CSS animations/transitions complete.\n */\n elementRef: React.RefObject<HTMLElement | null>\n}\n\n// ============================================================================\n// Utility: Wait for Animations\n// ============================================================================\n\n/**\n * Returns a promise that resolves when all CSS animations and transitions\n * on the element and its descendants have completed.\n */\nfunction waitForAnimations(element: HTMLElement): Promise<void> {\n // Collect animations from the element and all descendants\n const animations = [\n ...element.getAnimations(),\n ...Array.from(element.querySelectorAll('*')).flatMap((el) =>\n (el as HTMLElement).getAnimations(),\n ),\n ]\n\n if (animations.length === 0) {\n return Promise.resolve()\n }\n return Promise.all(animations.map((a) => a.finished))\n .then(() => {})\n .catch(() => {\n // Animation was cancelled (e.g., element removed or animation interrupted)\n })\n}\n\n// ============================================================================\n// Hook: useTransitionStatus\n// ============================================================================\n\nexport function useTransitionStatus(\n options: UseTransitionStatusOptions,\n): UseTransitionStatusReturn {\n const { open, keepMounted = false } = options\n\n const [mounted, setMounted] = React.useState(open || keepMounted)\n const [transitionStatus, setTransitionStatus] =\n React.useState<TransitionStatus>(open ? 'starting' : undefined)\n\n const elementRef = React.useRef<HTMLElement | null>(null)\n\n // Track if we're currently waiting for animations\n const waitingForAnimationsRef = React.useRef(false)\n\n // Handle open → true (enter)\n React.useEffect(() => {\n if (open) {\n // Cancel any pending exit\n waitingForAnimationsRef.current = false\n\n setMounted(true)\n setTransitionStatus('starting')\n\n // Clear starting style after first paint (double RAF for reliability)\n const raf = requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setTransitionStatus(undefined)\n })\n })\n\n return () => cancelAnimationFrame(raf)\n }\n }, [open])\n\n // Handle open → false (exit)\n React.useEffect(() => {\n if (!open && mounted && !waitingForAnimationsRef.current) {\n setTransitionStatus('ending')\n\n const element = elementRef.current\n\n if (!element) {\n // No element ref, unmount immediately\n setTransitionStatus(undefined)\n if (!keepMounted) {\n setMounted(false)\n }\n return\n }\n\n waitingForAnimationsRef.current = true\n\n // Wait a frame for the browser to process style changes and start animations\n const raf = requestAnimationFrame(() => {\n // Double RAF for reliability (like enter animation)\n requestAnimationFrame(() => {\n waitForAnimations(element).then(() => {\n // Check if we're still supposed to be unmounting\n // (user might have re-opened during animation)\n if (!waitingForAnimationsRef.current) return\n\n waitingForAnimationsRef.current = false\n setTransitionStatus(undefined)\n\n if (!keepMounted) {\n setMounted(false)\n }\n })\n })\n })\n\n return () => {\n cancelAnimationFrame(raf)\n }\n }\n }, [open, mounted, keepMounted])\n\n // Handle keepMounted change\n React.useEffect(() => {\n if (keepMounted && !mounted && !open) {\n setMounted(true)\n }\n }, [keepMounted, mounted, open])\n\n return {\n mounted: mounted || keepMounted,\n transitionStatus,\n elementRef,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/video-player/index.cjs","../../src/video-player/contexts/video-player-context.ts","../../src/video-player/hooks/use-video-player.ts","../../src/video-player/index.parts.ts","../../src/video-player/components/buffered-indicator/buffered-indicator.tsx","../../src/video-player/hooks/use-transition-status.ts"],"names":["VideoPlayerContext","useVideoPlayerContext","component","context","useVideoPlayer","index_parts_exports","__export","BufferedIndicator","Captions","CaptionsButton","CaptionsDataAttributes","CaptionsMenu","CaptionsMenuItem","Controls","ControlsDataAttributes","FullscreenButton","MuteButton","Overlay","OverlayDataAttributes","PictureInPictureButton","PlayButton","PlaybackRateButton","PlaybackRateMenu","PlaybackRateMenuItem","Portal","Poster","QualityMenu","QualityMenuItem","VideoPlayerRoot","RootDataAttributes","SeekSlider","SeekSliderBuffered","SeekSliderControl","SeekSliderCssVars","SeekSliderDataAttributes","SeekSliderHover","SeekSliderPreviewThumb","SeekSliderPreviewThumbDataAttributes","SeekSliderPreviewTooltip","SeekSliderPreviewTooltipPopup","SeekSliderPreviewTooltipPortal","SeekSliderPreviewTooltipPositioner","SeekSliderProgress","SeekSliderThumb","SeekSliderTrack","Thumbnail","ThumbnailDataAttributes","TimeDisplay","TimeDisplayDataAttributes","Track","Video","VolumeSlider","VolumeSliderControl","VolumeSliderCssVars","VolumeSliderDataAttributes","VolumeSliderRange","VolumeSliderThumb","VolumeSliderTrack","useTransitionStatus","props","forwardedRef","render","divProps","bufferedEnd","i","bufferedPercentage","state","style"],"mappings":"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","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/video-player/index.cjs","sourcesContent":[null,"'use client'\n\nimport * as React from 'react'\nimport type { VideoPlayerContextValue } from '../types.js'\n\nexport const VideoPlayerContext =\n React.createContext<VideoPlayerContextValue | null>(null)\n\nexport function useVideoPlayerContext(\n component: string,\n): VideoPlayerContextValue {\n const context = React.useContext(VideoPlayerContext)\n if (!context) {\n throw new Error(\n `<VideoPlayer.${component}> must be used within <VideoPlayer.Root>`,\n )\n }\n return context\n}\n","'use client'\n\nimport { useVideoPlayerContext } from '../contexts/video-player-context.js'\nimport type { VideoPlayerContextValue } from '../types.js'\n\n/**\n * Hook to access the VideoPlayer context from custom components.\n *\n * @example\n * ```tsx\n * function CustomControl() {\n * const { playing, toggle, currentTime, duration } = useVideoPlayer()\n *\n * return (\n * <div>\n * {playing ? 'Playing' : 'Paused'} - {currentTime}s / {duration}s\n * <button onClick={toggle}>Toggle</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useVideoPlayer(): VideoPlayerContextValue {\n return useVideoPlayerContext('useVideoPlayer')\n}\n","// ============================================================================\n// VideoPlayer Composable Parts\n// ============================================================================\n//\n// Import like: import * as VideoPlayer from './video-player/index.parts.js'\n//\n// Usage:\n// <VideoPlayer.Root>\n// <VideoPlayer.Video src=\"...\" />\n// <VideoPlayer.Controls>\n// <VideoPlayer.PlayButton />\n// <VideoPlayer.SeekSlider />\n// <VideoPlayer.TimeDisplay />\n// </VideoPlayer.Controls>\n// </VideoPlayer.Root>\n//\n\nexport { BufferedIndicator } from './components/buffered-indicator/buffered-indicator.js'\nexport { CaptionsDataAttributes } from './components/captions/captions.data-attributes.js'\nexport { Captions } from './components/captions/captions.js'\n// Captions\nexport { CaptionsButton } from './components/captions-button/captions-button.js'\nexport {\n CaptionsMenu,\n CaptionsMenuItem,\n} from './components/captions-menu/captions-menu.js'\nexport { ControlsDataAttributes } from './components/controls/controls.data-attributes.js'\nexport { Controls } from './components/controls/controls.js'\n// Display Controls\nexport { FullscreenButton } from './components/fullscreen-button/fullscreen-button.js'\nexport { MuteButton } from './components/mute-button/mute-button.js'\nexport { OverlayDataAttributes } from './components/overlay/overlay.data-attributes.js'\nexport { Overlay } from './components/overlay/overlay.js'\nexport { PictureInPictureButton } from './components/picture-in-picture-button/picture-in-picture-button.js'\n// Playback Controls\nexport { PlayButton } from './components/play-button/play-button.js'\n// Playback Rate\nexport { PlaybackRateButton } from './components/playback-rate-button/playback-rate-button.js'\nexport {\n PlaybackRateMenu,\n PlaybackRateMenuItem,\n} from './components/playback-rate-menu/playback-rate-menu.js'\n// Layout\nexport { Portal } from './components/portal/portal.js'\nexport { Poster } from './components/poster/poster.js'\n// Quality\nexport {\n QualityMenu,\n QualityMenuItem,\n} from './components/quality-menu/quality-menu.js'\n// Data Attributes & CSS Variables\nexport { RootDataAttributes } from './components/root/root.data-attributes.js'\n// Core\nexport { VideoPlayerRoot as Root } from './components/root/root.js'\nexport { SeekSliderCssVars } from './components/seek-slider/seek-slider.css-vars.js'\nexport { SeekSliderDataAttributes } from './components/seek-slider/seek-slider.data-attributes.js'\nexport {\n SeekSlider,\n SeekSliderBuffered,\n SeekSliderControl,\n SeekSliderHover,\n SeekSliderPreviewThumb,\n SeekSliderPreviewTooltip,\n SeekSliderPreviewTooltipPopup,\n SeekSliderPreviewTooltipPortal,\n SeekSliderPreviewTooltipPositioner,\n SeekSliderProgress,\n SeekSliderThumb,\n SeekSliderTrack,\n} from './components/seek-slider/seek-slider.js'\nexport { SeekSliderPreviewThumbDataAttributes } from './components/seek-slider/seek-slider-preview-thumb.data-attributes.js'\nexport { ThumbnailDataAttributes } from './components/thumbnail/thumbnail.data-attributes.js'\nexport { Thumbnail } from './components/thumbnail/thumbnail.js'\nexport { TimeDisplayDataAttributes } from './components/time-display/time-display.data-attributes.js'\nexport { TimeDisplay } from './components/time-display/time-display.js'\nexport { Track } from './components/track/track.js'\nexport { Video } from './components/video/video.js'\nexport { VolumeSliderCssVars } from './components/volume-slider/volume-slider.css-vars.js'\nexport { VolumeSliderDataAttributes } from './components/volume-slider/volume-slider.data-attributes.js'\n// Audio Controls\nexport {\n VolumeSlider,\n VolumeSliderControl,\n VolumeSliderRange,\n VolumeSliderThumb,\n VolumeSliderTrack,\n} from './components/volume-slider/volume-slider.js'\nexport {\n type TransitionStatus,\n type UseTransitionStatusOptions,\n type UseTransitionStatusReturn,\n useTransitionStatus,\n} from './hooks/use-transition-status.js'\n// Hooks\nexport { useVideoPlayer } from './hooks/use-video-player.js'\n// Types\nexport type {\n PlaybackIntent,\n PlaybackStatus,\n RenderProp,\n TrackInfo,\n VideoPlayerActions,\n VideoPlayerContextValue,\n VideoPlayerRootProps,\n VideoPlayerState,\n VideoQuality,\n VideoTextTrack,\n} from './types.js'\n","'use client'\n\nimport * as React from 'react'\nimport { useVideoPlayerContext } from '../../contexts/video-player-context.js'\nimport type { RenderProp } from '../../types.js'\n\n// ============================================================================\n// BufferedIndicator Props\n// ============================================================================\n\nexport interface BufferedIndicatorProps\n extends React.ComponentPropsWithRef<'div'> {\n render?: RenderProp<BufferedIndicatorRenderProps, BufferedIndicatorState>\n}\n\nexport interface BufferedIndicatorRenderProps {\n ref: React.Ref<HTMLElement>\n style: React.CSSProperties\n 'aria-hidden': true\n}\n\nexport interface BufferedIndicatorState {\n buffered: TimeRanges | null\n duration: number\n bufferedPercentage: number\n bufferedEnd: number\n}\n\n// ============================================================================\n// BufferedIndicator Component\n// ============================================================================\n\nexport const BufferedIndicator = React.forwardRef<\n HTMLDivElement,\n BufferedIndicatorProps\n>(function BufferedIndicator(props, forwardedRef) {\n const { render, ...divProps } = props\n const context = useVideoPlayerContext('BufferedIndicator')\n\n // Calculate buffered end position (for progress bar display)\n const bufferedEnd = React.useMemo(() => {\n if (!context.buffered || context.buffered.length === 0) return 0\n\n // Find the buffer range that contains current playback position\n for (let i = 0; i < context.buffered.length; i++) {\n if (\n context.buffered.start(i) <= context.currentTime &&\n context.currentTime <= context.buffered.end(i)\n ) {\n return context.buffered.end(i)\n }\n }\n\n // Fallback to end of first range\n return context.buffered.end(0)\n }, [context.buffered, context.currentTime])\n\n const bufferedPercentage =\n context.duration > 0 ? (bufferedEnd / context.duration) * 100 : 0\n\n const state: BufferedIndicatorState = {\n buffered: context.buffered,\n duration: context.duration,\n bufferedPercentage,\n bufferedEnd,\n }\n\n // CSS custom properties for styling\n const style = {\n '--buffered-percentage': `${bufferedPercentage}%`,\n '--buffered-end': bufferedEnd,\n ...divProps.style,\n } as React.CSSProperties\n\n const renderProps: BufferedIndicatorRenderProps = {\n ref: forwardedRef,\n style,\n 'aria-hidden': true,\n }\n\n if (render) {\n return render(renderProps, state)\n }\n\n return (\n <div ref={forwardedRef} aria-hidden=\"true\" {...divProps} style={style} />\n )\n})\n\n// ============================================================================\n// Namespace\n// ============================================================================\n\nexport namespace BufferedIndicator {\n export type Props = BufferedIndicatorProps\n export type State = BufferedIndicatorState\n}\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type TransitionStatus = 'starting' | 'ending' | undefined\n\nexport interface UseTransitionStatusOptions {\n /**\n * Whether the element should be visible/open.\n */\n open: boolean\n /**\n * Keep the element always mounted in the DOM, even when closed.\n * Only needed for JavaScript animation libraries (e.g., Framer Motion).\n * CSS transitions and animations work automatically without this.\n * @default false\n */\n keepMounted?: boolean\n}\n\nexport interface UseTransitionStatusReturn {\n /**\n * Whether the element should be rendered in the DOM.\n * Stays true during exit animations.\n */\n mounted: boolean\n /**\n * Current transition status:\n * - 'starting': First frame of enter animation\n * - 'ending': Exit animation in progress\n * - undefined: Idle state\n */\n transitionStatus: TransitionStatus\n /**\n * Ref to attach to the animated element.\n * Used to detect when CSS animations/transitions complete.\n */\n elementRef: React.RefObject<HTMLElement | null>\n}\n\n// ============================================================================\n// Utility: Wait for Animations\n// ============================================================================\n\n/**\n * Returns a promise that resolves when all CSS animations and transitions\n * on the element and its descendants have completed.\n */\nfunction waitForAnimations(element: HTMLElement): Promise<void> {\n // Collect animations from the element and all descendants\n const animations = [\n ...element.getAnimations(),\n ...Array.from(element.querySelectorAll('*')).flatMap((el) =>\n (el as HTMLElement).getAnimations(),\n ),\n ]\n\n if (animations.length === 0) {\n return Promise.resolve()\n }\n return Promise.all(animations.map((a) => a.finished))\n .then(() => {})\n .catch(() => {\n // Animation was cancelled (e.g., element removed or animation interrupted)\n })\n}\n\n// ============================================================================\n// Hook: useTransitionStatus\n// ============================================================================\n\nexport function useTransitionStatus(\n options: UseTransitionStatusOptions,\n): UseTransitionStatusReturn {\n const { open, keepMounted = false } = options\n\n const [mounted, setMounted] = React.useState(open || keepMounted)\n const [transitionStatus, setTransitionStatus] =\n React.useState<TransitionStatus>(open ? 'starting' : undefined)\n\n const elementRef = React.useRef<HTMLElement | null>(null)\n\n // Track if we're currently waiting for animations\n const waitingForAnimationsRef = React.useRef(false)\n\n // Handle open → true (enter)\n React.useEffect(() => {\n if (open) {\n // Cancel any pending exit\n waitingForAnimationsRef.current = false\n\n setMounted(true)\n setTransitionStatus('starting')\n\n // Clear starting style after first paint (double RAF for reliability)\n const raf = requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setTransitionStatus(undefined)\n })\n })\n\n return () => cancelAnimationFrame(raf)\n }\n }, [open])\n\n // Handle open → false (exit)\n React.useEffect(() => {\n if (!open && mounted && !waitingForAnimationsRef.current) {\n setTransitionStatus('ending')\n\n const element = elementRef.current\n\n if (!element) {\n // No element ref, unmount immediately\n setTransitionStatus(undefined)\n if (!keepMounted) {\n setMounted(false)\n }\n return\n }\n\n waitingForAnimationsRef.current = true\n\n // Wait a frame for the browser to process style changes and start animations\n const raf = requestAnimationFrame(() => {\n // Double RAF for reliability (like enter animation)\n requestAnimationFrame(() => {\n waitForAnimations(element).then(() => {\n // Check if we're still supposed to be unmounting\n // (user might have re-opened during animation)\n if (!waitingForAnimationsRef.current) return\n\n waitingForAnimationsRef.current = false\n setTransitionStatus(undefined)\n\n if (!keepMounted) {\n setMounted(false)\n }\n })\n })\n })\n\n return () => {\n cancelAnimationFrame(raf)\n }\n }\n }, [open, mounted, keepMounted])\n\n // Handle keepMounted change\n React.useEffect(() => {\n if (keepMounted && !mounted && !open) {\n setMounted(true)\n }\n }, [keepMounted, mounted, open])\n\n return {\n mounted: mounted || keepMounted,\n transitionStatus,\n elementRef,\n }\n}\n"]}
|
|
@@ -116,6 +116,10 @@ interface VideoPlayerActions {
|
|
|
116
116
|
resetIdle: () => void;
|
|
117
117
|
/** Set hover time for seek preview (null to clear) */
|
|
118
118
|
setHoverTime: (time: number | null) => void;
|
|
119
|
+
/** Temporarily pause playback during a seek interaction */
|
|
120
|
+
beginSeekInteraction: () => void;
|
|
121
|
+
/** Resume playback after a seek interaction if playback was previously intended */
|
|
122
|
+
endSeekInteraction: () => void;
|
|
119
123
|
}
|
|
120
124
|
interface VideoPlayerInternalHandlers {
|
|
121
125
|
onTimeUpdate: () => void;
|
|
@@ -116,6 +116,10 @@ interface VideoPlayerActions {
|
|
|
116
116
|
resetIdle: () => void;
|
|
117
117
|
/** Set hover time for seek preview (null to clear) */
|
|
118
118
|
setHoverTime: (time: number | null) => void;
|
|
119
|
+
/** Temporarily pause playback during a seek interaction */
|
|
120
|
+
beginSeekInteraction: () => void;
|
|
121
|
+
/** Resume playback after a seek interaction if playback was previously intended */
|
|
122
|
+
endSeekInteraction: () => void;
|
|
119
123
|
}
|
|
120
124
|
interface VideoPlayerInternalHandlers {
|
|
121
125
|
onTimeUpdate: () => void;
|