@hanifhan1f/vidstack-react 1.12.26 → 1.12.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dev/chunks/vidstack-3rdEWplD.js +189 -0
  2. package/dev/chunks/vidstack-BRTBRJ_I.js +288 -0
  3. package/dev/chunks/vidstack-BalWqr4j.js +1422 -0
  4. package/dev/chunks/vidstack-C56TjAKZ.js +61 -0
  5. package/dev/chunks/vidstack-C5tZAkKo.js +11694 -0
  6. package/dev/chunks/vidstack-CKsUl4ll.js +1384 -0
  7. package/dev/chunks/vidstack-CXjRKTos.js +401 -0
  8. package/dev/chunks/vidstack-C_xw7iZ2.js +34 -0
  9. package/dev/chunks/vidstack-CaaASbOf.js +476 -0
  10. package/dev/chunks/vidstack-CqNX679o.js +669 -0
  11. package/dev/chunks/vidstack-D2Bi2Td9.js +1537 -0
  12. package/dev/chunks/vidstack-D3ZXOE4d.js +643 -0
  13. package/dev/chunks/vidstack-D95QIbAo.js +551 -0
  14. package/dev/chunks/vidstack-DjqYvkVp.js +84 -0
  15. package/dev/chunks/vidstack-DnmOVAbr.js +643 -0
  16. package/dev/chunks/vidstack-Dnoefs4z.js +180 -0
  17. package/dev/chunks/vidstack-DqaqkU4T.js +9 -0
  18. package/dev/chunks/vidstack-FuCbl228.js +226 -0
  19. package/dev/chunks/vidstack-PREbBNMG.js +125 -0
  20. package/dev/chunks/vidstack-S_S6XDnL.js +375 -0
  21. package/dev/chunks/vidstack-gqKBE4xH.js +376 -0
  22. package/dev/chunks/vidstack-oOGofWSl.js +668 -0
  23. package/dev/chunks/vidstack-vh0BKYWJ.js +84 -0
  24. package/dev/player/vidstack-default-components.js +5 -5
  25. package/dev/player/vidstack-default-layout.js +5 -5
  26. package/dev/player/vidstack-plyr-layout.js +4 -4
  27. package/dev/player/vidstack-remotion.js +3 -3
  28. package/dev/vidstack.js +7 -7
  29. package/package.json +1 -1
  30. package/prod/chunks/vidstack-B0SSIHIv.js +1537 -0
  31. package/prod/chunks/vidstack-B3E9kXKq.js +34 -0
  32. package/prod/chunks/vidstack-BCBskRpc.js +664 -0
  33. package/prod/chunks/vidstack-BLWRqo3I.js +470 -0
  34. package/prod/chunks/vidstack-BXAOpsiW.js +61 -0
  35. package/prod/chunks/vidstack-BZVrgeRF.js +9 -0
  36. package/prod/chunks/vidstack-BzPma_p3.js +288 -0
  37. package/prod/chunks/vidstack-C48MQkXV.js +11199 -0
  38. package/prod/chunks/vidstack-CKBLQMZi.js +159 -0
  39. package/prod/chunks/vidstack-CKapDFwB.js +376 -0
  40. package/prod/chunks/vidstack-CYK75vJF.js +1382 -0
  41. package/prod/chunks/vidstack-CtxjO6HG.js +84 -0
  42. package/prod/chunks/vidstack-CwlfLr4v.js +504 -0
  43. package/prod/chunks/vidstack-D91K36KQ.js +206 -0
  44. package/prod/chunks/vidstack-DJThTSEm.js +125 -0
  45. package/prod/chunks/vidstack-DVMwXUgY.js +189 -0
  46. package/prod/chunks/vidstack-DXSNXDnS.js +1384 -0
  47. package/prod/chunks/vidstack-D_Sd7838.js +663 -0
  48. package/prod/chunks/vidstack-DdiGCJVp.js +504 -0
  49. package/prod/chunks/vidstack-DgsBXr1J.js +84 -0
  50. package/prod/chunks/vidstack-DhSvljmQ.js +375 -0
  51. package/prod/chunks/vidstack-DlPpeEXU.js +545 -0
  52. package/prod/chunks/vidstack-xwdT591E.js +386 -0
  53. package/prod/player/vidstack-default-components.js +5 -5
  54. package/prod/player/vidstack-default-layout.js +5 -5
  55. package/prod/player/vidstack-plyr-layout.js +4 -4
  56. package/prod/player/vidstack-remotion.js +3 -3
  57. package/prod/vidstack.js +7 -7
  58. package/server/chunks/vidstack--ufi23Q6.js +1537 -0
  59. package/server/chunks/vidstack-3hd9uS5U.js +386 -0
  60. package/server/chunks/vidstack-B4rJ1ZKK.js +376 -0
  61. package/server/chunks/vidstack-BTdEfKqV.js +84 -0
  62. package/server/chunks/vidstack-B_l_DXPI.js +61 -0
  63. package/server/chunks/vidstack-Bb44UuL8.js +470 -0
  64. package/server/chunks/vidstack-Bu9QXEz1.js +159 -0
  65. package/server/chunks/vidstack-Cb_tNfNU.js +11199 -0
  66. package/server/chunks/vidstack-D4t_SZbb.js +1416 -0
  67. package/server/chunks/vidstack-D9vUNwri.js +288 -0
  68. package/server/chunks/vidstack-DM-5dPT-.js +663 -0
  69. package/server/chunks/vidstack-DOIUveQF.js +504 -0
  70. package/server/chunks/vidstack-DWfS9vAY.js +84 -0
  71. package/server/chunks/vidstack-DY51lx0R.js +189 -0
  72. package/server/chunks/vidstack-DbNoKLjz.js +664 -0
  73. package/server/chunks/vidstack-DeS67_gx.js +9 -0
  74. package/server/chunks/vidstack-DiHlnSws.js +1384 -0
  75. package/server/chunks/vidstack-DnoqxmOs.js +125 -0
  76. package/server/chunks/vidstack-SkX-mSrw.js +206 -0
  77. package/server/chunks/vidstack-VGPw_CQP.js +375 -0
  78. package/server/chunks/vidstack-dz2TmHzm.js +34 -0
  79. package/server/chunks/vidstack-e0ZPAI-d.js +504 -0
  80. package/server/chunks/vidstack-zzooMghu.js +545 -0
  81. package/server/player/vidstack-default-components.js +5 -5
  82. package/server/player/vidstack-default-layout.js +5 -5
  83. package/server/player/vidstack-plyr-layout.js +4 -4
  84. package/server/player/vidstack-remotion.js +3 -3
  85. package/server/vidstack.js +7 -7
@@ -0,0 +1,34 @@
1
+ "use client"
2
+
3
+ import { scoped } from './vidstack-CZgUA94N.js';
4
+ import { HTMLMediaProvider, HTMLAirPlayAdapter } from './vidstack-C48MQkXV.js';
5
+ import 'react';
6
+ import '@floating-ui/dom';
7
+
8
+ class AudioProvider extends HTMLMediaProvider {
9
+ $$PROVIDER_TYPE = "AUDIO";
10
+ get type() {
11
+ return "audio";
12
+ }
13
+ airPlay;
14
+ constructor(audio, ctx) {
15
+ super(audio, ctx);
16
+ scoped(() => {
17
+ this.airPlay = new HTMLAirPlayAdapter(this.media, ctx);
18
+ }, this.scope);
19
+ }
20
+ setup() {
21
+ super.setup();
22
+ if (this.type === "audio") this.ctx.notify("provider-setup", this);
23
+ }
24
+ /**
25
+ * The native HTML `<audio>` element.
26
+ *
27
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}
28
+ */
29
+ get audio() {
30
+ return this.media;
31
+ }
32
+ }
33
+
34
+ export { AudioProvider };
@@ -0,0 +1,664 @@
1
+ "use client"
2
+
3
+ import * as React from 'react';
4
+ import { useReactContext, createReactComponent, composeRefs, useSignal, noop, useStateContext, signal, effect, isString } from './vidstack-CYK75vJF.js';
5
+ import { AirPlayButtonInstance, Primitive, PlayButtonInstance, CaptionButtonInstance, FullscreenButtonInstance, MuteButtonInstance, PIPButtonInstance, SeekButtonInstance, LiveButtonInstance, SliderValueInstance, SliderInstance, SliderPreviewInstance, useSliderState, VolumeSliderInstance, IS_SERVER, ThumbnailInstance, TimeSliderInstance, SliderChaptersInstance, SliderThumbnailInstance, SliderVideoInstance, RadioGroupInstance, RadioInstance, MenuInstance, MenuButtonInstance, useMediaState, MenuItemsInstance, MenuItemInstance, GestureInstance, TimeInstance } from './vidstack-D91K36KQ.js';
6
+ import { mediaContext, mediaState, isTrackCaptionKind } from 'vidstack';
7
+ import { createPortal } from 'react-dom';
8
+
9
+ function useMediaContext() {
10
+ return useReactContext(mediaContext);
11
+ }
12
+
13
+ const AirPlayButtonBridge = createReactComponent(AirPlayButtonInstance, {
14
+ domEventsRegex: /^onMedia/
15
+ });
16
+ const AirPlayButton = React.forwardRef(
17
+ ({ children, ...props }, forwardRef) => {
18
+ return /* @__PURE__ */ React.createElement(AirPlayButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
19
+ Primitive.button,
20
+ {
21
+ ...props2,
22
+ ref: composeRefs(props2.ref, forwardRef)
23
+ },
24
+ children
25
+ ));
26
+ }
27
+ );
28
+ AirPlayButton.displayName = "AirPlayButton";
29
+
30
+ const PlayButtonBridge = createReactComponent(PlayButtonInstance, {
31
+ domEventsRegex: /^onMedia/
32
+ });
33
+ const PlayButton = React.forwardRef(
34
+ ({ children, ...props }, forwardRef) => {
35
+ return /* @__PURE__ */ React.createElement(PlayButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
36
+ Primitive.button,
37
+ {
38
+ ...props2,
39
+ ref: composeRefs(props2.ref, forwardRef)
40
+ },
41
+ children
42
+ ));
43
+ }
44
+ );
45
+ PlayButton.displayName = "PlayButton";
46
+
47
+ const CaptionButtonBridge = createReactComponent(CaptionButtonInstance, {
48
+ domEventsRegex: /^onMedia/
49
+ });
50
+ const CaptionButton = React.forwardRef(
51
+ ({ children, ...props }, forwardRef) => {
52
+ return /* @__PURE__ */ React.createElement(CaptionButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
53
+ Primitive.button,
54
+ {
55
+ ...props2,
56
+ ref: composeRefs(props2.ref, forwardRef)
57
+ },
58
+ children
59
+ ));
60
+ }
61
+ );
62
+ CaptionButton.displayName = "CaptionButton";
63
+
64
+ const FullscreenButtonBridge = createReactComponent(FullscreenButtonInstance, {
65
+ domEventsRegex: /^onMedia/
66
+ });
67
+ const FullscreenButton = React.forwardRef(
68
+ ({ children, ...props }, forwardRef) => {
69
+ return /* @__PURE__ */ React.createElement(FullscreenButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
70
+ Primitive.button,
71
+ {
72
+ ...props2,
73
+ ref: composeRefs(props2.ref, forwardRef)
74
+ },
75
+ children
76
+ ));
77
+ }
78
+ );
79
+ FullscreenButton.displayName = "FullscreenButton";
80
+
81
+ const MuteButtonBridge = createReactComponent(MuteButtonInstance, {
82
+ domEventsRegex: /^onMedia/
83
+ });
84
+ const MuteButton = React.forwardRef(
85
+ ({ children, ...props }, forwardRef) => {
86
+ return /* @__PURE__ */ React.createElement(MuteButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
87
+ Primitive.button,
88
+ {
89
+ ...props2,
90
+ ref: composeRefs(props2.ref, forwardRef)
91
+ },
92
+ children
93
+ ));
94
+ }
95
+ );
96
+ MuteButton.displayName = "MuteButton";
97
+
98
+ const PIPButtonBridge = createReactComponent(PIPButtonInstance, {
99
+ domEventsRegex: /^onMedia/
100
+ });
101
+ const PIPButton = React.forwardRef(
102
+ ({ children, ...props }, forwardRef) => {
103
+ return /* @__PURE__ */ React.createElement(PIPButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
104
+ Primitive.button,
105
+ {
106
+ ...props2,
107
+ ref: composeRefs(props2.ref, forwardRef)
108
+ },
109
+ children
110
+ ));
111
+ }
112
+ );
113
+ PIPButton.displayName = "PIPButton";
114
+
115
+ const SeekButtonBridge = createReactComponent(SeekButtonInstance, {
116
+ domEventsRegex: /^onMedia/
117
+ });
118
+ const SeekButton = React.forwardRef(
119
+ ({ children, ...props }, forwardRef) => {
120
+ return /* @__PURE__ */ React.createElement(SeekButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
121
+ Primitive.button,
122
+ {
123
+ ...props2,
124
+ ref: composeRefs(props2.ref, forwardRef)
125
+ },
126
+ children
127
+ ));
128
+ }
129
+ );
130
+ SeekButton.displayName = "SeekButton";
131
+
132
+ const LiveButtonBridge = createReactComponent(LiveButtonInstance, {
133
+ domEventsRegex: /^onMedia/
134
+ });
135
+ const LiveButton = React.forwardRef(
136
+ ({ children, ...props }, forwardRef) => {
137
+ return /* @__PURE__ */ React.createElement(LiveButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
138
+ Primitive.button,
139
+ {
140
+ ...props2,
141
+ ref: composeRefs(props2.ref, forwardRef)
142
+ },
143
+ children
144
+ ));
145
+ }
146
+ );
147
+ LiveButton.displayName = "LiveButton";
148
+
149
+ const sliderCallbacks = [
150
+ "onDragStart",
151
+ "onDragEnd",
152
+ "onDragValueChange",
153
+ "onValueChange",
154
+ "onPointerValueChange"
155
+ ];
156
+
157
+ const SliderValueBridge = createReactComponent(SliderValueInstance);
158
+
159
+ const SliderBridge = createReactComponent(SliderInstance, {
160
+ events: sliderCallbacks
161
+ });
162
+ const Root$5 = React.forwardRef(({ children, ...props }, forwardRef) => {
163
+ return /* @__PURE__ */ React.createElement(SliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
164
+ });
165
+ Root$5.displayName = "Slider";
166
+ const Thumb = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }));
167
+ Thumb.displayName = "SliderThumb";
168
+ const Track = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }));
169
+ Track.displayName = "SliderTrack";
170
+ const TrackFill = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }));
171
+ TrackFill.displayName = "SliderTrackFill";
172
+ const PreviewBridge = createReactComponent(SliderPreviewInstance);
173
+ const Preview = React.forwardRef(
174
+ ({ children, ...props }, forwardRef) => {
175
+ return /* @__PURE__ */ React.createElement(PreviewBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
176
+ Primitive.div,
177
+ {
178
+ ...props2,
179
+ ref: composeRefs(props2.ref, forwardRef)
180
+ },
181
+ children
182
+ ));
183
+ }
184
+ );
185
+ Preview.displayName = "SliderPreview";
186
+ const Value = React.forwardRef(({ children, ...props }, forwardRef) => {
187
+ return /* @__PURE__ */ React.createElement(SliderValueBridge, { ...props }, (props2, instance) => {
188
+ const $text = useSignal(() => instance.getValueText(), instance);
189
+ return /* @__PURE__ */ React.createElement(Primitive.div, { ...props2, ref: forwardRef }, $text, children);
190
+ });
191
+ });
192
+ Value.displayName = "SliderValue";
193
+ const Steps = React.forwardRef(({ children, ...props }, forwardRef) => {
194
+ const $min = useSliderState("min"), $max = useSliderState("max"), $step = useSliderState("step"), steps = ($max - $min) / $step;
195
+ return /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }, Array.from({ length: Math.floor(steps) + 1 }).map((_, step) => children(step)));
196
+ });
197
+ Steps.displayName = "SliderSteps";
198
+
199
+ var slider = /*#__PURE__*/Object.freeze({
200
+ __proto__: null,
201
+ Preview: Preview,
202
+ Root: Root$5,
203
+ Steps: Steps,
204
+ Thumb: Thumb,
205
+ Track: Track,
206
+ TrackFill: TrackFill,
207
+ Value: Value
208
+ });
209
+
210
+ const VolumeSliderBridge = createReactComponent(VolumeSliderInstance, {
211
+ events: sliderCallbacks,
212
+ domEventsRegex: /^onMedia/
213
+ });
214
+ const Root$4 = React.forwardRef(
215
+ ({ children, ...props }, forwardRef) => {
216
+ return /* @__PURE__ */ React.createElement(VolumeSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
217
+ }
218
+ );
219
+ Root$4.displayName = "VolumeSlider";
220
+
221
+ var volumeSlider = /*#__PURE__*/Object.freeze({
222
+ __proto__: null,
223
+ Preview: Preview,
224
+ Root: Root$4,
225
+ Steps: Steps,
226
+ Thumb: Thumb,
227
+ Track: Track,
228
+ TrackFill: TrackFill,
229
+ Value: Value
230
+ });
231
+
232
+ function createVTTCue(startTime = 0, endTime = 0, text = "") {
233
+ if (IS_SERVER) {
234
+ return {
235
+ startTime,
236
+ endTime,
237
+ text,
238
+ addEventListener: noop,
239
+ removeEventListener: noop,
240
+ dispatchEvent: noop
241
+ };
242
+ }
243
+ return new window.VTTCue(startTime, endTime, text);
244
+ }
245
+ function appendParamsToURL(baseUrl, params) {
246
+ const url = new URL(baseUrl);
247
+ for (const key of Object.keys(params)) {
248
+ url.searchParams.set(key, params[key] + "");
249
+ }
250
+ return url.toString();
251
+ }
252
+
253
+ const ThumbnailBridge = createReactComponent(ThumbnailInstance);
254
+ const Root$3 = React.forwardRef(({ children, ...props }, forwardRef) => {
255
+ return /* @__PURE__ */ React.createElement(ThumbnailBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
256
+ Primitive.div,
257
+ {
258
+ ...props2,
259
+ ref: composeRefs(props2.ref, forwardRef)
260
+ },
261
+ children
262
+ ));
263
+ });
264
+ Root$3.displayName = "Thumbnail";
265
+ const Img = React.forwardRef(({ children, ...props }, forwardRef) => {
266
+ const { src, img, crossOrigin } = useStateContext(ThumbnailInstance.state), $src = useSignal(src), $crossOrigin = useSignal(crossOrigin);
267
+ return /* @__PURE__ */ React.createElement(
268
+ Primitive.img,
269
+ {
270
+ crossOrigin: $crossOrigin,
271
+ ...props,
272
+ src: $src || void 0,
273
+ ref: composeRefs(img.set, forwardRef)
274
+ },
275
+ children
276
+ );
277
+ });
278
+ Img.displayName = "ThumbnailImg";
279
+
280
+ var thumbnail = /*#__PURE__*/Object.freeze({
281
+ __proto__: null,
282
+ Img: Img,
283
+ Root: Root$3
284
+ });
285
+
286
+ const TimeSliderContext = React.createContext({
287
+ $chapters: signal(null)
288
+ });
289
+ TimeSliderContext.displayName = "TimeSliderContext";
290
+ const TimeSliderBridge = createReactComponent(TimeSliderInstance, {
291
+ events: sliderCallbacks,
292
+ domEventsRegex: /^onMedia/
293
+ });
294
+ const Root$2 = React.forwardRef(
295
+ ({ children, ...props }, forwardRef) => {
296
+ const $chapters = React.useMemo(() => signal(null), []);
297
+ return /* @__PURE__ */ React.createElement(TimeSliderContext.Provider, { value: { $chapters } }, /* @__PURE__ */ React.createElement(TimeSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children)));
298
+ }
299
+ );
300
+ Root$2.displayName = "TimeSlider";
301
+ const SliderChaptersBridge = createReactComponent(SliderChaptersInstance);
302
+ const Chapters = React.forwardRef(
303
+ ({ children, ...props }, forwardRef) => {
304
+ return /* @__PURE__ */ React.createElement(SliderChaptersBridge, { ...props }, (props2, instance) => /* @__PURE__ */ React.createElement(
305
+ Primitive.div,
306
+ {
307
+ ...props2,
308
+ ref: composeRefs(props2.ref, forwardRef)
309
+ },
310
+ /* @__PURE__ */ React.createElement(ChapterTracks, { instance }, children)
311
+ ));
312
+ }
313
+ );
314
+ Chapters.displayName = "SliderChapters";
315
+ function ChapterTracks({ instance, children }) {
316
+ const $cues = useSignal(() => instance.cues, instance), refs = React.useRef([]), emptyCue = React.useRef(null), { $chapters } = React.useContext(TimeSliderContext);
317
+ if (!emptyCue.current) {
318
+ emptyCue.current = createVTTCue();
319
+ }
320
+ React.useEffect(() => {
321
+ $chapters.set(instance);
322
+ return () => void $chapters.set(null);
323
+ }, [instance]);
324
+ React.useEffect(() => {
325
+ instance.setRefs(refs.current);
326
+ }, [$cues]);
327
+ return children($cues.length ? $cues : [emptyCue.current], (el) => {
328
+ if (!el) {
329
+ refs.current.length = 0;
330
+ return;
331
+ }
332
+ refs.current.push(el);
333
+ });
334
+ }
335
+ ChapterTracks.displayName = "SliderChapterTracks";
336
+ const ChapterTitle = React.forwardRef(
337
+ ({ children, ...props }, forwardRef) => {
338
+ const { $chapters } = React.useContext(TimeSliderContext), [title, setTitle] = React.useState();
339
+ React.useEffect(() => {
340
+ return effect(() => {
341
+ const chapters = $chapters(), cue = chapters?.activePointerCue || chapters?.activeCue;
342
+ setTitle(cue?.text || "");
343
+ });
344
+ }, []);
345
+ return /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }, title, children);
346
+ }
347
+ );
348
+ ChapterTitle.displayName = "SliderChapterTitle";
349
+ const Progress = React.forwardRef((props, forwardRef) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }));
350
+ Progress.displayName = "SliderProgress";
351
+ const SliderThumbnailBridge = createReactComponent(SliderThumbnailInstance);
352
+ const ThumbnailRoot = React.forwardRef(
353
+ ({ children, ...props }, forwardRef) => {
354
+ return /* @__PURE__ */ React.createElement(SliderThumbnailBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2, ref: composeRefs(props2.ref, forwardRef) }, children));
355
+ }
356
+ );
357
+ ThumbnailRoot.displayName = "SliderThumbnail";
358
+ const Thumbnail = {
359
+ Root: ThumbnailRoot,
360
+ Img: Img
361
+ };
362
+ const VideoBridge = createReactComponent(SliderVideoInstance, {
363
+ events: ["onCanPlay", "onError"]
364
+ });
365
+ const Video = React.forwardRef(
366
+ ({ children, ...props }, forwardRef) => {
367
+ return /* @__PURE__ */ React.createElement(VideoBridge, { ...props }, (props2, instance) => /* @__PURE__ */ React.createElement(
368
+ VideoProvider,
369
+ {
370
+ ...props2,
371
+ instance,
372
+ ref: composeRefs(props2.ref, forwardRef)
373
+ },
374
+ children
375
+ ));
376
+ }
377
+ );
378
+ Video.displayName = "SliderVideo";
379
+ const VideoProvider = React.forwardRef(
380
+ ({ instance, children, ...props }, forwardRef) => {
381
+ const { canLoad } = useStateContext(mediaState), { src, video, crossOrigin } = instance.$state, $src = useSignal(src), $canLoad = useSignal(canLoad), $crossOrigin = useSignal(crossOrigin);
382
+ return /* @__PURE__ */ React.createElement(
383
+ Primitive.video,
384
+ {
385
+ style: { maxWidth: "unset" },
386
+ ...props,
387
+ src: $src || void 0,
388
+ muted: true,
389
+ playsInline: true,
390
+ preload: $canLoad ? "auto" : "none",
391
+ crossOrigin: $crossOrigin || void 0,
392
+ ref: composeRefs(video.set, forwardRef)
393
+ },
394
+ children
395
+ );
396
+ }
397
+ );
398
+ VideoProvider.displayName = "SliderVideoProvider";
399
+
400
+ var timeSlider = /*#__PURE__*/Object.freeze({
401
+ __proto__: null,
402
+ ChapterTitle: ChapterTitle,
403
+ Chapters: Chapters,
404
+ Preview: Preview,
405
+ Progress: Progress,
406
+ Root: Root$2,
407
+ Steps: Steps,
408
+ Thumb: Thumb,
409
+ Thumbnail: Thumbnail,
410
+ Track: Track,
411
+ TrackFill: TrackFill,
412
+ Value: Value,
413
+ Video: Video
414
+ });
415
+
416
+ const RadioGroupBridge = createReactComponent(RadioGroupInstance, {
417
+ events: ["onChange"]
418
+ });
419
+ const Root$1 = React.forwardRef(
420
+ ({ children, ...props }, forwardRef) => {
421
+ return /* @__PURE__ */ React.createElement(RadioGroupBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
422
+ }
423
+ );
424
+ Root$1.displayName = "RadioGroup";
425
+ const ItemBridge$1 = createReactComponent(RadioInstance, {
426
+ events: ["onChange", "onSelect"]
427
+ });
428
+ const Item$1 = React.forwardRef(({ children, ...props }, forwardRef) => {
429
+ return /* @__PURE__ */ React.createElement(ItemBridge$1, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
430
+ Primitive.div,
431
+ {
432
+ ...props2,
433
+ ref: composeRefs(props2.ref, forwardRef)
434
+ },
435
+ children
436
+ ));
437
+ });
438
+ Item$1.displayName = "RadioItem";
439
+
440
+ var radioGroup = /*#__PURE__*/Object.freeze({
441
+ __proto__: null,
442
+ Item: Item$1,
443
+ Root: Root$1
444
+ });
445
+
446
+ const MenuBridge = createReactComponent(MenuInstance, {
447
+ events: ["onOpen", "onClose"],
448
+ domEventsRegex: /^onMedia/
449
+ });
450
+ const Root = React.forwardRef(({ children, ...props }, forwardRef) => {
451
+ return /* @__PURE__ */ React.createElement(MenuBridge, { ...props, ref: forwardRef }, (props2, instance) => /* @__PURE__ */ React.createElement(
452
+ Primitive.div,
453
+ {
454
+ ...props2,
455
+ style: { display: !instance.isSubmenu ? "contents" : void 0, ...props2.style }
456
+ },
457
+ children
458
+ ));
459
+ });
460
+ Root.displayName = "Menu";
461
+ const ButtonBridge = createReactComponent(MenuButtonInstance, {
462
+ events: ["onSelect"]
463
+ });
464
+ const Button = React.forwardRef(
465
+ ({ children, ...props }, forwardRef) => {
466
+ return /* @__PURE__ */ React.createElement(ButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
467
+ Primitive.button,
468
+ {
469
+ ...props2,
470
+ ref: composeRefs(props2.ref, forwardRef)
471
+ },
472
+ children
473
+ ));
474
+ }
475
+ );
476
+ Button.displayName = "MenuButton";
477
+ const Portal = React.forwardRef(
478
+ ({ container = null, disabled = false, children, ...props }, forwardRef) => {
479
+ let fullscreen = useMediaState("fullscreen"), shouldPortal = disabled === "fullscreen" ? !fullscreen : !disabled;
480
+ const target = React.useMemo(() => {
481
+ if (IS_SERVER) return null;
482
+ const node = isString(container) ? document.querySelector(container) : container;
483
+ return node ?? document.body;
484
+ }, [container]);
485
+ return !target || !shouldPortal ? children : createPortal(
486
+ /* @__PURE__ */ React.createElement(
487
+ Primitive.div,
488
+ {
489
+ ...props,
490
+ style: { display: "contents", ...props.style },
491
+ ref: forwardRef
492
+ },
493
+ children
494
+ ),
495
+ target
496
+ );
497
+ }
498
+ );
499
+ Portal.displayName = "MenuPortal";
500
+ const ItemsBridge = createReactComponent(MenuItemsInstance);
501
+ const Items = React.forwardRef(({ children, ...props }, forwardRef) => {
502
+ return /* @__PURE__ */ React.createElement(ItemsBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
503
+ Primitive.div,
504
+ {
505
+ ...props2,
506
+ ref: composeRefs(props2.ref, forwardRef)
507
+ },
508
+ children
509
+ ));
510
+ });
511
+ Items.displayName = "MenuItems";
512
+ const ItemBridge = createReactComponent(MenuItemInstance);
513
+ const Item = React.forwardRef(({ children, ...props }, forwardRef) => {
514
+ return /* @__PURE__ */ React.createElement(ItemBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
515
+ Primitive.div,
516
+ {
517
+ ...props2,
518
+ ref: composeRefs(props2.ref, forwardRef)
519
+ },
520
+ children
521
+ ));
522
+ });
523
+ Item.displayName = "MenuItem";
524
+
525
+ var menu = /*#__PURE__*/Object.freeze({
526
+ __proto__: null,
527
+ Button: Button,
528
+ Content: Items,
529
+ Item: Item,
530
+ Items: Items,
531
+ Portal: Portal,
532
+ Radio: Item$1,
533
+ RadioGroup: Root$1,
534
+ Root: Root
535
+ });
536
+
537
+ const GestureBridge = createReactComponent(GestureInstance, {
538
+ events: ["onWillTrigger", "onTrigger"]
539
+ });
540
+ const Gesture = React.forwardRef(
541
+ ({ children, ...props }, forwardRef) => {
542
+ return /* @__PURE__ */ React.createElement(GestureBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
543
+ }
544
+ );
545
+ Gesture.displayName = "Gesture";
546
+
547
+ const TimeBridge = createReactComponent(TimeInstance);
548
+ const Time = React.forwardRef(({ children, ...props }, forwardRef) => {
549
+ return /* @__PURE__ */ React.createElement(TimeBridge, { ...props }, (props2, instance) => /* @__PURE__ */ React.createElement(
550
+ TimeText,
551
+ {
552
+ ...props2,
553
+ instance,
554
+ ref: composeRefs(props2.ref, forwardRef)
555
+ },
556
+ children
557
+ ));
558
+ });
559
+ Time.displayName = "Time";
560
+ const TimeText = React.forwardRef(
561
+ ({ instance, children, ...props }, forwardRef) => {
562
+ const { timeText } = instance.$state, $timeText = useSignal(timeText);
563
+ return /* @__PURE__ */ React.createElement(Primitive.div, { ...props, ref: forwardRef }, $timeText, children);
564
+ }
565
+ );
566
+ TimeText.displayName = "TimeText";
567
+
568
+ function useMediaPlayer() {
569
+ const context = useMediaContext();
570
+ return context?.player || null;
571
+ }
572
+
573
+ function useAudioOptions() {
574
+ const media = useMediaContext(), { audioTracks, audioTrack } = media.$state, $audioTracks = useSignal(audioTracks);
575
+ useSignal(audioTrack);
576
+ return React.useMemo(() => {
577
+ const options = $audioTracks.map((track) => ({
578
+ track,
579
+ label: track.label,
580
+ value: getTrackValue$1(track),
581
+ get selected() {
582
+ return audioTrack() === track;
583
+ },
584
+ select(trigger) {
585
+ const index = audioTracks().indexOf(track);
586
+ if (index >= 0) media.remote.changeAudioTrack(index, trigger);
587
+ }
588
+ }));
589
+ Object.defineProperty(options, "disabled", {
590
+ get() {
591
+ return options.length <= 1;
592
+ }
593
+ });
594
+ Object.defineProperty(options, "selectedTrack", {
595
+ get() {
596
+ return audioTrack();
597
+ }
598
+ });
599
+ Object.defineProperty(options, "selectedValue", {
600
+ get() {
601
+ const track = audioTrack();
602
+ return track ? getTrackValue$1(track) : void 0;
603
+ }
604
+ });
605
+ return options;
606
+ }, [$audioTracks]);
607
+ }
608
+ function getTrackValue$1(track) {
609
+ return track.label.toLowerCase();
610
+ }
611
+
612
+ function useCaptionOptions({ off = true } = {}) {
613
+ const media = useMediaContext(), { textTracks, textTrack } = media.$state, $textTracks = useSignal(textTracks);
614
+ useSignal(textTrack);
615
+ return React.useMemo(() => {
616
+ const captionTracks = $textTracks.filter(isTrackCaptionKind), options = captionTracks.map((track) => ({
617
+ track,
618
+ label: track.label,
619
+ value: getTrackValue(track),
620
+ get selected() {
621
+ return textTrack() === track;
622
+ },
623
+ select(trigger) {
624
+ const index = textTracks().indexOf(track);
625
+ if (index >= 0) media.remote.changeTextTrackMode(index, "showing", trigger);
626
+ }
627
+ }));
628
+ if (off) {
629
+ options.unshift({
630
+ track: null,
631
+ label: isString(off) ? off : "Off",
632
+ value: "off",
633
+ get selected() {
634
+ return !textTrack();
635
+ },
636
+ select(trigger) {
637
+ media.remote.toggleCaptions(trigger);
638
+ }
639
+ });
640
+ }
641
+ Object.defineProperty(options, "disabled", {
642
+ get() {
643
+ return !captionTracks.length;
644
+ }
645
+ });
646
+ Object.defineProperty(options, "selectedTrack", {
647
+ get() {
648
+ return textTrack();
649
+ }
650
+ });
651
+ Object.defineProperty(options, "selectedValue", {
652
+ get() {
653
+ const track = textTrack();
654
+ return track ? getTrackValue(track) : "off";
655
+ }
656
+ });
657
+ return options;
658
+ }, [$textTracks]);
659
+ }
660
+ function getTrackValue(track) {
661
+ return track.id + ":" + track.kind + "-" + track.label.toLowerCase();
662
+ }
663
+
664
+ export { AirPlayButton, Button, CaptionButton, ChapterTitle, Chapters, FullscreenButton, Gesture, Img, Item$1 as Item, Items, LiveButton, MuteButton, PIPButton, PlayButton, Portal, Preview, Progress, Root$3 as Root, Root$2 as Root$1, Root as Root$2, Root$1 as Root$3, Root$4, Root$5, SeekButton, Steps, Thumb, Thumbnail, Time, Track, TrackFill, Value, appendParamsToURL, menu, radioGroup, slider, sliderCallbacks, thumbnail, timeSlider, useAudioOptions, useCaptionOptions, useMediaContext, useMediaPlayer, volumeSlider };