| |
| export const MAX_SCRIPT_CHARS = 500; |
| export const MIN_SCRIPT_CHARS = 380; |
| export const TARGET_SECONDS = "25-30"; |
| export const MIN_VIDEO_SECONDS = 25; |
|
|
| export function enforceScriptLimit(script: string): string { |
| const cleaned = script.trim().replace(/\s+/g, " "); |
| if (cleaned.length <= MAX_SCRIPT_CHARS) return cleaned; |
|
|
| const truncated = cleaned.slice(0, MAX_SCRIPT_CHARS); |
| const lastSpace = truncated.lastIndexOf(" "); |
| if (lastSpace > MAX_SCRIPT_CHARS * 0.6) { |
| return truncated.slice(0, lastSpace).trim(); |
| } |
| return truncated.trim(); |
| } |
|
|