import { f as Model } from "./types-TBVs22cZ.js";

//#region src/plugin-sdk/provider-oauth-runtime.d.ts
type OAuthCredentials = {
  refresh: string;
  access: string;
  expires: number;
  [key: string]: unknown;
};
type OAuthProviderId = string;
/** @deprecated Use OAuthProviderId instead. */
type OAuthProvider = OAuthProviderId;
type OAuthPrompt = {
  message: string;
  placeholder?: string;
  allowEmpty?: boolean;
};
type OAuthAuthorizationInput = {
  code?: string;
  state?: string;
};
type OAuthAuthInfo = {
  url: string;
  instructions?: string;
};
type OAuthSelectOption = {
  id: string;
  label: string;
};
type OAuthSelectPrompt = {
  message: string;
  options: OAuthSelectOption[];
};
interface OAuthLoginCallbacks {
  onAuth: (info: OAuthAuthInfo) => void;
  onPrompt: (prompt: OAuthPrompt) => Promise<string>;
  onProgress?: (message: string) => void;
  onManualCodeInput?: () => Promise<string>;
  /** Show an interactive selector and return the selected option id, or undefined on cancel. */
  onSelect?: (prompt: OAuthSelectPrompt) => Promise<string | undefined>;
  signal?: AbortSignal;
}
interface OAuthProviderInterface {
  readonly id: OAuthProviderId;
  readonly name: string;
  /** Run the login flow and return credentials to persist. */
  login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
  /** Whether login uses a local callback server and supports manual code input. */
  usesCallbackServer?: boolean;
  /** Refresh expired credentials and return updated credentials to persist. */
  refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
  /** Convert credentials to an API key string for the provider. */
  getApiKey(credentials: OAuthCredentials): string;
  /** Optionally adjust models for this provider, such as updating baseUrl. */
  modifyModels?(models: Model[], credentials: OAuthCredentials): Model[];
}
/** @deprecated Use OAuthProviderInterface instead. */
interface OAuthProviderInfo {
  id: OAuthProviderId;
  name: string;
  available: boolean;
}
declare function oauthSuccessHtml(message: string): string;
declare function oauthErrorHtml(message: string, details?: string): string;
declare function generatePKCE(): Promise<{
  verifier: string;
  challenge: string;
}>;
declare function generateOAuthState(): string;
declare function parseOAuthAuthorizationInput(input: string): OAuthAuthorizationInput;
declare function resolveOAuthTokenLifetimeMs(value: unknown): number | undefined;
declare function resolveOAuthTokenExpiresAt(value: unknown, options?: {
  nowMs?: number;
  refreshSkewMs?: number;
}): number | undefined;
declare function createOAuthLoginCancelledError(): Error;
declare function throwIfOAuthLoginAborted(signal?: AbortSignal): void;
declare function withOAuthLoginAbort<T>(promise: Promise<T>, signal?: AbortSignal, onAbort?: () => void): Promise<T>;
declare function buildOAuthRequestSignal(options: {
  signal?: AbortSignal;
  timeoutMs: number;
}): AbortSignal;
//#endregion
export { withOAuthLoginAbort as S, oauthSuccessHtml as _, OAuthPrompt as a, resolveOAuthTokenLifetimeMs as b, OAuthProviderInfo as c, OAuthSelectPrompt as d, buildOAuthRequestSignal as f, oauthErrorHtml as g, generatePKCE as h, OAuthLoginCallbacks as i, OAuthProviderInterface as l, generateOAuthState as m, OAuthAuthorizationInput as n, OAuthProvider as o, createOAuthLoginCancelledError as p, OAuthCredentials as r, OAuthProviderId as s, OAuthAuthInfo as t, OAuthSelectOption as u, parseOAuthAuthorizationInput as v, throwIfOAuthLoginAborted as x, resolveOAuthTokenExpiresAt as y };