"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCliOptions = exports.getAndValidateAbsoluteOutputFile = void 0; const renderer_1 = require("@remotion/renderer"); const node_fs_1 = __importDefault(require("node:fs")); const node_path_1 = __importDefault(require("node:path")); const config_1 = require("./config"); const get_env_1 = require("./get-env"); const get_input_props_1 = require("./get-input-props"); const log_1 = require("./log"); const getAndValidateFrameRange = (logLevel, indent) => { const frameRange = config_1.ConfigInternals.getRange(); if (typeof frameRange === 'number') { log_1.Log.warn({ logLevel, indent }, 'Selected a single frame. Assuming you want to output an image.'); log_1.Log.warn({ logLevel, indent }, `If you want to render a video, pass a range: '--frames=${frameRange}-${frameRange}'.`); log_1.Log.warn({ indent, logLevel }, "To dismiss this message, add the '--sequence' flag explicitly."); } return frameRange; }; const getAndValidateAbsoluteOutputFile = (relativeOutputLocation, overwrite, logLevel) => { const absoluteOutputFile = node_path_1.default.resolve(process.cwd(), relativeOutputLocation); if (node_fs_1.default.existsSync(absoluteOutputFile) && !overwrite) { log_1.Log.error({ indent: false, logLevel }, `File at ${absoluteOutputFile} already exists. Use --overwrite to overwrite.`); process.exit(1); } return absoluteOutputFile; }; exports.getAndValidateAbsoluteOutputFile = getAndValidateAbsoluteOutputFile; const getProResProfile = () => { const proResProfile = config_1.ConfigInternals.getProResProfile(); return proResProfile; }; const getCliOptions = (options) => { const frameRange = getAndValidateFrameRange(options.logLevel, false); const shouldOutputImageSequence = options.isStill ? true : config_1.ConfigInternals.getShouldOutputImageSequence(frameRange); const pixelFormat = config_1.ConfigInternals.getPixelFormat(); const proResProfile = getProResProfile(); const browserExecutable = config_1.ConfigInternals.getBrowserExecutable(); const disableWebSecurity = config_1.ConfigInternals.getChromiumDisableWebSecurity(); const ignoreCertificateErrors = config_1.ConfigInternals.getIgnoreCertificateErrors(); const userAgent = config_1.ConfigInternals.getChromiumUserAgent(); const everyNthFrame = config_1.ConfigInternals.getEveryNthFrame(); const concurrency = config_1.ConfigInternals.getConcurrency(); const height = config_1.ConfigInternals.getHeight(); const width = config_1.ConfigInternals.getWidth(); renderer_1.RenderInternals.validateConcurrency({ value: concurrency, setting: 'concurrency', checkIfValidForCurrentMachine: false, }); return { concurrency, frameRange, shouldOutputImageSequence, inputProps: (0, get_input_props_1.getInputProps)(null, options.logLevel), envVariables: (0, get_env_1.getEnvironmentVariables)(null, options.logLevel, options.indent), pixelFormat, proResProfile, everyNthFrame, stillFrame: config_1.ConfigInternals.getStillFrame(), browserExecutable, userAgent, disableWebSecurity, ignoreCertificateErrors, ffmpegOverride: config_1.ConfigInternals.getFfmpegOverrideFunction(), height, width, configFileImageFormat: config_1.ConfigInternals.getUserPreferredVideoImageFormat(), }; }; exports.getCliOptions = getCliOptions;