Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

727 B
Raw Blame
import type { CaptionDisplayWord } from "@hypit/caption";

type Surface = Pick<CaptionDisplayWord, "text" | "separatorBefore">;

/** The first displayed word starts a line; all other gaps come from authored content. */
export function wordGaps(words: readonly Surface[]): readonly boolean[] {
  return words.map((word, index) => index > 0 && word.separatorBefore === " ");
}

/** A uniform run can use column-gap; a mixed run requires individual separators. */
export function uniformGap(gaps: readonly boolean[]): boolean | undefined {
  const boundaries = gaps.slice(1);
  if (boundaries.length === 0) return false;
  if (boundaries.every(gap => gap)) return true;
  return boundaries.some(gap => gap) ? undefined : false;
}