@mux/ai 0.55.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-B-rLy1do.js';
2
- export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-DxSHvTk9.js';
1
+ export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, T as ThumbnailOptions, V as VTTCueBudgetChunkingOptions, b as VTTDurationChunk, c as VTTDurationChunkingOptions, d as chunkByTokens, e as chunkText, f as chunkVTTCues, g as chunkVTTCuesByBudget, h as chunkVTTCuesByDuration, j as estimateTokenCount, k as getHeatmapForAsset, l as getHeatmapForPlaybackId, m as getHeatmapForVideo, n as getStoryboardUrl, o as getThumbnailUrls } from '../index-DiuqBw6I.js';
2
+ export { r as CompletedShotsResult, D as DeletedShotsResult, s as ErroredShotsResult, H as Hotspot, t as HotspotOptions, u as HotspotResponse, L as LOW_CONFIDENCE_THRESHOLD, v as MAX_CUE_TEXT_CHARS, w as ParseVTTCuesOptions, x as PendingShotsResult, y as Shot, z as ShotRequestOptions, B as ShotsResult, F as SkippedShotsResult, G as TranscriptEmptyReason, J as TranscriptFetchOptions, K as TranscriptFetchStepResult, N as TranscriptResult, q as VTTCue, O as WaitForShotsOptions, Q as buildTranscriptUrl, R as buildVttFromCueBlocks, X as buildVttFromTranslatedCueBlocks, Y as concatenateVttSegments, Z as extractTextFromVTT, _ as extractTimestampedTranscript, $ as fetchTranscriptDataForUrl, a0 as fetchTranscriptForAsset, a1 as filterVttByScope, a2 as findCaptionTrack, a3 as getHotspotsForAsset, a4 as getHotspotsForPlaybackId, a5 as getHotspotsForVideo, a6 as getReadyTextTracks, a7 as getReliableLanguageCode, a8 as getShotsForAsset, a9 as parseVTTCues, aa as replaceCueText, ab as requestShotsForAsset, ac as sanitizeUntrustedText, ad as secondsToTimestamp, ae as splitVttPreambleAndCueBlocks, af as stripVttMetadataBlocks, ag as vttTimestampToSeconds, ah as waitForShotsForAsset } from '../transcripts-Brw74qlV.js';
3
3
  import '@mux/ts';
@@ -1710,8 +1710,38 @@ var ISO639_1_TO_3 = {
1710
1710
  // Estonian
1711
1711
  lv: "lav",
1712
1712
  // Latvian
1713
- lt: "lit"
1713
+ lt: "lit",
1714
1714
  // Lithuanian
1715
+ as: "asm",
1716
+ az: "aze",
1717
+ be: "bel",
1718
+ bs: "bos",
1719
+ cy: "cym",
1720
+ ga: "gle",
1721
+ ha: "hau",
1722
+ hy: "hye",
1723
+ jv: "jav",
1724
+ ka: "kat",
1725
+ kk: "kaz",
1726
+ ky: "kir",
1727
+ lb: "ltz",
1728
+ ln: "lin",
1729
+ mi: "mri",
1730
+ mk: "mkd",
1731
+ mn: "mon",
1732
+ mt: "mlt",
1733
+ my: "mya",
1734
+ ne: "nep",
1735
+ ny: "nya",
1736
+ oc: "oci",
1737
+ or: "ori",
1738
+ ps: "pus",
1739
+ sd: "snd",
1740
+ so: "som",
1741
+ sr: "srp",
1742
+ tg: "tgk",
1743
+ uz: "uzb",
1744
+ yo: "yor"
1715
1745
  };
1716
1746
  var ISO639_3_TO_1 = Object.fromEntries(
1717
1747
  Object.entries(ISO639_1_TO_3).map(([iso1, iso3]) => [iso3, iso1])
@@ -1903,14 +1933,13 @@ function extractTextFromVTT(vttContent) {
1903
1933
  textLines.join(" ").replace(/\s+/g, " ").trim()
1904
1934
  );
1905
1935
  }
1936
+ var VTT_TIMESTAMP_RE = /^(?:(\d+):)?(\d{2}):(\d{2})(?:\.(\d{3}))?$/;
1906
1937
  function vttTimestampToSeconds(timestamp) {
1907
- const parts = timestamp.split(":");
1908
- if (parts.length !== 3)
1909
- return 0;
1910
- const hours = Number.parseInt(parts[0], 10) || 0;
1911
- const minutes = Number.parseInt(parts[1], 10) || 0;
1912
- const seconds = Number.parseFloat(parts[2]) || 0;
1913
- return hours * 3600 + minutes * 60 + seconds;
1938
+ const match = VTT_TIMESTAMP_RE.exec(timestamp);
1939
+ if (!match)
1940
+ return void 0;
1941
+ const [, hours = "0", minutes, seconds, millis = "0"] = match;
1942
+ return Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds) + Number(millis) / 1e3;
1914
1943
  }
1915
1944
  function secondsToTimestamp(seconds) {
1916
1945
  const rounded = Math.max(0, Math.floor(seconds));
@@ -1933,6 +1962,8 @@ function extractTimestampedTranscript(vttContent) {
1933
1962
  if (line.includes("-->")) {
1934
1963
  const startTime = line.split(" --> ")[0].trim();
1935
1964
  const timeInSeconds = vttTimestampToSeconds(startTime);
1965
+ if (timeInSeconds === void 0)
1966
+ continue;
1936
1967
  let j = i + 1;
1937
1968
  while (j < lines.length && !lines[j].trim()) {
1938
1969
  j++;
@@ -1961,13 +1992,17 @@ function parseVTTCues(vttContent, options = {}) {
1961
1992
  if (isTimingLine(line)) {
1962
1993
  const [startStr, endStr] = line.split(" --> ").map((s) => s.trim());
1963
1994
  const startTime = vttTimestampToSeconds(startStr);
1964
- const endTime = vttTimestampToSeconds(endStr.split(" ")[0]);
1995
+ const endTime = vttTimestampToSeconds(endStr?.split(/\s+/)[0] ?? "");
1965
1996
  const currentCueIdentifierLine = lines[i - 1]?.trim() ?? "";
1966
1997
  const currentCueIdentifier = isLikelyCueIdentifier({
1967
1998
  line: currentCueIdentifierLine,
1968
1999
  nextLine: line,
1969
2000
  previousCueIdentifier
1970
2001
  }) ? parseNumericCueIdentifier(currentCueIdentifierLine) : null;
2002
+ if (startTime === void 0 || endTime === void 0) {
2003
+ previousCueIdentifier = currentCueIdentifier;
2004
+ continue;
2005
+ }
1971
2006
  const rawTextLines = [];
1972
2007
  let j = i + 1;
1973
2008
  while (j < lines.length && lines[j].trim() && !isTimingLine(lines[j].trim())) {