stormcloud-video-player 0.6.6 → 0.7.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.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +1340 -118
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +65 -1
- package/lib/index.d.ts +65 -1
- package/lib/index.js +1306 -100
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +40 -0
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +4 -0
- package/lib/players/HlsPlayer.cjs +40 -0
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +40 -0
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/OverlayRenderer.cjs +1189 -0
- package/lib/ui/OverlayRenderer.cjs.map +1 -0
- package/lib/ui/OverlayRenderer.d.cts +15 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +1300 -94
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/utils/overlays.cjs +286 -0
- package/lib/utils/overlays.cjs.map +1 -0
- package/lib/utils/overlays.d.cts +60 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _iterable_to_array_limit(arr, i) {
|
|
11
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12
|
+
if (_i == null) return;
|
|
13
|
+
var _arr = [];
|
|
14
|
+
var _n = true;
|
|
15
|
+
var _d = false;
|
|
16
|
+
var _s, _e;
|
|
17
|
+
try {
|
|
18
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
19
|
+
_arr.push(_s.value);
|
|
20
|
+
if (i && _arr.length === i) break;
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_d = true;
|
|
24
|
+
_e = err;
|
|
25
|
+
} finally{
|
|
26
|
+
try {
|
|
27
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
28
|
+
} finally{
|
|
29
|
+
if (_d) throw _e;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return _arr;
|
|
33
|
+
}
|
|
34
|
+
function _non_iterable_rest() {
|
|
35
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
36
|
+
}
|
|
37
|
+
function _sliced_to_array(arr, i) {
|
|
38
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
39
|
+
}
|
|
40
|
+
function _type_of(obj) {
|
|
41
|
+
"@swc/helpers - typeof";
|
|
42
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
43
|
+
}
|
|
44
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
45
|
+
if (!o) return;
|
|
46
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
47
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
48
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
49
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
50
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
51
|
+
}
|
|
52
|
+
var __create = Object.create;
|
|
53
|
+
var __defProp = Object.defineProperty;
|
|
54
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
55
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
56
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
57
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
58
|
+
var __export = function __export(target, all) {
|
|
59
|
+
for(var name in all)__defProp(target, name, {
|
|
60
|
+
get: all[name],
|
|
61
|
+
enumerable: true
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
65
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
66
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
67
|
+
try {
|
|
68
|
+
var _loop = function() {
|
|
69
|
+
var key = _step.value;
|
|
70
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
71
|
+
get: function get() {
|
|
72
|
+
return from[key];
|
|
73
|
+
},
|
|
74
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
78
|
+
} catch (err) {
|
|
79
|
+
_didIteratorError = true;
|
|
80
|
+
_iteratorError = err;
|
|
81
|
+
} finally{
|
|
82
|
+
try {
|
|
83
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
84
|
+
_iterator.return();
|
|
85
|
+
}
|
|
86
|
+
} finally{
|
|
87
|
+
if (_didIteratorError) {
|
|
88
|
+
throw _iteratorError;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return to;
|
|
94
|
+
};
|
|
95
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
96
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
97
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
98
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
99
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
100
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
101
|
+
value: mod,
|
|
102
|
+
enumerable: true
|
|
103
|
+
}) : target, mod);
|
|
104
|
+
};
|
|
105
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
106
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
107
|
+
value: true
|
|
108
|
+
}), mod);
|
|
109
|
+
};
|
|
110
|
+
// src/ui/OverlayRenderer.tsx
|
|
111
|
+
var OverlayRenderer_exports = {};
|
|
112
|
+
__export(OverlayRenderer_exports, {
|
|
113
|
+
OverlayRenderer: function OverlayRenderer1() {
|
|
114
|
+
return OverlayRenderer;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
module.exports = __toCommonJS(OverlayRenderer_exports);
|
|
118
|
+
var import_react = __toESM(require("react"), 1);
|
|
119
|
+
// src/utils/overlays.ts
|
|
120
|
+
var OVERLAY_API_BASE = "https://adstorm.co/api-adstorm-dev";
|
|
121
|
+
function timeStringToSeconds(timeStr) {
|
|
122
|
+
if (!timeStr) return 0;
|
|
123
|
+
var parts = timeStr.split(":");
|
|
124
|
+
if (parts.length >= 3) {
|
|
125
|
+
var _parts_, _parts_1, _parts_2;
|
|
126
|
+
var hours = parseInt((_parts_ = parts[0]) !== null && _parts_ !== void 0 ? _parts_ : "0", 10) || 0;
|
|
127
|
+
var minutes = parseInt((_parts_1 = parts[1]) !== null && _parts_1 !== void 0 ? _parts_1 : "0", 10) || 0;
|
|
128
|
+
var secStr = (_parts_2 = parts[2]) !== null && _parts_2 !== void 0 ? _parts_2 : "0";
|
|
129
|
+
var dotIdx = secStr.indexOf(".");
|
|
130
|
+
var seconds = parseInt(dotIdx >= 0 ? secStr.substring(0, dotIdx) : secStr, 10) || 0;
|
|
131
|
+
var msFrag = dotIdx >= 0 ? secStr.substring(dotIdx + 1) : "";
|
|
132
|
+
var ms = msFrag ? parseInt(msFrag.padEnd(3, "0").substring(0, 3), 10) || 0 : 0;
|
|
133
|
+
return hours * 3600 + minutes * 60 + seconds + ms / 1e3;
|
|
134
|
+
}
|
|
135
|
+
if (parts.length === 2) {
|
|
136
|
+
var _parts_3, _parts_4;
|
|
137
|
+
var minutes1 = parseInt((_parts_3 = parts[0]) !== null && _parts_3 !== void 0 ? _parts_3 : "0", 10) || 0;
|
|
138
|
+
var secStr1 = (_parts_4 = parts[1]) !== null && _parts_4 !== void 0 ? _parts_4 : "0";
|
|
139
|
+
var dotIdx1 = secStr1.indexOf(".");
|
|
140
|
+
var seconds1 = parseInt(dotIdx1 >= 0 ? secStr1.substring(0, dotIdx1) : secStr1, 10) || 0;
|
|
141
|
+
var msFrag1 = dotIdx1 >= 0 ? secStr1.substring(dotIdx1 + 1) : "";
|
|
142
|
+
var ms1 = msFrag1 ? parseInt(msFrag1.padEnd(3, "0").substring(0, 3), 10) || 0 : 0;
|
|
143
|
+
return minutes1 * 60 + seconds1 + ms1 / 1e3;
|
|
144
|
+
}
|
|
145
|
+
var num = parseFloat(timeStr);
|
|
146
|
+
return isFinite(num) ? Math.max(0, num) : 0;
|
|
147
|
+
}
|
|
148
|
+
function isOverlayActive(overlay, currentTime) {
|
|
149
|
+
if (!overlay.visible) return false;
|
|
150
|
+
var startSec = timeStringToSeconds(overlay.start_time);
|
|
151
|
+
var durationSec = timeStringToSeconds(overlay.duration);
|
|
152
|
+
if (durationSec <= 0) return false;
|
|
153
|
+
return currentTime >= startSec && currentTime < startSec + durationSec;
|
|
154
|
+
}
|
|
155
|
+
function resolveImageUrl(imageUrl) {
|
|
156
|
+
var apiBaseUrl = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : OVERLAY_API_BASE;
|
|
157
|
+
if (!imageUrl) return "";
|
|
158
|
+
if (imageUrl.startsWith("http://") || imageUrl.startsWith("https://")) {
|
|
159
|
+
return imageUrl;
|
|
160
|
+
}
|
|
161
|
+
if (imageUrl.startsWith("/")) {
|
|
162
|
+
try {
|
|
163
|
+
var url = new URL(apiBaseUrl);
|
|
164
|
+
return "".concat(url.origin).concat(imageUrl);
|
|
165
|
+
} catch (unused) {
|
|
166
|
+
return imageUrl;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return "".concat(apiBaseUrl, "/").concat(imageUrl);
|
|
170
|
+
}
|
|
171
|
+
// src/ui/OverlayRenderer.tsx
|
|
172
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
173
|
+
function computeVideoDimensions(video) {
|
|
174
|
+
var nativeWidth = video.videoWidth;
|
|
175
|
+
var nativeHeight = video.videoHeight;
|
|
176
|
+
if (!nativeWidth || !nativeHeight) return null;
|
|
177
|
+
var displayWidth = video.offsetWidth;
|
|
178
|
+
var displayHeight = video.offsetHeight;
|
|
179
|
+
if (!displayWidth || !displayHeight) return null;
|
|
180
|
+
var videoAspect = nativeWidth / nativeHeight;
|
|
181
|
+
var displayAspect = displayWidth / displayHeight;
|
|
182
|
+
var renderWidth;
|
|
183
|
+
var renderHeight;
|
|
184
|
+
var offsetX;
|
|
185
|
+
var offsetY;
|
|
186
|
+
if (videoAspect > displayAspect) {
|
|
187
|
+
renderWidth = displayWidth;
|
|
188
|
+
renderHeight = displayWidth / videoAspect;
|
|
189
|
+
offsetX = 0;
|
|
190
|
+
offsetY = (displayHeight - renderHeight) / 2;
|
|
191
|
+
} else {
|
|
192
|
+
renderHeight = displayHeight;
|
|
193
|
+
renderWidth = displayHeight * videoAspect;
|
|
194
|
+
offsetX = (displayWidth - renderWidth) / 2;
|
|
195
|
+
offsetY = 0;
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
nativeWidth: nativeWidth,
|
|
199
|
+
nativeHeight: nativeHeight,
|
|
200
|
+
displayWidth: renderWidth,
|
|
201
|
+
displayHeight: renderHeight,
|
|
202
|
+
offsetX: offsetX,
|
|
203
|
+
offsetY: offsetY,
|
|
204
|
+
scaleX: renderWidth / nativeWidth,
|
|
205
|
+
scaleY: renderHeight / nativeHeight
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function ImageOverlay(param) {
|
|
209
|
+
var overlay = param.overlay;
|
|
210
|
+
var src = resolveImageUrl(overlay.image_url || "");
|
|
211
|
+
if (!src) return null;
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
213
|
+
src: src,
|
|
214
|
+
alt: overlay.name,
|
|
215
|
+
draggable: false,
|
|
216
|
+
style: {
|
|
217
|
+
width: "100%",
|
|
218
|
+
height: "100%",
|
|
219
|
+
objectFit: "contain",
|
|
220
|
+
display: "block",
|
|
221
|
+
pointerEvents: "none",
|
|
222
|
+
userSelect: "none"
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function TextOverlay(param) {
|
|
227
|
+
var overlay = param.overlay;
|
|
228
|
+
var text = overlay.content || "";
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
230
|
+
style: {
|
|
231
|
+
width: "100%",
|
|
232
|
+
height: "100%",
|
|
233
|
+
display: "flex",
|
|
234
|
+
alignItems: "center",
|
|
235
|
+
justifyContent: "center",
|
|
236
|
+
color: "#ffffff",
|
|
237
|
+
fontSize: "clamp(10px, 1.4vw, 20px)",
|
|
238
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
239
|
+
fontWeight: 600,
|
|
240
|
+
textAlign: "center",
|
|
241
|
+
padding: "4px 8px",
|
|
242
|
+
boxSizing: "border-box",
|
|
243
|
+
wordBreak: "break-word",
|
|
244
|
+
textShadow: "0 1px 4px rgba(0,0,0,0.7)",
|
|
245
|
+
pointerEvents: "none",
|
|
246
|
+
userSelect: "none",
|
|
247
|
+
lineHeight: 1.3
|
|
248
|
+
},
|
|
249
|
+
children: text
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function ScrollerOverlay(param) {
|
|
253
|
+
var overlay = param.overlay;
|
|
254
|
+
var _ref, _ref1, _ref2, _ref3, _ref4;
|
|
255
|
+
var cfg = overlay.scroller_config;
|
|
256
|
+
var text = (cfg === null || cfg === void 0 ? void 0 : cfg.use_custom_text) && cfg.custom_text ? cfg.custom_text : overlay.content || (cfg === null || cfg === void 0 ? void 0 : cfg.custom_text) || "";
|
|
257
|
+
var scrollSpeed = (_ref = cfg === null || cfg === void 0 ? void 0 : cfg.scroll_speed) !== null && _ref !== void 0 ? _ref : 50;
|
|
258
|
+
var direction = (_ref1 = cfg === null || cfg === void 0 ? void 0 : cfg.direction) !== null && _ref1 !== void 0 ? _ref1 : "left";
|
|
259
|
+
var fontSize = (cfg === null || cfg === void 0 ? void 0 : cfg.font_size) ? "".concat(cfg.font_size, "px") : "clamp(10px, 1.2vw, 18px)";
|
|
260
|
+
var fontFamily = (cfg === null || cfg === void 0 ? void 0 : cfg.font_family) || "Roboto, 'Segoe UI', Arial, sans-serif";
|
|
261
|
+
var fontWeight = (cfg === null || cfg === void 0 ? void 0 : cfg.font_weight) || "600";
|
|
262
|
+
var textColor = (cfg === null || cfg === void 0 ? void 0 : cfg.text_color) || "#ffffff";
|
|
263
|
+
var bgColor = (cfg === null || cfg === void 0 ? void 0 : cfg.background_color) || "transparent";
|
|
264
|
+
var bgOpacity = (cfg === null || cfg === void 0 ? void 0 : cfg.background_opacity) !== void 0 ? cfg.background_opacity / 100 : 0;
|
|
265
|
+
var borderColor = (cfg === null || cfg === void 0 ? void 0 : cfg.border_color) || "transparent";
|
|
266
|
+
var borderWidth = (_ref2 = cfg === null || cfg === void 0 ? void 0 : cfg.border_width) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
267
|
+
var borderRadius = (_ref3 = cfg === null || cfg === void 0 ? void 0 : cfg.border_radius) !== null && _ref3 !== void 0 ? _ref3 : 0;
|
|
268
|
+
var padding = (_ref4 = cfg === null || cfg === void 0 ? void 0 : cfg.padding) !== null && _ref4 !== void 0 ? _ref4 : 4;
|
|
269
|
+
var isVertical = direction === "up" || direction === "down";
|
|
270
|
+
var isReverse = direction === "right" || direction === "down";
|
|
271
|
+
var durationSec = Math.max(3, 120 - scrollSpeed);
|
|
272
|
+
var animId = "sc-scroller-".concat(overlay.id);
|
|
273
|
+
var keyframes = isVertical ? "@keyframes ".concat(animId, " {\n 0% { transform: translateY(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateY(").concat(isReverse ? "100%" : "-100%", "); }\n }") : "@keyframes ".concat(animId, " {\n 0% { transform: translateX(").concat(isReverse ? "-100%" : "100%", "); }\n 100% { transform: translateX(").concat(isReverse ? "100%" : "-100%", "); }\n }");
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
275
|
+
children: [
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", {
|
|
277
|
+
children: keyframes
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
280
|
+
style: {
|
|
281
|
+
width: "100%",
|
|
282
|
+
height: "100%",
|
|
283
|
+
overflow: "hidden",
|
|
284
|
+
display: "flex",
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
backgroundColor: bgOpacity > 0 ? "rgba(".concat(hexToRgb(bgColor), ", ").concat(bgOpacity, ")") : void 0,
|
|
287
|
+
border: borderWidth > 0 ? "".concat(borderWidth, "px solid ").concat(borderColor) : void 0,
|
|
288
|
+
borderRadius: borderRadius > 0 ? "".concat(borderRadius, "px") : void 0,
|
|
289
|
+
padding: "".concat(padding, "px"),
|
|
290
|
+
boxSizing: "border-box",
|
|
291
|
+
pointerEvents: "none"
|
|
292
|
+
},
|
|
293
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
294
|
+
style: {
|
|
295
|
+
whiteSpace: "nowrap",
|
|
296
|
+
fontSize: fontSize,
|
|
297
|
+
fontFamily: fontFamily,
|
|
298
|
+
fontWeight: fontWeight,
|
|
299
|
+
color: textColor,
|
|
300
|
+
animation: "".concat(animId, " ").concat(durationSec, "s linear infinite"),
|
|
301
|
+
textShadow: "0 1px 4px rgba(0,0,0,0.5)",
|
|
302
|
+
userSelect: "none"
|
|
303
|
+
},
|
|
304
|
+
children: text
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function parseConfig(content) {
|
|
311
|
+
if (!content) return null;
|
|
312
|
+
try {
|
|
313
|
+
return JSON.parse(content);
|
|
314
|
+
} catch (unused) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
function ScoreBugOverlay(param) {
|
|
319
|
+
var overlay = param.overlay, size = param.size;
|
|
320
|
+
var cfg = parseConfig(overlay.content);
|
|
321
|
+
if (!cfg) return null;
|
|
322
|
+
var f = Math.max(6, size.w * 0.058);
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
324
|
+
style: {
|
|
325
|
+
width: "100%",
|
|
326
|
+
height: "100%",
|
|
327
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
328
|
+
display: "flex",
|
|
329
|
+
flexDirection: "column",
|
|
330
|
+
background: cfg.backgroundColor,
|
|
331
|
+
color: cfg.textColor,
|
|
332
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
333
|
+
overflow: "hidden",
|
|
334
|
+
pointerEvents: "none",
|
|
335
|
+
userSelect: "none",
|
|
336
|
+
fontSize: "".concat(f, "px")
|
|
337
|
+
},
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
340
|
+
style: {
|
|
341
|
+
flex: 1,
|
|
342
|
+
display: "flex",
|
|
343
|
+
alignItems: "center",
|
|
344
|
+
padding: "0 ".concat(f * 0.8, "px"),
|
|
345
|
+
gap: f * 0.4
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
349
|
+
style: {
|
|
350
|
+
flex: 1,
|
|
351
|
+
textAlign: "center"
|
|
352
|
+
},
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
355
|
+
style: {
|
|
356
|
+
fontSize: "1em",
|
|
357
|
+
fontWeight: 700
|
|
358
|
+
},
|
|
359
|
+
children: cfg.homeTeam
|
|
360
|
+
}),
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
362
|
+
style: {
|
|
363
|
+
fontSize: "1.8em",
|
|
364
|
+
fontWeight: 900,
|
|
365
|
+
lineHeight: 1
|
|
366
|
+
},
|
|
367
|
+
children: cfg.homeScore
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
}),
|
|
371
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
372
|
+
style: {
|
|
373
|
+
fontSize: "0.8em",
|
|
374
|
+
textAlign: "center",
|
|
375
|
+
opacity: 0.7,
|
|
376
|
+
padding: "0 ".concat(f * 0.4, "px")
|
|
377
|
+
},
|
|
378
|
+
children: [
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
380
|
+
children: cfg.period
|
|
381
|
+
}),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
383
|
+
children: cfg.clock
|
|
384
|
+
})
|
|
385
|
+
]
|
|
386
|
+
}),
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
388
|
+
style: {
|
|
389
|
+
flex: 1,
|
|
390
|
+
textAlign: "center"
|
|
391
|
+
},
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
394
|
+
style: {
|
|
395
|
+
fontSize: "1em",
|
|
396
|
+
fontWeight: 700
|
|
397
|
+
},
|
|
398
|
+
children: cfg.awayTeam
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
401
|
+
style: {
|
|
402
|
+
fontSize: "1.8em",
|
|
403
|
+
fontWeight: 900,
|
|
404
|
+
lineHeight: 1
|
|
405
|
+
},
|
|
406
|
+
children: cfg.awayScore
|
|
407
|
+
})
|
|
408
|
+
]
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
}),
|
|
412
|
+
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
413
|
+
style: {
|
|
414
|
+
fontSize: "0.7em",
|
|
415
|
+
textAlign: "center",
|
|
416
|
+
opacity: 0.5,
|
|
417
|
+
padding: "".concat(f * 0.2, "px 0"),
|
|
418
|
+
borderTop: "1px solid ".concat(cfg.accentColor, "40")
|
|
419
|
+
},
|
|
420
|
+
children: cfg.sponsorText
|
|
421
|
+
})
|
|
422
|
+
]
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
function LowerThirdOverlay(param) {
|
|
426
|
+
var overlay = param.overlay, size = param.size;
|
|
427
|
+
var cfg = parseConfig(overlay.content);
|
|
428
|
+
if (!cfg) return null;
|
|
429
|
+
var f = Math.max(6, size.w * 0.055);
|
|
430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
431
|
+
style: {
|
|
432
|
+
width: "100%",
|
|
433
|
+
height: "100%",
|
|
434
|
+
borderRadius: Math.max(2, size.w * 0.02),
|
|
435
|
+
display: "flex",
|
|
436
|
+
flexDirection: "column",
|
|
437
|
+
justifyContent: "flex-end",
|
|
438
|
+
background: cfg.backgroundColor,
|
|
439
|
+
color: cfg.textColor,
|
|
440
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
441
|
+
overflow: "hidden",
|
|
442
|
+
pointerEvents: "none",
|
|
443
|
+
userSelect: "none",
|
|
444
|
+
fontSize: "".concat(f, "px")
|
|
445
|
+
},
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
448
|
+
style: {
|
|
449
|
+
width: "100%",
|
|
450
|
+
height: Math.max(2, size.h * 0.06),
|
|
451
|
+
backgroundColor: cfg.accentColor
|
|
452
|
+
}
|
|
453
|
+
}),
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
455
|
+
style: {
|
|
456
|
+
flex: 1,
|
|
457
|
+
display: "flex",
|
|
458
|
+
flexDirection: "column",
|
|
459
|
+
justifyContent: "center",
|
|
460
|
+
padding: "".concat(f * 0.5, "px ").concat(f * 1.2, "px")
|
|
461
|
+
},
|
|
462
|
+
children: [
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
464
|
+
style: {
|
|
465
|
+
fontSize: "1.4em",
|
|
466
|
+
fontWeight: 700,
|
|
467
|
+
lineHeight: 1.2,
|
|
468
|
+
textShadow: "0 1px 4px rgba(0,0,0,0.5)"
|
|
469
|
+
},
|
|
470
|
+
children: cfg.headline
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
473
|
+
style: {
|
|
474
|
+
fontSize: "1em",
|
|
475
|
+
opacity: 0.7,
|
|
476
|
+
marginTop: f * 0.2
|
|
477
|
+
},
|
|
478
|
+
children: cfg.subtitle
|
|
479
|
+
})
|
|
480
|
+
]
|
|
481
|
+
}),
|
|
482
|
+
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
483
|
+
style: {
|
|
484
|
+
fontSize: "0.7em",
|
|
485
|
+
opacity: 0.4,
|
|
486
|
+
padding: "0 ".concat(f * 1.2, "px ").concat(f * 0.4, "px")
|
|
487
|
+
},
|
|
488
|
+
children: cfg.sponsorText
|
|
489
|
+
})
|
|
490
|
+
]
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function QrCodeOverlay(param) {
|
|
494
|
+
var overlay = param.overlay, size = param.size;
|
|
495
|
+
var cfg = parseConfig(overlay.content);
|
|
496
|
+
if (!cfg) return null;
|
|
497
|
+
var qrSide = Math.max(32, Math.min(size.w, size.h) * 0.55);
|
|
498
|
+
var qrUrl = "https://api.qrserver.com/v1/create-qr-code/?size=".concat(Math.round(qrSide * 2), "x").concat(Math.round(qrSide * 2), "&data=").concat(encodeURIComponent(cfg.url || "https://example.com"));
|
|
499
|
+
var f = Math.max(6, size.w * 0.06);
|
|
500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
501
|
+
style: {
|
|
502
|
+
width: "100%",
|
|
503
|
+
height: "100%",
|
|
504
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
505
|
+
display: "flex",
|
|
506
|
+
flexDirection: "column",
|
|
507
|
+
alignItems: "center",
|
|
508
|
+
justifyContent: "center",
|
|
509
|
+
gap: f * 0.4,
|
|
510
|
+
background: cfg.backgroundColor,
|
|
511
|
+
color: cfg.textColor,
|
|
512
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
513
|
+
padding: f * 0.6,
|
|
514
|
+
boxSizing: "border-box",
|
|
515
|
+
pointerEvents: "none",
|
|
516
|
+
userSelect: "none",
|
|
517
|
+
overflow: "hidden"
|
|
518
|
+
},
|
|
519
|
+
children: [
|
|
520
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
521
|
+
style: {
|
|
522
|
+
flexShrink: 0,
|
|
523
|
+
background: "#fff",
|
|
524
|
+
borderRadius: Math.max(2, qrSide * 0.06),
|
|
525
|
+
padding: Math.max(2, qrSide * 0.06),
|
|
526
|
+
lineHeight: 0
|
|
527
|
+
},
|
|
528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
|
|
529
|
+
src: qrUrl,
|
|
530
|
+
alt: "QR Code",
|
|
531
|
+
style: {
|
|
532
|
+
width: "".concat(qrSide, "px"),
|
|
533
|
+
height: "".concat(qrSide, "px"),
|
|
534
|
+
display: "block"
|
|
535
|
+
}
|
|
536
|
+
})
|
|
537
|
+
}),
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
539
|
+
style: {
|
|
540
|
+
fontSize: "".concat(f * 1.1, "px"),
|
|
541
|
+
fontWeight: 700,
|
|
542
|
+
textAlign: "center",
|
|
543
|
+
color: cfg.accentColor,
|
|
544
|
+
overflow: "hidden",
|
|
545
|
+
textOverflow: "ellipsis",
|
|
546
|
+
whiteSpace: "nowrap",
|
|
547
|
+
width: "100%"
|
|
548
|
+
},
|
|
549
|
+
children: cfg.ctaText
|
|
550
|
+
}),
|
|
551
|
+
cfg.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
552
|
+
style: {
|
|
553
|
+
fontSize: "".concat(f * 0.75, "px"),
|
|
554
|
+
opacity: 0.6,
|
|
555
|
+
textAlign: "center",
|
|
556
|
+
overflow: "hidden",
|
|
557
|
+
textOverflow: "ellipsis",
|
|
558
|
+
whiteSpace: "nowrap",
|
|
559
|
+
width: "100%"
|
|
560
|
+
},
|
|
561
|
+
children: cfg.description
|
|
562
|
+
})
|
|
563
|
+
]
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function ComingUpNextOverlay(param) {
|
|
567
|
+
var overlay = param.overlay, size = param.size;
|
|
568
|
+
var cfg = parseConfig(overlay.content);
|
|
569
|
+
if (!cfg) return null;
|
|
570
|
+
var f = Math.max(6, size.w * 0.05);
|
|
571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
572
|
+
style: {
|
|
573
|
+
width: "100%",
|
|
574
|
+
height: "100%",
|
|
575
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
576
|
+
display: "flex",
|
|
577
|
+
background: cfg.backgroundColor,
|
|
578
|
+
color: cfg.textColor,
|
|
579
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
580
|
+
overflow: "hidden",
|
|
581
|
+
pointerEvents: "none",
|
|
582
|
+
userSelect: "none",
|
|
583
|
+
fontSize: "".concat(f, "px")
|
|
584
|
+
},
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
587
|
+
style: {
|
|
588
|
+
width: Math.max(2, size.w * 0.015),
|
|
589
|
+
flexShrink: 0,
|
|
590
|
+
backgroundColor: cfg.accentColor
|
|
591
|
+
}
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
594
|
+
style: {
|
|
595
|
+
flex: 1,
|
|
596
|
+
display: "flex",
|
|
597
|
+
flexDirection: "column",
|
|
598
|
+
justifyContent: "center",
|
|
599
|
+
padding: "".concat(f * 0.6, "px ").concat(f * 1, "px"),
|
|
600
|
+
minWidth: 0
|
|
601
|
+
},
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
604
|
+
style: {
|
|
605
|
+
fontSize: "0.8em",
|
|
606
|
+
fontWeight: 600,
|
|
607
|
+
textTransform: "uppercase",
|
|
608
|
+
letterSpacing: "0.05em",
|
|
609
|
+
color: cfg.accentColor
|
|
610
|
+
},
|
|
611
|
+
children: "Coming Up Next"
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
614
|
+
style: {
|
|
615
|
+
fontSize: "1.5em",
|
|
616
|
+
fontWeight: 700,
|
|
617
|
+
lineHeight: 1.2,
|
|
618
|
+
marginTop: f * 0.2,
|
|
619
|
+
overflow: "hidden",
|
|
620
|
+
textOverflow: "ellipsis",
|
|
621
|
+
whiteSpace: "nowrap"
|
|
622
|
+
},
|
|
623
|
+
children: cfg.title
|
|
624
|
+
}),
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
626
|
+
style: {
|
|
627
|
+
fontSize: "0.9em",
|
|
628
|
+
opacity: 0.6,
|
|
629
|
+
overflow: "hidden",
|
|
630
|
+
textOverflow: "ellipsis",
|
|
631
|
+
whiteSpace: "nowrap"
|
|
632
|
+
},
|
|
633
|
+
children: cfg.subtitle
|
|
634
|
+
}),
|
|
635
|
+
cfg.scheduledTime && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
636
|
+
style: {
|
|
637
|
+
fontSize: "1em",
|
|
638
|
+
fontWeight: 600,
|
|
639
|
+
marginTop: f * 0.4,
|
|
640
|
+
color: cfg.accentColor
|
|
641
|
+
},
|
|
642
|
+
children: cfg.scheduledTime
|
|
643
|
+
})
|
|
644
|
+
]
|
|
645
|
+
})
|
|
646
|
+
]
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function ContextualTriggerOverlay(param) {
|
|
650
|
+
var overlay = param.overlay, size = param.size;
|
|
651
|
+
var cfg = parseConfig(overlay.content);
|
|
652
|
+
if (!cfg) return null;
|
|
653
|
+
var icons = {
|
|
654
|
+
alert: "\u26A0\uFE0F",
|
|
655
|
+
celebration: "\uD83C\uDF89",
|
|
656
|
+
info: "\u2139\uFE0F",
|
|
657
|
+
warning: "\uD83D\uDD14"
|
|
658
|
+
};
|
|
659
|
+
var f = Math.max(6, size.w * 0.05);
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
661
|
+
style: {
|
|
662
|
+
width: "100%",
|
|
663
|
+
height: "100%",
|
|
664
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
665
|
+
display: "flex",
|
|
666
|
+
alignItems: "center",
|
|
667
|
+
gap: f * 0.8,
|
|
668
|
+
padding: "0 ".concat(f * 1.2, "px"),
|
|
669
|
+
background: cfg.backgroundColor,
|
|
670
|
+
color: cfg.textColor,
|
|
671
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
672
|
+
borderLeft: "".concat(Math.max(2, size.w * 0.02), "px solid ").concat(cfg.accentColor),
|
|
673
|
+
boxSizing: "border-box",
|
|
674
|
+
pointerEvents: "none",
|
|
675
|
+
userSelect: "none",
|
|
676
|
+
fontSize: "".concat(f, "px")
|
|
677
|
+
},
|
|
678
|
+
children: [
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
680
|
+
style: {
|
|
681
|
+
fontSize: "2em",
|
|
682
|
+
flexShrink: 0
|
|
683
|
+
},
|
|
684
|
+
children: icons[cfg.iconType] || "\u26A1"
|
|
685
|
+
}),
|
|
686
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
687
|
+
style: {
|
|
688
|
+
flex: 1,
|
|
689
|
+
minWidth: 0
|
|
690
|
+
},
|
|
691
|
+
children: [
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
693
|
+
style: {
|
|
694
|
+
fontSize: "1.3em",
|
|
695
|
+
fontWeight: 700,
|
|
696
|
+
overflow: "hidden",
|
|
697
|
+
textOverflow: "ellipsis",
|
|
698
|
+
whiteSpace: "nowrap"
|
|
699
|
+
},
|
|
700
|
+
children: cfg.headline
|
|
701
|
+
}),
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
703
|
+
style: {
|
|
704
|
+
fontSize: "0.9em",
|
|
705
|
+
opacity: 0.7,
|
|
706
|
+
overflow: "hidden",
|
|
707
|
+
textOverflow: "ellipsis",
|
|
708
|
+
whiteSpace: "nowrap"
|
|
709
|
+
},
|
|
710
|
+
children: cfg.message
|
|
711
|
+
})
|
|
712
|
+
]
|
|
713
|
+
})
|
|
714
|
+
]
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
function OddsBettingOverlay(param) {
|
|
718
|
+
var overlay = param.overlay, size = param.size;
|
|
719
|
+
var cfg = parseConfig(overlay.content);
|
|
720
|
+
if (!cfg) return null;
|
|
721
|
+
var f = Math.max(6, size.w * 0.052);
|
|
722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
723
|
+
style: {
|
|
724
|
+
width: "100%",
|
|
725
|
+
height: "100%",
|
|
726
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
727
|
+
display: "flex",
|
|
728
|
+
flexDirection: "column",
|
|
729
|
+
padding: f * 0.8,
|
|
730
|
+
background: cfg.backgroundColor,
|
|
731
|
+
color: cfg.textColor,
|
|
732
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
733
|
+
boxSizing: "border-box",
|
|
734
|
+
pointerEvents: "none",
|
|
735
|
+
userSelect: "none",
|
|
736
|
+
fontSize: "".concat(f, "px")
|
|
737
|
+
},
|
|
738
|
+
children: [
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
740
|
+
style: {
|
|
741
|
+
fontSize: "0.9em",
|
|
742
|
+
fontWeight: 700,
|
|
743
|
+
textTransform: "uppercase",
|
|
744
|
+
letterSpacing: "0.05em",
|
|
745
|
+
color: cfg.accentColor,
|
|
746
|
+
marginBottom: f * 0.4
|
|
747
|
+
},
|
|
748
|
+
children: cfg.eventTitle
|
|
749
|
+
}),
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
751
|
+
style: {
|
|
752
|
+
flex: 1,
|
|
753
|
+
display: "flex",
|
|
754
|
+
flexDirection: "column",
|
|
755
|
+
gap: f * 0.2,
|
|
756
|
+
justifyContent: "center"
|
|
757
|
+
},
|
|
758
|
+
children: (cfg.options || []).slice(0, 5).map(function(opt, i) {
|
|
759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
760
|
+
style: {
|
|
761
|
+
display: "flex",
|
|
762
|
+
justifyContent: "space-between",
|
|
763
|
+
alignItems: "center",
|
|
764
|
+
padding: "".concat(f * 0.2, "px ").concat(f * 0.6, "px"),
|
|
765
|
+
borderRadius: Math.max(2, f * 0.3),
|
|
766
|
+
background: "".concat(cfg.accentColor, "15"),
|
|
767
|
+
fontSize: "1em"
|
|
768
|
+
},
|
|
769
|
+
children: [
|
|
770
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
771
|
+
style: {
|
|
772
|
+
overflow: "hidden",
|
|
773
|
+
textOverflow: "ellipsis",
|
|
774
|
+
whiteSpace: "nowrap",
|
|
775
|
+
flex: 1
|
|
776
|
+
},
|
|
777
|
+
children: opt.label
|
|
778
|
+
}),
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
780
|
+
style: {
|
|
781
|
+
fontWeight: 700,
|
|
782
|
+
marginLeft: f * 0.8,
|
|
783
|
+
flexShrink: 0,
|
|
784
|
+
color: cfg.accentColor
|
|
785
|
+
},
|
|
786
|
+
children: opt.odds
|
|
787
|
+
})
|
|
788
|
+
]
|
|
789
|
+
}, i);
|
|
790
|
+
})
|
|
791
|
+
}),
|
|
792
|
+
cfg.sponsorText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
793
|
+
style: {
|
|
794
|
+
fontSize: "0.7em",
|
|
795
|
+
opacity: 0.4,
|
|
796
|
+
textAlign: "center",
|
|
797
|
+
marginTop: f * 0.4
|
|
798
|
+
},
|
|
799
|
+
children: cfg.sponsorText
|
|
800
|
+
})
|
|
801
|
+
]
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function BreakingNewsOverlay(param) {
|
|
805
|
+
var overlay = param.overlay, size = param.size;
|
|
806
|
+
var cfg = parseConfig(overlay.content);
|
|
807
|
+
if (!cfg) return null;
|
|
808
|
+
var urgencyColors = {
|
|
809
|
+
breaking: "#dc2626",
|
|
810
|
+
urgent: "#ea580c",
|
|
811
|
+
normal: "#2563eb"
|
|
812
|
+
};
|
|
813
|
+
var labelBg = urgencyColors[cfg.urgency] || urgencyColors.normal;
|
|
814
|
+
var label = cfg.urgency === "breaking" ? "BREAKING" : cfg.urgency === "urgent" ? "URGENT" : "NEWS";
|
|
815
|
+
var f = Math.max(6, size.w * 0.05);
|
|
816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
817
|
+
style: {
|
|
818
|
+
width: "100%",
|
|
819
|
+
height: "100%",
|
|
820
|
+
borderRadius: Math.max(2, size.w * 0.02),
|
|
821
|
+
display: "flex",
|
|
822
|
+
alignItems: "center",
|
|
823
|
+
background: cfg.backgroundColor,
|
|
824
|
+
color: cfg.textColor,
|
|
825
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
826
|
+
overflow: "hidden",
|
|
827
|
+
pointerEvents: "none",
|
|
828
|
+
userSelect: "none",
|
|
829
|
+
fontSize: "".concat(f, "px")
|
|
830
|
+
},
|
|
831
|
+
children: [
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
833
|
+
style: {
|
|
834
|
+
padding: "0 ".concat(f * 0.8, "px"),
|
|
835
|
+
height: "100%",
|
|
836
|
+
display: "flex",
|
|
837
|
+
alignItems: "center",
|
|
838
|
+
background: labelBg,
|
|
839
|
+
color: "#fff",
|
|
840
|
+
fontSize: "1em",
|
|
841
|
+
fontWeight: 900,
|
|
842
|
+
textTransform: "uppercase",
|
|
843
|
+
letterSpacing: "0.05em",
|
|
844
|
+
flexShrink: 0
|
|
845
|
+
},
|
|
846
|
+
children: label
|
|
847
|
+
}),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
849
|
+
style: {
|
|
850
|
+
flex: 1,
|
|
851
|
+
padding: "0 ".concat(f * 1, "px"),
|
|
852
|
+
minWidth: 0
|
|
853
|
+
},
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
856
|
+
style: {
|
|
857
|
+
fontSize: "1.3em",
|
|
858
|
+
fontWeight: 700,
|
|
859
|
+
overflow: "hidden",
|
|
860
|
+
textOverflow: "ellipsis",
|
|
861
|
+
whiteSpace: "nowrap"
|
|
862
|
+
},
|
|
863
|
+
children: cfg.headline
|
|
864
|
+
}),
|
|
865
|
+
cfg.body && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
866
|
+
style: {
|
|
867
|
+
fontSize: "0.9em",
|
|
868
|
+
opacity: 0.7,
|
|
869
|
+
overflow: "hidden",
|
|
870
|
+
textOverflow: "ellipsis",
|
|
871
|
+
whiteSpace: "nowrap"
|
|
872
|
+
},
|
|
873
|
+
children: cfg.body
|
|
874
|
+
})
|
|
875
|
+
]
|
|
876
|
+
})
|
|
877
|
+
]
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
function CountdownOverlay(param) {
|
|
881
|
+
var overlay = param.overlay, size = param.size;
|
|
882
|
+
var cfg = parseConfig(overlay.content);
|
|
883
|
+
var _ref = _sliced_to_array((0, import_react.useState)({
|
|
884
|
+
d: 0,
|
|
885
|
+
h: 0,
|
|
886
|
+
m: 0,
|
|
887
|
+
s: 0
|
|
888
|
+
}), 2), remaining = _ref[0], setRemaining = _ref[1];
|
|
889
|
+
(0, import_react.useEffect)(function() {
|
|
890
|
+
if (!cfg) return;
|
|
891
|
+
var update = function update() {
|
|
892
|
+
var target = new Date(cfg.targetTime).getTime();
|
|
893
|
+
var now = Date.now();
|
|
894
|
+
var diff = Math.max(0, target - now);
|
|
895
|
+
setRemaining({
|
|
896
|
+
d: Math.floor(diff / 864e5),
|
|
897
|
+
h: Math.floor(diff % 864e5 / 36e5),
|
|
898
|
+
m: Math.floor(diff % 36e5 / 6e4),
|
|
899
|
+
s: Math.floor(diff % 6e4 / 1e3)
|
|
900
|
+
});
|
|
901
|
+
};
|
|
902
|
+
update();
|
|
903
|
+
var id = setInterval(update, 1e3);
|
|
904
|
+
return function() {
|
|
905
|
+
return clearInterval(id);
|
|
906
|
+
};
|
|
907
|
+
}, [
|
|
908
|
+
cfg === null || cfg === void 0 ? void 0 : cfg.targetTime
|
|
909
|
+
]);
|
|
910
|
+
if (!cfg) return null;
|
|
911
|
+
var f = Math.max(6, size.w * 0.055);
|
|
912
|
+
var pad = function pad(n) {
|
|
913
|
+
return String(n).padStart(2, "0");
|
|
914
|
+
};
|
|
915
|
+
var units = [
|
|
916
|
+
{
|
|
917
|
+
show: cfg.showDays,
|
|
918
|
+
value: pad(remaining.d),
|
|
919
|
+
label: "DAYS"
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
show: cfg.showHours,
|
|
923
|
+
value: pad(remaining.h),
|
|
924
|
+
label: "HRS"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
show: cfg.showMinutes,
|
|
928
|
+
value: pad(remaining.m),
|
|
929
|
+
label: "MIN"
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
show: cfg.showSeconds,
|
|
933
|
+
value: pad(remaining.s),
|
|
934
|
+
label: "SEC"
|
|
935
|
+
}
|
|
936
|
+
];
|
|
937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
938
|
+
style: {
|
|
939
|
+
width: "100%",
|
|
940
|
+
height: "100%",
|
|
941
|
+
borderRadius: Math.max(2, size.w * 0.035),
|
|
942
|
+
display: "flex",
|
|
943
|
+
flexDirection: "column",
|
|
944
|
+
alignItems: "center",
|
|
945
|
+
justifyContent: "center",
|
|
946
|
+
padding: f * 0.8,
|
|
947
|
+
background: cfg.backgroundColor,
|
|
948
|
+
color: cfg.textColor,
|
|
949
|
+
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
950
|
+
boxSizing: "border-box",
|
|
951
|
+
pointerEvents: "none",
|
|
952
|
+
userSelect: "none",
|
|
953
|
+
fontSize: "".concat(f, "px")
|
|
954
|
+
},
|
|
955
|
+
children: [
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
957
|
+
style: {
|
|
958
|
+
fontSize: "0.8em",
|
|
959
|
+
fontWeight: 600,
|
|
960
|
+
textTransform: "uppercase",
|
|
961
|
+
letterSpacing: "0.05em",
|
|
962
|
+
color: cfg.accentColor,
|
|
963
|
+
marginBottom: f * 0.4
|
|
964
|
+
},
|
|
965
|
+
children: cfg.eventName
|
|
966
|
+
}),
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
968
|
+
style: {
|
|
969
|
+
display: "flex",
|
|
970
|
+
gap: f * 0.6,
|
|
971
|
+
alignItems: "center"
|
|
972
|
+
},
|
|
973
|
+
children: units.filter(function(u) {
|
|
974
|
+
return u.show;
|
|
975
|
+
}).map(function(u, i, arr) {
|
|
976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, {
|
|
977
|
+
children: [
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
979
|
+
style: {
|
|
980
|
+
textAlign: "center"
|
|
981
|
+
},
|
|
982
|
+
children: [
|
|
983
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
984
|
+
style: {
|
|
985
|
+
fontSize: "2em",
|
|
986
|
+
fontWeight: 900,
|
|
987
|
+
lineHeight: 1,
|
|
988
|
+
borderRadius: Math.max(2, f * 0.4),
|
|
989
|
+
padding: "".concat(f * 0.2, "px ").concat(f * 0.4, "px"),
|
|
990
|
+
background: "".concat(cfg.accentColor, "20")
|
|
991
|
+
},
|
|
992
|
+
children: u.value
|
|
993
|
+
}),
|
|
994
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
995
|
+
style: {
|
|
996
|
+
fontSize: "0.5em",
|
|
997
|
+
opacity: 0.5,
|
|
998
|
+
marginTop: f * 0.2
|
|
999
|
+
},
|
|
1000
|
+
children: u.label
|
|
1001
|
+
})
|
|
1002
|
+
]
|
|
1003
|
+
}),
|
|
1004
|
+
i < arr.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1005
|
+
style: {
|
|
1006
|
+
fontSize: "1.8em",
|
|
1007
|
+
fontWeight: 700,
|
|
1008
|
+
opacity: 0.3
|
|
1009
|
+
},
|
|
1010
|
+
children: ":"
|
|
1011
|
+
})
|
|
1012
|
+
]
|
|
1013
|
+
}, u.label);
|
|
1014
|
+
})
|
|
1015
|
+
}),
|
|
1016
|
+
cfg.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1017
|
+
style: {
|
|
1018
|
+
fontSize: "0.8em",
|
|
1019
|
+
opacity: 0.6,
|
|
1020
|
+
marginTop: f * 0.4,
|
|
1021
|
+
textAlign: "center"
|
|
1022
|
+
},
|
|
1023
|
+
children: cfg.message
|
|
1024
|
+
})
|
|
1025
|
+
]
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
function ShapeOverlay(param) {
|
|
1029
|
+
var overlay = param.overlay, size = param.size;
|
|
1030
|
+
var f = Math.max(6, size.w * 0.05);
|
|
1031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1032
|
+
style: {
|
|
1033
|
+
width: "100%",
|
|
1034
|
+
height: "100%",
|
|
1035
|
+
borderRadius: Math.max(2, size.w * 0.03),
|
|
1036
|
+
background: "rgba(99, 102, 241, 0.2)",
|
|
1037
|
+
border: "2px solid rgba(99, 102, 241, 0.4)",
|
|
1038
|
+
display: "flex",
|
|
1039
|
+
alignItems: "center",
|
|
1040
|
+
justifyContent: "center",
|
|
1041
|
+
pointerEvents: "none",
|
|
1042
|
+
userSelect: "none"
|
|
1043
|
+
},
|
|
1044
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1045
|
+
style: {
|
|
1046
|
+
fontSize: "".concat(f, "px"),
|
|
1047
|
+
fontWeight: 500,
|
|
1048
|
+
color: "rgba(163, 163, 163, 0.8)",
|
|
1049
|
+
textTransform: "uppercase"
|
|
1050
|
+
},
|
|
1051
|
+
children: overlay.name
|
|
1052
|
+
})
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
function hexToRgb(hex) {
|
|
1056
|
+
if (!hex || !hex.startsWith("#")) return "0,0,0";
|
|
1057
|
+
var clean = hex.slice(1);
|
|
1058
|
+
var num = parseInt(clean.length === 3 ? clean.replace(/./g, "$&$&") : clean, 16);
|
|
1059
|
+
return "".concat(num >> 16 & 255, ",").concat(num >> 8 & 255, ",").concat(num & 255);
|
|
1060
|
+
}
|
|
1061
|
+
var OverlayRenderer = function OverlayRenderer(param) {
|
|
1062
|
+
var overlays = param.overlays, currentTime = param.currentTime, videoRef = param.videoRef, coordinateSpace = param.coordinateSpace;
|
|
1063
|
+
var _ref = _sliced_to_array((0, import_react.useState)(null), 2), dims = _ref[0], setDims = _ref[1];
|
|
1064
|
+
var rafRef = (0, import_react.useRef)(null);
|
|
1065
|
+
var updateDims = (0, import_react.useCallback)(function() {
|
|
1066
|
+
var video = videoRef.current;
|
|
1067
|
+
if (video) {
|
|
1068
|
+
var computed = computeVideoDimensions(video);
|
|
1069
|
+
setDims(function(prev) {
|
|
1070
|
+
if (!computed || prev && prev.nativeWidth === computed.nativeWidth && prev.nativeHeight === computed.nativeHeight && prev.displayWidth === computed.displayWidth && prev.displayHeight === computed.displayHeight && prev.offsetX === computed.offsetX && prev.offsetY === computed.offsetY) {
|
|
1071
|
+
return prev;
|
|
1072
|
+
}
|
|
1073
|
+
return computed;
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
}, [
|
|
1077
|
+
videoRef
|
|
1078
|
+
]);
|
|
1079
|
+
(0, import_react.useEffect)(function() {
|
|
1080
|
+
updateDims();
|
|
1081
|
+
var interval = setInterval(updateDims, 500);
|
|
1082
|
+
var handleResize = function handleResize() {
|
|
1083
|
+
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
1084
|
+
rafRef.current = requestAnimationFrame(updateDims);
|
|
1085
|
+
};
|
|
1086
|
+
window.addEventListener("resize", handleResize);
|
|
1087
|
+
return function() {
|
|
1088
|
+
clearInterval(interval);
|
|
1089
|
+
window.removeEventListener("resize", handleResize);
|
|
1090
|
+
if (rafRef.current) cancelAnimationFrame(rafRef.current);
|
|
1091
|
+
};
|
|
1092
|
+
}, [
|
|
1093
|
+
updateDims
|
|
1094
|
+
]);
|
|
1095
|
+
var activeOverlays = overlays.filter(function(o) {
|
|
1096
|
+
return isOverlayActive(o, currentTime);
|
|
1097
|
+
});
|
|
1098
|
+
if (!dims || activeOverlays.length === 0) return null;
|
|
1099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1100
|
+
"aria-hidden": "true",
|
|
1101
|
+
style: {
|
|
1102
|
+
position: "absolute",
|
|
1103
|
+
left: "".concat(dims.offsetX, "px"),
|
|
1104
|
+
top: "".concat(dims.offsetY, "px"),
|
|
1105
|
+
width: "".concat(dims.displayWidth, "px"),
|
|
1106
|
+
height: "".concat(dims.displayHeight, "px"),
|
|
1107
|
+
pointerEvents: "none",
|
|
1108
|
+
overflow: "hidden",
|
|
1109
|
+
zIndex: 8
|
|
1110
|
+
},
|
|
1111
|
+
children: activeOverlays.map(function(overlay) {
|
|
1112
|
+
var scaleX = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.width) ? dims.displayWidth / coordinateSpace.width : dims.scaleX;
|
|
1113
|
+
var scaleY = (coordinateSpace === null || coordinateSpace === void 0 ? void 0 : coordinateSpace.height) ? dims.displayHeight / coordinateSpace.height : dims.scaleY;
|
|
1114
|
+
var left = overlay.x * scaleX;
|
|
1115
|
+
var top = overlay.y * scaleY;
|
|
1116
|
+
var width = overlay.width * scaleX;
|
|
1117
|
+
var height = overlay.height * scaleY;
|
|
1118
|
+
var opacity = Math.max(0, Math.min(100, overlay.opacity)) / 100;
|
|
1119
|
+
var sz = {
|
|
1120
|
+
w: width,
|
|
1121
|
+
h: height
|
|
1122
|
+
};
|
|
1123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1124
|
+
style: {
|
|
1125
|
+
position: "absolute",
|
|
1126
|
+
left: "".concat(left, "px"),
|
|
1127
|
+
top: "".concat(top, "px"),
|
|
1128
|
+
width: "".concat(width, "px"),
|
|
1129
|
+
height: "".concat(height, "px"),
|
|
1130
|
+
opacity: opacity,
|
|
1131
|
+
zIndex: overlay.z_index,
|
|
1132
|
+
overflow: "hidden"
|
|
1133
|
+
},
|
|
1134
|
+
children: [
|
|
1135
|
+
overlay.type === "image" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageOverlay, {
|
|
1136
|
+
overlay: overlay
|
|
1137
|
+
}),
|
|
1138
|
+
overlay.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextOverlay, {
|
|
1139
|
+
overlay: overlay
|
|
1140
|
+
}),
|
|
1141
|
+
overlay.type === "scroller" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollerOverlay, {
|
|
1142
|
+
overlay: overlay
|
|
1143
|
+
}),
|
|
1144
|
+
overlay.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShapeOverlay, {
|
|
1145
|
+
overlay: overlay,
|
|
1146
|
+
size: sz
|
|
1147
|
+
}),
|
|
1148
|
+
overlay.type === "score_bug" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScoreBugOverlay, {
|
|
1149
|
+
overlay: overlay,
|
|
1150
|
+
size: sz
|
|
1151
|
+
}),
|
|
1152
|
+
overlay.type === "lower_third" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LowerThirdOverlay, {
|
|
1153
|
+
overlay: overlay,
|
|
1154
|
+
size: sz
|
|
1155
|
+
}),
|
|
1156
|
+
overlay.type === "qr_code" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QrCodeOverlay, {
|
|
1157
|
+
overlay: overlay,
|
|
1158
|
+
size: sz
|
|
1159
|
+
}),
|
|
1160
|
+
overlay.type === "coming_up_next" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComingUpNextOverlay, {
|
|
1161
|
+
overlay: overlay,
|
|
1162
|
+
size: sz
|
|
1163
|
+
}),
|
|
1164
|
+
overlay.type === "contextual_trigger" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextualTriggerOverlay, {
|
|
1165
|
+
overlay: overlay,
|
|
1166
|
+
size: sz
|
|
1167
|
+
}),
|
|
1168
|
+
overlay.type === "odds_betting" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OddsBettingOverlay, {
|
|
1169
|
+
overlay: overlay,
|
|
1170
|
+
size: sz
|
|
1171
|
+
}),
|
|
1172
|
+
overlay.type === "breaking_news" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreakingNewsOverlay, {
|
|
1173
|
+
overlay: overlay,
|
|
1174
|
+
size: sz
|
|
1175
|
+
}),
|
|
1176
|
+
overlay.type === "countdown" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountdownOverlay, {
|
|
1177
|
+
overlay: overlay,
|
|
1178
|
+
size: sz
|
|
1179
|
+
})
|
|
1180
|
+
]
|
|
1181
|
+
}, overlay.id);
|
|
1182
|
+
})
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1185
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1186
|
+
0 && (module.exports = {
|
|
1187
|
+
OverlayRenderer: OverlayRenderer
|
|
1188
|
+
});
|
|
1189
|
+
//# sourceMappingURL=OverlayRenderer.cjs.map
|