export declare function arrayify(value: T | T[]): T[]; export declare function delay(millis: number, value?: T): Promise; export declare function memcpy(trg: Uint8Array, trgOff: number, src: ArrayLike, srcOff?: number, len?: number): void; export declare function strcmp(a: string, b: string): 1 | 0 | -1; export declare function bufferEq(a: Uint8Array, b: ArrayLike, offset?: number): boolean; export declare function arrayEq(a: T[], b: T[], isEqual?: (a: T, b: T) => boolean): boolean; export declare function hash(buf: Uint8Array, bits: number): number; export declare function idiv(a: number, b: number): number; export declare function fnv1(data: Uint8Array): number; export declare function crc(p: Uint8Array): number; export declare function ALIGN(n: number): number; export declare function stringToUint8Array(input: string): Uint8Array; export declare function uint8ArrayToString(input: ArrayLike): string; export declare function fromUTF8(binstr: string): string; export declare function toUTF8(str: string, cesu8?: boolean): string; export type SMap = Record; /** @internal */ export declare class PromiseBuffer { private waiting; private available; drain(): void; pushError(v: Error): void; push(v: T): void; shiftAsync(timeout?: number): Promise; } /** @internal */ export declare class PromiseQueue { private readonly promises; enqueue(id: string, f: () => Promise): Promise; } export declare function rgbToHtmlColor(rgb: number): string; export declare function rgbaToHtmlColor(rgb: number, a: number): string; export declare function toFullHex(n: number[]): string; export declare function toHex(bytes: ArrayLike, sep?: string): string; export declare function fromHex(hex: string): Uint8Array; export declare function isSet(v: unknown): boolean; export declare function toArray(a: ArrayLike): T[]; export interface MutableArrayLike { readonly length: number; [n: number]: T; } export declare function hexNum(n: number): string; export declare function write32(buf: MutableArrayLike, pos: number, v: number): void; export declare function write24(buf: MutableArrayLike, pos: number, v: number): void; export declare function write16(buf: MutableArrayLike, pos: number, v: number): void; export declare function read32(buf: ArrayLike, pos: number): number; export declare function read16(buf: ArrayLike, pos: number): number; export declare function encodeU32LE(words: number[]): Uint8Array; export declare function decodeU32LE(buf: Uint8Array): number[]; export declare function isBufferEmpty(data: Uint8Array): boolean; export declare function bufferToString(buf: Uint8Array): string; export declare function stringToBuffer(str: string): Uint8Array; export declare function bufferConcat(a: Uint8Array, b: Uint8Array): Uint8Array; export declare function bufferConcatMany(bufs: Uint8Array[]): Uint8Array; export declare function arrayConcatMany(arrs: T[][]): T[]; export declare function jsonCopyFrom(trg: T, src: T): void; export declare function assert(cond: boolean, msg?: string, debugData?: any): void; export declare function flatClone(obj: T | null): T; export declare function clone(v: T): T; export declare function throttle(handler: () => void, delay: number): () => void; export interface Signal { signalled: Promise; signal: () => void; } export declare function signal(): Signal; export declare function readBlobToUint8Array(blob: Blob): Promise; export declare function readBlobToText(blob: Blob): Promise; export declare function debounce(handler: () => void, delay: number): () => void; export declare function debounceAsync(handler: () => Promise, delay: number): () => void; export declare function JSONTryParse(src: string, defaultValue?: T): T | undefined | null; export declare function roundWithPrecision(x: number, digits: number, round?: (x: number) => number): number; export declare function renderWithPrecision(x: number, digits: number, round?: (x: number) => number): string; export declare function randomRange(min: number, max: number): number; export declare function unique(values: T[]): T[]; export declare function uniqueMap(values: T[], id: (value: T) => string, converter: (value: T) => U): U[]; export declare function toMap(a: T[], keyConverter: (value: T, index: number) => string, valueConverter: (value: T, index: number) => V, ignoreMissingValues?: boolean): SMap; export declare function ellipse(text: string, maxChars: number, suffix?: string): string; export declare function ellipseFirstSentence(text: string): string; export declare function ellipseJoin(values: string[], maxChars: number, ellipse?: string): string; export declare function arrayShuffle(a: T[]): T[]; export declare function uniqueName(names: string[], name: string, separator?: string, startCount?: number): string; export declare function groupBy(list: T[], key: (value: T) => string): SMap; export declare function pick(...values: number[]): number; /** * Applies filters and returns array of [yays, nays] * @param values * @param condition */ export declare function splitFilter(values: ArrayLike, condition: (t: T) => boolean): [T[], T[]]; export declare function range(end: number): number[]; export declare function toggleBit(data: Uint8Array, bitindex: number): void; export declare function getBit(data: Uint8Array, bitindex: number): boolean; export declare function setBit(data: Uint8Array, bitindex: number, on: boolean): void; export declare function parseIdentifier(value: number | string): number;