@therealtinhtute/baroiplayer 1.0.0

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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +384 -0
  3. package/dist/context/media.js +2 -0
  4. package/dist/context/media.js.map +1 -0
  5. package/dist/context/media.mjs +15 -0
  6. package/dist/context/media.mjs.map +1 -0
  7. package/dist/context/store.js +2 -0
  8. package/dist/context/store.js.map +1 -0
  9. package/dist/context/store.mjs +5 -0
  10. package/dist/context/store.mjs.map +1 -0
  11. package/dist/context-BMteAJDN.js +1140 -0
  12. package/dist/context-BMteAJDN.js.map +1 -0
  13. package/dist/context-DCJ_scmO.cjs +23 -0
  14. package/dist/context-DCJ_scmO.cjs.map +1 -0
  15. package/dist/core-events-B5W_j8yU.js +480 -0
  16. package/dist/core-events-B5W_j8yU.js.map +1 -0
  17. package/dist/core-events-CN0-Vhhq.cjs +2 -0
  18. package/dist/core-events-CN0-Vhhq.cjs.map +1 -0
  19. package/dist/core-plugins-Bq9KLany.js +696 -0
  20. package/dist/core-plugins-Bq9KLany.js.map +1 -0
  21. package/dist/core-plugins-CPDSHMiQ.cjs +2 -0
  22. package/dist/core-plugins-CPDSHMiQ.cjs.map +1 -0
  23. package/dist/core.js +37 -0
  24. package/dist/core.js.map +1 -0
  25. package/dist/core.mjs +1217 -0
  26. package/dist/core.mjs.map +1 -0
  27. package/dist/enhanced-components-DHv0MFvG.js +1073 -0
  28. package/dist/enhanced-components-DHv0MFvG.js.map +1 -0
  29. package/dist/enhanced-components-DTIObgB7.cjs +2 -0
  30. package/dist/enhanced-components-DTIObgB7.cjs.map +1 -0
  31. package/dist/hooks-C_r8wexn.cjs +4 -0
  32. package/dist/hooks-C_r8wexn.cjs.map +1 -0
  33. package/dist/hooks-Da2wVXlF.js +1630 -0
  34. package/dist/hooks-Da2wVXlF.js.map +1 -0
  35. package/dist/index.css +1 -0
  36. package/dist/index.js +112 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/index.mjs +6126 -0
  39. package/dist/index.mjs.map +1 -0
  40. package/dist/minimal-components-DSq5sQpy.js +2002 -0
  41. package/dist/minimal-components-DSq5sQpy.js.map +1 -0
  42. package/dist/minimal-components-DflWiihN.cjs +2 -0
  43. package/dist/minimal-components-DflWiihN.cjs.map +1 -0
  44. package/dist/minimal-components.css +1 -0
  45. package/dist/mona-loading.gif +0 -0
  46. package/dist/performance-monitor-CUW6f5ll.cjs +2 -0
  47. package/dist/performance-monitor-CUW6f5ll.cjs.map +1 -0
  48. package/dist/performance-monitor-rMW1RgV3.js +302 -0
  49. package/dist/performance-monitor-rMW1RgV3.js.map +1 -0
  50. package/dist/utils-BnscpYYd.js +2798 -0
  51. package/dist/utils-BnscpYYd.js.map +1 -0
  52. package/dist/utils-D_czS_0K.cjs +9 -0
  53. package/dist/utils-D_czS_0K.cjs.map +1 -0
  54. package/dist/utils.js +2 -0
  55. package/dist/utils.js.map +1 -0
  56. package/dist/utils.mjs +7 -0
  57. package/dist/utils.mjs.map +1 -0
  58. package/package.json +114 -0
  59. package/src/adapters/videojs-adapter.tsx +470 -0
  60. package/src/assets/mona-loading.gif +0 -0
  61. package/src/components/AnimateLoading.tsx +115 -0
  62. package/src/components/LoadingState.tsx +248 -0
  63. package/src/components/accessibility/keyboard-help-overlay.tsx +213 -0
  64. package/src/components/audio-player.tsx +85 -0
  65. package/src/components/basic/index.ts +37 -0
  66. package/src/components/enhanced/advanced-features.tsx +316 -0
  67. package/src/components/enhanced/debug-panel.tsx +422 -0
  68. package/src/components/enhanced/enhanced-controls.tsx +600 -0
  69. package/src/components/enhanced/enhanced-media-player.tsx +509 -0
  70. package/src/components/enhanced/error-handling.tsx +345 -0
  71. package/src/components/enhanced/index.ts +39 -0
  72. package/src/components/enhanced/media-player-enhanced.tsx +349 -0
  73. package/src/components/examples/basic-video-player.tsx +55 -0
  74. package/src/components/examples/custom-controls-example.tsx +63 -0
  75. package/src/components/examples/enhanced-controls-example.tsx +114 -0
  76. package/src/components/examples/enhanced-media-player-example.tsx +293 -0
  77. package/src/components/examples/loading-states-demo.tsx +142 -0
  78. package/src/components/examples/react-19-demo.tsx +381 -0
  79. package/src/components/examples/volume-orientation-demo.tsx +114 -0
  80. package/src/components/icon-demo.tsx +209 -0
  81. package/src/components/icons/index.tsx +166 -0
  82. package/src/components/icons/svg-icons/ArrowLeftIcon.tsx +18 -0
  83. package/src/components/icons/svg-icons/ArrowRightIcon.tsx +18 -0
  84. package/src/components/icons/svg-icons/AudioIcon.tsx +22 -0
  85. package/src/components/icons/svg-icons/BackwardIcon.tsx +12 -0
  86. package/src/components/icons/svg-icons/CameraIcon.tsx +19 -0
  87. package/src/components/icons/svg-icons/CheckIcon.tsx +19 -0
  88. package/src/components/icons/svg-icons/EnablePiPIcon.tsx +17 -0
  89. package/src/components/icons/svg-icons/ForwardIcon.tsx +12 -0
  90. package/src/components/icons/svg-icons/FullscreenEnterIcon.tsx +23 -0
  91. package/src/components/icons/svg-icons/FullscreenExitIcon.tsx +23 -0
  92. package/src/components/icons/svg-icons/LoadingIcon.tsx +32 -0
  93. package/src/components/icons/svg-icons/PauseIcon.tsx +23 -0
  94. package/src/components/icons/svg-icons/PlayIcon.tsx +21 -0
  95. package/src/components/icons/svg-icons/PlaybackSpeedIcon.tsx +23 -0
  96. package/src/components/icons/svg-icons/QualityIcon.tsx +21 -0
  97. package/src/components/icons/svg-icons/SettingsIcon.tsx +12 -0
  98. package/src/components/icons/svg-icons/SliderIcon.tsx +21 -0
  99. package/src/components/icons/svg-icons/SubtitleIcon.tsx +21 -0
  100. package/src/components/icons/svg-icons/SubtitleOffIcon.tsx +25 -0
  101. package/src/components/icons/svg-icons/UnPiPIcon.tsx +17 -0
  102. package/src/components/icons/svg-icons/VolumeMutedIcon.tsx +16 -0
  103. package/src/components/icons/svg-icons/VolumeOneIcon.tsx +22 -0
  104. package/src/components/icons/svg-icons/VolumeThreeIcon.tsx +16 -0
  105. package/src/components/icons/svg-icons/VolumeTwoIcon.tsx +16 -0
  106. package/src/components/legacy.tsx +93 -0
  107. package/src/components/media-metadata-display.tsx +100 -0
  108. package/src/components/media-player-audio.tsx +39 -0
  109. package/src/components/media-player-controls.tsx +226 -0
  110. package/src/components/media-player-error.tsx +163 -0
  111. package/src/components/media-player-fullscreen.tsx +109 -0
  112. package/src/components/media-player-hls.tsx +111 -0
  113. package/src/components/media-player-loading.tsx +76 -0
  114. package/src/components/media-player-play.tsx +75 -0
  115. package/src/components/media-player-root.tsx +340 -0
  116. package/src/components/media-player-seek.tsx +168 -0
  117. package/src/components/media-player-time.tsx +99 -0
  118. package/src/components/media-player-tooltip.tsx +58 -0
  119. package/src/components/media-player-video.tsx +39 -0
  120. package/src/components/media-player-volume.tsx +155 -0
  121. package/src/components/media-player.tsx +257 -0
  122. package/src/components/media-suspense.tsx +362 -0
  123. package/src/components/player-settings-form.tsx +163 -0
  124. package/src/components/react-player-wrapper.tsx +651 -0
  125. package/src/components/simple-video-player.tsx +60 -0
  126. package/src/components/ui/enhanced-seek-bar.tsx +235 -0
  127. package/src/components/ui/fullscreen-button.tsx +60 -0
  128. package/src/components/ui/media-resource-preloader.tsx +395 -0
  129. package/src/components/ui/play-button.tsx +107 -0
  130. package/src/components/ui/seek-bar.tsx +161 -0
  131. package/src/components/ui/time-display.tsx +40 -0
  132. package/src/components/ui/volume-control.tsx +143 -0
  133. package/src/components/unified/base-media-player.tsx +246 -0
  134. package/src/components/unified/media-player.tsx +75 -0
  135. package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +561 -0
  136. package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +552 -0
  137. package/src/components/variants/minimal/MinimalControls.tsx +142 -0
  138. package/src/components/variants/minimal/MinimalLoading.tsx +32 -0
  139. package/src/components/variants/minimal/MinimalMediaPlayer.tsx +315 -0
  140. package/src/components/variants/minimal/MinimalOverlay.tsx +64 -0
  141. package/src/components/variants/minimal/MinimalPlayButton.tsx +65 -0
  142. package/src/components/variants/minimal/MinimalSeekBar.tsx +150 -0
  143. package/src/components/variants/minimal/MinimalVolumeControl.tsx +80 -0
  144. package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +210 -0
  145. package/src/components/variants/minimal/components/CenterPlayButton.tsx +22 -0
  146. package/src/components/variants/minimal/components/ControlBar.tsx +146 -0
  147. package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +361 -0
  148. package/src/components/variants/minimal/components/PlaybackControls.tsx +51 -0
  149. package/src/components/variants/minimal/components/RightControls.tsx +173 -0
  150. package/src/components/variants/minimal/components/SeekBar.tsx +131 -0
  151. package/src/components/variants/minimal/components/SettingsDropdown.tsx +70 -0
  152. package/src/components/variants/minimal/components/SubtitleDisplay.tsx +21 -0
  153. package/src/components/variants/minimal/components/TimeDisplay.tsx +18 -0
  154. package/src/components/variants/minimal/components/VideoElement.tsx +40 -0
  155. package/src/components/variants/minimal/components/VolumeControl.tsx +217 -0
  156. package/src/components/variants/minimal/index.ts +23 -0
  157. package/src/components/video-player.tsx +100 -0
  158. package/src/context/error-handling.ts +394 -0
  159. package/src/context/media-context.tsx +208 -0
  160. package/src/context/media-provider.tsx +265 -0
  161. package/src/context/media-store.ts +379 -0
  162. package/src/context/persistence.ts +453 -0
  163. package/src/core/events/event-system.ts +442 -0
  164. package/src/core/events/hooks.ts +302 -0
  165. package/src/core/events/index.ts +22 -0
  166. package/src/core/events/middleware.ts +269 -0
  167. package/src/core/index.ts +22 -0
  168. package/src/core/optimization/bundle-optimizer.tsx +308 -0
  169. package/src/core/performance/cicd.ts +96 -0
  170. package/src/core/performance/index.ts +38 -0
  171. package/src/core/performance/media-loading-optimizer.ts +538 -0
  172. package/src/core/performance/performance-budgets.ts +432 -0
  173. package/src/core/performance/performance-monitor.tsx +476 -0
  174. package/src/core/performance/performance-testing.ts +459 -0
  175. package/src/core/plugins/base-plugin.ts +224 -0
  176. package/src/core/plugins/enhanced-plugin-system.ts +411 -0
  177. package/src/core/plugins/examples/analytics-plugin.ts +242 -0
  178. package/src/core/plugins/index.ts +39 -0
  179. package/src/core/plugins/registry.ts +327 -0
  180. package/src/core/plugins/types.ts +159 -0
  181. package/src/core/plugins/utils.ts +316 -0
  182. package/src/core/progressive-loading.tsx +322 -0
  183. package/src/core/providers/enhanced-hls-provider.ts +339 -0
  184. package/src/core/providers/service-provider.tsx +168 -0
  185. package/src/core/utils.tsx +38 -0
  186. package/src/features/media-session/media-session-manager.ts +429 -0
  187. package/src/features/picture-in-picture/pip-manager.ts +429 -0
  188. package/src/features/playlist/playlist-manager.ts +606 -0
  189. package/src/features/subtitles/subtitle-manager.ts +441 -0
  190. package/src/features/subtitles/subtitle-parser.ts +280 -0
  191. package/src/features/thumbnails/thumbnail-generator.ts +519 -0
  192. package/src/hooks/accessibility/index.ts +27 -0
  193. package/src/hooks/accessibility/use-accessibility-preferences.ts +188 -0
  194. package/src/hooks/accessibility/use-focus-management.ts +176 -0
  195. package/src/hooks/accessibility/use-keyboard-shortcuts.ts +144 -0
  196. package/src/hooks/accessibility/use-screen-reader.ts +182 -0
  197. package/src/hooks/core/index.ts +47 -0
  198. package/src/hooks/legacy.ts +27 -0
  199. package/src/hooks/use-enhanced-media-player.ts +468 -0
  200. package/src/hooks/use-intelligent-preloading.ts +358 -0
  201. package/src/hooks/use-keyboard-controls.ts +115 -0
  202. package/src/hooks/use-media-actions.ts +175 -0
  203. package/src/hooks/use-media-metadata.ts +89 -0
  204. package/src/hooks/use-media-optimistic.ts +270 -0
  205. package/src/hooks/use-media-player.ts +312 -0
  206. package/src/hooks/use-media-state.ts +190 -0
  207. package/src/hooks/use-memory-optimization.ts +358 -0
  208. package/src/hooks/use-optimistic-controls.ts +92 -0
  209. package/src/hooks/use-optimized-media.ts +263 -0
  210. package/src/hooks/use-touch-gestures.ts +417 -0
  211. package/src/hooks/useEnhancedSubtitles.ts +258 -0
  212. package/src/hooks/useKeyboardShortcuts.ts +74 -0
  213. package/src/hooks/useMediaControls.ts +52 -0
  214. package/src/hooks/useScreenshot.ts +57 -0
  215. package/src/hooks/useSubtitles.ts +91 -0
  216. package/src/hooks/useVideoPlayer.ts +232 -0
  217. package/src/icons/components/FullscreenIcon.tsx +37 -0
  218. package/src/icons/components/SettingsIcon.tsx +38 -0
  219. package/src/icons/components/animated/LoadingIcon.tsx +43 -0
  220. package/src/icons/components/animated/PlayPauseIcon.tsx +50 -0
  221. package/src/icons/components/media/PauseIcon.tsx +39 -0
  222. package/src/icons/components/media/PlayIcon.tsx +38 -0
  223. package/src/icons/components/volume/VolumeIcon.tsx +39 -0
  224. package/src/icons/components/volume/VolumeOffIcon.tsx +39 -0
  225. package/src/icons/index.ts +56 -0
  226. package/src/icons/provider.tsx +64 -0
  227. package/src/icons/types.ts +40 -0
  228. package/src/index-enhanced.ts +35 -0
  229. package/src/index-legacy.ts +326 -0
  230. package/src/index.css +102 -0
  231. package/src/index.ts +216 -0
  232. package/src/lib/deprecation.ts +51 -0
  233. package/src/lib/format-time.ts +37 -0
  234. package/src/lib/index.ts +3 -0
  235. package/src/lib/utils.ts +6 -0
  236. package/src/styles/globals.css +462 -0
  237. package/src/styles/minimal-player.css +589 -0
  238. package/src/styles/pixel-art.css +46 -0
  239. package/src/styles/videojs.css +100 -0
  240. package/src/test/setup.ts +79 -0
  241. package/src/types/events.ts +47 -0
  242. package/src/types/formats.ts +95 -0
  243. package/src/types/index.ts +190 -0
  244. package/src/types/videojs-plugins.d.ts +14 -0
@@ -0,0 +1,1140 @@
1
+ var le = Object.defineProperty;
2
+ var ue = (i, e, t) => e in i ? le(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var M = (i, e, t) => ue(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import S from "react";
5
+ var H = { exports: {} }, K = {};
6
+ /**
7
+ * @license React
8
+ * react-jsx-runtime.production.js
9
+ *
10
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
11
+ *
12
+ * This source code is licensed under the MIT license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ var re;
16
+ function Ee() {
17
+ if (re) return K;
18
+ re = 1;
19
+ var i = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
20
+ function t(s, n, a) {
21
+ var d = null;
22
+ if (a !== void 0 && (d = "" + a), n.key !== void 0 && (d = "" + n.key), "key" in n) {
23
+ a = {};
24
+ for (var c in n)
25
+ c !== "key" && (a[c] = n[c]);
26
+ } else a = n;
27
+ return n = a.ref, {
28
+ $$typeof: i,
29
+ type: s,
30
+ key: d,
31
+ ref: n !== void 0 ? n : null,
32
+ props: a
33
+ };
34
+ }
35
+ return K.Fragment = e, K.jsx = t, K.jsxs = t, K;
36
+ }
37
+ var W = {};
38
+ /**
39
+ * @license React
40
+ * react-jsx-runtime.development.js
41
+ *
42
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
43
+ *
44
+ * This source code is licensed under the MIT license found in the
45
+ * LICENSE file in the root directory of this source tree.
46
+ */
47
+ var se;
48
+ function de() {
49
+ return se || (se = 1, process.env.NODE_ENV !== "production" && (function() {
50
+ function i(r) {
51
+ if (r == null) return null;
52
+ if (typeof r == "function")
53
+ return r.$$typeof === l ? null : r.displayName || r.name || null;
54
+ if (typeof r == "string") return r;
55
+ switch (r) {
56
+ case L:
57
+ return "Fragment";
58
+ case v:
59
+ return "Profiler";
60
+ case U:
61
+ return "StrictMode";
62
+ case C:
63
+ return "Suspense";
64
+ case h:
65
+ return "SuspenseList";
66
+ case J:
67
+ return "Activity";
68
+ }
69
+ if (typeof r == "object")
70
+ switch (typeof r.tag == "number" && console.error(
71
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
72
+ ), r.$$typeof) {
73
+ case D:
74
+ return "Portal";
75
+ case Y:
76
+ return (r.displayName || "Context") + ".Provider";
77
+ case G:
78
+ return (r._context.displayName || "Context") + ".Consumer";
79
+ case I:
80
+ var E = r.render;
81
+ return r = r.displayName, r || (r = E.displayName || E.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
82
+ case B:
83
+ return E = r.displayName || null, E !== null ? E : i(r.type) || "Memo";
84
+ case w:
85
+ E = r._payload, r = r._init;
86
+ try {
87
+ return i(r(E));
88
+ } catch {
89
+ }
90
+ }
91
+ return null;
92
+ }
93
+ function e(r) {
94
+ return "" + r;
95
+ }
96
+ function t(r) {
97
+ try {
98
+ var E = !1;
99
+ } catch {
100
+ E = !0;
101
+ }
102
+ if (E) {
103
+ E = console;
104
+ var f = E.error, R = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
105
+ return f.call(
106
+ E,
107
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
108
+ R
109
+ ), e(r);
110
+ }
111
+ }
112
+ function s(r) {
113
+ if (r === L) return "<>";
114
+ if (typeof r == "object" && r !== null && r.$$typeof === w)
115
+ return "<...>";
116
+ try {
117
+ var E = i(r);
118
+ return E ? "<" + E + ">" : "<...>";
119
+ } catch {
120
+ return "<...>";
121
+ }
122
+ }
123
+ function n() {
124
+ var r = u.A;
125
+ return r === null ? null : r.getOwner();
126
+ }
127
+ function a() {
128
+ return Error("react-stack-top-frame");
129
+ }
130
+ function d(r) {
131
+ if (y.call(r, "key")) {
132
+ var E = Object.getOwnPropertyDescriptor(r, "key").get;
133
+ if (E && E.isReactWarning) return !1;
134
+ }
135
+ return r.key !== void 0;
136
+ }
137
+ function c(r, E) {
138
+ function f() {
139
+ N || (N = !0, console.error(
140
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
141
+ E
142
+ ));
143
+ }
144
+ f.isReactWarning = !0, Object.defineProperty(r, "key", {
145
+ get: f,
146
+ configurable: !0
147
+ });
148
+ }
149
+ function T() {
150
+ var r = i(this.type);
151
+ return z[r] || (z[r] = !0, console.error(
152
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
153
+ )), r = this.props.ref, r !== void 0 ? r : null;
154
+ }
155
+ function g(r, E, f, R, k, P, $, X) {
156
+ return f = P.ref, r = {
157
+ $$typeof: A,
158
+ type: r,
159
+ key: E,
160
+ props: P,
161
+ _owner: k
162
+ }, (f !== void 0 ? f : null) !== null ? Object.defineProperty(r, "ref", {
163
+ enumerable: !1,
164
+ get: T
165
+ }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
166
+ configurable: !1,
167
+ enumerable: !1,
168
+ writable: !0,
169
+ value: 0
170
+ }), Object.defineProperty(r, "_debugInfo", {
171
+ configurable: !1,
172
+ enumerable: !1,
173
+ writable: !0,
174
+ value: null
175
+ }), Object.defineProperty(r, "_debugStack", {
176
+ configurable: !1,
177
+ enumerable: !1,
178
+ writable: !0,
179
+ value: $
180
+ }), Object.defineProperty(r, "_debugTask", {
181
+ configurable: !1,
182
+ enumerable: !1,
183
+ writable: !0,
184
+ value: X
185
+ }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
186
+ }
187
+ function p(r, E, f, R, k, P, $, X) {
188
+ var m = E.children;
189
+ if (m !== void 0)
190
+ if (R)
191
+ if (x(m)) {
192
+ for (R = 0; R < m.length; R++)
193
+ F(m[R]);
194
+ Object.freeze && Object.freeze(m);
195
+ } else
196
+ console.error(
197
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
198
+ );
199
+ else F(m);
200
+ if (y.call(E, "key")) {
201
+ m = i(r);
202
+ var j = Object.keys(E).filter(function(ce) {
203
+ return ce !== "key";
204
+ });
205
+ R = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", te[m + R] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
206
+ `A props object containing a "key" prop is being spread into JSX:
207
+ let props = %s;
208
+ <%s {...props} />
209
+ React keys must be passed directly to JSX without using spread:
210
+ let props = %s;
211
+ <%s key={someKey} {...props} />`,
212
+ R,
213
+ m,
214
+ j,
215
+ m
216
+ ), te[m + R] = !0);
217
+ }
218
+ if (m = null, f !== void 0 && (t(f), m = "" + f), d(E) && (t(E.key), m = "" + E.key), "key" in E) {
219
+ f = {};
220
+ for (var q in E)
221
+ q !== "key" && (f[q] = E[q]);
222
+ } else f = E;
223
+ return m && c(
224
+ f,
225
+ typeof r == "function" ? r.displayName || r.name || "Unknown" : r
226
+ ), g(
227
+ r,
228
+ m,
229
+ P,
230
+ k,
231
+ n(),
232
+ f,
233
+ $,
234
+ X
235
+ );
236
+ }
237
+ function F(r) {
238
+ typeof r == "object" && r !== null && r.$$typeof === A && r._store && (r._store.validated = 1);
239
+ }
240
+ var _ = S, A = Symbol.for("react.transitional.element"), D = Symbol.for("react.portal"), L = Symbol.for("react.fragment"), U = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), Y = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), h = Symbol.for("react.suspense_list"), B = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), J = Symbol.for("react.activity"), l = Symbol.for("react.client.reference"), u = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, y = Object.prototype.hasOwnProperty, x = Array.isArray, O = console.createTask ? console.createTask : function() {
241
+ return null;
242
+ };
243
+ _ = {
244
+ "react-stack-bottom-frame": function(r) {
245
+ return r();
246
+ }
247
+ };
248
+ var N, z = {}, Z = _["react-stack-bottom-frame"].bind(
249
+ _,
250
+ a
251
+ )(), ee = O(s(a)), te = {};
252
+ W.Fragment = L, W.jsx = function(r, E, f, R, k) {
253
+ var P = 1e4 > u.recentlyCreatedOwnerStacks++;
254
+ return p(
255
+ r,
256
+ E,
257
+ f,
258
+ !1,
259
+ R,
260
+ k,
261
+ P ? Error("react-stack-top-frame") : Z,
262
+ P ? O(s(r)) : ee
263
+ );
264
+ }, W.jsxs = function(r, E, f, R, k) {
265
+ var P = 1e4 > u.recentlyCreatedOwnerStacks++;
266
+ return p(
267
+ r,
268
+ E,
269
+ f,
270
+ !0,
271
+ R,
272
+ k,
273
+ P ? Error("react-stack-top-frame") : Z,
274
+ P ? O(s(r)) : ee
275
+ );
276
+ };
277
+ })()), W;
278
+ }
279
+ var ne;
280
+ function fe() {
281
+ return ne || (ne = 1, process.env.NODE_ENV === "production" ? H.exports = /* @__PURE__ */ Ee() : H.exports = /* @__PURE__ */ de()), H.exports;
282
+ }
283
+ var ae = /* @__PURE__ */ fe();
284
+ const o = {
285
+ PLAY: "PLAY",
286
+ PAUSE: "PAUSE",
287
+ SEEK: "SEEK",
288
+ SET_VOLUME: "SET_VOLUME",
289
+ MUTE: "MUTE",
290
+ UNMUTE: "UNMUTE",
291
+ TOGGLE_MUTE: "TOGGLE_MUTE",
292
+ SET_DURATION: "SET_DURATION",
293
+ SET_CURRENT_TIME: "SET_CURRENT_TIME",
294
+ SET_BUFFERED: "SET_BUFFERED",
295
+ SET_LOADING: "SET_LOADING",
296
+ SET_ERROR: "SET_ERROR",
297
+ ENTER_FULLSCREEN: "ENTER_FULLSCREEN",
298
+ EXIT_FULLSCREEN: "EXIT_FULLSCREEN",
299
+ ENTER_PIP: "ENTER_PIP",
300
+ EXIT_PIP: "EXIT_PIP",
301
+ SET_PLAYBACK_RATE: "SET_PLAYBACK_RATE",
302
+ SET_SUBTITLE_TRACK: "SET_SUBTITLE_TRACK",
303
+ SET_RENDITION: "SET_RENDITION",
304
+ TOGGLE_SUBTITLES: "TOGGLE_SUBTITLES",
305
+ PREVIEW_TIME: "PREVIEW_TIME",
306
+ CLEAR_PREVIEW: "CLEAR_PREVIEW",
307
+ // New actions for Video.js adapter
308
+ SET_BUFFERING: "SET_BUFFERING",
309
+ SET_QUALITY_LEVEL: "SET_QUALITY_LEVEL",
310
+ SET_BANDWIDTH_ESTIMATE: "SET_BANDWIDTH_ESTIMATE",
311
+ SET_ACTIVE_TEXT_TRACKS: "SET_ACTIVE_TEXT_TRACKS"
312
+ }, oe = S.createContext(null);
313
+ function Te() {
314
+ const i = S.useContext(oe);
315
+ if (!i)
316
+ throw new Error("useMediaContext must be used within a MediaPlayer");
317
+ return i;
318
+ }
319
+ const ie = S.createContext(null);
320
+ function V() {
321
+ const i = S.useContext(ie);
322
+ if (!i)
323
+ throw new Error("useMediaStore must be used within a MediaPlayer");
324
+ return i;
325
+ }
326
+ function Ne(i) {
327
+ const e = V(), t = () => i(e.getState());
328
+ return S.useSyncExternalStore(e.subscribe, t, t);
329
+ }
330
+ function ke() {
331
+ return V().dispatch;
332
+ }
333
+ function Me(i) {
334
+ const e = V(), t = "getOptimisticState" in e, s = () => i(t ? e.getOptimisticState() : e.getState());
335
+ return S.useSyncExternalStore(e.subscribe, s, s);
336
+ }
337
+ function Le() {
338
+ const i = V(), e = Te(), t = "getOptimisticState" in i, s = "errorHandler" in e ? e.errorHandler : null, n = "isRehydrated" in e ? e.isRehydrated : !0;
339
+ return {
340
+ isEnhanced: t,
341
+ errorHandler: s,
342
+ isRehydrated: n,
343
+ actionsState: t ? i.getActionState() : null
344
+ };
345
+ }
346
+ const Q = {
347
+ isPlaying: !1,
348
+ currentTime: 0,
349
+ duration: 0,
350
+ buffered: null,
351
+ isLoading: !1,
352
+ isBuffering: !1,
353
+ error: null,
354
+ volume: 1,
355
+ isMuted: !1,
356
+ isFullscreen: !1,
357
+ isPictureInPicture: !1,
358
+ playbackRate: 1,
359
+ subtitlesShowing: !1,
360
+ selectedSubtitleTrack: null,
361
+ selectedRendition: null,
362
+ qualityLevel: -1,
363
+ bandwidthEstimate: 0,
364
+ activeTextTracks: [],
365
+ previewTime: null,
366
+ previewImage: null,
367
+ previewCoords: null,
368
+ subtitlesList: [],
369
+ renditionList: []
370
+ }, Se = {
371
+ enabled: !0,
372
+ key: "baroi-player-state",
373
+ persist: ["volume", "isMuted", "playbackRate", "subtitlesShowing"],
374
+ debounceMs: 500
375
+ };
376
+ function ye(i = Q, e = {}) {
377
+ let t = { ...i }, s = { ...i }, n = {
378
+ pending: !1,
379
+ error: null,
380
+ lastAction: null,
381
+ retryCount: 0
382
+ };
383
+ const a = { ...Se, ...e }, d = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
384
+ let T = null;
385
+ const g = (l) => (d.add(l), () => d.delete(l)), p = () => {
386
+ d.forEach((l) => l());
387
+ }, F = () => t, _ = () => s, A = () => n, D = async () => {
388
+ if (!a.enabled || typeof window > "u") return;
389
+ const l = a.persist.reduce((u, y) => (u[y] = t[y], u), {});
390
+ try {
391
+ localStorage.setItem(a.key, JSON.stringify({
392
+ ...l,
393
+ timestamp: Date.now()
394
+ }));
395
+ } catch (u) {
396
+ console.warn("Failed to persist media state:", u);
397
+ }
398
+ }, L = () => {
399
+ T && clearTimeout(T), T = setTimeout(D, a.debounceMs);
400
+ }, U = async () => {
401
+ if (!(!a.enabled || typeof window > "u"))
402
+ try {
403
+ const l = localStorage.getItem(a.key);
404
+ if (!l) return;
405
+ const u = JSON.parse(l), { timestamp: y, ...x } = u, O = 10080 * 60 * 1e3;
406
+ if (y && Date.now() - y > O) {
407
+ v();
408
+ return;
409
+ }
410
+ const N = { ...t, ...x };
411
+ JSON.stringify(N) !== JSON.stringify(t) && (t = N, s = { ...N }, p());
412
+ } catch (l) {
413
+ console.warn("Failed to rehydrate media state:", l);
414
+ }
415
+ }, v = () => {
416
+ if (!(typeof window > "u"))
417
+ try {
418
+ localStorage.removeItem(a.key);
419
+ } catch (l) {
420
+ console.warn("Failed to clear persisted state:", l);
421
+ }
422
+ }, G = (l) => {
423
+ Object.assign(a, l);
424
+ }, Y = (l) => {
425
+ const u = { ...t, ...l };
426
+ JSON.stringify(u) !== JSON.stringify(t) && (t = u, s = { ...u }, L(), p());
427
+ }, I = (l) => {
428
+ const u = `${l.type}-${Date.now()}-${Math.random()}`;
429
+ c.set(u, { ...l, timestamp: Date.now() });
430
+ const y = h(s, l);
431
+ return s = { ...s, ...y }, p(), u;
432
+ }, C = (l) => {
433
+ if (c.has(l)) {
434
+ c.delete(l), s = { ...t };
435
+ for (const [, u] of c) {
436
+ const y = h(s, u);
437
+ s = { ...s, ...y };
438
+ }
439
+ p();
440
+ }
441
+ }, h = (l, u) => {
442
+ switch (u.type) {
443
+ case o.PLAY:
444
+ return { isPlaying: !0, error: null };
445
+ case o.PAUSE:
446
+ return { isPlaying: !1 };
447
+ case o.SEEK:
448
+ return { currentTime: u.detail };
449
+ case o.SET_VOLUME:
450
+ return { volume: Math.max(0, Math.min(1, u.detail)) };
451
+ case o.MUTE:
452
+ return { isMuted: !0 };
453
+ case o.UNMUTE:
454
+ return { isMuted: !1 };
455
+ case o.TOGGLE_MUTE:
456
+ return { isMuted: !l.isMuted };
457
+ case o.SET_DURATION:
458
+ return { duration: u.detail };
459
+ case o.SET_CURRENT_TIME:
460
+ return { currentTime: u.detail };
461
+ case o.SET_BUFFERED:
462
+ return { buffered: u.detail };
463
+ case o.SET_LOADING:
464
+ return { isLoading: u.detail };
465
+ case o.SET_ERROR:
466
+ return { error: u.detail, isLoading: !1 };
467
+ case o.ENTER_FULLSCREEN:
468
+ return { isFullscreen: !0 };
469
+ case o.EXIT_FULLSCREEN:
470
+ return { isFullscreen: !1 };
471
+ case o.ENTER_PIP:
472
+ return { isPictureInPicture: !0 };
473
+ case o.EXIT_PIP:
474
+ return { isPictureInPicture: !1 };
475
+ case o.SET_PLAYBACK_RATE:
476
+ return { playbackRate: u.detail };
477
+ case o.SET_SUBTITLE_TRACK:
478
+ return { selectedSubtitleTrack: u.detail };
479
+ case o.SET_RENDITION:
480
+ return { selectedRendition: u.detail };
481
+ case o.TOGGLE_SUBTITLES:
482
+ return { subtitlesShowing: !l.subtitlesShowing };
483
+ case o.PREVIEW_TIME:
484
+ return { previewTime: u.detail };
485
+ case o.CLEAR_PREVIEW:
486
+ return { previewTime: null, previewImage: null, previewCoords: null };
487
+ default:
488
+ return console.warn(`Unknown media action type: ${u.type}`), {};
489
+ }
490
+ }, B = (l) => {
491
+ const u = h(t, l);
492
+ Y(u);
493
+ }, w = async (l) => {
494
+ n = {
495
+ pending: !0,
496
+ error: null,
497
+ lastAction: l,
498
+ retryCount: l.retryCount || 0
499
+ };
500
+ const u = I(l);
501
+ try {
502
+ await new Promise((O) => setTimeout(O, 0));
503
+ const y = h(t, l), x = { ...t, ...y };
504
+ JSON.stringify(x) !== JSON.stringify(t) && (t = x, L()), c.delete(u), n = {
505
+ pending: !1,
506
+ error: null,
507
+ lastAction: l,
508
+ retryCount: 0
509
+ }, s = { ...t };
510
+ for (const [, O] of c) {
511
+ const N = h(s, O);
512
+ s = { ...s, ...N };
513
+ }
514
+ } catch (y) {
515
+ C(u), n = {
516
+ pending: !1,
517
+ error: y instanceof Error ? y.message : "Unknown error occurred",
518
+ lastAction: l,
519
+ retryCount: (l.retryCount || 0) + 1
520
+ }, n.retryCount < 3 && J(l.type) && setTimeout(() => {
521
+ w({
522
+ ...l,
523
+ retryCount: n.retryCount
524
+ });
525
+ }, Math.pow(2, n.retryCount) * 1e3);
526
+ }
527
+ p();
528
+ }, J = (l) => [
529
+ o.PLAY,
530
+ o.PAUSE,
531
+ o.SEEK,
532
+ o.SET_VOLUME,
533
+ o.MUTE,
534
+ o.UNMUTE,
535
+ o.TOGGLE_MUTE
536
+ ].includes(l);
537
+ return U(), {
538
+ subscribe: g,
539
+ getState: F,
540
+ setState: Y,
541
+ dispatch: B,
542
+ getOptimisticState: _,
543
+ dispatchOptimistic: w,
544
+ rollbackOptimistic: C,
545
+ getActionState: A,
546
+ setPersistenceConfig: G,
547
+ rehydrateFromStorage: U,
548
+ clearPersistedState: v
549
+ };
550
+ }
551
+ const b = {
552
+ USER_PREFERENCES: "baroi-player-preferences",
553
+ SESSION_STATE: "baroi-player-session",
554
+ PLAYBACK_HISTORY: "baroi-player-history",
555
+ CACHE_TIMESTAMP: "baroi-player-cache-ts"
556
+ };
557
+ class Re {
558
+ async getItem(e) {
559
+ if (typeof window > "u") return null;
560
+ try {
561
+ return localStorage.getItem(e);
562
+ } catch (t) {
563
+ return console.warn("Failed to read from localStorage:", t), null;
564
+ }
565
+ }
566
+ async setItem(e, t) {
567
+ if (!(typeof window > "u"))
568
+ try {
569
+ localStorage.setItem(e, t);
570
+ } catch (s) {
571
+ console.warn("Failed to write to localStorage:", s);
572
+ }
573
+ }
574
+ async removeItem(e) {
575
+ if (!(typeof window > "u"))
576
+ try {
577
+ localStorage.removeItem(e);
578
+ } catch (t) {
579
+ console.warn("Failed to remove from localStorage:", t);
580
+ }
581
+ }
582
+ async clear() {
583
+ if (!(typeof window > "u"))
584
+ try {
585
+ Object.values(b).forEach((e) => {
586
+ localStorage.removeItem(e);
587
+ });
588
+ } catch (e) {
589
+ console.warn("Failed to clear localStorage:", e);
590
+ }
591
+ }
592
+ }
593
+ const me = {
594
+ userPreferences: !0,
595
+ sessionState: !0,
596
+ playbackHistory: !0,
597
+ maxHistoryItems: 50,
598
+ maxCacheAge: 10080 * 60 * 1e3,
599
+ // 7 days
600
+ debounceMs: 1e3,
601
+ storage: new Re()
602
+ };
603
+ class pe {
604
+ constructor(e = {}) {
605
+ M(this, "config");
606
+ M(this, "storage");
607
+ M(this, "debounceTimeouts", /* @__PURE__ */ new Map());
608
+ this.config = { ...me, ...e }, this.storage = this.config.storage;
609
+ }
610
+ // User preferences methods
611
+ async getUserPreferences() {
612
+ if (!this.config.userPreferences) return null;
613
+ try {
614
+ const e = await this.storage.getItem(b.USER_PREFERENCES);
615
+ if (!e) return null;
616
+ const t = JSON.parse(e);
617
+ return this.isCacheExpired(t.timestamp) ? (await this.clearUserPreferences(), null) : t.preferences;
618
+ } catch (e) {
619
+ return console.warn("Failed to get user preferences:", e), null;
620
+ }
621
+ }
622
+ async saveUserPreferences(e) {
623
+ this.config.userPreferences && this.debounce(b.USER_PREFERENCES, async () => {
624
+ try {
625
+ const s = { ...await this.getUserPreferences() || {}, ...e };
626
+ await this.storage.setItem(b.USER_PREFERENCES, JSON.stringify({
627
+ preferences: s,
628
+ timestamp: Date.now()
629
+ }));
630
+ } catch (t) {
631
+ console.warn("Failed to save user preferences:", t);
632
+ }
633
+ });
634
+ }
635
+ async clearUserPreferences() {
636
+ try {
637
+ await this.storage.removeItem(b.USER_PREFERENCES);
638
+ } catch (e) {
639
+ console.warn("Failed to clear user preferences:", e);
640
+ }
641
+ }
642
+ // Session state methods
643
+ async getSessionState() {
644
+ if (!this.config.sessionState) return null;
645
+ try {
646
+ const e = await this.storage.getItem(b.SESSION_STATE);
647
+ return e ? JSON.parse(e).state : null;
648
+ } catch (e) {
649
+ return console.warn("Failed to get session state:", e), null;
650
+ }
651
+ }
652
+ async saveSessionState(e) {
653
+ this.config.sessionState && this.debounce(b.SESSION_STATE, async () => {
654
+ try {
655
+ const s = { ...await this.getSessionState() || {
656
+ currentTime: 0,
657
+ playbackPosition: {}
658
+ }, ...e };
659
+ await this.storage.setItem(b.SESSION_STATE, JSON.stringify({
660
+ state: s,
661
+ timestamp: Date.now()
662
+ }));
663
+ } catch (t) {
664
+ console.warn("Failed to save session state:", t);
665
+ }
666
+ });
667
+ }
668
+ async clearSessionState() {
669
+ try {
670
+ await this.storage.removeItem(b.SESSION_STATE);
671
+ } catch (e) {
672
+ console.warn("Failed to clear session state:", e);
673
+ }
674
+ }
675
+ // Playback history methods
676
+ async getPlaybackHistory() {
677
+ if (!this.config.playbackHistory) return [];
678
+ try {
679
+ const e = await this.storage.getItem(b.PLAYBACK_HISTORY);
680
+ if (!e) return [];
681
+ const t = JSON.parse(e);
682
+ return this.isCacheExpired(t.timestamp) ? (await this.clearPlaybackHistory(), []) : t.history || [];
683
+ } catch (e) {
684
+ return console.warn("Failed to get playback history:", e), [];
685
+ }
686
+ }
687
+ async addToPlaybackHistory(e) {
688
+ if (this.config.playbackHistory)
689
+ try {
690
+ const t = await this.getPlaybackHistory(), s = {
691
+ ...e,
692
+ timestamp: Date.now()
693
+ }, n = t.filter((d) => d.mediaId !== e.mediaId), a = [s, ...n].slice(0, this.config.maxHistoryItems);
694
+ await this.storage.setItem(b.PLAYBACK_HISTORY, JSON.stringify({
695
+ history: a,
696
+ timestamp: Date.now()
697
+ }));
698
+ } catch (t) {
699
+ console.warn("Failed to add to playback history:", t);
700
+ }
701
+ }
702
+ async clearPlaybackHistory() {
703
+ try {
704
+ await this.storage.removeItem(b.PLAYBACK_HISTORY);
705
+ } catch (e) {
706
+ console.warn("Failed to clear playback history:", e);
707
+ }
708
+ }
709
+ // Utility methods
710
+ async savePlaybackPosition(e, t) {
711
+ const n = (await this.getSessionState())?.playbackPosition || {};
712
+ await this.saveSessionState({
713
+ playbackPosition: {
714
+ ...n,
715
+ [e]: t
716
+ }
717
+ });
718
+ }
719
+ async getPlaybackPosition(e) {
720
+ return (await this.getSessionState())?.playbackPosition?.[e] || 0;
721
+ }
722
+ // Extract preferences from MediaState
723
+ extractUserPreferences(e) {
724
+ return {
725
+ volume: e.volume,
726
+ isMuted: e.isMuted,
727
+ playbackRate: e.playbackRate,
728
+ subtitlesShowing: e.subtitlesShowing,
729
+ selectedSubtitleTrack: e.selectedSubtitleTrack?.id || null,
730
+ preferredRendition: e.selectedRendition,
731
+ autoplay: !1,
732
+ // This would come from config
733
+ keyboardShortcuts: !0
734
+ // This would come from config
735
+ };
736
+ }
737
+ // Extract session state from MediaState
738
+ extractSessionState(e, t) {
739
+ return {
740
+ currentTime: e.currentTime,
741
+ mediaId: t,
742
+ playbackPosition: {}
743
+ };
744
+ }
745
+ // Clear all persisted data
746
+ async clearAll() {
747
+ await this.storage.clear(), this.debounceTimeouts.clear();
748
+ }
749
+ // Private helper methods
750
+ isCacheExpired(e) {
751
+ return e ? Date.now() - e > this.config.maxCacheAge : !0;
752
+ }
753
+ debounce(e, t) {
754
+ const s = this.debounceTimeouts.get(e);
755
+ s && clearTimeout(s);
756
+ const n = setTimeout(async () => {
757
+ await t(), this.debounceTimeouts.delete(e);
758
+ }, this.config.debounceMs);
759
+ this.debounceTimeouts.set(e, n);
760
+ }
761
+ }
762
+ function _e(i) {
763
+ const [e] = S.useState(() => new pe(i));
764
+ return S.useEffect(() => () => {
765
+ e.clearAll();
766
+ }, [e]), e;
767
+ }
768
+ function ge(i, e, t) {
769
+ const s = _e(t), [n, a] = S.useState(!1);
770
+ return S.useEffect(() => {
771
+ let d = !0;
772
+ return (async () => {
773
+ try {
774
+ const [T, g] = await Promise.all([
775
+ s.getUserPreferences(),
776
+ s.getSessionState()
777
+ ]);
778
+ if (!d) return;
779
+ const p = {
780
+ ...T && {
781
+ volume: T.volume,
782
+ isMuted: T.isMuted,
783
+ playbackRate: T.playbackRate,
784
+ subtitlesShowing: T.subtitlesShowing
785
+ },
786
+ ...g && e === g.mediaId && {
787
+ currentTime: g.currentTime
788
+ }
789
+ };
790
+ Object.keys(p).length > 0 && console.log("Rehydrated state:", p), a(!0);
791
+ } catch (T) {
792
+ console.warn("Failed to rehydrate state:", T), a(!0);
793
+ }
794
+ })(), () => {
795
+ d = !1;
796
+ };
797
+ }, [s, e]), S.useEffect(() => {
798
+ if (!n) return;
799
+ const d = s.extractUserPreferences(i);
800
+ if (s.saveUserPreferences(d), e) {
801
+ const c = s.extractSessionState(i, e);
802
+ s.saveSessionState(c), i.currentTime > 0 && i.duration > 0 && s.savePlaybackPosition(e, i.currentTime);
803
+ }
804
+ }, [s, i, e, n]), {
805
+ manager: s,
806
+ isRehydrated: n
807
+ };
808
+ }
809
+ const he = {
810
+ maxRetries: 3,
811
+ baseDelay: 1e3,
812
+ maxDelay: 1e4,
813
+ exponentialBackoff: !0,
814
+ retryableErrors: [
815
+ "NETWORK_ERROR",
816
+ "TIMEOUT_ERROR"
817
+ /* TIMEOUT_ERROR */
818
+ ],
819
+ retryableActions: [
820
+ "PLAY",
821
+ "PAUSE",
822
+ "SEEK",
823
+ "SET_VOLUME",
824
+ "ENTER_FULLSCREEN",
825
+ "EXIT_FULLSCREEN"
826
+ ]
827
+ };
828
+ class be {
829
+ canRecover(e) {
830
+ return e.type === "NETWORK_ERROR" && e.retryCount < 3;
831
+ }
832
+ async recover(e) {
833
+ navigator.onLine === !1 && await new Promise((t) => {
834
+ const s = () => {
835
+ window.removeEventListener("online", s), t(void 0);
836
+ };
837
+ window.addEventListener("online", s);
838
+ }), await new Promise((t) => setTimeout(t, 2e3));
839
+ }
840
+ }
841
+ class we {
842
+ canRecover(e) {
843
+ return e.type === "PLAYBACK_ERROR" && e.retryCount < 2;
844
+ }
845
+ async recover(e) {
846
+ const t = document.querySelector("video, audio");
847
+ t && (t.load(), await new Promise((s) => {
848
+ const n = () => {
849
+ t.removeEventListener("canplay", n), s(void 0);
850
+ };
851
+ t.addEventListener("canplay", n);
852
+ }));
853
+ }
854
+ }
855
+ class Pe {
856
+ canRecover(e) {
857
+ return e.type === "PERMISSION_ERROR" && e.action?.type === "ENTER_FULLSCREEN";
858
+ }
859
+ async recover(e) {
860
+ console.warn("Fullscreen requires user interaction");
861
+ }
862
+ }
863
+ class Oe {
864
+ constructor(e = {}, t = []) {
865
+ M(this, "config");
866
+ M(this, "recoveryStrategies");
867
+ M(this, "errorQueue", /* @__PURE__ */ new Map());
868
+ M(this, "listeners", /* @__PURE__ */ new Set());
869
+ this.config = { ...he, ...e }, this.recoveryStrategies = [
870
+ new be(),
871
+ new we(),
872
+ new Pe(),
873
+ ...t
874
+ ];
875
+ }
876
+ // Create a media error from a generic error
877
+ createMediaError(e, t, s = 0) {
878
+ const n = Date.now();
879
+ if (e instanceof Error) {
880
+ const a = this.categorizeError(e, t);
881
+ return {
882
+ type: a,
883
+ message: e.message,
884
+ action: t,
885
+ timestamp: n,
886
+ retryable: this.isRetryable(a, t),
887
+ retryCount: s,
888
+ originalError: e
889
+ };
890
+ }
891
+ return {
892
+ type: "UNKNOWN_ERROR",
893
+ message: typeof e == "string" ? e : "Unknown error occurred",
894
+ action: t,
895
+ timestamp: n,
896
+ retryable: this.isRetryable("UNKNOWN_ERROR", t),
897
+ retryCount: s
898
+ };
899
+ }
900
+ // Categorize errors based on error properties and action context
901
+ categorizeError(e, t) {
902
+ const s = e.message.toLowerCase();
903
+ return s.includes("network") || s.includes("fetch") || s.includes("connection") || e.name === "NetworkError" ? "NETWORK_ERROR" : s.includes("permission") || s.includes("denied") || s.includes("fullscreen") || e.name === "NotAllowedError" ? "PERMISSION_ERROR" : s.includes("decode") || s.includes("format") || s.includes("codec") || t?.type === "PLAY" ? "PLAYBACK_ERROR" : s.includes("timeout") || e.name === "TimeoutError" ? "TIMEOUT_ERROR" : s.includes("not supported") || s.includes("unsupported") || e.name === "NotSupportedError" ? "NOT_SUPPORTED_ERROR" : "UNKNOWN_ERROR";
904
+ }
905
+ // Check if an error/action combination is retryable
906
+ isRetryable(e, t) {
907
+ const s = this.config.retryableErrors.includes(e), n = !t || this.config.retryableActions.includes(t.type);
908
+ return s && n;
909
+ }
910
+ // Calculate retry delay with exponential backoff
911
+ calculateRetryDelay(e) {
912
+ if (!this.config.exponentialBackoff)
913
+ return this.config.baseDelay;
914
+ const t = this.config.baseDelay * Math.pow(2, e);
915
+ return Math.min(t, this.config.maxDelay);
916
+ }
917
+ // Handle an error with automatic retry logic
918
+ async handleError(e, t, s) {
919
+ const n = this.createMediaError(e, t, t?.retryCount || 0), a = `${t?.type}-${n.timestamp}`;
920
+ this.errorQueue.set(a, n), this.listeners.forEach((d) => d(n));
921
+ for (const d of this.recoveryStrategies)
922
+ if (d.canRecover(n))
923
+ try {
924
+ await d.recover(n);
925
+ break;
926
+ } catch (c) {
927
+ console.warn("Recovery strategy failed:", c);
928
+ }
929
+ if (n.retryable && n.retryCount < this.config.maxRetries && s && t) {
930
+ const d = this.calculateRetryDelay(n.retryCount);
931
+ console.log(`Retrying action ${t.type} in ${d}ms (attempt ${n.retryCount + 1}/${this.config.maxRetries})`), setTimeout(async () => {
932
+ try {
933
+ await s({
934
+ ...t,
935
+ retryCount: n.retryCount + 1
936
+ }), this.errorQueue.delete(a);
937
+ } catch (c) {
938
+ await this.handleError(c, {
939
+ ...t,
940
+ retryCount: n.retryCount + 1
941
+ }, s);
942
+ }
943
+ }, d);
944
+ }
945
+ return n;
946
+ }
947
+ // Subscribe to error events
948
+ subscribe(e) {
949
+ return this.listeners.add(e), () => this.listeners.delete(e);
950
+ }
951
+ // Get current errors
952
+ getErrors() {
953
+ return Array.from(this.errorQueue.values());
954
+ }
955
+ // Clear specific error
956
+ clearError(e) {
957
+ this.errorQueue.delete(e);
958
+ }
959
+ // Clear all errors
960
+ clearAllErrors() {
961
+ this.errorQueue.clear();
962
+ }
963
+ // Get error statistics
964
+ getErrorStats() {
965
+ const e = this.getErrors(), t = Date.now(), s = 300 * 1e3, n = e.reduce((c, T) => (c[T.type] = (c[T.type] || 0) + 1, c), {}), a = e.filter((c) => c.retryable).length, d = e.filter((c) => t - c.timestamp < s);
966
+ return {
967
+ totalErrors: e.length,
968
+ errorsByType: n,
969
+ retryableErrors: a,
970
+ recentErrors: d
971
+ };
972
+ }
973
+ }
974
+ function Ae(i = Q) {
975
+ let e = { ...i };
976
+ const t = /* @__PURE__ */ new Set(), s = (c) => (t.add(c), () => t.delete(c)), n = () => e, a = (c) => {
977
+ const T = { ...e, ...c };
978
+ JSON.stringify(T) !== JSON.stringify(e) && (e = T, t.forEach((g) => g()));
979
+ };
980
+ return { subscribe: s, getState: n, setState: a, dispatch: (c) => {
981
+ switch (c.type) {
982
+ case o.PLAY:
983
+ a({ isPlaying: !0, error: null });
984
+ break;
985
+ case o.PAUSE:
986
+ a({ isPlaying: !1 });
987
+ break;
988
+ case o.SEEK:
989
+ a({ currentTime: c.detail });
990
+ break;
991
+ case o.SET_VOLUME:
992
+ a({ volume: Math.max(0, Math.min(1, c.detail)) });
993
+ break;
994
+ case o.MUTE:
995
+ a({ isMuted: !0 });
996
+ break;
997
+ case o.UNMUTE:
998
+ a({ isMuted: !1 });
999
+ break;
1000
+ case o.TOGGLE_MUTE:
1001
+ a({ isMuted: !e.isMuted });
1002
+ break;
1003
+ case o.SET_DURATION:
1004
+ a({ duration: c.detail });
1005
+ break;
1006
+ case o.SET_CURRENT_TIME:
1007
+ a({ currentTime: c.detail });
1008
+ break;
1009
+ case o.SET_BUFFERED:
1010
+ a({ buffered: c.detail });
1011
+ break;
1012
+ case o.SET_LOADING:
1013
+ a({ isLoading: c.detail });
1014
+ break;
1015
+ case o.SET_ERROR:
1016
+ a({ error: c.detail, isLoading: !1 });
1017
+ break;
1018
+ case o.ENTER_FULLSCREEN:
1019
+ a({ isFullscreen: !0 });
1020
+ break;
1021
+ case o.EXIT_FULLSCREEN:
1022
+ a({ isFullscreen: !1 });
1023
+ break;
1024
+ case o.ENTER_PIP:
1025
+ a({ isPictureInPicture: !0 });
1026
+ break;
1027
+ case o.EXIT_PIP:
1028
+ a({ isPictureInPicture: !1 });
1029
+ break;
1030
+ case o.SET_PLAYBACK_RATE:
1031
+ a({ playbackRate: c.detail });
1032
+ break;
1033
+ case o.SET_SUBTITLE_TRACK:
1034
+ a({ selectedSubtitleTrack: c.detail });
1035
+ break;
1036
+ case o.SET_RENDITION:
1037
+ a({ selectedRendition: c.detail });
1038
+ break;
1039
+ case o.TOGGLE_SUBTITLES:
1040
+ a({ subtitlesShowing: !e.subtitlesShowing });
1041
+ break;
1042
+ case o.PREVIEW_TIME:
1043
+ a({ previewTime: c.detail });
1044
+ break;
1045
+ case o.CLEAR_PREVIEW:
1046
+ a({ previewTime: null, previewImage: null, previewCoords: null });
1047
+ break;
1048
+ default:
1049
+ console.warn(`Unknown media action type: ${c.type}`);
1050
+ }
1051
+ } };
1052
+ }
1053
+ function Ue({
1054
+ children: i,
1055
+ mediaId: e = "media-player",
1056
+ labelId: t = "media-player-label",
1057
+ descriptionId: s = "media-player-description",
1058
+ dir: n = "ltr",
1059
+ portalContainer: a,
1060
+ tooltipDelayDuration: d = 700,
1061
+ tooltipSideOffset: c = 4,
1062
+ disabled: T = !1,
1063
+ isVideo: g = !0,
1064
+ withoutTooltip: p = !1,
1065
+ initialState: F = {},
1066
+ // React 19 enhancements
1067
+ useEnhancedStore: _ = !0,
1068
+ persistenceConfig: A,
1069
+ retryConfig: D,
1070
+ enableOptimisticUpdates: L = !0,
1071
+ enableErrorRecovery: U = !0,
1072
+ onStateRehydrated: v
1073
+ }) {
1074
+ const G = S.useRef(null), Y = S.useRef(null), I = S.useMemo(() => {
1075
+ const w = { ...Q, ...F };
1076
+ return _ ? ye(w, A) : Ae(w);
1077
+ }, [_, A]), C = S.useMemo(() => U && _ ? new Oe(D) : null, [U, _, D]), h = _ ? ge(
1078
+ I.getState(),
1079
+ e,
1080
+ A
1081
+ ) : null;
1082
+ S.useEffect(() => {
1083
+ if (h?.isRehydrated && v) {
1084
+ const w = I.getState();
1085
+ v(w);
1086
+ }
1087
+ }, [h?.isRehydrated, v, I]);
1088
+ const B = S.useMemo(
1089
+ () => ({
1090
+ mediaId: e,
1091
+ labelId: t,
1092
+ descriptionId: s,
1093
+ dir: n,
1094
+ rootRef: G,
1095
+ mediaRef: Y,
1096
+ portalContainer: a,
1097
+ tooltipDelayDuration: d,
1098
+ tooltipSideOffset: c,
1099
+ disabled: T,
1100
+ isVideo: g,
1101
+ withoutTooltip: p,
1102
+ // React 19 enhancements
1103
+ errorHandler: C,
1104
+ isEnhanced: _,
1105
+ isRehydrated: h?.isRehydrated
1106
+ }),
1107
+ [
1108
+ e,
1109
+ t,
1110
+ s,
1111
+ n,
1112
+ a,
1113
+ d,
1114
+ c,
1115
+ T,
1116
+ g,
1117
+ p,
1118
+ C,
1119
+ _,
1120
+ h?.isRehydrated
1121
+ ]
1122
+ );
1123
+ return /* @__PURE__ */ ae.jsx(oe.Provider, { value: B, children: /* @__PURE__ */ ae.jsx(ie.Provider, { value: I, children: i }) });
1124
+ }
1125
+ export {
1126
+ o as M,
1127
+ ke as a,
1128
+ Ne as b,
1129
+ V as c,
1130
+ Ue as d,
1131
+ Me as e,
1132
+ ye as f,
1133
+ oe as g,
1134
+ ie as h,
1135
+ Le as i,
1136
+ ae as j,
1137
+ Q as k,
1138
+ Te as u
1139
+ };
1140
+ //# sourceMappingURL=context-BMteAJDN.js.map