hyperframes 0.7.93 → 0.7.94

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 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.93" : "0.0.0-dev";
53
+ VERSION = true ? "0.7.94" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -135598,7 +135598,7 @@ var init_present = __esm({
135598
135598
  function isAuthError(err) {
135599
135599
  return err instanceof AuthError;
135600
135600
  }
135601
- var AuthError, ErrNotConfigured, ErrInvalidStore, ErrUnauthenticated, ErrApi, ErrOAuthNotConfigured, ErrRefreshFailed;
135601
+ var AuthError, ErrNotConfigured, ErrInvalidStore, ErrUnauthenticated, ErrApi, ErrOAuthNotConfigured, ErrRefreshFailed, ErrDeviceAuthFailed;
135602
135602
  var init_errors = __esm({
135603
135603
  "src/auth/errors.ts"() {
135604
135604
  "use strict";
@@ -135638,6 +135638,11 @@ var init_errors = __esm({
135638
135638
  detail ? `Failed to refresh OAuth tokens: ${detail}` : "Failed to refresh OAuth tokens",
135639
135639
  "Run `hyperframes auth login` to re-authenticate."
135640
135640
  );
135641
+ ErrDeviceAuthFailed = (detail) => new AuthError(
135642
+ "DEVICE_AUTH_FAILED",
135643
+ `Device authorization failed: ${detail}`,
135644
+ "Run `hyperframes auth login --device` to start a new code."
135645
+ );
135641
135646
  }
135642
135647
  });
135643
135648
 
@@ -136347,6 +136352,9 @@ function tokenEndpoint() {
136347
136352
  function revokeEndpoint() {
136348
136353
  return process.env["HYPERFRAMES_OAUTH_REVOKE_URL"] || DEFAULT_REVOKE_URL;
136349
136354
  }
136355
+ function deviceAuthorizationEndpoint() {
136356
+ return process.env["HYPERFRAMES_OAUTH_DEVICE_URL"] || DEFAULT_DEVICE_AUTHORIZATION_URL;
136357
+ }
136350
136358
  function resolveClientId() {
136351
136359
  const override = process.env["HYPERFRAMES_OAUTH_CLIENT_ID"];
136352
136360
  const id = override && override.length > 0 ? override : DEFAULT_CLIENT_ID;
@@ -136402,6 +136410,127 @@ async function startAuthorizationCodeFlow(opts = {}) {
136402
136410
  await persistOAuth(tokens, { preserveMissing: false });
136403
136411
  return { tokens };
136404
136412
  }
136413
+ async function startDeviceAuthorizationFlow(opts = {}) {
136414
+ const runtime = {
136415
+ clientId: resolveClientId(),
136416
+ fetchImpl: opts.fetchImpl ?? fetch,
136417
+ sleepImpl: opts.sleepImpl ?? ((ms) => new Promise((resolve77) => setTimeout(resolve77, ms))),
136418
+ now: opts.now ?? Date.now,
136419
+ requestTimeoutMs: opts.requestTimeoutMs ?? DEVICE_REQUEST_TIMEOUT_MS
136420
+ };
136421
+ const issuance = await requestDeviceAuthorization(runtime, opts.scope ?? DEFAULT_SCOPES);
136422
+ await opts.onChallenge?.({
136423
+ userCode: issuance.userCode,
136424
+ verificationUri: issuance.verificationUri,
136425
+ ...issuance.verificationUriComplete ? { verificationUriComplete: issuance.verificationUriComplete } : {}
136426
+ });
136427
+ return await pollDeviceToken(runtime, issuance);
136428
+ }
136429
+ async function requestDeviceAuthorization(runtime, scope) {
136430
+ return await withDeviceRequestTimeout(
136431
+ runtime,
136432
+ "could not reach the authorization server",
136433
+ async (signal) => {
136434
+ const response = await runtime.fetchImpl(deviceAuthorizationEndpoint(), {
136435
+ method: "POST",
136436
+ headers: {
136437
+ "content-type": "application/x-www-form-urlencoded",
136438
+ accept: "application/json"
136439
+ },
136440
+ body: new URLSearchParams({ client_id: runtime.clientId, scope }).toString(),
136441
+ signal
136442
+ });
136443
+ if (!response.ok) {
136444
+ throw ErrDeviceAuthFailed(`authorization server returned HTTP ${response.status}`);
136445
+ }
136446
+ return parseDeviceAuthorizationResponse(await readJsonOrDeviceError(response));
136447
+ }
136448
+ );
136449
+ }
136450
+ async function pollDeviceToken(runtime, issuance) {
136451
+ const deadline = runtime.now() + Math.min(issuance.expiresIn, MAX_DEVICE_FLOW_SECONDS) * 1e3;
136452
+ let intervalSeconds = issuance.interval;
136453
+ while (runtime.now() < deadline) {
136454
+ const remainingMs = deadline - runtime.now();
136455
+ if (remainingMs <= 0) break;
136456
+ await runtime.sleepImpl(Math.min(intervalSeconds * 1e3, remainingMs));
136457
+ const result = await requestDeviceToken(runtime, issuance.deviceCode);
136458
+ if (result.tokens) return result.tokens;
136459
+ if (result.slowDown) {
136460
+ intervalSeconds = Math.min(
136461
+ Math.max(intervalSeconds + 5, result.retryAfterSeconds ?? 0),
136462
+ MAX_DEVICE_POLL_SECONDS
136463
+ );
136464
+ }
136465
+ }
136466
+ throw ErrDeviceAuthFailed("the code expired");
136467
+ }
136468
+ async function requestDeviceToken(runtime, deviceCode) {
136469
+ return await withDeviceRequestTimeout(
136470
+ runtime,
136471
+ "lost contact with the authorization server",
136472
+ async (signal) => {
136473
+ const response = await runtime.fetchImpl(tokenEndpoint(), {
136474
+ method: "POST",
136475
+ headers: {
136476
+ "content-type": "application/x-www-form-urlencoded",
136477
+ accept: "application/json"
136478
+ },
136479
+ body: new URLSearchParams({
136480
+ grant_type: DEVICE_CODE_GRANT_TYPE,
136481
+ device_code: deviceCode,
136482
+ client_id: runtime.clientId
136483
+ }).toString(),
136484
+ signal
136485
+ });
136486
+ return await evaluateDevicePollResponse(response, runtime.now());
136487
+ }
136488
+ );
136489
+ }
136490
+ async function evaluateDevicePollResponse(response, nowMs) {
136491
+ if (response.ok) {
136492
+ return { tokens: parseTokenResponse(await readJsonOrDeviceError(response)) };
136493
+ }
136494
+ const error = await readDeviceOAuthError(response);
136495
+ switch (error) {
136496
+ case "authorization_pending":
136497
+ return {};
136498
+ case "slow_down":
136499
+ return { slowDown: true, retryAfterSeconds: retryAfterSeconds(response, nowMs) };
136500
+ case "access_denied":
136501
+ throw ErrDeviceAuthFailed("access was denied");
136502
+ case "expired_token":
136503
+ throw ErrDeviceAuthFailed("the code expired");
136504
+ default:
136505
+ if (response.status === 429) {
136506
+ return { slowDown: true, retryAfterSeconds: retryAfterSeconds(response, nowMs) };
136507
+ }
136508
+ throw ErrDeviceAuthFailed(`authorization server returned HTTP ${response.status}`);
136509
+ }
136510
+ }
136511
+ async function withDeviceRequestTimeout(runtime, networkError, operation) {
136512
+ const controller = new AbortController();
136513
+ const timer = setTimeout(() => controller.abort(), runtime.requestTimeoutMs);
136514
+ try {
136515
+ return await operation(controller.signal);
136516
+ } catch (err) {
136517
+ if (controller.signal.aborted) {
136518
+ throw ErrDeviceAuthFailed("authorization server request timed out");
136519
+ }
136520
+ if (isAuthError(err)) throw err;
136521
+ throw ErrDeviceAuthFailed(networkError);
136522
+ } finally {
136523
+ clearTimeout(timer);
136524
+ }
136525
+ }
136526
+ function retryAfterSeconds(response, nowMs) {
136527
+ const value = response.headers.get("retry-after")?.trim();
136528
+ if (!value) return void 0;
136529
+ if (/^\d+$/.test(value)) return Math.min(Number(value), MAX_DEVICE_POLL_SECONDS);
136530
+ const retryAt = Date.parse(value);
136531
+ if (!Number.isFinite(retryAt)) return void 0;
136532
+ return Math.min(Math.max(Math.ceil((retryAt - nowMs) / 1e3), 0), MAX_DEVICE_POLL_SECONDS);
136533
+ }
136405
136534
  async function refreshTokens(refresh_token, opts = {}) {
136406
136535
  const clientId = resolveClientId();
136407
136536
  const fetchImpl = opts.fetchImpl ?? fetch;
@@ -136562,6 +136691,146 @@ async function persistOAuth(tokens, opts) {
136562
136691
  const oauth = opts.preserveMissing ? { ...existing.oauth, ...tokens } : { ...tokens };
136563
136692
  await writeStore({ ...existing, oauth });
136564
136693
  }
136694
+ async function persistVerifiedOAuthSession(tokens, user) {
136695
+ let credentials = {};
136696
+ try {
136697
+ ({ credentials } = await readStore());
136698
+ } catch {
136699
+ credentials = {};
136700
+ }
136701
+ const next = {
136702
+ ...credentials,
136703
+ oauth: { ...tokens }
136704
+ };
136705
+ if (user.email || user.first_name || user.last_name || user.username) {
136706
+ next.user = {
136707
+ ...credentials.user,
136708
+ email: user.email,
136709
+ first_name: user.first_name,
136710
+ last_name: user.last_name,
136711
+ username: user.username
136712
+ };
136713
+ } else {
136714
+ delete next.user;
136715
+ }
136716
+ await writeStore(next);
136717
+ }
136718
+ function parseDeviceAuthorizationResponse(payload) {
136719
+ const data2 = requireDeviceAuthorizationRecord(payload);
136720
+ const deviceCode = stringField(data2, "device_code");
136721
+ const userCode = stringField(data2, "user_code");
136722
+ const verificationUri = requiredSafeVerificationUri(data2, "verification_uri");
136723
+ const verificationUriComplete = optionalSafeVerificationUri(data2, "verification_uri_complete");
136724
+ const expiresIn = strictNumericField(data2, "expires_in");
136725
+ const interval = strictNumericField(data2, "interval");
136726
+ requireSafeDeviceCode(deviceCode);
136727
+ requireSafeDeviceCode(userCode);
136728
+ const timing2 = normalizeDeviceAuthorizationTiming(data2, expiresIn, interval);
136729
+ return {
136730
+ deviceCode,
136731
+ userCode,
136732
+ verificationUri,
136733
+ ...verificationUriComplete ? { verificationUriComplete } : {},
136734
+ ...timing2
136735
+ };
136736
+ }
136737
+ function requireSafeDeviceCode(value) {
136738
+ if (!value || !isHeaderSafe(value)) {
136739
+ throw ErrDeviceAuthFailed("authorization server returned an invalid response");
136740
+ }
136741
+ }
136742
+ function normalizeDeviceAuthorizationTiming(data2, expiresIn, interval) {
136743
+ if (!isPositiveNumber(expiresIn) || data2["interval"] !== void 0 && !isPositiveNumber(interval)) {
136744
+ throw ErrDeviceAuthFailed("authorization server returned invalid timing values");
136745
+ }
136746
+ return {
136747
+ expiresIn,
136748
+ interval: Math.min(
136749
+ Math.max(Math.ceil(interval ?? MIN_DEVICE_POLL_SECONDS), MIN_DEVICE_POLL_SECONDS),
136750
+ MAX_DEVICE_POLL_SECONDS
136751
+ )
136752
+ };
136753
+ }
136754
+ function requiredSafeVerificationUri(data2, key2) {
136755
+ const value = normalizeSafeVerificationUri(stringField(data2, key2));
136756
+ if (!value) throw ErrDeviceAuthFailed("authorization server returned an unsafe verification URL");
136757
+ return value;
136758
+ }
136759
+ function optionalSafeVerificationUri(data2, key2) {
136760
+ if (data2[key2] === void 0) return void 0;
136761
+ return requiredSafeVerificationUri(data2, key2);
136762
+ }
136763
+ function requireDeviceAuthorizationRecord(payload) {
136764
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
136765
+ throw ErrDeviceAuthFailed("authorization server returned an invalid response");
136766
+ }
136767
+ return payload;
136768
+ }
136769
+ function isPositiveNumber(value) {
136770
+ return value !== void 0 && value > 0;
136771
+ }
136772
+ function normalizeSafeVerificationUri(value) {
136773
+ if (!value || !isHeaderSafe(value)) return void 0;
136774
+ try {
136775
+ const url = new URL(value);
136776
+ if (url.username || url.password) return void 0;
136777
+ const allowed = url.protocol === "https:" || url.protocol === "http:" && ["127.0.0.1", "localhost"].includes(url.hostname);
136778
+ return allowed ? url.href : void 0;
136779
+ } catch {
136780
+ return void 0;
136781
+ }
136782
+ }
136783
+ async function readJsonOrDeviceError(res) {
136784
+ return await readBoundedDeviceJson(res);
136785
+ }
136786
+ async function readDeviceOAuthError(res) {
136787
+ try {
136788
+ const payload = await readBoundedDeviceJson(res);
136789
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) return void 0;
136790
+ const error = payload["error"];
136791
+ return typeof error === "string" ? error : void 0;
136792
+ } catch {
136793
+ return void 0;
136794
+ }
136795
+ }
136796
+ function strictNumericField(obj, key2) {
136797
+ const value = obj[key2];
136798
+ if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
136799
+ if (typeof value !== "string" || value.trim() === "") return void 0;
136800
+ const parsed = Number(value);
136801
+ return Number.isFinite(parsed) ? parsed : void 0;
136802
+ }
136803
+ async function readBoundedDeviceJson(res) {
136804
+ if (!res.body) throw ErrDeviceAuthFailed("authorization server returned no data");
136805
+ const reader = res.body.getReader();
136806
+ const chunks = [];
136807
+ let total = 0;
136808
+ try {
136809
+ while (true) {
136810
+ const { done, value } = await reader.read();
136811
+ if (done) break;
136812
+ if (!value) continue;
136813
+ total += value.byteLength;
136814
+ if (total > MAX_DEVICE_RESPONSE_BYTES) {
136815
+ await reader.cancel();
136816
+ throw ErrDeviceAuthFailed("authorization server response was too large");
136817
+ }
136818
+ chunks.push(value);
136819
+ }
136820
+ const body = new Uint8Array(total);
136821
+ let offset2 = 0;
136822
+ for (const chunk of chunks) {
136823
+ body.set(chunk, offset2);
136824
+ offset2 += chunk.byteLength;
136825
+ }
136826
+ return JSON.parse(new TextDecoder().decode(body));
136827
+ } catch (err) {
136828
+ if (isAuthError(err)) throw err;
136829
+ throw ErrDeviceAuthFailed("authorization server returned non-JSON data");
136830
+ } finally {
136831
+ reader.releaseLock();
136832
+ }
136833
+ }
136565
136834
  async function readJsonOrThrow(res) {
136566
136835
  try {
136567
136836
  return await res.json();
@@ -136576,7 +136845,7 @@ async function safeText2(res) {
136576
136845
  return "";
136577
136846
  }
136578
136847
  }
136579
- var REVOKE_TIMEOUT_MS, MIN_EXPIRES_IN_SECONDS, DEFAULT_CLIENT_ID, DEFAULT_SCOPES, DEFAULT_AUTHORIZE_URL, DEFAULT_TOKEN_URL, DEFAULT_REVOKE_URL;
136848
+ var REVOKE_TIMEOUT_MS, MIN_EXPIRES_IN_SECONDS, DEFAULT_CLIENT_ID, DEFAULT_SCOPES, DEFAULT_AUTHORIZE_URL, DEFAULT_TOKEN_URL, DEFAULT_REVOKE_URL, DEFAULT_DEVICE_AUTHORIZATION_URL, DEVICE_CODE_GRANT_TYPE, MAX_DEVICE_FLOW_SECONDS, MIN_DEVICE_POLL_SECONDS, MAX_DEVICE_POLL_SECONDS, MAX_DEVICE_RESPONSE_BYTES, DEVICE_REQUEST_TIMEOUT_MS;
136580
136849
  var init_oauth = __esm({
136581
136850
  "src/auth/oauth.ts"() {
136582
136851
  "use strict";
@@ -136595,6 +136864,13 @@ var init_oauth = __esm({
136595
136864
  DEFAULT_AUTHORIZE_URL = "https://app.heygen.com/oauth/authorize";
136596
136865
  DEFAULT_TOKEN_URL = "https://api2.heygen.com/v1/oauth/token";
136597
136866
  DEFAULT_REVOKE_URL = "https://api2.heygen.com/v1/oauth/revoke";
136867
+ DEFAULT_DEVICE_AUTHORIZATION_URL = "https://api2.heygen.com/v1/oauth/device_authorization";
136868
+ DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
136869
+ MAX_DEVICE_FLOW_SECONDS = 30 * 60;
136870
+ MIN_DEVICE_POLL_SECONDS = 5;
136871
+ MAX_DEVICE_POLL_SECONDS = 60;
136872
+ MAX_DEVICE_RESPONSE_BYTES = 64 * 1024;
136873
+ DEVICE_REQUEST_TIMEOUT_MS = 15e3;
136598
136874
  }
136599
136875
  });
136600
136876
 
@@ -201752,6 +202028,98 @@ __export(login_exports, {
201752
202028
  default: () => login_default
201753
202029
  });
201754
202030
  import { stdin as input } from "process";
202031
+ function isRemoteOrHeadless() {
202032
+ const remoteEnvironment = [
202033
+ "CODESPACES",
202034
+ "GITHUB_CODESPACES",
202035
+ "REMOTE_CONTAINERS",
202036
+ "GITPOD_WORKSPACE_ID",
202037
+ "container"
202038
+ ].some(envFlagEnabled);
202039
+ return Boolean(
202040
+ process.env["SSH_CONNECTION"] || process.env["SSH_CLIENT"] || process.env["SSH_TTY"] || process.env["BROWSER"] === "none" || process.env["HF_NO_BROWSER"] === "1" || remoteEnvironment || process.stdout.isTTY !== true
202041
+ );
202042
+ }
202043
+ function envFlagEnabled(name) {
202044
+ const value = process.env[name]?.trim().toLowerCase();
202045
+ return Boolean(value && value !== "0" && value !== "false" && value !== "no");
202046
+ }
202047
+ function assertAttendedDeviceFlow() {
202048
+ if (envFlagEnabled("CI") || process.stdin.isTTY !== true || process.stdout.isTTY !== true) {
202049
+ console.error(
202050
+ c.error(
202051
+ "`--device` requires an attended terminal and is disabled in CI. Use an API key or workload credential for automation."
202052
+ )
202053
+ );
202054
+ failUsage();
202055
+ }
202056
+ }
202057
+ async function runDeviceLogin() {
202058
+ assertAttendedDeviceFlow();
202059
+ assertOAuthConfiguredOrExit();
202060
+ const { trackAuthLoginStarted: trackAuthLoginStarted2, trackAuthLoginCompleted: trackAuthLoginCompleted2, trackAuthLoginFailed: trackAuthLoginFailed2, identifyUser: identifyUser2 } = await Promise.resolve().then(() => (init_telemetry2(), telemetry_exports2));
202061
+ trackAuthLoginStarted2("device");
202062
+ let tokens;
202063
+ try {
202064
+ tokens = await startDeviceAuthorizationFlow({
202065
+ onChallenge: ({ verificationUri, verificationUriComplete, userCode }) => {
202066
+ console.log(`Open ${c.accent(verificationUriComplete ?? verificationUri)} in a browser.`);
202067
+ if (!verificationUriComplete) console.log(`Enter code ${c.bold(userCode)}.`);
202068
+ console.log(c.dim("Waiting for approval\u2026"));
202069
+ }
202070
+ });
202071
+ } catch (err) {
202072
+ const message = err.message || "Device authorization failed.";
202073
+ trackAuthLoginFailed2("device", /expired/i.test(message) ? "flow_timeout" : "flow_error");
202074
+ console.error(c.error(message));
202075
+ failCommand();
202076
+ }
202077
+ const credential = {
202078
+ type: "oauth",
202079
+ access_token: tokens.access_token,
202080
+ ...tokens.refresh_token ? { refresh_token: tokens.refresh_token } : {},
202081
+ source: "file_json",
202082
+ refreshable: false
202083
+ };
202084
+ let user;
202085
+ try {
202086
+ user = await new AuthClient().getCurrentUser(credential);
202087
+ } catch (err) {
202088
+ await revokeDeviceTokens(tokens);
202089
+ trackAuthLoginFailed2("device", "rejected");
202090
+ console.error(
202091
+ c.error(
202092
+ `HeyGen could not verify the approved device session; no credential was saved. ${err.message}`
202093
+ )
202094
+ );
202095
+ failCommand();
202096
+ }
202097
+ try {
202098
+ await persistVerifiedOAuthSession(tokens, toStoredUserInfo(user));
202099
+ } catch (err) {
202100
+ await revokeDeviceTokens(tokens);
202101
+ trackAuthLoginFailed2("device", "flow_error");
202102
+ console.error(
202103
+ c.error(
202104
+ `Could not save the verified device session; it was revoked. ${err.message}`
202105
+ )
202106
+ );
202107
+ failCommand();
202108
+ }
202109
+ const id = identityKey(user);
202110
+ if (id) identifyUser2(id);
202111
+ trackAuthLoginCompleted2("device", id);
202112
+ const identity = userDisplayName(toStoredUserInfo(user)) ?? "(unknown user)";
202113
+ console.log(c.success(`\u2713 Signed in as ${identity}.`));
202114
+ }
202115
+ async function revokeDeviceTokens(tokens) {
202116
+ await revokeTokens(tokens.access_token, { token_type_hint: "access_token" });
202117
+ if (tokens.refresh_token) {
202118
+ await revokeTokens(tokens.refresh_token, {
202119
+ token_type_hint: "refresh_token"
202120
+ });
202121
+ }
202122
+ }
201755
202123
  async function runOAuthLogin() {
201756
202124
  assertOAuthConfiguredOrExit();
201757
202125
  const { trackAuthLoginStarted: trackAuthLoginStarted2, trackAuthLoginFailed: trackAuthLoginFailed2 } = await Promise.resolve().then(() => (init_telemetry2(), telemetry_exports2));
@@ -201886,7 +202254,11 @@ async function rollback(previous) {
201886
202254
  async function verifyAndReport(key2) {
201887
202255
  const client = new AuthClient();
201888
202256
  try {
201889
- const user = await client.getCurrentUser({ type: "api_key", key: key2, source: "file_json" });
202257
+ const user = await client.getCurrentUser({
202258
+ type: "api_key",
202259
+ key: key2,
202260
+ source: "file_json"
202261
+ });
201890
202262
  await persistUserInfo(user);
201891
202263
  const identity = userDisplayName(toStoredUserInfo(user)) ?? "(unknown user)";
201892
202264
  console.log(c.success(`\u2713 API key saved. Authenticated as ${identity}.`));
@@ -201963,15 +202335,35 @@ var init_login = __esm({
201963
202335
  "api-key": {
201964
202336
  type: "string",
201965
202337
  description: "API key value, or pass `--api-key` with no value to read from stdin / prompt."
202338
+ },
202339
+ device: {
202340
+ type: "boolean",
202341
+ description: "Use an attended device code (for SSH/headless terminals; never for CI)."
201966
202342
  }
201967
202343
  },
201968
202344
  // fallow-ignore-next-line complexity
201969
202345
  async run({ args }) {
201970
202346
  const inlineKey = args["api-key"];
202347
+ if (inlineKey !== void 0 && args.device) {
202348
+ console.error(c.error("Choose either --device or --api-key, not both."));
202349
+ failUsage();
202350
+ }
201971
202351
  if (inlineKey !== void 0) {
201972
202352
  await runApiKeyLogin(inlineKey);
201973
202353
  return;
201974
202354
  }
202355
+ if (args.device) {
202356
+ await runDeviceLogin();
202357
+ return;
202358
+ }
202359
+ if (isRemoteOrHeadless()) {
202360
+ console.error(
202361
+ c.error(
202362
+ "Browser callback login is unavailable in this remote/headless terminal. Run `hyperframes auth login --device`."
202363
+ )
202364
+ );
202365
+ failUsage();
202366
+ }
201975
202367
  await runOAuthLogin();
201976
202368
  }
201977
202369
  });
@@ -202394,6 +202786,7 @@ var init_auth3 = __esm({
202394
202786
  init_colors();
202395
202787
  examples37 = [
202396
202788
  ["Sign in via browser (OAuth)", "hyperframes auth login"],
202789
+ ["Sign in from SSH/headless terminal", "hyperframes auth login --device"],
202397
202790
  ["Save an API key (interactive)", "hyperframes auth login --api-key"],
202398
202791
  ["Save an API key from stdin", "echo $HEYGEN_API_KEY | hyperframes auth login --api-key"],
202399
202792
  ["Check who you're signed in as", "hyperframes auth status"],
@@ -202407,7 +202800,7 @@ Manage HeyGen credentials. Credentials live in
202407
202800
  ${c.accent("~/.heygen/credentials")} and are shared with heygen-cli.
202408
202801
 
202409
202802
  ${c.bold("SUBCOMMANDS:")}
202410
- ${c.accent("login")} ${c.dim("Sign in via browser (default) or --api-key for a long-lived key.")}
202803
+ ${c.accent("login")} ${c.dim("Sign in via browser, --device for SSH, or --api-key for a long-lived key.")}
202411
202804
  ${c.accent("status")} ${c.dim("Show the active credential's source, type, and identity.")}
202412
202805
  ${c.accent("refresh")} ${c.dim("Force-refresh the OAuth access token.")}
202413
202806
  ${c.accent("logout")} ${c.dim("Remove the stored credential (--keep-api-key for OAuth-only).")}
@@ -202418,6 +202811,7 @@ ${c.bold("ENV VARS:")}
202418
202811
  ${c.accent("HEYGEN_API_URL")} Override the API base URL (default https://api.heygen.com).
202419
202812
  ${c.accent("HEYGEN_CONFIG_DIR")} Override the credentials directory (default ~/.heygen).
202420
202813
  ${c.accent("HYPERFRAMES_OAUTH_CLIENT_ID")} Override the OAuth client_id (for dev/test).
202814
+ ${c.accent("HYPERFRAMES_OAUTH_DEVICE_URL")} Override the RFC 8628 device endpoint (for dev/test).
202421
202815
  `;
202422
202816
  auth_default = defineCommand({
202423
202817
  meta: { name: "auth", description: "Sign in to HeyGen and manage credentials" },
@@ -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.93/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=`
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.94/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;
@@ -1,4 +1,4 @@
1
- var ce=Object.defineProperty;var pe=(r,t,e)=>t in r?ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>pe(r,typeof t!="symbol"?t+"":t,e);import{r as ne,i as me,a as fe}from"./index-Dp1zVb9X.js";function _e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function F(r){return typeof r=="object"&&r!==null}function ge(r){return F(r)&&typeof r.getDuration=="function"}function ye(r){return F(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function ve(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const be=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:ve("0.0.0-dev");function H(r){if(r===null)return null;const t=Number.parseInt(r,10);return Number.isFinite(t)&&t>0?t:null}function we(r){const t=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!t)return null;const e=H(t.getAttribute("data-width")),i=H(t.getAttribute("data-height"));return e!==null&&i!==null?{width:e,height:i}:null}class Ae{constructor(t,e){c(this,"_interval",null);c(this,"_runtimeInjected",!1);this._iframe=t,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let t=0;this._interval=setInterval(()=>{var e;t++;try{const i=this._iframe.contentWindow;if(!i)return;const s=!!(i.__hf||i.__player),o=!!(i.__timelines&&Object.keys(i.__timelines).length>0),d=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(_e({hasRuntime:s,hasTimelines:o,hasNestedCompositions:d,runtimeInjected:this._runtimeInjected,attempts:t})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const a=this._resolvePlaybackDurationAdapter(i);if(a&&a.getDuration()>0){this.stop();const h=we(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:h});return}}catch{}t>=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{const t=this._iframe.contentWindow;return t?this._resolveDirectTimelineAdapterFromWindow(t):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(t){return this._resolveDirectTimelineAdapterFromWindow(t)}hasRuntimeBridge(t){return Reflect.get(t,"__hf")!==void 0||F(Reflect.get(t,"__player"))}_injectRuntime(){var t,e;this._runtimeInjected=!0;try{const i=this._iframe.contentDocument;if(!i)return;const s=i.createElement("script");s.src=be,(i.head||i.documentElement).appendChild(s),(e=(t=this._callbacks).onRuntimeInjected)==null||e.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(t){var a,h;if(this.hasRuntimeBridge(t))return null;const e=Reflect.get(t,"__timelines");if(!F(e))return null;const i=Object.keys(e);if(i.length===0)return null;const s=(h=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:h.getAttribute("data-composition-id"),o=s&&s in e?s:i[i.length-1],d=e[o];return ye(d)?d:null}_resolvePlaybackDurationAdapter(t){const e=Reflect.get(t,"__player");if(ge(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const i=this._resolveDirectTimelineAdapterFromWindow(t);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}}const Ee=`
1
+ var ce=Object.defineProperty;var pe=(r,t,e)=>t in r?ce(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var c=(r,t,e)=>pe(r,typeof t!="symbol"?t+"":t,e);import{r as ne,i as me,a as fe}from"./index-CH_dyqrx.js";function _e(r){return r.hasRuntime||r.runtimeInjected?!1:!!(r.hasNestedCompositions||r.hasTimelines&&r.attempts>=5)}function F(r){return typeof r=="object"&&r!==null}function ge(r){return F(r)&&typeof r.getDuration=="function"}function ye(r){return F(r)&&typeof r.duration=="function"&&typeof r.time=="function"&&typeof r.seek=="function"&&typeof r.play=="function"&&typeof r.pause=="function"}function ve(r){if(!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(r))throw new Error(`Invalid HyperFrames runtime version: ${r}`);return`https://cdn.jsdelivr.net/npm/@hyperframes/core@${r}/dist/hyperframe.runtime.iife.js`}const be=typeof __HYPERFRAMES_RUNTIME_CDN_URL__=="string"?__HYPERFRAMES_RUNTIME_CDN_URL__:ve("0.0.0-dev");function H(r){if(r===null)return null;const t=Number.parseInt(r,10);return Number.isFinite(t)&&t>0?t:null}function we(r){const t=(r==null?void 0:r.querySelector("[data-composition-id][data-width][data-height]"))??(r==null?void 0:r.querySelector("[data-width][data-height]"));if(!t)return null;const e=H(t.getAttribute("data-width")),i=H(t.getAttribute("data-height"));return e!==null&&i!==null?{width:e,height:i}:null}class Ae{constructor(t,e){c(this,"_interval",null);c(this,"_runtimeInjected",!1);this._iframe=t,this._callbacks=e}get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let t=0;this._interval=setInterval(()=>{var e;t++;try{const i=this._iframe.contentWindow;if(!i)return;const s=!!(i.__hf||i.__player),o=!!(i.__timelines&&Object.keys(i.__timelines).length>0),d=!!((e=this._iframe.contentDocument)!=null&&e.querySelector("[data-composition-src]"));if(_e({hasRuntime:s,hasTimelines:o,hasNestedCompositions:d,runtimeInjected:this._runtimeInjected,attempts:t})){this._injectRuntime();return}if(this._runtimeInjected&&!s)return;const a=this._resolvePlaybackDurationAdapter(i);if(a&&a.getDuration()>0){this.stop();const h=we(this._iframe.contentDocument);this._callbacks.onReady({duration:a.getDuration(),adapter:a,compositionSize:h});return}}catch{}t>=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{const t=this._iframe.contentWindow;return t?this._resolveDirectTimelineAdapterFromWindow(t):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(t){return this._resolveDirectTimelineAdapterFromWindow(t)}hasRuntimeBridge(t){return Reflect.get(t,"__hf")!==void 0||F(Reflect.get(t,"__player"))}_injectRuntime(){var t,e;this._runtimeInjected=!0;try{const i=this._iframe.contentDocument;if(!i)return;const s=i.createElement("script");s.src=be,(i.head||i.documentElement).appendChild(s),(e=(t=this._callbacks).onRuntimeInjected)==null||e.call(t)}catch{}}_resolveDirectTimelineAdapterFromWindow(t){var a,h;if(this.hasRuntimeBridge(t))return null;const e=Reflect.get(t,"__timelines");if(!F(e))return null;const i=Object.keys(e);if(i.length===0)return null;const s=(h=(a=this._iframe.contentDocument)==null?void 0:a.querySelector("[data-composition-id]"))==null?void 0:h.getAttribute("data-composition-id"),o=s&&s in e?s:i[i.length-1],d=e[o];return ye(d)?d:null}_resolvePlaybackDurationAdapter(t){const e=Reflect.get(t,"__player");if(ge(e))return{kind:"runtime",getDuration:()=>e.getDuration()};const i=this._resolveDirectTimelineAdapterFromWindow(t);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}}const Ee=`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -1 +1 @@
1
- import{g as P}from"./index-Dp1zVb9X.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
1
+ import{g as P}from"./index-CH_dyqrx.js";function j(c,d){for(var s=0;s<d.length;s++){const a=d[s];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in c)){const l=Object.getOwnPropertyDescriptor(a,i);l&&Object.defineProperty(c,i,l.get?l:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(c,Symbol.toStringTag,{value:"Module"}))}var v={},w;function k(){if(w)return v;w=1,Object.defineProperty(v,"__esModule",{value:!0}),v.default=d;var c=window.OfflineAudioContext||window.webkitOfflineAudioContext;function d(e){var r=a(e);return r.start(0),[i,y,O(e.sampleRate),s].reduce(function(t,o){return o(t)},r.buffer.getChannelData(0))}function s(e){return e.sort(function(r,t){return t.count-r.count}).splice(0,5)[0].tempo}function a(e){var r=e.length,t=e.numberOfChannels,o=e.sampleRate,n=new c(t,r,o),u=n.createBufferSource();u.buffer=e;var f=n.createBiquadFilter();return f.type="lowpass",u.connect(f),f.connect(n.destination),u}function i(e){for(var r=[],t=.9,o=.3,n=15;r.length<n&&t>=o;)r=l(e,t),t-=.05;if(r.length<n)throw new Error("Could not find enough samples for a reliable detection.");return r}function l(e,r){for(var t=[],o=0,n=e.length;o<n;o+=1)e[o]>r&&(t.push(o),o+=1e4);return t}function y(e){var r=[];return e.forEach(function(t,o){for(var n=function(x){var g=e[o+x]-t,_=r.some(function(h){if(h.interval===g)return h.count+=1});_||r.push({interval:g,count:1})},u=0;u<10;u+=1)n(u)}),r}function O(e){return function(r){var t=[];return r.forEach(function(o){if(o.interval!==0){for(var n=60/(o.interval/e);n<90;)n*=2;for(;n>180;)n/=2;n=Math.round(n);var u=t.some(function(f){if(f.tempo===n)return f.count+=o.count});u||t.push({tempo:n,count:o.count})}}),t}}return v}var p,b;function q(){return b||(b=1,p=k().default),p}var m=q();const A=P(m),D=j({__proto__:null,default:A},[m]);export{D as i};
@@ -1,4 +1,4 @@
1
- import{n as Qi}from"./index-Dp1zVb9X.js";/*!
1
+ import{n as Qi}from"./index-CH_dyqrx.js";/*!
2
2
  * Copyright (c) 2026-present, Vanilagy and contributors
3
3
  *
4
4
  * This Source Code Form is subject to the terms of the Mozilla Public