hyperframes 0.7.80 → 0.7.81
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.
- package/dist/cli.js +213 -63
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/studio/assets/{hyperframes-player-Csai0_vh.js → hyperframes-player-B32VouCm.js} +1 -1
- package/dist/studio/assets/{index-BhdJN49y.js → index-B5u2_pSh.js} +3 -3
- package/dist/studio/assets/{index-By-YiRxq.js → index-DCTAKfpa.js} +1 -1
- package/dist/studio/assets/{index-B5aYTg-4.js → index-HeUw0EKI.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.7.
|
|
53
|
+
VERSION = true ? "0.7.81" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -114529,7 +114529,9 @@ __export(deterministicFonts_exports, {
|
|
|
114529
114529
|
FONT_ALIASES: () => FONT_ALIASES,
|
|
114530
114530
|
FONT_ALIAS_KEYS: () => FONT_ALIAS_KEYS,
|
|
114531
114531
|
FONT_FETCH_FAILED: () => FONT_FETCH_FAILED,
|
|
114532
|
+
FONT_FETCH_UNAVAILABLE: () => FONT_FETCH_UNAVAILABLE,
|
|
114532
114533
|
FontFetchError: () => FontFetchError,
|
|
114534
|
+
FontFetchUnavailableError: () => FontFetchUnavailableError,
|
|
114533
114535
|
GENERIC_FAMILIES: () => GENERIC_FAMILIES2,
|
|
114534
114536
|
collectFontFamilyCustomProperties: () => collectFontFamilyCustomProperties,
|
|
114535
114537
|
fontFormatHint: () => fontFormatHint,
|
|
@@ -114540,7 +114542,7 @@ __export(deterministicFonts_exports, {
|
|
|
114540
114542
|
resolveFontFamilyDeclarationFamilies: () => resolveFontFamilyDeclarationFamilies
|
|
114541
114543
|
});
|
|
114542
114544
|
import { createHash as createHash11 } from "crypto";
|
|
114543
|
-
import { existsSync as existsSync43, mkdirSync as mkdirSync19, readFileSync as readFileSync25, writeFileSync as writeFileSync16 } from "fs";
|
|
114545
|
+
import { existsSync as existsSync43, mkdirSync as mkdirSync19, mkdtempSync as mkdtempSync5, readFileSync as readFileSync25, writeFileSync as writeFileSync16 } from "fs";
|
|
114544
114546
|
import { homedir as homedir12, tmpdir as tmpdir6 } from "os";
|
|
114545
114547
|
import { join as join39 } from "path";
|
|
114546
114548
|
import postcss4 from "postcss";
|
|
@@ -114862,13 +114864,20 @@ function warnUnresolvedFonts(unresolved) {
|
|
|
114862
114864
|
);
|
|
114863
114865
|
}
|
|
114864
114866
|
function resolveFontCacheRoot() {
|
|
114865
|
-
|
|
114867
|
+
if (process.env.HYPERFRAMES_FONT_CACHE_DIR) {
|
|
114868
|
+
return process.env.HYPERFRAMES_FONT_CACHE_DIR;
|
|
114869
|
+
}
|
|
114870
|
+
if (process.env.AWS_LAMBDA_FUNCTION_NAME) {
|
|
114871
|
+
lambdaFontCacheRoot ??= mkdtempSync5(join39(tmpdir6(), "hyperframes-fonts-"));
|
|
114872
|
+
return lambdaFontCacheRoot;
|
|
114873
|
+
}
|
|
114874
|
+
return join39(homedir12(), ".cache", "hyperframes", "fonts");
|
|
114866
114875
|
}
|
|
114867
114876
|
function fontSlug(familyName) {
|
|
114868
114877
|
return familyName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
114869
114878
|
}
|
|
114870
114879
|
function fontCacheDir(slug) {
|
|
114871
|
-
const dir = join39(
|
|
114880
|
+
const dir = join39(resolveFontCacheRoot(), slug);
|
|
114872
114881
|
if (!existsSync43(dir)) {
|
|
114873
114882
|
mkdirSync19(dir, { recursive: true });
|
|
114874
114883
|
}
|
|
@@ -114880,10 +114889,100 @@ function subsetToken(woff2Url) {
|
|
|
114880
114889
|
function cachedWoff2Path(slug, weight, style, subset) {
|
|
114881
114890
|
return join39(fontCacheDir(slug), `${weight}-${style}-${subset}.woff2`);
|
|
114882
114891
|
}
|
|
114883
|
-
function fontFetchError(familyName, url, what, cause) {
|
|
114884
|
-
const reason = "status" in cause ? `returned HTTP ${cause.status}` : `failed: ${cause.error.message}`;
|
|
114892
|
+
function fontFetchError(familyName, url, what, cause, unavailable = false) {
|
|
114893
|
+
const reason = "status" in cause ? `returned HTTP ${cause.status}` : `failed: ${cause.error instanceof Error ? cause.error.message : String(cause.error)}`;
|
|
114885
114894
|
const message = `[deterministicFonts] ${what} fetch for ${JSON.stringify(familyName)} ${reason}. Distributed renders require deterministic fonts; system-font fallback would produce non-byte-identical output.`;
|
|
114886
|
-
|
|
114895
|
+
const errorCause = "error" in cause ? cause.error : void 0;
|
|
114896
|
+
return unavailable ? new FontFetchUnavailableError(familyName, url, message, errorCause) : new FontFetchError(familyName, url, message, errorCause);
|
|
114897
|
+
}
|
|
114898
|
+
function isRetryableFontFetchStatus(status) {
|
|
114899
|
+
return status === 408 || status === 425 || status === 429 || status >= 500;
|
|
114900
|
+
}
|
|
114901
|
+
function retryAfterMs(response) {
|
|
114902
|
+
const value = response.headers.get("retry-after");
|
|
114903
|
+
if (value === null) return null;
|
|
114904
|
+
const seconds = Number(value);
|
|
114905
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
114906
|
+
const date = Date.parse(value);
|
|
114907
|
+
return Number.isNaN(date) ? null : Math.max(0, date - Date.now());
|
|
114908
|
+
}
|
|
114909
|
+
function callerAbortReason(signal) {
|
|
114910
|
+
return signal.reason ?? new DOMException("Font fetch cancelled", "AbortError");
|
|
114911
|
+
}
|
|
114912
|
+
function throwIfCallerAborted(signal) {
|
|
114913
|
+
if (signal?.aborted) throw callerAbortReason(signal);
|
|
114914
|
+
}
|
|
114915
|
+
async function waitForFontFetchRetry(delayMs, signal) {
|
|
114916
|
+
throwIfCallerAborted(signal);
|
|
114917
|
+
if (delayMs <= 0) return;
|
|
114918
|
+
await new Promise((resolve77, reject) => {
|
|
114919
|
+
const timeout = setTimeout(() => {
|
|
114920
|
+
signal?.removeEventListener("abort", onAbort);
|
|
114921
|
+
resolve77();
|
|
114922
|
+
}, delayMs);
|
|
114923
|
+
const onAbort = () => {
|
|
114924
|
+
clearTimeout(timeout);
|
|
114925
|
+
reject(signal ? callerAbortReason(signal) : new DOMException("Cancelled", "AbortError"));
|
|
114926
|
+
};
|
|
114927
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
114928
|
+
if (signal?.aborted) onAbort();
|
|
114929
|
+
});
|
|
114930
|
+
}
|
|
114931
|
+
function retryDelayMs(response, attempt, baseDelayMs) {
|
|
114932
|
+
const requestedDelay = response ? retryAfterMs(response) : null;
|
|
114933
|
+
if (requestedDelay !== null) return requestedDelay;
|
|
114934
|
+
const ceiling = baseDelayMs * 2 ** attempt;
|
|
114935
|
+
return Math.floor(Math.random() * (ceiling + 1));
|
|
114936
|
+
}
|
|
114937
|
+
function cancelResponseBody2(response) {
|
|
114938
|
+
try {
|
|
114939
|
+
void response.body?.cancel().catch(() => {
|
|
114940
|
+
});
|
|
114941
|
+
} catch {
|
|
114942
|
+
}
|
|
114943
|
+
}
|
|
114944
|
+
async function runFontFetchAttempt(url, init, readBody, options, remainingMs) {
|
|
114945
|
+
const timeoutSignal = AbortSignal.timeout(
|
|
114946
|
+
Math.max(1, Math.min(options.retryPolicy.attemptTimeoutMs, remainingMs))
|
|
114947
|
+
);
|
|
114948
|
+
const signal = options.abortSignal ? AbortSignal.any([options.abortSignal, timeoutSignal]) : timeoutSignal;
|
|
114949
|
+
let response;
|
|
114950
|
+
try {
|
|
114951
|
+
response = await options.fetchImpl(url, { ...init, signal });
|
|
114952
|
+
if (!isRetryableFontFetchStatus(response.status)) {
|
|
114953
|
+
if (!response.ok) return { completed: true, result: { ok: false, response } };
|
|
114954
|
+
const body = await readBody(response);
|
|
114955
|
+
return { completed: true, result: { ok: true, response, body } };
|
|
114956
|
+
}
|
|
114957
|
+
cancelResponseBody2(response);
|
|
114958
|
+
return { completed: false, response, cause: { status: response.status } };
|
|
114959
|
+
} catch (error) {
|
|
114960
|
+
throwIfCallerAborted(options.abortSignal);
|
|
114961
|
+
return { completed: false, response, cause: { error } };
|
|
114962
|
+
}
|
|
114963
|
+
}
|
|
114964
|
+
async function fetchFontResource(url, init, readBody, familyName, what, options) {
|
|
114965
|
+
if (!options.failClosedFontFetch) {
|
|
114966
|
+
const response = await options.fetchImpl(url, { ...init, signal: options.abortSignal });
|
|
114967
|
+
if (!response.ok) return { ok: false, response };
|
|
114968
|
+
return { ok: true, response, body: await readBody(response) };
|
|
114969
|
+
}
|
|
114970
|
+
let lastCause = {
|
|
114971
|
+
error: new DOMException("Font fetch budget exhausted", "TimeoutError")
|
|
114972
|
+
};
|
|
114973
|
+
for (let attempt = 0; attempt < options.retryPolicy.maxAttempts; attempt += 1) {
|
|
114974
|
+
throwIfCallerAborted(options.abortSignal);
|
|
114975
|
+
const remainingMs = options.retryDeadlineMs - Date.now();
|
|
114976
|
+
if (remainingMs <= 0) break;
|
|
114977
|
+
const attemptResult = await runFontFetchAttempt(url, init, readBody, options, remainingMs);
|
|
114978
|
+
if (attemptResult.completed) return attemptResult.result;
|
|
114979
|
+
lastCause = attemptResult.cause;
|
|
114980
|
+
if (attempt + 1 >= options.retryPolicy.maxAttempts) break;
|
|
114981
|
+
const delayMs = retryDelayMs(attemptResult.response, attempt, options.retryPolicy.baseDelayMs);
|
|
114982
|
+
if (delayMs >= options.retryDeadlineMs - Date.now()) break;
|
|
114983
|
+
await waitForFontFetchRetry(delayMs, options.abortSignal);
|
|
114984
|
+
}
|
|
114985
|
+
throw fontFetchError(familyName, url, what, lastCause, true);
|
|
114887
114986
|
}
|
|
114888
114987
|
async function ensureWoff2DataUri(cachePath2, woff2Url, familyName, weight, style, options) {
|
|
114889
114988
|
try {
|
|
@@ -114892,15 +114991,18 @@ async function ensureWoff2DataUri(cachePath2, woff2Url, familyName, weight, styl
|
|
|
114892
114991
|
}
|
|
114893
114992
|
const woff2What = `Google Fonts woff2 (${weight}/${style})`;
|
|
114894
114993
|
try {
|
|
114895
|
-
const
|
|
114896
|
-
|
|
114897
|
-
|
|
114898
|
-
|
|
114899
|
-
|
|
114900
|
-
|
|
114901
|
-
|
|
114902
|
-
|
|
114994
|
+
const fontResult = await fetchFontResource(
|
|
114995
|
+
woff2Url,
|
|
114996
|
+
void 0,
|
|
114997
|
+
(response) => response.arrayBuffer(),
|
|
114998
|
+
familyName,
|
|
114999
|
+
woff2What,
|
|
115000
|
+
options
|
|
115001
|
+
);
|
|
115002
|
+
if (!fontResult.ok) return null;
|
|
115003
|
+
writeFileSync16(cachePath2, Buffer.from(fontResult.body), { flag: "wx", mode: 420 });
|
|
114903
115004
|
} catch (err) {
|
|
115005
|
+
throwIfCallerAborted(options.abortSignal);
|
|
114904
115006
|
if (err instanceof FontFetchError) throw err;
|
|
114905
115007
|
if (err.code === "EEXIST") {
|
|
114906
115008
|
} else if (options.failClosedFontFetch) {
|
|
@@ -114919,17 +115021,20 @@ async function fetchGoogleFont(familyName, options, fontText) {
|
|
|
114919
115021
|
const url = `https://fonts.googleapis.com/css2?family=${encodedFamily}:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,700${textParam}`;
|
|
114920
115022
|
let cssText;
|
|
114921
115023
|
try {
|
|
114922
|
-
const
|
|
114923
|
-
|
|
114924
|
-
|
|
114925
|
-
|
|
114926
|
-
|
|
114927
|
-
|
|
114928
|
-
|
|
115024
|
+
const cssResult = await fetchFontResource(
|
|
115025
|
+
url,
|
|
115026
|
+
{ headers: { "User-Agent": WOFF2_USER_AGENT } },
|
|
115027
|
+
(response) => response.text(),
|
|
115028
|
+
familyName,
|
|
115029
|
+
"Google Fonts CSS",
|
|
115030
|
+
options
|
|
115031
|
+
);
|
|
115032
|
+
if (!cssResult.ok) {
|
|
114929
115033
|
return [];
|
|
114930
115034
|
}
|
|
114931
|
-
cssText =
|
|
115035
|
+
cssText = cssResult.body;
|
|
114932
115036
|
} catch (err) {
|
|
115037
|
+
throwIfCallerAborted(options.abortSignal);
|
|
114933
115038
|
if (err instanceof FontFetchError) throw err;
|
|
114934
115039
|
if (options.failClosedFontFetch) {
|
|
114935
115040
|
throw fontFetchError(familyName, url, "Google Fonts CSS", { error: err });
|
|
@@ -114970,14 +115075,38 @@ function extractGoogleFontsText(html) {
|
|
|
114970
115075
|
);
|
|
114971
115076
|
return encodeURIComponent(uniqueCharacters).length <= GOOGLE_FONTS_TEXT_MAX_ENCODED_LENGTH ? uniqueCharacters : void 0;
|
|
114972
115077
|
}
|
|
115078
|
+
function resolveFontFetchRetryPolicy(configured) {
|
|
115079
|
+
return {
|
|
115080
|
+
maxAttempts: Math.max(
|
|
115081
|
+
1,
|
|
115082
|
+
Math.floor(configured?.maxAttempts ?? DEFAULT_FONT_FETCH_RETRY_POLICY.maxAttempts)
|
|
115083
|
+
),
|
|
115084
|
+
attemptTimeoutMs: Math.max(
|
|
115085
|
+
1,
|
|
115086
|
+
configured?.attemptTimeoutMs ?? DEFAULT_FONT_FETCH_RETRY_POLICY.attemptTimeoutMs
|
|
115087
|
+
),
|
|
115088
|
+
maxElapsedMs: Math.max(
|
|
115089
|
+
1,
|
|
115090
|
+
configured?.maxElapsedMs ?? DEFAULT_FONT_FETCH_RETRY_POLICY.maxElapsedMs
|
|
115091
|
+
),
|
|
115092
|
+
baseDelayMs: Math.max(
|
|
115093
|
+
0,
|
|
115094
|
+
configured?.baseDelayMs ?? DEFAULT_FONT_FETCH_RETRY_POLICY.baseDelayMs
|
|
115095
|
+
)
|
|
115096
|
+
};
|
|
115097
|
+
}
|
|
114973
115098
|
async function injectDeterministicFontFaces(html, options = {}) {
|
|
114974
115099
|
const failClosedFontFetch = options.failClosedFontFetch === true;
|
|
114975
115100
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
114976
115101
|
const allowSystemFontCapture = options.allowSystemFontCapture !== false;
|
|
115102
|
+
const retryPolicy = resolveFontFetchRetryPolicy(options.fontFetchRetryPolicy);
|
|
114977
115103
|
const fetchOptions = {
|
|
114978
115104
|
failClosedFontFetch,
|
|
114979
115105
|
fetchImpl,
|
|
114980
|
-
allowSystemFontCapture
|
|
115106
|
+
allowSystemFontCapture,
|
|
115107
|
+
abortSignal: options.abortSignal,
|
|
115108
|
+
retryPolicy,
|
|
115109
|
+
retryDeadlineMs: Date.now() + retryPolicy.maxElapsedMs
|
|
114981
115110
|
};
|
|
114982
115111
|
const existingFaces = extractExistingFontFaces(html);
|
|
114983
115112
|
const requestedFamilies = extractRequestedFontFamilies(html);
|
|
@@ -115025,7 +115154,7 @@ async function injectDeterministicFontFaces(html, options = {}) {
|
|
|
115025
115154
|
}
|
|
115026
115155
|
return document2.toString();
|
|
115027
115156
|
}
|
|
115028
|
-
var GENERIC_FAMILIES2, CANONICAL_FONTS, FONT_ALIASES,
|
|
115157
|
+
var GENERIC_FAMILIES2, CANONICAL_FONTS, FONT_ALIASES, lambdaFontCacheRoot, WOFF2_USER_AGENT, FONT_FETCH_FAILED, FONT_FETCH_UNAVAILABLE, FontFetchError, FontFetchUnavailableError, DEFAULT_FONT_FETCH_RETRY_POLICY, GOOGLE_FONTS_TEXT_MAX_ENCODED_LENGTH;
|
|
115029
115158
|
var init_deterministicFonts = __esm({
|
|
115030
115159
|
"../producer/src/services/deterministicFonts.ts"() {
|
|
115031
115160
|
"use strict";
|
|
@@ -115127,22 +115256,35 @@ var init_deterministicFonts = __esm({
|
|
|
115127
115256
|
}
|
|
115128
115257
|
};
|
|
115129
115258
|
FONT_ALIASES = FONT_ALIAS_MAP;
|
|
115130
|
-
GOOGLE_FONTS_CACHE_DIR = resolveFontCacheRoot();
|
|
115131
115259
|
WOFF2_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
|
|
115132
115260
|
FONT_FETCH_FAILED = "FONT_FETCH_FAILED";
|
|
115261
|
+
FONT_FETCH_UNAVAILABLE = "FONT_FETCH_UNAVAILABLE";
|
|
115133
115262
|
FontFetchError = class extends Error {
|
|
115134
|
-
code
|
|
115263
|
+
code;
|
|
115135
115264
|
familyName;
|
|
115136
115265
|
url;
|
|
115137
115266
|
cause;
|
|
115138
|
-
constructor(familyName, url, message, cause) {
|
|
115267
|
+
constructor(familyName, url, message, cause, code = FONT_FETCH_FAILED) {
|
|
115139
115268
|
super(message);
|
|
115140
115269
|
this.name = "FontFetchError";
|
|
115270
|
+
this.code = code;
|
|
115141
115271
|
this.familyName = familyName;
|
|
115142
115272
|
this.url = url;
|
|
115143
115273
|
this.cause = cause;
|
|
115144
115274
|
}
|
|
115145
115275
|
};
|
|
115276
|
+
FontFetchUnavailableError = class extends FontFetchError {
|
|
115277
|
+
constructor(familyName, url, message, cause) {
|
|
115278
|
+
super(familyName, url, message, cause, FONT_FETCH_UNAVAILABLE);
|
|
115279
|
+
this.name = "FontFetchUnavailableError";
|
|
115280
|
+
}
|
|
115281
|
+
};
|
|
115282
|
+
DEFAULT_FONT_FETCH_RETRY_POLICY = {
|
|
115283
|
+
maxAttempts: 2,
|
|
115284
|
+
attemptTimeoutMs: 8e3,
|
|
115285
|
+
maxElapsedMs: 2e4,
|
|
115286
|
+
baseDelayMs: 250
|
|
115287
|
+
};
|
|
115146
115288
|
GOOGLE_FONTS_TEXT_MAX_ENCODED_LENGTH = 1700;
|
|
115147
115289
|
}
|
|
115148
115290
|
});
|
|
@@ -116475,7 +116617,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
116475
116617
|
);
|
|
116476
116618
|
const coalescedHtml = await injectDeterministicFontFaces(normalizedFontHtml, {
|
|
116477
116619
|
failClosedFontFetch: options.failClosedFontFetch === true,
|
|
116478
|
-
allowSystemFontCapture: options.allowSystemFontCapture
|
|
116620
|
+
allowSystemFontCapture: options.allowSystemFontCapture,
|
|
116621
|
+
abortSignal: options.abortSignal
|
|
116479
116622
|
});
|
|
116480
116623
|
const assembledHtml = await inlineExternalScripts(coalescedHtml);
|
|
116481
116624
|
const HF_POSITION_ATTRS = [
|
|
@@ -116922,13 +117065,15 @@ async function runCompileStage(input2) {
|
|
|
116922
117065
|
log: log2,
|
|
116923
117066
|
assertNotAborted,
|
|
116924
117067
|
failClosedFontFetch,
|
|
116925
|
-
allowSystemFontCapture
|
|
117068
|
+
allowSystemFontCapture,
|
|
117069
|
+
abortSignal
|
|
116926
117070
|
} = input2;
|
|
116927
117071
|
const compileStart = Date.now();
|
|
116928
117072
|
const compiled = await compileForRender(projectDir, htmlPath, join43(workDir, "downloads"), {
|
|
116929
117073
|
log: log2,
|
|
116930
117074
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
116931
117075
|
allowSystemFontCapture,
|
|
117076
|
+
abortSignal,
|
|
116932
117077
|
variables: input2.variables,
|
|
116933
117078
|
animatedGifCacheDir: cfg.extractCacheDir ? join43(cfg.extractCacheDir, "animated-gif") : void 0,
|
|
116934
117079
|
ffmpegProcessTimeout: cfg.ffmpegProcessTimeout
|
|
@@ -119322,7 +119467,7 @@ import {
|
|
|
119322
119467
|
constants as constants3,
|
|
119323
119468
|
fstatSync as fstatSync4,
|
|
119324
119469
|
mkdirSync as mkdirSync23,
|
|
119325
|
-
mkdtempSync as
|
|
119470
|
+
mkdtempSync as mkdtempSync6,
|
|
119326
119471
|
openSync as openSync6,
|
|
119327
119472
|
readFileSync as readFileSync28,
|
|
119328
119473
|
statfsSync as statfsSync2
|
|
@@ -119458,7 +119603,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
119458
119603
|
const video = composition.videos.find((v2) => v2.id === videoId);
|
|
119459
119604
|
if (!video) continue;
|
|
119460
119605
|
mkdirSync23(framesDir, { recursive: true });
|
|
119461
|
-
const frameDir =
|
|
119606
|
+
const frameDir = mkdtempSync6(join49(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
119462
119607
|
const duration = video.end - video.start;
|
|
119463
119608
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
119464
119609
|
const rawPath = join49(frameDir, "frames.rgb48le");
|
|
@@ -121058,7 +121203,7 @@ var init_assembleStage = __esm({
|
|
|
121058
121203
|
import {
|
|
121059
121204
|
existsSync as existsSync50,
|
|
121060
121205
|
mkdirSync as mkdirSync26,
|
|
121061
|
-
mkdtempSync as
|
|
121206
|
+
mkdtempSync as mkdtempSync7,
|
|
121062
121207
|
readFileSync as readFileSync29,
|
|
121063
121208
|
readdirSync as readdirSync16,
|
|
121064
121209
|
rmSync as rmSync16,
|
|
@@ -121578,7 +121723,7 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
121578
121723
|
const debugDir = join57(producerRoot, ".debug");
|
|
121579
121724
|
const outputDir = dirname25(outputPath);
|
|
121580
121725
|
if (!existsSync50(outputDir)) mkdirSync26(outputDir, { recursive: true });
|
|
121581
|
-
const workDir = job.config.debug ? join57(debugDir, job.id) :
|
|
121726
|
+
const workDir = job.config.debug ? join57(debugDir, job.id) : mkdtempSync7(resolveRenderWorkDirPrefix(outputPath, job.id));
|
|
121582
121727
|
const pipelineStart = Date.now();
|
|
121583
121728
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
121584
121729
|
const logPath = job.config.debug ? join57(workDir, "render.log") : null;
|
|
@@ -123774,7 +123919,7 @@ import {
|
|
|
123774
123919
|
existsSync as existsSync54,
|
|
123775
123920
|
mkdirSync as mkdirSync27,
|
|
123776
123921
|
statSync as statSync17,
|
|
123777
|
-
mkdtempSync as
|
|
123922
|
+
mkdtempSync as mkdtempSync8,
|
|
123778
123923
|
writeFileSync as writeFileSync18,
|
|
123779
123924
|
rmSync as rmSync17,
|
|
123780
123925
|
createReadStream as createReadStream2
|
|
@@ -123929,7 +124074,7 @@ async function resolveInlineRenderHtml(body) {
|
|
|
123929
124074
|
}
|
|
123930
124075
|
function materializeInlineProject(html, options) {
|
|
123931
124076
|
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir9();
|
|
123932
|
-
const tempProjectDir =
|
|
124077
|
+
const tempProjectDir = mkdtempSync8(join60(tempRoot, "producer-project-"));
|
|
123933
124078
|
writeFileSync18(join60(tempProjectDir, "index.html"), html, "utf-8");
|
|
123934
124079
|
return {
|
|
123935
124080
|
prepared: {
|
|
@@ -125384,6 +125529,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
125384
125529
|
needsAlpha,
|
|
125385
125530
|
log: log2,
|
|
125386
125531
|
assertNotAborted,
|
|
125532
|
+
abortSignal,
|
|
125387
125533
|
// Distributed renders fail closed on font-fetch errors so the planDir
|
|
125388
125534
|
// is content-addressed against deterministic fonts only.
|
|
125389
125535
|
failClosedFontFetch: config.failClosedFontFetch !== false,
|
|
@@ -125711,7 +125857,7 @@ import {
|
|
|
125711
125857
|
existsSync as existsSync58,
|
|
125712
125858
|
linkSync as linkSync2,
|
|
125713
125859
|
mkdirSync as mkdirSync30,
|
|
125714
|
-
mkdtempSync as
|
|
125860
|
+
mkdtempSync as mkdtempSync9,
|
|
125715
125861
|
renameSync as renameSync13,
|
|
125716
125862
|
rmSync as rmSync19,
|
|
125717
125863
|
statSync as statSync18,
|
|
@@ -125761,7 +125907,7 @@ var init_planV2Publisher = __esm({
|
|
|
125761
125907
|
this.destinationDir = destinationDir;
|
|
125762
125908
|
this.#linkFile = options.linkFile ?? linkSync2;
|
|
125763
125909
|
mkdirSync30(dirname29(destinationDir), { recursive: true });
|
|
125764
|
-
this.temporaryDir =
|
|
125910
|
+
this.temporaryDir = mkdtempSync9(join67(dirname29(destinationDir), ".plan-v2-publish-"));
|
|
125765
125911
|
}
|
|
125766
125912
|
async putBlob(blob) {
|
|
125767
125913
|
const digest = assertPlanV2Sha256(blob.sha256, "published blob sha256");
|
|
@@ -125774,7 +125920,7 @@ var init_planV2Publisher = __esm({
|
|
|
125774
125920
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
125775
125921
|
if (existsSync58(destinationPath)) return;
|
|
125776
125922
|
mkdirSync30(dirname29(destinationPath), { recursive: true });
|
|
125777
|
-
const stagingDir =
|
|
125923
|
+
const stagingDir = mkdtempSync9(join67(dirname29(destinationPath), ".plan-v2-blob-"));
|
|
125778
125924
|
const temporaryPath = join67(stagingDir, "blob");
|
|
125779
125925
|
try {
|
|
125780
125926
|
try {
|
|
@@ -125816,7 +125962,7 @@ import {
|
|
|
125816
125962
|
existsSync as existsSync59,
|
|
125817
125963
|
lstatSync as lstatSync6,
|
|
125818
125964
|
mkdirSync as mkdirSync31,
|
|
125819
|
-
mkdtempSync as
|
|
125965
|
+
mkdtempSync as mkdtempSync10,
|
|
125820
125966
|
openSync as openSync7,
|
|
125821
125967
|
readFileSync as readFileSync34,
|
|
125822
125968
|
readSync as readSync4,
|
|
@@ -126060,7 +126206,7 @@ function computeManifestHash(manifest) {
|
|
|
126060
126206
|
function writeBlob(sourcePath, destinationPath) {
|
|
126061
126207
|
if (existsSync59(destinationPath)) return;
|
|
126062
126208
|
mkdirSync31(dirname30(destinationPath), { recursive: true });
|
|
126063
|
-
const temporaryDir =
|
|
126209
|
+
const temporaryDir = mkdtempSync10(join68(dirname30(destinationPath), ".plan-v2-blob-"));
|
|
126064
126210
|
const temporaryPath = join68(temporaryDir, "blob");
|
|
126065
126211
|
try {
|
|
126066
126212
|
copyFileSync8(sourcePath, temporaryPath);
|
|
@@ -126144,7 +126290,7 @@ function createPlanV2FromV1(planV1Dir, planV2Dir) {
|
|
|
126144
126290
|
}
|
|
126145
126291
|
const publication = buildPlanV2Publication(planV1Dir);
|
|
126146
126292
|
mkdirSync31(dirname30(planV2Dir), { recursive: true });
|
|
126147
|
-
const tempDir =
|
|
126293
|
+
const tempDir = mkdtempSync10(join68(dirname30(planV2Dir), ".plan-v2-build-"));
|
|
126148
126294
|
try {
|
|
126149
126295
|
for (const blob of publication.blobs) {
|
|
126150
126296
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
@@ -126183,7 +126329,7 @@ async function publishPlanV2FromV1(planV1Dir, publisher) {
|
|
|
126183
126329
|
}
|
|
126184
126330
|
}
|
|
126185
126331
|
async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
|
|
126186
|
-
const stagingRoot =
|
|
126332
|
+
const stagingRoot = mkdtempSync10(join68(options.stagingParentDir ?? tmpdir10(), ".plan-v2-source-"));
|
|
126187
126333
|
try {
|
|
126188
126334
|
await plan(
|
|
126189
126335
|
projectDir,
|
|
@@ -126388,7 +126534,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir) {
|
|
|
126388
126534
|
sourcePath: verifyBlob(planV2Dir, artifact)
|
|
126389
126535
|
}));
|
|
126390
126536
|
mkdirSync31(dirname30(destinationDir), { recursive: true });
|
|
126391
|
-
const tempDir =
|
|
126537
|
+
const tempDir = mkdtempSync10(join68(dirname30(destinationDir), ".plan-v2-materialize-"));
|
|
126392
126538
|
try {
|
|
126393
126539
|
for (const { artifact, sourcePath } of verified) {
|
|
126394
126540
|
const destinationPath = join68(tempDir, ...artifact.path.split("/"));
|
|
@@ -127307,11 +127453,11 @@ var init_renderChunk = __esm({
|
|
|
127307
127453
|
});
|
|
127308
127454
|
|
|
127309
127455
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
127310
|
-
import { mkdtempSync as
|
|
127456
|
+
import { mkdtempSync as mkdtempSync11, rmSync as rmSync24 } from "fs";
|
|
127311
127457
|
import { tmpdir as tmpdir11 } from "os";
|
|
127312
127458
|
import { join as join71 } from "path";
|
|
127313
127459
|
async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath) {
|
|
127314
|
-
const workRoot =
|
|
127460
|
+
const workRoot = mkdtempSync11(join71(tmpdir11(), "hf-plan-v2-chunk-"));
|
|
127315
127461
|
const materializedPlanDir = join71(workRoot, "plan");
|
|
127316
127462
|
try {
|
|
127317
127463
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
@@ -127321,7 +127467,7 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath) {
|
|
|
127321
127467
|
}
|
|
127322
127468
|
}
|
|
127323
127469
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
127324
|
-
const workRoot =
|
|
127470
|
+
const workRoot = mkdtempSync11(join71(tmpdir11(), "hf-plan-v2-assembler-"));
|
|
127325
127471
|
const materializedPlanDir = join71(workRoot, "plan");
|
|
127326
127472
|
try {
|
|
127327
127473
|
const materialized = materializePlanV2Target(
|
|
@@ -127384,6 +127530,10 @@ __export(src_exports2, {
|
|
|
127384
127530
|
CURRENT_PLAN_PROTOCOL: () => CURRENT_PLAN_PROTOCOL,
|
|
127385
127531
|
DEFAULT_CONFIG: () => DEFAULT_CONFIG2,
|
|
127386
127532
|
DISTRIBUTED_RENDER_CAPABILITIES: () => DISTRIBUTED_RENDER_CAPABILITIES,
|
|
127533
|
+
FONT_FETCH_FAILED: () => FONT_FETCH_FAILED,
|
|
127534
|
+
FONT_FETCH_UNAVAILABLE: () => FONT_FETCH_UNAVAILABLE,
|
|
127535
|
+
FontFetchError: () => FontFetchError,
|
|
127536
|
+
FontFetchUnavailableError: () => FontFetchUnavailableError,
|
|
127387
127537
|
PLAN_ARTIFACT_LAYOUT: () => PLAN_ARTIFACT_LAYOUT,
|
|
127388
127538
|
PLAN_HASH_SCHEMA: () => PLAN_HASH_SCHEMA,
|
|
127389
127539
|
PLAN_PROTOCOL_UNSUPPORTED: () => PLAN_PROTOCOL_UNSUPPORTED,
|
|
@@ -135755,7 +135905,7 @@ __export(render_exports, {
|
|
|
135755
135905
|
renderLocal: () => renderLocal,
|
|
135756
135906
|
resolveBrowserGpuForCli: () => resolveBrowserGpuForCli
|
|
135757
135907
|
});
|
|
135758
|
-
import { mkdtempSync as
|
|
135908
|
+
import { mkdtempSync as mkdtempSync12, readdirSync as readdirSync27, readFileSync as readFileSync53, statSync as statSync28, writeFileSync as writeFileSync30, rmSync as rmSync26 } from "fs";
|
|
135759
135909
|
import { freemem as freemem5, tmpdir as tmpdir12 } from "os";
|
|
135760
135910
|
import { resolve as resolve54, dirname as dirname41, join as join87, basename as basename16 } from "path";
|
|
135761
135911
|
import { execFileSync as execFileSync11, spawn as spawn14 } from "child_process";
|
|
@@ -135823,7 +135973,7 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
135823
135973
|
}
|
|
135824
135974
|
if (!quiet) console.log(c.dim(` Building Docker image: ${tag} (${platform10})...`));
|
|
135825
135975
|
const dockerfilePath = resolveDockerfilePath();
|
|
135826
|
-
const tmpDir =
|
|
135976
|
+
const tmpDir = mkdtempSync12(join87(tmpdir12(), "hyperframes-docker-"));
|
|
135827
135977
|
writeFileSync30(join87(tmpDir, "Dockerfile"), readFileSync53(dockerfilePath));
|
|
135828
135978
|
const targetArch = platform10 === "linux/arm64" ? "arm64" : "amd64";
|
|
135829
135979
|
try {
|
|
@@ -138401,7 +138551,7 @@ __export(validate_exports, {
|
|
|
138401
138551
|
resolveNavigationTimeoutMs: () => resolveNavigationTimeoutMs,
|
|
138402
138552
|
shouldIgnoreRequestFailure: () => shouldIgnoreRequestFailure
|
|
138403
138553
|
});
|
|
138404
|
-
import { existsSync as existsSync80, mkdtempSync as
|
|
138554
|
+
import { existsSync as existsSync80, mkdtempSync as mkdtempSync13, readFileSync as readFileSync56, rmSync as rmSync27 } from "fs";
|
|
138405
138555
|
import { tmpdir as tmpdir13 } from "os";
|
|
138406
138556
|
import { join as join90, dirname as dirname43 } from "path";
|
|
138407
138557
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
@@ -138568,7 +138718,7 @@ async function localizeRemoteAssets(html) {
|
|
|
138568
138718
|
try {
|
|
138569
138719
|
const { loadProducer: loadProducer2 } = await Promise.resolve().then(() => (init_producer(), producer_exports));
|
|
138570
138720
|
const { localizeRemoteMediaSources: localizeRemoteMediaSources2, localizeRemoteImageSources: localizeRemoteImageSources2, localizeRemoteFontFaces: localizeRemoteFontFaces2 } = await loadProducer2();
|
|
138571
|
-
dir =
|
|
138721
|
+
dir = mkdtempSync13(join90(tmpdir13(), "hf-validate-assets-"));
|
|
138572
138722
|
const assetDir = dir;
|
|
138573
138723
|
const media = await localizeRemoteMediaSources2(html, assetDir);
|
|
138574
138724
|
const images = await localizeRemoteImageSources2(media.html, assetDir);
|
|
@@ -145413,7 +145563,7 @@ var init_remove_background = __esm({
|
|
|
145413
145563
|
|
|
145414
145564
|
// src/whisper/parakeet.ts
|
|
145415
145565
|
import { execFileSync as execFileSync12 } from "child_process";
|
|
145416
|
-
import { existsSync as existsSync88, mkdtempSync as
|
|
145566
|
+
import { existsSync as existsSync88, mkdtempSync as mkdtempSync14, readFileSync as readFileSync63, rmSync as rmSync28, writeFileSync as writeFileSync36 } from "fs";
|
|
145417
145567
|
import { homedir as homedir17, tmpdir as tmpdir14 } from "os";
|
|
145418
145568
|
import { basename as basename19, extname as extname17, join as join99 } from "path";
|
|
145419
145569
|
function isRunnable(bin) {
|
|
@@ -145483,7 +145633,7 @@ function transcribeWithParakeet(inputPath, dir, options) {
|
|
|
145483
145633
|
options?.onProgress?.(
|
|
145484
145634
|
cached2 ? "Transcribing with Parakeet..." : "Downloading Parakeet model (first run, ~600MB)..."
|
|
145485
145635
|
);
|
|
145486
|
-
const workDir =
|
|
145636
|
+
const workDir = mkdtempSync14(join99(tmpdir14(), "hyperframes-parakeet-"));
|
|
145487
145637
|
try {
|
|
145488
145638
|
const argv2 = [inputPath, "--model", model, "--output-format", "json", "--output-dir", workDir];
|
|
145489
145639
|
if (options?.language) argv2.push("--language", options.language);
|
|
@@ -187478,7 +187628,7 @@ __export(snapshot_exports, {
|
|
|
187478
187628
|
resolveSnapshotVideoFrameTime: () => resolveSnapshotVideoFrameTime,
|
|
187479
187629
|
tailFrameTime: () => tailFrameTime
|
|
187480
187630
|
});
|
|
187481
|
-
import { existsSync as existsSync98, mkdtempSync as
|
|
187631
|
+
import { existsSync as existsSync98, mkdtempSync as mkdtempSync15, readFileSync as readFileSync68, mkdirSync as mkdirSync49, rmSync as rmSync29, writeFileSync as writeFileSync41 } from "fs";
|
|
187482
187632
|
import { tmpdir as tmpdir15 } from "os";
|
|
187483
187633
|
import { resolve as resolve67, join as join106, relative as relative24, isAbsolute as isAbsolute15, basename as basename25 } from "path";
|
|
187484
187634
|
function orbitStageSource() {
|
|
@@ -187526,7 +187676,7 @@ function requireSnapshotFfmpeg(ffmpegPath) {
|
|
|
187526
187676
|
);
|
|
187527
187677
|
}
|
|
187528
187678
|
async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
|
|
187529
|
-
const tmp =
|
|
187679
|
+
const tmp = mkdtempSync15(join106(tmpdir15(), "hf-snapshot-frame-"));
|
|
187530
187680
|
const outPath = join106(tmp, "frame.png");
|
|
187531
187681
|
try {
|
|
187532
187682
|
const ffmpegPath = requireSnapshotFfmpeg(findFFmpeg());
|
|
@@ -188995,7 +189145,7 @@ import {
|
|
|
188995
189145
|
copyFileSync as copyFileSync10,
|
|
188996
189146
|
existsSync as existsSync100,
|
|
188997
189147
|
mkdirSync as mkdirSync50,
|
|
188998
|
-
mkdtempSync as
|
|
189148
|
+
mkdtempSync as mkdtempSync16,
|
|
188999
189149
|
readFileSync as readFileSync70,
|
|
189000
189150
|
rmSync as rmSync30,
|
|
189001
189151
|
writeFileSync as writeFileSync44
|
|
@@ -189257,7 +189407,7 @@ function frameFileNameForPath(framePath) {
|
|
|
189257
189407
|
return "frame.png";
|
|
189258
189408
|
}
|
|
189259
189409
|
async function prepareGradeCompareTempProject(opts) {
|
|
189260
|
-
const tempDir =
|
|
189410
|
+
const tempDir = mkdtempSync16(join107(tmpdir16(), "hf-grade-compare-"));
|
|
189261
189411
|
try {
|
|
189262
189412
|
const frameFileName2 = opts.frameFileName ?? frameFileNameForPath(opts.framePath);
|
|
189263
189413
|
writeFileSync44(join107(tempDir, frameFileName2), opts.frameBuffer);
|
|
@@ -189304,7 +189454,7 @@ function isVideoPath2(filePath) {
|
|
|
189304
189454
|
return [".mp4", ".mov", ".m4v", ".webm", ".mkv", ".avi", ".mpeg", ".mpg", ".ogv"].includes(ext);
|
|
189305
189455
|
}
|
|
189306
189456
|
async function extractVideoFrameToBuffer2(videoPath) {
|
|
189307
|
-
const tmp =
|
|
189457
|
+
const tmp = mkdtempSync16(join107(tmpdir16(), "hf-grade-compare-frame-"));
|
|
189308
189458
|
const outPath = join107(tmp, "frame.png");
|
|
189309
189459
|
try {
|
|
189310
189460
|
const ffmpegPath = findFFmpeg();
|
|
@@ -189546,7 +189696,7 @@ __export(compare_exports, {
|
|
|
189546
189696
|
parseCompareArgs: () => parseCompareArgs,
|
|
189547
189697
|
prepareCompareVariantProjects: () => prepareCompareVariantProjects
|
|
189548
189698
|
});
|
|
189549
|
-
import { cpSync as cpSync6, existsSync as existsSync101, mkdirSync as mkdirSync51, mkdtempSync as
|
|
189699
|
+
import { cpSync as cpSync6, existsSync as existsSync101, mkdirSync as mkdirSync51, mkdtempSync as mkdtempSync17, renameSync as renameSync16, rmSync as rmSync31, statSync as statSync35 } from "fs";
|
|
189550
189700
|
import { tmpdir as tmpdir17 } from "os";
|
|
189551
189701
|
import { basename as basename28, dirname as dirname55, extname as extname24, join as join108 } from "path";
|
|
189552
189702
|
function defaultLabelForPath(input2) {
|
|
@@ -189647,7 +189797,7 @@ function inputError(variant) {
|
|
|
189647
189797
|
);
|
|
189648
189798
|
}
|
|
189649
189799
|
function stageHtmlVariant(variant) {
|
|
189650
|
-
const stagedDir =
|
|
189800
|
+
const stagedDir = mkdtempSync17(join108(tmpdir17(), "hf-compare-variant-"));
|
|
189651
189801
|
try {
|
|
189652
189802
|
cpSync6(dirname55(variant.inputPath), stagedDir, {
|
|
189653
189803
|
recursive: true,
|
|
@@ -189744,7 +189894,7 @@ async function renderCompareSheet(parsed) {
|
|
|
189744
189894
|
const capResult = capCompareVariants(parsed.variants);
|
|
189745
189895
|
const variants = capResult.variants;
|
|
189746
189896
|
const prepared = prepareCompareVariantProjects(variants);
|
|
189747
|
-
const frameDir =
|
|
189897
|
+
const frameDir = mkdtempSync17(join108(tmpdir17(), "hf-compare-frames-"));
|
|
189748
189898
|
const framePaths = [];
|
|
189749
189899
|
try {
|
|
189750
189900
|
let renderReadyTimedOut = false;
|
|
@@ -198837,7 +198987,7 @@ ${c.bold("ENV VARS:")}
|
|
|
198837
198987
|
});
|
|
198838
198988
|
|
|
198839
198989
|
// ../core/dist/figma/client.js
|
|
198840
|
-
function
|
|
198990
|
+
function retryAfterMs2(res) {
|
|
198841
198991
|
const raw = res.headers.get("retry-after");
|
|
198842
198992
|
if (raw === null)
|
|
198843
198993
|
return null;
|
|
@@ -198937,7 +199087,7 @@ function createFigmaClient(options) {
|
|
|
198937
199087
|
res = await doFetch(`${base2}${path2}`, { headers: { "X-Figma-Token": token } });
|
|
198938
199088
|
if (res.status !== 429 || attempt >= maxRetries)
|
|
198939
199089
|
break;
|
|
198940
|
-
const wait =
|
|
199090
|
+
const wait = retryAfterMs2(res) ?? 1e3 * 2 ** attempt;
|
|
198941
199091
|
await sleep5(wait);
|
|
198942
199092
|
}
|
|
198943
199093
|
await throwForStatus(res, path2, opts);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var HyperframesPlayer=(()=>{var J=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Xe=(i,e)=>{for(var t in e)J(i,t,{get:e[t],enumerable:!0})},Ze=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qe(e))!Ye.call(i,n)&&n!==t&&J(i,n,{get:()=>e[n],enumerable:!(r=Ge(e,n))||r.enumerable});return i};var Qe=i=>Ze(J({},"__esModule",{value:!0}),i);var Lt={};Xe(Lt,{HyperframesPlayer:()=>Q,SPEED_PRESETS:()=>te,formatSpeed:()=>N,formatTime:()=>$});function ye(i){return i.hasRuntime||i.runtimeInjected?!1:!!(i.hasNestedCompositions||i.hasTimelines&&i.attempts>=5)}function I(i){return typeof i=="object"&&i!==null}function Ee(i){return I(i)&&typeof i.getDuration=="function"}function Se(i){return I(i)&&typeof i.duration=="function"&&typeof i.time=="function"&&typeof i.seek=="function"&&typeof i.play=="function"&&typeof i.pause=="function"}var Je="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.7.
|
|
1
|
+
"use strict";var HyperframesPlayer=(()=>{var J=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Xe=(i,e)=>{for(var t in e)J(i,t,{get:e[t],enumerable:!0})},Ze=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qe(e))!Ye.call(i,n)&&n!==t&&J(i,n,{get:()=>e[n],enumerable:!(r=Ge(e,n))||r.enumerable});return i};var Qe=i=>Ze(J({},"__esModule",{value:!0}),i);var Lt={};Xe(Lt,{HyperframesPlayer:()=>Q,SPEED_PRESETS:()=>te,formatSpeed:()=>N,formatTime:()=>$});function ye(i){return i.hasRuntime||i.runtimeInjected?!1:!!(i.hasNestedCompositions||i.hasTimelines&&i.attempts>=5)}function I(i){return typeof i=="object"&&i!==null}function Ee(i){return I(i)&&typeof i.getDuration=="function"}function Se(i){return I(i)&&typeof i.duration=="function"&&typeof i.time=="function"&&typeof i.seek=="function"&&typeof i.play=="function"&&typeof i.pause=="function"}var Je="https://cdn.jsdelivr.net/npm/@hyperframes/core@0.7.81/dist/hyperframe.runtime.iife.js";function D(i){if(i===null)return null;let e=Number.parseInt(i,10);return Number.isFinite(e)&&e>0?e:null}function Ke(i){let e=i?.querySelector("[data-composition-id][data-width][data-height]")??i?.querySelector("[data-width][data-height]");if(!e)return null;let t=D(e.getAttribute("data-width")),r=D(e.getAttribute("data-height"));return t!==null&&r!==null?{width:t,height:r}:null}var j=class{constructor(e,t){this._iframe=e;this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let r=!!(t.__hf||t.__player),n=!!(t.__timelines&&Object.keys(t.__timelines).length>0),o=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(ye({hasRuntime:r,hasTimelines:n,hasNestedCompositions:o,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!r)return;let s=this._resolvePlaybackDurationAdapter(t);if(s&&s.getDuration()>0){this.stop();let l=Ke(this._iframe.contentDocument);this._callbacks.onReady({duration:s.getDuration(),adapter:s,compositionSize:l});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||I(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=Je,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!I(t))return null;let r=Object.keys(t);if(r.length===0)return null;let n=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),o=n&&n in t?n:r[r.length-1],s=t[o];return Se(s)?s:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(Ee(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let r=this._resolveDirectTimelineAdapterFromWindow(e);return r?{kind:"direct-timeline",timeline:r,getDuration:()=>r.duration()}:null}};var Te=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
position: relative;
|