| ; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.resetElementLibraries = exports.getElementLibraries = exports.addElementLibrary = void 0; | |
| const studio_shared_1 = require("@remotion/studio-shared"); | |
| let elementLibraries = []; | |
| const addElementLibrary = (options) => { | |
| var _a; | |
| if (typeof options !== 'object' || | |
| options === null || | |
| Array.isArray(options)) { | |
| const receivedType = Array.isArray(options) ? 'an array' : typeof options; | |
| throw new Error(`Config.addElementLibrary() expects an object, got ${receivedType}`); | |
| } | |
| const { url, displayName, captionStylesUrl } = options; | |
| if (typeof url !== 'string') { | |
| throw new Error(`Config.addElementLibrary() expects "url" to be a string, got ${typeof url}`); | |
| } | |
| let parsedUrl; | |
| try { | |
| parsedUrl = new URL(url); | |
| } | |
| catch (_b) { | |
| throw new Error(`Config.addElementLibrary() expects an absolute URL, got ${JSON.stringify(url)}`); | |
| } | |
| if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') { | |
| throw new Error(`Config.addElementLibrary() only supports HTTP and HTTPS URLs, got ${JSON.stringify(url)}`); | |
| } | |
| const normalizedCaptionStylesUrl = captionStylesUrl === undefined ? null : (0, studio_shared_1.normalizeHttpUrl)(captionStylesUrl); | |
| if (captionStylesUrl !== undefined && normalizedCaptionStylesUrl === null) { | |
| throw new Error('Config.addElementLibrary() expects "captionStylesUrl" to be an absolute HTTP or HTTPS URL'); | |
| } | |
| if (displayName !== undefined && typeof displayName !== 'string') { | |
| throw new Error(`Config.addElementLibrary() expects the display name to be a string, got ${typeof displayName}`); | |
| } | |
| const trimmedDisplayName = (_a = displayName === null || displayName === void 0 ? void 0 : displayName.trim()) !== null && _a !== void 0 ? _a : null; | |
| if (trimmedDisplayName === '') { | |
| throw new Error('Config.addElementLibrary() expects the display name to not be empty'); | |
| } | |
| elementLibraries.push({ | |
| displayName: trimmedDisplayName, | |
| url: parsedUrl.href, | |
| captionStylesUrl: normalizedCaptionStylesUrl, | |
| }); | |
| }; | |
| exports.addElementLibrary = addElementLibrary; | |
| const getElementLibraries = () => elementLibraries; | |
| exports.getElementLibraries = getElementLibraries; | |
| const resetElementLibraries = () => { | |
| elementLibraries = []; | |
| }; | |
| exports.resetElementLibraries = resetElementLibraries; | |
Xet Storage Details
- Size:
- 2.47 kB
- Xet hash:
- 5238769293e62b30d7ed644f398c6c597394fb61a47e7294329330d204af21ff
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.