suada-components 1.9.0 → 1.10.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 (96) hide show
  1. package/dist/{components/DailyMotion-B7yDPBbg.js → DailyMotion-DacNkqsi.js} +1 -1
  2. package/dist/{components/DailyMotion-BmnymjR1.esm.js → DailyMotion-gaY-1HqX.esm.js} +1 -1
  3. package/dist/{components/Facebook-D9Ak6ZJU.esm.js → Facebook-C_tH1Bi_.esm.js} +1 -1
  4. package/dist/{components/Facebook-42iqQU2G.js → Facebook-D4wLMJkY.js} +1 -1
  5. package/dist/{components/FilePlayer-CAnHK0Cd.js → FilePlayer-B4s5OcYq.js} +1 -1
  6. package/dist/{components/FilePlayer-wg9lyafD.esm.js → FilePlayer-DqR2mvGK.esm.js} +1 -1
  7. package/dist/{components/Kaltura-DPaEN-dq.esm.js → Kaltura-C9QbmEfO.esm.js} +1 -1
  8. package/dist/{components/Kaltura-Ct6kwbgP.js → Kaltura-kCqUZWuf.js} +1 -1
  9. package/dist/{components/Mixcloud-sBbcL5rG.js → Mixcloud-2c71b3Nf.js} +1 -1
  10. package/dist/{components/Mixcloud-BobSN3YI.esm.js → Mixcloud-ib_DIXF1.esm.js} +1 -1
  11. package/dist/{components/Mux-Cosy8sFO.js → Mux-BsXgGo6C.js} +1 -1
  12. package/dist/{components/Mux-B9YP-rFr.esm.js → Mux-CJ6kEh1R.esm.js} +1 -1
  13. package/dist/{components/Preview-DiVfo6aa.js → Preview-gEkhA4mX.js} +1 -1
  14. package/dist/{components/Preview-XcTlhHT1.esm.js → Preview-kqr7fWet.esm.js} +1 -1
  15. package/dist/{components/SoundCloud-CIWqB-QW.js → SoundCloud-BWup2g--.js} +1 -1
  16. package/dist/{components/SoundCloud-BTHoyFWT.esm.js → SoundCloud-DJM0bsQG.esm.js} +1 -1
  17. package/dist/{components/Streamable-DsfQCy3p.esm.js → Streamable-CJltauTy.esm.js} +1 -1
  18. package/dist/{components/Streamable-9anYiQtU.js → Streamable-UeTHV2nZ.js} +1 -1
  19. package/dist/{components/Twitch-D1BOr8hj.esm.js → Twitch-C9qq_89Q.esm.js} +1 -1
  20. package/dist/{components/Twitch-Dud6e1Rv.js → Twitch-_N8mEsiS.js} +1 -1
  21. package/dist/{components/Vidyard-BuOu85uS.js → Vidyard-CQuxB99Z.js} +1 -1
  22. package/dist/{components/Vidyard-C1csjpQH.esm.js → Vidyard-gtcLQdYd.esm.js} +1 -1
  23. package/dist/{components/Vimeo-CHlHIswX.esm.js → Vimeo-Dzp5eoLi.esm.js} +1 -1
  24. package/dist/{components/Vimeo-DrDJ5O9H.js → Vimeo-nhXVoFTb.js} +1 -1
  25. package/dist/{components/Wistia-fh9U2CA2.js → Wistia-C1DqA9IW.js} +1 -1
  26. package/dist/{components/Wistia-D-eYyONb.esm.js → Wistia-DV3BO3z9.esm.js} +1 -1
  27. package/dist/{components/YouTube-CmnnzZvk.esm.js → YouTube-BKwvJCnt.esm.js} +1 -1
  28. package/dist/{components/YouTube-DC2uZ14c.js → YouTube-DDou5phH.js} +1 -1
  29. package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
  30. package/dist/components/DailyMotion-B8IJNjSc.js +180 -0
  31. package/dist/components/DailyMotion-COg3zgIZ.esm.js +178 -0
  32. package/dist/components/Facebook-DJ7a3Bj8.js +181 -0
  33. package/dist/components/Facebook-NS80Vk6j.esm.js +179 -0
  34. package/dist/components/FilePlayer-D-fc3B0E.esm.js +408 -0
  35. package/dist/components/FilePlayer-SyLt5qGX.js +410 -0
  36. package/dist/components/Kaltura-BTFxSMxP.js +178 -0
  37. package/dist/components/Kaltura-CmFIWSef.esm.js +176 -0
  38. package/dist/components/Mixcloud-CO5MsWUJ.esm.js +164 -0
  39. package/dist/components/Mixcloud-DHAfVpcc.js +166 -0
  40. package/dist/components/Mux-C8-HithD.esm.js +264 -0
  41. package/dist/components/Mux-bycDxP8G.js +266 -0
  42. package/dist/components/Preview-Clg3y6sj.esm.js +173 -0
  43. package/dist/components/Preview-CzpcknZI.js +175 -0
  44. package/dist/components/SoundCloud-Dz9DeIIM.js +183 -0
  45. package/dist/components/SoundCloud-LfWEBVy1.esm.js +181 -0
  46. package/dist/components/Streamable-BpcVhi4M.esm.js +174 -0
  47. package/dist/components/Streamable-Cs_c-7jS.js +176 -0
  48. package/dist/components/Twitch-BJ9aSIM2.esm.js +168 -0
  49. package/dist/components/Twitch-C9bksXF6.js +170 -0
  50. package/dist/components/VideoPlayer/PiPContext.d.ts +8 -0
  51. package/dist/components/VideoPlayer/PiPContext.js +149 -0
  52. package/dist/components/VideoPlayer/PiPContext.js.map +1 -0
  53. package/dist/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  54. package/dist/components/VideoPlayer/PiPContext.types.js +2 -0
  55. package/dist/components/VideoPlayer/PiPContext.types.js.map +1 -0
  56. package/dist/components/VideoPlayer/usePiP.d.ts +2 -0
  57. package/dist/components/VideoPlayer/usePiP.js +10 -0
  58. package/dist/components/VideoPlayer/usePiP.js.map +1 -0
  59. package/dist/components/VideoPlayer/usePlayerControls.js +46 -64
  60. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -1
  61. package/dist/components/Vidyard-CsUFSBXh.js +174 -0
  62. package/dist/components/Vidyard-Dc8NHJ7p.esm.js +172 -0
  63. package/dist/components/Vimeo-CwlScNtK.esm.js +213 -0
  64. package/dist/components/Vimeo-D6C93592.js +215 -0
  65. package/dist/components/Wistia-Bxvdn3oO.js +190 -0
  66. package/dist/components/Wistia-Cwl4fNWW.esm.js +188 -0
  67. package/dist/components/YouTube-BF85SRPF.js +260 -0
  68. package/dist/components/YouTube-DKkYzN7-.esm.js +258 -0
  69. package/dist/components/components/CourseCard/CourseCard.styles.d.ts +1 -1
  70. package/dist/components/components/VideoPlayer/PiPContext.d.ts +8 -0
  71. package/dist/components/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  72. package/dist/components/components/VideoPlayer/usePiP.d.ts +2 -0
  73. package/dist/components/components/index.d.ts +2 -0
  74. package/dist/components/{index-DetZ05pw.js → index-C08W0lXg.js} +157 -295
  75. package/dist/components/{index-DKAGRUEW.esm.js → index-F6zEoSWf.esm.js} +156 -296
  76. package/dist/components/index.d.ts +2 -0
  77. package/dist/components/index.esm.js +1 -1
  78. package/dist/components/index.js +2 -0
  79. package/dist/components/index.js.map +1 -1
  80. package/dist/icons/components/CourseCard/CourseCard.styles.d.ts +1 -1
  81. package/dist/icons/components/VideoPlayer/PiPContext.d.ts +8 -0
  82. package/dist/icons/components/VideoPlayer/PiPContext.types.d.ts +16 -0
  83. package/dist/icons/components/VideoPlayer/usePiP.d.ts +2 -0
  84. package/dist/icons/components/index.d.ts +2 -0
  85. package/dist/index-CcTTuhg8.esm.js +94920 -0
  86. package/dist/index-Dq4qpx9F.js +95142 -0
  87. package/dist/index.d.ts +2 -0
  88. package/dist/index.esm.js +3 -3
  89. package/dist/index.js +3 -0
  90. package/dist/index.js.map +1 -1
  91. package/package.json +1 -1
  92. package/dist/components/VideoPlayer/pipManager.d.ts +0 -60
  93. package/dist/components/VideoPlayer/pipManager.js +0 -272
  94. package/dist/components/VideoPlayer/pipManager.js.map +0 -1
  95. package/dist/components/components/VideoPlayer/pipManager.d.ts +0 -60
  96. package/dist/icons/components/VideoPlayer/pipManager.d.ts +0 -60
@@ -0,0 +1,264 @@
1
+ import { a as requirePatterns, g as getDefaultExportFromCjs } from './index-F6zEoSWf.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-C08W0lXg.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,173 @@
1
+ import { g as getDefaultExportFromCjs } from './index-F6zEoSWf.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 Preview_1;
20
+ var hasRequiredPreview;
21
+
22
+ function requirePreview () {
23
+ if (hasRequiredPreview) return Preview_1;
24
+ hasRequiredPreview = 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 Preview_exports = {};
58
+ __export(Preview_exports, {
59
+ default: () => Preview
60
+ });
61
+ Preview_1 = __toCommonJS(Preview_exports);
62
+ var import_react = __toESM(React__default);
63
+ const ICON_SIZE = "64px";
64
+ const cache = {};
65
+ class Preview extends import_react.Component {
66
+ constructor() {
67
+ super(...arguments);
68
+ __publicField(this, "mounted", false);
69
+ __publicField(this, "state", {
70
+ image: null
71
+ });
72
+ __publicField(this, "handleKeyPress", (e) => {
73
+ if (e.key === "Enter" || e.key === " ") {
74
+ this.props.onClick();
75
+ }
76
+ });
77
+ }
78
+ componentDidMount() {
79
+ this.mounted = true;
80
+ this.fetchImage(this.props);
81
+ }
82
+ componentDidUpdate(prevProps) {
83
+ const { url, light } = this.props;
84
+ if (prevProps.url !== url || prevProps.light !== light) {
85
+ this.fetchImage(this.props);
86
+ }
87
+ }
88
+ componentWillUnmount() {
89
+ this.mounted = false;
90
+ }
91
+ fetchImage({ url, light, oEmbedUrl }) {
92
+ if (import_react.default.isValidElement(light)) {
93
+ return;
94
+ }
95
+ if (typeof light === "string") {
96
+ this.setState({ image: light });
97
+ return;
98
+ }
99
+ if (cache[url]) {
100
+ this.setState({ image: cache[url] });
101
+ return;
102
+ }
103
+ this.setState({ image: null });
104
+ return window.fetch(oEmbedUrl.replace("{url}", url)).then((response) => response.json()).then((data) => {
105
+ if (data.thumbnail_url && this.mounted) {
106
+ const image = data.thumbnail_url.replace("height=100", "height=480").replace("-d_295x166", "-d_640");
107
+ this.setState({ image });
108
+ cache[url] = image;
109
+ }
110
+ });
111
+ }
112
+ render() {
113
+ const { light, onClick, playIcon, previewTabIndex, previewAriaLabel } = this.props;
114
+ const { image } = this.state;
115
+ const isElement = import_react.default.isValidElement(light);
116
+ const flexCenter = {
117
+ display: "flex",
118
+ alignItems: "center",
119
+ justifyContent: "center"
120
+ };
121
+ const styles = {
122
+ preview: {
123
+ width: "100%",
124
+ height: "100%",
125
+ backgroundImage: image && !isElement ? `url(${image})` : void 0,
126
+ backgroundSize: "cover",
127
+ backgroundPosition: "center",
128
+ cursor: "pointer",
129
+ ...flexCenter
130
+ },
131
+ shadow: {
132
+ background: "radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",
133
+ borderRadius: ICON_SIZE,
134
+ width: ICON_SIZE,
135
+ height: ICON_SIZE,
136
+ position: isElement ? "absolute" : void 0,
137
+ ...flexCenter
138
+ },
139
+ playIcon: {
140
+ borderStyle: "solid",
141
+ borderWidth: "16px 0 16px 26px",
142
+ borderColor: "transparent transparent transparent white",
143
+ marginLeft: "7px"
144
+ }
145
+ };
146
+ 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" }));
147
+ return /* @__PURE__ */ import_react.default.createElement(
148
+ "div",
149
+ {
150
+ style: styles.preview,
151
+ className: "react-player__preview",
152
+ onClick,
153
+ tabIndex: previewTabIndex,
154
+ onKeyPress: this.handleKeyPress,
155
+ ...previewAriaLabel ? { "aria-label": previewAriaLabel } : {}
156
+ },
157
+ isElement ? light : null,
158
+ playIcon || defaultPlayIcon
159
+ );
160
+ }
161
+ }
162
+ return Preview_1;
163
+ }
164
+
165
+ var PreviewExports = /*@__PURE__*/ requirePreview();
166
+ var Preview = /*@__PURE__*/getDefaultExportFromCjs(PreviewExports);
167
+
168
+ var Preview$1 = /*#__PURE__*/_mergeNamespaces({
169
+ __proto__: null,
170
+ default: Preview
171
+ }, [PreviewExports]);
172
+
173
+ export { Preview$1 as P };