suada-components 1.0.2504170948 → 1.1.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 (200) hide show
  1. package/dist/components/BreadCrumb/Breadcrumb.js.map +1 -1
  2. package/dist/components/Button/Button.interface.d.ts +1 -0
  3. package/dist/components/DailyMotion-B2EpqlJO.esm.js +178 -0
  4. package/dist/components/DailyMotion-BYA5rhY5.js +180 -0
  5. package/dist/components/Facebook-DBxSErS8.esm.js +179 -0
  6. package/dist/components/Facebook-DJMdBwGM.js +181 -0
  7. package/dist/components/FilePlayer-DLiC_Doh.esm.js +408 -0
  8. package/dist/components/FilePlayer-DRqq2T-L.js +410 -0
  9. package/dist/components/Kaltura-BAvKhQp8.esm.js +176 -0
  10. package/dist/components/Kaltura-DFK3UxTc.js +178 -0
  11. package/dist/components/Mixcloud-C0S4Txcb.esm.js +164 -0
  12. package/dist/components/Mixcloud-CnG6kbdi.js +166 -0
  13. package/dist/components/Mux-BCS9rYAf.esm.js +264 -0
  14. package/dist/components/Mux-ChXwYRDL.js +266 -0
  15. package/dist/components/Preview-CPdzmWpt.js +175 -0
  16. package/dist/components/Preview-MgDcO7wW.esm.js +173 -0
  17. package/dist/components/SoundCloud-BxxMgfs2.esm.js +181 -0
  18. package/dist/components/SoundCloud-CcFGRoSv.js +183 -0
  19. package/dist/components/Streamable-BIBOfZ0w.js +176 -0
  20. package/dist/components/Streamable-Drn6K8AN.esm.js +174 -0
  21. package/dist/components/Twitch-CGC2HQMj.esm.js +168 -0
  22. package/dist/components/Twitch-DoUQRPQR.js +170 -0
  23. package/dist/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  24. package/dist/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  25. package/dist/components/VideoPlayer/Controls/Controls.interface.js +2 -0
  26. package/dist/components/VideoPlayer/Controls/Controls.interface.js.map +1 -0
  27. package/dist/components/VideoPlayer/Controls/Controls.js +36 -0
  28. package/dist/components/VideoPlayer/Controls/Controls.js.map +1 -0
  29. package/dist/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  30. package/dist/components/VideoPlayer/Controls/Controls.styles.js +25 -0
  31. package/dist/components/VideoPlayer/Controls/Controls.styles.js.map +1 -0
  32. package/dist/components/VideoPlayer/Controls/index.d.ts +1 -0
  33. package/dist/components/VideoPlayer/Controls/index.js +2 -0
  34. package/dist/components/VideoPlayer/Controls/index.js.map +1 -0
  35. package/dist/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  36. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  37. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.js +2 -0
  38. package/dist/components/VideoPlayer/PlaybackSpeedMenu.interface.js.map +1 -0
  39. package/dist/components/VideoPlayer/PlaybackSpeedMenu.js +20 -0
  40. package/dist/components/VideoPlayer/PlaybackSpeedMenu.js.map +1 -0
  41. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  42. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.js +18 -0
  43. package/dist/components/VideoPlayer/PlaybackSpeedMenu.styles.js.map +1 -0
  44. package/dist/components/VideoPlayer/Player.d.ts +3 -11
  45. package/dist/components/VideoPlayer/Player.interface.d.ts +63 -0
  46. package/dist/components/VideoPlayer/Player.interface.js +2 -0
  47. package/dist/components/VideoPlayer/Player.interface.js.map +1 -0
  48. package/dist/components/VideoPlayer/Player.js +82 -97
  49. package/dist/components/VideoPlayer/Player.js.map +1 -1
  50. package/dist/components/VideoPlayer/Player.styles.d.ts +8 -0
  51. package/dist/components/VideoPlayer/Player.styles.js +17 -0
  52. package/dist/components/VideoPlayer/Player.styles.js.map +1 -0
  53. package/dist/components/VideoPlayer/VideoPlayer.stories.d.ts +10 -26
  54. package/dist/components/VideoPlayer/VideoPlayer.stories.js +174 -19
  55. package/dist/components/VideoPlayer/VideoPlayer.stories.js.map +1 -1
  56. package/dist/components/VideoPlayer/constants/index.d.ts +2 -0
  57. package/dist/components/VideoPlayer/constants/index.js +31 -0
  58. package/dist/components/VideoPlayer/constants/index.js.map +1 -0
  59. package/dist/components/VideoPlayer/parseVtt.d.ts +6 -0
  60. package/dist/components/VideoPlayer/parseVtt.js +35 -0
  61. package/dist/components/VideoPlayer/parseVtt.js.map +1 -0
  62. package/dist/components/VideoPlayer/timeConversion.d.ts +5 -0
  63. package/dist/components/VideoPlayer/timeConversion.js +70 -0
  64. package/dist/components/VideoPlayer/timeConversion.js.map +1 -0
  65. package/dist/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  66. package/dist/components/VideoPlayer/useDynamicPosition.js +50 -0
  67. package/dist/components/VideoPlayer/useDynamicPosition.js.map +1 -0
  68. package/dist/components/VideoPlayer/useEventListener.d.ts +3 -0
  69. package/dist/components/VideoPlayer/useEventListener.js +27 -0
  70. package/dist/components/VideoPlayer/useEventListener.js.map +1 -0
  71. package/dist/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  72. package/dist/components/VideoPlayer/useMenuToggle.js +25 -0
  73. package/dist/components/VideoPlayer/useMenuToggle.js.map +1 -0
  74. package/dist/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  75. package/dist/components/VideoPlayer/useOnOutsideClick.js +16 -0
  76. package/dist/components/VideoPlayer/useOnOutsideClick.js.map +1 -0
  77. package/dist/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  78. package/dist/components/VideoPlayer/usePlayerControls.js +330 -0
  79. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -0
  80. package/dist/components/Vidyard-B-jW75yA.esm.js +172 -0
  81. package/dist/components/Vidyard-If2H-ayj.js +174 -0
  82. package/dist/components/Vimeo-Cvg3rB5o.esm.js +213 -0
  83. package/dist/components/Vimeo-hI3cddOi.js +215 -0
  84. package/dist/components/Wistia-BtYIM6Uo.esm.js +188 -0
  85. package/dist/components/Wistia-CZwfIsgx.js +190 -0
  86. package/dist/components/YouTube-D1u9T9FZ.js +260 -0
  87. package/dist/components/YouTube-vwMwhQ13.esm.js +258 -0
  88. package/dist/components/components/Button/Button.interface.d.ts +1 -0
  89. package/dist/components/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  90. package/dist/components/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  91. package/dist/components/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  92. package/dist/components/components/VideoPlayer/Controls/index.d.ts +1 -0
  93. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  94. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  95. package/dist/components/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  96. package/dist/components/components/VideoPlayer/Player.d.ts +3 -11
  97. package/dist/components/components/VideoPlayer/Player.interface.d.ts +63 -0
  98. package/dist/components/components/VideoPlayer/Player.styles.d.ts +8 -0
  99. package/dist/components/components/VideoPlayer/constants/index.d.ts +2 -0
  100. package/dist/components/components/VideoPlayer/parseVtt.d.ts +6 -0
  101. package/dist/components/components/VideoPlayer/timeConversion.d.ts +5 -0
  102. package/dist/components/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  103. package/dist/components/components/VideoPlayer/useEventListener.d.ts +3 -0
  104. package/dist/components/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  105. package/dist/components/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  106. package/dist/components/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  107. package/dist/components/icons/Heart.d.ts +7 -0
  108. package/dist/components/icons/Maximize.d.ts +3 -0
  109. package/dist/components/icons/Meter.d.ts +3 -0
  110. package/dist/components/icons/Minimize.d.ts +3 -0
  111. package/dist/components/icons/Pause.d.ts +3 -0
  112. package/dist/components/icons/Play.d.ts +3 -0
  113. package/dist/components/icons/Rewind.d.ts +7 -0
  114. package/dist/components/icons/Skip.d.ts +8 -0
  115. package/dist/components/icons/Subtitles.d.ts +7 -0
  116. package/dist/components/icons/VideoCheckmark.d.ts +3 -0
  117. package/dist/components/icons/VolumeMute.d.ts +8 -0
  118. package/dist/components/icons/VolumeUp.d.ts +8 -0
  119. package/dist/components/icons/index.d.ts +11 -0
  120. package/dist/components/index-DLzCbCHu.esm.js +94482 -0
  121. package/dist/components/index-wLnkslO9.js +94536 -0
  122. package/dist/components/index.esm.js +3 -122501
  123. package/dist/icons/Heart.d.ts +7 -0
  124. package/dist/icons/Heart.js +28 -0
  125. package/dist/icons/Heart.js.map +1 -0
  126. package/dist/icons/Maximize.d.ts +3 -0
  127. package/dist/icons/Maximize.js +28 -0
  128. package/dist/icons/Maximize.js.map +1 -0
  129. package/dist/icons/Meter.d.ts +3 -0
  130. package/dist/icons/Meter.js +28 -0
  131. package/dist/icons/Meter.js.map +1 -0
  132. package/dist/icons/Minimize.d.ts +3 -0
  133. package/dist/icons/Minimize.js +28 -0
  134. package/dist/icons/Minimize.js.map +1 -0
  135. package/dist/icons/Pause.d.ts +3 -0
  136. package/dist/icons/Pause.js +28 -0
  137. package/dist/icons/Pause.js.map +1 -0
  138. package/dist/icons/Play.d.ts +3 -0
  139. package/dist/icons/Play.js +28 -0
  140. package/dist/icons/Play.js.map +1 -0
  141. package/dist/icons/Rewind.d.ts +7 -0
  142. package/dist/icons/Rewind.js +28 -0
  143. package/dist/icons/Rewind.js.map +1 -0
  144. package/dist/icons/Skip.d.ts +8 -0
  145. package/dist/icons/Skip.js +28 -0
  146. package/dist/icons/Skip.js.map +1 -0
  147. package/dist/icons/Subtitles.d.ts +7 -0
  148. package/dist/icons/Subtitles.js +28 -0
  149. package/dist/icons/Subtitles.js.map +1 -0
  150. package/dist/icons/VideoCheckmark.d.ts +3 -0
  151. package/dist/icons/VideoCheckmark.js +28 -0
  152. package/dist/icons/VideoCheckmark.js.map +1 -0
  153. package/dist/icons/VolumeMute.d.ts +8 -0
  154. package/dist/icons/VolumeMute.js +28 -0
  155. package/dist/icons/VolumeMute.js.map +1 -0
  156. package/dist/icons/VolumeUp.d.ts +8 -0
  157. package/dist/icons/VolumeUp.js +28 -0
  158. package/dist/icons/VolumeUp.js.map +1 -0
  159. package/dist/icons/components/Button/Button.interface.d.ts +1 -0
  160. package/dist/icons/components/VideoPlayer/Controls/Controls.d.ts +4 -0
  161. package/dist/icons/components/VideoPlayer/Controls/Controls.interface.d.ts +32 -0
  162. package/dist/icons/components/VideoPlayer/Controls/Controls.styles.d.ts +16 -0
  163. package/dist/icons/components/VideoPlayer/Controls/index.d.ts +1 -0
  164. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.d.ts +4 -0
  165. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.interface.d.ts +18 -0
  166. package/dist/icons/components/VideoPlayer/PlaybackSpeedMenu.styles.d.ts +4 -0
  167. package/dist/icons/components/VideoPlayer/Player.d.ts +3 -11
  168. package/dist/icons/components/VideoPlayer/Player.interface.d.ts +63 -0
  169. package/dist/icons/components/VideoPlayer/Player.styles.d.ts +8 -0
  170. package/dist/icons/components/VideoPlayer/constants/index.d.ts +2 -0
  171. package/dist/icons/components/VideoPlayer/parseVtt.d.ts +6 -0
  172. package/dist/icons/components/VideoPlayer/timeConversion.d.ts +5 -0
  173. package/dist/icons/components/VideoPlayer/useDynamicPosition.d.ts +16 -0
  174. package/dist/icons/components/VideoPlayer/useEventListener.d.ts +3 -0
  175. package/dist/icons/components/VideoPlayer/useMenuToggle.d.ts +22 -0
  176. package/dist/icons/components/VideoPlayer/useOnOutsideClick.d.ts +3 -0
  177. package/dist/icons/components/VideoPlayer/usePlayerControls.d.ts +3 -0
  178. package/dist/icons/icons/Heart.d.ts +7 -0
  179. package/dist/icons/icons/Maximize.d.ts +3 -0
  180. package/dist/icons/icons/Meter.d.ts +3 -0
  181. package/dist/icons/icons/Minimize.d.ts +3 -0
  182. package/dist/icons/icons/Pause.d.ts +3 -0
  183. package/dist/icons/icons/Play.d.ts +3 -0
  184. package/dist/icons/icons/Rewind.d.ts +7 -0
  185. package/dist/icons/icons/Skip.d.ts +8 -0
  186. package/dist/icons/icons/Subtitles.d.ts +7 -0
  187. package/dist/icons/icons/VideoCheckmark.d.ts +3 -0
  188. package/dist/icons/icons/VolumeMute.d.ts +8 -0
  189. package/dist/icons/icons/VolumeUp.d.ts +8 -0
  190. package/dist/icons/icons/index.d.ts +11 -0
  191. package/dist/icons/index.d.ts +11 -0
  192. package/dist/icons/index.esm.js +308 -1
  193. package/dist/icons/index.js +11 -0
  194. package/dist/icons/index.js.map +1 -1
  195. package/package.json +3 -1
  196. package/dist/components/VideoPlayer/styled-components.d.ts +0 -9
  197. package/dist/components/VideoPlayer/styled-components.js +0 -19
  198. package/dist/components/VideoPlayer/styled-components.js.map +0 -1
  199. package/dist/components/components/VideoPlayer/styled-components.d.ts +0 -9
  200. package/dist/icons/components/VideoPlayer/styled-components.d.ts +0 -9
@@ -0,0 +1,264 @@
1
+ import { a as requirePatterns, g as getDefaultExportFromCjs } from './index-DLzCbCHu.esm.js';
2
+ import React__default from 'react';
3
+
4
+ function _mergeNamespaces(n, m) {
5
+ m.forEach(function (e) {
6
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
7
+ if (k !== 'default' && !(k in n)) {
8
+ var d = Object.getOwnPropertyDescriptor(e, k);
9
+ Object.defineProperty(n, k, d.get ? d : {
10
+ enumerable: true,
11
+ get: function () { return e[k]; }
12
+ });
13
+ }
14
+ });
15
+ });
16
+ return Object.freeze(n);
17
+ }
18
+
19
+ var Mux_1;
20
+ var hasRequiredMux;
21
+
22
+ function requireMux () {
23
+ if (hasRequiredMux) return Mux_1;
24
+ hasRequiredMux = 1;
25
+ var __create = Object.create;
26
+ var __defProp = Object.defineProperty;
27
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
28
+ var __getOwnPropNames = Object.getOwnPropertyNames;
29
+ var __getProtoOf = Object.getPrototypeOf;
30
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
31
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+ var __copyProps = (to, from, except, desc) => {
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (let key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(to, key) && key !== except)
40
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
41
+ }
42
+ return to;
43
+ };
44
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
45
+ // If the importer is in node compatibility mode or this is not an ESM
46
+ // file that has been converted to a CommonJS file using a Babel-
47
+ // compatible transform (i.e. "__esModule" has not been set), then set
48
+ // "default" to the CommonJS "module.exports" for node compatibility.
49
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
50
+ mod
51
+ ));
52
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
53
+ var __publicField = (obj, key, value) => {
54
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
55
+ return value;
56
+ };
57
+ var Mux_exports = {};
58
+ __export(Mux_exports, {
59
+ default: () => Mux
60
+ });
61
+ Mux_1 = __toCommonJS(Mux_exports);
62
+ var import_react = __toESM(React__default);
63
+ var import_patterns = /*@__PURE__*/ requirePatterns();
64
+ const SDK_URL = "https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";
65
+ class Mux extends import_react.Component {
66
+ constructor() {
67
+ super(...arguments);
68
+ // Proxy methods to prevent listener leaks
69
+ __publicField(this, "onReady", (...args) => this.props.onReady(...args));
70
+ __publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
71
+ __publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
72
+ __publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
73
+ __publicField(this, "onPause", (...args) => this.props.onPause(...args));
74
+ __publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
75
+ __publicField(this, "onError", (...args) => this.props.onError(...args));
76
+ __publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
77
+ __publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
78
+ __publicField(this, "onSeek", (e) => {
79
+ this.props.onSeek(e.target.currentTime);
80
+ });
81
+ __publicField(this, "onDurationChange", () => {
82
+ const duration = this.getDuration();
83
+ this.props.onDuration(duration);
84
+ });
85
+ __publicField(this, "mute", () => {
86
+ this.player.muted = true;
87
+ });
88
+ __publicField(this, "unmute", () => {
89
+ this.player.muted = false;
90
+ });
91
+ __publicField(this, "ref", (player) => {
92
+ this.player = player;
93
+ });
94
+ }
95
+ componentDidMount() {
96
+ this.props.onMount && this.props.onMount(this);
97
+ this.addListeners(this.player);
98
+ const playbackId = this.getPlaybackId(this.props.url);
99
+ if (playbackId) {
100
+ this.player.playbackId = playbackId;
101
+ }
102
+ }
103
+ componentWillUnmount() {
104
+ this.player.playbackId = null;
105
+ this.removeListeners(this.player);
106
+ }
107
+ addListeners(player) {
108
+ const { playsinline } = this.props;
109
+ player.addEventListener("play", this.onPlay);
110
+ player.addEventListener("waiting", this.onBuffer);
111
+ player.addEventListener("playing", this.onBufferEnd);
112
+ player.addEventListener("pause", this.onPause);
113
+ player.addEventListener("seeked", this.onSeek);
114
+ player.addEventListener("ended", this.onEnded);
115
+ player.addEventListener("error", this.onError);
116
+ player.addEventListener("ratechange", this.onPlayBackRateChange);
117
+ player.addEventListener("enterpictureinpicture", this.onEnablePIP);
118
+ player.addEventListener("leavepictureinpicture", this.onDisablePIP);
119
+ player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
120
+ player.addEventListener("canplay", this.onReady);
121
+ if (playsinline) {
122
+ player.setAttribute("playsinline", "");
123
+ }
124
+ }
125
+ removeListeners(player) {
126
+ player.removeEventListener("canplay", this.onReady);
127
+ player.removeEventListener("play", this.onPlay);
128
+ player.removeEventListener("waiting", this.onBuffer);
129
+ player.removeEventListener("playing", this.onBufferEnd);
130
+ player.removeEventListener("pause", this.onPause);
131
+ player.removeEventListener("seeked", this.onSeek);
132
+ player.removeEventListener("ended", this.onEnded);
133
+ player.removeEventListener("error", this.onError);
134
+ player.removeEventListener("ratechange", this.onPlayBackRateChange);
135
+ player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
136
+ player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
137
+ player.removeEventListener("canplay", this.onReady);
138
+ }
139
+ async load(url) {
140
+ var _a;
141
+ const { onError, config } = this.props;
142
+ if (!((_a = globalThis.customElements) == null ? void 0 : _a.get("mux-player"))) {
143
+ try {
144
+ const sdkUrl = SDK_URL.replace("VERSION", config.version);
145
+ await import(
146
+ /* webpackIgnore: true */
147
+ `${sdkUrl}`
148
+ );
149
+ this.props.onLoaded();
150
+ } catch (error) {
151
+ onError(error);
152
+ }
153
+ }
154
+ const [, id] = url.match(import_patterns.MATCH_URL_MUX);
155
+ this.player.playbackId = id;
156
+ }
157
+ play() {
158
+ const promise = this.player.play();
159
+ if (promise) {
160
+ promise.catch(this.props.onError);
161
+ }
162
+ }
163
+ pause() {
164
+ this.player.pause();
165
+ }
166
+ stop() {
167
+ this.player.playbackId = null;
168
+ }
169
+ seekTo(seconds, keepPlaying = true) {
170
+ this.player.currentTime = seconds;
171
+ if (!keepPlaying) {
172
+ this.pause();
173
+ }
174
+ }
175
+ setVolume(fraction) {
176
+ this.player.volume = fraction;
177
+ }
178
+ enablePIP() {
179
+ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
180
+ this.player.requestPictureInPicture();
181
+ }
182
+ }
183
+ disablePIP() {
184
+ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
185
+ document.exitPictureInPicture();
186
+ }
187
+ }
188
+ setPlaybackRate(rate) {
189
+ try {
190
+ this.player.playbackRate = rate;
191
+ } catch (error) {
192
+ this.props.onError(error);
193
+ }
194
+ }
195
+ getDuration() {
196
+ if (!this.player)
197
+ return null;
198
+ const { duration, seekable } = this.player;
199
+ if (duration === Infinity && seekable.length > 0) {
200
+ return seekable.end(seekable.length - 1);
201
+ }
202
+ return duration;
203
+ }
204
+ getCurrentTime() {
205
+ if (!this.player)
206
+ return null;
207
+ return this.player.currentTime;
208
+ }
209
+ getSecondsLoaded() {
210
+ if (!this.player)
211
+ return null;
212
+ const { buffered } = this.player;
213
+ if (buffered.length === 0) {
214
+ return 0;
215
+ }
216
+ const end = buffered.end(buffered.length - 1);
217
+ const duration = this.getDuration();
218
+ if (end > duration) {
219
+ return duration;
220
+ }
221
+ return end;
222
+ }
223
+ getPlaybackId(url) {
224
+ const [, id] = url.match(import_patterns.MATCH_URL_MUX);
225
+ return id;
226
+ }
227
+ render() {
228
+ const { url, playing, loop, controls, muted, config, width, height } = this.props;
229
+ const style = {
230
+ width: width === "auto" ? width : "100%",
231
+ height: height === "auto" ? height : "100%"
232
+ };
233
+ if (controls === false) {
234
+ style["--controls"] = "none";
235
+ }
236
+ return /* @__PURE__ */ import_react.default.createElement(
237
+ "mux-player",
238
+ {
239
+ ref: this.ref,
240
+ "playback-id": this.getPlaybackId(url),
241
+ style,
242
+ preload: "auto",
243
+ autoPlay: playing || void 0,
244
+ muted: muted ? "" : void 0,
245
+ loop: loop ? "" : void 0,
246
+ ...config.attributes
247
+ }
248
+ );
249
+ }
250
+ }
251
+ __publicField(Mux, "displayName", "Mux");
252
+ __publicField(Mux, "canPlay", import_patterns.canPlay.mux);
253
+ return Mux_1;
254
+ }
255
+
256
+ var MuxExports = /*@__PURE__*/ requireMux();
257
+ var Mux = /*@__PURE__*/getDefaultExportFromCjs(MuxExports);
258
+
259
+ var Mux$1 = /*#__PURE__*/_mergeNamespaces({
260
+ __proto__: null,
261
+ default: Mux
262
+ }, [MuxExports]);
263
+
264
+ export { Mux$1 as M };
@@ -0,0 +1,266 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-wLnkslO9.js');
4
+ var React = require('react');
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var Mux_1;
22
+ var hasRequiredMux;
23
+
24
+ function requireMux () {
25
+ if (hasRequiredMux) return Mux_1;
26
+ hasRequiredMux = 1;
27
+ var __create = Object.create;
28
+ var __defProp = Object.defineProperty;
29
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
30
+ var __getOwnPropNames = Object.getOwnPropertyNames;
31
+ var __getProtoOf = Object.getPrototypeOf;
32
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
33
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __copyProps = (to, from, except, desc) => {
39
+ if (from && typeof from === "object" || typeof from === "function") {
40
+ for (let key of __getOwnPropNames(from))
41
+ if (!__hasOwnProp.call(to, key) && key !== except)
42
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
+ }
44
+ return to;
45
+ };
46
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
47
+ // If the importer is in node compatibility mode or this is not an ESM
48
+ // file that has been converted to a CommonJS file using a Babel-
49
+ // compatible transform (i.e. "__esModule" has not been set), then set
50
+ // "default" to the CommonJS "module.exports" for node compatibility.
51
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
52
+ mod
53
+ ));
54
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
55
+ var __publicField = (obj, key, value) => {
56
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
57
+ return value;
58
+ };
59
+ var Mux_exports = {};
60
+ __export(Mux_exports, {
61
+ default: () => Mux
62
+ });
63
+ Mux_1 = __toCommonJS(Mux_exports);
64
+ var import_react = __toESM(React);
65
+ var import_patterns = /*@__PURE__*/ index.requirePatterns();
66
+ const SDK_URL = "https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";
67
+ class Mux extends import_react.Component {
68
+ constructor() {
69
+ super(...arguments);
70
+ // Proxy methods to prevent listener leaks
71
+ __publicField(this, "onReady", (...args) => this.props.onReady(...args));
72
+ __publicField(this, "onPlay", (...args) => this.props.onPlay(...args));
73
+ __publicField(this, "onBuffer", (...args) => this.props.onBuffer(...args));
74
+ __publicField(this, "onBufferEnd", (...args) => this.props.onBufferEnd(...args));
75
+ __publicField(this, "onPause", (...args) => this.props.onPause(...args));
76
+ __publicField(this, "onEnded", (...args) => this.props.onEnded(...args));
77
+ __publicField(this, "onError", (...args) => this.props.onError(...args));
78
+ __publicField(this, "onPlayBackRateChange", (event) => this.props.onPlaybackRateChange(event.target.playbackRate));
79
+ __publicField(this, "onEnablePIP", (...args) => this.props.onEnablePIP(...args));
80
+ __publicField(this, "onSeek", (e) => {
81
+ this.props.onSeek(e.target.currentTime);
82
+ });
83
+ __publicField(this, "onDurationChange", () => {
84
+ const duration = this.getDuration();
85
+ this.props.onDuration(duration);
86
+ });
87
+ __publicField(this, "mute", () => {
88
+ this.player.muted = true;
89
+ });
90
+ __publicField(this, "unmute", () => {
91
+ this.player.muted = false;
92
+ });
93
+ __publicField(this, "ref", (player) => {
94
+ this.player = player;
95
+ });
96
+ }
97
+ componentDidMount() {
98
+ this.props.onMount && this.props.onMount(this);
99
+ this.addListeners(this.player);
100
+ const playbackId = this.getPlaybackId(this.props.url);
101
+ if (playbackId) {
102
+ this.player.playbackId = playbackId;
103
+ }
104
+ }
105
+ componentWillUnmount() {
106
+ this.player.playbackId = null;
107
+ this.removeListeners(this.player);
108
+ }
109
+ addListeners(player) {
110
+ const { playsinline } = this.props;
111
+ player.addEventListener("play", this.onPlay);
112
+ player.addEventListener("waiting", this.onBuffer);
113
+ player.addEventListener("playing", this.onBufferEnd);
114
+ player.addEventListener("pause", this.onPause);
115
+ player.addEventListener("seeked", this.onSeek);
116
+ player.addEventListener("ended", this.onEnded);
117
+ player.addEventListener("error", this.onError);
118
+ player.addEventListener("ratechange", this.onPlayBackRateChange);
119
+ player.addEventListener("enterpictureinpicture", this.onEnablePIP);
120
+ player.addEventListener("leavepictureinpicture", this.onDisablePIP);
121
+ player.addEventListener("webkitpresentationmodechanged", this.onPresentationModeChange);
122
+ player.addEventListener("canplay", this.onReady);
123
+ if (playsinline) {
124
+ player.setAttribute("playsinline", "");
125
+ }
126
+ }
127
+ removeListeners(player) {
128
+ player.removeEventListener("canplay", this.onReady);
129
+ player.removeEventListener("play", this.onPlay);
130
+ player.removeEventListener("waiting", this.onBuffer);
131
+ player.removeEventListener("playing", this.onBufferEnd);
132
+ player.removeEventListener("pause", this.onPause);
133
+ player.removeEventListener("seeked", this.onSeek);
134
+ player.removeEventListener("ended", this.onEnded);
135
+ player.removeEventListener("error", this.onError);
136
+ player.removeEventListener("ratechange", this.onPlayBackRateChange);
137
+ player.removeEventListener("enterpictureinpicture", this.onEnablePIP);
138
+ player.removeEventListener("leavepictureinpicture", this.onDisablePIP);
139
+ player.removeEventListener("canplay", this.onReady);
140
+ }
141
+ async load(url) {
142
+ var _a;
143
+ const { onError, config } = this.props;
144
+ if (!((_a = globalThis.customElements) == null ? void 0 : _a.get("mux-player"))) {
145
+ try {
146
+ const sdkUrl = SDK_URL.replace("VERSION", config.version);
147
+ await import(
148
+ /* webpackIgnore: true */
149
+ `${sdkUrl}`
150
+ );
151
+ this.props.onLoaded();
152
+ } catch (error) {
153
+ onError(error);
154
+ }
155
+ }
156
+ const [, id] = url.match(import_patterns.MATCH_URL_MUX);
157
+ this.player.playbackId = id;
158
+ }
159
+ play() {
160
+ const promise = this.player.play();
161
+ if (promise) {
162
+ promise.catch(this.props.onError);
163
+ }
164
+ }
165
+ pause() {
166
+ this.player.pause();
167
+ }
168
+ stop() {
169
+ this.player.playbackId = null;
170
+ }
171
+ seekTo(seconds, keepPlaying = true) {
172
+ this.player.currentTime = seconds;
173
+ if (!keepPlaying) {
174
+ this.pause();
175
+ }
176
+ }
177
+ setVolume(fraction) {
178
+ this.player.volume = fraction;
179
+ }
180
+ enablePIP() {
181
+ if (this.player.requestPictureInPicture && document.pictureInPictureElement !== this.player) {
182
+ this.player.requestPictureInPicture();
183
+ }
184
+ }
185
+ disablePIP() {
186
+ if (document.exitPictureInPicture && document.pictureInPictureElement === this.player) {
187
+ document.exitPictureInPicture();
188
+ }
189
+ }
190
+ setPlaybackRate(rate) {
191
+ try {
192
+ this.player.playbackRate = rate;
193
+ } catch (error) {
194
+ this.props.onError(error);
195
+ }
196
+ }
197
+ getDuration() {
198
+ if (!this.player)
199
+ return null;
200
+ const { duration, seekable } = this.player;
201
+ if (duration === Infinity && seekable.length > 0) {
202
+ return seekable.end(seekable.length - 1);
203
+ }
204
+ return duration;
205
+ }
206
+ getCurrentTime() {
207
+ if (!this.player)
208
+ return null;
209
+ return this.player.currentTime;
210
+ }
211
+ getSecondsLoaded() {
212
+ if (!this.player)
213
+ return null;
214
+ const { buffered } = this.player;
215
+ if (buffered.length === 0) {
216
+ return 0;
217
+ }
218
+ const end = buffered.end(buffered.length - 1);
219
+ const duration = this.getDuration();
220
+ if (end > duration) {
221
+ return duration;
222
+ }
223
+ return end;
224
+ }
225
+ getPlaybackId(url) {
226
+ const [, id] = url.match(import_patterns.MATCH_URL_MUX);
227
+ return id;
228
+ }
229
+ render() {
230
+ const { url, playing, loop, controls, muted, config, width, height } = this.props;
231
+ const style = {
232
+ width: width === "auto" ? width : "100%",
233
+ height: height === "auto" ? height : "100%"
234
+ };
235
+ if (controls === false) {
236
+ style["--controls"] = "none";
237
+ }
238
+ return /* @__PURE__ */ import_react.default.createElement(
239
+ "mux-player",
240
+ {
241
+ ref: this.ref,
242
+ "playback-id": this.getPlaybackId(url),
243
+ style,
244
+ preload: "auto",
245
+ autoPlay: playing || void 0,
246
+ muted: muted ? "" : void 0,
247
+ loop: loop ? "" : void 0,
248
+ ...config.attributes
249
+ }
250
+ );
251
+ }
252
+ }
253
+ __publicField(Mux, "displayName", "Mux");
254
+ __publicField(Mux, "canPlay", import_patterns.canPlay.mux);
255
+ return Mux_1;
256
+ }
257
+
258
+ var MuxExports = /*@__PURE__*/ requireMux();
259
+ var Mux = /*@__PURE__*/index.getDefaultExportFromCjs(MuxExports);
260
+
261
+ var Mux$1 = /*#__PURE__*/_mergeNamespaces({
262
+ __proto__: null,
263
+ default: Mux
264
+ }, [MuxExports]);
265
+
266
+ exports.Mux = Mux$1;
@@ -0,0 +1,175 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-wLnkslO9.js');
4
+ var React = require('react');
5
+
6
+ function _mergeNamespaces(n, m) {
7
+ m.forEach(function (e) {
8
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default' && !(k in n)) {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ });
18
+ return Object.freeze(n);
19
+ }
20
+
21
+ var Preview_1;
22
+ var hasRequiredPreview;
23
+
24
+ function requirePreview () {
25
+ if (hasRequiredPreview) return Preview_1;
26
+ hasRequiredPreview = 1;
27
+ var __create = Object.create;
28
+ var __defProp = Object.defineProperty;
29
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
30
+ var __getOwnPropNames = Object.getOwnPropertyNames;
31
+ var __getProtoOf = Object.getPrototypeOf;
32
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
33
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __copyProps = (to, from, except, desc) => {
39
+ if (from && typeof from === "object" || typeof from === "function") {
40
+ for (let key of __getOwnPropNames(from))
41
+ if (!__hasOwnProp.call(to, key) && key !== except)
42
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
43
+ }
44
+ return to;
45
+ };
46
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
47
+ // If the importer is in node compatibility mode or this is not an ESM
48
+ // file that has been converted to a CommonJS file using a Babel-
49
+ // compatible transform (i.e. "__esModule" has not been set), then set
50
+ // "default" to the CommonJS "module.exports" for node compatibility.
51
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
52
+ mod
53
+ ));
54
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
55
+ var __publicField = (obj, key, value) => {
56
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
57
+ return value;
58
+ };
59
+ var Preview_exports = {};
60
+ __export(Preview_exports, {
61
+ default: () => Preview
62
+ });
63
+ Preview_1 = __toCommonJS(Preview_exports);
64
+ var import_react = __toESM(React);
65
+ const ICON_SIZE = "64px";
66
+ const cache = {};
67
+ class Preview extends import_react.Component {
68
+ constructor() {
69
+ super(...arguments);
70
+ __publicField(this, "mounted", false);
71
+ __publicField(this, "state", {
72
+ image: null
73
+ });
74
+ __publicField(this, "handleKeyPress", (e) => {
75
+ if (e.key === "Enter" || e.key === " ") {
76
+ this.props.onClick();
77
+ }
78
+ });
79
+ }
80
+ componentDidMount() {
81
+ this.mounted = true;
82
+ this.fetchImage(this.props);
83
+ }
84
+ componentDidUpdate(prevProps) {
85
+ const { url, light } = this.props;
86
+ if (prevProps.url !== url || prevProps.light !== light) {
87
+ this.fetchImage(this.props);
88
+ }
89
+ }
90
+ componentWillUnmount() {
91
+ this.mounted = false;
92
+ }
93
+ fetchImage({ url, light, oEmbedUrl }) {
94
+ if (import_react.default.isValidElement(light)) {
95
+ return;
96
+ }
97
+ if (typeof light === "string") {
98
+ this.setState({ image: light });
99
+ return;
100
+ }
101
+ if (cache[url]) {
102
+ this.setState({ image: cache[url] });
103
+ return;
104
+ }
105
+ this.setState({ image: null });
106
+ return window.fetch(oEmbedUrl.replace("{url}", url)).then((response) => response.json()).then((data) => {
107
+ if (data.thumbnail_url && this.mounted) {
108
+ const image = data.thumbnail_url.replace("height=100", "height=480").replace("-d_295x166", "-d_640");
109
+ this.setState({ image });
110
+ cache[url] = image;
111
+ }
112
+ });
113
+ }
114
+ render() {
115
+ const { light, onClick, playIcon, previewTabIndex, previewAriaLabel } = this.props;
116
+ const { image } = this.state;
117
+ const isElement = import_react.default.isValidElement(light);
118
+ const flexCenter = {
119
+ display: "flex",
120
+ alignItems: "center",
121
+ justifyContent: "center"
122
+ };
123
+ const styles = {
124
+ preview: {
125
+ width: "100%",
126
+ height: "100%",
127
+ backgroundImage: image && !isElement ? `url(${image})` : void 0,
128
+ backgroundSize: "cover",
129
+ backgroundPosition: "center",
130
+ cursor: "pointer",
131
+ ...flexCenter
132
+ },
133
+ shadow: {
134
+ background: "radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",
135
+ borderRadius: ICON_SIZE,
136
+ width: ICON_SIZE,
137
+ height: ICON_SIZE,
138
+ position: isElement ? "absolute" : void 0,
139
+ ...flexCenter
140
+ },
141
+ playIcon: {
142
+ borderStyle: "solid",
143
+ borderWidth: "16px 0 16px 26px",
144
+ borderColor: "transparent transparent transparent white",
145
+ marginLeft: "7px"
146
+ }
147
+ };
148
+ const defaultPlayIcon = /* @__PURE__ */ import_react.default.createElement("div", { style: styles.shadow, className: "react-player__shadow" }, /* @__PURE__ */ import_react.default.createElement("div", { style: styles.playIcon, className: "react-player__play-icon" }));
149
+ return /* @__PURE__ */ import_react.default.createElement(
150
+ "div",
151
+ {
152
+ style: styles.preview,
153
+ className: "react-player__preview",
154
+ onClick,
155
+ tabIndex: previewTabIndex,
156
+ onKeyPress: this.handleKeyPress,
157
+ ...previewAriaLabel ? { "aria-label": previewAriaLabel } : {}
158
+ },
159
+ isElement ? light : null,
160
+ playIcon || defaultPlayIcon
161
+ );
162
+ }
163
+ }
164
+ return Preview_1;
165
+ }
166
+
167
+ var PreviewExports = /*@__PURE__*/ requirePreview();
168
+ var Preview = /*@__PURE__*/index.getDefaultExportFromCjs(PreviewExports);
169
+
170
+ var Preview$1 = /*#__PURE__*/_mergeNamespaces({
171
+ __proto__: null,
172
+ default: Preview
173
+ }, [PreviewExports]);
174
+
175
+ exports.Preview = Preview$1;