@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,159 @@
1
+ "use client"
2
+
3
+ import { IS_CHROME, IS_IOS, canGoogleCastSrc, IS_SERVER, loadScript } from './vidstack-C48MQkXV.js';
4
+ import { listenEvent, peek } from './vidstack-CZgUA94N.js';
5
+
6
+ function getCastFrameworkURL() {
7
+ return "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
8
+ }
9
+ function hasLoadedCastFramework() {
10
+ return !!window.cast?.framework;
11
+ }
12
+ function isCastAvailable() {
13
+ return !!window.chrome?.cast?.isAvailable;
14
+ }
15
+ function isCastConnected() {
16
+ return getCastContext().getCastState() === cast.framework.CastState.CONNECTED;
17
+ }
18
+ function getCastContext() {
19
+ return window.cast.framework.CastContext.getInstance();
20
+ }
21
+ function getCastSession() {
22
+ return getCastContext().getCurrentSession();
23
+ }
24
+ function getCastSessionMedia() {
25
+ return getCastSession()?.getSessionObj().media[0];
26
+ }
27
+ function hasActiveCastSession(src) {
28
+ const contentId = getCastSessionMedia()?.media.contentId;
29
+ return contentId === src?.src;
30
+ }
31
+ function getDefaultCastOptions() {
32
+ return {
33
+ language: "en-US",
34
+ autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
35
+ receiverApplicationId: chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
36
+ resumeSavedSession: true,
37
+ androidReceiverCompatible: true
38
+ };
39
+ }
40
+ function getCastErrorMessage(code) {
41
+ const defaultMessage = `Google Cast Error Code: ${code}`;
42
+ return defaultMessage;
43
+ }
44
+ function listenCastContextEvent(type, handler) {
45
+ return listenEvent(getCastContext(), type, handler);
46
+ }
47
+
48
+ class GoogleCastLoader {
49
+ name = "google-cast";
50
+ target;
51
+ #player;
52
+ /**
53
+ * @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
54
+ */
55
+ get cast() {
56
+ return getCastContext();
57
+ }
58
+ mediaType() {
59
+ return "video";
60
+ }
61
+ canPlay(src) {
62
+ return IS_CHROME && !IS_IOS && canGoogleCastSrc(src);
63
+ }
64
+ async prompt(ctx) {
65
+ let loadEvent, openEvent, errorEvent;
66
+ try {
67
+ loadEvent = await this.#loadCastFramework(ctx);
68
+ if (!this.#player) {
69
+ this.#player = new cast.framework.RemotePlayer();
70
+ new cast.framework.RemotePlayerController(this.#player);
71
+ }
72
+ openEvent = ctx.player.createEvent("google-cast-prompt-open", {
73
+ trigger: loadEvent
74
+ });
75
+ ctx.player.dispatchEvent(openEvent);
76
+ this.#notifyRemoteStateChange(ctx, "connecting", openEvent);
77
+ await this.#showPrompt(peek(ctx.$props.googleCast));
78
+ ctx.$state.remotePlaybackInfo.set({
79
+ deviceName: getCastSession()?.getCastDevice().friendlyName
80
+ });
81
+ if (isCastConnected()) this.#notifyRemoteStateChange(ctx, "connected", openEvent);
82
+ } catch (code) {
83
+ const error = code instanceof Error ? code : this.#createError(
84
+ (code + "").toUpperCase(),
85
+ "Prompt failed."
86
+ );
87
+ errorEvent = ctx.player.createEvent("google-cast-prompt-error", {
88
+ detail: error,
89
+ trigger: openEvent ?? loadEvent,
90
+ cancelable: true
91
+ });
92
+ ctx.player.dispatch(errorEvent);
93
+ this.#notifyRemoteStateChange(
94
+ ctx,
95
+ isCastConnected() ? "connected" : "disconnected",
96
+ errorEvent
97
+ );
98
+ throw error;
99
+ } finally {
100
+ ctx.player.dispatch("google-cast-prompt-close", {
101
+ trigger: errorEvent ?? openEvent ?? loadEvent
102
+ });
103
+ }
104
+ }
105
+ async load(ctx) {
106
+ if (IS_SERVER) {
107
+ throw Error("[vidstack] can not load google cast provider server-side");
108
+ }
109
+ if (!this.#player) {
110
+ throw Error("[vidstack] google cast player was not initialized");
111
+ }
112
+ return new (await import('./vidstack-BLWRqo3I.js')).GoogleCastProvider(this.#player, ctx);
113
+ }
114
+ async #loadCastFramework(ctx) {
115
+ if (hasLoadedCastFramework()) return;
116
+ const loadStartEvent = ctx.player.createEvent("google-cast-load-start");
117
+ ctx.player.dispatch(loadStartEvent);
118
+ await loadScript(getCastFrameworkURL());
119
+ await customElements.whenDefined("google-cast-launcher");
120
+ const loadedEvent = ctx.player.createEvent("google-cast-loaded", { trigger: loadStartEvent });
121
+ ctx.player.dispatch(loadedEvent);
122
+ if (!isCastAvailable()) {
123
+ throw this.#createError("CAST_NOT_AVAILABLE", "Google Cast not available on this platform.");
124
+ }
125
+ return loadedEvent;
126
+ }
127
+ async #showPrompt(options) {
128
+ this.#setOptions(options);
129
+ const errorCode = await this.cast.requestSession();
130
+ if (errorCode) {
131
+ throw this.#createError(
132
+ errorCode.toUpperCase(),
133
+ getCastErrorMessage(errorCode)
134
+ );
135
+ }
136
+ }
137
+ #setOptions(options) {
138
+ this.cast?.setOptions({
139
+ ...getDefaultCastOptions(),
140
+ ...options
141
+ });
142
+ }
143
+ #notifyRemoteStateChange(ctx, state, trigger) {
144
+ const detail = { type: "google-cast", state };
145
+ ctx.notify("remote-playback-change", detail, trigger);
146
+ }
147
+ #createError(code, message) {
148
+ const error = Error(message);
149
+ error.code = code;
150
+ return error;
151
+ }
152
+ }
153
+
154
+ var loader = /*#__PURE__*/Object.freeze({
155
+ __proto__: null,
156
+ GoogleCastLoader: GoogleCastLoader
157
+ });
158
+
159
+ export { getCastContext, getCastErrorMessage, getCastSession, getCastSessionMedia, hasActiveCastSession, listenCastContextEvent, loader };
@@ -0,0 +1,376 @@
1
+ "use client"
2
+
3
+ import * as React from 'react';
4
+ import { createReactComponent, composeRefs, listenEvent, useReactScope, scoped, computed, signal, effect, EventsController, useSignal } from './vidstack-CYK75vJF.js';
5
+ import { MediaAnnouncerInstance, Primitive, ControlsInstance, ControlsGroupInstance, TooltipInstance, TooltipTriggerInstance, TooltipContentInstance, GoogleCastButtonInstance, QualitySliderInstance, AudioGainSliderInstance, SpeedSliderInstance, useMediaState, CaptionsInstance } from './vidstack-D91K36KQ.js';
6
+ import { sliderCallbacks, Preview, Steps, Thumb, Track as Track$1, TrackFill as TrackFill$1, Value, useMediaContext } from './vidstack-BCBskRpc.js';
7
+ import { watchActiveTextTrack, formatSpokenTime, formatTime } from 'vidstack';
8
+
9
+ const MediaAnnouncerBridge = createReactComponent(MediaAnnouncerInstance, {
10
+ events: ["onChange"]
11
+ });
12
+ const MediaAnnouncer = React.forwardRef(
13
+ ({ style, children, ...props }, forwardRef) => {
14
+ return /* @__PURE__ */ React.createElement(MediaAnnouncerBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
15
+ Primitive.div,
16
+ {
17
+ ...props2,
18
+ style: { display: "contents", ...style },
19
+ ref: composeRefs(props2.ref, forwardRef)
20
+ },
21
+ children
22
+ ));
23
+ }
24
+ );
25
+ MediaAnnouncer.displayName = "MediaAnnouncer";
26
+
27
+ const ControlsBridge = createReactComponent(ControlsInstance);
28
+ const Root$5 = React.forwardRef(({ children, ...props }, forwardRef) => {
29
+ return /* @__PURE__ */ React.createElement(ControlsBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
30
+ Primitive.div,
31
+ {
32
+ ...props2,
33
+ ref: composeRefs(props2.ref, forwardRef)
34
+ },
35
+ children
36
+ ));
37
+ });
38
+ Root$5.displayName = "Controls";
39
+ const ControlsGroupBridge = createReactComponent(ControlsGroupInstance);
40
+ const Group = React.forwardRef(({ children, ...props }, forwardRef) => {
41
+ return /* @__PURE__ */ React.createElement(ControlsGroupBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
42
+ Primitive.div,
43
+ {
44
+ ...props2,
45
+ ref: composeRefs(props2.ref, forwardRef)
46
+ },
47
+ children
48
+ ));
49
+ });
50
+ Group.displayName = "ControlsGroup";
51
+
52
+ var controls = /*#__PURE__*/Object.freeze({
53
+ __proto__: null,
54
+ Group: Group,
55
+ Root: Root$5
56
+ });
57
+
58
+ const TooltipBridge = createReactComponent(TooltipInstance);
59
+ function Root$4({ children, ...props }) {
60
+ return /* @__PURE__ */ React.createElement(TooltipBridge, { ...props }, children);
61
+ }
62
+ Root$4.displayName = "Tooltip";
63
+ const TriggerBridge = createReactComponent(TooltipTriggerInstance);
64
+ const Trigger = React.forwardRef(
65
+ ({ children, ...props }, forwardRef) => {
66
+ return /* @__PURE__ */ React.createElement(TriggerBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
67
+ Primitive.button,
68
+ {
69
+ ...props2,
70
+ ref: composeRefs(props2.ref, forwardRef)
71
+ },
72
+ children
73
+ ));
74
+ }
75
+ );
76
+ Trigger.displayName = "TooltipTrigger";
77
+ const ContentBridge = createReactComponent(TooltipContentInstance);
78
+ const Content = React.forwardRef(
79
+ ({ children, ...props }, forwardRef) => {
80
+ return /* @__PURE__ */ React.createElement(ContentBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
81
+ Primitive.div,
82
+ {
83
+ ...props2,
84
+ ref: composeRefs(props2.ref, forwardRef)
85
+ },
86
+ children
87
+ ));
88
+ }
89
+ );
90
+ Content.displayName = "TooltipContent";
91
+
92
+ var tooltip = /*#__PURE__*/Object.freeze({
93
+ __proto__: null,
94
+ Content: Content,
95
+ Root: Root$4,
96
+ Trigger: Trigger
97
+ });
98
+
99
+ const GoogleCastButtonBridge = createReactComponent(GoogleCastButtonInstance, {
100
+ domEventsRegex: /^onMedia/
101
+ });
102
+ const GoogleCastButton = React.forwardRef(
103
+ ({ children, ...props }, forwardRef) => {
104
+ return /* @__PURE__ */ React.createElement(GoogleCastButtonBridge, { ...props }, (props2) => /* @__PURE__ */ React.createElement(
105
+ Primitive.button,
106
+ {
107
+ ...props2,
108
+ ref: composeRefs(props2.ref, forwardRef)
109
+ },
110
+ children
111
+ ));
112
+ }
113
+ );
114
+ GoogleCastButton.displayName = "GoogleCastButton";
115
+
116
+ const QualitySliderBridge = createReactComponent(QualitySliderInstance, {
117
+ events: sliderCallbacks,
118
+ domEventsRegex: /^onMedia/
119
+ });
120
+ const Root$3 = React.forwardRef(
121
+ ({ children, ...props }, forwardRef) => {
122
+ return /* @__PURE__ */ React.createElement(QualitySliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
123
+ }
124
+ );
125
+ Root$3.displayName = "QualitySlider";
126
+
127
+ var qualitySlider = /*#__PURE__*/Object.freeze({
128
+ __proto__: null,
129
+ Preview: Preview,
130
+ Root: Root$3,
131
+ Steps: Steps,
132
+ Thumb: Thumb,
133
+ Track: Track$1,
134
+ TrackFill: TrackFill$1,
135
+ Value: Value
136
+ });
137
+
138
+ const AudioGainSliderBridge = createReactComponent(AudioGainSliderInstance, {
139
+ events: sliderCallbacks,
140
+ domEventsRegex: /^onMedia/
141
+ });
142
+ const Root$2 = React.forwardRef(
143
+ ({ children, ...props }, forwardRef) => {
144
+ return /* @__PURE__ */ React.createElement(AudioGainSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
145
+ }
146
+ );
147
+ Root$2.displayName = "AudioGainSlider";
148
+
149
+ var audioGainSlider = /*#__PURE__*/Object.freeze({
150
+ __proto__: null,
151
+ Preview: Preview,
152
+ Root: Root$2,
153
+ Steps: Steps,
154
+ Thumb: Thumb,
155
+ Track: Track$1,
156
+ TrackFill: TrackFill$1,
157
+ Value: Value
158
+ });
159
+
160
+ const SpeedSliderBridge = createReactComponent(SpeedSliderInstance, {
161
+ events: sliderCallbacks,
162
+ domEventsRegex: /^onMedia/
163
+ });
164
+ const Root$1 = React.forwardRef(
165
+ ({ children, ...props }, forwardRef) => {
166
+ return /* @__PURE__ */ React.createElement(SpeedSliderBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
167
+ }
168
+ );
169
+ Root$1.displayName = "SpeedSlider";
170
+
171
+ var speedSlider = /*#__PURE__*/Object.freeze({
172
+ __proto__: null,
173
+ Preview: Preview,
174
+ Root: Root$1,
175
+ Steps: Steps,
176
+ Thumb: Thumb,
177
+ Track: Track$1,
178
+ TrackFill: TrackFill$1,
179
+ Value: Value
180
+ });
181
+
182
+ const Title = React.forwardRef(({ children, ...props }, forwardRef) => {
183
+ const $title = useMediaState("title");
184
+ return /* @__PURE__ */ React.createElement(Primitive.span, { ...props, ref: forwardRef }, $title, children);
185
+ });
186
+ Title.displayName = "Title";
187
+
188
+ function useActiveTextCues(track) {
189
+ const [activeCues, setActiveCues] = React.useState([]);
190
+ React.useEffect(() => {
191
+ if (!track) {
192
+ setActiveCues([]);
193
+ return;
194
+ }
195
+ function onCuesChange() {
196
+ if (track) setActiveCues(track.activeCues);
197
+ }
198
+ onCuesChange();
199
+ return listenEvent(track, "cue-change", onCuesChange);
200
+ }, [track]);
201
+ return activeCues;
202
+ }
203
+
204
+ function useActiveTextTrack(kind) {
205
+ const media = useMediaContext(), [track, setTrack] = React.useState(null);
206
+ React.useEffect(() => {
207
+ return watchActiveTextTrack(media.textTracks, kind, setTrack);
208
+ }, [kind]);
209
+ return track;
210
+ }
211
+
212
+ function useChapterTitle() {
213
+ const $track = useActiveTextTrack("chapters"), $cues = useActiveTextCues($track);
214
+ return $cues[0]?.text || "";
215
+ }
216
+
217
+ const ChapterTitle = React.forwardRef(
218
+ ({ defaultText = "", children, ...props }, forwardRef) => {
219
+ const $chapterTitle = useChapterTitle();
220
+ return /* @__PURE__ */ React.createElement(Primitive.span, { ...props, ref: forwardRef }, $chapterTitle || defaultText, children);
221
+ }
222
+ );
223
+ ChapterTitle.displayName = "ChapterTitle";
224
+
225
+ const CaptionsBridge = createReactComponent(CaptionsInstance);
226
+ const Captions = React.forwardRef(
227
+ ({ children, ...props }, forwardRef) => {
228
+ return /* @__PURE__ */ React.createElement(CaptionsBridge, { ...props, ref: forwardRef }, (props2) => /* @__PURE__ */ React.createElement(Primitive.div, { ...props2 }, children));
229
+ }
230
+ );
231
+ Captions.displayName = "Captions";
232
+
233
+ const Root = React.forwardRef(
234
+ ({ size = 96, children, ...props }, forwardRef) => {
235
+ return /* @__PURE__ */ React.createElement(
236
+ "svg",
237
+ {
238
+ width: size,
239
+ height: size,
240
+ fill: "none",
241
+ viewBox: "0 0 120 120",
242
+ "aria-hidden": "true",
243
+ "data-part": "root",
244
+ ...props,
245
+ ref: forwardRef
246
+ },
247
+ children
248
+ );
249
+ }
250
+ );
251
+ const Track = React.forwardRef(
252
+ ({ width = 8, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
253
+ "circle",
254
+ {
255
+ cx: "60",
256
+ cy: "60",
257
+ r: "54",
258
+ stroke: "currentColor",
259
+ strokeWidth: width,
260
+ "data-part": "track",
261
+ ...props,
262
+ ref
263
+ },
264
+ children
265
+ )
266
+ );
267
+ const TrackFill = React.forwardRef(
268
+ ({ width = 8, fillPercent = 50, children, ...props }, ref) => /* @__PURE__ */ React.createElement(
269
+ "circle",
270
+ {
271
+ cx: "60",
272
+ cy: "60",
273
+ r: "54",
274
+ stroke: "currentColor",
275
+ pathLength: "100",
276
+ strokeWidth: width,
277
+ strokeDasharray: 100,
278
+ strokeDashoffset: 100 - fillPercent,
279
+ "data-part": "track-fill",
280
+ ...props,
281
+ ref
282
+ },
283
+ children
284
+ )
285
+ );
286
+
287
+ var spinner = /*#__PURE__*/Object.freeze({
288
+ __proto__: null,
289
+ Root: Root,
290
+ Track: Track,
291
+ TrackFill: TrackFill
292
+ });
293
+
294
+ function createSignal(initialValue, deps = []) {
295
+ const scope = useReactScope();
296
+ return React.useMemo(() => scoped(() => signal(initialValue), scope), [scope, ...deps]);
297
+ }
298
+ function createComputed(compute, deps = []) {
299
+ const scope = useReactScope();
300
+ return React.useMemo(() => scoped(() => computed(compute), scope), [scope, ...deps]);
301
+ }
302
+ function createEffect(compute, deps = []) {
303
+ const scope = useReactScope();
304
+ React.useEffect(() => scoped(() => effect(compute), scope), [scope, ...deps]);
305
+ }
306
+ function useScoped(compute) {
307
+ const scope = useReactScope();
308
+ return React.useMemo(() => scoped(compute, scope), [scope]);
309
+ }
310
+
311
+ function useTextCues(track) {
312
+ const [cues, setCues] = React.useState([]);
313
+ React.useEffect(() => {
314
+ if (!track) return;
315
+ function onCuesChange() {
316
+ if (track) setCues([...track.cues]);
317
+ }
318
+ const events = new EventsController(track).add("add-cue", onCuesChange).add("remove-cue", onCuesChange);
319
+ onCuesChange();
320
+ return () => {
321
+ setCues([]);
322
+ events.abort();
323
+ };
324
+ }, [track]);
325
+ return cues;
326
+ }
327
+
328
+ function useChapterOptions() {
329
+ const media = useMediaContext(), track = useActiveTextTrack("chapters"), cues = useTextCues(track), $startTime = useSignal(media.$state.seekableStart), $endTime = useSignal(media.$state.seekableEnd);
330
+ useActiveTextCues(track);
331
+ return React.useMemo(() => {
332
+ const options = track ? cues.filter((cue) => cue.startTime <= $endTime && cue.endTime >= $startTime).map((cue, i) => {
333
+ let currentRef = null, stopProgressEffect;
334
+ return {
335
+ cue,
336
+ label: cue.text,
337
+ value: i.toString(),
338
+ startTimeText: formatTime(Math.max(0, cue.startTime - $startTime)),
339
+ durationText: formatSpokenTime(
340
+ Math.min($endTime, cue.endTime) - Math.max($startTime, cue.startTime)
341
+ ),
342
+ get selected() {
343
+ return cue === track.activeCues[0];
344
+ },
345
+ setProgressVar(ref) {
346
+ if (!ref || cue !== track.activeCues[0]) {
347
+ stopProgressEffect?.();
348
+ stopProgressEffect = void 0;
349
+ ref?.style.setProperty("--progress", "0%");
350
+ currentRef = null;
351
+ return;
352
+ }
353
+ if (currentRef === ref) return;
354
+ currentRef = ref;
355
+ stopProgressEffect?.();
356
+ stopProgressEffect = effect(() => {
357
+ const { realCurrentTime } = media.$state, time = realCurrentTime(), cueStartTime = Math.max($startTime, cue.startTime), duration = Math.min($endTime, cue.endTime) - cueStartTime, progress = Math.max(0, time - cueStartTime) / duration * 100;
358
+ ref.style.setProperty("--progress", progress.toFixed(3) + "%");
359
+ });
360
+ },
361
+ select(trigger) {
362
+ media.remote.seek(cue.startTime - $startTime, trigger);
363
+ }
364
+ };
365
+ }) : [];
366
+ Object.defineProperty(options, "selectedValue", {
367
+ get() {
368
+ const index = options.findIndex((option) => option.selected);
369
+ return (index >= 0 ? index : 0).toString();
370
+ }
371
+ });
372
+ return options;
373
+ }, [cues, $startTime, $endTime]);
374
+ }
375
+
376
+ export { Captions, ChapterTitle, Content, GoogleCastButton, Group, MediaAnnouncer, Root$4 as Root, Root$2 as Root$1, Root$1 as Root$2, Root$3, Root$5 as Root$4, Root as Root$5, Title, Track, TrackFill, Trigger, audioGainSlider, controls, createComputed, createEffect, createSignal, qualitySlider, speedSlider, spinner, tooltip, useActiveTextCues, useActiveTextTrack, useChapterOptions, useChapterTitle, useScoped, useTextCues };