/** * JData decoding (https://neurojson.org/jdata/draft3): the annotated forms of a JSON or BJData * document turned into JavaScript values. * * Copyright (c) 2019-2026 Qianqian Fang . BSD 3-clause license. */ import { Codec } from './codecs'; import { typeOfTypedArray } from './ndarray'; export interface DecodeOptions { /** N-D arrays as: 'auto' (default: numjs NdArray when numjs is loaded or passed as `nj`, else * NDArray), 'ndarray' (NDArray), 'numjs', 'nested' (nested arrays), 'typed' (the flat typed * array), 'jdata' (an {_ArrayType_, _ArraySize_, _ArrayData_: TypedArray} object, for BJData), or * a function (data, shape, dtype) => value */ ndarray?: 'auto' | 'ndarray' | 'numjs' | 'nested' | 'typed' | 'jdata' | ((data: any, shape: number[], dtype: string) => any); /** the numjs module (default: the global nj) */ nj?: any; /** sparse arrays as SparseArray (default 'sparse') or 'dense' */ sparse?: 'sparse' | 'dense'; /** special matrices (_ArrayShape_) are always expanded; tables as an object of columns * ('columns', default) or an array of records ('records') */ table?: 'columns' | 'records'; /** _ArrayZipData_ text is base64 (default true; false: a binary string, one byte per char) */ base64?: boolean; /** codecs for this call, by _ArrayZipType_ (see registerCodec) */ codecs?: { [name: string]: Codec; }; /** decode nested values too (default true) */ recursive?: boolean; /** _ByteStream_ data as Uint8Array (default) or, in browsers, 'blob' */ bytestream?: 'bytes' | 'blob'; } /** Bytes of a _ArrayZipData_ (base64 text, bytes, or an array of byte values). */ export declare function zipBytes(z: any, base64: boolean, isBase64Codec: boolean): Uint8Array; export declare class JDataDecoder { private o; private mode; private unzipped?; /** unzipped: _ArrayZipData_ entries already decompressed (decodeAsync) */ constructor(opts?: DecodeOptions, unzipped?: Map); /** An N-D array in the requested form. */ nd(data: any, shape: number[], dtype: string, imag?: any): any; value(x: any): any; array(x: any): any; /** The pre-processed array of _ArrayChunks_ tiles. */ private chunks; private sparse; /** A special matrix (_ArrayShape_) expanded. */ private special; private enumeration; private table; private bytestream; } /** The JavaScript values of the JData annotations in a JSON or BJData document. */ export declare function decode(value: any, opts?: DecodeOptions): any; export { typeOfTypedArray };