{"version":3,"sources":["../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/constants.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/arrays.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/objects.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/data-types.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/numbers.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/strings.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/read.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/util/struct.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/column.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/table.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/batch-type.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/builder.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/compression.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/block.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/body-compression.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/record-batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/dictionary-batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/data-type.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/metadata.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/schema.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/message.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/decode-ipc.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/decode/table-from-ipc.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/record-batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/dictionary-batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/metadata.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/data-type.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/schema.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/footer.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/message.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/sink.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/encode-ipc.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/encode/table-to-ipc.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/buffer.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/batch.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/validity.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/dictionary.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/infer-type.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/binary.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/bool.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/decimal.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/fixed-size-binary.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/fixed-size-list.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/interval.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/list.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/struct.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/map.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/run-end-encoded.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/union.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/utf8.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builders/values.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/builder.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/column-from-values.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/column-from-array.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/table-from-columns.js","../../../node_modules/.pnpm/@uwdata+flechette@2.3.0/node_modules/@uwdata/flechette/src/build/table-from-arrays.js","../../ducklings-workers-shared/src/index.ts"],"names":["MAGIC","EOS","Version","Endianness","MessageHeader","Type","Precision","DateUnit","TimeUnit","IntervalUnit","UnionMode","CompressionType","BodyCompressionMethod","uint8Array","uint16Array","uint32Array","uint64Array","int8Array","int16Array","int32Array","int64Array","float32Array","float64Array","isArrayBufferLike","data","intArrayType","bitWidth","signed","i","TypedArray","isTypedArray","value","isArray","isInt64ArrayType","bisect","offsets","index","a","b","mid","align64","length","bpe","align","array","alignedLength","resize","newLength","offset","newArray","grow","shift","isDate","isIterable","check","test","message","checkOneOf","set","keyFor","object","key","val","invalidDataType","typeId","field","name","type","nullable","metadata","isField","isDataType","asField","defaultName","defaultNullable","basicType","dictionary","indexType","ordered","id","int32","nullType","int","int8","int16","int64","uint8","uint16","uint32","uint64","float","precision","float32","float64","binary","utf8","bool","decimal","scale","date","unit","dateDay","time","timestamp","timezone","interval","list","child","struct","children","union","mode","typeIds","typeIdForValue","v","m","fixedSizeBinary","stride","fixedSizeList","mapType","keysSorted","duration","largeBinary","largeUtf8","largeList","runEndEncoded","runsField","valuesField","listView","largeListView","f64","buf","i64","u32","i32","u8","identity","toBigInt","toOffset","toDateDay","toTimestamp","toMonthDayNanoBytes","d","n","toNumber","divide","num","div","toDecimal32","toDecimal","asUint64","fromDecimal64","fromDecimal128","x","fromDecimal256","toFloat16","sign","expo","sigf","textDecoder","textEncoder","decodeUtf8","encodeUtf8","str","keyString","objectKey","s","k","SIZEOF_INT","SIZEOF_SHORT","decodeBit","bitmap","readObject","pos","readInt32","vtable","size","readInt16","read","fallback","off","readOffset","readBoolean","readInt8","readUint8","readUint16","readUint32","readInt64","readString","readVector","extract","base","_","RowIndex","proxyFactory","names","batches","RowObject","structObject","proto","batch","objectFactory","obj","isDirectBatch","DirectBatch","Batch","nullCount","validity","values","sizes","start","end","options","NumberBatch","ArrayBatch","NullBatch","Int64Batch","Float16Batch","BoolBatch","Decimal32NumberBatch","DecimalBatch","DecimalNumberBatch","DecimalBigIntBatch","DateBatch","DateDayBatch","DateDayMillisecondBatch","TimestampSecondBatch","TimestampMillisecondBatch","TimestampMicrosecondBatch","TimestampNanosecondBatch","IntervalDayTimeBatch","IntervalMonthDayNanoBatch","offset32","offset64","BinaryBatch","LargeBinaryBatch","Utf8Batch","LargeUtf8Batch","ListBatch","LargeListBatch","ListViewBatch","LargeListViewBatch","FixedBatch","FixedBinaryBatch","FixedListBatch","pairs","keys","vals","entries","MapEntryBatch","MapBatch","SparseUnionBatch","typeMap","DenseUnionBatch","StructBatch","factory","StructProxyBatch","RunEndEncodedBatch","runs","DictionaryBatch","ViewBatch","BinaryViewBatch","Utf8ViewBatch","columnBuilder","Column","c","batchedIterator","copy","ArrayType","copyArray","extractArray","iter","next","j","Table","_Table","schema","useProxy","f","gen","indices","as","fields","renameField","all","cols","getFactory","numRows","output","row","batchType","useBigInt","useDate","useDecimalInt","useMap","wrap","BaseClass","WrapperClass","writeInt32","writeInt64","INIT_SIZE","Builder","sink","prep","numFields","addFields","objectBuilder","items","itemSize","alignment","writeItem","rootOffset","bytes","buffer","pad","byteCount","builder","additionalBytes","space","minalign","bufSize","used","alignSize","startOffset","slot","defaultValue","vtableOffset","standardFields","len","existingTable","vtables","vt1","outer_loop","vt2","LENGTH_NO_COMPRESSED_DATA","COMPRESS_LENGTH_PREFIX","missingCodec","codecs","getCompressionCodec","decompressBuffer","body","codec","ulen","compressBuffer","compressed","keep","decodeBlock","decodeBlocks","decodeBodyCompression","get","decodeRecordBatch","version","decodeDictionaryBatch","decodeDataType","decodeMetadata","decodeSchema","decodeSchemaFields","fieldsOffset","decodeField","typeOffset","dict","decodeDictionary","decodeFieldChildren","fieldOffset","decodeInt","invalidMessageMetadata","expected","actual","invalidMessageBodyLength","invalidMessageType","decodeMessage","metadataLength","head","bodyLength","content","decoder","decodeIPC","source","isArrowFileFormat","decodeIPCFile","decodeIPCStream","stream","records","dictionaries","dicts","recs","tableFromIPC","createTable","dictionaryMap","context","contextGenerator","dictionaryTypes","visitSchemaFields","isDelta","visit","ctx","visitor","visitField","nodes","regions","compression","variadic","nodeIndex","bufferIndex","variadicIndex","maybeDecompress","region","node","BatchType","encodeRecordBatch","nodeVector","regionVector","variadicVector","count","encodeCompression","method","encodeDictionaryBatch","dictionaryBatch","dataOffset","encodeMetadata","encodeDataType","encodeDictionary","encodeInt","encodeFloat","encodeDecimal","encodeDate","encodeTime","encodeTimestamp","encodeInterval","encodeDuration","encodeFixedSize","encodeMap","encodeUnion","timezoneOffset","typeIdsOffset","isLittleEndian","encodeSchema","fieldOffsets","encodeField","fieldsVectorOffset","metadataOffset","dictionaryOffset","childOffsets","childrenVectorOffset","nameOffset","writeFooter","dictBlocks","recordBlocks","recsOffset","encodeBlock","dictsOffset","schemaOffset","writeMessage","headerType","headerOffset","blocks","prefixSize","messageSize","alignedSize","Sink","MemorySink","bufs","sum","STREAM","FILE","encodeIPC","format","file","writeBuffers","buffers","tableToIPC","table","columns","checkBatchLengths","idMap","assembleDictionaryBatches","assembleRecordBatches","assembleSchema","assembleContext","byteLength","dictMap","dictionaryColumn","assembleRecordBatch","col","visitDictionaries","visitDictType","visitFields","parentType","batchIndex","column","arrayType","Buffer","Bitmap","BatchBuilder","ValidityBuilder","isValid","dictionaryContext","dictionaryValues","valueType","DictionaryBuilder","inferType","profile","profiler","boolCount","numberCount","intCount","bigintCount","dateCount","dayCount","stringCount","arrayCount","structCount","min","max","minLength","maxLength","minBigInt","maxBigInt","arrayProfile","structProfiles","valid","intType","bigintType","unionType","BinaryBuilder","BoolBuilder","DecimalBuilder","FixedSizeBinaryBuilder","FixedSizeListBuilder","IntervalDayTimeBuilder","IntervalMonthDayNanoBuilder","AbstractListBuilder","offsetType","ListBuilder","AbstractStructBuilder","StructBuilder","setters","MapBuilder","MapStructBuilder","keyValuePair","NO_VALUE","RunEndEncodedBuilder","AbstractUnionBuilder","lookup","SparseUnionBuilder","DenseUnionBuilder","Utf8Builder","DirectBuilder","Int64Builder","TransformBuilder","transform","builderContext","columnFromValues","callback","maxBatchRows","opt","nullBatches","limit","numBatches","rem","columnFromArray","columnFromTypedArray","typeForTypedArray","add","idx","tableFromColumns","tableFromArrays","types","DuckDBType","AccessMode","DuckDBError","_DuckDBError","code","query","stripSqlComments","sql","result","DANGEROUS_PATTERNS","checkSql","strippedSql","sanitizeSql","module","initPromise","getModule","init","DuckDBModule","config","imports","receiveInstance","instance","versionPtr","JS_MAX_SAFE_INTEGER_BIGINT","JS_MIN_SAFE_INTEGER_BIGINT","utf8Decoder","toSafeNumberOrString","unsigned","readSignedInt64","mod","wordOffset","readUnsignedInt64","readSignedHugeint","low64","readUnsignedHugeint","stringifyIntegersForArrow","normalizeInt64ValuesForArrow","canDecodeRawColumnData","duckdbType","shouldRepresentAsUtf8Arrow","readInlineOrHeapBytes","structPtr","valuePtr","readInlineOrHeapString","bytesToHex","readBlobHexValue","readTextResultValue","resultPtr","colIdx","rowIdx","strPtr","readTextColumnDataFromResult","rowCount","rowOffset","readTextChunkValue","chunkPtr","readTextColumnDataFromChunk","readColumnData","dataPtr","nullmaskPtr","hasNullmask","days","low","high","micros","millis","PreparedStatement","stmtPtr","_connPtr","valLow","valHigh","ptr","tsLow","tsHigh","errorPtr","errorMsg","columnCount","namePtr","columnData","rows","rowsChanged","stmtPtrPtr","DataChunk","columnIndex","vectorPtr","validityPtr","columnType","r","isRowNull","chunkPtrPtr","StreamingResult","chunk","allRows","colName","chunkData","normalizedChunkData","DuckDB","_DuckDB","finalConfig","configPtrPtr","configPtr","setConfig","dbPtrPtr","errorPtrPtr","connPtrPtr","connPtr","configPtrPtrForDestroy","parts","current","part","text","Connection","status","wasmError","err","error","boolPtr","tableData","fn","tableName","ipcBuffer","bufPtr"],"mappings":";AACO,IAAMA,E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AE5B,IAAM2F,CAAAA,CAAa3F,CAAAA,CAAO,OAAA,CAAQ,CAAC,CAAA,CACnC,GAAI,CACFA,CAAAA,CAAO,QAAA,CAAS2F,CAAAA,CAAY,IAAA,CAAK,OAAA,CAAS,GAAG,CAAA,CAC7C3F,CAAAA,CAAO,KAAA,CAAM,mBAAA,CAAqB,IAAA,CAAM,CAAC,QAAQ,CAAA,CAAG,CAAC2F,CAAU,CAAC,EAClE,CAAA,OAAE,CACA3F,CAAAA,CAAO,KAAA,CAAM2F,CAAU,EACzB,CAEA,IAAA,CAAK,MAAA,CAAS,IAAA,CACd,IAAA,CAAK,OAAA,CAAU,EACjB,CACF","file":"index.cjs","sourcesContent":["/** Magic bytes 'ARROW1' indicating the Arrow 'file' format. */\nexport const MAGIC = Uint8Array.of(65, 82, 82, 79, 87, 49);\n\n/** Bytes for an 'end of stream' message. */\nexport const EOS = Uint8Array.of(255, 255, 255, 255, 0, 0, 0, 0);\n\n/**\n * Apache Arrow version.\n */\nexport const Version = /** @type {const} */ ({\n  /** 0.1.0 (October 2016). */\n  V1: 0,\n  /** 0.2.0 (February 2017). Non-backwards compatible with V1. */\n  V2: 1,\n  /** 0.3.0 -> 0.7.1 (May - December 2017). Non-backwards compatible with V2. */\n  V3: 2,\n  /** >= 0.8.0 (December 2017). Non-backwards compatible with V3. */\n  V4: 3,\n  /**\n   * >= 1.0.0 (July 2020). Backwards compatible with V4 (V5 readers can read V4\n   * metadata and IPC messages). Implementations are recommended to provide a\n   * V4 compatibility mode with V5 format changes disabled.\n   *\n   * Incompatible changes between V4 and V5:\n   * - Union buffer layout has changed.\n   *   In V5, Unions don't have a validity bitmap buffer.\n   */\n  V5: 4\n});\n\n/**\n * Endianness of Arrow-encoded data.\n */\nexport const Endianness = /** @type {const} */ ({\n  Little: 0,\n  Big: 1\n});\n\n/**\n * Message header type codes.\n */\nexport const MessageHeader = /** @type {const} */ ({\n  NONE: 0,\n  /**\n   * A Schema describes the columns in a record batch.\n   */\n  Schema: 1,\n  /**\n   * For sending dictionary encoding information. Any Field can be\n   * dictionary-encoded, but in this case none of its children may be\n   * dictionary-encoded.\n   * There is one vector / column per dictionary, but that vector / column\n   * may be spread across multiple dictionary batches by using the isDelta\n   * flag.\n   */\n  DictionaryBatch: 2,\n  /**\n   * A data header describing the shared memory layout of a \"record\" or \"row\"\n   * batch. Some systems call this a \"row batch\" internally and others a \"record\n   * batch\".\n   */\n  RecordBatch: 3,\n  /**\n   * EXPERIMENTAL: Metadata for n-dimensional arrays, aka \"tensors\" or\n   * \"ndarrays\". Arrow implementations in general are not required to implement\n   * this type.\n   *\n   * Not currently supported by Flechette.\n   */\n  Tensor: 4,\n  /**\n   * EXPERIMENTAL: Metadata for n-dimensional sparse arrays, aka \"sparse\n   * tensors\". Arrow implementations in general are not required to implement\n   * this type.\n   *\n   * Not currently supported by Flechette.\n   */\n  SparseTensor: 5\n});\n\n/**\n * Field data type ids.\n * Only non-negative values ever occur in IPC flatbuffer binary data.\n */\nexport const Type = /** @type {const} */ ({\n  /**\n   * Dictionary types compress data by using a set of integer indices to\n   * lookup potentially repeated vales in a separate dictionary of values.\n   *\n   * This type entry is provided for API convenience, it does not occur\n   * in actual Arrow IPC binary data.\n   */\n  Dictionary: -1,\n  /** No data type. Included for flatbuffer compatibility. */\n  NONE: 0,\n  /** Null values only. */\n  Null: 1,\n  /** Integers, either signed or unsigned, with 8, 16, 32, or 64 bit widths. */\n  Int: 2,\n  /** Floating point numbers with 16, 32, or 64 bit precision. */\n  Float: 3,\n  /** Opaque binary data. */\n  Binary: 4,\n  /** Unicode with UTF-8 encoding. */\n  Utf8: 5,\n  /** Booleans represented as 8 bit bytes. */\n  Bool: 6,\n  /**\n   * Exact decimal value represented as an integer value in two's complement.\n   * Currently only 128-bit (16-byte) and 256-bit (32-byte) integers are used.\n   * The representation uses the endianness indicated in the schema.\n   */\n  Decimal: 7,\n  /**\n   * Date is either a 32-bit or 64-bit signed integer type representing an\n   * elapsed time since UNIX epoch (1970-01-01), stored in either of two units:\n   * - Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no\n   * leap seconds), where the values are evenly divisible by 86400000\n   * - Days (32 bits) since the UNIX epoch\n   */\n  Date: 8,\n  /**\n   * Time is either a 32-bit or 64-bit signed integer type representing an\n   * elapsed time since midnight, stored in either of four units: seconds,\n   * milliseconds, microseconds or nanoseconds.\n   *\n   * The integer `bitWidth` depends on the `unit` and must be one of the following:\n   * - SECOND and MILLISECOND: 32 bits\n   * - MICROSECOND and NANOSECOND: 64 bits\n   *\n   * The allowed values are between 0 (inclusive) and 86400 (=24*60*60) seconds\n   * (exclusive), adjusted for the time unit (for example, up to 86400000\n   * exclusive for the MILLISECOND unit).\n   * This definition doesn't allow for leap seconds. Time values from\n   * measurements with leap seconds will need to be corrected when ingesting\n   * into Arrow (for example by replacing the value 86400 with 86399).\n   */\n  Time: 9,\n  /**\n   * Timestamp is a 64-bit signed integer representing an elapsed time since a\n   * fixed epoch, stored in either of four units: seconds, milliseconds,\n   * microseconds or nanoseconds, and is optionally annotated with a timezone.\n   *\n   * Timestamp values do not include any leap seconds (in other words, all\n   * days are considered 86400 seconds long).\n   *\n   * The timezone is an optional string for the name of a timezone, one of:\n   *\n   *  - As used in the Olson timezone database (the \"tz database\" or\n   *    \"tzdata\"), such as \"America/New_York\".\n   *  - An absolute timezone offset of the form \"+XX:XX\" or \"-XX:XX\",\n   *    such as \"+07:30\".\n   *\n   * Whether a timezone string is present indicates different semantics about\n   * the data.\n   */\n  Timestamp: 10,\n  /**\n   * A \"calendar\" interval which models types that don't necessarily\n   * have a precise duration without the context of a base timestamp (e.g.\n   * days can differ in length during day light savings time transitions).\n   * All integers in the units below are stored in the endianness indicated\n   * by the schema.\n   *\n   *  - YEAR_MONTH - Indicates the number of elapsed whole months, stored as\n   *    4-byte signed integers.\n   *  - DAY_TIME - Indicates the number of elapsed days and milliseconds (no\n   *    leap seconds), stored as 2 contiguous 32-bit signed integers (8-bytes\n   *    in total). Support of this IntervalUnit is not required for full arrow\n   *    compatibility.\n   *  - MONTH_DAY_NANO - A triple of the number of elapsed months, days, and\n   *    nanoseconds. The values are stored contiguously in 16-byte blocks.\n   *    Months and days are encoded as 32-bit signed integers and nanoseconds\n   *    is encoded as a 64-bit signed integer. Nanoseconds does not allow for\n   *    leap seconds. Each field is independent (e.g. there is no constraint\n   *    that nanoseconds have the same sign as days or that the quantity of\n   *    nanoseconds represents less than a day's worth of time).\n   */\n  Interval: 11,\n  /**\n   * List (vector) data supporting variably-sized lists.\n   * A list has a single child data type for list entries.\n   */\n  List: 12,\n  /**\n   * A struct consisting of multiple named child data types.\n   */\n  Struct: 13,\n  /**\n   * A union is a complex type with parallel child data types. By default ids\n   * in the type vector refer to the offsets in the children. Optionally\n   * typeIds provides an indirection between the child offset and the type id.\n   * For each child `typeIds[offset]` is the id used in the type vector.\n   */\n  Union: 14,\n  /**\n   * Binary data where each entry has the same fixed size.\n   */\n  FixedSizeBinary: 15,\n  /**\n   * List (vector) data where every list has the same fixed size.\n   * A list has a single child data type for list entries.\n   */\n  FixedSizeList: 16,\n  /**\n   * A Map is a logical nested type that is represented as\n   * List<entries: Struct<key: K, value: V>>\n   *\n   * In this layout, the keys and values are each respectively contiguous. We do\n   * not constrain the key and value types, so the application is responsible\n   * for ensuring that the keys are hashable and unique. Whether the keys are sorted\n   * may be set in the metadata for this field.\n   *\n   * In a field with Map type, the field has a child Struct field, which then\n   * has two children: key type and the second the value type. The names of the\n   * child fields may be respectively \"entries\", \"key\", and \"value\", but this is\n   * not enforced.\n   *\n   * Map\n   * ```text\n   *   - child[0] entries: Struct\n   *   - child[0] key: K\n   *   - child[1] value: V\n   *  ```\n   * Neither the \"entries\" field nor the \"key\" field may be nullable.\n   *\n   * The metadata is structured so that Arrow systems without special handling\n   * for Map can make Map an alias for List. The \"layout\" attribute for the Map\n   * field must have the same contents as a List.\n   */\n  Map: 17,\n  /**\n   * An absolute length of time unrelated to any calendar artifacts. For the\n   * purposes of Arrow implementations, adding this value to a Timestamp\n   * (\"t1\") naively (i.e. simply summing the two numbers) is acceptable even\n   * though in some cases the resulting Timestamp (t2) would not account for\n   * leap-seconds during the elapsed time between \"t1\" and \"t2\". Similarly,\n   * representing the difference between two Unix timestamp is acceptable, but\n   * would yield a value that is possibly a few seconds off from the true\n   * elapsed time.\n   *\n   * The resolution defaults to millisecond, but can be any of the other\n   * supported TimeUnit values as with Timestamp and Time types. This type is\n   * always represented as an 8-byte integer.\n   */\n  Duration: 18,\n  /**\n   * Same as Binary, but with 64-bit offsets, allowing representation of\n   * extremely large data values.\n   */\n  LargeBinary: 19,\n  /**\n   * Same as Utf8, but with 64-bit offsets, allowing representation of\n   * extremely large data values.\n   */\n  LargeUtf8: 20,\n  /**\n   * Same as List, but with 64-bit offsets, allowing representation of\n   * extremely large data values.\n   */\n  LargeList: 21,\n  /**\n   * Contains two child arrays, run_ends and values. The run_ends child array\n   * must be a 16/32/64-bit integer array which encodes the indices at which\n   * the run with the value in each corresponding index in the values child\n   * array ends. Like list/struct types, the value array can be of any type.\n   */\n  RunEndEncoded: 22,\n  /**\n   * Logically the same as Binary, but the internal representation uses a view\n   * struct that contains the string length and either the string's entire data\n   * inline (for small strings) or an inlined prefix, an index of another buffer,\n   * and an offset pointing to a slice in that buffer (for non-small strings).\n   *\n   * Since it uses a variable number of data buffers, each Field with this type\n   * must have a corresponding entry in `variadicBufferCounts`.\n   */\n  BinaryView: 23,\n  /**\n   * Logically the same as Utf8, but the internal representation uses a view\n   * struct that contains the string length and either the string's entire data\n   * inline (for small strings) or an inlined prefix, an index of another buffer,\n   * and an offset pointing to a slice in that buffer (for non-small strings).\n   *\n   * Since it uses a variable number of data buffers, each Field with this type\n   * must have a corresponding entry in `variadicBufferCounts`.\n   */\n  Utf8View: 24,\n  /**\n   * Represents the same logical types that List can, but contains offsets and\n   * sizes allowing for writes in any order and sharing of child values among\n   * list values.\n   */\n  ListView: 25,\n  /**\n   * Same as ListView, but with 64-bit offsets and sizes, allowing to represent\n   * extremely large data values.\n   */\n  LargeListView: 26\n});\n\n/**\n * Floating point number precision.\n */\nexport const Precision = /** @type {const} */ ({\n  /** 16-bit floating point number. */\n  HALF: 0,\n  /** 32-bit floating point number. */\n  SINGLE: 1,\n  /** 64-bit floating point number. */\n  DOUBLE: 2\n});\n\n/**\n * Date units.\n */\nexport const DateUnit = /** @type {const} */ ({\n  /* Days (as 32 bit int) since the UNIX epoch. */\n  DAY: 0,\n  /**\n   * Milliseconds (as 64 bit int) indicating UNIX time elapsed since the epoch\n   * (no leap seconds), with values evenly divisible by 86400000.\n   */\n  MILLISECOND: 1\n});\n\n/**\n * Time units.\n */\nexport const TimeUnit = /** @type {const} */ ({\n  /** Seconds. */\n  SECOND: 0,\n  /** Milliseconds. */\n  MILLISECOND: 1,\n  /** Microseconds. */\n  MICROSECOND: 2,\n  /** Nanoseconds. */\n  NANOSECOND: 3\n});\n\n/**\n * Date/time interval units.\n */\nexport const IntervalUnit = /** @type {const} */ ({\n  /**\n   * Indicates the number of elapsed whole months, stored as 4-byte signed\n   * integers.\n   */\n  YEAR_MONTH: 0,\n  /**\n   * Indicates the number of elapsed days and milliseconds (no leap seconds),\n   * stored as 2 contiguous 32-bit signed integers (8-bytes in total). Support\n   * of this IntervalUnit is not required for full arrow compatibility.\n   */\n  DAY_TIME: 1,\n  /**\n   * A triple of the number of elapsed months, days, and nanoseconds.\n   * The values are stored contiguously in 16-byte blocks. Months and days are\n   * encoded as 32-bit signed integers and nanoseconds is encoded as a 64-bit\n   * signed integer. Nanoseconds does not allow for leap seconds. Each field is\n   * independent (e.g. there is no constraint that nanoseconds have the same\n   * sign as days or that the quantity of nanoseconds represents less than a\n   * day's worth of time).\n   */\n  MONTH_DAY_NANO: 2\n});\n\n/**\n * Union type modes.\n */\nexport const UnionMode = /** @type {const} */ ({\n  /** Sparse union layout with full arrays for each sub-type. */\n  Sparse: 0,\n  /** Dense union layout with offsets into value arrays. */\n  Dense: 1\n});\n\n/**\n * Compression types.\n */\nexport const CompressionType = /** @type {const} */ ({\n  /**\n   * LZ4 frame compression.\n   * Not to be confused with \"raw\" (also called \"block\") format.\n   */\n  LZ4_FRAME: 0,\n  /** Zstandard compression. */\n  ZSTD: 1\n});\n\n/**\n * Body compression methods.\n * Provided for forward compatibility in case Arrow needs to support\n * different strategies for compressing the IPC message body (like\n * whole-body compression rather than buffer-level) in the future.\n */\nexport const BodyCompressionMethod = /** @type {const} */ ({\n  /**\n   * Each constituent buffer is first compressed with the indicated\n   * compressor, and then written with the uncompressed length in the first 8\n   * bytes as a 64-bit little-endian signed integer followed by the compressed\n   * buffer bytes (and then padding as required by the protocol). The\n   * uncompressed length may be set to -1 to indicate that the data that\n   * follows is not compressed, which can be useful for cases where\n   * compression does not yield appreciable savings.\n   */\n  BUFFER: 0\n});\n","/**\n * @import { Int64ArrayConstructor, IntArrayConstructor, IntegerArray, TypedArray } from '../types.js'\n */\nexport const uint8Array = Uint8Array;\nexport const uint16Array = Uint16Array;\nexport const uint32Array = Uint32Array;\nexport const uint64Array = BigUint64Array;\nexport const int8Array = Int8Array;\nexport const int16Array = Int16Array;\nexport const int32Array = Int32Array;\nexport const int64Array = BigInt64Array;\nexport const float32Array = Float32Array;\nexport const float64Array = Float64Array;\n\n/**\n * Check if an input value is an ArrayBuffer or SharedArrayBuffer.\n * @param {unknown} data\n * @returns {data is ArrayBufferLike}\n */\nexport function isArrayBufferLike(data) {\n  return data instanceof ArrayBuffer || (\n    typeof SharedArrayBuffer !== 'undefined' &&\n    data instanceof SharedArrayBuffer\n  );\n}\n\n/**\n * Return the appropriate typed array constructor for the given\n * integer type metadata.\n * @param {number} bitWidth The integer size in bits.\n * @param {boolean} signed Flag indicating if the integer is signed.\n * @returns {IntArrayConstructor}\n */\nexport function intArrayType(bitWidth, signed) {\n  const i = Math.log2(bitWidth) - 3;\n  return (\n    signed\n      ? [int8Array, int16Array, int32Array, int64Array]\n      : [uint8Array, uint16Array, uint32Array, uint64Array]\n  )[i];\n}\n\n/** Shared prototype for typed arrays. */\nconst TypedArray = Object.getPrototypeOf(Int8Array);\n\n/**\n * Check if a value is a typed array.\n * @param {*} value The value to check.\n * @returns {value is TypedArray}\n *  True if value is a typed array, false otherwise.\n */\nexport function isTypedArray(value) {\n  return value instanceof TypedArray;\n}\n\n/**\n * Check if a value is either a standard array or typed array.\n * @param {*} value The value to check.\n * @returns {value is (Array | TypedArray)}\n *  True if value is an array, false otherwise.\n */\nexport function isArray(value) {\n  return Array.isArray(value) || isTypedArray(value);\n}\n\n/**\n * Check if a value is an array type (constructor) for 64-bit integers,\n * one of BigInt64Array or BigUint64Array.\n * @param {*} value The value to check.\n * @returns {value is Int64ArrayConstructor}\n *  True if value is a 64-bit array type, false otherwise.\n */\nexport function isInt64ArrayType(value) {\n  return value === int64Array || value === uint64Array;\n}\n\n/**\n * Determine the correct index into an offset array for a given\n * full column row index. Assumes offset indices can be manipulated\n * as 32-bit signed integers.\n * @param {IntegerArray} offsets The offsets array.\n * @param {number} index The full column row index.\n */\nexport function bisect(offsets, index) {\n  let a = 0;\n  let b = offsets.length;\n  if (b <= 2147483648) { // 2 ** 31\n    // fast version, use unsigned bit shift\n    // array length fits within 32-bit signed integer\n    do {\n      const mid = (a + b) >>> 1;\n      if (offsets[mid] <= index) a = mid + 1;\n      else b = mid;\n    } while (a < b);\n  } else {\n    // slow version, use division and truncate\n    // array length exceeds 32-bit signed integer\n    do {\n      const mid = Math.trunc((a + b) / 2);\n      if (offsets[mid] <= index) a = mid + 1;\n      else b = mid;\n    } while (a < b);\n  }\n  return a;\n}\n\n/**\n * Compute a 64-bit aligned buffer size.\n * @param {number} length The starting size.\n * @param {number} bpe Bytes per element.\n * @returns {number} The aligned size.\n */\nfunction align64(length, bpe = 1) {\n  return (((length * bpe) + 7) & ~7) / bpe;\n}\n\n/**\n * Return a 64-bit aligned version of the array.\n * @template {TypedArray} T\n * @param {T} array The array.\n * @param {number} length The current array length.\n * @returns {T} The aligned array.\n */\nexport function align(array, length = array.length) {\n  const alignedLength = align64(length, array.BYTES_PER_ELEMENT);\n  return array.length > alignedLength ? /** @type {T} */ (array.subarray(0, alignedLength))\n    : array.length < alignedLength ? resize(array, alignedLength)\n    : array;\n}\n\n/**\n * Resize a typed array to exactly the specified length.\n * @template {TypedArray} T\n * @param {T} array The array.\n * @param {number} newLength The new length.\n * @param {number} [offset] The offset at which to copy the old array.\n * @returns {T} The resized array.\n */\nexport function resize(array, newLength, offset = 0) {\n  // @ts-ignore\n  const newArray = new array.constructor(newLength);\n  newArray.set(array, offset);\n  return newArray;\n}\n\n/**\n * Grow a typed array to accommdate a minimum index. The array size is\n * doubled until it exceeds the minimum index.\n * @template {TypedArray} T\n * @param {T} array The array.\n * @param {number} index The minimum index.\n * @param {boolean} [shift] Flag to shift copied bytes to back of array.\n * @returns {T} The resized array.\n */\nexport function grow(array, index, shift) {\n  while (array.length <= index) {\n    array = resize(array, array.length << 1, shift ? array.length : 0);\n  }\n  return array;\n}\n","/**\n * Check if a value is a Date instance\n * @param {*} value The value to check.\n * @returns {value is Date} True if value is a Date, false otherwise.\n */\nexport function isDate(value) {\n  return value instanceof Date;\n}\n\n/**\n * Check if a value is iterable.\n * @param {*} value The value to check.\n * @returns {value is Iterable} True if value is iterable, false otherwise.\n */\nexport function isIterable(value) {\n  return typeof value[Symbol.iterator] === 'function';\n}\n\n/**\n * Return the input value if it passes a test.\n * Otherwise throw an error using the given message generator.\n * @template T\n * @param {T} value The value to check.\n * @param {(value: T) => boolean} test The test function.\n * @param {(value: *) => string} message Message generator.\n * @returns {T} The input value.\n * @throws if the value does not pass the test\n */\nexport function check(value, test, message) {\n  if (test(value)) return value;\n  throw new Error(message(value));\n}\n\n/**\n * Return the input value if it exists in the provided set.\n * Otherwise throw an error using the given message generator.\n * @template T\n * @param {T} value The value to check.\n * @param {T[] | Record<string,T>} set The set of valid values.\n * @param {(value: *) => string} [message] Message generator.\n * @returns {T} The input value.\n * @throws if the value is not included in the set\n */\nexport function checkOneOf(value, set, message) {\n  set = Array.isArray(set) ? set : Object.values(set);\n  return check(\n    value,\n    (value) => set.includes(value),\n    message ?? (() => `${value} must be one of ${set}`)\n  );\n}\n\n/**\n * Return the first object key that pairs with the given value.\n * @param {Record<string,any>} object The object to search.\n * @param {any} value The value to lookup.\n * @returns {string} The first matching key, or '<Unknown>' if not found.\n */\nexport function keyFor(object, value) {\n  for (const [key, val] of Object.entries(object)) {\n    if (val === value) return key;\n  }\n  return '<Unknown>';\n}\n","/**\n * @import { BinaryType, BinaryViewType, BoolType, DataType, DateType, DateUnit_, DecimalType, DictionaryType, DurationType, Field, FixedSizeBinaryType, FixedSizeListType, FloatType, IntBitWidth, IntervalType, IntervalUnit_, IntType, LargeBinaryType, LargeListType, LargeListViewType, LargeUtf8Type, ListType, ListViewType, MapType, NullType, Precision_, RunEndEncodedType, StructType, TimestampType, TimeType, TimeUnit_, UnionMode_, UnionType, Utf8Type, Utf8ViewType } from './types.js'\n */\nimport { DateUnit, IntervalUnit, Precision, TimeUnit, Type, UnionMode } from './constants.js';\nimport { intArrayType, float32Array, float64Array, int32Array, int64Array, uint16Array, uint64Array } from './util/arrays.js';\nimport { check, checkOneOf, keyFor } from './util/objects.js';\n\n/**\n * @typedef {Field | DataType} FieldInput\n */\n\nexport const invalidDataType = (typeId) =>\n  `Unsupported data type: \"${keyFor(Type, typeId)}\" (id ${typeId})`;\n\n/**\n * Return a new field instance for use in a schema or type definition. A field\n * represents a field name, data type, and additional metadata. Fields are used\n * to represent child types within nested types like List, Struct, and Union.\n * @param {string} name The field name.\n * @param {DataType} type The field data type.\n * @param {boolean} [nullable=true] Flag indicating if the field is nullable\n *  (default `true`).\n * @param {Map<string,string>|null} [metadata=null] Custom field metadata\n *  annotations (default `null`).\n * @returns {Field} The field instance.\n */\nexport const field = (name, type, nullable = true, metadata = null) => ({\n  name,\n  type,\n  nullable,\n  metadata\n});\n\n/**\n * Checks if a value is a field instance.\n * @param {any} value\n * @returns {value is Field}\n */\nfunction isField(value) {\n  return Object.hasOwn(value, 'name') && isDataType(value.type)\n}\n\n/**\n * Checks if a value is a data type instance.\n * @param {any} value\n * @returns {value is DataType}\n */\nfunction isDataType(value) {\n  return typeof value?.typeId === 'number';\n}\n\n/**\n * Return a field instance from a field or data type input.\n * @param {FieldInput} value\n *  The value to map to a field.\n * @param {string} [defaultName] The default field name.\n * @param {boolean} [defaultNullable=true] The default nullable value.\n * @returns {Field} The field instance.\n */\nfunction asField(value, defaultName = '', defaultNullable = true) {\n  return isField(value)\n    ? value\n    : field(\n        defaultName,\n        check(value, isDataType, () => `Data type expected.`),\n        defaultNullable\n      );\n}\n\n/////\n\n/**\n * Return a basic type with only a type id.\n * @template {typeof Type[keyof typeof Type]} T\n * @param {T} typeId The type id.\n */\nconst basicType = (typeId) => ({ typeId });\n\n/**\n * Return a Dictionary data type instance.  A dictionary type consists of a\n * dictionary of values (which may be of any type) and corresponding integer\n * indices that reference those values. If values are repeated, a dictionary\n * encoding can provide substantial space savings. In the IPC format,\n * dictionary indices reside alongside other columns in a record batch, while\n * dictionary values are written to special dictionary batches, linked by a\n * unique dictionary *id*.\n * @param {DataType} type The data type of dictionary\n *  values.\n * @param {IntType} [indexType] The data type of\n *  dictionary indices. Must be an integer type (default `int32`).\n * @param {boolean} [ordered=false] Indicates if dictionary values are\n *  ordered (default `false`).\n * @param {number} [id=-1] The dictionary id. The default value (-1) indicates\n *  the dictionary applies to a single column only. Provide an explicit id in\n *  order to reuse a dictionary across columns when building, in which case\n *  different dictionaries *must* have different unique ids. All dictionary\n *  ids are later resolved (possibly to new values) upon IPC encoding.\n * @returns {DictionaryType}\n */\nexport const dictionary = (type, indexType, ordered = false, id = -1) => ({\n  typeId: Type.Dictionary,\n  id,\n  dictionary: type,\n  indices: indexType || int32(),\n  ordered\n});\n\n/**\n * Return a Null data type instance. Null data requires no storage and all\n * extracted values are `null`.\n * @returns {NullType} The null data type.\n */\nexport const nullType = () => basicType(Type.Null);\n\n/**\n * Return an Int data type instance.\n * @param {IntBitWidth} [bitWidth=32] The integer bit width.\n *  One of `8`, `16`, `32` (default), or `64`.\n * @param {boolean} [signed=true] Flag for signed or unsigned integers\n *  (default `true`).\n * @returns {IntType} The integer data type.\n */\nexport const int = (bitWidth = 32, signed = true) => ({\n  typeId: Type.Int,\n  bitWidth: checkOneOf(bitWidth, [8, 16, 32, 64]),\n  signed,\n  values: intArrayType(bitWidth, signed)\n});\n/**\n * Return an Int data type instance for 8 bit signed integers.\n * @returns {IntType} The integer data type.\n */\nexport const int8 = () => int(8);\n/**\n * Return an Int data type instance for 16 bit signed integers.\n * @returns {IntType} The integer data type.\n */\nexport const int16 = () => int(16);\n/**\n * Return an Int data type instance for 32 bit signed integers.\n * @returns {IntType} The integer data type.\n */\nexport const int32 = () => int(32);\n/**\n * Return an Int data type instance for 64 bit signed integers.\n * @returns {IntType} The integer data type.\n */\nexport const int64 = () => int(64);\n/**\n * Return an Int data type instance for 8 bit unsigned integers.\n * @returns {IntType} The integer data type.\n */\nexport const uint8 = () => int(8, false);\n/**\n * Return an Int data type instance for 16 bit unsigned integers.\n * @returns {IntType} The integer data type.\n */\nexport const uint16 = () => int(16, false);\n/**\n * Return an Int data type instance for 32 bit unsigned integers.\n * @returns {IntType} The integer data type.\n */\nexport const uint32 = () => int(32, false);\n/**\n * Return an Int data type instance for 64 bit unsigned integers.\n * @returns {IntType} The integer data type.\n */\nexport const uint64 = () => int(64, false);\n\n/**\n * Return a Float data type instance for floating point numbers.\n * @param {Precision_} [precision=2] The floating point\n *  precision. One of `Precision.HALF` (16-bit), `Precision.SINGLE` (32-bit)\n *  or `Precision.DOUBLE` (64-bit, default).\n * @returns {FloatType} The floating point data type.\n */\nexport const float = (precision = 2) => ({\n  typeId: Type.Float,\n  precision: checkOneOf(precision, Precision),\n  values: [uint16Array, float32Array, float64Array][precision]\n});\n/**\n * Return a Float data type instance for half-precision (16 bit) numbers.\n * @returns {FloatType} The floating point data type.\n */\nexport const float16 = () => float(Precision.HALF);\n/**\n * Return a Float data type instance for single-precision (32 bit) numbers.\n * @returns {FloatType} The floating point data type.\n */\nexport const float32 = () => float(Precision.SINGLE);\n/**\n * Return a Float data type instance for double-precision (64 bit) numbers.\n * @returns {FloatType} The floating point data type.\n */\nexport const float64 = () => float(Precision.DOUBLE);\n\n/**\n * Return a Binary data type instance for variably-sized opaque binary data\n * with 32-bit offsets.\n * @returns {BinaryType} The binary data type.\n */\nexport const binary = () => ({\n  typeId: Type.Binary,\n  offsets: int32Array\n});\n\n/**\n * Return a Utf8 data type instance for Unicode string data.\n * [UTF-8](https://en.wikipedia.org/wiki/UTF-8) code points are stored as\n * binary data.\n * @returns {Utf8Type} The utf8 data type.\n */\nexport const utf8 = () => ({\n  typeId: Type.Utf8,\n  offsets: int32Array\n});\n\n/**\n * Return a Bool data type instance. Bool values are stored compactly in\n * bitmaps with eight values per byte.\n * @returns {BoolType} The bool data type.\n */\nexport const bool = () => basicType(Type.Bool);\n\n/**\n * Return a Decimal data type instance. Decimal values are represented as 32,\n * 64, 128, or 256 bit integers in two's complement. Decimals are fixed point\n * numbers with a set *precision* (total number of decimal digits) and *scale*\n * (number of fractional digits). For example, the number `35.42` can be\n * represented as `3542` with *precision* ≥ 4 and *scale* = 2.\n * @param {number} precision The decimal precision: the total number of\n *  decimal digits that can be represented.\n * @param {number} scale The number of fractional digits, beyond the\n *  decimal point.\n * @param {32 | 64 | 128 | 256} [bitWidth] The decimal bit width.\n *  One of 32, 64, 128 (default), or 256.\n * @returns {DecimalType} The decimal data type.\n */\nexport const decimal = (precision, scale, bitWidth = 128) => ({\n  typeId: Type.Decimal,\n  precision,\n  scale,\n  bitWidth: checkOneOf(bitWidth, [32, 64, 128, 256]),\n  values: bitWidth === 32 ? int32Array : uint64Array\n});\n/**\n * Return an Decimal data type instance with a bit width of 32.\n * @param {number} precision The decimal precision: the total number of\n *  decimal digits that can be represented.\n * @param {number} scale The number of fractional digits, beyond the\n *  decimal point.\n * @returns {DecimalType} The decimal data type.\n */\nexport const decimal32 = (precision, scale) => decimal(precision, scale, 32);\n/**\n * Return an Decimal data type instance with a bit width of 64.\n * @param {number} precision The decimal precision: the total number of\n *  decimal digits that can be represented.\n * @param {number} scale The number of fractional digits, beyond the\n *  decimal point.\n * @returns {DecimalType} The decimal data type.\n */\nexport const decimal64 = (precision, scale) => decimal(precision, scale, 64);\n/**\n * Return an Decimal data type instance with a bit width of 128.\n * @param {number} precision The decimal precision: the total number of\n *  decimal digits that can be represented.\n * @param {number} scale The number of fractional digits, beyond the\n *  decimal point.\n * @returns {DecimalType} The decimal data type.\n */\nexport const decimal128 = (precision, scale) => decimal(precision, scale, 128);\n/**\n * Return an Decimal data type instance with a bit width of 256.\n * @param {number} precision The decimal precision: the total number of\n *  decimal digits that can be represented.\n * @param {number} scale The number of fractional digits, beyond the\n *  decimal point.\n * @returns {DecimalType} The decimal data type.\n */\nexport const decimal256 = (precision, scale) => decimal(precision, scale, 256);\n\n/**\n * Return a Date data type instance. Date values are 32-bit or 64-bit signed\n * integers representing elapsed time since the UNIX epoch (Jan 1, 1970 UTC),\n * either in units of days (32 bits) or milliseconds (64 bits, with values\n * evenly divisible by 86400000).\n * @param {DateUnit_} unit The date unit.\n *  One of `DateUnit.DAY` or `DateUnit.MILLISECOND`.\n * @returns {DateType} The date data type.\n */\nexport const date = (unit) => ({\n  typeId: Type.Date,\n  unit: checkOneOf(unit, DateUnit),\n  values: unit === DateUnit.DAY ? int32Array : int64Array\n});\n/**\n * Return a Date data type instance with units of days.\n * @returns {DateType} The date data type.\n */\nexport const dateDay = () => date(DateUnit.DAY);\n/**\n * Return a Date data type instance with units of milliseconds.\n * @returns {DateType} The date data type.\n */\nexport const dateMillisecond = () => date(DateUnit.MILLISECOND);\n\n/**\n * Return a Time data type instance, stored in one of four *unit*s: seconds,\n * milliseconds, microseconds or nanoseconds. The integer *bitWidth* is\n * inferred from the *unit* and is 32 bits for seconds and milliseconds or\n * 64 bits for microseconds and nanoseconds. The allowed values are between 0\n * (inclusive) and 86400 (=24*60*60) seconds (exclusive), adjusted for the\n * time unit (for example, up to 86400000 exclusive for the\n * `DateUnit.MILLISECOND` unit.\n *\n * This definition doesn't allow for leap seconds. Time values from\n * measurements with leap seconds will need to be corrected when ingesting\n * into Arrow (for example by replacing the value 86400 with 86399).\n * @param {TimeUnit_} unit The time unit.\n *  One of `TimeUnit.SECOND`, `TimeUnit.MILLISECOND` (default),\n *  `TimeUnit.MICROSECOND`, or `TimeUnit.NANOSECOND`.\n * @returns {TimeType} The time data type.\n */\nexport const time = (unit = TimeUnit.MILLISECOND) => {\n  unit = checkOneOf(unit, TimeUnit);\n  const bitWidth = unit === TimeUnit.SECOND || unit === TimeUnit.MILLISECOND ? 32 : 64;\n  return {\n    typeId: Type.Time,\n    unit,\n    bitWidth,\n    values: bitWidth === 32 ? int32Array : int64Array\n  };\n};\n/**\n * Return a Time data type instance, represented as seconds.\n * @returns {TimeType} The time data type.\n */\nexport const timeSecond = () => time(TimeUnit.SECOND);\n/**\n * Return a Time data type instance, represented as milliseconds.\n * @returns {TimeType} The time data type.\n */\nexport const timeMillisecond = () => time(TimeUnit.MILLISECOND);\n/**\n * Return a Time data type instance, represented as microseconds.\n * @returns {TimeType} The time data type.\n */\nexport const timeMicrosecond = () => time(TimeUnit.MICROSECOND);\n/**\n * Return a Time data type instance, represented as nanoseconds.\n * @returns {TimeType} The time data type.\n */\nexport const timeNanosecond = () => time(TimeUnit.NANOSECOND);\n\n/**\n * Return a Timestamp data type instance. Timestamp values are 64-bit signed\n * integers representing an elapsed time since a fixed epoch, stored in either\n * of four units: seconds, milliseconds, microseconds or nanoseconds, and are\n * optionally annotated with a timezone. Timestamp values do not include any\n * leap seconds (in other words, all days are considered 86400 seconds long).\n * @param {TimeUnit_} [unit] The time unit.\n *  One of `TimeUnit.SECOND`, `TimeUnit.MILLISECOND` (default),\n *  `TimeUnit.MICROSECOND`, or `TimeUnit.NANOSECOND`.\n * @param {string|null} [timezone=null] An optional string for the name of a\n *  timezone. If provided, the value should either be a string as used in the\n *  Olson timezone database (the \"tz database\" or \"tzdata\"), such as\n *  \"America/New_York\", or an absolute timezone offset of the form \"+XX:XX\" or\n *  \"-XX:XX\", such as \"+07:30\".Whether a timezone string is present indicates\n *  different semantics about the data.\n * @returns {TimestampType} The time data type.\n */\nexport const timestamp = (unit = TimeUnit.MILLISECOND, timezone = null) => ({\n  typeId: Type.Timestamp,\n  unit: checkOneOf(unit, TimeUnit),\n  timezone,\n  values: int64Array\n});\n\n/**\n * Return an Interval type instance. Values represent calendar intervals stored\n * as integers for each date part. The supported *unit*s are year/moth,\n * day/time, and month/day/nanosecond intervals.\n *\n * `IntervalUnit.YEAR_MONTH` indicates the number of elapsed whole months,\n * stored as 32-bit signed integers.\n *\n * `IntervalUnit.DAY_TIME` indicates the number of elapsed days and\n * milliseconds (no leap seconds), stored as 2 contiguous 32-bit signed\n * integers (8-bytes in total).\n *\n * `IntervalUnit.MONTH_DAY_NANO` is a triple of the number of elapsed months,\n * days, and nanoseconds. The values are stored contiguously in 16-byte blocks.\n * Months and days are encoded as 32-bit signed integers and nanoseconds is\n * encoded as a 64-bit signed integer. Nanoseconds does not allow for leap\n * seconds. Each field is independent (e.g. there is no constraint that\n * nanoseconds have the same sign as days or that the quantity of nanoseconds\n * represents less than a day's worth of time).\n * @param {IntervalUnit_} unit  The interval unit.\n *  One of `IntervalUnit.YEAR_MONTH`, `IntervalUnit.DAY_TIME`, or\n *  `IntervalUnit.MONTH_DAY_NANO` (default).\n * @returns {IntervalType} The interval data type.\n */\nexport const interval = (unit = IntervalUnit.MONTH_DAY_NANO) => ({\n  typeId: Type.Interval,\n  unit: checkOneOf(unit, IntervalUnit),\n  values: unit === IntervalUnit.MONTH_DAY_NANO ? undefined : int32Array\n});\n\n/**\n * Return a List data type instance, representing variably-sized lists\n * (arrays) with 32-bit offsets. A list has a single child data type for\n * list entries. Lists are represented using integer offsets that indicate\n * list extents within a single child array containing all list values.\n * @param {FieldInput} child The child (list item) field or data type.\n * @returns {ListType} The list data type.\n */\nexport const list = (child) => ({\n  typeId: Type.List,\n  children: [ asField(child) ],\n  offsets: int32Array\n});\n\n/**\n * Return a Struct data type instance. A struct consists of multiple named\n * child data types. Struct values are stored as parallel child batches, one\n * per child type, and extracted to standard JavaScript objects.\n * @param {Field[] | Record<string, DataType>} children\n *  An array of property fields, or an object mapping property names to data\n *  types. If an object, the instantiated fields are assumed to be nullable\n *  and have no metadata.\n * @returns {StructType} The struct data type.\n */\nexport const struct = (children) => ({\n  typeId: Type.Struct,\n  children: Array.isArray(children) && children.length > 0 && isField(children[0])\n    ? /** @type {Field[]} */ (children)\n    : Object.entries(children).map(([name, type]) => field(name, type))\n});\n\n/**\n * Return a Union type instance. A union is a complex type with parallel\n * *children* data types. Union values are stored in either a sparse\n * (`UnionMode.Sparse`) or dense (`UnionMode.Dense`) layout *mode*. In a\n * sparse layout, child types are stored in parallel arrays with the same\n * lengths, resulting in many unused, empty values. In a dense layout, child\n * types have variable lengths and an offsets array is used to index the\n * appropriate value.\n *\n * By default, ids in the type vector refer to the index in the children\n * array. Optionally, *typeIds* provide an indirection between the child\n * index and the type id. For each child, `typeIds[index]` is the id used\n * in the type vector. The *typeIdForValue* argument provides a lookup\n * function for mapping input data to the proper child type id, and is\n * required if using builder methods.\n * @param {UnionMode_} mode The union mode.\n *  One of `UnionMode.Sparse` or `UnionMode.Dense`.\n * @param {FieldInput[]} children The children fields or data types.\n *  Types are mapped to nullable fields with no metadata.\n * @param {number[]} [typeIds]  Children type ids, in the same order as the\n *  children types. Type ids provide a level of indirection over children\n *  types. If not provided, the children indices are used as the type ids.\n * @param {(value: any, index: number) => number} [typeIdForValue]\n *  A function that takes an arbitrary value and a row index and returns a\n *  correponding union type id. Required by builder methods.\n * @returns {UnionType} The union data type.\n */\nexport const union = (mode, children, typeIds, typeIdForValue) => {\n  typeIds ??= children.map((v, i) => i);\n  return {\n    typeId: Type.Union,\n    mode: checkOneOf(mode, UnionMode),\n    typeIds,\n    typeMap: typeIds.reduce((m, id, i) => ((m[id] = i), m), {}),\n    children: children.map((v, i) => asField(v, `_${i}`)),\n    typeIdForValue,\n    offsets: int32Array,\n  };\n};\n\n/**\n * Create a FixedSizeBinary data type instance for opaque binary data where\n * each entry has the same fixed size.\n * @param {number} stride The fixed size in bytes.\n * @returns {FixedSizeBinaryType} The fixed size binary data type.\n */\nexport const fixedSizeBinary = (stride) => ({\n  typeId: Type.FixedSizeBinary,\n  stride\n});\n\n/**\n * Return a FixedSizeList type instance for list (array) data where every list\n * has the same fixed size. A list has a single child data type for list\n * entries. Fixed size lists are represented as a single child array containing\n * all list values, indexed using the known stride.\n * @param {FieldInput} child The list item data type.\n * @param {number} stride The fixed list size.\n * @returns {FixedSizeListType} The fixed size list data type.\n */\nexport const fixedSizeList = (child, stride) => ({\n  typeId: Type.FixedSizeList,\n  stride,\n  children: [ asField(child) ]\n});\n\n/**\n * Internal method to create a Map type instance.\n * @param {boolean} keysSorted Flag indicating if the map keys are sorted.\n * @param {Field} child The child fields.\n * @returns {MapType} The map data type.\n */\nexport const mapType = (keysSorted, child) => ({\n  typeId: Type.Map,\n  keysSorted,\n  children: [child],\n  offsets: int32Array\n});\n\n/**\n * Return a Map data type instance representing collections of key-value pairs.\n * A Map is a logical nested type that is represented as a list of key-value\n * structs. The key and value types are not constrained, so the application is\n * responsible for ensuring that the keys are hashable and unique, and that\n * keys are properly sorted if *keysSorted* is `true`.\n * @param {FieldInput} keyField The map key field or data type.\n * @param {FieldInput} valueField The map value field or data type.\n * @param {boolean} [keysSorted=false] Flag indicating if the map keys are\n *  sorted (default `false`).\n * @returns {MapType} The map data type.\n */\nexport const map = (keyField, valueField, keysSorted = false) => mapType(\n  keysSorted,\n  field(\n    'entries',\n    struct([ asField(keyField, 'key', false), asField(valueField, 'value') ]),\n    false\n  )\n);\n\n/**\n * Return a Duration data type instance. Durations represent an absolute length\n * of time unrelated to any calendar artifacts. The resolution defaults to\n * millisecond, but can be any of the other `TimeUnit` values. This type is\n * always represented as a 64-bit integer.\n * @param {TimeUnit_} unit\n * @returns {DurationType} The duration data type.\n */\nexport const duration = (unit = TimeUnit.MILLISECOND) => ({\n  typeId: Type.Duration,\n  unit: checkOneOf(unit, TimeUnit),\n  values: int64Array\n});\n\n/**\n * Return a LargeBinary data type instance for variably-sized opaque binary\n * data with 64-bit offsets, allowing representation of extremely large data\n * values.\n * @returns {LargeBinaryType} The large binary data type.\n */\nexport const largeBinary = () => ({\n  typeId: Type.LargeBinary,\n  offsets: int64Array\n});\n\n/**\n * Return a LargeUtf8 data type instance for Unicode string data of variable\n * length with 64-bit offsets, allowing representation of extremely large data\n * values. [UTF-8](https://en.wikipedia.org/wiki/UTF-8) code points are stored\n * as binary data.\n * @returns {LargeUtf8Type} The large utf8 data type.\n */\nexport const largeUtf8 = () => ({\n  typeId: Type.LargeUtf8,\n  offsets: int64Array\n});\n\n/**\n * Return a LargeList data type instance, representing variably-sized lists\n * (arrays) with 64-bit offsets, allowing representation of extremely large\n * data values. A list has a single child data type for list entries. Lists\n * are represented using integer offsets that indicate list extents within a\n * single child array containing all list values.\n * @param {FieldInput} child The child (list item) field or data type.\n * @returns {LargeListType} The large list data type.\n */\nexport const largeList = (child) => ({\n  typeId: Type.LargeList,\n  children: [ asField(child) ],\n  offsets: int64Array\n});\n\n/**\n * Return a RunEndEncoded data type instance, which compresses data by\n * representing consecutive repeated values as a run. This data type uses two\n * child arrays, `run_ends` and `values`. The `run_ends` child array must be\n * a 16, 32, or 64 bit integer array which encodes the indices at which the\n * run with the value in each corresponding index in the values child array\n * ends. Like list and struct types, the `values` array can be of any type.\n * @param {FieldInput} runsField The run-ends field or data type.\n * @param {FieldInput} valuesField The values field or data type.\n * @returns {RunEndEncodedType} The large list data type.\n */\nexport const runEndEncoded = (runsField, valuesField) => ({\n  typeId: Type.RunEndEncoded,\n  children: [\n    check(\n      asField(runsField, 'run_ends'),\n      (field) => field.type.typeId === Type.Int,\n      () => 'Run-ends must have an integer type.'\n    ),\n    asField(valuesField, 'values')\n  ]\n});\n\n/**\n * Return a BinaryView data type instance. BinaryView data is logically the\n * same as the Binary type, but the internal representation uses a view struct\n * that contains the string length and either the string's entire data inline\n * (for small strings) or an inlined prefix, an index of another buffer, and an\n * offset pointing to a slice in that buffer (for non-small strings).\n *\n * Flechette can encode and decode BinaryView data; however, Flechette does\n * not currently support building BinaryView columns from JavaScript values.\n * @returns {BinaryViewType} The binary view data type.\n */\nexport const binaryView = () => /** @type {BinaryViewType} */\n  (basicType(Type.BinaryView));\n\n/**\n * Return a Utf8View data type instance. Utf8View data is logically the same as\n * the Utf8 type, but the internal representation uses a view struct that\n * contains the string length and either the string's entire data inline (for\n * small strings) or an inlined prefix, an index of another buffer, and an\n * offset pointing to a slice in that buffer (for non-small strings).\n *\n * Flechette can encode and decode Utf8View data; however, Flechette does\n * not currently support building Utf8View columns from JavaScript values.\n * @returns {Utf8ViewType} The utf8 view data type.\n */\nexport const utf8View = () => /** @type {Utf8ViewType} */\n  (basicType(Type.Utf8View));\n\n/**\n * Return a ListView data type instance, representing variably-sized lists\n * (arrays) with 32-bit offsets. ListView data represents the same logical\n * types that List can, but contains both offsets and sizes allowing for\n * writes in any order and sharing of child values among list values.\n *\n * Flechette can encode and decode ListView data; however, Flechette does not\n * currently support building ListView columns from JavaScript values.\n * @param {FieldInput} child The child (list item) field or data type.\n * @returns {ListViewType} The list view data type.\n */\nexport const listView = (child) => ({\n  typeId: Type.ListView,\n  children: [ asField(child, 'value') ],\n  offsets: int32Array\n});\n\n/**\n * Return a LargeListView data type instance, representing variably-sized lists\n * (arrays) with 64-bit offsets, allowing representation of extremely large\n * data values. LargeListView data represents the same logical types that\n * LargeList can, but contains both offsets and sizes allowing for writes\n * in any order and sharing of child values among list values.\n *\n * Flechette can encode and decode LargeListView data; however, Flechette does\n * not currently support building LargeListView columns from JavaScript values.\n * @param {FieldInput} child The child (list item) field or data type.\n * @returns {LargeListViewType} The large list view data type.\n */\nexport const largeListView = (child) => ({\n  typeId: Type.LargeListView,\n  children: [ asField(child, 'value') ],\n  offsets: int64Array\n});\n","/**\n * @import { TimeUnit_, TypedArray } from '../types.js';\n */\nimport { float64Array, int32Array, int64Array, isInt64ArrayType, uint32Array, uint8Array } from './arrays.js';\nimport { TimeUnit } from '../constants.js';\n\n// typed arrays over a shared buffer to aid binary conversion\nconst f64 = new float64Array(2);\nconst buf = f64.buffer;\nconst i64 = new int64Array(buf);\nconst u32 = new uint32Array(buf);\nconst i32 = new int32Array(buf);\nconst u8 = new uint8Array(buf);\n\n/**\n * Return a value unchanged.\n * @template T\n * @param {T} value The value.\n * @returns {T} The value.\n */\nexport function identity(value) {\n  return value;\n}\n\n/**\n * Return a value coerced to a BigInt.\n * @param {*} value The value.\n * @returns {bigint} The BigInt value.\n */\nexport function toBigInt(value) {\n  return BigInt(value);\n}\n\n/**\n * Return an offset conversion method for the given data type.\n * @param {{ offsets: TypedArray}} type The array type.\n */\nexport function toOffset(type) {\n  return isInt64ArrayType(type) ? toBigInt : identity;\n}\n\n/**\n * Return the number of days from a millisecond timestamp.\n * @param {number} value The millisecond timestamp.\n * @returns {number} The number of days.\n */\nexport function toDateDay(value) {\n  return (value / 864e5) | 0;\n}\n\n/**\n * Return a timestamp conversion method for the given time unit.\n * @param {TimeUnit_} unit The time unit.\n * @returns {(value: number) => bigint} The conversion method.\n */\nexport function toTimestamp(unit) {\n  return unit === TimeUnit.SECOND ? value => toBigInt(value / 1e3)\n    : unit === TimeUnit.MILLISECOND ? toBigInt\n    : unit === TimeUnit.MICROSECOND ? value => toBigInt(value * 1e3)\n    : value => toBigInt(value * 1e6);\n}\n\n/**\n * Write month/day/nanosecond interval to a byte buffer.\n * @param {Array | Float64Array} interval The interval data.\n * @returns {Uint8Array} A byte buffer with the interval data.\n *  The returned buffer is reused across calls, and so should be\n *  copied to a target buffer immediately.\n */\nexport function toMonthDayNanoBytes([m, d, n]) {\n  i32[0] = m;\n  i32[1] = d;\n  i64[1] = toBigInt(n);\n  return u8;\n}\n\n/**\n * Coerce a bigint value to a number. Throws an error if the bigint value\n * lies outside the range of what a number can precisely represent.\n * @param {bigint} value The value to check and possibly convert.\n * @returns {number} The converted number value.\n */\nexport function toNumber(value) {\n  if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER) {\n    throw Error(`BigInt exceeds integer number representation: ${value}`);\n  }\n  return Number(value);\n}\n\n/**\n * Divide one BigInt value by another, and return the result as a number.\n * The division may involve unsafe integers and a loss of precision.\n * @param {bigint} num The numerator.\n * @param {bigint} div The divisor.\n * @returns {number} The result of the division as a floating point number.\n */\nexport function divide(num, div) {\n  return Number(num / div) + Number(num % div) / Number(div);\n}\n\n/**\n * Return a 32-bit decimal conversion method for the given decimal scale.\n * @param {number} scale The scale mapping fractional digits to integers.\n * @returns {(value: number|bigint) => number} A conversion method that maps\n *  floating point numbers to 32-bit decimals.\n */\nexport function toDecimal32(scale) {\n  return (value) => typeof value === 'bigint'\n    ? Number(value)\n    : Math.trunc(value * scale);\n}\n\n/**\n * Convert a floating point number or bigint to decimal bytes.\n * @param {number|bigint} value The number to encode. If a bigint, we assume\n *  it already represents the decimal in integer form with the correct scale.\n *  Otherwise, we assume a float that requires scaled integer conversion.\n * @param {BigUint64Array} buf The uint64 array to write to.\n * @param {number} offset The starting index offset into the array.\n * @param {number} stride The stride of an encoded decimal, in 64-bit steps.\n * @param {number} scale The scale mapping fractional digits to integers.\n */\nexport function toDecimal(value, buf, offset, stride, scale) {\n  const v = typeof value === 'bigint'\n    ? value\n    : toBigInt(Math.trunc(value * scale));\n  // assignment into uint64array performs needed truncation for us\n  buf[offset] = v;\n  if (stride > 1) {\n    buf[offset + 1] = (v >> 64n);\n    if (stride > 2) {\n      buf[offset + 2] = (v >> 128n);\n      buf[offset + 3] = (v >> 192n);\n    }\n  }\n}\n\n// helper method to extract uint64 values from bigints\nconst asUint64 = v => BigInt.asUintN(64, v);\n\n/**\n * Convert a 64-bit decimal value to a bigint.\n * @param {BigUint64Array} buf The uint64 array containing the decimal bytes.\n * @param {number} offset The starting index offset into the array.\n * @returns {bigint} The converted decimal as a bigint, such that all\n *  fractional digits are scaled up to integers (for example, 1.12 -> 112).\n */\nexport function fromDecimal64(buf, offset) {\n  return BigInt.asIntN(64, buf[offset]);\n}\n\n/**\n * Convert a 128-bit decimal value to a bigint.\n * @param {BigUint64Array} buf The uint64 array containing the decimal bytes.\n * @param {number} offset The starting index offset into the array.\n * @returns {bigint} The converted decimal as a bigint, such that all\n *  fractional digits are scaled up to integers (for example, 1.12 -> 112).\n */\nexport function fromDecimal128(buf, offset) {\n  const i = offset << 1;\n  let x;\n  if (BigInt.asIntN(64, buf[i + 1]) < 0) {\n    x = asUint64(~buf[i]) | (asUint64(~buf[i + 1]) << 64n);\n    x = -(x + 1n);\n  } else {\n    x = buf[i] | (buf[i + 1] << 64n);\n  }\n  return x;\n}\n\n/**\n * Convert a 256-bit decimal value to a bigint.\n * @param {BigUint64Array} buf The uint64 array containing the decimal bytes.\n * @param {number} offset The starting index offset into the array.\n * @returns {bigint} The converted decimal as a bigint, such that all\n *  fractional digits are scaled up to integers (for example, 1.12 -> 112).\n */\nexport function fromDecimal256(buf, offset) {\n  const i = offset << 2;\n  let x;\n  if (BigInt.asIntN(64, buf[i + 3]) < 0) {\n    x = asUint64(~buf[i])\n      | (asUint64(~buf[i + 1]) << 64n)\n      | (asUint64(~buf[i + 2]) << 128n)\n      | (asUint64(~buf[i + 3]) << 192n);\n    x = -(x + 1n);\n  } else {\n    x = buf[i]\n      | (buf[i + 1] << 64n)\n      | (buf[i + 2] << 128n)\n      | (buf[i + 3] << 192n);\n  }\n  return x;\n}\n\n/**\n * Convert a 16-bit float from integer bytes to a number.\n * Adapted from https://github.com/apache/arrow/blob/main/js/src/util/math.ts\n * @param {number} value The float as a 16-bit integer.\n * @returns {number} The converted 64-bit floating point number.\n */\nexport function fromFloat16(value) {\n  const expo = (value & 0x7C00) >> 10;\n  const sigf = (value & 0x03FF) / 1024;\n  const sign = (-1) ** ((value & 0x8000) >> 15);\n  switch (expo) {\n    case 0x1F: return sign * (sigf ? Number.NaN : 1 / 0);\n    case 0x00: return sign * (sigf ? 6.103515625e-5 * sigf : 0);\n  }\n  return sign * (2 ** (expo - 15)) * (1 + sigf);\n}\n\n/**\n * Convert a number to a 16-bit float as integer bytes..\n * Inspired by numpy's `npy_double_to_half`:\n * https://github.com/numpy/numpy/blob/5a5987291dc95376bb098be8d8e5391e89e77a2c/numpy/core/src/npymath/halffloat.c#L43\n * Adapted from https://github.com/apache/arrow/blob/main/js/src/util/math.ts\n * @param {number} value The 64-bit floating point number to convert.\n * @returns {number} The converted 16-bit integer.\n */\nexport function toFloat16(value) {\n  if (value !== value) return 0x7E00; // NaN\n  f64[0] = value;\n\n  // Magic numbers:\n  // 0x80000000 = 10000000 00000000 00000000 00000000 -- masks the 32nd bit\n  // 0x7ff00000 = 01111111 11110000 00000000 00000000 -- masks the 21st-31st bits\n  // 0x000fffff = 00000000 00001111 11111111 11111111 -- masks the 1st-20th bit\n  const sign = (u32[1] & 0x80000000) >> 16 & 0xFFFF;\n  let expo = (u32[1] & 0x7FF00000), sigf = 0x0000;\n\n  if (expo >= 0x40F00000) {\n    //\n    // If exponent overflowed, the float16 is either NaN or Infinity.\n    // Rules to propagate the sign bit: mantissa > 0 ? NaN : +/-Infinity\n    //\n    // Magic numbers:\n    // 0x40F00000 = 01000000 11110000 00000000 00000000 -- 6-bit exponent overflow\n    // 0x7C000000 = 01111100 00000000 00000000 00000000 -- masks the 27th-31st bits\n    //\n    // returns:\n    // qNaN, aka 32256 decimal, 0x7E00 hex, or 01111110 00000000 binary\n    // sNaN, aka 32000 decimal, 0x7D00 hex, or 01111101 00000000 binary\n    // +inf, aka 31744 decimal, 0x7C00 hex, or 01111100 00000000 binary\n    // -inf, aka 64512 decimal, 0xFC00 hex, or 11111100 00000000 binary\n    //\n    // If mantissa is greater than 23 bits, set to +Infinity like numpy\n    if (u32[0] > 0) {\n      expo = 0x7C00;\n    } else {\n      expo = (expo & 0x7C000000) >> 16;\n      sigf = (u32[1] & 0x000FFFFF) >> 10;\n    }\n  } else if (expo <= 0x3F000000) {\n    //\n    // If exponent underflowed, the float is either signed zero or subnormal.\n    //\n    // Magic numbers:\n    // 0x3F000000 = 00111111 00000000 00000000 00000000 -- 6-bit exponent underflow\n    //\n    sigf = 0x100000 + (u32[1] & 0x000FFFFF);\n    sigf = 0x100000 + (sigf << ((expo >> 20) - 998)) >> 21;\n    expo = 0;\n  } else {\n    //\n    // No overflow or underflow, rebase the exponent and round the mantissa\n    // Magic numbers:\n    // 0x200 = 00000010 00000000 -- masks off the 10th bit\n    //\n    // Ensure the first mantissa bit (the 10th one) is 1 and round\n    expo = (expo - 0x3F000000) >> 10;\n    sigf = ((u32[1] & 0x000FFFFF) + 0x200) >> 10;\n  }\n  return sign | expo | sigf & 0xFFFF;\n}\n","import { isArray } from './arrays.js';\nimport { isDate } from './objects.js';\n\nconst textDecoder = new TextDecoder('utf-8');\nconst textEncoder = new TextEncoder();\n\n/**\n * Return a UTF-8 string decoded from a byte buffer.\n * @param {Uint8Array} buf The byte buffer.\n * @returns {string} The decoded string.\n */\nexport function decodeUtf8(buf) {\n  return textDecoder.decode(buf);\n}\n\n/**\n * Return a byte buffer encoded from a UTF-8 string.\n * @param {string } str The string to encode.\n * @returns {Uint8Array} The encoded byte buffer.\n */\nexport function encodeUtf8(str) {\n  return textEncoder.encode(str);\n}\n\n/**\n * Return a string-coercible key value that uniquely identifies a value.\n * @param {*} value The input value.\n * @returns {string} The key string.\n */\nexport function keyString(value) {\n  const val = typeof value !== 'object' || !value ? (value ?? null)\n    : isDate(value) ? +value\n    // @ts-ignore\n    : isArray(value) ? `[${value.map(keyString)}]`\n    : objectKey(value);\n  return `${val}`;\n}\n\nfunction objectKey(value) {\n  let s = '';\n  let i = -1;\n  for (const k in value) {\n    if (++i > 0) s += ',';\n    s += `\"${k}\":${keyString(value[k])}`;\n  }\n  return `{${s}}`;\n}\n","import { toNumber } from './numbers.js';\nimport { decodeUtf8 } from './strings.js';\n\n/** The size in bytes of a 32-bit integer. */\nexport const SIZEOF_INT = 4;\n\n/** The size in bytes of a 16-bit integer. */\nexport const SIZEOF_SHORT = 2;\n\n/**\n * Return a boolean for a single bit in a bitmap.\n * @param {Uint8Array} bitmap The bitmap.\n * @param {number} index The bit index to read.\n * @returns {boolean} The boolean bitmap value.\n */\nexport function decodeBit(bitmap, index) {\n  return (bitmap[index >> 3] & 1 << (index % 8)) !== 0;\n}\n\n/**\n * Lookup helper for flatbuffer object (table) entries.\n * @param {Uint8Array} buf The byte buffer.\n * @param {number} index The base index of the object.\n */\nexport function readObject(buf, index) {\n  const pos = index + readInt32(buf, index);\n  const vtable = pos - readInt32(buf, pos);\n  const size = readInt16(buf, vtable);\n  /**\n   * Retrieve a value from a flatbuffer table layout.\n   * @template T\n   * @param {number} index The table entry index.\n   * @param {(buf: Uint8Array, offset: number) => T} read Read function to invoke.\n   * @param {T} [fallback=null] The default fallback value.\n   * @returns {T}\n   */\n  return (index, read, fallback = null) => {\n    if (index < size) {\n      const off = readInt16(buf, vtable + index);\n      if (off) return read(buf, pos + off);\n    }\n    return fallback;\n  };\n}\n\n/**\n * Return a buffer offset value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readOffset(buf, offset) {\n  return offset;\n}\n\n/**\n * Return a boolean value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {boolean}\n */\nexport function readBoolean(buf, offset) {\n  return !!readInt8(buf, offset);\n}\n\n/**\n * Return a signed 8-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readInt8(buf, offset) {\n  return readUint8(buf, offset) << 24 >> 24;\n}\n\n/**\n * Return an unsigned 8-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readUint8(buf, offset) {\n  return buf[offset];\n}\n\n/**\n * Return a signed 16-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readInt16(buf, offset) {\n  return readUint16(buf, offset) << 16 >> 16;\n}\n\n/**\n * Return an unsigned 16-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readUint16(buf, offset) {\n  return buf[offset] | buf[offset + 1] << 8;\n}\n\n/**\n * Return a signed 32-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readInt32(buf, offset) {\n  return buf[offset]\n    | buf[offset + 1] << 8\n    | buf[offset + 2] << 16\n    | buf[offset + 3] << 24;\n}\n\n/**\n * Return an unsigned 32-bit integer value.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readUint32(buf, offset) {\n  return readInt32(buf, offset) >>> 0;\n}\n\n/**\n * Return a signed 64-bit integer value coerced to a JS number.\n * Throws an error if the value exceeds what a JS number can represent.\n * @param {Uint8Array} buf\n * @param {number} offset\n * @returns {number}\n */\nexport function readInt64(buf, offset) {\n  return toNumber(BigInt.asIntN(\n    64,\n    BigInt(readUint32(buf, offset)) +\n      (BigInt(readUint32(buf, offset + SIZEOF_INT)) << 32n)\n  ));\n}\n\n/**\n * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.\n * This allocates a new string and converts to wide chars upon each access.\n * @param {Uint8Array} buf The byte buffer.\n * @param {number} index The index of the string entry.\n * @returns {string} The decoded string.\n */\nexport function readString(buf, index) {\n  let offset = index + readInt32(buf, index); // get the string offset\n  const length = readInt32(buf, offset);  // get the string length\n  offset += SIZEOF_INT; // skip length value\n  return decodeUtf8(buf.subarray(offset, offset + length));\n}\n\n/**\n * Extract a flatbuffer vector to an array.\n * @template T\n * @param {Uint8Array} buf The byte buffer.\n * @param {number} offset The offset location of the vector.\n * @param {number} stride The stride between vector entries.\n * @param {(buf: Uint8Array, pos: number) => T} extract Vector entry extraction function.\n * @returns {T[]} The extracted vector entries.\n */\nexport function readVector(buf, offset, stride, extract) {\n  if (!offset) return [];\n\n  // get base position by adding offset delta\n  const base = offset + readInt32(buf, offset);\n\n  // read vector size, extract entries\n  return Array.from(\n    { length: readInt32(buf, base) },\n    (_, i) => extract(buf, base + SIZEOF_INT + i * stride)\n  );\n}\n","/**\n * @import { Batch } from '../batch.js';\n */\n\n/**\n * Symbol for the row index value of a struct object proxy.\n */\nexport const RowIndex = Symbol('rowIndex');\n\n/**\n * Returns a row proxy object factory. The resulting method takes a\n * batch-level row index as input and returns an object that proxies\n * access to underlying batches.\n * @param {string[]} names The column (property) names\n * @param {Batch[]} batches The value batches.\n * @returns {(index: number) => Record<string, any>}\n */\nexport function proxyFactory(names, batches) {\n  class RowObject {\n    /**\n     * Create a new proxy row object representing a struct or table row.\n     * @param {number} index The record batch row index.\n     */\n    constructor(index) {\n      this[RowIndex] = index;\n    }\n\n    /**\n     * Return a JSON-compatible object representation.\n     */\n    toJSON() {\n      return structObject(names, batches, this[RowIndex]);\n    }\n  };\n\n  // prototype for row proxy objects\n  const proto = RowObject.prototype;\n\n  for (let i = 0; i < names.length; ++i) {\n    // skip duplicated column names\n    if (Object.hasOwn(proto, names[i])) continue;\n\n    // add a getter method for the current batch\n    const batch = batches[i];\n    Object.defineProperty(proto, names[i], {\n      get() { return batch.at(this[RowIndex]); },\n      enumerable: true\n    });\n  }\n\n  return index => new RowObject(index);\n}\n\n/**\n * Returns a row object factory. The resulting method takes a\n * batch-level row index as input and returns an object whose property\n * values have been extracted from the batches.\n * @param {string[]} names The column (property) names\n * @param {Batch[]} batches The value batches.\n * @returns {(index: number) => Record<string, any>}\n */\nexport function objectFactory(names, batches) {\n  return index => structObject(names, batches, index);\n}\n\n/**\n * Return a vanilla object representing a struct (row object) type.\n * @param {string[]} names The column (property) names\n * @param {Batch[]} batches The value batches.\n * @param {number} index The record batch row index.\n * @returns {Record<string, any>}\n */\nexport function structObject(names, batches, index) {\n  const obj = {};\n  for (let i = 0; i < names.length; ++i) {\n    obj[names[i]] = batches[i].at(index);\n  }\n  return obj;\n}\n","/**\n * @import { Column } from './column.js'\n * @import { DataType, DecimalType, IntegerArray, OffsetArray, TypedArray, TypedArrayConstructor, ValueArray } from './types.js'\n */\nimport { bisect, float64Array } from './util/arrays.js';\nimport { divide, fromDecimal128, fromDecimal256, fromDecimal64, toNumber } from './util/numbers.js';\nimport { decodeBit, readInt32, readInt64 } from './util/read.js';\nimport { decodeUtf8 } from './util/strings.js';\nimport { objectFactory, proxyFactory } from './util/struct.js';\n\n/**\n * Check if the input is a batch that supports direct access to\n * binary data in the form of typed arrays.\n * @param {Batch<any>?} batch The data batch to check.\n * @returns {boolean} True if a direct batch, false otherwise.\n */\nexport function isDirectBatch(batch) {\n  return batch instanceof DirectBatch;\n}\n\n/**\n * Column values from a single record batch.\n * A column may contain multiple batches.\n * @template T\n */\nexport class Batch {\n  /**\n   * The array type to use when extracting data from the batch.\n   * A null value indicates that the array type should match\n   * the type of the batch's values array.\n   * @type {ArrayConstructor | TypedArrayConstructor | null}\n   */\n  static ArrayType = null;\n\n  /**\n   * Create a new column batch.\n   * @param {object} options\n   * @param {number} options.length The length of the batch\n   * @param {number} options.nullCount The null value count\n   * @param {DataType} options.type The data type.\n   * @param {Uint8Array} [options.validity] Validity bitmap buffer\n   * @param {TypedArray} [options.values] Values buffer\n   * @param {OffsetArray} [options.offsets] Offsets buffer\n   * @param {OffsetArray} [options.sizes] Sizes buffer\n   * @param {Batch[]} [options.children] Children batches\n   */\n  constructor({\n    length,\n    nullCount,\n    type,\n    validity,\n    values,\n    offsets,\n    sizes,\n    children\n  }) {\n    this.length = length;\n    this.nullCount = nullCount;\n    this.type = type;\n    this.validity = validity;\n    this.values = values;\n    this.offsets = offsets;\n    this.sizes = sizes;\n    this.children = children;\n\n    // optimize access if this batch has no null values\n    // some types (like union) may have null values in\n    // child batches, but no top-level validity buffer\n    if (!nullCount || !this.validity) {\n      /** @type {(index: number) => T | null} */\n      this.at = index => this.value(index);\n    }\n  }\n\n  /**\n   * Provide an informative object string tag.\n   */\n  get [Symbol.toStringTag]() {\n    return 'Batch';\n  }\n\n  /**\n   * Return the value at the given index.\n   * @param {number} index The value index.\n   * @returns {T | null} The value.\n   */\n  at(index) {\n    return this.isValid(index) ? this.value(index) : null;\n  }\n\n  /**\n   * Check if a value at the given index is valid (non-null).\n   * @param {number} index The value index.\n   * @returns {boolean} True if valid, false otherwise.\n   */\n  isValid(index) {\n    return decodeBit(this.validity, index);\n  }\n\n  /**\n   * Return the value at the given index. This method does not check the\n   * validity bitmap and is intended primarily for internal use. In most\n   * cases, callers should use the `at()` method instead.\n   * @param {number} index The value index\n   * @returns {T} The value, ignoring the validity bitmap.\n   */\n  value(index) {\n    return /** @type {T} */ (this.values[index]);\n  }\n\n  /**\n   * Extract an array of values within the given index range. Unlike\n   * Array.slice, all arguments are required and may not be negative indices.\n   * @param {number} start The starting index, inclusive\n   * @param {number} end The ending index, exclusive\n   * @returns {ValueArray<T?>} The slice of values\n   */\n  slice(start, end) {\n    const n = end - start;\n    const values = Array(n);\n    for (let i = 0; i < n; ++i) {\n      values[i] = this.at(start + i);\n    }\n    return values;\n  }\n\n  /**\n   * Return an iterator over the values in this batch.\n   * @returns {Iterator<T?>}\n   */\n  *[Symbol.iterator]() {\n    for (let i = 0; i < this.length; ++i) {\n      yield this.at(i);\n    }\n  }\n}\n\n/**\n * A batch whose value buffer can be used directly, without transformation.\n * @template T\n * @extends {Batch<T>}\n */\nexport class DirectBatch extends Batch {\n  /**\n   * Create a new column batch with direct value array access.\n   * @param {object} options\n   * @param {number} options.length The length of the batch\n   * @param {number} options.nullCount The null value count\n   * @param {DataType} options.type The data type.\n   * @param {Uint8Array} [options.validity] Validity bitmap buffer\n   * @param {TypedArray} options.values Values buffer\n   */\n  constructor(options) {\n    super(options);\n    // underlying buffers may be padded, exceeding the logical batch length\n    // we trim the values array so we can safely access it directly\n    const { length, values } = this;\n    this.values = values.subarray(0, length);\n  }\n\n  /**\n   * Extract an array of values within the given index range. Unlike\n   * Array.slice, all arguments are required and may not be negative indices.\n   * When feasible, a zero-copy subarray of a typed array is returned.\n   * @param {number} start The starting index, inclusive\n   * @param {number} end The ending index, exclusive\n   * @returns {ValueArray<T?>} The slice of values\n   */\n  slice(start, end) {\n    // @ts-ignore\n    return this.nullCount\n      ? super.slice(start, end)\n      : this.values.subarray(start, end);\n  }\n\n  /**\n   * Return an iterator over the values in this batch.\n   * @returns {Iterator<T?>}\n   */\n  [Symbol.iterator]() {\n    return this.nullCount\n      ? super[Symbol.iterator]()\n      : /** @type {Iterator<T?>} */ (this.values[Symbol.iterator]());\n  }\n}\n\n/**\n * A batch whose values are transformed to 64-bit numbers.\n * @extends {Batch<number>}\n */\nexport class NumberBatch extends Batch {\n  static ArrayType = float64Array;\n}\n\n/**\n * A batch whose values should be returned in a standard array.\n * @template T\n * @extends {Batch<T>}\n */\nexport class ArrayBatch extends Batch {\n  static ArrayType = Array;\n}\n\n/**\n * A batch of null values only.\n * @extends {ArrayBatch<null>}\n */\nexport class NullBatch extends ArrayBatch {\n  /**\n   * @param {number} index The value index\n   * @returns {null}\n   */\n  value(index) { // eslint-disable-line no-unused-vars\n    return null;\n  }\n}\n\n/**\n * A batch that coerces BigInt values to 64-bit numbers.\n * @extends {NumberBatch}\n */\nexport class Int64Batch extends NumberBatch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return toNumber(/** @type {bigint} */ (this.values[index]));\n  }\n}\n\n/**\n * A batch of 16-bit floating point numbers, accessed as unsigned\n * 16-bit ints and transformed to 64-bit numbers.\n */\nexport class Float16Batch extends NumberBatch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    const v = /** @type {number} */ (this.values[index]);\n    const expo = (v & 0x7C00) >> 10;\n    const sigf = (v & 0x03FF) / 1024;\n    const sign = (-1) ** ((v & 0x8000) >> 15);\n    switch (expo) {\n      case 0x1F: return sign * (sigf ? Number.NaN : 1 / 0);\n      case 0x00: return sign * (sigf ? 6.103515625e-5 * sigf : 0);\n    }\n    return sign * (2 ** (expo - 15)) * (1 + sigf);\n  }\n}\n\n/**\n * A batch of boolean values stored as a bitmap.\n * @extends {ArrayBatch<boolean>}\n */\nexport class BoolBatch extends ArrayBatch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return decodeBit(/** @type {Uint8Array} */ (this.values), index);\n  }\n}\n\n/**\n * A batch of 32-bit decimal numbers, returned as converted 64-bit floating\n * point numbers. Number coercion may be lossy if the decimal precision can\n * not be represented in a 64-bit floating point format.\n * @extends {NumberBatch}\n */\nexport class Decimal32NumberBatch extends NumberBatch {\n  constructor(options) {\n    super(options);\n    const { scale } = /** @type {DecimalType} */ (this.type);\n    this.scale = 10 ** scale;\n  }\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return /** @type {number} */(this.values[index]) / this.scale;\n  }\n}\n\n/**\n * An abstract class for a batch of 64-, 128- or 256-bit decimal numbers,\n * accessed in strided BigUint64Arrays.\n * @template T\n * @extends {Batch<T>}\n */\nexport class DecimalBatch extends Batch {\n  constructor(options) {\n    super(options);\n    const { bitWidth, scale } = /** @type {DecimalType} */ (this.type);\n    this.decimal = bitWidth === 64 ? fromDecimal64\n      : bitWidth === 128 ? fromDecimal128\n      : fromDecimal256;\n    this.scale = 10n ** BigInt(scale);\n  }\n}\n\n/**\n * A batch of 64-, 128- or 256-bit decimal numbers, returned as converted\n * 64-bit floating point numbers. Number coercion may be lossy if the decimal\n * precision can not be represented in a 64-bit floating point format.\n * @extends {DecimalBatch<number>}\n */\nexport class DecimalNumberBatch extends DecimalBatch {\n  static ArrayType = float64Array;\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return divide(\n      this.decimal(/** @type {BigUint64Array} */ (this.values), index),\n      this.scale\n    );\n  }\n}\n\n/**\n * A batch of 64-, 128- or 256-bit decimal numbers, returned as scaled\n * bigint values, such that all fractional digits have been shifted\n * to integer places by the decimal type scale factor.\n * @extends {DecimalBatch<bigint>}\n */\nexport class DecimalBigIntBatch extends DecimalBatch {\n  static ArrayType = Array;\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return this.decimal(/** @type {BigUint64Array} */ (this.values), index);\n  }\n}\n\n/**\n * A batch of date or timestamp values that are coerced to UNIX epoch timestamps\n * and returned as JS Date objects. This batch wraps a source batch that provides\n * timestamp values.\n * @extends {ArrayBatch<Date>}\n */\nexport class DateBatch extends ArrayBatch {\n  /**\n   * Create a new date batch.\n   * @param {Batch<number>} batch A batch of timestamp values.\n   */\n  constructor(batch) {\n    super(batch);\n    this.source = batch;\n  }\n\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return new Date(this.source.value(index));\n  }\n}\n\n/**\n * A batch of dates as day counts, coerced to timestamp numbers.\n */\nexport class DateDayBatch extends NumberBatch {\n  /**\n   * @param {number} index The value index\n   * @returns {number}\n   */\n  value(index) {\n    // epoch days to milliseconds\n    return 86400000 * /** @type {number} */ (this.values[index]);\n  }\n}\n\n/**\n * A batch of dates as millisecond timestamps, coerced to numbers.\n */\nexport const DateDayMillisecondBatch = Int64Batch;\n\n/**\n * A batch of timestaps in seconds, coerced to millisecond numbers.\n */\nexport class TimestampSecondBatch extends Int64Batch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    return super.value(index) * 1e3; // seconds to milliseconds\n  }\n}\n\n/**\n * A batch of timestaps in milliseconds, coerced to numbers.\n */\nexport const TimestampMillisecondBatch = Int64Batch;\n\n/**\n * A batch of timestaps in microseconds, coerced to millisecond numbers.\n */\nexport class TimestampMicrosecondBatch extends Int64Batch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    // microseconds to milliseconds\n    return divide(/** @type {bigint} */ (this.values[index]), 1000n);\n  }\n}\n\n/**\n * A batch of timestaps in nanoseconds, coerced to millisecond numbers.\n */\nexport class TimestampNanosecondBatch extends Int64Batch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    // nanoseconds to milliseconds\n    return divide(/** @type {bigint} */ (this.values[index]), 1000000n);\n  }\n}\n\n/**\n * A batch of day/time intervals, returned as two-element 32-bit int arrays.\n * @extends {ArrayBatch<Int32Array>}\n */\nexport class IntervalDayTimeBatch extends ArrayBatch {\n  /**\n   * @param {number} index The value index\n   * @returns {Int32Array}\n   */\n  value(index) {\n    const values = /** @type {Int32Array} */ (this.values);\n    return values.subarray(index << 1, (index + 1) << 1);\n  }\n}\n\n/**\n * A batch of month/day/nanosecond intervals, returned as three-element arrays.\n * @extends {ArrayBatch<Float64Array>}\n */\nexport class IntervalMonthDayNanoBatch extends ArrayBatch {\n  /**\n   * @param {number} index The value index\n   */\n  value(index) {\n    const values = /** @type {Uint8Array} */ (this.values);\n    const base = index << 4;\n    return Float64Array.of(\n      readInt32(values, base),\n      readInt32(values, base + 4),\n      readInt64(values, base + 8)\n    );\n  }\n}\n\nconst offset32 = ({values, offsets}, index) => values.subarray(offsets[index], offsets[index + 1]);\nconst offset64 = ({values, offsets}, index) => values.subarray(toNumber(offsets[index]), toNumber(offsets[index + 1]));\n\n/**\n * A batch of binary blobs with variable offsets, returned as byte buffers of\n * unsigned 8-bit integers. The offsets are 32-bit ints.\n * @extends {ArrayBatch<Uint8Array>}\n */\nexport class BinaryBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {Uint8Array}\n   */\n  value(index) {\n    return offset32(this, index);\n  }\n}\n\n/**\n * A batch of binary blobs with variable offsets, returned as byte buffers of\n * unsigned 8-bit integers. The offsets are 64-bit ints. Value extraction will\n * fail if an offset exceeds `Number.MAX_SAFE_INTEGER`.\n * @extends {ArrayBatch<Uint8Array>}\n */\nexport class LargeBinaryBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {Uint8Array}\n   */\n  value(index) {\n    return offset64(this, index);\n  }\n}\n\n/**\n * A batch of UTF-8 strings with variable offsets. The offsets are 32-bit ints.\n * @extends {ArrayBatch<string>}\n */\nexport class Utf8Batch extends ArrayBatch {\n  /**\n   * @param {number} index\n   */\n  value(index) {\n    return decodeUtf8(offset32(this, index));\n  }\n}\n\n/**\n * A batch of UTF-8 strings with variable offsets. The offsets are 64-bit ints.\n * Value extraction will fail if an offset exceeds `Number.MAX_SAFE_INTEGER`.\n * @extends {ArrayBatch<string>}\n */\nexport class LargeUtf8Batch extends ArrayBatch {\n  /**\n   * @param {number} index\n   */\n  value(index) {\n    return decodeUtf8(offset64(this, index));\n  }\n}\n\n/**\n * A batch of list (array) values of variable length. The list offsets are\n * 32-bit ints.\n * @template V\n * @extends {ArrayBatch<ValueArray<V>>}\n */\nexport class ListBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {ValueArray<V>}\n   */\n  value(index) {\n    const offsets = /** @type {Int32Array} */ (this.offsets);\n    return this.children[0].slice(offsets[index], offsets[index + 1]);\n  }\n}\n\n/**\n * A batch of list (array) values of variable length. The list offsets are\n * 64-bit ints. Value extraction will fail if an offset exceeds\n * `Number.MAX_SAFE_INTEGER`.\n * @template V\n * @extends {ArrayBatch<ValueArray<V>>}\n */\nexport class LargeListBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {ValueArray<V>}\n   */\n  value(index) {\n    const offsets = /** @type {BigInt64Array} */ (this.offsets);\n    return this.children[0].slice(toNumber(offsets[index]), toNumber(offsets[index + 1]));\n  }\n}\n\n/**\n * A batch of list (array) values of variable length. The list offsets and\n * sizes are 32-bit ints.\n * @template V\n * @extends {ArrayBatch<ValueArray<V>>}\n */\nexport class ListViewBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {ValueArray<V>}\n   */\n  value(index) {\n    const a = /** @type {number} */ (this.offsets[index]);\n    const b = a + /** @type {number} */ (this.sizes[index]);\n    return this.children[0].slice(a, b);\n  }\n}\n\n/**\n * A batch of list (array) values of variable length. The list offsets and\n * sizes are 64-bit ints. Value extraction will fail if an offset or size\n * exceeds `Number.MAX_SAFE_INTEGER`.\n * @template V\n * @extends {ArrayBatch<ValueArray<V>>}\n */\nexport class LargeListViewBatch extends ArrayBatch {\n  /**\n   * @param {number} index\n   * @returns {ValueArray<V>}\n   */\n  value(index) {\n    const a = /** @type {bigint} */ (this.offsets[index]);\n    const b = a + /** @type {bigint} */ (this.sizes[index]);\n    return this.children[0].slice(toNumber(a), toNumber(b));\n  }\n}\n\n/**\n * A batch with a fixed stride.\n * @template T\n * @extends {ArrayBatch<T>}\n */\nclass FixedBatch extends ArrayBatch {\n  constructor(options) {\n    super(options);\n    /** @type {number} */\n    // @ts-ignore\n    this.stride = this.type.stride;\n  }\n}\n\n/**\n * A batch of binary blobs of fixed size, returned as byte buffers of unsigned\n * 8-bit integers.\n * @extends {FixedBatch<Uint8Array>}\n */\nexport class FixedBinaryBatch extends FixedBatch {\n  /**\n   * @param {number} index\n   * @returns {Uint8Array}\n   */\n  value(index) {\n    const { stride, values } = this;\n    return /** @type {Uint8Array} */ (values)\n      .subarray(index * stride, (index + 1) * stride);\n  }\n}\n\n/**\n * A batch of list (array) values of fixed length.\n * @template V\n * @extends {FixedBatch<ValueArray<V>>}\n */\nexport class FixedListBatch extends FixedBatch {\n  /**\n   * @param {number} index\n   * @returns {ValueArray<V>}\n   */\n  value(index) {\n    const { children, stride } = this;\n    return children[0].slice(index * stride, (index + 1) * stride);\n  }\n}\n\n/**\n * Extract Map key-value pairs from parallel child batches.\n */\nfunction pairs({ children, offsets }, index) {\n  const [ keys, vals ] = children[0].children;\n  const start = offsets[index];\n  const end = offsets[index + 1];\n  const entries = [];\n  for (let i = start; i < end; ++i) {\n    entries.push([keys.at(i), vals.at(i)]);\n  }\n  return entries;\n}\n\n/**\n * A batch of map (key, value) values. The map is represented as a list of\n * key-value structs.\n * @template K, V\n * @extends {ArrayBatch<[K, V][]>}\n */\nexport class MapEntryBatch extends ArrayBatch {\n  /**\n   * Return the value at the given index.\n   * @param {number} index The value index.\n   * @returns {[K, V][]} The map entries as an array of [key, value] arrays.\n   */\n  value(index) {\n    return /** @type {[K, V][]} */ (pairs(this, index));\n  }\n}\n\n/**\n * A batch of map (key, value) values. The map is represented as a list of\n * key-value structs.\n * @template K, V\n * @extends {ArrayBatch<Map<K, V>>}\n */\nexport class MapBatch extends ArrayBatch {\n  /**\n   * Return the value at the given index.\n   * @param {number} index The value index.\n   * @returns {Map<K, V>} The map value.\n   */\n  value(index) {\n    return new Map(/** @type {[K, V][]} */ (pairs(this, index)));\n  }\n}\n\n/**\n * A batch of union-type values with a sparse layout, enabling direct\n * lookup from the child value batches.\n * @template T\n * @extends {ArrayBatch<T>}\n */\nexport class SparseUnionBatch extends ArrayBatch {\n  /**\n   * Create a new column batch.\n   * @param {object} options\n   * @param {number} options.length The length of the batch\n   * @param {number} options.nullCount The null value count\n   * @param {DataType} options.type The data type.\n   * @param {Uint8Array} [options.validity] Validity bitmap buffer\n   * @param {Int32Array} [options.offsets] Offsets buffer\n   * @param {Batch[]} options.children Children batches\n   * @param {Int8Array} options.typeIds Union type ids buffer\n   * @param {Record<string, number>} options.map A typeId to children index map\n   */\n  constructor({ typeIds, ...options }) {\n    super(options);\n    /** @type {Int8Array} */\n    this.typeIds = typeIds;\n    /** @type {Record<string, number>} */\n    // @ts-ignore\n    this.typeMap = this.type.typeMap;\n  }\n\n  /**\n   * @param {number} index The value index.\n   */\n  value(index, offset = index) {\n    const { typeIds, children, typeMap } = this;\n    return children[typeMap[typeIds[index]]].at(offset);\n  }\n}\n\n/**\n * A batch of union-type values with a dense layout, reqiring offset\n * lookups from the child value batches.\n * @template T\n * @extends {SparseUnionBatch<T>}\n */\nexport class DenseUnionBatch extends SparseUnionBatch {\n  /**\n   * @param {number} index The value index.\n   */\n  value(index) {\n    return super.value(index, /** @type {number} */ (this.offsets[index]));\n  }\n}\n\n/**\n * A batch of struct values, containing a set of named properties.\n * Struct property values are extracted and returned as JS objects.\n * @extends {ArrayBatch<Record<string, any>>}\n */\nexport class StructBatch extends ArrayBatch {\n  constructor(options, factory = objectFactory) {\n    super(options);\n    /** @type {string[]} */\n    // @ts-ignore\n    this.names = this.type.children.map(child => child.name);\n    this.factory = factory(this.names, this.children);\n  }\n\n  /**\n   * @param {number} index The value index.\n   * @returns {Record<string, any>}\n   */\n  value(index) {\n    return this.factory(index);\n  }\n}\n\n/**\n * A batch of struct values, containing a set of named properties.\n * Structs are returned as proxy objects that extract data directly\n * from underlying Arrow batches.\n * @extends {StructBatch}\n */\nexport class StructProxyBatch extends StructBatch {\n  constructor(options) {\n    super(options, proxyFactory);\n  }\n}\n\n/**\n * A batch of run-end-encoded values.\n * @template T\n * @extends {ArrayBatch<T>}\n */\nexport class RunEndEncodedBatch extends ArrayBatch {\n  /**\n   * @param {number} index The value index.\n   */\n  value(index) {\n    const [ { values: runs }, vals ] = this.children;\n    return vals.at(\n      bisect(/** @type {IntegerArray} */(runs), index)\n    );\n  }\n}\n\n/**\n * A batch of dictionary-encoded values.\n * @template T\n * @extends {ArrayBatch<T>}\n */\nexport class DictionaryBatch extends ArrayBatch {\n  /**\n   * Register the backing dictionary. Dictionaries are added\n   * after batch creation as the complete dictionary may not\n   * be finished across multiple record batches.\n   * @param {Column<T>} dictionary\n   * The dictionary of column values.\n   */\n  setDictionary(dictionary) {\n    this.dictionary = dictionary;\n    this.cache = dictionary.cache();\n    return this;\n  }\n\n  /**\n   * @param {number} index The value index.\n   */\n  value(index) {\n    return this.cache[this.key(index)];\n  }\n\n  /**\n   * @param {number} index The value index.\n   * @returns {number} The dictionary key\n   */\n  key(index) {\n    return /** @type {number} */ (this.values[index]);\n  }\n}\n\n/**\n * @template T\n * @extends {ArrayBatch<T>}\n */\nclass ViewBatch extends ArrayBatch {\n  /**\n   * Create a new view batch.\n   * @param {object} options Batch options.\n   * @param {number} options.length The length of the batch\n   * @param {number} options.nullCount The null value count\n   * @param {DataType} options.type The data type.\n   * @param {Uint8Array} [options.validity] Validity bitmap buffer\n   * @param {Uint8Array} options.values Values buffer\n   * @param {Uint8Array[]} options.data View data buffers\n   */\n  constructor({ data, ...options }) {\n    super(options);\n    this.data = data;\n  }\n\n  /**\n   * Get the binary data at the provided index.\n   * @param {number} index The value index.\n   * @returns {Uint8Array}\n   */\n  view(index) {\n    const { values, data } = this;\n    const offset = index << 4; // each entry is 16 bytes\n    let start = offset + 4;\n    let buf = /** @type {Uint8Array} */ (values);\n    const length = readInt32(buf, offset);\n    if (length > 12) {\n      // longer strings are in a data buffer\n      start = readInt32(buf, offset + 12);\n      buf = data[readInt32(buf, offset + 8)];\n    }\n    return buf.subarray(start, start + length);\n  }\n}\n\n/**\n * A batch of binary blobs from variable data buffers, returned as byte\n * buffers of unsigned 8-bit integers.\n * @extends {ViewBatch<Uint8Array>}\n */\nexport class BinaryViewBatch extends ViewBatch {\n  /**\n   * @param {number} index The value index.\n   */\n  value(index) {\n    return this.view(index);\n  }\n}\n\n/**\n * A batch of UTF-8 strings from variable data buffers.\n * @extends {ViewBatch<string>}\n */\nexport class Utf8ViewBatch extends ViewBatch {\n  /**\n   * @param {number} index The value index.\n   */\n  value(index) {\n    return decodeUtf8(this.view(index));\n  }\n}\n","/**\n * @import { Batch } from './batch.js'\n * @import { DataType, ValueArray } from './types.js'\n */\nimport { bisect } from './util/arrays.js';\nimport { isDirectBatch } from './batch.js';\n\n/**\n * Build up a column from batches.\n */\nexport function columnBuilder(type) {\n  let data = [];\n  return {\n    add(batch) { data.push(batch); return this; },\n    clear: () => data = [],\n    done: () => new Column(data, type)\n  };\n}\n\n/**\n * A data column. A column provides a view over one or more value batches,\n * each drawn from an Arrow record batch. This class supports random access\n * to column values by integer index; however, extracting arrays using\n * `toArray()` or iterating over values (`for (const value of column) {...}`)\n * provide more efficient ways for bulk access or scanning.\n * @template T\n */\nexport class Column {\n  /**\n   * Create a new column instance.\n   * @param {Batch<T>[]} data The value batches.\n   * @param {DataType} [type] The column data type.\n   *  If not specified, the type is extracted from the batches.\n   */\n  constructor(data, type = data[0]?.type) {\n    /**\n     * The column data type.\n     * @type {DataType}\n     * @readonly\n     */\n    this.type = type;\n    /**\n     * The column length.\n     * @type {number}\n     * @readonly\n     */\n    this.length = data.reduce((m, c) => m + c.length, 0);\n    /**\n     * The count of null values in the column.\n     * @type {number}\n     * @readonly\n     */\n    this.nullCount = data.reduce((m, c) => m + c.nullCount, 0);\n    /**\n     * An array of column data batches.\n     * @type {readonly Batch<T>[]}\n     * @readonly\n     */\n    this.data = data;\n\n    const n = data.length;\n    const offsets = new Int32Array(n + 1);\n    if (n === 1) {\n      const [ batch ] = data;\n      offsets[1] = batch.length;\n      // optimize access to single batch\n      this.at = index => batch.at(index);\n    } else {\n      for (let i = 0, s = 0; i < n; ++i) {\n        offsets[i + 1] = (s += data[i].length);\n      }\n    }\n\n    /**\n     * Index offsets for data batches.\n     * Used to map a column row index to a batch-specific index.\n     * @type {Int32Array}\n     * @readonly\n     */\n    this.offsets = offsets;\n  }\n\n  /**\n   * Provide an informative object string tag.\n   */\n  get [Symbol.toStringTag]() {\n    return 'Column';\n  }\n\n  /**\n   * Return an iterator over the values in this column.\n   * @returns {Iterator<T?>}\n   */\n  [Symbol.iterator]() {\n    const data = this.data;\n    return data.length === 1\n      ? data[0][Symbol.iterator]()\n      : batchedIterator(data);\n  }\n\n  /**\n   * Return the column value at the given index. If a column has multiple\n   * batches, this method performs binary search over the batch lengths to\n   * determine the batch from which to retrieve the value. The search makes\n   * lookup less efficient than a standard array access. If making a full\n   * scan of a column, consider extracting arrays via `toArray()` or using an\n   * iterator (`for (const value of column) {...}`).\n   * @param {number} index The row index.\n   * @returns {T | null} The value.\n   */\n  at(index) {\n    // NOTE: if there is only one batch, this method is replaced with an\n    // optimized version in the Column constructor.\n    const { data, offsets } = this;\n    const i = bisect(offsets, index) - 1;\n    return data[i]?.at(index - offsets[i]); // undefined if out of range\n  }\n\n  /**\n   * Return the column value at the given index. This method is the same as\n   * `at()` and is provided for better compatibility with Apache Arrow JS.\n   * @param {number} index The row index.\n   * @returns {T | null} The value.\n   */\n  get(index) {\n    return this.at(index);\n  }\n\n  /**\n   * Extract column values into a single array instance. When possible,\n   * a zero-copy subarray of the input Arrow data is returned.\n   * @returns {ValueArray<T?>}\n   */\n  toArray() {\n    const { length, nullCount, data } = this;\n    const copy = !nullCount && isDirectBatch(data[0]);\n    const n = data.length;\n\n    if (copy && n === 1) {\n      // use batch array directly\n      // @ts-ignore\n      return data[0].values;\n    }\n\n    // determine output array type\n    const ArrayType = !n || nullCount > 0 ? Array\n      // @ts-ignore\n      : (data[0].constructor.ArrayType ?? data[0].values.constructor);\n\n    const array = new ArrayType(length);\n    return copy ? copyArray(array, data) : extractArray(array, data);\n  }\n\n  /**\n   * Return an array of cached column values.\n   * Used internally to accelerate dictionary types.\n   */\n  cache() {\n    return this._cache ?? (this._cache = this.toArray());\n  }\n}\n\nfunction *batchedIterator(data) {\n  for (let i = 0; i < data.length; ++i) {\n    const iter = data[i][Symbol.iterator]();\n    for (let next = iter.next(); !next.done; next = iter.next()) {\n      yield next.value;\n    }\n  }\n}\n\nfunction copyArray(array, data) {\n  for (let i = 0, offset = 0; i < data.length; ++i) {\n    const { values } = data[i];\n    array.set(values, offset);\n    offset += values.length;\n  }\n  return array;\n}\n\nfunction extractArray(array, data) {\n  let index = -1;\n  for (let i = 0; i < data.length; ++i) {\n    const batch = data[i];\n    for (let j = 0; j < batch.length; ++j) {\n      array[++index] = batch.at(j);\n    }\n  }\n  return array;\n}\n","/**\n * @import { Column } from './column.js'\n * @import { Schema, StructFactory, TypeMap, ValueArray } from './types.js'\n */\nimport { bisect } from './util/arrays.js';\nimport { objectFactory, proxyFactory } from './util/struct.js';\n\n/**\n * A table consists of a collection of named columns (or 'children').\n * To work with table data directly in JavaScript, use `toColumns()`\n * to extract an object that maps column names to extracted value arrays,\n * or `toArray()` to extract an array of row objects. For random access\n * by row index, use `getChild()` to access data for a specific column.\n * @template {TypeMap} [T=TypeMap]\n */\nexport class Table {\n  /**\n   * Create a new table with the given schema and columns (children).\n   * @param {Schema} schema The table schema.\n   * @param {Column[]} children The table columns.\n   * @param {boolean} [useProxy=false] Flag indicating if row proxy\n   *  objects should be used to represent table rows (default `false`).\n   */\n  constructor(schema, children, useProxy = false) {\n    const names = schema.fields.map(f => f.name);\n\n    /**\n     * @type {Schema}\n     * @readonly\n     */\n    this.schema = schema;\n    /**\n     * @type {(keyof T)[]}\n     * @readonly\n     */\n    this.names = names;\n    /**\n     * @type {Column[]}\n     * @readonly\n     */\n    this.children = children;\n    /**\n     * @type {StructFactory}\n     * @readonly\n     */\n    this.factory = useProxy ? proxyFactory : objectFactory;\n\n    // lazily created row object generators\n    const gen = [];\n\n    /**\n     * Returns a row object generator for the given batch index.\n     * @private\n     * @readonly\n     * @param {number} b The batch index.\n     * @returns {(index: number) => { [P in keyof T]: T[P] }}\n     */\n    this.getFactory = b => gen[b]\n      ?? (gen[b] = this.factory(names, children.map(c => c.data[b])));\n  }\n\n  /**\n   * Provide an informative object string tag.\n   */\n  get [Symbol.toStringTag]() {\n    return 'Table';\n  }\n\n  /**\n   * The number of columns in this table.\n   * @return {number} The number of columns.\n   */\n  get numCols() {\n    return this.names.length;\n  }\n\n  /**\n   * The number of rows in this table.\n   * @return {number} The number of rows.\n   */\n  get numRows() {\n    return this.children[0]?.length ?? 0;\n  }\n\n  /**\n   * Return the child column at the given index position.\n   * @template {T[keyof T]} R\n   * @param {number} index The column index.\n   * @returns {Column<R>}\n   */\n  getChildAt(index) {\n    return this.children[index];\n  }\n\n  /**\n   * Return the first child column with the given name.\n   * @template {keyof T} P\n   * @param {P} name The column name.\n   * @returns {Column<T[P]>}\n   */\n  getChild(name) {\n    const i = this.names.findIndex(x => x === name);\n    return i > -1 ? this.children[i] : undefined;\n  }\n\n  /**\n   * Construct a new table containing only columns at the specified indices.\n   * The order of columns in the new table matches the order of input indices.\n   * @template {T[keyof T]} V\n   * @param {number[]} indices The indices of columns to keep.\n   * @param {string[]} [as] Optional new names for selected columns.\n   * @returns {Table<{ [key: string]: V }>} A new table with selected columns.\n   */\n  selectAt(indices, as = []) {\n    const { children, factory, schema } = this;\n    const { fields } = schema;\n    return new Table(\n      {\n        ...schema,\n        fields: indices.map((i, j) => renameField(fields[i], as[j]))\n      },\n      indices.map(i => children[i]),\n      factory === proxyFactory\n    );\n  }\n\n  /**\n   * Construct a new table containing only columns with the specified names.\n   * If columns have duplicate names, the first (with lowest index) is used.\n   * The order of columns in the new table matches the order of input names.\n   * @template {keyof T} K\n   * @param {K[]} names Names of columns to keep.\n   * @param {string[]} [as] Optional new names for selected columns.\n   * @returns A new table with columns matching the specified names.\n   */\n  select(names, as) {\n    const all = /** @type {K[]} */(this.names);\n    const indices = names.map(name => all.indexOf(name));\n    return this.selectAt(indices, as);\n  }\n\n  /**\n   * Return an object mapping column names to extracted value arrays.\n   * @returns {{ [P in keyof T]: ValueArray<T[P]> }}\n   */\n  toColumns() {\n    const { children, names } = this;\n    /** @type {{ [P in keyof T]: ValueArray<T[P]> }} */\n    // @ts-expect-error assign to empty object\n    const cols = {};\n    names.forEach((name, i) => cols[name] = children[i]?.toArray() ?? [] );\n    return cols;\n  }\n\n  /**\n   * Return an array of objects representing the rows of this table.\n   * @returns {{ [P in keyof T]: T[P] }[]}\n   */\n  toArray() {\n    const { children, getFactory, numRows } = this;\n    const data = children[0]?.data ?? [];\n    const output = Array(numRows);\n    for (let b = 0, row = -1; b < data.length; ++b) {\n      const f = getFactory(b);\n      for (let i = 0; i < data[b].length; ++i) {\n        output[++row] = f(i);\n      }\n    }\n    return output;\n  }\n\n  /**\n   * Return an iterator over objects representing the rows of this table.\n   * @returns {Generator<{ [P in keyof T]: T[P] }, any, any>}\n   */\n  *[Symbol.iterator]() {\n    const { children, getFactory } = this;\n    const data = children[0]?.data ?? [];\n    for (let b = 0; b < data.length; ++b) {\n      const f = getFactory(b);\n      for (let i = 0; i < data[b].length; ++i) {\n        yield f(i);\n      }\n    }\n  }\n\n  /**\n   * Return a row object for the given index.\n   * @param {number} index The row index.\n   * @returns {{ [P in keyof T]: T[P] }} The row object.\n   */\n  at(index) {\n    const { children, getFactory, numRows } = this;\n    if (index < 0 || index >= numRows) return null;\n    const [{ offsets }] = children;\n    const b = bisect(offsets, index) - 1;\n    return getFactory(b)(index - offsets[b]);\n  }\n\n  /**\n   * Return a row object for the given index. This method is the same as\n   * `at()` and is provided for better compatibility with Apache Arrow JS.\n   * @param {number} index The row index.\n   * @returns {{ [P in keyof T]: T[P] }} The row object.\n   */\n  get(index) {\n    return this.at(index);\n  }\n}\n\nfunction renameField(field, name) {\n  return (name != null && name !== field.name)\n    ? { ...field, name }\n    : field;\n}\n","/**\n * @import { DataType, ExtractionOptions } from './types.js';\n */\nimport { BinaryBatch, BinaryViewBatch, BoolBatch, DateBatch, DateDayBatch, DateDayMillisecondBatch, Decimal32NumberBatch, DecimalBigIntBatch, DecimalNumberBatch, DenseUnionBatch, DictionaryBatch, DirectBatch, FixedBinaryBatch, FixedListBatch, Float16Batch, Int64Batch, IntervalDayTimeBatch, IntervalMonthDayNanoBatch, LargeBinaryBatch, LargeListBatch, LargeListViewBatch, LargeUtf8Batch, ListBatch, ListViewBatch, MapBatch, MapEntryBatch, NullBatch, RunEndEncodedBatch, SparseUnionBatch, StructBatch, StructProxyBatch, TimestampMicrosecondBatch, TimestampMillisecondBatch, TimestampNanosecondBatch, TimestampSecondBatch, Utf8Batch, Utf8ViewBatch } from './batch.js';\nimport { DateUnit, IntervalUnit, TimeUnit, Type } from './constants.js';\nimport { invalidDataType } from './data-types.js';\n\n/**\n * Return a batch constructor for the given data type and extraction options.\n * @param {DataType} type The data type.\n * @param {ExtractionOptions} options The extraction options.\n */\nexport function batchType(type, options = {}) {\n  const { typeId, bitWidth, mode, precision, unit } = /** @type {any} */(type);\n  const { useBigInt, useDate, useDecimalInt, useMap, useProxy } = options;\n\n  switch (typeId) {\n    case Type.Null: return NullBatch;\n    case Type.Bool: return BoolBatch;\n    case Type.Int:\n    case Type.Time:\n    case Type.Duration:\n      return useBigInt || bitWidth < 64 ? DirectBatch : Int64Batch;\n    case Type.Float:\n      return precision ? DirectBatch : Float16Batch;\n    case Type.Date:\n      return wrap(\n        unit === DateUnit.DAY ? DateDayBatch : DateDayMillisecondBatch,\n        useDate && DateBatch\n      );\n    case Type.Timestamp:\n      return wrap(\n        unit === TimeUnit.SECOND ? TimestampSecondBatch\n          : unit === TimeUnit.MILLISECOND ? TimestampMillisecondBatch\n          : unit === TimeUnit.MICROSECOND ? TimestampMicrosecondBatch\n          : TimestampNanosecondBatch,\n        useDate && DateBatch\n      );\n    case Type.Decimal:\n      return bitWidth === 32\n        ? (useDecimalInt ? DirectBatch : Decimal32NumberBatch)\n        : (useDecimalInt ? DecimalBigIntBatch : DecimalNumberBatch);\n    case Type.Interval:\n      return unit === IntervalUnit.DAY_TIME ? IntervalDayTimeBatch\n        : unit === IntervalUnit.YEAR_MONTH ? DirectBatch\n        : IntervalMonthDayNanoBatch;\n    case Type.FixedSizeBinary: return FixedBinaryBatch;\n    case Type.Utf8: return Utf8Batch;\n    case Type.LargeUtf8: return LargeUtf8Batch;\n    case Type.Binary: return BinaryBatch;\n    case Type.LargeBinary: return LargeBinaryBatch;\n    case Type.BinaryView: return BinaryViewBatch;\n    case Type.Utf8View: return Utf8ViewBatch;\n    case Type.List: return ListBatch;\n    case Type.LargeList: return LargeListBatch;\n    case Type.Map: return useMap ? MapBatch : MapEntryBatch;\n    case Type.ListView: return ListViewBatch;\n    case Type.LargeListView: return LargeListViewBatch;\n    case Type.FixedSizeList: return FixedListBatch;\n    case Type.Struct: return useProxy ? StructProxyBatch : StructBatch;\n    case Type.RunEndEncoded: return RunEndEncodedBatch;\n    case Type.Dictionary: return DictionaryBatch;\n    case Type.Union: return mode ? DenseUnionBatch : SparseUnionBatch;\n  }\n  throw new Error(invalidDataType(typeId));\n}\n\nfunction wrap(BaseClass, WrapperClass) {\n  return WrapperClass\n    ? class WrapBatch extends WrapperClass {\n        constructor(options) {\n          super(new BaseClass(options));\n        }\n      }\n    : BaseClass;\n}\n","/**\n * @import { Sink } from './sink.js';\n */\nimport { grow } from '../util/arrays.js';\nimport { SIZEOF_INT, SIZEOF_SHORT, readInt16 } from '../util/read.js';\nimport { encodeUtf8 } from '../util/strings.js';\n\nexport function writeInt32(buf, index, value) {\n  buf[index] = value;\n  buf[index + 1] = value >> 8;\n  buf[index + 2] = value >> 16;\n  buf[index + 3] = value >> 24;\n}\n\nexport function writeInt64(buf, index, value) {\n  const v = BigInt(value);\n  writeInt32(buf, index + 4, Number(BigInt.asIntN(32, v >> BigInt(32))));\n  writeInt32(buf, index + 0, Number(BigInt.asIntN(32, v)));\n}\n\nconst INIT_SIZE = 1024;\n\n/** Flatbuffer binary builder. */\nexport class Builder {\n  /**\n   * Create a new builder instance.\n   * @param {Sink} sink The byte consumer.\n   */\n  constructor(sink) {\n    /**\n     * Sink that consumes built byte buffers.\n     * @type {Sink}\n     */\n    this.sink = sink;\n    /**\n     * Minimum alignment encountered so far.\n     * @type {number}\n     */\n    this.minalign = 1;\n    /**\n     * Current byte buffer.\n     * @type {Uint8Array}\n     */\n    this.buf = new Uint8Array(INIT_SIZE);\n    /**\n     * Remaining space in the current buffer.\n     * @type {number}\n     */\n    this.space = INIT_SIZE;\n    /**\n     * List of offsets of all vtables. Used to find and\n     * reuse tables upon duplicated table field schemas.\n     * @type {number[]}\n     */\n    this.vtables = [];\n    /**\n     * Total bytes written to sink thus far.\n     */\n    this.outputBytes = 0;\n  }\n\n  /**\n   * Returns the flatbuffer offset, relative to the end of the current buffer.\n   * @returns {number} Offset relative to the end of the buffer.\n   */\n  offset() {\n    return this.buf.length - this.space;\n  }\n\n  /**\n   * Write a flatbuffer int8 value at the current buffer position\n   * and advance the internal cursor.\n   * @param {number} value\n   */\n  writeInt8(value) {\n    this.buf[this.space -= 1] = value;\n  }\n\n  /**\n   * Write a flatbuffer int16 value at the current buffer position\n   * and advance the internal cursor.\n   * @param {number} value\n   */\n  writeInt16(value) {\n    this.buf[this.space -= 2] = value;\n    this.buf[this.space + 1] = value >> 8;\n  }\n\n  /**\n   * Write a flatbuffer int32 value at the current buffer position\n   * and advance the internal cursor.\n   * @param {number} value\n   */\n  writeInt32(value) {\n    writeInt32(this.buf, this.space -= 4, value);\n  }\n\n  /**\n   * Write a flatbuffer int64 value at the current buffer position\n   * and advance the internal cursor.\n   * @param {number} value\n   */\n  writeInt64(value) {\n    writeInt64(this.buf, this.space -= 8, value);\n  }\n\n  /**\n   * Add a flatbuffer int8 value, properly aligned,\n   * @param value The int8 value to add the buffer.\n   */\n  addInt8(value) {\n    prep(this, 1, 0);\n    this.writeInt8(value);\n  }\n\n  /**\n   * Add a flatbuffer int16 value, properly aligned,\n   * @param value The int16 value to add the buffer.\n   */\n  addInt16(value) {\n    prep(this, 2, 0);\n    this.writeInt16(value);\n  }\n\n  /**\n   * Add a flatbuffer int32 value, properly aligned,\n   * @param value The int32 value to add the buffer.\n   */\n  addInt32(value) {\n    prep(this, 4, 0);\n    this.writeInt32(value);\n  }\n\n  /**\n   * Add a flatbuffer int64 values, properly aligned.\n   * @param value The int64 value to add the buffer.\n   */\n  addInt64(value) {\n    prep(this, 8, 0);\n    this.writeInt64(value);\n  }\n\n  /**\n   * Add a flatbuffer offset, relative to where it will be written.\n   * @param {number} offset The offset to add.\n   */\n  addOffset(offset) {\n    prep(this, SIZEOF_INT, 0); // Ensure alignment is already done.\n    this.writeInt32(this.offset() - offset + SIZEOF_INT);\n  }\n\n  /**\n   * Add a flatbuffer object (vtable).\n   * @param {number} numFields The maximum number of fields\n   *  this object may include.\n   * @param {(tableBuilder: ReturnType<objectBuilder>) => void} [addFields]\n   *  A callback function that writes all fields using an object builder.\n   * @returns {number} The object offset.\n   */\n  addObject(numFields, addFields) {\n    const b = objectBuilder(this, numFields);\n    addFields?.(b);\n    return b.finish();\n  }\n\n  /**\n   * Add a flatbuffer vector (list).\n   * @template T\n   * @param {T[]} items An array of items to write.\n   * @param {number} itemSize The size in bytes of a serialized item.\n   * @param {number} alignment The desired byte alignment value.\n   * @param {(builder: this, item: T) => void} writeItem A callback\n   *  function that writes a vector item to this builder.\n   * @returns {number} The vector offset.\n   */\n  addVector(items, itemSize, alignment, writeItem) {\n    const n = items?.length;\n    if (!n) return 0;\n    prep(this, SIZEOF_INT, itemSize * n);\n    prep(this, alignment, itemSize * n); // Just in case alignment > int.\n    for (let i = n; --i >= 0;) {\n      writeItem(this, items[i]);\n    }\n    this.writeInt32(n);\n    return this.offset();\n  }\n\n  /**\n   * Convenience method for writing a vector of byte buffer offsets.\n   * @param {number[]} offsets\n   * @returns {number} The vector offset.\n   */\n  addOffsetVector(offsets) {\n    return this.addVector(offsets, 4, 4, (b, off) => b.addOffset(off));\n  }\n\n  /**\n   * Add a flatbuffer UTF-8 string.\n   * @param {string} s The string to encode.\n   * @return {number} The string offset.\n   */\n  addString(s) {\n    if (s == null) return 0;\n    const utf8 = encodeUtf8(s);\n    const n = utf8.length;\n    this.addInt8(0); // string null terminator\n    prep(this, SIZEOF_INT, n);\n    this.buf.set(utf8, this.space -= n);\n    this.writeInt32(n);\n    return this.offset();\n  }\n\n  /**\n   * Finish the current flatbuffer by adding a root offset.\n   * @param {number} rootOffset The root offset.\n   */\n  finish(rootOffset) {\n    prep(this, this.minalign, SIZEOF_INT);\n    this.addOffset(rootOffset);\n  }\n\n  /**\n   * Flush the current flatbuffer byte buffer content to the sink,\n   * and reset the flatbuffer builder state.\n   */\n  flush() {\n    const { buf, sink } = this;\n    const bytes = buf.subarray(this.space, buf.length);\n    sink.write(bytes);\n    this.outputBytes += bytes.byteLength;\n    this.minalign = 1;\n    this.vtables = [];\n    this.buf = new Uint8Array(INIT_SIZE);\n    this.space = INIT_SIZE;\n  }\n\n  /**\n   * Add a byte buffer directly to the builder sink. This method bypasses\n   * any unflushed flatbuffer state and leaves it unchanged, writing the\n   * buffer to the sink *before* the flatbuffer.\n   * The buffer will be padded for 64-bit (8-byte) alignment as needed.\n   * @param {Uint8Array} buffer The buffer to add.\n   * @returns {number} The total byte count of the buffer and padding.\n   */\n  addBuffer(buffer) {\n    const size = buffer.byteLength;\n    if (!size) return 0;\n    this.sink.write(buffer);\n    this.outputBytes += size;\n    const pad = ((size + 7) & ~7) - size;\n    this.addPadding(pad);\n    return size + pad;\n  }\n\n  /**\n   * Write padding bytes directly to the builder sink. This method bypasses\n   * any unflushed flatbuffer state and leaves it unchanged, writing the\n   * padding bytes to the sink *before* the flatbuffer.\n   * @param {number} byteCount The number of padding bytes.\n   */\n  addPadding(byteCount) {\n    if (byteCount > 0) {\n      this.sink.write(new Uint8Array(byteCount));\n      this.outputBytes += byteCount;\n    }\n  }\n}\n\n/**\n * Prepare to write an element of `size` after `additionalBytes` have been\n * written, e.g. if we write a string, we need to align such the int length\n * field is aligned to 4 bytes, and the string data follows it directly. If all\n * we need to do is alignment, `additionalBytes` will be 0.\n * @param {Builder} builder The builder to prep.\n * @param {number} size The size of the new element to write.\n * @param {number} additionalBytes Additional padding size.\n */\nexport function prep(builder, size, additionalBytes) {\n  let { buf, space, minalign } = builder;\n\n  // track the biggest thing we've ever aligned to\n  if (size > minalign) {\n    builder.minalign = size;\n  }\n\n  // find alignment needed so that `size` aligns after `additionalBytes`\n  const bufSize = buf.length;\n  const used = bufSize - space + additionalBytes;\n  const alignSize = (~used + 1) & (size - 1);\n\n  // reallocate the buffer if needed\n  buf = grow(buf, used + alignSize + size - 1, true);\n  space += buf.length - bufSize;\n\n  // add padding\n  for (let i = 0; i < alignSize; ++i) {\n    buf[--space] = 0;\n  }\n\n  // update builder state\n  builder.buf = buf;\n  builder.space = space;\n}\n\n/**\n * Returns a builder object for flatbuffer objects (vtables).\n * @param {Builder} builder The underlying flatbuffer builder.\n * @param {number} numFields The expected number of fields, not\n *  including the standard size fields.\n */\nfunction objectBuilder(builder, numFields) {\n  /** @type {number[]} */\n  const vtable = Array(numFields).fill(0);\n  const startOffset = builder.offset();\n\n  function slot(index) {\n    vtable[index] = builder.offset();\n  }\n\n  return {\n    /**\n     * Add an int8-valued table field.\n     * @param {number} index\n     * @param {number} value\n     * @param {number} defaultValue\n     */\n    addInt8(index, value, defaultValue) {\n      if (value != defaultValue) {\n        builder.addInt8(value);\n        slot(index);\n      }\n    },\n\n    /**\n     * Add an int16-valued table field.\n     * @param {number} index\n     * @param {number} value\n     * @param {number} defaultValue\n     */\n    addInt16(index, value, defaultValue) {\n      if (value != defaultValue) {\n        builder.addInt16(value);\n        slot(index);\n      }\n    },\n\n    /**\n     * Add an int32-valued table field.\n     * @param {number} index\n     * @param {number} value\n     * @param {number} defaultValue\n     */\n    addInt32(index, value, defaultValue) {\n      if (value != defaultValue) {\n        builder.addInt32(value);\n        slot(index);\n      }\n    },\n\n    /**\n     * Add an int64-valued table field.\n     * @param {number} index\n     * @param {number} value\n     * @param {number} defaultValue\n     */\n    addInt64(index, value, defaultValue) {\n      if (value != defaultValue) {\n        builder.addInt64(value);\n        slot(index);\n      }\n    },\n\n    /**\n     * Add a buffer offset-valued table field.\n     * @param {number} index\n     * @param {number} value\n     * @param {number} defaultValue\n     */\n    addOffset(index, value, defaultValue) {\n      if (value != defaultValue) {\n        builder.addOffset(value);\n        slot(index);\n      }\n    },\n\n    /**\n     * Write the vtable to the buffer and return the table offset.\n     * @returns {number} The buffer offset to the vtable.\n     */\n    finish() {\n      // add offset entry, will overwrite later with actual offset\n      builder.addInt32(0);\n      const vtableOffset = builder.offset();\n\n      // trim zero-valued fields (indicating default value)\n      let i = numFields;\n      while (--i >= 0 && vtable[i] === 0) {} // eslint-disable-line no-empty\n      const size = i + 1;\n\n      // Write out the current vtable.\n      for (; i >= 0; --i) {\n        // Offset relative to the start of the table.\n        builder.addInt16(vtable[i] ? (vtableOffset - vtable[i]) : 0);\n      }\n\n      const standardFields = 2; // size fields\n      builder.addInt16(vtableOffset - startOffset);\n      const len = (size + standardFields) * SIZEOF_SHORT;\n      builder.addInt16(len);\n\n      // Search for an existing vtable that matches the current one.\n      let existingTable = 0;\n      const { buf, vtables, space: vt1 } = builder;\n    outer_loop:\n      for (i = 0; i < vtables.length; ++i) {\n        const vt2 = buf.length - vtables[i];\n        if (len == readInt16(buf, vt2)) {\n          for (let j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT) {\n            if (readInt16(buf, vt1 + j) != readInt16(buf, vt2 + j)) {\n              continue outer_loop;\n            }\n          }\n          existingTable = vtables[i];\n          break;\n        }\n      }\n\n      if (existingTable) {\n        // Found a match: remove the current vtable.\n        // Point table to existing vtable.\n        builder.space = buf.length - vtableOffset;\n        writeInt32(buf, builder.space, existingTable - vtableOffset);\n      } else {\n        // No match: add the location of the current vtable to the vtables list.\n        // Point table to current vtable.\n        const off = builder.offset();\n        vtables.push(off);\n        writeInt32(buf, buf.length - vtableOffset, off - vtableOffset);\n      }\n\n      return vtableOffset;\n    }\n  }\n}\n","/** @import { Codec, CompressionType_ } from './types.js' */\nimport { CompressionType } from './constants.js';\nimport { writeInt64 } from './encode/builder.js';\nimport { keyFor } from './util/objects.js';\nimport { readInt64 } from './util/read.js';\n\nconst LENGTH_NO_COMPRESSED_DATA = -1;\nconst COMPRESS_LENGTH_PREFIX = 8;\n\n/**\n * Return an error message for a missing codec.\n * @param {CompressionType_} type The codec type.\n */\nexport function missingCodec(type) {\n  return `Missing compression codec \"${keyFor(CompressionType, type)}\" (id ${type})`;\n}\n\n/** @type {Map<CompressionType_, Codec>} */\nconst codecs = new Map;\n\n/**\n * Register a codec to use for compressing or decompressing Arrow buffers.\n * @param {CompressionType_} type The compression type.\n * @param {Codec} codec The codec implementation.\n */\nexport function setCompressionCodec(type, codec) {\n  codecs.set(type, codec);\n}\n\n/**\n * Returns a compression codec for the provided type, or null if not found.\n * Compression codecs must first be registered using *setCompressionCodec*.\n * @param {CompressionType_ | null} [type] The compression type.\n * @returns {Codec | null} The compression codec, or null if not registered.\n */\nexport function getCompressionCodec(type) {\n  return (type != null && codecs.get(type)) || null;\n}\n\n/**\n * Decompress an Arrow buffer, return decompressed bytes and region metadata.\n * @param {Uint8Array} body The message body.\n * @param {{ offset: number, length: number }} region Buffer region metadata.\n * @param {Codec} codec A compression codec.\n * @returns {{ bytes: Uint8Array, offset: number, length: number }}\n */\nexport function decompressBuffer(body, { offset, length }, codec) {\n  if (length === 0) {\n    return { bytes: new Uint8Array(0), offset: 0, length: 0 };\n  }\n  const ulen = readInt64(body, offset); // uncompressed length\n  const buf = body.subarray(offset + COMPRESS_LENGTH_PREFIX, offset + length);\n  const bytes = (ulen === LENGTH_NO_COMPRESSED_DATA) ? buf : codec.decode(buf);\n  return { bytes, offset: 0, length: bytes.length };\n}\n\n/**\n * Compress an Arrow buffer, return encoded bytes. If the compression does\n * not decrease the overall length, retains uncompressed bytes.\n * @param {Uint8Array} bytes The byte buffer to compress.\n * @param {Codec} codec A compression codec.\n */\nexport function compressBuffer(bytes, codec) {\n  const compressed = codec.encode(bytes);\n  const keep = compressed.length < bytes.length;\n  const data = keep ? compressed : bytes;\n  const buf = new Uint8Array(COMPRESS_LENGTH_PREFIX + data.length);\n  writeInt64(buf, 0, keep ? bytes.length : LENGTH_NO_COMPRESSED_DATA);\n  buf.set(data, COMPRESS_LENGTH_PREFIX);\n  return buf;\n}\n","import { readInt32, readInt64, readVector } from '../util/read.js';\n\n/**\n * Decode a block that points to messages within an Arrow 'file' format.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @returns The file block.\n */\nexport function decodeBlock(buf, index) {\n  //  0: offset\n  //  8: metadataLength\n  // 16: bodyLength\n  return {\n    offset: readInt64(buf, index),\n    metadataLength: readInt32(buf, index + 8),\n    bodyLength: readInt64(buf, index + 16)\n  }\n}\n\n/**\n * Decode a vector of blocks.\n * @param {Uint8Array} buf\n * @param {number} index\n * @returns An array of file blocks.\n */\nexport function decodeBlocks(buf, index) {\n  return readVector(buf, index, 24, decodeBlock);\n}\n","/**\n * @import { BodyCompression, BodyCompressionMethod_, CompressionType_ } from '../types.js'\n */\nimport { BodyCompressionMethod, CompressionType } from '../constants.js';\nimport { readInt8, readObject } from '../util/read.js';\n\n/**\n * Decode record batch body compression metadata.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @returns {BodyCompression | undefined} The body compression metadata\n */\nexport function decodeBodyCompression(buf, index) {\n  //  4: codec\n  //  6: method\n  const get = readObject(buf, index);\n  return {\n    codec: /** @type {CompressionType_} */(\n      get(4, readInt8, CompressionType.LZ4_FRAME)),\n    method: /** @type {BodyCompressionMethod_} */(\n      get(6, readInt8, BodyCompressionMethod.BUFFER))\n  };\n}\n","/**\n * @import { RecordBatch, Version_ } from '../types.js'\n */\nimport { Version } from '../constants.js';\nimport { readInt64, readObject, readOffset, readVector } from '../util/read.js';\nimport { decodeBodyCompression } from './body-compression.js';\n\n/**\n * Decode a record batch.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @param {Version_} version Arrow version value\n * @returns {RecordBatch} The record batch\n */\nexport function decodeRecordBatch(buf, index, version) {\n  //  4: length\n  //  6: nodes\n  //  8: buffers\n  // 10: compression (requires codec plug-in)\n  // 12: variadicBuffers (buffer counts for view-typed fields)\n  const get = readObject(buf, index);\n\n  // If an Arrow buffer was written before version 4,\n  // advance 8 bytes to skip the now-removed page_id field\n  const offset = version < Version.V4 ? 8 : 0;\n\n  return {\n    length: get(4, readInt64, 0),\n    nodes: readVector(buf, get(6, readOffset), 16, (buf, pos) => ({\n      length: readInt64(buf, pos),\n      nullCount: readInt64(buf, pos + 8)\n    })),\n    regions: readVector(buf, get(8, readOffset), 16 + offset, (buf, pos) => ({\n      offset: readInt64(buf, pos + offset),\n      length: readInt64(buf, pos + offset + 8)\n    })),\n    compression: get(10, decodeBodyCompression),\n    variadic: readVector(buf, get(12, readOffset), 8, readInt64)\n  };\n}\n","/**\n * @import { DictionaryBatch, Version_ } from '../types.js'\n */\nimport { readBoolean, readInt64, readObject } from '../util/read.js';\nimport { decodeRecordBatch } from './record-batch.js';\n\n/**\n * Decode a dictionary batch.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @param {Version_} version Arrow version value\n * @returns {DictionaryBatch} The dictionary batch\n */\nexport function decodeDictionaryBatch(buf, index, version) {\n  //  4: id\n  //  6: data\n  //  8: isDelta\n  const get = readObject(buf, index);\n  return {\n    id: get(4, readInt64, 0),\n    data: get(6, (buf, off) => decodeRecordBatch(buf, off, version)),\n    /**\n     * If isDelta is true the values in the dictionary are to be appended to a\n     * dictionary with the indicated id. If isDelta is false this dictionary\n     * should replace the existing dictionary.\n     */\n    isDelta: get(8, readBoolean, false)\n  };\n}\n","/**\n * @import { DataType, Field } from '../types.js'\n */\nimport { DateUnit, IntervalUnit, Precision, TimeUnit, Type, UnionMode } from '../constants.js';\nimport { binary, date, decimal, duration, fixedSizeBinary, fixedSizeList, float, int, interval, invalidDataType, largeBinary, largeList, largeListView, largeUtf8, list, listView, mapType, runEndEncoded, struct, time, timestamp, union, utf8 } from '../data-types.js';\nimport { checkOneOf } from '../util/objects.js';\nimport { readBoolean, readInt16, readInt32, readObject, readOffset, readString, readVector } from '../util/read.js';\n\n/**\n * Decode a data type definition for a field.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data.\n * @param {number} index The starting index in the byte buffer.\n * @param {number} typeId The data type id.\n * @param {Field[]} [children] A list of parsed child fields.\n * @returns {DataType} The data type.\n */\nexport function decodeDataType(buf, index, typeId, children) {\n  checkOneOf(typeId, Type, invalidDataType);\n  const get = readObject(buf, index);\n\n  switch (typeId) {\n    // types without flatbuffer objects\n    case Type.Binary: return binary();\n    case Type.Utf8: return utf8();\n    case Type.LargeBinary: return largeBinary();\n    case Type.LargeUtf8: return largeUtf8();\n    case Type.List: return list(children[0]);\n    case Type.ListView: return listView(children[0]);\n    case Type.LargeList: return largeList(children[0]);\n    case Type.LargeListView: return largeListView(children[0]);\n    case Type.Struct: return struct(children);\n    case Type.RunEndEncoded: return runEndEncoded(children[0], children[1]);\n\n    // types with flatbuffer objects\n    case Type.Int: return int(\n      // @ts-ignore\n      get(4, readInt32, 0), // bitwidth\n      get(6, readBoolean, false) // signed\n    );\n    case Type.Float: return float(\n      // @ts-ignore\n      get(4, readInt16, Precision.HALF) // precision\n    );\n    case Type.Decimal: return decimal(\n      get(4, readInt32, 0), // precision\n      get(6, readInt32, 0), // scale\n      // @ts-ignore\n      get(8, readInt32, 128) // bitwidth\n    );\n    case Type.Date: return date(\n      // @ts-ignore\n      get(4, readInt16, DateUnit.MILLISECOND) // unit\n    );\n    case Type.Time: return time(\n      // @ts-ignore\n      get(4, readInt16, TimeUnit.MILLISECOND) // unit\n    );\n    case Type.Timestamp: return timestamp(\n      // @ts-ignore\n      get(4, readInt16, TimeUnit.SECOND), // unit\n      get(6, readString) // timezone\n    );\n    case Type.Interval: return interval(\n      // @ts-ignore\n      get(4, readInt16, IntervalUnit.YEAR_MONTH) // unit\n    );\n    case Type.Duration: return duration(\n      // @ts-ignore\n      get(4, readInt16, TimeUnit.MILLISECOND) // unit\n    );\n\n    case Type.FixedSizeBinary: return fixedSizeBinary(\n      get(4, readInt32, 0) // stride\n    );\n    case Type.FixedSizeList: return fixedSizeList(\n      children[0],\n      get(4, readInt32, 0), // stride\n    );\n    case Type.Map: return mapType(\n      get(4, readBoolean, false), // keysSorted\n      children[0]\n    );\n\n    case Type.Union: return union(\n      // @ts-ignore\n      get(4, readInt16, UnionMode.Sparse), // mode\n      children,\n      readVector(buf, get(6, readOffset), 4, readInt32) // type ids\n    );\n  }\n  // case Type.NONE:\n  // case Type.Null:\n  // case Type.Bool:\n  // case Type.BinaryView:\n  // case Type.Utf8View:\n  // @ts-ignore\n  return { typeId };\n}\n","/**\n * @import { Metadata } from '../types.js'\n */\nimport { readObject, readString, readVector } from '../util/read.js';\n\n/**\n * Decode custom metadata consisting of key-value string pairs.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @returns {Metadata | null} The custom metadata map\n */\nexport function decodeMetadata(buf, index) {\n  const entries = readVector(buf, index, 4, (buf, pos) => {\n    const get = readObject(buf, pos);\n    return /** @type {[string, string]} */ ([\n      get(4, readString), // 4: key (string)\n      get(6, readString)  // 6: key (string)\n    ]);\n  });\n  return entries.length ? new Map(entries) : null;\n}\n","/**\n * @import { DictionaryType, Endianness_, Field, IntType, Schema, Version_ } from '../types.js'\n */\nimport { Type } from '../constants.js';\nimport { dictionary, int32 } from '../data-types.js';\nimport { readBoolean, readInt16, readInt64, readObject, readOffset, readString, readUint8, readVector } from '../util/read.js';\nimport { decodeDataType } from './data-type.js';\nimport { decodeMetadata } from './metadata.js';\n\n/**\n * Decode a table schema describing the fields and their data types.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @param {Version_} version Arrow version value\n * @returns {Schema} The schema\n */\nexport function decodeSchema(buf, index, version) {\n  //  4: endianness (int16)\n  //  6: fields (vector)\n  //  8: metadata (vector)\n  // 10: features (int64[])\n  const get = readObject(buf, index);\n  return {\n    version,\n    endianness: /** @type {Endianness_} */ (get(4, readInt16, 0)),\n    fields: get(6, decodeSchemaFields, []),\n    metadata: get(8, decodeMetadata)\n  };\n}\n\n/**\n * @returns {Field[] | null}\n */\nfunction decodeSchemaFields(buf, fieldsOffset) {\n  return readVector(buf, fieldsOffset, 4, decodeField);\n}\n\n/**\n * @returns {Field}\n */\nfunction decodeField(buf, index) {\n  //  4: name (string)\n  //  6: nullable (bool)\n  //  8: type id (uint8)\n  // 10: type (union)\n  // 12: dictionary (table)\n  // 14: children (vector)\n  // 16: metadata (vector)\n  const get = readObject(buf, index);\n  const typeId = get(8, readUint8, Type.NONE);\n  const typeOffset = get(10, readOffset, 0);\n  const dict = get(12, decodeDictionary);\n  const children = get(14, decodeFieldChildren, []);\n\n  let type = decodeDataType(buf, typeOffset, typeId, children);\n  if (dict) {\n    dict.dictionary = type;\n    type = dict;\n  }\n\n  return {\n    name: get(4, readString),\n    type,\n    nullable: get(6, readBoolean, false),\n    metadata: get(16, decodeMetadata)\n  };\n}\n\n/**\n * @returns {Field[]}\n */\nfunction decodeFieldChildren(buf, fieldOffset) {\n  return readVector(buf, fieldOffset, 4, decodeField);\n}\n\n/**\n * @param {Uint8Array} buf\n * @param {number} index\n * @returns {DictionaryType}\n */\nfunction decodeDictionary(buf, index) {\n  if (!index) return null;\n  //  4: id (int64)\n  //  6: indexType (Int type)\n  //  8: isOrdered (boolean)\n  // 10: kind (int16) currently only dense array is supported\n  const get = readObject(buf, index);\n  return dictionary(\n    null, // data type will be populated by caller\n    get(6, decodeInt, int32()), // index type\n    get(8, readBoolean, false), // ordered\n    get(4, readInt64, 0), // id\n  );\n}\n\n/**\n * Decode an integer data type.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data.\n * @param {number} index The starting index in the byte buffer.\n * @returns {IntType}\n */\nfunction decodeInt(buf, index) {\n  return /** @type {IntType} */ (\n    decodeDataType(buf, index, Type.Int)\n  );\n}\n","/**\n * @import { Message, MessageHeader_, Version_ } from '../types.js'\n */\nimport { MessageHeader, Version } from '../constants.js';\nimport { keyFor } from '../util/objects.js';\nimport { SIZEOF_INT, readInt16, readInt32, readInt64, readObject, readOffset, readUint8 } from '../util/read.js';\nimport { decodeDictionaryBatch } from './dictionary-batch.js';\nimport { decodeRecordBatch } from './record-batch.js';\nimport { decodeSchema } from './schema.js';\n\nconst invalidMessageMetadata = (expected, actual) =>\n  `Expected to read ${expected} metadata bytes, but only read ${actual}.`;\n\nconst invalidMessageBodyLength = (expected, actual) =>\n  `Expected to read ${expected} bytes for message body, but only read ${actual}.`;\n\nconst invalidMessageType = (type) =>\n  `Unsupported message type: ${type} (${keyFor(MessageHeader, type)})`;\n\n/**\n * A \"message\" contains a block of Apache Arrow data, such as a schema,\n * record batch, or dictionary batch. This message decodes a single\n * message, returning its associated metadata and content.\n * @param {Uint8Array} buf A byte buffer of binary Arrow IPC data\n * @param {number} index The starting index in the byte buffer\n * @returns {Message} The decoded message.\n */\nexport function decodeMessage(buf, index) {\n  // get message start\n  let metadataLength = readInt32(buf, index) || 0;\n  index += SIZEOF_INT;\n\n  // ARROW-6313: If the first 4 bytes are continuation indicator (-1), read\n  // the next 4 for the 32-bit metadata length. Otherwise, assume this is a\n  // pre-v0.15 message, where the first 4 bytes are the metadata length.\n  if (metadataLength === -1) {\n    metadataLength = readInt32(buf, index) || 0;\n    index += SIZEOF_INT;\n  }\n  if (metadataLength === 0) return null;\n\n  const head = buf.subarray(index, index += metadataLength);\n  if (head.byteLength < metadataLength) {\n    throw new Error(invalidMessageMetadata(metadataLength, head.byteLength));\n  }\n\n  // decode message metadata\n  //  4: version\n  //  6: headerType\n  //  8: headerIndex\n  // 10: bodyLength\n  const get = readObject(head, 0);\n  const version = /** @type {Version_} */\n    (get(4, readInt16, Version.V1));\n  const type = /** @type {MessageHeader_} */\n    (get(6, readUint8, MessageHeader.NONE));\n  const offset = get(8, readOffset, 0);\n  const bodyLength = get(10, readInt64, 0);\n  let content;\n\n  if (offset) {\n    // decode message header\n    const decoder = type === MessageHeader.Schema ? decodeSchema\n      : type === MessageHeader.DictionaryBatch ? decodeDictionaryBatch\n      : type === MessageHeader.RecordBatch ? decodeRecordBatch\n      : null;\n    if (!decoder) throw new Error(invalidMessageType(type));\n    content = decoder(head, offset, version);\n\n    // extract message body\n    if (bodyLength > 0) {\n      const body = buf.subarray(index, index += bodyLength);\n      if (body.byteLength < bodyLength) {\n        throw new Error(invalidMessageBodyLength(bodyLength, body.byteLength));\n      }\n      // @ts-ignore\n      content.body = body;\n    } else if (type !== MessageHeader.Schema) {\n      // table-from-ipc.js buffer accessor requires body to exist, even for empty batches\n      // @ts-ignore\n      content.body = new Uint8Array(0);\n    }\n  }\n\n  return { version, type, index, content };\n}\n","/**\n * @import { ArrowData, Version_ } from '../types.js'\n */\nimport { MAGIC, MessageHeader, Version } from '../constants.js';\nimport { isArrayBufferLike } from '../util/arrays.js';\nimport { readInt16, readInt32, readObject } from '../util/read.js';\nimport { decodeBlocks } from './block.js';\nimport { decodeMessage } from './message.js';\nimport { decodeMetadata } from './metadata.js';\nimport { decodeSchema } from './schema.js';\n\n/**\n * Decode [Apache Arrow IPC data][1] and return parsed schema, record batch,\n * and dictionary batch definitions. The input binary data may be either\n * an `ArrayBuffer` or `Uint8Array`. For Arrow data in the IPC 'stream' format,\n * an array of `Uint8Array` instances is also supported.\n *\n * This method stops short of generating views over field buffers. Use the\n * `createData()` method on the result to enable column data access.\n *\n * [1]: https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc\n * @param {ArrayBufferLike | Uint8Array | Uint8Array[]} data\n *  The source byte buffer, or an array of buffers. If an array, each byte\n *  array may contain one or more self-contained messages. Messages may NOT\n *  span multiple byte arrays.\n * @returns {import('../types.js').ArrowData}\n */\nexport function decodeIPC(data) {\n  const source = isArrayBufferLike(data) ? new Uint8Array(data) : data;\n  return source instanceof Uint8Array && isArrowFileFormat(source)\n    ? decodeIPCFile(source)\n    : decodeIPCStream(source);\n}\n\n/**\n * @param {Uint8Array} buf\n * @returns {boolean}\n */\nfunction isArrowFileFormat(buf) {\n  if (!buf || buf.length < 4) return false;\n  for (let i = 0; i < 6; ++i) {\n    if (MAGIC[i] !== buf[i]) return false;\n  }\n  return true;\n}\n\n/**\n * Decode data in the [Arrow IPC 'stream' format][1].\n *\n * [1]: https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format\n * @param {Uint8Array | Uint8Array[]} data The source byte buffer, or an\n *  array of buffers. If an array, each byte array may contain one or more\n *  self-contained messages. Messages may NOT span multiple byte arrays.\n * @returns {ArrowData}\n */\nexport function decodeIPCStream(data) {\n  const stream = [data].flat();\n\n  let schema;\n  const records = [];\n  const dictionaries = [];\n\n  // consume each message in the stream\n  for (const buf of stream) {\n    if (!(buf instanceof Uint8Array)) {\n      throw new Error(`IPC data batch was not a Uint8Array.`);\n    }\n    let offset = 0;\n\n    // decode all messages in current buffer\n    while (true) {\n      const m = decodeMessage(buf, offset);\n      if (m === null) break; // end of messages\n      offset = m.index;\n      if (!m.content) continue;\n      switch (m.type) {\n        case MessageHeader.Schema:\n          // ignore repeated schema messages\n          if (!schema) schema = m.content;\n          break;\n        case MessageHeader.RecordBatch:\n          records.push(m.content);\n          break;\n        case MessageHeader.DictionaryBatch:\n          dictionaries.push(m.content);\n          break;\n      }\n    }\n  }\n\n  return /** @type {ArrowData} */ (\n    { schema, dictionaries, records, metadata: null }\n  );\n}\n\n/**\n * Decode data in the [Arrow IPC 'file' format][1].\n *\n * [1]: https://arrow.apache.org/docs/format/Columnar.html#ipc-file-format\n * @param {Uint8Array} data The source byte buffer.\n * @returns {ArrowData}\n */\nexport function decodeIPCFile(data) {\n  // find footer location\n  const offset = data.byteLength - (MAGIC.length + 4);\n  const length = readInt32(data, offset);\n\n  // decode file footer\n  //  4: version\n  //  6: schema\n  //  8: dictionaries (vector)\n  // 10: batches (vector)\n  // 12: metadata\n  const get = readObject(data, offset - length);\n  const version = /** @type {Version_} */\n    (get(4, readInt16, Version.V1));\n  const dicts = get(8, decodeBlocks, []);\n  const recs = get(10, decodeBlocks, []);\n\n  return /** @type {ArrowData} */ ({\n    schema: get(6, (buf, index) => decodeSchema(buf, index, version)),\n    dictionaries: dicts.map(({ offset }) => decodeMessage(data, offset).content),\n    records: recs.map(({ offset }) => decodeMessage(data, offset).content),\n    metadata: get(12, decodeMetadata)\n  });\n}\n","/**\n * @import { ArrowData, BodyCompression, ExtractionOptions, Field, RecordBatch, Schema } from '../types.js'\n */\nimport { batchType } from '../batch-type.js';\nimport { columnBuilder } from '../column.js';\nimport { decompressBuffer, getCompressionCodec, missingCodec } from '../compression.js';\nimport { BodyCompressionMethod, Type, UnionMode, Version } from '../constants.js';\nimport { invalidDataType } from '../data-types.js';\nimport { Table } from '../table.js';\nimport { int8Array } from '../util/arrays.js';\nimport { decodeIPC } from './decode-ipc.js';\n\n/**\n * Decode [Apache Arrow IPC data][1] and return a new Table. The input binary\n * data may be either an `ArrayBuffer` or `Uint8Array`. For Arrow data in the\n * [IPC 'stream' format][2], an array of `Uint8Array` values is also supported.\n *\n * [1]: https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc\n * [2]: https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format\n * @param {ArrayBufferLike | Uint8Array | Uint8Array[]} data\n *  The source byte buffer, or an array of buffers. If an array, each byte\n *  array may contain one or more self-contained messages. Messages may NOT\n *  span multiple byte arrays.\n * @param {ExtractionOptions} [options]\n *  Options for controlling how values are transformed when extracted\n *  from an Arrow binary representation.\n * @returns {Table} A Table instance.\n */\nexport function tableFromIPC(data, options) {\n  return createTable(decodeIPC(data), options);\n}\n\n/**\n * Create a table from parsed IPC data.\n * @param {ArrowData} data\n *  The IPC data, as returned by parseIPC.\n * @param {ExtractionOptions} [options]\n *  Options for controlling how values are transformed when extracted\n *  from am Arrow binary representation.\n * @returns {Table} A Table instance.\n */\nexport function createTable(data, options = {}) {\n  const { schema = { fields: [] }, dictionaries, records } = data;\n  const { version, fields } = schema;\n  const dictionaryMap = new Map;\n  const context = contextGenerator(options, version, dictionaryMap);\n\n  // build dictionary type map\n  const dictionaryTypes = new Map;\n  visitSchemaFields(schema, field => {\n    const type = field.type;\n    if (type.typeId === Type.Dictionary) {\n      dictionaryTypes.set(type.id, type.dictionary);\n    }\n  });\n\n  // decode dictionaries, build dictionary column map\n  const dicts = new Map;\n  for (const dict of dictionaries) {\n    const { id, data, isDelta, body } = dict;\n    const type = dictionaryTypes.get(id);\n    const batch = visit(type, context({ ...data, body }));\n    if (!dicts.has(id)) {\n      if (isDelta) {\n        throw new Error('Delta update can not be first dictionary batch.');\n      }\n      dicts.set(id, columnBuilder(type).add(batch));\n    } else {\n      const dict = dicts.get(id);\n      if (!isDelta) dict.clear();\n      dict.add(batch);\n    }\n  }\n  dicts.forEach((value, key) => dictionaryMap.set(key, value.done()));\n\n  // decode column fields\n  const cols = fields.map(f => columnBuilder(f.type));\n  for (const batch of records) {\n    const ctx = context(batch);\n    fields.forEach((f, i) => cols[i].add(visit(f.type, ctx)));\n  }\n\n  return new Table(schema, cols.map(c => c.done()), options.useProxy);\n}\n\n/**\n * Visit all fields within a schema.\n * @param {Schema} schema\n * @param {(field: Field) => void} visitor\n */\nfunction visitSchemaFields(schema, visitor) {\n  schema.fields.forEach(function visitField(field) {\n    visitor(field);\n    // @ts-ignore\n    field.type.dictionary?.children?.forEach(visitField);\n    // @ts-ignore\n    field.type.children?.forEach(visitField);\n  });\n}\n\n/**\n * Context object generator for field visitation and buffer definition.\n */\nfunction contextGenerator(options, version, dictionaryMap) {\n  const base = {\n    version,\n    options,\n    dictionary: id => dictionaryMap.get(id),\n  };\n\n  /**\n   * Return a context generator.\n   * @param {RecordBatch} batch\n   */\n  return batch => {\n    const { length, nodes, regions, compression, variadic, body } = batch;\n    let nodeIndex = -1;\n    let bufferIndex = -1;\n    let variadicIndex = -1;\n    return {\n      ...base,\n      length,\n      node: () => nodes[++nodeIndex],\n      buffer: (ArrayType) => {\n        const { bytes, length, offset } = maybeDecompress(body, regions[++bufferIndex], compression);\n        return ArrayType\n          ? new ArrayType(bytes.buffer, bytes.byteOffset + offset, length / ArrayType.BYTES_PER_ELEMENT)\n          : bytes.subarray(offset, offset + length)\n      },\n      variadic: () => variadic[++variadicIndex],\n      visit(children) { return children.map(f => visit(f.type, this)); }\n    };\n  };\n}\n\n/**\n * Prepare an arrow buffer for use, potentially decompressing it.\n * @param {Uint8Array} body\n * @param {{offset: number, length: number}} region\n * @param {BodyCompression} compression\n */\nfunction maybeDecompress(body, region, compression) {\n  if (!compression) {\n    return { bytes: body, ...region };\n  } else if (compression.method !== BodyCompressionMethod.BUFFER) {\n    throw new Error(`Unknown compression method (${compression.method})`);\n  } else {\n    const id = compression.codec;\n    const codec = getCompressionCodec(id);\n    if (!codec) throw new Error(missingCodec(id));\n    return decompressBuffer(body, region, codec);\n  }\n}\n\n/**\n * Visit a field, instantiating views of buffer regions.\n */\nfunction visit(type, ctx) {\n  const { typeId } = type;\n  const { options, node, buffer, variadic, version } = ctx;\n  const BatchType = batchType(type, options);\n\n  // extract the next { length, nullCount } field node - ALL fields have field nodes\n  const base = { ...node(), type };\n\n  if (typeId === Type.Null) {\n    // null fields have field nodes but no data buffers\n    return new BatchType({ ...base, nullCount: base.length });\n  }\n\n  switch (typeId) {\n    // validity and data value buffers\n    case Type.Bool:\n    case Type.Int:\n    case Type.Time:\n    case Type.Duration:\n    case Type.Float:\n    case Type.Decimal:\n    case Type.Date:\n    case Type.Timestamp:\n    case Type.Interval:\n    case Type.FixedSizeBinary:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        values: buffer(type.values)\n      });\n\n    // validity, offset, and value buffers\n    case Type.Utf8:\n    case Type.LargeUtf8:\n    case Type.Binary:\n    case Type.LargeBinary:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        offsets: buffer(type.offsets),\n        values: buffer()\n      });\n\n    // views with variadic buffers\n    case Type.BinaryView:\n    case Type.Utf8View:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        values: buffer(), // views buffer\n        data: Array.from({ length: variadic() }, () => buffer()) // data buffers\n      });\n\n    // validity, offset, and list child\n    case Type.List:\n    case Type.LargeList:\n    case Type.Map:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        offsets: buffer(type.offsets),\n        children: ctx.visit(type.children)\n      });\n\n    // validity, offset, size, and list child\n    case Type.ListView:\n    case Type.LargeListView:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        offsets: buffer(type.offsets),\n        sizes: buffer(type.offsets),\n        children: ctx.visit(type.children)\n      });\n\n    // validity and children\n    case Type.FixedSizeList:\n    case Type.Struct:\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        children: ctx.visit(type.children)\n      });\n\n    // children only\n    case Type.RunEndEncoded:\n      return new BatchType({\n        ...base,\n        children: ctx.visit(type.children)\n      });\n\n    // dictionary\n    case Type.Dictionary: {\n      const { id, indices } = type;\n      return new BatchType({\n        ...base,\n        validity: buffer(),\n        values: buffer(indices.values),\n      }).setDictionary(ctx.dictionary(id));\n    }\n\n    // union\n    case Type.Union: {\n      if (version < Version.V5) {\n        buffer(); // skip unused null bitmap\n      }\n      return new BatchType({\n        ...base,\n        typeIds: buffer(int8Array),\n        offsets: type.mode === UnionMode.Sparse ? null : buffer(type.offsets),\n        children: ctx.visit(type.children)\n      });\n    }\n\n    // unsupported type\n    default:\n      throw new Error(invalidDataType(typeId));\n  }\n}\n","/**\n * @import { BodyCompression, RecordBatch } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { BodyCompressionMethod, CompressionType } from '../constants.js';\n\n/**\n * @param {Builder} builder\n * @param {RecordBatch} batch\n * @param {BodyCompression | null} [compression]\n * @returns {number}\n */\nexport function encodeRecordBatch(builder, batch, compression) {\n  const { nodes, regions, variadic } = batch;\n  const nodeVector = builder.addVector(nodes, 16, 8,\n    (builder, node) => {\n      builder.writeInt64(node.nullCount);\n      builder.writeInt64(node.length);\n      return builder.offset();\n    }\n  );\n  const regionVector = builder.addVector(regions, 16, 8,\n    (builder, region) => {\n      builder.writeInt64(region.length);\n      builder.writeInt64(region.offset);\n      return builder.offset();\n    }\n  );\n  const variadicVector = builder.addVector(variadic, 8, 8,\n    (builder, count) => builder.addInt64(count)\n  );\n  return builder.addObject(5, b => {\n    b.addInt64(0, nodes[0].length, 0);\n    b.addOffset(1, nodeVector, 0);\n    b.addOffset(2, regionVector, 0);\n    b.addOffset(3, encodeCompression(builder, compression), 0);\n    b.addOffset(4, variadicVector, 0);\n  });\n}\n\n/**\n * @param {Builder} builder\n * @param {BodyCompression | null} [compression]\n * @returns {number}\n */\nfunction encodeCompression(builder, compression) {\n  if (!compression) return 0;\n  const { codec, method } = compression;\n  return builder.addObject(2, b => {\n    b.addInt8(0, codec, CompressionType.LZ4_FRAME);\n    b.addInt8(1, method, BodyCompressionMethod.BUFFER);\n  });\n}\n","/**\n * @import { BodyCompression, DictionaryBatch } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { encodeRecordBatch } from './record-batch.js';\n\n/**\n * @param {Builder} builder\n * @param {DictionaryBatch} dictionaryBatch\n * @param {BodyCompression | null} compression\n * @returns {number}\n */\nexport function encodeDictionaryBatch(builder, dictionaryBatch, compression) {\n  const dataOffset = encodeRecordBatch(builder, dictionaryBatch.data, compression);\n  return builder.addObject(3, b => {\n    b.addInt64(0, dictionaryBatch.id, 0);\n    b.addOffset(1, dataOffset, 0);\n    b.addInt8(2, +dictionaryBatch.isDelta, 0);\n  });\n}\n","/**\n * @import { Builder } from './builder.js';\n */\n\n/**\n * @param {Builder} builder\n * @param {Map<string, string>} metadata\n * @returns {number}\n */\nexport function encodeMetadata(builder, metadata) {\n  return metadata?.size > 0\n     ? builder.addOffsetVector(Array.from(metadata, ([k, v]) => {\n        const key = builder.addString(`${k}`);\n        const val = builder.addString(`${v}`);\n        return builder.addObject(2, b => {\n          b.addOffset(0, key, 0);\n          b.addOffset(1, val, 0);\n        });\n      }))\n    : 0;\n}\n","/**\n * @import { DataType } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { DateUnit, IntervalUnit, Precision, TimeUnit, Type, UnionMode } from '../constants.js';\nimport { invalidDataType } from '../data-types.js';\nimport { checkOneOf } from '../util/objects.js';\n\n/**\n * Encode a data type into a flatbuffer.\n * @param {Builder} builder\n * @param {DataType} type\n * @returns {number} The offset at which the data type is written.\n */\nexport function encodeDataType(builder, type) {\n  const typeId = checkOneOf(type.typeId, Type, invalidDataType);\n\n  switch (typeId) {\n    case Type.Dictionary:\n      return encodeDictionary(builder, type);\n    case Type.Int:\n      return encodeInt(builder, type);\n    case Type.Float:\n      return encodeFloat(builder, type);\n    case Type.Decimal:\n      return encodeDecimal(builder, type);\n    case Type.Date:\n      return encodeDate(builder, type);\n    case Type.Time:\n      return encodeTime(builder, type);\n    case Type.Timestamp:\n      return encodeTimestamp(builder, type);\n    case Type.Interval:\n      return encodeInterval(builder, type);\n    case Type.Duration:\n      return encodeDuration(builder, type);\n    case Type.FixedSizeBinary:\n    case Type.FixedSizeList:\n      return encodeFixedSize(builder, type);\n    case Type.Map:\n      return encodeMap(builder, type);\n    case Type.Union:\n      return encodeUnion(builder, type);\n  }\n  // case Type.Null:\n  // case Type.Binary:\n  // case Type.LargeBinary:\n  // case Type.BinaryView:\n  // case Type.Bool:\n  // case Type.Utf8:\n  // case Type.Utf8View:\n  // case Type.LargeUtf8:\n  // case Type.List:\n  // case Type.ListView:\n  // case Type.LargeList:\n  // case Type.LargeListView:\n  // case Type.RunEndEncoded:\n  // case Type.Struct:\n  return builder.addObject(0);\n}\n\nfunction encodeDate(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt16(0, type.unit, DateUnit.MILLISECOND);\n  });\n}\n\nfunction encodeDecimal(builder, type) {\n  return builder.addObject(3, b => {\n    b.addInt32(0, type.precision, 0);\n    b.addInt32(1, type.scale, 0);\n    b.addInt32(2, type.bitWidth, 128);\n  });\n}\n\nfunction encodeDuration(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt16(0, type.unit, TimeUnit.MILLISECOND);\n  });\n}\n\nfunction encodeFixedSize(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt32(0, type.stride, 0);\n  });\n}\n\nfunction encodeFloat(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt16(0, type.precision, Precision.HALF);\n  });\n}\n\nfunction encodeInt(builder, type) {\n  return builder.addObject(2, b => {\n    b.addInt32(0, type.bitWidth, 0);\n    b.addInt8(1, +type.signed, 0);\n  });\n}\n\nfunction encodeInterval(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt16(0, type.unit, IntervalUnit.YEAR_MONTH);\n  });\n}\n\nfunction encodeMap(builder, type) {\n  return builder.addObject(1, b => {\n    b.addInt8(0, +type.keysSorted, 0);\n  });\n}\n\nfunction encodeTime(builder, type) {\n  return builder.addObject(2, b => {\n    b.addInt16(0, type.unit, TimeUnit.MILLISECOND);\n    b.addInt32(1, type.bitWidth, 32);\n  });\n}\n\nfunction encodeTimestamp(builder, type) {\n  const timezoneOffset = builder.addString(type.timezone);\n  return builder.addObject(2, b => {\n    b.addInt16(0, type.unit, TimeUnit.SECOND);\n    b.addOffset(1, timezoneOffset, 0);\n  });\n}\n\nfunction encodeUnion(builder, type) {\n  const typeIdsOffset = builder.addVector(\n    type.typeIds, 4, 4,\n    (builder, value) => builder.addInt32(value)\n  );\n  return builder.addObject(2, b => {\n    b.addInt16(0, type.mode, UnionMode.Sparse);\n    b.addOffset(1, typeIdsOffset, 0);\n  });\n}\n\nfunction encodeDictionary(builder, type) {\n  // The Arrow spec uses signed 32-bit integers as the default index type.\n  // However, multiple 3rd party tools fail on a null (default) index type,\n  // so we always encode the index data type explicitly here.\n  return builder.addObject(4, b => {\n    b.addInt64(0, type.id, 0);\n    b.addOffset(1, encodeDataType(builder, type.indices), 0);\n    b.addInt8(2, +type.ordered, 0);\n    // NOT SUPPORTED: 3, dictionaryKind (defaults to dense array)\n  });\n}\n","/**\n * @import { DictionaryType, Field, Schema } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { Type } from '../constants.js';\nimport { encodeDataType } from './data-type.js';\nimport { encodeMetadata } from './metadata.js';\n\nconst isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;\n\n/**\n * @param {Builder} builder\n * @param {Schema} schema\n * @returns {number}\n */\nexport function encodeSchema(builder, schema) {\n  const { fields, metadata } = schema;\n  const fieldOffsets = fields.map(f => encodeField(builder, f));\n  const fieldsVectorOffset = builder.addOffsetVector(fieldOffsets);\n  const metadataOffset = encodeMetadata(builder, metadata);\n  return builder.addObject(4, b => {\n    b.addInt16(0, +(!isLittleEndian), 0);\n    b.addOffset(1, fieldsVectorOffset, 0);\n    b.addOffset(2, metadataOffset, 0);\n    // NOT SUPPORTED: 3, features\n  });\n}\n\n/**\n * @param {Builder} builder\n * @param {Field} field\n * @returns {number}\n */\nfunction encodeField(builder, field) {\n  const { name, nullable, type, metadata } = field;\n  let { typeId } = type;\n\n  // encode field data type\n  let typeOffset = 0;\n  let dictionaryOffset = 0;\n  if (typeId !== Type.Dictionary) {\n    typeOffset = encodeDataType(builder, type);\n  } else {\n    const dict = /** @type {DictionaryType} */ (type).dictionary;\n    typeId = dict.typeId;\n    dictionaryOffset = encodeDataType(builder, type);\n    typeOffset = encodeDataType(builder, dict);\n  }\n\n  // encode children, metadata, name, and field object\n  // @ts-ignore\n  const childOffsets = (type.children || []).map(f => encodeField(builder, f));\n  const childrenVectorOffset = builder.addOffsetVector(childOffsets);\n  const metadataOffset = encodeMetadata(builder, metadata);\n  const nameOffset = builder.addString(name);\n  return builder.addObject(7, b => {\n    b.addOffset(0, nameOffset, 0);\n    b.addInt8(1, +nullable, +false);\n    b.addInt8(2, typeId, Type.NONE);\n    b.addOffset(3, typeOffset, 0);\n    b.addOffset(4, dictionaryOffset, 0);\n    b.addOffset(5, childrenVectorOffset, 0);\n    b.addOffset(6, metadataOffset, 0);\n  });\n}\n","/**\n * @import { Block, Schema } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { MAGIC, Version } from '../constants.js';\nimport { encodeMetadata } from './metadata.js';\nimport { encodeSchema } from './schema.js';\n\n/**\n * Write a file footer.\n * @param {Builder} builder The binary builder.\n * @param {Schema} schema The table schema.\n * @param {Block[]} dictBlocks Dictionary batch file blocks.\n * @param {Block[]} recordBlocks Record batch file blocks.\n * @param {Map<string,string> | null} metadata File-level metadata.\n */\nexport function writeFooter(builder, schema, dictBlocks, recordBlocks, metadata) {\n  // encode footer flatbuffer\n  const metadataOffset = encodeMetadata(builder, metadata);\n  const recsOffset = builder.addVector(recordBlocks, 24, 8, encodeBlock);\n  const dictsOffset = builder.addVector(dictBlocks, 24, 8, encodeBlock);\n  const schemaOffset = encodeSchema(builder, schema);\n  builder.finish(\n    builder.addObject(5, b => {\n      b.addInt16(0, Version.V5, Version.V1);\n      b.addOffset(1, schemaOffset, 0);\n      b.addOffset(2, dictsOffset, 0);\n      b.addOffset(3, recsOffset, 0);\n      b.addOffset(4, metadataOffset, 0);\n    })\n  );\n  const size = builder.offset();\n\n  // add eos with continuation indicator\n  builder.addInt32(0);\n  builder.addInt32(-1);\n\n  // write builder contents\n  builder.flush();\n\n  // write file tail\n  builder.sink.write(new Uint8Array(Int32Array.of(size).buffer));\n  builder.sink.write(MAGIC);\n}\n\n/**\n * Encode a file pointer block.\n * @param {Builder} builder\n * @param {Block} block\n * @returns {number} the current block offset\n */\nfunction encodeBlock(builder, { offset, metadataLength, bodyLength }) {\n  builder.writeInt64(bodyLength);\n  builder.writeInt32(0);\n  builder.writeInt32(metadataLength);\n  builder.writeInt64(offset);\n  return builder.offset();\n}\n","/**\n * @import { Block, MessageHeader_ } from '../types.js';\n * @import { Builder } from './builder.js';\n */\nimport { MessageHeader, Version } from '../constants.js';\n\n/**\n * Write an IPC message to the builder sink.\n * @param {Builder} builder\n * @param {MessageHeader_} headerType\n * @param {number} headerOffset\n * @param {number} bodyLength\n * @param {Block[]} [blocks]\n */\nexport function writeMessage(builder, headerType, headerOffset, bodyLength, blocks) {\n  builder.finish(\n    builder.addObject(5, b => {\n      b.addInt16(0, Version.V5, Version.V1);\n      b.addInt8(1, headerType, MessageHeader.NONE);\n      b.addOffset(2, headerOffset, 0);\n      b.addInt64(3, bodyLength, 0);\n      // NOT SUPPORTED: 4, message-level metadata\n    })\n  );\n\n  const prefixSize = 8; // continuation indicator + message size\n  const messageSize = builder.offset();\n  const alignedSize = (messageSize + prefixSize + 7) & ~7;\n\n  // track blocks for file footer\n  blocks?.push({\n    offset: builder.outputBytes,\n    metadataLength: alignedSize,\n    bodyLength\n  });\n\n  // write size prefix (including padding)\n  builder.addInt32(alignedSize - prefixSize);\n\n  // write the stream continuation indicator\n  builder.addInt32(-1);\n\n  // flush the builder content\n  builder.flush();\n\n  // add alignment padding as needed\n  builder.addPadding(alignedSize - messageSize - prefixSize);\n}\n","export class Sink {\n  /**\n   * Write bytes to this sink.\n   * @param {Uint8Array} bytes The byte buffer to write.\n   */\n  write(bytes) { // eslint-disable-line no-unused-vars\n  }\n\n  /**\n   * Write padding bytes (zeroes) to this sink.\n   * @param {number} byteCount The number of padding bytes.\n   */\n  pad(byteCount) {\n    this.write(new Uint8Array(byteCount));\n  }\n\n  /**\n   * @returns {Uint8Array | null}\n   */\n  finish() {\n    return null;\n  }\n}\n\nexport class MemorySink extends Sink {\n  /**\n   * A sink that collects bytes in memory.\n   */\n  constructor() {\n    super();\n    this.buffers = [];\n  }\n\n  /**\n   * Write bytes\n   * @param {Uint8Array} bytes\n   */\n  write(bytes) {\n    this.buffers.push(bytes);\n  }\n\n  /**\n   * @returns {Uint8Array}\n   */\n  finish() {\n    const bufs = this.buffers;\n    const size = bufs.reduce((sum, b) => sum + b.byteLength, 0);\n    const buf = new Uint8Array(size);\n    for (let i = 0, off = 0; i < bufs.length; ++i) {\n      buf.set(bufs[i], off);\n      off += bufs[i].byteLength;\n    }\n    return buf;\n  }\n}\n","/**\n * @import { Sink } from './sink.js';\n * @import { CompressionType_ } from '../types.js';\n */\nimport { BodyCompressionMethod, EOS, MAGIC, MessageHeader } from '../constants.js';\nimport { Builder } from './builder.js';\nimport { encodeDictionaryBatch } from './dictionary-batch.js';\nimport { writeFooter } from './footer.js';\nimport { encodeRecordBatch } from './record-batch.js';\nimport { encodeSchema } from './schema.js';\nimport { writeMessage } from './message.js';\nimport { MemorySink } from './sink.js';\n\nconst STREAM = 'stream';\nconst FILE = 'file';\n\n/**\n * Encode assembled data into Arrow IPC binary format.\n * @param {any} data Assembled table data.\n * @param {object} options Encoding options.\n * @param {Sink} [options.sink] IPC byte consumer.\n * @param {'stream' | 'file'} [options.format] Arrow stream or file format.\n * @param {CompressionType_} [options.codec] Compression codec to apply.\n * @returns {Sink} The sink that was passed in.\n */\nexport function encodeIPC(data, { sink, format = STREAM, codec } = {}) {\n  if (format !== STREAM && format !== FILE) {\n    throw new Error(`Unrecognized Arrow IPC format: ${format}`);\n  }\n  const { schema, dictionaries = [], records = [], metadata } = data;\n  const builder = new Builder(sink || new MemorySink());\n  const file = format === FILE;\n  const dictBlocks = [];\n  const recordBlocks = [];\n  const compression = codec != null\n    ? { codec, method: BodyCompressionMethod.BUFFER }\n    : null;\n\n  if (file) {\n    builder.addBuffer(MAGIC);\n  }\n\n  // both stream and file start with the schema\n  if (schema) {\n    writeMessage(\n      builder,\n      MessageHeader.Schema,\n      encodeSchema(builder, schema),\n      0\n    );\n  }\n\n  // write dictionary messages\n  for (const dict of dictionaries) {\n    const { data } = dict;\n    writeMessage(\n      builder,\n      MessageHeader.DictionaryBatch,\n      encodeDictionaryBatch(builder, dict, compression),\n      data.byteLength,\n      dictBlocks\n    );\n    writeBuffers(builder, data.buffers);\n  }\n\n  // write record batch messages\n  for (const batch of records) {\n    writeMessage(\n      builder,\n      MessageHeader.RecordBatch,\n      encodeRecordBatch(builder, batch, compression),\n      batch.byteLength,\n      recordBlocks\n    );\n    writeBuffers(builder, batch.buffers);\n  }\n\n  // both stream and file include end-of-stream message\n  builder.addBuffer(EOS);\n\n  if (file) {\n    writeFooter(builder, schema, dictBlocks, recordBlocks, metadata);\n  }\n\n  return builder.sink;\n}\n\n/**\n * Write byte buffers to the builder sink.\n * Buffers are aligned to 64 bits (8 bytes) as needed.\n * @param {Builder} builder\n * @param {Uint8Array[]} buffers\n */\nfunction writeBuffers(builder, buffers) {\n  for (let i = 0; i < buffers.length; ++i) {\n    builder.addBuffer(buffers[i]); // handles alignment for us\n  }\n}\n","/**\n * @import { Batch, DictionaryBatch } from '../batch.js';\n * @import { Column } from '../column.js';\n * @import { Table } from '../table.js';\n * @import { Codec, CompressionType_, DataType, RecordBatch, Schema, TypedArray } from '../types.js';\n * @import { Sink } from './sink.js';\n */\nimport { compressBuffer, getCompressionCodec, missingCodec } from '../compression.js';\nimport { Type, UnionMode } from '../constants.js';\nimport { invalidDataType } from '../data-types.js';\nimport { encodeIPC } from './encode-ipc.js';\n\n/**\n * Encode an Arrow table into Arrow IPC binary format.\n * @param {Table} table The Arrow table to encode.\n * @param {object} options Encoding options.\n * @param {Sink} [options.sink] IPC byte consumer.\n * @param {'stream' | 'file'} [options.format] Arrow stream or file format.\n * @param {CompressionType_ | null} [options.codec] Compression codec to apply.\n * @returns {Uint8Array | null} The generated bytes (for an in-memory sink)\n *  or null (if using a sink that writes bytes elsewhere).\n */\nexport function tableToIPC(table, options) {\n  // accept a format string option for Arrow-JS compatibility\n  if (typeof options === 'string') {\n    options = { format: options };\n  }\n\n  // resolve compression codec\n  const id = options?.codec;\n  const codec = getCompressionCodec(id);\n  if (id != null && !codec) throw new Error(missingCodec(id));\n\n  const columns = table.children;\n  checkBatchLengths(columns);\n\n  const { dictionaries, idMap } = assembleDictionaryBatches(columns, codec);\n  const records = assembleRecordBatches(columns, codec);\n  const schema = assembleSchema(table.schema, idMap);\n  const data = { schema, dictionaries, records };\n  return encodeIPC(data, { ...options, codec: id }).finish();\n}\n\nfunction checkBatchLengths(columns) {\n  const n = columns[0]?.data.map(d => d.length);\n  columns.forEach(({ data }) => {\n    if (data.length !== n.length || data.some((b, i) => b.length !== n[i])) {\n      throw new Error('Columns have inconsistent batch sizes.');\n    }\n  });\n}\n\n/**\n * Create a new assembly context.\n * @param {Codec} [codec] Optional buffer compression codec.\n */\nfunction assembleContext(codec) {\n  let byteLength = 0;\n  const nodes = [];\n  const regions = [];\n  const buffers = [];\n  const variadic = [];\n  return {\n    /**\n     * @param {number} length\n     * @param {number} nullCount\n     */\n    node(length, nullCount) {\n      nodes.push({ length, nullCount });\n    },\n    /**\n     * @param {TypedArray} b\n     */\n    buffer(b) {\n      const bytes = new Uint8Array(b.buffer, b.byteOffset, b.byteLength);\n      const buf = codec ? compressBuffer(bytes, codec) : bytes;\n      const length = buf.byteLength;\n      regions.push({ offset: byteLength, length });\n      buffers.push(buf);\n      byteLength += ((length + 7) & ~7); // align to padding\n    },\n    /**\n     * @param {number} length\n     */\n    variadic(length) {\n      variadic.push(length);\n    },\n    /**\n     * @param {DataType} type\n     * @param {Batch} batch\n     */\n    children(type, batch) {\n      // @ts-ignore\n      type.children.forEach((field, index) => {\n        visit(field.type, batch.children[index], this);\n      });\n    },\n    /**\n     * @returns {RecordBatch}\n     */\n    done() {\n      return { byteLength, nodes, regions, variadic, buffers };\n    }\n  };\n}\n\n/**\n * Assemble dictionary batches and their unique ids.\n * @param {Column[]} columns The table columns.\n * @param {Codec} [codec] Optional buffer compression codec.\n * @returns {{\n *    dictionaries: DictionaryBatch[],\n *    idMap: Map<DataType, number>\n *  }}\n *  The assembled dictionary batches and a map from dictionary column\n *  instances to dictionary ids.\n */\nfunction assembleDictionaryBatches(columns, codec) {\n  const dictionaries = [];\n  const dictMap = new Map;\n  const idMap = new Map;\n  let id = -1;\n\n  // track dictionaries, key by dictionary column, assign ids\n  const visitor = dictionaryColumn => {\n    if (!dictMap.has(dictionaryColumn)) {\n      dictMap.set(dictionaryColumn, ++id);\n      for (let i = 0; i < dictionaryColumn.data.length; ++i) {\n        dictionaries.push({\n          id,\n          isDelta: i > 0,\n          data: assembleRecordBatch([dictionaryColumn], i, codec)\n        });\n      }\n      idMap.set(dictionaryColumn.type, id);\n    } else {\n      idMap.set(dictionaryColumn.type, dictMap.get(dictionaryColumn));\n    }\n  };\n\n  // recurse through column batches to find dictionaries\n  // it is sufficient to visit the first batch only,\n  // as all batches have the same dictionary column\n  columns.forEach(col => visitDictionaries(col.data[0], visitor));\n\n  return { dictionaries, idMap };\n}\n\n/**\n * Traverse column batches to visit dictionary columns.\n * @param {Batch} batch\n * @param {(column: Column) => void} visitor\n */\nfunction visitDictionaries(batch, visitor) {\n  if (batch?.type.typeId === Type.Dictionary) {\n    // @ts-ignore - batch has type DictionaryBatch\n    const dictionary = batch.dictionary;\n    visitor(dictionary);\n    visitDictionaries(dictionary.data[0], visitor);\n  }\n  batch?.children?.forEach(child => visitDictionaries(child, visitor));\n}\n\n/**\n * Assemble a schema with resolved dictionary ids.\n * @param {Schema} schema The schema.\n * @param {Map<DataType, number>} idMap A map\n *  from dictionary value types to dictionary ids.\n * @returns {Schema} A new schema with resolved\n *  dictionary ids. If there are no dictionaries, the input schema is\n *  returned unchanged.\n */\nfunction assembleSchema(schema, idMap) {\n  // early exit if no dictionaries\n  if (!idMap.size) return schema;\n\n  const visit = type => {\n    if (type.typeId === Type.Dictionary) {\n      type.id = idMap.get(type.dictionary); // lookup and set id\n      visitDictType(type);\n    }\n    if (type.children) {\n      (type.children = type.children.slice()).forEach(visitFields);\n    }\n  };\n\n  // visit a field in a field array\n  const visitFields = (field, index, array) => {\n    const type = { ...field.type };\n    array[index] = { ...field, type };\n    visit(type);\n  };\n\n  // visit a dictionary values type\n  const visitDictType = (parentType) => {\n    const type = { ...parentType.dictionary };\n    parentType.dictionary = type;\n    visit(type);\n  };\n\n  schema = { ...schema, fields: schema.fields.slice() };\n  schema.fields.forEach(visitFields);\n  return schema;\n}\n\n/**\n * Assemble record batches with marshalled buffers.\n * @param {Column[]} columns The table columns.\n * @param {Codec} [codec] Optional buffer compression codec.\n * @returns {RecordBatch[]} The assembled record batches.\n */\nfunction assembleRecordBatches(columns, codec) {\n  return (columns[0]?.data || [])\n    .map((_, index) => assembleRecordBatch(columns, index, codec));\n}\n\n/**\n * Assemble a record batch with marshalled buffers.\n * @param {Column[]} columns The table columns.\n * @param {number} batchIndex The batch index.\n * @param {Codec} [codec] Optional buffer compression codec.\n * @returns {RecordBatch} The assembled record batch.\n */\nfunction assembleRecordBatch(columns, batchIndex = 0, codec) {\n  const ctx = assembleContext(codec);\n  columns.forEach(column => {\n    visit(column.type, column.data[batchIndex], ctx);\n  });\n  return ctx.done();\n}\n\n/**\n * Visit a column batch, assembling buffer data.\n * @param {DataType} type The data type.\n * @param {Batch} batch The column batch.\n * @param {ReturnType<assembleContext>} ctx The assembly context.\n */\nfunction visit(type, batch, ctx) {\n  const { typeId } = type;\n\n  // record field node info - ALL fields need field nodes, including nulls\n  ctx.node(batch.length, batch.nullCount);\n\n  // null fields have field nodes but no data buffers\n  if (typeId === Type.Null) return;\n\n  switch (typeId) {\n    // validity and value buffers\n    // backing dictionaries handled elsewhere\n    case Type.Bool:\n    case Type.Int:\n    case Type.Time:\n    case Type.Duration:\n    case Type.Float:\n    case Type.Date:\n    case Type.Timestamp:\n    case Type.Decimal:\n    case Type.Interval:\n    case Type.FixedSizeBinary:\n    case Type.Dictionary: // dict key values\n      ctx.buffer(batch.validity);\n      ctx.buffer(batch.values);\n      return;\n\n    // validity, offset, and value buffers\n    case Type.Utf8:\n    case Type.LargeUtf8:\n    case Type.Binary:\n    case Type.LargeBinary:\n      ctx.buffer(batch.validity);\n      ctx.buffer(batch.offsets);\n      ctx.buffer(batch.values);\n      return;\n\n    // views with variadic buffers\n    case Type.BinaryView:\n    case Type.Utf8View:\n      ctx.buffer(batch.validity);\n      ctx.buffer(batch.values);\n      // @ts-ignore\n      ctx.variadic(batch.data.length);\n      // @ts-ignore\n      batch.data.forEach(b => ctx.buffer(b));\n      return;\n\n    // validity, offset, and list child\n    case Type.List:\n    case Type.LargeList:\n    case Type.Map:\n      ctx.buffer(batch.validity);\n      ctx.buffer(batch.offsets);\n      ctx.children(type, batch);\n      return;\n\n    // validity, offset, size, and list child\n    case Type.ListView:\n    case Type.LargeListView:\n      ctx.buffer(batch.validity);\n      ctx.buffer(batch.offsets);\n      ctx.buffer(batch.sizes);\n      ctx.children(type, batch);\n      return;\n\n    // validity and children\n    case Type.FixedSizeList:\n    case Type.Struct:\n      ctx.buffer(batch.validity);\n      ctx.children(type, batch);\n      return;\n\n    // children only\n    case Type.RunEndEncoded:\n      ctx.children(type, batch);\n      return;\n\n    // union\n    case Type.Union: {\n      // @ts-ignore\n      ctx.buffer(batch.typeIds);\n      if (type.mode === UnionMode.Dense) {\n        ctx.buffer(batch.offsets);\n      }\n      ctx.children(type, batch);\n      return;\n    }\n\n    // unsupported type\n    default:\n      throw new Error(invalidDataType(typeId));\n  }\n}\n","/**\n * @import { TypedArray, TypedArrayConstructor } from '../types.js'\n */\nimport { align, grow, uint8Array } from '../util/arrays.js';\n\n/**\n * Create a new resizable buffer instance.\n * @param {TypedArrayConstructor} [arrayType]\n *  The array type.\n * @returns {Buffer} The buffer.\n */\nexport function buffer(arrayType) {\n  return new Buffer(arrayType);\n}\n\n/**\n * Resizable byte buffer.\n */\nexport class Buffer {\n  /**\n   * Create a new resizable buffer instance.\n   * @param {TypedArrayConstructor} arrayType\n   */\n  constructor(arrayType = uint8Array) {\n    this.buf = new arrayType(512);\n  }\n  /**\n   * Return the underlying data as a 64-bit aligned array of minimum size.\n   * @param {number} size The desired minimum array size.\n   * @returns {TypedArray} The 64-bit aligned array.\n   */\n  array(size) {\n    return align(this.buf, size);\n  }\n  /**\n   * Prepare for writes to the given index, resizing as necessary.\n   * @param {number} index The array index to prepare to write to.\n   */\n  prep(index) {\n    if (index >= this.buf.length) {\n      this.buf = grow(this.buf, index);\n    }\n  }\n  /**\n   * Return the value at the given index.\n   * @param {number} index The array index.\n   */\n  get(index) {\n    return this.buf[index];\n  }\n  /**\n   * Set a value at the given index.\n   * @param {number | bigint} value The value to set.\n   * @param {number} index The index to write to.\n   */\n  set(value, index) {\n    this.prep(index);\n    this.buf[index] = value;\n  }\n  /**\n   * Write a byte array at the given index. The method should be called\n   * only when the underlying buffer is of type Uint8Array.\n   * @param {Uint8Array} bytes The byte array.\n   * @param {number} index The starting index to write to.\n   */\n  write(bytes, index) {\n    this.prep(index + bytes.length);\n    /** @type {Uint8Array} */ (this.buf).set(bytes, index);\n  }\n}\n\n/**\n * Create a new resizable bitmap instance.\n * @returns {Bitmap} The bitmap buffer.\n */\nexport function bitmap() {\n  return new Bitmap();\n}\n\n/**\n * Resizable bitmap buffer.\n */\nexport class Bitmap extends Buffer {\n  /**\n   * Set a bit to true at the given bitmap index.\n   * @param {number} index The index to write to.\n   */\n  set(index) {\n    const i = index >> 3;\n    this.prep(i);\n    /** @type {Uint8Array} */ (this.buf)[i] |= (1 << (index % 8));\n  }\n}\n","/**\n * @import { Batch } from '../../batch.js'\n */\n\n/**\n * Abstract class for building a column data batch.\n */\nexport class BatchBuilder {\n  constructor(type, ctx) {\n    this.type = type;\n    this.ctx = ctx;\n    this.batchClass = ctx.batchType(type);\n  }\n\n  /**\n   * Initialize the builder state.\n   * @returns {this} This builder.\n   */\n  init() {\n    this.index = -1;\n    return this;\n  }\n\n  /**\n   * Write a value to the builder.\n   * @param {*} value\n   * @param {number} index\n   * @returns {boolean | void}\n   */\n  set(value, index) {\n    this.index = index;\n    return false;\n  }\n\n  /**\n   * Returns a batch constructor options object.\n   * Used internally to marshal batch data.\n   * @returns {Record<string, any>}\n   */\n  done() {\n    return null;\n  }\n\n  /**\n   * Returns a completed batch and reinitializes the builder state.\n   * @returns {Batch}\n   */\n  batch() {\n    const b = new this.batchClass(this.done());\n    this.init();\n    return b;\n  }\n}\n","import { uint8Array } from '../../util/arrays.js';\nimport { bitmap } from '../buffer.js';\nimport { BatchBuilder } from './batch.js';\n\n/**\n * Builder for validity bitmaps within batches.\n */\nexport class ValidityBuilder extends BatchBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n  }\n\n  init() {\n    this.nullCount = 0;\n    this.validity = bitmap();\n    return super.init();\n  }\n\n  /**\n   * @param {*} value\n   * @param {number} index\n   * @returns {boolean | void}\n   */\n  set(value, index) {\n    this.index = index;\n    const isValid = value != null;\n    if (isValid) {\n      this.validity.set(index);\n    } else {\n      this.nullCount++;\n    }\n    return isValid;\n  }\n\n  done() {\n    const { index, nullCount, type, validity } = this;\n    return {\n      length: index + 1,\n      nullCount,\n      type,\n      validity: nullCount\n        ? validity.array((index >> 3) + 1)\n        : new uint8Array(0)\n    };\n  }\n}\n","/**\n * @import { builderContext } from '../builder.js'\n * @import { DictionaryType, ExtractionOptions } from '../../types.js'\n */\nimport { Column } from '../../column.js';\nimport { keyString } from '../../util/strings.js';\nimport { batchType } from '../../batch-type.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Create a context object for managing dictionary builders.\n */\nexport function dictionaryContext() {\n  const idMap = new Map;\n  const dicts = new Set;\n  return {\n    /**\n     * Get a dictionary values builder for the given dictionary type.\n     * @param {DictionaryType} type\n     *  The dictionary type.\n     * @param {*} ctx The builder context.\n     * @returns {ReturnType<dictionaryValues>}\n     */\n    get(type, ctx) {\n      // if a dictionary has a non-negative id, assume it was set\n      // intentionally and track it for potential reuse across columns\n      // otherwise the dictionary is used for a single column only\n      const id = type.id;\n      if (id >= 0 && idMap.has(id)) {\n        return idMap.get(id);\n      } else {\n        const dict = dictionaryValues(type, ctx);\n        if (id >= 0) idMap.set(id, dict);\n        dicts.add(dict);\n        return dict;\n      }\n    },\n    /**\n     * Finish building dictionary values columns and assign them to\n     * their corresponding dictionary batches.\n     * @param {ExtractionOptions} options\n     */\n    finish(options) {\n      dicts.forEach(dict => dict.finish(options));\n    }\n  };\n}\n\n/**\n * Builder helper for creating dictionary values.\n * @param {DictionaryType} type\n *  The dictionary data type.\n * @param {ReturnType<builderContext>} ctx\n *  The builder context.\n */\nexport function dictionaryValues(type, ctx) {\n  const keys = Object.create(null);\n  const values = ctx.builder(type.dictionary);\n  const batches = [];\n\n  values.init();\n  let index = -1;\n\n  return {\n    type,\n    values,\n\n    add(batch) {\n      batches.push(batch);\n      return batch;\n    },\n\n    key(value) {\n      const v = keyString(value);\n      let k = keys[v];\n      if (k === undefined) {\n        keys[v] = k = ++index;\n        values.set(value, k);\n      }\n      return k;\n    },\n\n    finish(options) {\n      const valueType = type.dictionary;\n      const batch = new (batchType(valueType, options))(values.done());\n      const dictionary = new Column([batch]);\n      batches.forEach(batch => batch.setDictionary(dictionary));\n    }\n  };\n}\n\n/**\n * Builder for dictionary-typed data batches.\n */\nexport class DictionaryBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.dict = ctx.dictionary(type);\n  }\n\n  init() {\n    this.values = buffer(this.type.indices.values);\n    return super.init();\n  }\n\n  set(value, index) {\n    if (super.set(value, index)) {\n      this.values.set(this.dict.key(value), index);\n    }\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      values: this.values.array(this.index + 1)\n    };\n  }\n\n  batch() {\n    // register batch with dictionary\n    // batch will be updated when the dictionary is finished\n    return this.dict.add(super.batch());\n  }\n}\n","/**\n * @import { DataType, IntType, UnionType } from '../types.js'\n */\nimport { bool, dateDay, dictionary, field, fixedSizeList, float64, int16, int32, int64, int8, list, nullType, struct, timestamp, utf8 } from '../data-types.js';\nimport { isArray } from '../util/arrays.js';\n\n/**\n * Infer the data type for a given input array.\n * @param {(visitor: (value: any) => void) => void} visit\n *  A function that applies a callback to successive data values.\n * @returns {DataType} The data type.\n */\nexport function inferType(visit) {\n  const profile = profiler();\n  visit(value => profile.add(value));\n  return profile.type();\n}\n\nfunction profiler() {\n  let length = 0;\n  let nullCount = 0;\n  let boolCount = 0;\n  let numberCount = 0;\n  let intCount = 0;\n  let bigintCount = 0;\n  let dateCount = 0;\n  let dayCount = 0;\n  let stringCount = 0;\n  let arrayCount = 0;\n  let structCount = 0;\n  let min = Infinity;\n  let max = -Infinity;\n  let minLength = Infinity;\n  let maxLength = -Infinity;\n  let minBigInt;\n  let maxBigInt;\n  let arrayProfile;\n  let structProfiles = {};\n\n  return {\n    add(value) {\n      length++;\n      if (value == null) {\n        nullCount++;\n        return;\n      }\n      switch (typeof value) {\n        case 'string':\n          stringCount++;\n          break;\n        case 'number':\n          numberCount++;\n          if (value < min) min = value;\n          if (value > max) max = value;\n          if (Number.isInteger(value)) intCount++;\n          break;\n        case 'bigint':\n          bigintCount++;\n          if (minBigInt === undefined) {\n            minBigInt = maxBigInt = value;\n          } else {\n            if (value < minBigInt) minBigInt = value;\n            if (value > maxBigInt) maxBigInt = value;\n          }\n          break;\n        case 'boolean':\n          boolCount++;\n          break;\n        case 'object':\n          if (value instanceof Date) {\n            dateCount++;\n            // 1 day = 1000ms * 60s * 60min * 24hr = 86400000\n            if ((+value % 864e5) === 0) dayCount++;\n          } else if (isArray(value)) {\n            arrayCount++;\n            const len = value.length;\n            if (len < minLength) minLength = len;\n            if (len > maxLength) maxLength = len;\n            arrayProfile ??= profiler();\n            value.forEach(arrayProfile.add);\n          } else {\n            structCount++;\n            for (const key in value) {\n              const fieldProfiler = structProfiles[key]\n                ?? (structProfiles[key] = profiler());\n              fieldProfiler.add(value[key]);\n            }\n          }\n      }\n    },\n    type() {\n      const valid = length - nullCount;\n      return valid === 0 ? nullType()\n        : intCount === valid ? intType(min, max)\n        : numberCount === valid ? float64()\n        : bigintCount === valid ? bigintType(minBigInt, maxBigInt)\n        : boolCount === valid ? bool()\n        : dayCount === valid ? dateDay()\n        : dateCount === valid ? timestamp()\n        : stringCount === valid ? dictionary(utf8())\n        : arrayCount === valid ? arrayType(arrayProfile.type(), minLength, maxLength)\n        : structCount === valid ? struct(\n            Object.entries(structProfiles).map(_ => field(_[0], _[1].type()))\n          )\n        : unionType();\n    }\n  };\n}\n\n/**\n * Return a list or fixed list type.\n * @param {DataType} type The child data type.\n * @param {number} minLength The minumum list length.\n * @param {number} maxLength The maximum list length.\n * @returns {DataType} The data type.\n */\nfunction arrayType(type, minLength, maxLength) {\n  return maxLength === minLength\n    ? fixedSizeList(type, minLength)\n    : list(type);\n}\n\n/**\n * @param {number} min\n * @param {number} max\n * @returns {DataType}\n */\nfunction intType(min, max) {\n  const v = Math.max(Math.abs(min) - 1, max);\n  return v < (1 << 7) ? int8()\n    : v < (1 << 15) ? int16()\n    : v < (2 ** 31) ? int32()\n    : float64();\n}\n\n/**\n * @param {bigint} min\n * @param {bigint} max\n * @returns {IntType}\n */\nfunction bigintType(min, max) {\n  const v = -min > max ? -min - 1n : max;\n  if (v >= 2 ** 63) {\n    throw new Error(`BigInt exceeds 64 bits: ${v}`);\n  }\n  return int64();\n}\n\n/**\n * @returns {UnionType}\n */\nfunction unionType() {\n  throw new Error('Mixed types detected, please define a union type.');\n}\n","import { toOffset } from '../../util/numbers.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for batches of binary-typed data.\n */\nexport class BinaryBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.toOffset = toOffset(type.offsets);\n  }\n\n  init() {\n    this.offsets = buffer(this.type.offsets);\n    this.values = buffer();\n    this.pos = 0;\n    return super.init();\n  }\n\n  set(value, index) {\n    const { offsets, values, toOffset } = this;\n    if (super.set(value, index)) {\n      values.write(value, this.pos);\n      this.pos += value.length;\n    }\n    offsets.set(toOffset(this.pos), index + 1);\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      offsets: this.offsets.array(this.index + 2),\n      values: this.values.array(this.pos + 1)\n    };\n  }\n}\n","import { bitmap } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for batches of bool-typed data.\n */\nexport class BoolBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n  }\n\n  init() {\n    this.values = bitmap();\n    return super.init();\n  }\n\n  set(value, index) {\n    super.set(value, index);\n    if (value) this.values.set(index);\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      values: this.values.array((this.index >> 3) + 1)\n    }\n  }\n}\n","import { toDecimal } from '../../util/numbers.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for batches of decimal-typed data (64-bits or more).\n */\nexport class DecimalBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.scale = 10 ** type.scale;\n    this.stride = type.bitWidth >> 6;\n  }\n\n  init() {\n    this.values = buffer(this.type.values);\n    return super.init();\n  }\n\n  set(value, index) {\n    const { scale, stride, values } = this;\n    if (super.set(value, index)) {\n      values.prep((index + 1) * stride);\n      // @ts-ignore\n      toDecimal(value, values.buf, index * stride, stride, scale);\n    }\n  }\n\n  done() {\n    const { index, stride, values } = this;\n    return {\n      ...super.done(),\n      values: values.array((index + 1) * stride)\n    };\n  }\n}\n","import { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for fixed-size-binary-typed data batches.\n */\nexport class FixedSizeBinaryBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.stride = type.stride;\n  }\n\n  init() {\n    this.values = buffer();\n    return super.init();\n  }\n\n  set(value, index) {\n    if (super.set(value, index)) {\n      this.values.write(value, index * this.stride);\n    }\n  }\n\n  done() {\n    const { stride, values } = this;\n    return {\n      ...super.done(),\n      values: values.array(stride * (this.index + 1))\n    };\n  }\n}\n","import { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for fixed-size-list-typed data batches.\n */\nexport class FixedSizeListBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.child = ctx.builder(this.type.children[0].type);\n    this.stride = type.stride;\n  }\n\n  init() {\n    this.child.init();\n    return super.init();\n  }\n\n  set(value, index) {\n    const { child, stride } = this;\n    const base = index * stride;\n    if (super.set(value, index)) {\n      for (let i = 0; i < stride; ++i) {\n        child.set(value[i], base + i);\n      }\n    } else {\n      child.index = base + stride;\n    }\n  }\n\n  done() {\n    const { child } = this;\n    return {\n      ...super.done(),\n      children: [ child.batch() ]\n    };\n  }\n}\n","import { toMonthDayNanoBytes } from '../../util/numbers.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for day/time interval-typed data batches.\n */\nexport class IntervalDayTimeBuilder extends ValidityBuilder {\n  init() {\n    this.values = buffer(this.type.values);\n    return super.init();\n  }\n\n  set(value, index) {\n    if (super.set(value, index)) {\n      const i = index << 1;\n      this.values.set(value[0], i);\n      this.values.set(value[1], i + 1);\n    }\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      values: this.values.array((this.index + 1) << 1)\n    }\n  }\n}\n\n/**\n * Builder for month/day/nano interval-typed data batches.\n */\nexport class IntervalMonthDayNanoBuilder extends ValidityBuilder {\n  init() {\n    this.values = buffer();\n    return super.init();\n  }\n\n  set(value, index) {\n    if (super.set(value, index)) {\n      this.values.write(toMonthDayNanoBytes(value), index << 4);\n    }\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      values: this.values.array((this.index + 1) << 4)\n    }\n  }\n}\n","import { toOffset } from '../../util/numbers.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Abstract class for building list data batches.\n */\nexport class AbstractListBuilder extends ValidityBuilder {\n  constructor(type, ctx, child) {\n    super(type, ctx);\n    this.child = child;\n  }\n\n  init() {\n    this.child.init();\n    const offsetType = this.type.offsets;\n    this.offsets = buffer(offsetType);\n    this.toOffset = toOffset(offsetType);\n    this.pos = 0;\n    return super.init();\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      offsets: this.offsets.array(this.index + 2),\n      children: [ this.child.batch() ]\n    };\n  }\n}\n\n/**\n * Builder for list-typed data batches.\n */\nexport class ListBuilder extends AbstractListBuilder {\n  constructor(type, ctx) {\n    super(type, ctx, ctx.builder(type.children[0].type));\n  }\n\n  set(value, index) {\n    const { child, offsets, toOffset } = this;\n    if (super.set(value, index)) {\n      value.forEach(v => child.set(v, this.pos++));\n    }\n    offsets.set(toOffset(this.pos), index + 1);\n  }\n}\n","import { ValidityBuilder } from './validity.js';\n\n/**\n * Abstract class for building list-typed data batches.\n */\nexport class AbstractStructBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.children = type.children.map(c => ctx.builder(c.type));\n  }\n\n  init() {\n    this.children.forEach(c => c.init());\n    return super.init();\n  }\n\n  done() {\n    const { children } = this;\n    children.forEach(c => c.index = this.index);\n    return {\n      ...super.done(),\n      children: children.map(c => c.batch())\n    };\n  }\n}\n\n/**\n * Builder for struct-typed data batches.\n */\nexport class StructBuilder extends AbstractStructBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.setters = this.children.map((child, i) => {\n      const name = type.children[i].name;\n      return (value, index) => child.set(value?.[name], index);\n    });\n  }\n\n  set(value, index) {\n    super.set(value, index);\n    const setters = this.setters;\n    for (let i = 0; i < setters.length; ++i) {\n      setters[i](value, index);\n    }\n  }\n}\n","import { AbstractListBuilder } from './list.js';\nimport { AbstractStructBuilder } from './struct.js';\n\n/**\n * Builder for map-typed data batches.\n */\nexport class MapBuilder extends AbstractListBuilder {\n  constructor(type, ctx) {\n    super(type, ctx, new MapStructBuilder(type.children[0].type, ctx));\n  }\n\n  set(value, index) {\n    const { child, offsets, toOffset } = this;\n    if (super.set(value, index)) {\n      for (const keyValuePair of value) {\n        child.set(keyValuePair, this.pos++);\n      }\n    }\n    offsets.set(toOffset(this.pos), index + 1);\n  }\n}\n\n/**\n * Builder for key-value struct batches within a map.\n */\nclass MapStructBuilder extends AbstractStructBuilder {\n  set(value, index) {\n    super.set(value, index);\n    const [key, val] = this.children;\n    key.set(value[0], index);\n    val.set(value[1], index);\n  }\n}\n","import { keyString } from '../../util/strings.js';\nimport { BatchBuilder } from './batch.js';\n\nconst NO_VALUE = {}; // empty object that fails strict equality\n\n/**\n * Builder for run-end-encoded-typed data batches.\n */\nexport class RunEndEncodedBuilder extends BatchBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.children = type.children.map(c => ctx.builder(c.type));\n  }\n\n  init() {\n    this.pos = 0;\n    this.key = null;\n    this.value = NO_VALUE;\n    this.children.forEach(c => c.init());\n    return super.init();\n  }\n\n  next() {\n    const [runs, vals] = this.children;\n    runs.set(this.index + 1, this.pos);\n    vals.set(this.value, this.pos++);\n  }\n\n  set(value, index) {\n    // perform fast strict equality test\n    if (value !== this.value) {\n      // if no match, fallback to key string test\n      const key = keyString(value);\n      if (key !== this.key) {\n        // if key doesn't match, write prior run and update\n        if (this.key) this.next();\n        this.key = key;\n        this.value = value;\n      }\n    }\n    this.index = index;\n  }\n\n  done() {\n    this.next();\n    const { children, index, type } = this;\n    return {\n      length: index + 1,\n      nullCount: 0,\n      type,\n      children: children.map(c => c.batch())\n    };\n  }\n}\n","import { int8Array } from '../../util/arrays.js';\nimport { BatchBuilder } from './batch.js';\nimport { buffer } from '../buffer.js';\n\n/**\n * Abstract class for building union-typed data batches.\n */\nexport class AbstractUnionBuilder extends BatchBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.children = type.children.map(c => ctx.builder(c.type));\n    this.typeMap = type.typeMap;\n    this.lookup = type.typeIdForValue;\n  }\n\n  init() {\n    this.nullCount = 0;\n    this.typeIds = buffer(int8Array);\n    this.children.forEach(c => c.init());\n    return super.init();\n  }\n\n  set(value, index) {\n    const { children, lookup, typeMap, typeIds } = this;\n    this.index = index;\n    const typeId = lookup(value, index);\n    const child = children[typeMap[typeId]];\n    typeIds.set(typeId, index);\n    if (value == null) ++this.nullCount;\n    // @ts-ignore\n    this.update(value, index, child);\n  }\n\n  done() {\n    const { children, nullCount, type, typeIds } = this;\n    const length = this.index + 1;\n    return {\n      length,\n      nullCount,\n      type,\n      typeIds: typeIds.array(length),\n      children: children.map(c => c.batch())\n    };\n  }\n}\n\n/**\n * Builder for sparse union-typed data batches.\n */\nexport class SparseUnionBuilder extends AbstractUnionBuilder {\n  update(value, index, child) {\n    // update selected child with value\n    // then set all other children to null\n    child.set(value, index);\n    this.children.forEach(c => { if (c !== child) c.set(null, index) });\n  }\n}\n\n/**\n * Builder for dense union-typed data batches.\n */\nexport class DenseUnionBuilder extends AbstractUnionBuilder {\n  init() {\n    this.offsets = buffer(this.type.offsets);\n    return super.init();\n  }\n\n  update(value, index, child) {\n    const offset = child.index + 1;\n    child.set(value, offset);\n    this.offsets.set(offset, index);\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      offsets: this.offsets.array(this.index + 1)\n    };\n  }\n}\n","import { encodeUtf8 } from '../../util/strings.js';\nimport { BinaryBuilder } from './binary.js';\n\n/**\n * Builder for utf8-typed data batches.\n */\nexport class Utf8Builder extends BinaryBuilder {\n  set(value, index) {\n    super.set(value && encodeUtf8(value), index);\n  }\n}\n","import { toBigInt } from '../../util/numbers.js';\nimport { buffer } from '../buffer.js';\nimport { ValidityBuilder } from './validity.js';\n\n/**\n * Builder for data batches that can be accessed directly as typed arrays.\n */\nexport class DirectBuilder extends ValidityBuilder {\n  constructor(type, ctx) {\n    super(type, ctx);\n    this.values = buffer(type.values);\n  }\n\n  init() {\n    this.values = buffer(this.type.values);\n    return super.init();\n  }\n\n  /**\n   * @param {*} value\n   * @param {number} index\n   * @returns {boolean | void}\n   */\n  set(value, index) {\n    if (super.set(value, index)) {\n      this.values.set(value, index);\n    }\n  }\n\n  done() {\n    return {\n      ...super.done(),\n      values: this.values.array(this.index + 1)\n    };\n  }\n}\n\n/**\n * Builder for int64/uint64 data batches written as bigints.\n */\nexport class Int64Builder extends DirectBuilder {\n  set(value, index) {\n    super.set(value == null ? value : toBigInt(value), index);\n  }\n}\n\n/**\n * Builder for data batches whose values must pass through a transform\n * function prior to be written to a backing buffer.\n */\nexport class TransformBuilder extends DirectBuilder {\n  constructor(type, ctx, transform) {\n    super(type, ctx);\n    this.transform = transform;\n  }\n  set(value, index) {\n    super.set(value == null ? value : this.transform(value), index);\n  }\n}\n","/**\n * @import { DataType, ExtractionOptions } from '../types.js'\n * @import { BatchBuilder } from './builders/batch.js'\n */\nimport { batchType } from '../batch-type.js';\nimport { IntervalUnit, Type } from '../constants.js';\nimport { invalidDataType } from '../data-types.js';\nimport { isInt64ArrayType } from '../util/arrays.js';\nimport { toBigInt, toDateDay, toDecimal32, toFloat16, toTimestamp } from '../util/numbers.js';\nimport { BinaryBuilder } from './builders/binary.js';\nimport { BoolBuilder } from './builders/bool.js';\nimport { DecimalBuilder } from './builders/decimal.js';\nimport { DictionaryBuilder, dictionaryContext } from './builders/dictionary.js';\nimport { FixedSizeBinaryBuilder } from './builders/fixed-size-binary.js';\nimport { FixedSizeListBuilder } from './builders/fixed-size-list.js';\nimport { IntervalDayTimeBuilder, IntervalMonthDayNanoBuilder } from './builders/interval.js';\nimport { ListBuilder } from './builders/list.js';\nimport { MapBuilder } from './builders/map.js';\nimport { RunEndEncodedBuilder } from './builders/run-end-encoded.js';\nimport { StructBuilder } from './builders/struct.js';\nimport { DenseUnionBuilder, SparseUnionBuilder } from './builders/union.js';\nimport { Utf8Builder } from './builders/utf8.js';\nimport { DirectBuilder, Int64Builder, TransformBuilder } from './builders/values.js';\n\n/**\n * Create a context object for shared builder state.\n * @param {ExtractionOptions} [options]  Batch extraction options.\n* @param {ReturnType<dictionaryContext>} [dictionaries]\n *  Context object for tracking dictionaries.\n */\nexport function builderContext(\n  options = {},\n  dictionaries = dictionaryContext()\n) {\n  return {\n    batchType: type => batchType(type, options),\n    builder(type) { return builder(type, this); },\n    dictionary(type) { return dictionaries.get(type, this); },\n    finish: () => dictionaries.finish(options)\n  };\n}\n\n/**\n * Returns a batch builder for the given type and builder context.\n * @param {DataType} type A data type.\n * @param {ReturnType<builderContext>} [ctx] A builder context.\n * @returns {BatchBuilder}\n */\nexport function builder(type, ctx = builderContext()) {\n  const { typeId } = type;\n  switch (typeId) {\n    case Type.Int:\n    case Type.Time:\n    case Type.Duration:\n      return isInt64ArrayType(type.values)\n        ? new Int64Builder(type, ctx)\n        : new DirectBuilder(type, ctx);\n    case Type.Float:\n      return type.precision\n        ? new DirectBuilder(type, ctx)\n        : new TransformBuilder(type, ctx, toFloat16)\n    case Type.Binary:\n    case Type.LargeBinary:\n      return new BinaryBuilder(type, ctx);\n    case Type.Utf8:\n    case Type.LargeUtf8:\n      return new Utf8Builder(type, ctx);\n    case Type.Bool:\n      return new BoolBuilder(type, ctx);\n    case Type.Decimal:\n      return type.bitWidth === 32\n        ? new TransformBuilder(type, ctx, toDecimal32(type.scale))\n        : new DecimalBuilder(type, ctx);\n    case Type.Date:\n      return new TransformBuilder(type, ctx, type.unit ? toBigInt : toDateDay);\n    case Type.Timestamp:\n      return new TransformBuilder(type, ctx, toTimestamp(type.unit));\n    case Type.Interval:\n      switch (type.unit) {\n        case IntervalUnit.DAY_TIME:\n          return new IntervalDayTimeBuilder(type, ctx);\n        case IntervalUnit.MONTH_DAY_NANO:\n          return new IntervalMonthDayNanoBuilder(type, ctx);\n      }\n      // case IntervalUnit.YEAR_MONTH:\n      return new DirectBuilder(type, ctx);\n    case Type.List:\n    case Type.LargeList:\n      return new ListBuilder(type, ctx);\n    case Type.Struct:\n      return new StructBuilder(type, ctx);\n    case Type.Union:\n      return type.mode\n        ? new DenseUnionBuilder(type, ctx)\n        : new SparseUnionBuilder(type, ctx);\n    case Type.FixedSizeBinary:\n      return new FixedSizeBinaryBuilder(type, ctx);\n    case Type.FixedSizeList:\n      return new FixedSizeListBuilder(type, ctx);\n    case Type.Map:\n      return new MapBuilder(type, ctx);\n    case Type.RunEndEncoded:\n      return new RunEndEncodedBuilder(type, ctx);\n\n    case Type.Dictionary:\n      return new DictionaryBuilder(type, ctx);\n  }\n  // case Type.BinaryView:\n  // case Type.Utf8View:\n  // case Type.ListView:\n  // case Type.LargeListView:\n  throw new Error(invalidDataType(typeId));\n}\n","/**\n * @import { ColumnBuilderOptions, DataType, NullType } from '../types.js'\n * @import { dictionaryContext } from './builders/dictionary.js'\n */\nimport { NullBatch } from '../batch.js';\nimport { Column } from '../column.js';\nimport { inferType } from './infer-type.js';\nimport { builder, builderContext } from './builder.js';\nimport { Type } from '../constants.js';\nimport { isIterable } from '../util/objects.js';\n\n/**\n * Create a new column by iterating over provided values.\n * @template T\n * @param {Iterable | ((callback: (value: any) => void) => void)} values\n *  Either an iterable object or a visitor function that applies a callback\n *  to successive data values (akin to Array.forEach).\n * @param {DataType} [type] The data type.\n * @param {ColumnBuilderOptions} [options]\n *  Builder options for the generated column.\n * @param {ReturnType<dictionaryContext>} [dicts]\n *  Dictionary context object, for internal use only.\n * @returns {Column<T>} The generated column.\n */\nexport function columnFromValues(values, type, options = {}, dicts) {\n  const visit = isIterable(values)\n    ? callback => { for (const value of values) callback(value); }\n    : values;\n\n  type ??= inferType(visit);\n  const { maxBatchRows = Infinity, ...opt } = options;\n  let data;\n\n  if (type.typeId === Type.Null) {\n    let length = 0;\n    visit(() => ++length);\n    data = nullBatches(type, length, maxBatchRows);\n  } else {\n    const ctx = builderContext(opt, dicts);\n    const b = builder(type, ctx).init();\n    const next = b => data.push(b.batch());\n    data = [];\n\n    let row = 0;\n    visit(value => {\n      b.set(value, row++);\n      if (row >= maxBatchRows) {\n        next(b);\n        row = 0;\n      }\n    });\n    if (row) next(b);\n\n    // resolve dictionaries\n    ctx.finish();\n  }\n\n  return new Column(data, type);\n}\n\n/**\n * Create null batches with the given batch size limit.\n * @param {NullType} type The null data type.\n * @param {number} length The total column length.\n * @param {number} limit The maximum batch size.\n * @returns {NullBatch[]} The null batches.\n */\nfunction nullBatches(type, length, limit) {\n  const data = [];\n  const batch = length => new NullBatch({ length, nullCount: length, type });\n  const numBatches = Math.floor(length / limit);\n  for (let i = 0; i < numBatches; ++i) {\n    data.push(batch(limit));\n  }\n  const rem = length % limit;\n  if (rem) data.push(batch(rem));\n  return data;\n}\n","/**\n * @import { ColumnBuilderOptions, DataType, TypedArray, TypedArrayConstructor } from '../types.js'\n * @import { dictionaryContext } from './builders/dictionary.js'\n */\nimport { float32Array, float64Array, int16Array, int32Array, int64Array, int8Array, isInt64ArrayType, isTypedArray, uint16Array, uint32Array, uint64Array, uint8Array } from '../util/arrays.js';\nimport { DirectBatch, Int64Batch } from '../batch.js';\nimport { Column } from '../column.js';\nimport { float32, float64, int16, int32, int64, int8, uint16, uint32, uint64, uint8 } from '../data-types.js';\nimport { columnFromValues } from './column-from-values.js';\n\n/**\n * Create a new column from a provided data array.\n * @template T\n * @param {Array | TypedArray} array The input data.\n * @param {DataType} [type] The data type.\n *  If not specified, type inference is attempted.\n * @param {ColumnBuilderOptions} [options]\n *  Builder options for the generated column.\n * @param {ReturnType<dictionaryContext>} [dicts]\n *  Builder context object, for internal use only.\n * @returns {Column<T>} The generated column.\n */\nexport function columnFromArray(array, type, options = {}, dicts) {\n  return !type && isTypedArray(array)\n    ? columnFromTypedArray(array, options)\n    : columnFromValues(v => array.forEach(v), type, options, dicts);\n}\n\n/**\n * Create a new column from a typed array input.\n * @template T\n * @param {TypedArray} values The input data.\n * @param {ColumnBuilderOptions} options\n *  Builder options for the generated column.\n * @returns {Column<T>} The generated column.\n */\nfunction columnFromTypedArray(values, { maxBatchRows, useBigInt }) {\n  const arrayType = /** @type {TypedArrayConstructor} */ (\n    values.constructor\n  );\n  const type = typeForTypedArray(arrayType);\n  const length = values.length;\n  const limit = Math.min(maxBatchRows || Infinity, length);\n  const numBatches = Math.floor(length / limit);\n\n  const batches = [];\n  const batchType = isInt64ArrayType(arrayType) && !useBigInt ? Int64Batch : DirectBatch;\n  const add = (start, end) => batches.push(new batchType({\n    length: end - start,\n    nullCount: 0,\n    type,\n    validity: new uint8Array(0),\n    values: values.subarray(start, end)\n  }));\n\n  let idx = 0;\n  for (let i = 0; i < numBatches; ++i) add(idx, idx += limit);\n  if (idx < length) add(idx, length);\n\n  return new Column(batches);\n}\n\n/**\n * Return an Arrow data type for a given typed array type.\n * @param {TypedArrayConstructor} arrayType The typed array type.\n * @returns {DataType} The data type.\n */\nfunction typeForTypedArray(arrayType) {\n  switch (arrayType) {\n    case float32Array: return float32();\n    case float64Array: return float64();\n    case int8Array: return int8();\n    case int16Array: return int16();\n    case int32Array: return int32();\n    case int64Array: return int64();\n    case uint8Array: return uint8();\n    case uint16Array: return uint16();\n    case uint32Array: return uint32();\n    case uint64Array: return uint64();\n  }\n}\n","/**\n * @import { Column } from '../column.js'\n */\nimport { Endianness, Version } from '../constants.js';\nimport { field } from '../data-types.js';\nimport { Table } from '../table.js';\n\n/**\n * Create a new table from a collection of columns. Columns are assumed\n * to have the same record batch sizes.\n * @param {[string, Column][] | Record<string, Column>} data The columns,\n *  as an object with name keys, or an array of [name, column] pairs.\n * @param {boolean} [useProxy] Flag indicating if row proxy\n *  objects should be used to represent table rows (default `false`).\n * @returns {Table} The new table.\n */\nexport function tableFromColumns(data, useProxy) {\n  const fields = [];\n  const entries = Array.isArray(data) ? data : Object.entries(data);\n  const length = entries[0]?.[1].length;\n\n  const columns = entries.map(([name, col]) => {\n    if (col.length !== length) {\n      throw new Error('All columns must have the same length.');\n    }\n    fields.push(field(name, col.type));\n    return col;\n  });\n\n  const schema = {\n    version: Version.V5,\n    endianness: Endianness.Little,\n    fields,\n    metadata: null\n  };\n\n  return new Table(schema, columns, useProxy);\n}\n","/**\n * @import { Column } from '../column.js'\n * @import { TableBuilderOptions, TypedArray } from '../types.js'\n * @import { Table } from '../table.js'\n */\nimport { dictionaryContext } from './builders/dictionary.js';\nimport { columnFromArray } from './column-from-array.js';\nimport { tableFromColumns } from './table-from-columns.js';\n\n/**\n * Create a new table from the provided arrays.\n * @param {[string, Array | TypedArray][]\n *  | Record<string, Array | TypedArray>} data\n *  The input data as a collection of named arrays.\n * @param {TableBuilderOptions} options\n *  Table builder options, including an optional type map.\n * @returns {Table} The new table.\n */\nexport function tableFromArrays(data, options = {}) {\n  const { types = {}, ...opt } = options;\n  const dicts = dictionaryContext();\n  const entries = Array.isArray(data) ? data : Object.entries(data);\n  const columns = entries.map(([name, array]) =>\n    /** @type {[string, Column]} */ (\n    [ name, columnFromArray(array, types[name], opt, dicts)]\n  ));\n  return tableFromColumns(columns, options.useProxy);\n}\n","/**\n * Ducklings Workers - Minimal DuckDB for Cloudflare Workers\n *\n * This package provides a lightweight DuckDB binding for WebAssembly,\n * designed for Cloudflare Workers.\n *\n * IMPORTANT: In this build, query() and execute() are async and return Promises.\n * Always use: `await conn.query(...)` or `await conn.execute(...)`\n *\n * @packageDocumentation\n */\n\nimport {\n  bool,\n  type DataType,\n  float32,\n  float64,\n  int8,\n  int16,\n  int32,\n  int64,\n  type Table,\n  tableFromArrays,\n  uint8,\n  uint16,\n  uint32,\n  uint64,\n  utf8,\n} from '@uwdata/flechette';\n\n/**\n * DuckDB type constants mapping to the C API type IDs.\n * @category Types\n */\nexport const DuckDBType = {\n  INVALID: 0,\n  BOOLEAN: 1,\n  TINYINT: 2,\n  SMALLINT: 3,\n  INTEGER: 4,\n  BIGINT: 5,\n  UTINYINT: 6,\n  USMALLINT: 7,\n  UINTEGER: 8,\n  UBIGINT: 9,\n  FLOAT: 10,\n  DOUBLE: 11,\n  TIMESTAMP: 12,\n  DATE: 13,\n  TIME: 14,\n  INTERVAL: 15,\n  HUGEINT: 16,\n  UHUGEINT: 32,\n  VARCHAR: 17,\n  BLOB: 18,\n  DECIMAL: 19,\n  TIMESTAMP_S: 20,\n  TIMESTAMP_MS: 21,\n  TIMESTAMP_NS: 22,\n  ENUM: 23,\n  LIST: 24,\n  STRUCT: 25,\n  MAP: 26,\n  ARRAY: 33,\n  UUID: 27,\n  UNION: 28,\n  BIT: 29,\n  TIME_TZ: 30,\n  TIMESTAMP_TZ: 31,\n} as const;\n\n/**\n * Type ID from DuckDB type constants.\n * @category Types\n */\nexport type DuckDBTypeId = (typeof DuckDBType)[keyof typeof DuckDBType];\n\n/**\n * Database access mode.\n * @category Configuration\n */\nexport enum AccessMode {\n  /** DuckDB determines mode based on context (resolves to READ_WRITE for in-memory) */\n  AUTOMATIC = 'automatic',\n  /** Read-only mode - all write operations are blocked */\n  READ_ONLY = 'read_only',\n  /** Read-write mode - allows both reads and writes */\n  READ_WRITE = 'read_write',\n}\n\n/**\n * DuckDB configuration options.\n * @category Configuration\n */\nexport interface DuckDBConfig {\n  /**\n   * Database access mode.\n   * Use READ_ONLY to prevent any data modification.\n   * @default AccessMode.AUTOMATIC\n   */\n  accessMode?: AccessMode;\n\n  /**\n   * Enable external access (file I/O, httpfs, etc.).\n   * Set to false to prevent all external data access.\n   * WARNING: Setting to false will disable httpfs functionality.\n   * @default true\n   */\n  enableExternalAccess?: boolean;\n\n  /**\n   * Lock configuration after startup.\n   * Prevents runtime configuration changes via SQL SET commands.\n   * @default true (secure default)\n   */\n  lockConfiguration?: boolean;\n\n  /**\n   * Custom configuration options.\n   * Key-value pairs passed directly to duckdb_set_config.\n   * @see https://duckdb.org/docs/configuration/overview\n   */\n  customConfig?: Record<string, string>;\n}\n\n/**\n * Error thrown by DuckDB operations.\n * @category Types\n */\nexport class DuckDBError extends Error {\n  public readonly code?: string;\n  public readonly query?: string;\n\n  constructor(message: string, code?: string, query?: string) {\n    super(message);\n    this.name = 'DuckDBError';\n    this.code = code;\n    this.query = query;\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, DuckDBError);\n    }\n  }\n}\n\n/**\n * Options for SQL sanitization.\n * @category Security\n */\nexport interface SanitizeSqlOptions {\n  /** Allow PRAGMA statements (default: false) */\n  allowPragma?: boolean;\n  /** Allow COPY ... TO statements (default: false) */\n  allowCopyTo?: boolean;\n  /** Allow EXPORT DATABASE statements (default: false) */\n  allowExportDatabase?: boolean;\n  /** Allow duckdb_secrets() function (default: false) */\n  allowSecretsFunction?: boolean;\n}\n\n/**\n * Result of SQL sanitization check.\n * @category Security\n */\nexport interface SanitizeResult {\n  /** Whether the SQL is considered safe */\n  safe: boolean;\n  /** The original SQL string */\n  sql: string;\n  /** Reason why the SQL was blocked (if unsafe) */\n  reason?: string;\n  /** The pattern that matched (if unsafe) */\n  matchedPattern?: string;\n}\n\n/**\n * Strips SQL comments to prevent bypass attempts.\n * @internal\n */\nfunction stripSqlComments(sql: string): string {\n  // Remove /* ... */ block comments (non-greedy)\n  let result = sql.replace(/\\/\\*[\\s\\S]*?\\*\\//g, ' ');\n  // Remove -- line comments\n  result = result.replace(/--[^\\n\\r]*/g, ' ');\n  // Remove # line comments (MySQL-style, supported by DuckDB)\n  result = result.replace(/#[^\\n\\r]*/g, ' ');\n  return result;\n}\n\n/**\n * Dangerous SQL patterns to block.\n * @internal\n */\nconst DANGEROUS_PATTERNS = {\n  secretsFunction: {\n    pattern: /\\bduckdb_secrets\\s*\\(/i,\n    message: 'Access to duckdb_secrets() is not allowed',\n  },\n  pragma: {\n    pattern: /^\\s*PRAGMA\\b/im,\n    message: 'PRAGMA statements are not allowed',\n  },\n  copyTo: {\n    pattern: /\\bCOPY\\b[\\s\\S]+?\\bTO\\b\\s+['\"`]/i,\n    message: 'COPY ... TO statements are not allowed',\n  },\n  exportDatabase: {\n    pattern: /\\bEXPORT\\s+DATABASE\\b/i,\n    message: 'EXPORT DATABASE statements are not allowed',\n  },\n} as const;\n\n/**\n * Checks if a SQL statement contains dangerous patterns.\n *\n * This function does not throw - it returns a result object indicating\n * whether the SQL is safe or not. Use this when you want to handle\n * unsafe SQL yourself.\n *\n * @category Security\n * @param sql - The SQL statement to check\n * @param options - Options to selectively allow certain patterns\n * @returns A SanitizeResult object with safety status\n *\n * @example\n * ```typescript\n * const result = checkSql(\"SELECT * FROM duckdb_secrets()\");\n * if (!result.safe) {\n *   console.log(`Blocked: ${result.reason}`);\n * }\n * ```\n */\nexport function checkSql(sql: string, options: SanitizeSqlOptions = {}): SanitizeResult {\n  // Strip comments before checking patterns\n  const strippedSql = stripSqlComments(sql);\n\n  // Check each pattern unless explicitly allowed\n  if (\n    !options.allowSecretsFunction &&\n    DANGEROUS_PATTERNS.secretsFunction.pattern.test(strippedSql)\n  ) {\n    return {\n      safe: false,\n      sql,\n      reason: DANGEROUS_PATTERNS.secretsFunction.message,\n      matchedPattern: 'duckdb_secrets()',\n    };\n  }\n\n  if (!options.allowPragma && DANGEROUS_PATTERNS.pragma.pattern.test(strippedSql)) {\n    return {\n      safe: false,\n      sql,\n      reason: DANGEROUS_PATTERNS.pragma.message,\n      matchedPattern: 'PRAGMA',\n    };\n  }\n\n  if (!options.allowCopyTo && DANGEROUS_PATTERNS.copyTo.pattern.test(strippedSql)) {\n    return {\n      safe: false,\n      sql,\n      reason: DANGEROUS_PATTERNS.copyTo.message,\n      matchedPattern: 'COPY ... TO',\n    };\n  }\n\n  if (!options.allowExportDatabase && DANGEROUS_PATTERNS.exportDatabase.pattern.test(strippedSql)) {\n    return {\n      safe: false,\n      sql,\n      reason: DANGEROUS_PATTERNS.exportDatabase.message,\n      matchedPattern: 'EXPORT DATABASE',\n    };\n  }\n\n  return { safe: true, sql };\n}\n\n/**\n * Sanitizes a SQL statement by checking for dangerous patterns.\n *\n * This function throws a DuckDBError if the SQL contains dangerous patterns.\n * Use this in request handlers to automatically reject unsafe queries.\n *\n * **Blocked patterns:**\n * - `duckdb_secrets()` - Exposes database credentials\n * - `PRAGMA` - Can modify database settings\n * - `COPY ... TO` - Writes files to disk (COPY FROM is allowed)\n * - `EXPORT DATABASE` - Exports database to files\n *\n * Note: SET commands are blocked separately by `lockConfiguration: true` in DuckDBConfig.\n *\n * @category Security\n * @param sql - The SQL statement to sanitize\n * @param options - Options to selectively allow certain patterns\n * @returns The original SQL if safe\n * @throws DuckDBError with code 'SANITIZE_ERROR' if dangerous patterns detected\n *\n * @example\n * ```typescript\n * import { sanitizeSql, DuckDBError } from '@ducklings/workers';\n *\n * // In a request handler\n * try {\n *   const safeSql = sanitizeSql(userInput);\n *   const result = await conn.query(safeSql);\n *   return Response.json({ data: result });\n * } catch (e) {\n *   if (e instanceof DuckDBError && e.code === 'SANITIZE_ERROR') {\n *     return Response.json({ error: e.message }, { status: 400 });\n *   }\n *   throw e;\n * }\n * ```\n */\nexport function sanitizeSql(sql: string, options: SanitizeSqlOptions = {}): string {\n  const result = checkSql(sql, options);\n\n  if (!result.safe) {\n    throw new DuckDBError(result.reason!, 'SANITIZE_ERROR', sql);\n  }\n\n  return sql;\n}\n\n/**\n * Column metadata for query results.\n * @category Types\n */\nexport interface ColumnInfo {\n  name: string;\n  type: DuckDBTypeId;\n  alias?: string;\n}\n\n// Emscripten module interface\ninterface EmscriptenModule {\n  ccall: (\n    name: string,\n    returnType: string | null,\n    argTypes: string[],\n    args: unknown[],\n    opts?: { async?: boolean },\n  ) => unknown | Promise<unknown>;\n  cwrap: (\n    name: string,\n    returnType: string | null,\n    argTypes: string[],\n  ) => (...args: unknown[]) => unknown;\n  getValue: (ptr: number, type: string) => number;\n  setValue: (ptr: number, value: number, type: string) => void;\n  UTF8ToString: (ptr: number) => string;\n  stringToUTF8: (str: string, outPtr: number, maxBytesToWrite: number) => void;\n  lengthBytesUTF8: (str: string) => number;\n  _malloc: (size: number) => number;\n  _free: (ptr: number) => void;\n  stackAlloc: (size: number) => number;\n  stackSave: () => number;\n  stackRestore: (ptr: number) => void;\n  HEAPU8: Uint8Array;\n  HEAP8: Int8Array;\n  HEAP16: Int16Array;\n  HEAP32: Int32Array;\n  HEAPU16: Uint16Array;\n  HEAPU32: Uint32Array;\n  HEAPF32: Float32Array;\n  HEAPF64: Float64Array;\n  /**\n   * Emscripten's filesystem. The workers build exports it — `scripts/build-duckdb.sh`\n   * lists `FS` in `EXPORTED_RUNTIME_METHODS` for this target — which is what makes\n   * registering a file by name possible below.\n   */\n  FS: {\n    mkdir: (path: string) => void;\n    writeFile: (path: string, data: ArrayBuffer | Uint8Array) => void;\n    unlink: (path: string) => void;\n    readFile: (path: string, opts: { encoding: 'binary' }) => Uint8Array;\n  };\n}\n\n// Module state\nlet module: EmscriptenModule | null = null;\nlet initPromise: Promise<EmscriptenModule> | null = null;\n\n/**\n * Helper to get the current module, throwing if not initialized.\n */\nfunction getModule(): EmscriptenModule {\n  if (!module) {\n    throw new DuckDBError('DuckDB WASM not initialized. Call init() first.');\n  }\n  return module;\n}\n\n/**\n * Options for initializing the DuckDB WASM module (workers build).\n * @category Types\n */\nexport interface InitOptions {\n  /**\n   * Pre-compiled WebAssembly.Module (required for Cloudflare Workers)\n   * In Workers, import the WASM file directly and pass it here.\n   *\n   * @example\n   * ```typescript\n   * import wasmModule from '@ducklings/workers/wasm';\n   * await init({ wasmModule });\n   * ```\n   */\n  wasmModule: WebAssembly.Module;\n  /** Optional transport for httpfs requests; fixed for the module lifetime. */\n  httpFetch?: (url: string, init: RequestInit) => Promise<Response>;\n}\n\n/**\n * Initialize the DuckDB WASM module (workers build with Asyncify).\n *\n * This version is optimized for Cloudflare Workers and uses the workers-specific\n * WASM build that includes Asyncify support for async HTTP operations.\n *\n * @category Database\n * @param options - Initialization options with pre-compiled WASM module\n * @returns Promise that resolves when initialization is complete\n *\n * @example\n * ```typescript\n * import { init, DuckDB } from '@ducklings/workers';\n * import wasmModule from '@ducklings/workers/wasm';\n *\n * await init({ wasmModule });\n *\n * const db = new DuckDB();\n * const conn = db.connect();\n *\n * // httpfs works in CF Workers with this build!\n * const result = await conn.query(\"SELECT * FROM 'https://example.com/data.parquet'\");\n * ```\n */\nexport async function init(options: InitOptions): Promise<void> {\n  if (module) {\n    return;\n  }\n\n  if (initPromise) {\n    await initPromise;\n    return;\n  }\n\n  if (!options?.wasmModule) {\n    throw new Error(\n      'Workers build requires a pre-compiled WASM module. ' +\n        'Import the WASM file and pass it as { wasmModule }.',\n    );\n  }\n\n  initPromise = (async () => {\n    // Dynamic import of the workers-specific Emscripten-generated JavaScript\n    const DuckDBModule = (await import('./wasm/duckdb-workers.js')).default;\n\n    // Initialize the Emscripten module with pre-compiled WASM\n    const config: Record<string, unknown> = {\n      httpFetch: options.httpFetch,\n      instantiateWasm: (\n        imports: WebAssembly.Imports,\n        receiveInstance: (instance: WebAssembly.Instance) => void,\n      ) => {\n        WebAssembly.instantiate(options.wasmModule, imports).then((instance) => {\n          receiveInstance(instance);\n        });\n        return {}; // Return empty exports, will be filled by receiveInstance\n      },\n    };\n\n    const mod = await DuckDBModule(config);\n    return mod as EmscriptenModule;\n  })();\n\n  module = await initPromise;\n}\n\n/**\n * Returns the DuckDB library version.\n * @category Database\n */\nexport function version(): string {\n  if (!module) {\n    throw new DuckDBError('DuckDB WASM not initialized. Call init() first.');\n  }\n  const versionPtr = module.ccall('duckdb_library_version', 'number', [], []) as number;\n  return module.UTF8ToString(versionPtr);\n}\n\nconst JS_MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);\nconst JS_MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);\nconst utf8Decoder = new TextDecoder();\n\nfunction toSafeNumberOrString(value: bigint, unsigned = false): number | string {\n  const min = unsigned ? 0n : JS_MIN_SAFE_INTEGER_BIGINT;\n  if (value >= min && value <= JS_MAX_SAFE_INTEGER_BIGINT) {\n    return Number(value);\n  }\n  return value.toString();\n}\n\nfunction readSignedInt64(mod: EmscriptenModule, wordOffset: number): bigint {\n  return (BigInt(mod.HEAP32[wordOffset + 1]) << 32n) + BigInt(mod.HEAPU32[wordOffset]);\n}\n\nfunction readUnsignedInt64(mod: EmscriptenModule, wordOffset: number): bigint {\n  return (BigInt(mod.HEAPU32[wordOffset + 1]) << 32n) + BigInt(mod.HEAPU32[wordOffset]);\n}\n\nfunction readSignedHugeint(mod: EmscriptenModule, wordOffset: number): bigint {\n  const low64 = readUnsignedInt64(mod, wordOffset);\n  const high64 = (BigInt(mod.HEAP32[wordOffset + 3]) << 32n) + BigInt(mod.HEAPU32[wordOffset + 2]);\n  return (high64 << 64n) + low64;\n}\n\nfunction readUnsignedHugeint(mod: EmscriptenModule, wordOffset: number): bigint {\n  const low64 = readUnsignedInt64(mod, wordOffset);\n  const high64 =\n    (BigInt(mod.HEAPU32[wordOffset + 3]) << 32n) + BigInt(mod.HEAPU32[wordOffset + 2]);\n  return (high64 << 64n) + low64;\n}\n\nfunction stringifyIntegersForArrow(values: unknown[]): unknown[] {\n  return values.map((value) => (value == null ? null : String(value)));\n}\n\nfunction normalizeInt64ValuesForArrow(values: unknown[]): unknown[] {\n  return values.map((value) => {\n    if (value == null) return null;\n    if (typeof value === 'bigint') return value;\n    if (typeof value === 'number') return BigInt(value);\n    return BigInt(String(value));\n  });\n}\n\nfunction canDecodeRawColumnData(duckdbType: number): boolean {\n  switch (duckdbType) {\n    case DuckDBType.BOOLEAN:\n    case DuckDBType.TINYINT:\n    case DuckDBType.SMALLINT:\n    case DuckDBType.INTEGER:\n    case DuckDBType.BIGINT:\n    case DuckDBType.UTINYINT:\n    case DuckDBType.USMALLINT:\n    case DuckDBType.UINTEGER:\n    case DuckDBType.UBIGINT:\n    case DuckDBType.HUGEINT:\n    case DuckDBType.UHUGEINT:\n    case DuckDBType.FLOAT:\n    case DuckDBType.DOUBLE:\n      return true;\n    default:\n      return false;\n  }\n}\n\nfunction shouldRepresentAsUtf8Arrow(duckdbType: number): boolean {\n  switch (duckdbType) {\n    case DuckDBType.BOOLEAN:\n    case DuckDBType.TINYINT:\n    case DuckDBType.SMALLINT:\n    case DuckDBType.INTEGER:\n    case DuckDBType.BIGINT:\n    case DuckDBType.UTINYINT:\n    case DuckDBType.USMALLINT:\n    case DuckDBType.UINTEGER:\n    case DuckDBType.UBIGINT:\n    case DuckDBType.FLOAT:\n    case DuckDBType.DOUBLE:\n      return false;\n    default:\n      return true;\n  }\n}\n\nfunction readInlineOrHeapBytes(mod: EmscriptenModule, structPtr: number): Uint8Array {\n  const length = mod.HEAPU32[structPtr >> 2];\n  if (length <= 12) {\n    return mod.HEAPU8.slice(structPtr + 4, structPtr + 4 + length);\n  }\n  const valuePtr = mod.HEAPU32[(structPtr + 8) >> 2];\n  return mod.HEAPU8.slice(valuePtr, valuePtr + length);\n}\n\nfunction readInlineOrHeapString(mod: EmscriptenModule, structPtr: number): string {\n  return utf8Decoder.decode(readInlineOrHeapBytes(mod, structPtr));\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n  return Array.from(bytes, (value) => value.toString(16).padStart(2, '0')).join('');\n}\n\nfunction readBlobHexValue(mod: EmscriptenModule, structPtr: number): string {\n  return `\\\\x${bytesToHex(readInlineOrHeapBytes(mod, structPtr))}`;\n}\n\nfunction readTextResultValue(\n  mod: EmscriptenModule,\n  resultPtr: number,\n  colIdx: number,\n  rowIdx: number,\n): string | null {\n  const strPtr = mod.ccall(\n    'duckdb_wasm_result_value_to_string',\n    'number',\n    ['number', 'number', 'number', 'number', 'number'],\n    [resultPtr, colIdx, 0, rowIdx, 0],\n  ) as number;\n\n  if (!strPtr) {\n    return null;\n  }\n\n  try {\n    return mod.UTF8ToString(strPtr);\n  } finally {\n    mod._free(strPtr);\n  }\n}\n\nfunction readTextColumnDataFromResult(\n  mod: EmscriptenModule,\n  resultPtr: number,\n  colIdx: number,\n  rowCount: number,\n  rowOffset = 0,\n): unknown[] {\n  const values: unknown[] = new Array(rowCount);\n  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {\n    values[rowIdx] = readTextResultValue(mod, resultPtr, colIdx, rowOffset + rowIdx);\n  }\n  return values;\n}\n\nfunction readTextChunkValue(\n  mod: EmscriptenModule,\n  chunkPtr: number,\n  colIdx: number,\n  rowIdx: number,\n): string | null {\n  const strPtr = mod.ccall(\n    'duckdb_wasm_data_chunk_value_to_string',\n    'number',\n    ['number', 'number', 'number', 'number', 'number'],\n    [chunkPtr, colIdx, 0, rowIdx, 0],\n  ) as number;\n\n  if (!strPtr) {\n    return null;\n  }\n\n  try {\n    return mod.UTF8ToString(strPtr);\n  } finally {\n    mod._free(strPtr);\n  }\n}\n\nfunction readTextColumnDataFromChunk(\n  mod: EmscriptenModule,\n  chunkPtr: number,\n  colIdx: number,\n  rowCount: number,\n): unknown[] {\n  const values: unknown[] = new Array(rowCount);\n  for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {\n    values[rowIdx] = readTextChunkValue(mod, chunkPtr, colIdx, rowIdx);\n  }\n  return values;\n}\n\n/**\n * Reads column data from DuckDB result with proper type conversion.\n * @internal\n */\nfunction readColumnData(\n  mod: EmscriptenModule,\n  dataPtr: number,\n  nullmaskPtr: number,\n  rowCount: number,\n  duckdbType: number,\n): unknown[] {\n  const result: unknown[] = new Array(rowCount);\n  const hasNullmask = nullmaskPtr !== 0;\n\n  switch (duckdbType) {\n    case DuckDBType.BOOLEAN: {\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPU8[dataPtr + i] !== 0;\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.TINYINT: {\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAP8[dataPtr + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.SMALLINT: {\n      const offset = dataPtr >> 1;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAP16[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.INTEGER: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAP32[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.BIGINT: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = toSafeNumberOrString(readSignedInt64(mod, offset + i * 2));\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.UTINYINT: {\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPU8[dataPtr + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.USMALLINT: {\n      const offset = dataPtr >> 1;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPU16[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.UINTEGER: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPU32[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.UBIGINT: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = toSafeNumberOrString(readUnsignedInt64(mod, offset + i * 2), true);\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.HUGEINT: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = toSafeNumberOrString(readSignedHugeint(mod, offset + i * 4));\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.UHUGEINT: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = toSafeNumberOrString(readUnsignedHugeint(mod, offset + i * 4), true);\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.FLOAT: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPF32[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.DOUBLE: {\n      const offset = dataPtr >> 3;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = mod.HEAPF64[offset + i];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.BLOB: {\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          result[i] = readBlobHexValue(mod, dataPtr + i * 16);\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.DATE: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          const days = mod.HEAP32[offset + i];\n          const date = new Date(days * 24 * 60 * 60 * 1000);\n          result[i] = date.toISOString().split('T')[0];\n        }\n      }\n      break;\n    }\n\n    case DuckDBType.TIMESTAMP:\n    case DuckDBType.TIMESTAMP_TZ: {\n      const offset = dataPtr >> 2;\n      for (let i = 0; i < rowCount; i++) {\n        if (hasNullmask && mod.HEAPU8[nullmaskPtr + i]) {\n          result[i] = null;\n        } else {\n          // Timestamp is stored as microseconds since epoch\n          const low = mod.HEAPU32[offset + i * 2];\n          const high = mod.HEAP32[offset + i * 2 + 1];\n          const micros = BigInt(high) * BigInt(0x100000000) + BigInt(low >>> 0);\n          const millis = Number(micros / BigInt(1000));\n          const date = new Date(millis);\n          result[i] = date.toISOString();\n        }\n      }\n      break;\n    }\n\n    default:\n      // Return null for unsupported types - will be handled by varchar fallback\n      for (let i = 0; i < rowCount; i++) {\n        result[i] = null;\n      }\n      break;\n  }\n\n  return result;\n}\n\n/**\n * A prepared SQL statement with parameter binding.\n * @category Query Results\n */\nexport class PreparedStatement {\n  private stmtPtr: number;\n  private closed = false;\n  private readonly sql: string;\n\n  /** @internal */\n  constructor(stmtPtr: number, _connPtr: number, sql: string) {\n    this.stmtPtr = stmtPtr;\n    this.sql = sql;\n  }\n\n  parameterCount(): number {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    return mod.ccall('duckdb_nparams', 'number', ['number'], [this.stmtPtr]) as number;\n  }\n\n  bindBoolean(index: number, value: boolean): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_boolean',\n      'number',\n      ['number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, value ? 1 : 0],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind boolean at index ${index}`);\n    return this;\n  }\n\n  bindInt32(index: number, value: number): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_int32',\n      'number',\n      ['number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, value],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind int32 at index ${index}`);\n    return this;\n  }\n\n  bindInt64(index: number, value: bigint | number): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const val = BigInt(value);\n    const valLow = Number(val & BigInt(0xffffffff));\n    const valHigh = Number((val >> BigInt(32)) & BigInt(0xffffffff));\n    const result = mod.ccall(\n      'duckdb_bind_int64',\n      'number',\n      ['number', 'number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, valLow, valHigh],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind int64 at index ${index}`);\n    return this;\n  }\n\n  bindFloat(index: number, value: number): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_float',\n      'number',\n      ['number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, value],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind float at index ${index}`);\n    return this;\n  }\n\n  bindDouble(index: number, value: number): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_double',\n      'number',\n      ['number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, value],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind double at index ${index}`);\n    return this;\n  }\n\n  bindString(index: number, value: string): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_varchar',\n      'number',\n      ['number', 'number', 'number', 'string'],\n      [this.stmtPtr, index, 0, value],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind string at index ${index}`);\n    return this;\n  }\n\n  bindBlob(index: number, value: Uint8Array): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const ptr = mod._malloc(value.length);\n    try {\n      mod.HEAPU8.set(value, ptr);\n      const result = mod.ccall(\n        'duckdb_bind_blob',\n        'number',\n        ['number', 'number', 'number', 'number', 'number', 'number'],\n        [this.stmtPtr, index, 0, ptr, value.length, 0],\n      ) as number;\n      if (result !== 0) throw new DuckDBError(`Failed to bind blob at index ${index}`);\n    } finally {\n      mod._free(ptr);\n    }\n    return this;\n  }\n\n  bindNull(index: number): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const result = mod.ccall(\n      'duckdb_bind_null',\n      'number',\n      ['number', 'number', 'number'],\n      [this.stmtPtr, index, 0],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind null at index ${index}`);\n    return this;\n  }\n\n  bindTimestamp(index: number, value: Date): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const micros = BigInt(value.getTime()) * BigInt(1000);\n    const tsLow = Number(micros & BigInt(0xffffffff));\n    const tsHigh = Number((micros >> BigInt(32)) & BigInt(0xffffffff));\n    const result = mod.ccall(\n      'duckdb_bind_timestamp',\n      'number',\n      ['number', 'number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, tsLow, tsHigh],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind timestamp at index ${index}`);\n    return this;\n  }\n\n  bindDate(index: number, value: Date): this {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n    const days = Math.floor(value.getTime() / (24 * 60 * 60 * 1000));\n    const result = mod.ccall(\n      'duckdb_bind_date',\n      'number',\n      ['number', 'number', 'number', 'number'],\n      [this.stmtPtr, index, 0, days],\n    ) as number;\n    if (result !== 0) throw new DuckDBError(`Failed to bind date at index ${index}`);\n    return this;\n  }\n\n  bind(index: number, value: unknown): this {\n    if (value === null || value === undefined) return this.bindNull(index);\n    if (typeof value === 'boolean') return this.bindBoolean(index, value);\n    if (typeof value === 'number') {\n      if (Number.isInteger(value) && value >= -2147483648 && value <= 2147483647) {\n        return this.bindInt32(index, value);\n      }\n      return this.bindDouble(index, value);\n    }\n    if (typeof value === 'bigint') return this.bindInt64(index, value);\n    if (typeof value === 'string') return this.bindString(index, value);\n    if (value instanceof Date) return this.bindTimestamp(index, value);\n    if (value instanceof Uint8Array) return this.bindBlob(index, value);\n    return this.bindString(index, String(value));\n  }\n\n  /**\n   * Executes the prepared statement and returns results as an array of objects.\n   * @returns Promise resolving to array of result rows\n   */\n  async run<T = Record<string, unknown>>(): Promise<T[]> {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n\n    const resultPtr = mod._malloc(64);\n    mod.HEAPU8.fill(0, resultPtr, resultPtr + 64);\n    try {\n      const status = (await mod.ccall(\n        'duckdb_execute_prepared',\n        'number',\n        ['number', 'number'],\n        [this.stmtPtr, resultPtr],\n        { async: true },\n      )) as number;\n\n      if (status !== 0) {\n        const errorPtr = mod.ccall(\n          'duckdb_result_error',\n          'number',\n          ['number'],\n          [resultPtr],\n        ) as number;\n        const errorMsg = errorPtr\n          ? mod.UTF8ToString(errorPtr)\n          : 'Prepared statement execution failed';\n        throw new DuckDBError(errorMsg, undefined, this.sql);\n      }\n\n      const columnCount = mod.ccall(\n        'duckdb_column_count',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n      const rowCount = mod.ccall('duckdb_row_count', 'number', ['number'], [resultPtr]) as number;\n\n      // Get column metadata (name and type)\n      const columns: { name: string; type: number }[] = [];\n      for (let i = 0; i < columnCount; i++) {\n        const namePtr = mod.ccall(\n          'duckdb_column_name',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        const type = mod.ccall(\n          'duckdb_column_type',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        columns.push({\n          name: mod.UTF8ToString(namePtr),\n          type,\n        });\n      }\n\n      // Extract column data with proper types\n      const columnData: unknown[][] = [];\n      for (let colIdx = 0; colIdx < columnCount; colIdx++) {\n        const col = columns[colIdx];\n\n        const dataPtr = mod.ccall(\n          'duckdb_column_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        const nullmaskPtr = mod.ccall(\n          'duckdb_nullmask_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        if (!canDecodeRawColumnData(col.type) || dataPtr === 0) {\n          columnData.push(readTextColumnDataFromResult(mod, resultPtr, colIdx, rowCount));\n        } else {\n          columnData.push(readColumnData(mod, dataPtr, nullmaskPtr, rowCount, col.type));\n        }\n      }\n\n      // Build result rows\n      const rows: T[] = new Array(rowCount);\n      for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {\n        const row: Record<string, unknown> = {};\n        for (let colIdx = 0; colIdx < columnCount; colIdx++) {\n          row[columns[colIdx].name] = columnData[colIdx][rowIdx];\n        }\n        rows[rowIdx] = row as T;\n      }\n\n      return rows;\n    } finally {\n      try {\n        mod.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n      } finally {\n        mod._free(resultPtr);\n      }\n    }\n  }\n\n  /**\n   * Executes the prepared statement without returning results.\n   * @returns Promise resolving to number of rows affected\n   */\n  async execute(): Promise<number> {\n    if (this.closed) throw new DuckDBError('Statement is closed');\n    const mod = getModule();\n\n    const resultPtr = mod._malloc(64);\n    try {\n      const status = (await mod.ccall(\n        'duckdb_execute_prepared',\n        'number',\n        ['number', 'number'],\n        [this.stmtPtr, resultPtr],\n        { async: true },\n      )) as number;\n\n      if (status !== 0) {\n        const errorPtr = mod.ccall(\n          'duckdb_result_error',\n          'number',\n          ['number'],\n          [resultPtr],\n        ) as number;\n        const errorMsg = errorPtr\n          ? mod.UTF8ToString(errorPtr)\n          : 'Prepared statement execution failed';\n        mod.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n        throw new DuckDBError(errorMsg, undefined, this.sql);\n      }\n\n      const rowsChanged = mod.ccall(\n        'duckdb_rows_changed',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n      mod.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n      return rowsChanged;\n    } finally {\n      mod._free(resultPtr);\n    }\n  }\n\n  close(): void {\n    if (this.closed) return;\n    const mod = getModule();\n    const stmtPtrPtr = mod._malloc(4);\n    try {\n      mod.setValue(stmtPtrPtr, this.stmtPtr, 'i32');\n      mod.ccall('duckdb_destroy_prepare', null, ['number'], [stmtPtrPtr]);\n    } finally {\n      mod._free(stmtPtrPtr);\n    }\n    this.closed = true;\n    this.stmtPtr = 0;\n  }\n}\n\n/**\n * A chunk of data from a streaming query result.\n * @category Query Results\n */\nexport class DataChunk {\n  private chunkPtr: number;\n  private destroyed = false;\n  private readonly columns: ColumnInfo[];\n\n  /** @internal */\n  constructor(chunkPtr: number, columns: ColumnInfo[]) {\n    this.chunkPtr = chunkPtr;\n    this.columns = columns;\n  }\n\n  get rowCount(): number {\n    if (this.destroyed) return 0;\n    const mod = getModule();\n    return mod.ccall('duckdb_data_chunk_get_size', 'number', ['number'], [this.chunkPtr]) as number;\n  }\n\n  get columnCount(): number {\n    if (this.destroyed) return 0;\n    const mod = getModule();\n    return mod.ccall(\n      'duckdb_data_chunk_get_column_count',\n      'number',\n      ['number'],\n      [this.chunkPtr],\n    ) as number;\n  }\n\n  getColumnInfo(): ColumnInfo[] {\n    return this.columns;\n  }\n\n  getColumn(columnIndex: number): unknown[] {\n    if (this.destroyed) throw new DuckDBError('DataChunk has been destroyed');\n    const mod = getModule();\n    const rows = this.rowCount;\n\n    const vectorPtr = mod.ccall(\n      'duckdb_data_chunk_get_vector',\n      'number',\n      ['number', 'number'],\n      [this.chunkPtr, columnIndex],\n    ) as number;\n\n    if (!vectorPtr) throw new DuckDBError(`Failed to get vector for column ${columnIndex}`);\n\n    const dataPtr = mod.ccall(\n      'duckdb_vector_get_data',\n      'number',\n      ['number'],\n      [vectorPtr],\n    ) as number;\n    const validityPtr = mod.ccall(\n      'duckdb_vector_get_validity',\n      'number',\n      ['number'],\n      [vectorPtr],\n    ) as number;\n\n    const columnType = this.columns[columnIndex]?.type ?? DuckDBType.VARCHAR;\n    if (!canDecodeRawColumnData(columnType)) {\n      return readTextColumnDataFromChunk(mod, this.chunkPtr, columnIndex, rows);\n    }\n    return this.readVectorData(dataPtr, validityPtr, rows, columnType);\n  }\n\n  toArray<T = Record<string, unknown>>(): T[] {\n    if (this.destroyed) return [];\n    const rows = this.rowCount;\n    const cols = this.columnCount;\n\n    const columnData: unknown[][] = [];\n    for (let c = 0; c < cols; c++) {\n      columnData.push(this.getColumn(c));\n    }\n\n    const result: T[] = new Array(rows);\n    for (let r = 0; r < rows; r++) {\n      const row: Record<string, unknown> = {};\n      for (let c = 0; c < cols; c++) {\n        row[this.columns[c].name] = columnData[c][r];\n      }\n      result[r] = row as T;\n    }\n    return result;\n  }\n\n  private readVectorData(\n    dataPtr: number,\n    validityPtr: number,\n    rowCount: number,\n    duckdbType: number,\n  ): unknown[] {\n    const mod = getModule();\n    const result: unknown[] = new Array(rowCount);\n\n    const isRowNull = (rowIdx: number): boolean => {\n      if (validityPtr === 0) return false;\n      return (\n        (mod.ccall(\n          'duckdb_validity_row_is_valid',\n          'number',\n          ['number', 'number'],\n          [validityPtr, rowIdx],\n        ) as number) === 0\n      );\n    };\n\n    switch (duckdbType) {\n      case DuckDBType.BOOLEAN:\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAPU8[dataPtr + i] !== 0;\n        }\n        break;\n\n      case DuckDBType.TINYINT:\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAP8[dataPtr + i];\n        }\n        break;\n\n      case DuckDBType.SMALLINT: {\n        const offset = dataPtr >> 1;\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAP16[offset + i];\n        }\n        break;\n      }\n\n      case DuckDBType.INTEGER: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAP32[offset + i];\n        }\n        break;\n      }\n\n      case DuckDBType.BIGINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readSignedInt64(mod, offset + i * 2));\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UBIGINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readUnsignedInt64(mod, offset + i * 2), true);\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.HUGEINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readSignedHugeint(mod, offset + i * 4));\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UHUGEINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readUnsignedHugeint(mod, offset + i * 4), true);\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.FLOAT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAPF32[offset + i];\n        }\n        break;\n      }\n\n      case DuckDBType.DOUBLE: {\n        const offset = dataPtr >> 3;\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : mod.HEAPF64[offset + i];\n        }\n        break;\n      }\n\n      case DuckDBType.BLOB:\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = isRowNull(i) ? null : readBlobHexValue(mod, dataPtr + i * 16);\n        }\n        break;\n\n      case DuckDBType.DATE: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            const days = mod.HEAP32[offset + i];\n            const date = new Date(days * 24 * 60 * 60 * 1000);\n            result[i] = date.toISOString().split('T')[0];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.TIMESTAMP:\n      case DuckDBType.TIMESTAMP_TZ: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            const low = mod.HEAPU32[offset + i * 2];\n            const high = mod.HEAP32[offset + i * 2 + 1];\n            const micros = high * 0x100000000 + low;\n            const date = new Date(micros / 1000);\n            result[i] = date.toISOString();\n          }\n        }\n        break;\n      }\n\n      default:\n        for (let i = 0; i < rowCount; i++) {\n          if (isRowNull(i)) {\n            result[i] = null;\n          } else {\n            result[i] = readInlineOrHeapString(mod, dataPtr + i * 16);\n          }\n        }\n        break;\n    }\n\n    return result;\n  }\n\n  destroy(): void {\n    if (this.destroyed) return;\n    const mod = getModule();\n    const chunkPtrPtr = mod._malloc(4);\n    try {\n      mod.setValue(chunkPtrPtr, this.chunkPtr, 'i32');\n      mod.ccall('duckdb_destroy_data_chunk', null, ['number'], [chunkPtrPtr]);\n    } finally {\n      mod._free(chunkPtrPtr);\n    }\n    this.destroyed = true;\n    this.chunkPtr = 0;\n  }\n}\n\n/**\n * A streaming query result that yields data in chunks.\n * @category Query Results\n */\nexport class StreamingResult implements Iterable<DataChunk> {\n  private resultPtr: number;\n  private closed = false;\n  private readonly columns: ColumnInfo[];\n  private currentChunkIndex = 0;\n  private readonly totalChunks: number;\n\n  /** @internal */\n  constructor(resultPtr: number, columns: ColumnInfo[]) {\n    this.resultPtr = resultPtr;\n    this.columns = columns;\n\n    const mod = getModule();\n    this.totalChunks = mod.ccall(\n      'duckdb_result_chunk_count',\n      'number',\n      ['number'],\n      [resultPtr],\n    ) as number;\n  }\n\n  getColumns(): ColumnInfo[] {\n    return this.columns;\n  }\n\n  get columnCount(): number {\n    return this.columns.length;\n  }\n\n  get chunkCount(): number {\n    return this.totalChunks;\n  }\n\n  nextChunk(): DataChunk | null {\n    if (this.closed || this.currentChunkIndex >= this.totalChunks) {\n      return null;\n    }\n\n    const mod = getModule();\n    const chunkPtr = mod.ccall(\n      'duckdb_result_get_chunk',\n      'number',\n      ['number', 'number'],\n      [this.resultPtr, this.currentChunkIndex],\n    ) as number;\n\n    if (!chunkPtr) return null;\n\n    this.currentChunkIndex++;\n    return new DataChunk(chunkPtr, this.columns);\n  }\n\n  reset(): void {\n    this.currentChunkIndex = 0;\n  }\n\n  *[Symbol.iterator](): Iterator<DataChunk> {\n    this.reset();\n    let chunk: DataChunk | null;\n    while ((chunk = this.nextChunk()) !== null) {\n      try {\n        yield chunk;\n      } finally {\n        chunk.destroy();\n      }\n    }\n  }\n\n  toArray<T = Record<string, unknown>>(): T[] {\n    const allRows: T[] = [];\n    for (const chunk of this) {\n      allRows.push(...chunk.toArray<T>());\n    }\n    return allRows;\n  }\n\n  /**\n   * Converts the streaming result into a Flechette Arrow Table.\n   *\n   * Reads all remaining chunks and aggregates them into a single Arrow table.\n   * DuckDB column types are mapped to the corresponding Flechette types.\n   *\n   * @returns A Flechette {@link Table} containing all result data\n   *\n   * @example\n   * ```typescript\n   * const stream = conn.queryStreaming('SELECT * FROM large_table');\n   * const arrowTable = stream.toArrowTable();\n   * console.log(arrowTable.numRows);\n   * ```\n   */\n  toArrowTable(): Table {\n    const columnData: Record<string, unknown[]> = {};\n    const types: Record<string, DataType> = {};\n\n    for (const col of this.columns) {\n      columnData[col.name] = [];\n      types[col.name] = this.getFlechetteType(col.type);\n    }\n\n    for (const chunk of this) {\n      for (let c = 0; c < this.columns.length; c++) {\n        const column = this.columns[c];\n        const colName = column.name;\n        const chunkData = chunk.getColumn(c);\n        const normalizedChunkData =\n          column.type === DuckDBType.BIGINT || column.type === DuckDBType.UBIGINT\n            ? normalizeInt64ValuesForArrow(chunkData)\n            : column.type === DuckDBType.HUGEINT || column.type === DuckDBType.UHUGEINT\n              ? stringifyIntegersForArrow(chunkData)\n              : chunkData;\n        columnData[colName].push(...normalizedChunkData);\n      }\n    }\n\n    return tableFromArrays(columnData, { types });\n  }\n\n  private getFlechetteType(duckdbType: DuckDBTypeId): DataType {\n    if (shouldRepresentAsUtf8Arrow(duckdbType)) {\n      return utf8();\n    }\n\n    switch (duckdbType) {\n      case DuckDBType.BOOLEAN:\n        return bool();\n      case DuckDBType.TINYINT:\n        return int8();\n      case DuckDBType.SMALLINT:\n        return int16();\n      case DuckDBType.INTEGER:\n        return int32();\n      case DuckDBType.BIGINT:\n        return int64();\n      case DuckDBType.UTINYINT:\n        return uint8();\n      case DuckDBType.USMALLINT:\n        return uint16();\n      case DuckDBType.UINTEGER:\n        return uint32();\n      case DuckDBType.UBIGINT:\n        return uint64();\n      case DuckDBType.FLOAT:\n        return float32();\n      case DuckDBType.DOUBLE:\n        return float64();\n      default:\n        return utf8();\n    }\n  }\n\n  close(): void {\n    if (this.closed) return;\n    const mod = getModule();\n    mod.ccall('duckdb_destroy_result', null, ['number'], [this.resultPtr]);\n    this.closed = true;\n    this.resultPtr = 0;\n  }\n}\n\n/**\n * DuckDB database instance for Cloudflare Workers.\n *\n * @category Database\n * @example\n * ```typescript\n * import { init, DuckDB, AccessMode } from '@ducklings/workers';\n * import wasmModule from '@ducklings/workers/wasm';\n *\n * await init({ wasmModule });\n *\n * // Default configuration (httpfs enabled, config locked)\n * const db = new DuckDB();\n *\n * // Or with custom security configuration\n * const secureDb = new DuckDB({\n *   accessMode: AccessMode.READ_ONLY,\n *   lockConfiguration: true,\n * });\n *\n * const conn = db.connect();\n * const result = await conn.query('SELECT 42 as answer');\n * console.log(result);\n *\n * conn.close();\n * db.close();\n * ```\n */\nexport class DuckDB {\n  private dbPtr: number = 0;\n  private closed: boolean = false;\n\n  /**\n   * Creates a new DuckDB database instance.\n   *\n   * @param config - Optional configuration options\n   */\n  constructor(config: DuckDBConfig = {}) {\n    if (!module) {\n      throw new DuckDBError('DuckDB WASM not initialized. Call init() first.');\n    }\n\n    // Store module reference for use in closures\n    const mod = module;\n\n    // Apply defaults\n    const finalConfig = {\n      accessMode: config.accessMode ?? AccessMode.AUTOMATIC,\n      enableExternalAccess: config.enableExternalAccess ?? true,\n      lockConfiguration: config.lockConfiguration ?? true,\n      customConfig: config.customConfig ?? {},\n    };\n\n    // Create config object\n    const configPtrPtr = mod._malloc(4);\n    const result = mod.ccall(\n      'duckdb_create_config',\n      'number',\n      ['number'],\n      [configPtrPtr],\n    ) as number;\n\n    if (result !== 0) {\n      mod._free(configPtrPtr);\n      throw new DuckDBError('Failed to create DuckDB configuration');\n    }\n\n    const configPtr = mod.getValue(configPtrPtr, 'i32');\n    mod._free(configPtrPtr);\n\n    try {\n      // Helper to set config option\n      const setConfig = (name: string, value: string) => {\n        const setResult = mod.ccall(\n          'duckdb_set_config',\n          'number',\n          ['number', 'string', 'string'],\n          [configPtr, name, value],\n        ) as number;\n        if (setResult !== 0) {\n          throw new DuckDBError(`Failed to set config option: ${name}`);\n        }\n      };\n\n      // Apply access mode\n      if (finalConfig.accessMode !== AccessMode.AUTOMATIC) {\n        setConfig('access_mode', finalConfig.accessMode);\n      }\n\n      // Apply external access setting\n      if (finalConfig.enableExternalAccess === false) {\n        setConfig('enable_external_access', 'false');\n      }\n\n      // Apply custom config options\n      for (const [key, value] of Object.entries(finalConfig.customConfig)) {\n        setConfig(key, value);\n      }\n\n      // Open database with config\n      const dbPtrPtr = mod._malloc(4);\n      const errorPtrPtr = mod._malloc(4);\n\n      try {\n        const openResult = mod.ccall(\n          'duckdb_open_ext',\n          'number',\n          ['string', 'number', 'number', 'number'],\n          [':memory:', dbPtrPtr, configPtr, errorPtrPtr],\n        ) as number;\n\n        if (openResult !== 0) {\n          const errorPtr = mod.getValue(errorPtrPtr, 'i32');\n          const errorMsg = errorPtr ? mod.UTF8ToString(errorPtr) : 'Unknown error';\n          throw new DuckDBError(`Failed to open database: ${errorMsg}`);\n        }\n\n        this.dbPtr = mod.getValue(dbPtrPtr, 'i32');\n      } finally {\n        mod._free(dbPtrPtr);\n        mod._free(errorPtrPtr);\n      }\n\n      // Initialize extensions (only if external access enabled)\n      if (finalConfig.enableExternalAccess !== false) {\n        mod.ccall('duckdb_wasm_httpfs_init', null, ['number'], [this.dbPtr]);\n      }\n\n      // Lock configuration (secure default)\n      if (finalConfig.lockConfiguration !== false) {\n        // Use direct ccall for synchronous execution during construction\n        const connPtrPtr = mod._malloc(4);\n        try {\n          const connResult = mod.ccall(\n            'duckdb_connect',\n            'number',\n            ['number', 'number'],\n            [this.dbPtr, connPtrPtr],\n          ) as number;\n\n          if (connResult === 0) {\n            const connPtr = mod.getValue(connPtrPtr, 'i32');\n            const resultPtr = mod._malloc(64);\n            try {\n              mod.ccall(\n                'duckdb_query',\n                'number',\n                ['number', 'string', 'number'],\n                [connPtr, 'SET lock_configuration = true', resultPtr],\n              );\n              mod.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n            } finally {\n              mod._free(resultPtr);\n            }\n            mod.ccall('duckdb_disconnect', null, ['number'], [connPtrPtr]);\n          }\n        } finally {\n          mod._free(connPtrPtr);\n        }\n      }\n    } finally {\n      // Destroy config object\n      const configPtrPtrForDestroy = mod._malloc(4);\n      mod.setValue(configPtrPtrForDestroy, configPtr, 'i32');\n      mod.ccall('duckdb_destroy_config', null, ['number'], [configPtrPtrForDestroy]);\n      mod._free(configPtrPtrForDestroy);\n    }\n  }\n\n  /**\n   * Creates a new DuckDB database instance asynchronously.\n   *\n   * @param config - Optional configuration options\n   */\n  static async create(config?: DuckDBConfig): Promise<DuckDB> {\n    return new DuckDB(config);\n  }\n\n  private getOpenModule(): EmscriptenModule {\n    if (this.closed) {\n      throw new DuckDBError('Database is closed');\n    }\n    return getModule();\n  }\n\n  /**\n   * Register an in-memory buffer as a file DuckDB can read by name.\n   *\n   * Useful when the bytes are already in hand — fetched from object storage through a\n   * platform binding, say — and there is no URL DuckDB could `httpfs` instead. Mirrors\n   * `registerFileBuffer` in `@ducklings/browser`, which has had this API all along.\n   *\n   * @param name - File name to register, optionally with directories\n   * @param buffer - The file's contents\n   *\n   * @example\n   * ```typescript\n   * await db.registerFileBuffer('data.csv', new TextEncoder().encode('id\\n1\\n'));\n   * const rows = await conn.query(\"SELECT * FROM read_csv('data.csv')\");\n   * ```\n   */\n  async registerFileBuffer(name: string, buffer: Uint8Array): Promise<void> {\n    const mod = this.getOpenModule();\n    const parts = name.split('/').filter(Boolean);\n    let current = '';\n    for (const part of parts.slice(0, -1)) {\n      current += `/${part}`;\n      try {\n        mod.FS.mkdir(current);\n      } catch {\n        // The directory already exists, which is the state we want.\n      }\n    }\n    mod.FS.writeFile(`/${name}`, buffer);\n  }\n\n  /**\n   * Register text as a file, encoded as UTF-8.\n   *\n   * @param name - File name to register\n   * @param text - The file's contents\n   */\n  async registerFileText(name: string, text: string): Promise<void> {\n    await this.registerFileBuffer(name, new TextEncoder().encode(text));\n  }\n\n  /**\n   * Read a registered file back out as bytes.\n   *\n   * The mirror of {@link registerFileBuffer}, and how a query's output leaves the\n   * filesystem — `COPY (…) TO 'x.parquet'`, then this.\n   *\n   * @param name - File name to read\n   * @returns The file's contents\n   *\n   * @example\n   * ```typescript\n   * await conn.query(\"COPY (SELECT 42 AS answer) TO 'out.parquet' (FORMAT PARQUET)\");\n   * const bytes = await db.copyFileToBuffer('out.parquet');\n   * ```\n   */\n  async copyFileToBuffer(name: string): Promise<Uint8Array> {\n    const data = this.getOpenModule().FS.readFile(`/${name}`, { encoding: 'binary' });\n    return data instanceof Uint8Array ? data : new TextEncoder().encode(data);\n  }\n\n  /**\n   * Remove a file registered with {@link registerFileBuffer}.\n   *\n   * @param name - File name to remove\n   */\n  async dropFile(name: string): Promise<void> {\n    const mod = this.getOpenModule();\n    try {\n      mod.FS.unlink(`/${name}`);\n    } catch {\n      // Nothing to remove is already the desired state.\n    }\n  }\n\n  connect(): Connection {\n    if (this.closed || !module) {\n      throw new DuckDBError('Database is closed');\n    }\n\n    const connPtrPtr = module._malloc(4);\n    try {\n      const result = module.ccall(\n        'duckdb_connect',\n        'number',\n        ['number', 'number'],\n        [this.dbPtr, connPtrPtr],\n      ) as number;\n\n      if (result !== 0) {\n        throw new DuckDBError('Failed to create connection');\n      }\n\n      const connPtr = module.getValue(connPtrPtr, '*');\n      return new Connection(connPtr);\n    } finally {\n      module._free(connPtrPtr);\n    }\n  }\n\n  close(): void {\n    if (this.closed || !module) return;\n\n    const dbPtrPtr = module._malloc(4);\n    try {\n      module.setValue(dbPtrPtr, this.dbPtr, '*');\n      module.ccall('duckdb_close', null, ['number'], [dbPtrPtr]);\n    } finally {\n      module._free(dbPtrPtr);\n    }\n\n    this.closed = true;\n    this.dbPtr = 0;\n  }\n}\n\n/**\n * A connection to a DuckDB database (async API for Cloudflare Workers).\n *\n * All query methods in this class are async and return Promises.\n * @category Connection\n */\nexport class Connection {\n  private connPtr: number;\n  private closed: boolean = false;\n\n  /** @internal */\n  constructor(connPtr: number) {\n    this.connPtr = connPtr;\n  }\n\n  /**\n   * Executes a SQL query and returns the results.\n   * This is async to support httpfs in Cloudflare Workers.\n   *\n   * @param sql - The SQL query to execute\n   * @returns Promise resolving to array of result rows as objects\n   */\n  async query<T = Record<string, unknown>>(sql: string): Promise<T[]> {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n\n    const resultPtr = module._malloc(64);\n    try {\n      let status: number;\n      try {\n        status = (await module.ccall(\n          'duckdb_query',\n          'number',\n          ['number', 'string', 'number'],\n          [this.connPtr, sql, resultPtr],\n          { async: true },\n        )) as number;\n      } catch (wasmError: unknown) {\n        const err = wasmError as Error;\n        console.error('WASM trap:', err.message, '\\nStack:', err.stack);\n        throw wasmError;\n      }\n\n      if (status !== 0) {\n        const errorPtr = module.ccall(\n          'duckdb_result_error',\n          'number',\n          ['number'],\n          [resultPtr],\n        ) as number;\n\n        const error = errorPtr ? module.UTF8ToString(errorPtr) : 'Query failed';\n        module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n        throw new DuckDBError(error, undefined, sql);\n      }\n\n      const columnCount = module.ccall(\n        'duckdb_column_count',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n\n      const columns: { name: string; type: number }[] = [];\n      for (let i = 0; i < columnCount; i++) {\n        const namePtr = module.ccall(\n          'duckdb_column_name',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        const type = module.ccall(\n          'duckdb_column_type',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        columns.push({\n          name: module.UTF8ToString(namePtr),\n          type,\n        });\n      }\n\n      const rowCount = module.ccall(\n        'duckdb_row_count',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n\n      const columnData: unknown[][] = [];\n      for (let colIdx = 0; colIdx < columnCount; colIdx++) {\n        const col = columns[colIdx];\n\n        const dataPtr = module.ccall(\n          'duckdb_column_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        const nullmaskPtr = module.ccall(\n          'duckdb_nullmask_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        if (!canDecodeRawColumnData(col.type) || dataPtr === 0) {\n          columnData.push(readTextColumnDataFromResult(module, resultPtr, colIdx, rowCount));\n        } else {\n          columnData.push(this.readColumnData(dataPtr, nullmaskPtr, rowCount, col.type));\n        }\n      }\n\n      const rows: T[] = new Array(rowCount);\n      for (let rowIdx = 0; rowIdx < rowCount; rowIdx++) {\n        const row: Record<string, unknown> = {};\n        for (let colIdx = 0; colIdx < columnCount; colIdx++) {\n          row[columns[colIdx].name] = columnData[colIdx][rowIdx];\n        }\n        rows[rowIdx] = row as T;\n      }\n\n      module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n\n      return rows;\n    } finally {\n      module._free(resultPtr);\n    }\n  }\n\n  private readColumnData(\n    dataPtr: number,\n    nullmaskPtr: number,\n    rowCount: number,\n    duckdbType: number,\n  ): unknown[] {\n    if (!module) return [];\n\n    const result: unknown[] = new Array(rowCount);\n    const hasNullmask = nullmaskPtr !== 0;\n\n    switch (duckdbType) {\n      case DuckDBType.BOOLEAN: {\n        const boolPtr = dataPtr;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPU8[boolPtr + i] !== 0;\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.TINYINT: {\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAP8[dataPtr + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.SMALLINT: {\n        const offset = dataPtr >> 1;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAP16[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.INTEGER: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAP32[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.BIGINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readSignedInt64(module, offset + i * 2));\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UTINYINT: {\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPU8[dataPtr + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.USMALLINT: {\n        const offset = dataPtr >> 1;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPU16[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UINTEGER: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPU32[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UBIGINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readUnsignedInt64(module, offset + i * 2), true);\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.HUGEINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(readSignedHugeint(module, offset + i * 4));\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.UHUGEINT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = toSafeNumberOrString(\n              readUnsignedHugeint(module, offset + i * 4),\n              true,\n            );\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.FLOAT: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPF32[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.DOUBLE: {\n        const offset = dataPtr >> 3;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = module.HEAPF64[offset + i];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.BLOB: {\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            result[i] = readBlobHexValue(module, dataPtr + i * 16);\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.DATE: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            const days = module.HEAP32[offset + i];\n            const date = new Date(days * 24 * 60 * 60 * 1000);\n            result[i] = date.toISOString().split('T')[0];\n          }\n        }\n        break;\n      }\n\n      case DuckDBType.TIMESTAMP:\n      case DuckDBType.TIMESTAMP_TZ: {\n        const offset = dataPtr >> 2;\n        for (let i = 0; i < rowCount; i++) {\n          if (hasNullmask && module.HEAPU8[nullmaskPtr + i]) {\n            result[i] = null;\n          } else {\n            // Timestamp is stored as microseconds since epoch\n            const low = module.HEAPU32[offset + i * 2];\n            const high = module.HEAP32[offset + i * 2 + 1];\n            const micros = BigInt(high) * BigInt(0x100000000) + BigInt(low >>> 0);\n            const millis = Number(micros / BigInt(1000));\n            const date = new Date(millis);\n            result[i] = date.toISOString();\n          }\n        }\n        break;\n      }\n\n      default:\n        for (let i = 0; i < rowCount; i++) {\n          result[i] = null;\n        }\n        break;\n    }\n\n    return result;\n  }\n\n  /**\n   * Executes a SQL query and returns results as an Arrow table.\n   *\n   * @param sql - The SQL query to execute\n   * @returns Promise resolving to Arrow Table\n   */\n  async queryArrow(sql: string): Promise<Table> {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n\n    const resultPtr = module._malloc(64);\n    try {\n      let status: number;\n      try {\n        status = (await module.ccall(\n          'duckdb_query',\n          'number',\n          ['number', 'string', 'number'],\n          [this.connPtr, sql, resultPtr],\n          { async: true },\n        )) as number;\n      } catch (wasmError: unknown) {\n        const err = wasmError as Error;\n        console.error('WASM trap:', err.message, '\\nStack:', err.stack);\n        throw wasmError;\n      }\n\n      if (status !== 0) {\n        const errorPtr = module.ccall(\n          'duckdb_result_error',\n          'number',\n          ['number'],\n          [resultPtr],\n        ) as number;\n        const error = errorPtr ? module.UTF8ToString(errorPtr) : 'Query failed';\n        module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n        throw new DuckDBError(error, undefined, sql);\n      }\n\n      const columnCount = module.ccall(\n        'duckdb_column_count',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n\n      const rowCount = module.ccall(\n        'duckdb_row_count',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n\n      const columns: { name: string; type: number; flechetteType: DataType }[] = [];\n      for (let i = 0; i < columnCount; i++) {\n        const namePtr = module.ccall(\n          'duckdb_column_name',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        const type = module.ccall(\n          'duckdb_column_type',\n          'number',\n          ['number', 'number'],\n          [resultPtr, i],\n        ) as number;\n\n        columns.push({\n          name: module.UTF8ToString(namePtr),\n          type,\n          flechetteType: this.getFlechetteType(type) || utf8(),\n        });\n      }\n\n      const tableData: Record<string, unknown[]> = {};\n      const types: Record<string, DataType> = {};\n\n      for (let colIdx = 0; colIdx < columnCount; colIdx++) {\n        const col = columns[colIdx];\n\n        const dataPtr = module.ccall(\n          'duckdb_column_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        const nullmaskPtr = module.ccall(\n          'duckdb_nullmask_data',\n          'number',\n          ['number', 'number'],\n          [resultPtr, colIdx],\n        ) as number;\n\n        if (!canDecodeRawColumnData(col.type) || dataPtr === 0) {\n          tableData[col.name] = readTextColumnDataFromResult(module, resultPtr, colIdx, rowCount);\n        } else {\n          const values = this.readColumnData(dataPtr, nullmaskPtr, rowCount, col.type);\n          tableData[col.name] =\n            col.type === DuckDBType.BIGINT || col.type === DuckDBType.UBIGINT\n              ? normalizeInt64ValuesForArrow(values)\n              : col.type === DuckDBType.HUGEINT || col.type === DuckDBType.UHUGEINT\n                ? stringifyIntegersForArrow(values)\n                : values;\n        }\n\n        types[col.name] = col.flechetteType;\n      }\n\n      module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n\n      return tableFromArrays(tableData, { types });\n    } finally {\n      module._free(resultPtr);\n    }\n  }\n\n  private getFlechetteType(duckdbType: number): DataType | null {\n    if (shouldRepresentAsUtf8Arrow(duckdbType)) {\n      return utf8();\n    }\n\n    switch (duckdbType) {\n      case DuckDBType.BOOLEAN:\n        return bool();\n      case DuckDBType.TINYINT:\n        return int8();\n      case DuckDBType.SMALLINT:\n        return int16();\n      case DuckDBType.INTEGER:\n        return int32();\n      case DuckDBType.BIGINT:\n        return int64();\n      case DuckDBType.UTINYINT:\n        return uint8();\n      case DuckDBType.USMALLINT:\n        return uint16();\n      case DuckDBType.UINTEGER:\n        return uint32();\n      case DuckDBType.UBIGINT:\n        return uint64();\n      case DuckDBType.FLOAT:\n        return float32();\n      case DuckDBType.DOUBLE:\n        return float64();\n      default:\n        return utf8();\n    }\n  }\n\n  /**\n   * Executes a SQL statement without returning results.\n   *\n   * @param sql - The SQL statement to execute\n   * @returns Promise resolving to number of rows affected\n   */\n  async execute(sql: string): Promise<number> {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n\n    const resultPtr = module._malloc(64);\n    try {\n      let status: number;\n      try {\n        status = (await module.ccall(\n          'duckdb_query',\n          'number',\n          ['number', 'string', 'number'],\n          [this.connPtr, sql, resultPtr],\n          { async: true },\n        )) as number;\n      } catch (wasmError: unknown) {\n        const err = wasmError as Error;\n        console.error('WASM trap:', err.message, '\\nStack:', err.stack);\n        throw wasmError;\n      }\n\n      if (status !== 0) {\n        const errorPtr = module.ccall(\n          'duckdb_result_error',\n          'number',\n          ['number'],\n          [resultPtr],\n        ) as number;\n\n        const error = errorPtr ? module.UTF8ToString(errorPtr) : 'Query failed';\n        module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n        throw new DuckDBError(error, undefined, sql);\n      }\n\n      const rowsChanged = module.ccall(\n        'duckdb_rows_changed',\n        'number',\n        ['number'],\n        [resultPtr],\n      ) as number;\n\n      module.ccall('duckdb_destroy_result', null, ['number'], [resultPtr]);\n      return rowsChanged;\n    } finally {\n      module._free(resultPtr);\n    }\n  }\n\n  /**\n   * Creates a prepared statement for the given SQL.\n   *\n   * @param sql - The SQL statement to prepare (use ? for parameters)\n   * @returns A PreparedStatement instance\n   */\n  prepare(sql: string): PreparedStatement {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n\n    const stmtPtrPtr = module._malloc(4);\n    try {\n      const result = module.ccall(\n        'duckdb_prepare',\n        'number',\n        ['number', 'string', 'number'],\n        [this.connPtr, sql, stmtPtrPtr],\n      ) as number;\n\n      if (result !== 0) {\n        const stmtPtr = module.getValue(stmtPtrPtr, '*');\n        if (stmtPtr) {\n          const errorPtr = module.ccall(\n            'duckdb_prepare_error',\n            'number',\n            ['number'],\n            [stmtPtr],\n          ) as number;\n          const error = errorPtr ? module.UTF8ToString(errorPtr) : 'Failed to prepare statement';\n          module.ccall('duckdb_destroy_prepare', null, ['number'], [stmtPtr]);\n          throw new DuckDBError(error, undefined, sql);\n        }\n        throw new DuckDBError('Failed to prepare statement', undefined, sql);\n      }\n\n      const stmtPtr = module.getValue(stmtPtrPtr, '*');\n      return new PreparedStatement(stmtPtr, this.connPtr, sql);\n    } finally {\n      module._free(stmtPtrPtr);\n    }\n  }\n\n  /**\n   * Prepares SQL asynchronously.\n   * Required when binding may read remote metadata, such as a Parquet schema.\n   */\n  async prepareAsync(sql: string): Promise<PreparedStatement> {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n    const mod = module;\n    const stmtPtrPtr = mod._malloc(4);\n    mod.setValue(stmtPtrPtr, 0, 'i32');\n    try {\n      const result = (await mod.ccall(\n        'duckdb_prepare',\n        'number',\n        ['number', 'string', 'number'],\n        [this.connPtr, sql, stmtPtrPtr],\n        { async: true },\n      )) as number;\n      const stmtPtr = mod.getValue(stmtPtrPtr, '*');\n      if (result !== 0) {\n        let error = 'Failed to prepare statement';\n        if (stmtPtr) {\n          const errorPtr = mod.ccall(\n            'duckdb_prepare_error',\n            'number',\n            ['number'],\n            [stmtPtr],\n          ) as number;\n          if (errorPtr) error = mod.UTF8ToString(errorPtr);\n          mod.ccall('duckdb_destroy_prepare', null, ['number'], [stmtPtrPtr]);\n        }\n        throw new DuckDBError(error, undefined, sql);\n      }\n      return new PreparedStatement(stmtPtr, this.connPtr, sql);\n    } finally {\n      mod._free(stmtPtrPtr);\n    }\n  }\n\n  async beginTransaction(): Promise<void> {\n    await this.execute('BEGIN TRANSACTION');\n  }\n\n  async commit(): Promise<void> {\n    await this.execute('COMMIT');\n  }\n\n  async rollback(): Promise<void> {\n    await this.execute('ROLLBACK');\n  }\n\n  async transaction<T>(fn: () => Promise<T>): Promise<T> {\n    await this.beginTransaction();\n    try {\n      const result = await fn();\n      await this.commit();\n      return result;\n    } catch (e) {\n      await this.rollback();\n      throw e;\n    }\n  }\n\n  /**\n   * Insert data from an Arrow IPC stream buffer into a table.\n   *\n   * Creates a new table with the given name from the Arrow IPC data. If the table\n   * already exists, the call is a no-op (uses `CREATE TABLE IF NOT EXISTS`).\n   *\n   * **Important:** The IPC stream must not contain dictionary-encoded columns.\n   * Flechette's `tableFromArrays()` defaults to `dictionary(utf8())` for string\n   * columns. Use explicit `utf8()` types to avoid this:\n   *\n   * @param tableName - The name of the table to create\n   * @param ipcBuffer - Arrow IPC stream bytes (use `tableToIPC(table, { format: 'stream' })`)\n   * @throws {@link DuckDBError} If the connection is closed or the IPC data is invalid\n   *\n   * @example\n   * ```typescript\n   * import { tableFromArrays, tableToIPC, utf8 } from '@ducklings/workers';\n   *\n   * const table = tableFromArrays(\n   *   { id: [1, 2, 3], name: ['Alice', 'Bob', 'Charlie'] },\n   *   { types: { name: utf8() } }  // Required for string columns\n   * );\n   * const ipcBuffer = tableToIPC(table, { format: 'stream' });\n   * await conn.insertArrowFromIPCStream('users', ipcBuffer);\n   * ```\n   *\n   * @category Data Insertion\n   */\n  async insertArrowFromIPCStream(tableName: string, ipcBuffer: Uint8Array): Promise<void> {\n    if (this.closed || !module) {\n      throw new DuckDBError('Connection is closed');\n    }\n\n    const bufPtr = module._malloc(ipcBuffer.length);\n    module.HEAPU8.set(ipcBuffer, bufPtr);\n\n    try {\n      const result = (await module.ccall(\n        'duckdb_wasm_insert_arrow_ipc',\n        'number',\n        ['number', 'string', 'number', 'number'],\n        [this.connPtr, tableName, bufPtr, ipcBuffer.length],\n        { async: true },\n      )) as number;\n\n      if (result !== 0) {\n        throw new DuckDBError(`Failed to insert Arrow IPC data into \"${tableName}\"`);\n      }\n    } finally {\n      module._free(bufPtr);\n    }\n  }\n\n  close(): void {\n    if (this.closed || !module) return;\n\n    const connPtrPtr = module._malloc(4);\n    try {\n      module.setValue(connPtrPtr, this.connPtr, '*');\n      module.ccall('duckdb_disconnect', null, ['number'], [connPtrPtr]);\n    } finally {\n      module._free(connPtrPtr);\n    }\n\n    this.closed = true;\n    this.connPtr = 0;\n  }\n}\n\n// Re-export Flechette types and utilities\nexport type { Table } from '@uwdata/flechette';\nexport { tableFromArrays, tableFromIPC, tableToIPC } from '@uwdata/flechette';\n"]}