var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var utils_exports = {}; __export(utils_exports, { camelCase: () => camelCase, capitalize: () => capitalize, constToCamel: () => constToCamel, dashedToCamel: () => dashedToCamel, delay: () => delay, isNumericString: () => isNumericString, isValidNumber: () => isValidNumber, parseAudioTrack: () => parseAudioTrack, parseAudioTrackList: () => parseAudioTrackList, parseRendition: () => parseRendition, parseRenditionList: () => parseRenditionList, stringifyAudioTrack: () => stringifyAudioTrack, stringifyAudioTrackList: () => stringifyAudioTrackList, stringifyRendition: () => stringifyRendition, stringifyRenditionList: () => stringifyRenditionList }); module.exports = __toCommonJS(utils_exports); function stringifyRenditionList(renditions) { return renditions == null ? void 0 : renditions.map(stringifyRendition).join(" "); } function parseRenditionList(renditions) { return renditions == null ? void 0 : renditions.split(/\s+/).map(parseRendition); } function stringifyRendition(rendition) { if (rendition) { const { id, width, height } = rendition; return [id, width, height].filter((a) => a != null).join(":"); } } function parseRendition(rendition) { if (rendition) { const [id, width, height] = rendition.split(":"); return { id, width: +width, height: +height }; } } function stringifyAudioTrackList(audioTracks) { return audioTracks == null ? void 0 : audioTracks.map(stringifyAudioTrack).join(" "); } function parseAudioTrackList(audioTracks) { return audioTracks == null ? void 0 : audioTracks.split(/\s+/).map(parseAudioTrack); } function stringifyAudioTrack(audioTrack) { if (audioTrack) { const { id, kind, language, label } = audioTrack; return [id, kind, language, label].filter((a) => a != null).join(":"); } } function parseAudioTrack(audioTrack) { if (audioTrack) { const [id, kind, language, label] = audioTrack.split(":"); return { id, kind, language, label }; } } function dashedToCamel(word) { return word.split("-").map(function(x, i) { return (i ? x[0].toUpperCase() : x[0].toLowerCase()) + x.slice(1).toLowerCase(); }).join(""); } function constToCamel(word, upperFirst = false) { return word.split("_").map(function(x, i) { return (i || upperFirst ? x[0].toUpperCase() : x[0].toLowerCase()) + x.slice(1).toLowerCase(); }).join(""); } function camelCase(name) { return name.replace(/[-_]([a-z])/g, ($0, $1) => $1.toUpperCase()); } function isValidNumber(x) { return typeof x === "number" && !Number.isNaN(x) && Number.isFinite(x); } function isNumericString(str) { if (typeof str != "string") return false; return !isNaN(str) && !isNaN(parseFloat(str)); } const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); const capitalize = (str) => str && str[0].toUpperCase() + str.slice(1);