import { t as AutoReconnectingWebsocket } from "./AutoReconnectingWebsocket-BSt-vnzX.mjs";

//#region src/lib/availableStorage.d.ts
/**
 * Safety wrapper around browser localStorage providing context availability
 * checks and JSON parsing
 */
declare class AvailableStorage {
  available: boolean;
  getJSON<T>(key: string): Partial<T> | null;
  setJSON(key: string, obj: unknown): null | undefined;
  delete(key: string): null | undefined;
  setString(key: string, value: string): null | undefined;
  getString(key: string): string | null;
}
declare const availableStorage: AvailableStorage;
//#endregion
//#region src/lib/converters.d.ts
type URLParseOptions = {
  /**
   * Ignore any scheme in the input string and force this scheme instead.
   */
  scheme?: "http" | "https";
  /**
   * If the input string does not include a scheme, use this as the default
   * scheme.
   */
  defaultScheme?: "http" | "https";
};
/**
 * Parse a string as a URL, with options to enforce or default the scheme.
 */
declare function parseUrl(url: string, options?: URLParseOptions): URL;
/**
 * Attempt to parse a string as a URL; return undefined if we can't
 */
declare function tryParseUrl(url: string, options?: URLParseOptions): URL | undefined;
/**
 * Permissively parse a NOVA instance URL from a config variable.
 * If scheme is not specified, defaults to https for *.wandelbots.io hosts,
 * and http otherwise.
 * Throws an error if a valid URL could not be determined.
 */
declare function parseNovaInstanceUrl(url: string): URL;
/** Try to parse something as JSON; return undefined if we can't */
declare function tryParseJson(json: unknown): any;
/** Try to turn something into JSON; return undefined if we can't */
declare function tryStringifyJson(json: unknown): string | undefined;
/**
 * Converts object parameters to query string.
 * e.g. { a: "1", b: "2" } => "?a=1&b=2"
 *      {} => ""
 */
declare function makeUrlQueryString(obj: Record<string, string>): string;
/** Convert radians to degrees */
declare function radiansToDegrees(radians: number): number;
/** Convert degrees to radians */
declare function degreesToRadians(degrees: number): number;
/**
 * Check for coordinate system id equivalence, accounting for the "world" default
 * on empty/undefined values.
 */
declare function isSameCoordinateSystem(firstCoordSystem: string | undefined, secondCoordSystem: string | undefined): boolean;
/**
 * Helpful const for converting {x, y, z} to [x, y, z] and vice versa
 */
declare const XYZ_TO_VECTOR: {
  x: number;
  y: number;
  z: number;
};
//#endregion
//#region src/lib/errorHandling.d.ts
declare function delay(ms: number): Promise<unknown>;
/**
 * Attempts to make a helpful error message from an unknown thrown error
 * or promise rejection.
 *
 * This function is mainly to aid debugging and good bug reports. For
 * expected errors encountered by end users, it's more ideal to catch
 * the specific error code and provide a localized app-specific error message.
 */
declare function makeErrorMessage(err: unknown): string;
/**
 * Reloads the page with protection against loops.
 * Allows at most one reload per 10 seconds; otherwise throws
 * an error.
 */
declare function guardedPageReload(key: string): Promise<never>;
//#endregion
//#region src/lib/LoginWithAuth0.d.ts
/** Determine which Auth0 configuration to use based on instance URL */
declare const getAuth0Config: (instanceUrl: URL) => {
  domain: string;
  clientId: string;
};
/**
 * Initializes Auth0 login process using redirect if necessary and retrieves an access token.
 * Returns null when an access token should not be needed to authenticate (i.e. cookie auth
 * when deployed on the instance domain)
 */
declare const loginWithAuth0: (instanceUrl: URL) => Promise<string | null>;
//#endregion
export { AutoReconnectingWebsocket, URLParseOptions, XYZ_TO_VECTOR, availableStorage, degreesToRadians, delay, getAuth0Config, guardedPageReload, isSameCoordinateSystem, loginWithAuth0, makeErrorMessage, makeUrlQueryString, parseNovaInstanceUrl, parseUrl, radiansToDegrees, tryParseJson, tryParseUrl, tryStringifyJson };
//# sourceMappingURL=index.d.mts.map