import * as encoding from "lib0/encoding";
import * as decoding from "lib0/decoding";
//#region packages/provider/src/types.d.ts
type AuthorizedScope = "read-write" | "readonly";
//#endregion
//#region packages/common/src/auth.d.ts
declare enum AuthMessageType {
  Token = 0,
  PermissionDenied = 1,
  Authenticated = 2
}
declare const writeAuthentication: (encoder: encoding.Encoder, auth: string) => void;
declare const writePermissionDenied: (encoder: encoding.Encoder, reason: string) => void;
declare const writeAuthenticated: (encoder: encoding.Encoder, scope: AuthorizedScope) => void;
declare const writeTokenSyncRequest: (encoder: encoding.Encoder) => void;
declare const readAuthMessage: (decoder: decoding.Decoder, sendToken: () => void, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
//#endregion
//#region packages/common/src/CloseEvents.d.ts
interface CloseEvent {
  code: number;
  reason: string;
}
/**
 * The server is terminating the connection because a data frame was received
 * that is too large.
 * See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
 */
declare const MessageTooBig: CloseEvent;
/**
 * The server successfully processed the request, asks that the requester reset
 * its document view, and is not returning any content.
 */
declare const ResetConnection: CloseEvent;
/**
 * Similar to Forbidden, but specifically for use when authentication is required and has
 * failed or has not yet been provided.
 */
declare const Unauthorized: CloseEvent;
/**
 * The request contained valid data and was understood by the server, but the server
 * is refusing action.
 */
declare const Forbidden: CloseEvent;
/**
 * The server timed out waiting for the request.
 */
declare const ConnectionTimeout: CloseEvent;
//#endregion
//#region packages/common/src/awarenessStatesToArray.d.ts
declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
  clientId: number;
}[];
//#endregion
//#region packages/common/src/routingKey.d.ts
declare function makeRoutingKey(documentName: string, sessionId: string): string;
declare function parseRoutingKey(key: string): {
  documentName: string;
  sessionId: string | null;
};
//#endregion
//#region packages/common/src/SkipFurtherHooksError.d.ts
declare class SkipFurtherHooksError extends Error {
  constructor(message?: string);
}
//#endregion
//#region packages/common/src/types.d.ts
/**
 * State of the WebSocket connection.
 * https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
 */
declare enum WsReadyStates {
  Connecting = 0,
  Open = 1,
  Closing = 2,
  Closed = 3
}
//#endregion
export { AuthMessageType, CloseEvent, ConnectionTimeout, Forbidden, MessageTooBig, ResetConnection, SkipFurtherHooksError, Unauthorized, WsReadyStates, awarenessStatesToArray, makeRoutingKey, parseRoutingKey, readAuthMessage, writeAuthenticated, writeAuthentication, writePermissionDenied, writeTokenSyncRequest };