suada-components 1.9.0 → 1.9.1

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-B-Q4fBEb.js} +1 -1
  2. package/dist/{components/DailyMotion-BmnymjR1.esm.js → DailyMotion-BAvo3Toe.esm.js} +1 -1
  3. package/dist/{components/Facebook-D9Ak6ZJU.esm.js → Facebook-C8GOujDt.esm.js} +1 -1
  4. package/dist/{components/Facebook-42iqQU2G.js → Facebook-CASik-P5.js} +1 -1
  5. package/dist/{components/FilePlayer-wg9lyafD.esm.js → FilePlayer-BOZIvaDy.esm.js} +1 -1
  6. package/dist/{components/FilePlayer-CAnHK0Cd.js → FilePlayer-CQ80KWY2.js} +1 -1
  7. package/dist/{components/Kaltura-DPaEN-dq.esm.js → Kaltura-B12Xdl6X.esm.js} +1 -1
  8. package/dist/{components/Kaltura-Ct6kwbgP.js → Kaltura-nYc5k7UB.js} +1 -1
  9. package/dist/{components/Mixcloud-sBbcL5rG.js → Mixcloud-DGQnlDAK.js} +1 -1
  10. package/dist/{components/Mixcloud-BobSN3YI.esm.js → Mixcloud-JfeQIOki.esm.js} +1 -1
  11. package/dist/{components/Mux-B9YP-rFr.esm.js → Mux-BHWzpAR-.esm.js} +1 -1
  12. package/dist/{components/Mux-Cosy8sFO.js → Mux-CiKZc8gj.js} +1 -1
  13. package/dist/{components/Preview-XcTlhHT1.esm.js → Preview-DSovY9gr.esm.js} +1 -1
  14. package/dist/{components/Preview-DiVfo6aa.js → Preview-DvZKrgm5.js} +1 -1
  15. package/dist/{components/SoundCloud-CIWqB-QW.js → SoundCloud-Di7z3nmP.js} +1 -1
  16. package/dist/{components/SoundCloud-BTHoyFWT.esm.js → SoundCloud-j_R0lK8D.esm.js} +1 -1
  17. package/dist/{components/Streamable-DsfQCy3p.esm.js → Streamable-CRhXZIKP.esm.js} +1 -1
  18. package/dist/{components/Streamable-9anYiQtU.js → Streamable-CV1mgzRv.js} +1 -1
  19. package/dist/{components/Twitch-D1BOr8hj.esm.js → Twitch-6icfp-ZE.esm.js} +1 -1
  20. package/dist/{components/Twitch-Dud6e1Rv.js → Twitch-Dj66vkCD.js} +1 -1
  21. package/dist/{components/Vidyard-C1csjpQH.esm.js → Vidyard--KX47pZ0.esm.js} +1 -1
  22. package/dist/{components/Vidyard-BuOu85uS.js → Vidyard-B-qmApe9.js} +1 -1
  23. package/dist/{components/Vimeo-CHlHIswX.esm.js → Vimeo-Ba9C6utC.esm.js} +1 -1
  24. package/dist/{components/Vimeo-DrDJ5O9H.js → Vimeo-DePzl7Sn.js} +1 -1
  25. package/dist/{components/Wistia-fh9U2CA2.js → Wistia-CXYB3Yus.js} +1 -1
  26. package/dist/{components/Wistia-D-eYyONb.esm.js → Wistia-DWJcdcY2.esm.js} +1 -1
  27. package/dist/{components/YouTube-CmnnzZvk.esm.js → YouTube-DdBVPxzz.esm.js} +1 -1
  28. package/dist/{components/YouTube-DC2uZ14c.js → YouTube-vwMoW93C.js} +1 -1
  29. package/dist/components/CourseCard/CourseCard.styles.d.ts +1 -1
  30. package/dist/components/DailyMotion-Cr_8IZRR.js +180 -0
  31. package/dist/components/DailyMotion-D2n1NDDi.esm.js +178 -0
  32. package/dist/components/Facebook-CDrTA2_L.esm.js +179 -0
  33. package/dist/components/Facebook-YxZce26V.js +181 -0
  34. package/dist/components/FilePlayer-BzkVMbQ8.esm.js +408 -0
  35. package/dist/components/FilePlayer-DqqTufgX.js +410 -0
  36. package/dist/components/Kaltura-B0UZLr6g.esm.js +176 -0
  37. package/dist/components/Kaltura-krSxvIBr.js +178 -0
  38. package/dist/components/Mixcloud-BCT5e47d.js +166 -0
  39. package/dist/components/Mixcloud-D9qk3D6i.esm.js +164 -0
  40. package/dist/components/Mux-BZleoaJh.esm.js +264 -0
  41. package/dist/components/Mux-D_si09u2.js +266 -0
  42. package/dist/components/Preview-CmduMeEZ.js +175 -0
  43. package/dist/components/Preview-DQLbQ8_C.esm.js +173 -0
  44. package/dist/components/SoundCloud-BHgTfaW7.js +183 -0
  45. package/dist/components/SoundCloud-BgnX8kOF.esm.js +181 -0
  46. package/dist/components/Streamable-DTAzjVwd.js +176 -0
  47. package/dist/components/Streamable-DbRbUflP.esm.js +174 -0
  48. package/dist/components/Twitch-CXOhay4a.esm.js +168 -0
  49. package/dist/components/Twitch-CnEk-l9R.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 +12 -40
  60. package/dist/components/VideoPlayer/usePlayerControls.js.map +1 -1
  61. package/dist/components/Vidyard-Cn_LcGwi.js +174 -0
  62. package/dist/components/Vidyard-YcZH6kkW.esm.js +172 -0
  63. package/dist/components/Vimeo-BUVxWt7t.js +215 -0
  64. package/dist/components/Vimeo-Cv0qx3aR.esm.js +213 -0
  65. package/dist/components/Wistia-COWrV8QC.js +190 -0
  66. package/dist/components/Wistia-PneZ48dn.esm.js +188 -0
  67. package/dist/components/YouTube-BUyvzJQw.esm.js +258 -0
  68. package/dist/components/YouTube-DeQdfkWm.js +260 -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-Bs-XxxV4.js} +153 -304
  75. package/dist/components/{index-DKAGRUEW.esm.js → index-C4Mk2H3N.esm.js} +152 -305
  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-Bp-idbg5.esm.js +94907 -0
  86. package/dist/index-CSj9NYxJ.js +95129 -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,173 @@
1
+ import { g as getDefaultExportFromCjs } from './index-C4Mk2H3N.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 };
@@ -0,0 +1,183 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-Bs-XxxV4.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 SoundCloud_1;
22
+ var hasRequiredSoundCloud;
23
+
24
+ function requireSoundCloud () {
25
+ if (hasRequiredSoundCloud) return SoundCloud_1;
26
+ hasRequiredSoundCloud = 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 SoundCloud_exports = {};
60
+ __export(SoundCloud_exports, {
61
+ default: () => SoundCloud
62
+ });
63
+ SoundCloud_1 = __toCommonJS(SoundCloud_exports);
64
+ var import_react = __toESM(React);
65
+ var import_utils = /*@__PURE__*/ index.requireUtils();
66
+ var import_patterns = /*@__PURE__*/ index.requirePatterns();
67
+ const SDK_URL = "https://w.soundcloud.com/player/api.js";
68
+ const SDK_GLOBAL = "SC";
69
+ class SoundCloud extends import_react.Component {
70
+ constructor() {
71
+ super(...arguments);
72
+ __publicField(this, "callPlayer", import_utils.callPlayer);
73
+ __publicField(this, "duration", null);
74
+ __publicField(this, "currentTime", null);
75
+ __publicField(this, "fractionLoaded", null);
76
+ __publicField(this, "mute", () => {
77
+ this.setVolume(0);
78
+ });
79
+ __publicField(this, "unmute", () => {
80
+ if (this.props.volume !== null) {
81
+ this.setVolume(this.props.volume);
82
+ }
83
+ });
84
+ __publicField(this, "ref", (iframe) => {
85
+ this.iframe = iframe;
86
+ });
87
+ }
88
+ componentDidMount() {
89
+ this.props.onMount && this.props.onMount(this);
90
+ }
91
+ load(url, isReady) {
92
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((SC) => {
93
+ if (!this.iframe)
94
+ return;
95
+ const { PLAY, PLAY_PROGRESS, PAUSE, FINISH, ERROR } = SC.Widget.Events;
96
+ if (!isReady) {
97
+ this.player = SC.Widget(this.iframe);
98
+ this.player.bind(PLAY, this.props.onPlay);
99
+ this.player.bind(PAUSE, () => {
100
+ const remaining = this.duration - this.currentTime;
101
+ if (remaining < 0.05) {
102
+ return;
103
+ }
104
+ this.props.onPause();
105
+ });
106
+ this.player.bind(PLAY_PROGRESS, (e) => {
107
+ this.currentTime = e.currentPosition / 1e3;
108
+ this.fractionLoaded = e.loadedProgress;
109
+ });
110
+ this.player.bind(FINISH, () => this.props.onEnded());
111
+ this.player.bind(ERROR, (e) => this.props.onError(e));
112
+ }
113
+ this.player.load(url, {
114
+ ...this.props.config.options,
115
+ callback: () => {
116
+ this.player.getDuration((duration) => {
117
+ this.duration = duration / 1e3;
118
+ this.props.onReady();
119
+ });
120
+ }
121
+ });
122
+ });
123
+ }
124
+ play() {
125
+ this.callPlayer("play");
126
+ }
127
+ pause() {
128
+ this.callPlayer("pause");
129
+ }
130
+ stop() {
131
+ }
132
+ seekTo(seconds, keepPlaying = true) {
133
+ this.callPlayer("seekTo", seconds * 1e3);
134
+ if (!keepPlaying) {
135
+ this.pause();
136
+ }
137
+ }
138
+ setVolume(fraction) {
139
+ this.callPlayer("setVolume", fraction * 100);
140
+ }
141
+ getDuration() {
142
+ return this.duration;
143
+ }
144
+ getCurrentTime() {
145
+ return this.currentTime;
146
+ }
147
+ getSecondsLoaded() {
148
+ return this.fractionLoaded * this.duration;
149
+ }
150
+ render() {
151
+ const { display } = this.props;
152
+ const style = {
153
+ width: "100%",
154
+ height: "100%",
155
+ display
156
+ };
157
+ return /* @__PURE__ */ import_react.default.createElement(
158
+ "iframe",
159
+ {
160
+ ref: this.ref,
161
+ src: `https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,
162
+ style,
163
+ frameBorder: 0,
164
+ allow: "autoplay"
165
+ }
166
+ );
167
+ }
168
+ }
169
+ __publicField(SoundCloud, "displayName", "SoundCloud");
170
+ __publicField(SoundCloud, "canPlay", import_patterns.canPlay.soundcloud);
171
+ __publicField(SoundCloud, "loopOnEnded", true);
172
+ return SoundCloud_1;
173
+ }
174
+
175
+ var SoundCloudExports = /*@__PURE__*/ requireSoundCloud();
176
+ var SoundCloud = /*@__PURE__*/index.getDefaultExportFromCjs(SoundCloudExports);
177
+
178
+ var SoundCloud$1 = /*#__PURE__*/_mergeNamespaces({
179
+ __proto__: null,
180
+ default: SoundCloud
181
+ }, [SoundCloudExports]);
182
+
183
+ exports.SoundCloud = SoundCloud$1;
@@ -0,0 +1,181 @@
1
+ import { r as requireUtils, a as requirePatterns, g as getDefaultExportFromCjs } from './index-C4Mk2H3N.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 SoundCloud_1;
20
+ var hasRequiredSoundCloud;
21
+
22
+ function requireSoundCloud () {
23
+ if (hasRequiredSoundCloud) return SoundCloud_1;
24
+ hasRequiredSoundCloud = 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 SoundCloud_exports = {};
58
+ __export(SoundCloud_exports, {
59
+ default: () => SoundCloud
60
+ });
61
+ SoundCloud_1 = __toCommonJS(SoundCloud_exports);
62
+ var import_react = __toESM(React__default);
63
+ var import_utils = /*@__PURE__*/ requireUtils();
64
+ var import_patterns = /*@__PURE__*/ requirePatterns();
65
+ const SDK_URL = "https://w.soundcloud.com/player/api.js";
66
+ const SDK_GLOBAL = "SC";
67
+ class SoundCloud extends import_react.Component {
68
+ constructor() {
69
+ super(...arguments);
70
+ __publicField(this, "callPlayer", import_utils.callPlayer);
71
+ __publicField(this, "duration", null);
72
+ __publicField(this, "currentTime", null);
73
+ __publicField(this, "fractionLoaded", null);
74
+ __publicField(this, "mute", () => {
75
+ this.setVolume(0);
76
+ });
77
+ __publicField(this, "unmute", () => {
78
+ if (this.props.volume !== null) {
79
+ this.setVolume(this.props.volume);
80
+ }
81
+ });
82
+ __publicField(this, "ref", (iframe) => {
83
+ this.iframe = iframe;
84
+ });
85
+ }
86
+ componentDidMount() {
87
+ this.props.onMount && this.props.onMount(this);
88
+ }
89
+ load(url, isReady) {
90
+ (0, import_utils.getSDK)(SDK_URL, SDK_GLOBAL).then((SC) => {
91
+ if (!this.iframe)
92
+ return;
93
+ const { PLAY, PLAY_PROGRESS, PAUSE, FINISH, ERROR } = SC.Widget.Events;
94
+ if (!isReady) {
95
+ this.player = SC.Widget(this.iframe);
96
+ this.player.bind(PLAY, this.props.onPlay);
97
+ this.player.bind(PAUSE, () => {
98
+ const remaining = this.duration - this.currentTime;
99
+ if (remaining < 0.05) {
100
+ return;
101
+ }
102
+ this.props.onPause();
103
+ });
104
+ this.player.bind(PLAY_PROGRESS, (e) => {
105
+ this.currentTime = e.currentPosition / 1e3;
106
+ this.fractionLoaded = e.loadedProgress;
107
+ });
108
+ this.player.bind(FINISH, () => this.props.onEnded());
109
+ this.player.bind(ERROR, (e) => this.props.onError(e));
110
+ }
111
+ this.player.load(url, {
112
+ ...this.props.config.options,
113
+ callback: () => {
114
+ this.player.getDuration((duration) => {
115
+ this.duration = duration / 1e3;
116
+ this.props.onReady();
117
+ });
118
+ }
119
+ });
120
+ });
121
+ }
122
+ play() {
123
+ this.callPlayer("play");
124
+ }
125
+ pause() {
126
+ this.callPlayer("pause");
127
+ }
128
+ stop() {
129
+ }
130
+ seekTo(seconds, keepPlaying = true) {
131
+ this.callPlayer("seekTo", seconds * 1e3);
132
+ if (!keepPlaying) {
133
+ this.pause();
134
+ }
135
+ }
136
+ setVolume(fraction) {
137
+ this.callPlayer("setVolume", fraction * 100);
138
+ }
139
+ getDuration() {
140
+ return this.duration;
141
+ }
142
+ getCurrentTime() {
143
+ return this.currentTime;
144
+ }
145
+ getSecondsLoaded() {
146
+ return this.fractionLoaded * this.duration;
147
+ }
148
+ render() {
149
+ const { display } = this.props;
150
+ const style = {
151
+ width: "100%",
152
+ height: "100%",
153
+ display
154
+ };
155
+ return /* @__PURE__ */ import_react.default.createElement(
156
+ "iframe",
157
+ {
158
+ ref: this.ref,
159
+ src: `https://w.soundcloud.com/player/?url=${encodeURIComponent(this.props.url)}`,
160
+ style,
161
+ frameBorder: 0,
162
+ allow: "autoplay"
163
+ }
164
+ );
165
+ }
166
+ }
167
+ __publicField(SoundCloud, "displayName", "SoundCloud");
168
+ __publicField(SoundCloud, "canPlay", import_patterns.canPlay.soundcloud);
169
+ __publicField(SoundCloud, "loopOnEnded", true);
170
+ return SoundCloud_1;
171
+ }
172
+
173
+ var SoundCloudExports = /*@__PURE__*/ requireSoundCloud();
174
+ var SoundCloud = /*@__PURE__*/getDefaultExportFromCjs(SoundCloudExports);
175
+
176
+ var SoundCloud$1 = /*#__PURE__*/_mergeNamespaces({
177
+ __proto__: null,
178
+ default: SoundCloud
179
+ }, [SoundCloudExports]);
180
+
181
+ export { SoundCloud$1 as S };