@loaders.gl/arrow 4.0.0-beta.2 → 4.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/{esm/arrow-loader.js → arrow-loader.js} +1 -1
  2. package/dist/arrow-loader.js.map +1 -0
  3. package/dist/arrow-worker.js +896 -82
  4. package/dist/{esm/arrow-writer.js → arrow-writer.js} +2 -2
  5. package/dist/arrow-writer.js.map +1 -0
  6. package/dist/dist.dev.js +12471 -0
  7. package/dist/index.cjs +262 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +17 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/{esm/lib → lib}/arrow-table-batch.js +1 -2
  13. package/dist/lib/arrow-table-batch.js.map +1 -0
  14. package/dist/lib/arrow-table.js.map +1 -0
  15. package/dist/lib/convert-table.js.map +1 -0
  16. package/dist/{esm/lib → lib}/encode-arrow.js +1 -1
  17. package/dist/lib/encode-arrow.js.map +1 -0
  18. package/dist/lib/parse-arrow-in-batches.js.map +1 -0
  19. package/dist/{esm/lib → lib}/parse-arrow-sync.js +1 -1
  20. package/dist/lib/parse-arrow-sync.js.map +1 -0
  21. package/dist/schema/arrow-type-utils.d.ts +4 -0
  22. package/dist/schema/arrow-type-utils.d.ts.map +1 -0
  23. package/dist/schema/arrow-type-utils.js +24 -0
  24. package/dist/schema/arrow-type-utils.js.map +1 -0
  25. package/dist/schema/convert-schema-arrow.d.ts +13 -0
  26. package/dist/schema/convert-schema-arrow.d.ts.map +1 -0
  27. package/dist/schema/convert-schema-arrow.js +158 -0
  28. package/dist/schema/convert-schema-arrow.js.map +1 -0
  29. package/dist/schema/convert-table-to-arrow.d.ts +42 -0
  30. package/dist/schema/convert-table-to-arrow.d.ts.map +1 -0
  31. package/dist/schema/convert-table-to-arrow.js +2 -0
  32. package/dist/schema/convert-table-to-arrow.js.map +1 -0
  33. package/dist/types.d.ts +1 -1
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/types.js.map +1 -0
  36. package/dist/{esm/workers → workers}/arrow-worker.js +1 -1
  37. package/dist/workers/arrow-worker.js.map +1 -0
  38. package/package.json +16 -9
  39. package/src/index.ts +4 -0
  40. package/src/schema/arrow-type-utils.ts +71 -0
  41. package/src/schema/convert-schema-arrow.ts +232 -0
  42. package/src/schema/convert-table-to-arrow.ts +59 -0
  43. package/src/types.ts +1 -9
  44. package/dist/bundle.d.ts +0 -2
  45. package/dist/bundle.d.ts.map +0 -1
  46. package/dist/dist.min.js +0 -12691
  47. package/dist/es5/arrow-loader.js +0 -25
  48. package/dist/es5/arrow-loader.js.map +0 -1
  49. package/dist/es5/arrow-writer.js +0 -23
  50. package/dist/es5/arrow-writer.js.map +0 -1
  51. package/dist/es5/bundle.js +0 -6
  52. package/dist/es5/bundle.js.map +0 -1
  53. package/dist/es5/index.js +0 -61
  54. package/dist/es5/index.js.map +0 -1
  55. package/dist/es5/lib/arrow-table-batch.js +0 -99
  56. package/dist/es5/lib/arrow-table-batch.js.map +0 -1
  57. package/dist/es5/lib/arrow-table.js +0 -2
  58. package/dist/es5/lib/arrow-table.js.map +0 -1
  59. package/dist/es5/lib/convert-table.js +0 -57
  60. package/dist/es5/lib/convert-table.js.map +0 -1
  61. package/dist/es5/lib/encode-arrow.js +0 -40
  62. package/dist/es5/lib/encode-arrow.js.map +0 -1
  63. package/dist/es5/lib/parse-arrow-in-batches.js +0 -135
  64. package/dist/es5/lib/parse-arrow-in-batches.js.map +0 -1
  65. package/dist/es5/lib/parse-arrow-sync.js +0 -27
  66. package/dist/es5/lib/parse-arrow-sync.js.map +0 -1
  67. package/dist/es5/types.js +0 -13
  68. package/dist/es5/types.js.map +0 -1
  69. package/dist/es5/workers/arrow-worker.js +0 -6
  70. package/dist/es5/workers/arrow-worker.js.map +0 -1
  71. package/dist/esm/arrow-loader.js.map +0 -1
  72. package/dist/esm/arrow-writer.js.map +0 -1
  73. package/dist/esm/bundle.js +0 -4
  74. package/dist/esm/bundle.js.map +0 -1
  75. package/dist/esm/index.js +0 -16
  76. package/dist/esm/index.js.map +0 -1
  77. package/dist/esm/lib/arrow-table-batch.js.map +0 -1
  78. package/dist/esm/lib/arrow-table.js.map +0 -1
  79. package/dist/esm/lib/convert-table.js.map +0 -1
  80. package/dist/esm/lib/encode-arrow.js.map +0 -1
  81. package/dist/esm/lib/parse-arrow-in-batches.js.map +0 -1
  82. package/dist/esm/lib/parse-arrow-sync.js.map +0 -1
  83. package/dist/esm/types.js.map +0 -1
  84. package/dist/esm/workers/arrow-worker.js.map +0 -1
  85. package/src/bundle.ts +0 -4
  86. /package/dist/{esm/lib → lib}/arrow-table.js +0 -0
  87. /package/dist/{esm/lib → lib}/convert-table.js +0 -0
  88. /package/dist/{esm/lib → lib}/parse-arrow-in-batches.js +0 -0
  89. /package/dist/{esm/types.js → types.js} +0 -0
@@ -1,15 +1,14 @@
1
+ "use strict";
1
2
  (() => {
2
3
  var __defProp = Object.defineProperty;
3
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
4
4
  var __export = (target, all) => {
5
- __markAsModule(target);
6
5
  for (var name in all)
7
6
  __defProp(target, name, { get: all[name], enumerable: true });
8
7
  };
9
8
 
10
9
  // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
11
10
  function getTransferList(object, recursive = true, transfers) {
12
- const transfersSet = transfers || new Set();
11
+ const transfersSet = transfers || /* @__PURE__ */ new Set();
13
12
  if (!object) {
14
13
  } else if (isTransferable(object)) {
15
14
  transfersSet.add(object);
@@ -52,11 +51,15 @@
52
51
  }
53
52
  return parentPort;
54
53
  }
55
- var onMessageWrapperMap = new Map();
54
+ var onMessageWrapperMap = /* @__PURE__ */ new Map();
56
55
  var WorkerBody = class {
56
+ /** Check that we are actually in a worker thread */
57
57
  static inWorkerThread() {
58
58
  return typeof self !== "undefined" || Boolean(getParentPort());
59
59
  }
60
+ /*
61
+ * (type: WorkerMessageType, payload: WorkerMessagePayload) => any
62
+ */
60
63
  static set onmessage(onMessage) {
61
64
  function handleMessage(message) {
62
65
  const parentPort3 = getParentPort();
@@ -100,6 +103,11 @@
100
103
  globalThis.removeEventListener("message", onMessageWrapper);
101
104
  }
102
105
  }
106
+ /**
107
+ * Send a message from a worker to creating thread (main thread)
108
+ * @param type
109
+ * @param payload
110
+ */
103
111
  static postMessage(type, payload) {
104
112
  const data = { source: "loaders.gl", type, payload };
105
113
  const transferList = getTransferList(payload);
@@ -131,6 +139,7 @@
131
139
  loader,
132
140
  arrayBuffer: input,
133
141
  options,
142
+ // @ts-expect-error fetch missing
134
143
  context: {
135
144
  ...context,
136
145
  _parse: parseOnMainThread
@@ -398,6 +407,7 @@
398
407
  };
399
408
  return batch;
400
409
  }
410
+ // HELPERS
401
411
  _reallocateColumns() {
402
412
  if (this.length < this.allocated) {
403
413
  return;
@@ -458,6 +468,7 @@
458
468
  }
459
469
  return false;
460
470
  }
471
+ /** @deprecated Use addArrayRow or addObjectRow */
461
472
  addRow(row) {
462
473
  if (this.limitReached()) {
463
474
  return;
@@ -471,6 +482,7 @@
471
482
  this.addObjectRow(row);
472
483
  }
473
484
  }
485
+ /** Add one row to the batch */
474
486
  addArrayRow(row) {
475
487
  if (!this.aggregator) {
476
488
  const TableBatchType = this._getTableBatchType();
@@ -478,6 +490,7 @@
478
490
  }
479
491
  this.aggregator.addArrayRow(row);
480
492
  }
493
+ /** Add one row to the batch */
481
494
  addObjectRow(row) {
482
495
  if (!this.aggregator) {
483
496
  const TableBatchType = this._getTableBatchType();
@@ -485,6 +498,7 @@
485
498
  }
486
499
  this.aggregator.addObjectRow(row);
487
500
  }
501
+ /** Mark an incoming raw memory chunk has completed */
488
502
  chunkComplete(chunk) {
489
503
  if (chunk instanceof ArrayBuffer) {
490
504
  this.bytesUsed += chunk.byteLength;
@@ -500,6 +514,7 @@
500
514
  getFinalBatch(options) {
501
515
  return this._getBatch(options);
502
516
  }
517
+ // INTERNAL
503
518
  _estimateRowMB(row) {
504
519
  return Array.isArray(row) ? row.length * 8 : Object.keys(row).length * 8;
505
520
  }
@@ -521,6 +536,9 @@
521
536
  this.lastBatchEmittedMs = Date.now();
522
537
  return true;
523
538
  }
539
+ /**
540
+ * bytesUsed can be set via chunkComplete or via getBatch*
541
+ */
524
542
  _getBatch(options) {
525
543
  if (!this.aggregator) {
526
544
  return null;
@@ -590,7 +608,9 @@
590
608
  return column[rowIndex];
591
609
  case "arrow-table":
592
610
  const arrowTable = table.data;
593
- const arrowColumnIndex = arrowTable.schema.fields.findIndex((field) => field.name === columnName);
611
+ const arrowColumnIndex = arrowTable.schema.fields.findIndex(
612
+ (field) => field.name === columnName
613
+ );
594
614
  return arrowTable.getChildAt(arrowColumnIndex)?.get(rowIndex);
595
615
  default:
596
616
  throw new Error("todo");
@@ -819,6 +839,7 @@
819
839
  name,
820
840
  type: type.type || "null",
821
841
  nullable: type.nullable
842
+ // metadata: {}
822
843
  };
823
844
  }
824
845
  if (Array.isArray(column) && column.length > 0) {
@@ -828,6 +849,7 @@
828
849
  name,
829
850
  type,
830
851
  nullable: true
852
+ // metadata: {},
831
853
  };
832
854
  }
833
855
  throw new Error("empty table");
@@ -838,6 +860,7 @@
838
860
  name,
839
861
  type,
840
862
  nullable: true
863
+ // metadata: {}
841
864
  };
842
865
  }
843
866
 
@@ -921,7 +944,31 @@
921
944
  };
922
945
  }
923
946
 
924
- // ../../node_modules/apache-arrow/node_modules/tslib/tslib.es6.mjs
947
+ // src/arrow-loader.ts
948
+ var VERSION = true ? "4.0.0-beta.4" : "latest";
949
+ var ArrowLoader = {
950
+ name: "Apache Arrow",
951
+ id: "arrow",
952
+ module: "arrow",
953
+ version: VERSION,
954
+ // worker: true,
955
+ category: "table",
956
+ extensions: ["arrow", "feather"],
957
+ mimeTypes: [
958
+ "application/vnd.apache.arrow.file",
959
+ "application/vnd.apache.arrow.stream",
960
+ "application/octet-stream"
961
+ ],
962
+ binary: true,
963
+ tests: ["ARROW"],
964
+ options: {
965
+ arrow: {
966
+ shape: "columnar-table"
967
+ }
968
+ }
969
+ };
970
+
971
+ // ../../node_modules/tslib/tslib.es6.mjs
925
972
  function __rest(s, e) {
926
973
  var t = {};
927
974
  for (var p in s)
@@ -1273,14 +1320,17 @@
1273
1320
  });
1274
1321
  };
1275
1322
  const buffers = typeof source === "string" ? wrap(source) : ArrayBuffer.isView(source) ? wrap(source) : source instanceof ArrayBuffer ? wrap(source) : source instanceof SharedArrayBuf ? wrap(source) : isIterable(source) ? emit(source) : !isAsyncIterable(source) ? wrap(source) : source;
1276
- yield __await(yield* __asyncDelegator(__asyncValues(pump(function(it) {
1277
- return __asyncGenerator(this, arguments, function* () {
1278
- let r = null;
1279
- do {
1280
- r = yield __await(it.next(yield yield __await(toArrayBufferView(ArrayCtor, r))));
1281
- } while (!r.done);
1282
- });
1283
- }(buffers[Symbol.asyncIterator]())))));
1323
+ yield __await(
1324
+ // otherwise if AsyncIterable, use it
1325
+ yield* __asyncDelegator(__asyncValues(pump(function(it) {
1326
+ return __asyncGenerator(this, arguments, function* () {
1327
+ let r = null;
1328
+ do {
1329
+ r = yield __await(it.next(yield yield __await(toArrayBufferView(ArrayCtor, r))));
1330
+ } while (!r.done);
1331
+ });
1332
+ }(buffers[Symbol.asyncIterator]()))))
1333
+ );
1284
1334
  return yield __await(new ArrayCtor());
1285
1335
  });
1286
1336
  }
@@ -1332,9 +1382,11 @@
1332
1382
  fromNodeStream(stream) {
1333
1383
  return pump2(fromNodeStream(stream));
1334
1384
  },
1385
+ // @ts-ignore
1335
1386
  toDOMStream(source, options) {
1336
1387
  throw new Error(`"toDOMStream" not available in this environment`);
1337
1388
  },
1389
+ // @ts-ignore
1338
1390
  toNodeStream(source, options) {
1339
1391
  throw new Error(`"toNodeStream" not available in this environment`);
1340
1392
  }
@@ -1819,6 +1871,7 @@
1819
1871
  return digits !== null && digits !== void 0 ? digits : `0`;
1820
1872
  }
1821
1873
  var BN = class {
1874
+ /** @nocollapse */
1822
1875
  static new(num, isSigned) {
1823
1876
  switch (isSigned) {
1824
1877
  case true:
@@ -1838,12 +1891,15 @@
1838
1891
  }
1839
1892
  return new UnsignedBigNum(num);
1840
1893
  }
1894
+ /** @nocollapse */
1841
1895
  static signed(num) {
1842
1896
  return new SignedBigNum(num);
1843
1897
  }
1898
+ /** @nocollapse */
1844
1899
  static unsigned(num) {
1845
1900
  return new UnsignedBigNum(num);
1846
1901
  }
1902
+ /** @nocollapse */
1847
1903
  static decimal(num) {
1848
1904
  return new DecimalBigNum(num);
1849
1905
  }
@@ -1881,63 +1937,83 @@
1881
1937
  var _t;
1882
1938
  var _u;
1883
1939
  var DataType = class {
1940
+ /** @nocollapse */
1884
1941
  static isNull(x) {
1885
1942
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Null;
1886
1943
  }
1944
+ /** @nocollapse */
1887
1945
  static isInt(x) {
1888
1946
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Int;
1889
1947
  }
1948
+ /** @nocollapse */
1890
1949
  static isFloat(x) {
1891
1950
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Float;
1892
1951
  }
1952
+ /** @nocollapse */
1893
1953
  static isBinary(x) {
1894
1954
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Binary;
1895
1955
  }
1956
+ /** @nocollapse */
1896
1957
  static isUtf8(x) {
1897
1958
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Utf8;
1898
1959
  }
1960
+ /** @nocollapse */
1899
1961
  static isBool(x) {
1900
1962
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Bool;
1901
1963
  }
1964
+ /** @nocollapse */
1902
1965
  static isDecimal(x) {
1903
1966
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Decimal;
1904
1967
  }
1968
+ /** @nocollapse */
1905
1969
  static isDate(x) {
1906
1970
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Date;
1907
1971
  }
1972
+ /** @nocollapse */
1908
1973
  static isTime(x) {
1909
1974
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Time;
1910
1975
  }
1976
+ /** @nocollapse */
1911
1977
  static isTimestamp(x) {
1912
1978
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Timestamp;
1913
1979
  }
1980
+ /** @nocollapse */
1914
1981
  static isInterval(x) {
1915
1982
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Interval;
1916
1983
  }
1984
+ /** @nocollapse */
1917
1985
  static isList(x) {
1918
1986
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.List;
1919
1987
  }
1988
+ /** @nocollapse */
1920
1989
  static isStruct(x) {
1921
1990
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Struct;
1922
1991
  }
1992
+ /** @nocollapse */
1923
1993
  static isUnion(x) {
1924
1994
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Union;
1925
1995
  }
1996
+ /** @nocollapse */
1926
1997
  static isFixedSizeBinary(x) {
1927
1998
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.FixedSizeBinary;
1928
1999
  }
2000
+ /** @nocollapse */
1929
2001
  static isFixedSizeList(x) {
1930
2002
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.FixedSizeList;
1931
2003
  }
2004
+ /** @nocollapse */
1932
2005
  static isMap(x) {
1933
2006
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Map;
1934
2007
  }
2008
+ /** @nocollapse */
1935
2009
  static isDictionary(x) {
1936
2010
  return (x === null || x === void 0 ? void 0 : x.typeId) === Type.Dictionary;
1937
2011
  }
2012
+ /** @nocollapse */
1938
2013
  static isDenseUnion(x) {
1939
2014
  return DataType.isUnion(x) && x.mode === UnionMode.Dense;
1940
2015
  }
2016
+ /** @nocollapse */
1941
2017
  static isSparseUnion(x) {
1942
2018
  return DataType.isUnion(x) && x.mode === UnionMode.Sparse;
1943
2019
  }
@@ -2313,7 +2389,7 @@
2313
2389
  this.mode = mode;
2314
2390
  this.children = children;
2315
2391
  this.typeIds = typeIds = Int32Array.from(typeIds);
2316
- this.typeIdToChildIndex = typeIds.reduce((typeIdToChildIndex, typeId, idx) => (typeIdToChildIndex[typeId] = idx) && typeIdToChildIndex || typeIdToChildIndex, Object.create(null));
2392
+ this.typeIdToChildIndex = typeIds.reduce((typeIdToChildIndex, typeId, idx) => (typeIdToChildIndex[typeId] = idx) && typeIdToChildIndex || typeIdToChildIndex, /* @__PURE__ */ Object.create(null));
2317
2393
  }
2318
2394
  get typeId() {
2319
2395
  return Type.Union;
@@ -3635,7 +3711,10 @@
3635
3711
  const alignedSize = bitmap.byteLength + 7 & ~7;
3636
3712
  if (offset > 0 || bitmap.byteLength < alignedSize) {
3637
3713
  const bytes = new Uint8Array(alignedSize);
3638
- bytes.set(offset % 8 === 0 ? bitmap.subarray(offset >> 3) : packBools(new BitIterator(bitmap, offset, length, null, getBool2)).subarray(0, alignedSize));
3714
+ bytes.set(offset % 8 === 0 ? bitmap.subarray(offset >> 3) : (
3715
+ // Otherwise iterate each bit from the offset and return a new one
3716
+ packBools(new BitIterator(bitmap, offset, length, null, getBool2)).subarray(0, alignedSize)
3717
+ ));
3639
3718
  return bytes;
3640
3719
  }
3641
3720
  return bitmap;
@@ -3697,7 +3776,12 @@
3697
3776
  }
3698
3777
  const rhsInside = rhs >> 3 << 3;
3699
3778
  const lhsInside = lhs + (lhs % 8 === 0 ? 0 : 8 - lhs % 8);
3700
- return popcnt_bit_range(data, lhs, lhsInside) + popcnt_bit_range(data, rhsInside, rhs) + popcnt_array(data, lhsInside >> 3, rhsInside - lhsInside >> 3);
3779
+ return (
3780
+ // Get the popcnt of bits between the left hand side, and the next highest multiple of 8
3781
+ popcnt_bit_range(data, lhs, lhsInside) + // Get the popcnt of bits between the right hand side, and the next lowest multiple of 8
3782
+ popcnt_bit_range(data, rhsInside, rhs) + // Get the popcnt of all bits between the left and right hand sides' multiples of 8
3783
+ popcnt_array(data, lhsInside >> 3, rhsInside - lhsInside >> 3)
3784
+ );
3701
3785
  }
3702
3786
  function popcnt_array(arr, byteOffset, byteLength) {
3703
3787
  let cnt = 0, pos = Math.trunc(byteOffset);
@@ -3809,7 +3893,15 @@
3809
3893
  const nullCount = +(this._nullCount === 0) - 1;
3810
3894
  const childStride = typeId === 16 ? stride : 1;
3811
3895
  const buffers = this._sliceBuffers(offset, length, stride, typeId);
3812
- return this.clone(this.type, this.offset + offset, length, nullCount, buffers, children.length === 0 || this.valueOffsets ? children : this._sliceChildren(children, childStride * offset, childStride * length));
3896
+ return this.clone(
3897
+ this.type,
3898
+ this.offset + offset,
3899
+ length,
3900
+ nullCount,
3901
+ buffers,
3902
+ // Don't slice children if we have value offsets (the variable-width types)
3903
+ children.length === 0 || this.valueOffsets ? children : this._sliceChildren(children, childStride * offset, childStride * length)
3904
+ );
3813
3905
  }
3814
3906
  _changeLengthAndBackfillNullBitmap(newLength) {
3815
3907
  if (this.typeId === Type.Null) {
@@ -3829,7 +3921,8 @@
3829
3921
  let arr;
3830
3922
  const { buffers } = this;
3831
3923
  (arr = buffers[BufferType.TYPE]) && (buffers[BufferType.TYPE] = arr.subarray(offset, offset + length));
3832
- (arr = buffers[BufferType.OFFSET]) && (buffers[BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) || (arr = buffers[BufferType.DATA]) && (buffers[BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));
3924
+ (arr = buffers[BufferType.OFFSET]) && (buffers[BufferType.OFFSET] = arr.subarray(offset, offset + length + 1)) || // Otherwise if no offsets, slice the data buffer. Don't slice the data vector for Booleans, since the offset goes by bits not bytes
3925
+ (arr = buffers[BufferType.DATA]) && (buffers[BufferType.DATA] = typeId === 6 ? arr : arr.subarray(stride * offset, stride * (offset + length)));
3833
3926
  return buffers;
3834
3927
  }
3835
3928
  _sliceChildren(children, offset, length) {
@@ -4392,57 +4485,123 @@
4392
4485
  this.numChildren = (_d2 = (_c2 = type.children) === null || _c2 === void 0 ? void 0 : _c2.length) !== null && _d2 !== void 0 ? _d2 : 0;
4393
4486
  this.length = this._offsets.at(-1);
4394
4487
  }
4488
+ /**
4489
+ * The aggregate size (in bytes) of this Vector's buffers and/or child Vectors.
4490
+ */
4395
4491
  get byteLength() {
4396
4492
  if (this._byteLength === -1) {
4397
4493
  this._byteLength = this.data.reduce((byteLength, data) => byteLength + data.byteLength, 0);
4398
4494
  }
4399
4495
  return this._byteLength;
4400
4496
  }
4497
+ /**
4498
+ * The number of null elements in this Vector.
4499
+ */
4401
4500
  get nullCount() {
4402
4501
  if (this._nullCount === -1) {
4403
4502
  this._nullCount = computeChunkNullCounts(this.data);
4404
4503
  }
4405
4504
  return this._nullCount;
4406
4505
  }
4506
+ /**
4507
+ * The Array or TypedArray constructor used for the JS representation
4508
+ * of the element's values in {@link Vector.prototype.toArray `toArray()`}.
4509
+ */
4407
4510
  get ArrayType() {
4408
4511
  return this.type.ArrayType;
4409
4512
  }
4513
+ /**
4514
+ * The name that should be printed when the Vector is logged in a message.
4515
+ */
4410
4516
  get [Symbol.toStringTag]() {
4411
4517
  return `${this.VectorName}<${this.type[Symbol.toStringTag]}>`;
4412
4518
  }
4519
+ /**
4520
+ * The name of this Vector.
4521
+ */
4413
4522
  get VectorName() {
4414
4523
  return `${Type[this.type.typeId]}Vector`;
4415
4524
  }
4525
+ /**
4526
+ * Check whether an element is null.
4527
+ * @param index The index at which to read the validity bitmap.
4528
+ */
4529
+ // @ts-ignore
4416
4530
  isValid(index) {
4417
4531
  return false;
4418
4532
  }
4533
+ /**
4534
+ * Get an element value by position.
4535
+ * @param index The index of the element to read.
4536
+ */
4537
+ // @ts-ignore
4419
4538
  get(index) {
4420
4539
  return null;
4421
4540
  }
4541
+ /**
4542
+ * Set an element value by position.
4543
+ * @param index The index of the element to write.
4544
+ * @param value The value to set.
4545
+ */
4546
+ // @ts-ignore
4422
4547
  set(index, value) {
4423
4548
  return;
4424
4549
  }
4550
+ /**
4551
+ * Retrieve the index of the first occurrence of a value in an Vector.
4552
+ * @param element The value to locate in the Vector.
4553
+ * @param offset The index at which to begin the search. If offset is omitted, the search starts at index 0.
4554
+ */
4555
+ // @ts-ignore
4425
4556
  indexOf(element, offset) {
4426
4557
  return -1;
4427
4558
  }
4428
4559
  includes(element, offset) {
4429
4560
  return this.indexOf(element, offset) > 0;
4430
4561
  }
4562
+ /**
4563
+ * Get the size in bytes of an element by index.
4564
+ * @param index The index at which to get the byteLength.
4565
+ */
4566
+ // @ts-ignore
4431
4567
  getByteLength(index) {
4432
4568
  return 0;
4433
4569
  }
4570
+ /**
4571
+ * Iterator for the Vector's elements.
4572
+ */
4434
4573
  [Symbol.iterator]() {
4435
4574
  return instance4.visit(this);
4436
4575
  }
4576
+ /**
4577
+ * Combines two or more Vectors of the same type.
4578
+ * @param others Additional Vectors to add to the end of this Vector.
4579
+ */
4437
4580
  concat(...others) {
4438
4581
  return new Vector(this.data.concat(others.flatMap((x) => x.data).flat(Number.POSITIVE_INFINITY)));
4439
4582
  }
4583
+ /**
4584
+ * Return a zero-copy sub-section of this Vector.
4585
+ * @param start The beginning of the specified portion of the Vector.
4586
+ * @param end The end of the specified portion of the Vector. This is exclusive of the element at the index 'end'.
4587
+ */
4440
4588
  slice(begin, end) {
4441
4589
  return new Vector(clampRange(this, begin, end, ({ data, _offsets }, begin2, end2) => sliceChunks(data, _offsets, begin2, end2)));
4442
4590
  }
4443
4591
  toJSON() {
4444
4592
  return [...this];
4445
4593
  }
4594
+ /**
4595
+ * Return a JavaScript Array or TypedArray of the Vector's elements.
4596
+ *
4597
+ * @note If this Vector contains a single Data chunk and the Vector's type is a
4598
+ * primitive numeric type corresponding to one of the JavaScript TypedArrays, this
4599
+ * method returns a zero-copy slice of the underlying TypedArray values. If there's
4600
+ * more than one chunk, the resulting TypedArray will be a copy of the data from each
4601
+ * chunk's underlying TypedArray values.
4602
+ *
4603
+ * @returns An Array or TypedArray of the Vector's elements, based on the Vector's DataType.
4604
+ */
4446
4605
  toArray() {
4447
4606
  const { type, data, length, stride, ArrayType } = this;
4448
4607
  switch (type.typeId) {
@@ -4466,13 +4625,26 @@
4466
4625
  }
4467
4626
  return [...this];
4468
4627
  }
4628
+ /**
4629
+ * Returns a string representation of the Vector.
4630
+ *
4631
+ * @returns A string representation of the Vector.
4632
+ */
4469
4633
  toString() {
4470
4634
  return `[${[...this].join(",")}]`;
4471
4635
  }
4636
+ /**
4637
+ * Returns a child Vector by name, or null if this Vector has no child with the given name.
4638
+ * @param name The name of the child to retrieve.
4639
+ */
4472
4640
  getChild(name) {
4473
4641
  var _b2;
4474
4642
  return this.getChildAt((_b2 = this.type.children) === null || _b2 === void 0 ? void 0 : _b2.findIndex((f) => f.name === name));
4475
4643
  }
4644
+ /**
4645
+ * Returns a child Vector by index, or null if this Vector has no child at the supplied index.
4646
+ * @param index The index of the child to retrieve.
4647
+ */
4476
4648
  getChildAt(index) {
4477
4649
  if (index > -1 && index < this.numChildren) {
4478
4650
  return new Vector(this.data.map(({ children }) => children[index]));
@@ -4485,6 +4657,17 @@
4485
4657
  }
4486
4658
  return false;
4487
4659
  }
4660
+ /**
4661
+ * Adds memoization to the Vector's {@link get} method. For dictionary
4662
+ * vectors, this method return a vector that memoizes only the dictionary
4663
+ * values.
4664
+ *
4665
+ * Memoization is very useful when decoding a value is expensive such as
4666
+ * Uft8. The memoization creates a cache of the size of the Vector and
4667
+ * therfore increases memory usage.
4668
+ *
4669
+ * @returns A new vector that memoizes calls to {@link get}.
4670
+ */
4488
4671
  memoize() {
4489
4672
  if (DataType.isDictionary(this.type)) {
4490
4673
  const dictionary = new MemoizedVector(this.data[0].dictionary);
@@ -4497,6 +4680,12 @@
4497
4680
  }
4498
4681
  return new MemoizedVector(this);
4499
4682
  }
4683
+ /**
4684
+ * Returns a vector without memoization of the {@link get} method. If this
4685
+ * vector is not memoized, this method returns this vector.
4686
+ *
4687
+ * @returns A a vector without memoization.
4688
+ */
4500
4689
  unmemoize() {
4501
4690
  if (DataType.isDictionary(this.type) && this.isMemoized) {
4502
4691
  const dictionary = this.data[0].dictionary.unmemoize();
@@ -4682,6 +4871,7 @@ return true;`);
4682
4871
  get reservedByteLength() {
4683
4872
  return this.buffer.byteLength;
4684
4873
  }
4874
+ // @ts-ignore
4685
4875
  set(index, value) {
4686
4876
  return this;
4687
4877
  }
@@ -4777,12 +4967,21 @@ return true;`);
4777
4967
 
4778
4968
  // ../../node_modules/apache-arrow/builder.mjs
4779
4969
  var Builder = class {
4970
+ /** @nocollapse */
4971
+ // @ts-ignore
4780
4972
  static throughNode(options) {
4781
4973
  throw new Error(`"throughNode" not available in this environment`);
4782
4974
  }
4975
+ /** @nocollapse */
4976
+ // @ts-ignore
4783
4977
  static throughDOM(options) {
4784
4978
  throw new Error(`"throughDOM" not available in this environment`);
4785
4979
  }
4980
+ /**
4981
+ * Construct a builder with the given Arrow DataType with optional null values,
4982
+ * which will be interpreted as "null" when set or appended to the `Builder`.
4983
+ * @param {{ type: T, nullValues?: any[] }} options A `BuilderOptions` object used to create this `Builder`.
4984
+ */
4786
4985
  constructor({ "type": type, "nullValues": nulls }) {
4787
4986
  this.length = 0;
4788
4987
  this.finished = false;
@@ -4795,6 +4994,10 @@ return true;`);
4795
4994
  this._isValid = createIsValidFunction(nulls);
4796
4995
  }
4797
4996
  }
4997
+ /**
4998
+ * Flush the `Builder` and return a `Vector<T>`.
4999
+ * @returns {Vector<T>} A `Vector<T>` of the flushed values.
5000
+ */
4798
5001
  toVector() {
4799
5002
  return new Vector([this.flush()]);
4800
5003
  }
@@ -4807,6 +5010,9 @@ return true;`);
4807
5010
  get numChildren() {
4808
5011
  return this.children.length;
4809
5012
  }
5013
+ /**
5014
+ * @returns The aggregate length (in bytes) of the values that have been written.
5015
+ */
4810
5016
  get byteLength() {
4811
5017
  let size = 0;
4812
5018
  const { _offsets, _values, _nulls, _typeIds, children } = this;
@@ -4816,9 +5022,15 @@ return true;`);
4816
5022
  _typeIds && (size += _typeIds.byteLength);
4817
5023
  return children.reduce((size2, child) => size2 + child.byteLength, size);
4818
5024
  }
5025
+ /**
5026
+ * @returns The aggregate number of rows that have been reserved to write new values.
5027
+ */
4819
5028
  get reservedLength() {
4820
5029
  return this._nulls.reservedLength;
4821
5030
  }
5031
+ /**
5032
+ * @returns The aggregate length (in bytes) that has been reserved to write new values.
5033
+ */
4822
5034
  get reservedByteLength() {
4823
5035
  let size = 0;
4824
5036
  this._offsets && (size += this._offsets.reservedByteLength);
@@ -4839,18 +5051,43 @@ return true;`);
4839
5051
  get typeIds() {
4840
5052
  return this._typeIds ? this._typeIds.buffer : null;
4841
5053
  }
5054
+ /**
5055
+ * Appends a value (or null) to this `Builder`.
5056
+ * This is equivalent to `builder.set(builder.length, value)`.
5057
+ * @param {T['TValue'] | TNull } value The value to append.
5058
+ */
4842
5059
  append(value) {
4843
5060
  return this.set(this.length, value);
4844
5061
  }
5062
+ /**
5063
+ * Validates whether a value is valid (true), or null (false)
5064
+ * @param {T['TValue'] | TNull } value The value to compare against null the value representations
5065
+ */
4845
5066
  isValid(value) {
4846
5067
  return this._isValid(value);
4847
5068
  }
5069
+ /**
5070
+ * Write a value (or null-value sentinel) at the supplied index.
5071
+ * If the value matches one of the null-value representations, a 1-bit is
5072
+ * written to the null `BitmapBufferBuilder`. Otherwise, a 0 is written to
5073
+ * the null `BitmapBufferBuilder`, and the value is passed to
5074
+ * `Builder.prototype.setValue()`.
5075
+ * @param {number} index The index of the value to write.
5076
+ * @param {T['TValue'] | TNull } value The value to write at the supplied index.
5077
+ * @returns {this} The updated `Builder` instance.
5078
+ */
4848
5079
  set(index, value) {
4849
5080
  if (this.setValid(index, this.isValid(value))) {
4850
5081
  this.setValue(index, value);
4851
5082
  }
4852
5083
  return this;
4853
5084
  }
5085
+ /**
5086
+ * Write a value to the underlying buffers at the supplied index, bypassing
5087
+ * the null-value check. This is a low-level method that
5088
+ * @param {number} index
5089
+ * @param {T['TValue'] | TNull } value
5090
+ */
4854
5091
  setValue(index, value) {
4855
5092
  this._setValue(this, index, value);
4856
5093
  }
@@ -4858,12 +5095,25 @@ return true;`);
4858
5095
  this.length = this._nulls.set(index, +valid).length;
4859
5096
  return valid;
4860
5097
  }
5098
+ // @ts-ignore
4861
5099
  addChild(child, name = `${this.numChildren}`) {
4862
5100
  throw new Error(`Cannot append children to non-nested type "${this.type}"`);
4863
5101
  }
5102
+ /**
5103
+ * Retrieve the child `Builder` at the supplied `index`, or null if no child
5104
+ * exists at that index.
5105
+ * @param {number} index The index of the child `Builder` to retrieve.
5106
+ * @returns {Builder | null} The child Builder at the supplied index or null.
5107
+ */
4864
5108
  getChildAt(index) {
4865
5109
  return this.children[index] || null;
4866
5110
  }
5111
+ /**
5112
+ * Commit all the values that have been written to their underlying
5113
+ * ArrayBuffers, including any child Builders if applicable, and reset
5114
+ * the internal `Builder` state.
5115
+ * @returns A `Data<T>` of the buffers and children representing the values written.
5116
+ */
4867
5117
  flush() {
4868
5118
  let data;
4869
5119
  let typeIds;
@@ -4894,12 +5144,20 @@ return true;`);
4894
5144
  valueOffsets
4895
5145
  });
4896
5146
  }
5147
+ /**
5148
+ * Finalize this `Builder`, and child builders if applicable.
5149
+ * @returns {this} The finalized `Builder` instance.
5150
+ */
4897
5151
  finish() {
4898
5152
  this.finished = true;
4899
5153
  for (const child of this.children)
4900
5154
  child.finish();
4901
5155
  return this;
4902
5156
  }
5157
+ /**
5158
+ * Clear this Builder's internal state, including child Builders if applicable, and reset the length to 0.
5159
+ * @returns {this} The cleared `Builder` instance.
5160
+ */
4903
5161
  clear() {
4904
5162
  var _a5, _b2, _c2, _d2;
4905
5163
  this.length = 0;
@@ -4936,7 +5194,7 @@ return true;`);
4936
5194
  this._offsets = new OffsetsBufferBuilder();
4937
5195
  }
4938
5196
  setValue(index, value) {
4939
- const pending = this._pending || (this._pending = new Map());
5197
+ const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
4940
5198
  const current = pending.get(index);
4941
5199
  current && (this._pendingLength -= current.length);
4942
5200
  this._pendingLength += value instanceof MapRow ? value[kKeys].length : value.length;
@@ -4944,7 +5202,7 @@ return true;`);
4944
5202
  }
4945
5203
  setValid(index, isValid) {
4946
5204
  if (!super.setValid(index, isValid)) {
4947
- (this._pending || (this._pending = new Map())).set(index, void 0);
5205
+ (this._pending || (this._pending = /* @__PURE__ */ new Map())).set(index, void 0);
4948
5206
  return false;
4949
5207
  }
4950
5208
  return true;
@@ -4985,12 +5243,22 @@ return true;`);
4985
5243
  this.bb = bb;
4986
5244
  return this;
4987
5245
  }
5246
+ /**
5247
+ * Index to the start of the RecordBlock (note this is past the Message header)
5248
+ */
4988
5249
  offset() {
4989
5250
  return this.bb.readInt64(this.bb_pos);
4990
5251
  }
5252
+ /**
5253
+ * Length of the metadata
5254
+ */
4991
5255
  metaDataLength() {
4992
5256
  return this.bb.readInt32(this.bb_pos + 8);
4993
5257
  }
5258
+ /**
5259
+ * Length of the data (this is aligned so there can be a gap between this and
5260
+ * the metadata).
5261
+ */
4994
5262
  bodyLength() {
4995
5263
  return this.bb.readInt64(this.bb_pos + 16);
4996
5264
  }
@@ -5028,26 +5296,44 @@ return true;`);
5028
5296
 
5029
5297
  // ../../node_modules/apache-arrow/node_modules/flatbuffers/mjs/byte-buffer.js
5030
5298
  var ByteBuffer = class {
5299
+ /**
5300
+ * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)
5301
+ */
5031
5302
  constructor(bytes_) {
5032
5303
  this.bytes_ = bytes_;
5033
5304
  this.position_ = 0;
5034
5305
  this.text_decoder_ = new TextDecoder();
5035
5306
  }
5307
+ /**
5308
+ * Create and allocate a new ByteBuffer with a given size.
5309
+ */
5036
5310
  static allocate(byte_size) {
5037
5311
  return new ByteBuffer(new Uint8Array(byte_size));
5038
5312
  }
5039
5313
  clear() {
5040
5314
  this.position_ = 0;
5041
5315
  }
5316
+ /**
5317
+ * Get the underlying `Uint8Array`.
5318
+ */
5042
5319
  bytes() {
5043
5320
  return this.bytes_;
5044
5321
  }
5322
+ /**
5323
+ * Get the buffer's position.
5324
+ */
5045
5325
  position() {
5046
5326
  return this.position_;
5047
5327
  }
5328
+ /**
5329
+ * Set the buffer's position.
5330
+ */
5048
5331
  setPosition(position) {
5049
5332
  this.position_ = position;
5050
5333
  }
5334
+ /**
5335
+ * Get the buffer's capacity.
5336
+ */
5051
5337
  capacity() {
5052
5338
  return this.bytes_.length;
5053
5339
  }
@@ -5127,6 +5413,11 @@ return true;`);
5127
5413
  this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);
5128
5414
  this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);
5129
5415
  }
5416
+ /**
5417
+ * Return the file identifier. Behavior is undefined for FlatBuffers whose
5418
+ * schema does not include a file_identifier (likely points at padding or the
5419
+ * start of a the root vtable).
5420
+ */
5130
5421
  getBufferIdentifier() {
5131
5422
  if (this.bytes_.length < this.position_ + SIZEOF_INT + FILE_IDENTIFIER_LENGTH) {
5132
5423
  throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");
@@ -5137,15 +5428,33 @@ return true;`);
5137
5428
  }
5138
5429
  return result;
5139
5430
  }
5431
+ /**
5432
+ * Look up a field in the vtable, return an offset into the object, or 0 if the
5433
+ * field is not present.
5434
+ */
5140
5435
  __offset(bb_pos, vtable_offset) {
5141
5436
  const vtable = bb_pos - this.readInt32(bb_pos);
5142
5437
  return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;
5143
5438
  }
5439
+ /**
5440
+ * Initialize any Table-derived type to point to the union at the given offset.
5441
+ */
5144
5442
  __union(t, offset) {
5145
5443
  t.bb_pos = offset + this.readInt32(offset);
5146
5444
  t.bb = this;
5147
5445
  return t;
5148
5446
  }
5447
+ /**
5448
+ * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.
5449
+ * This allocates a new string and converts to wide chars upon each access.
5450
+ *
5451
+ * To avoid the conversion to string, pass Encoding.UTF8_BYTES as the
5452
+ * "optionalEncoding" argument. This is useful for avoiding conversion when
5453
+ * the data will just be packaged back up in another FlatBuffer later on.
5454
+ *
5455
+ * @param offset
5456
+ * @param opt_encoding Defaults to UTF16_STRING
5457
+ */
5149
5458
  __string(offset, opt_encoding) {
5150
5459
  offset += this.readInt32(offset);
5151
5460
  const length = this.readInt32(offset);
@@ -5156,18 +5465,34 @@ return true;`);
5156
5465
  else
5157
5466
  return this.text_decoder_.decode(utf8bytes);
5158
5467
  }
5468
+ /**
5469
+ * Handle unions that can contain string as its member, if a Table-derived type then initialize it,
5470
+ * if a string then return a new one
5471
+ *
5472
+ * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this
5473
+ * makes the behaviour of __union_with_string different compared to __union
5474
+ */
5159
5475
  __union_with_string(o, offset) {
5160
5476
  if (typeof o === "string") {
5161
5477
  return this.__string(offset);
5162
5478
  }
5163
5479
  return this.__union(o, offset);
5164
5480
  }
5481
+ /**
5482
+ * Retrieve the relative offset stored at "offset"
5483
+ */
5165
5484
  __indirect(offset) {
5166
5485
  return offset + this.readInt32(offset);
5167
5486
  }
5487
+ /**
5488
+ * Get the start of data of a vector whose offset is stored at "offset" in this object.
5489
+ */
5168
5490
  __vector(offset) {
5169
5491
  return offset + this.readInt32(offset) + SIZEOF_INT;
5170
5492
  }
5493
+ /**
5494
+ * Get the length of a vector whose offset is stored at "offset" in this object.
5495
+ */
5171
5496
  __vector_len(offset) {
5172
5497
  return this.readInt32(offset + this.readInt32(offset));
5173
5498
  }
@@ -5182,6 +5507,9 @@ return true;`);
5182
5507
  }
5183
5508
  return true;
5184
5509
  }
5510
+ /**
5511
+ * A helper function for generating list for obj api
5512
+ */
5185
5513
  createScalarList(listAccessor, listLength) {
5186
5514
  const ret = [];
5187
5515
  for (let i = 0; i < listLength; ++i) {
@@ -5192,6 +5520,12 @@ return true;`);
5192
5520
  }
5193
5521
  return ret;
5194
5522
  }
5523
+ /**
5524
+ * A helper function for generating list for obj api
5525
+ * @param listAccessor function that accepts an index and return data at that index
5526
+ * @param listLength listLength
5527
+ * @param res result list
5528
+ */
5195
5529
  createObjList(listAccessor, listLength) {
5196
5530
  const ret = [];
5197
5531
  for (let i = 0; i < listLength; ++i) {
@@ -5206,6 +5540,9 @@ return true;`);
5206
5540
 
5207
5541
  // ../../node_modules/apache-arrow/node_modules/flatbuffers/mjs/builder.js
5208
5542
  var Builder2 = class {
5543
+ /**
5544
+ * Create a FlatBufferBuilder.
5545
+ */
5209
5546
  constructor(opt_initial_size) {
5210
5547
  this.minalign = 1;
5211
5548
  this.vtable = null;
@@ -5239,15 +5576,40 @@ return true;`);
5239
5576
  this.force_defaults = false;
5240
5577
  this.string_maps = null;
5241
5578
  }
5579
+ /**
5580
+ * In order to save space, fields that are set to their default value
5581
+ * don't get serialized into the buffer. Forcing defaults provides a
5582
+ * way to manually disable this optimization.
5583
+ *
5584
+ * @param forceDefaults true always serializes default values
5585
+ */
5242
5586
  forceDefaults(forceDefaults) {
5243
5587
  this.force_defaults = forceDefaults;
5244
5588
  }
5589
+ /**
5590
+ * Get the ByteBuffer representing the FlatBuffer. Only call this after you've
5591
+ * called finish(). The actual data starts at the ByteBuffer's current position,
5592
+ * not necessarily at 0.
5593
+ */
5245
5594
  dataBuffer() {
5246
5595
  return this.bb;
5247
5596
  }
5597
+ /**
5598
+ * Get the bytes representing the FlatBuffer. Only call this after you've
5599
+ * called finish().
5600
+ */
5248
5601
  asUint8Array() {
5249
5602
  return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());
5250
5603
  }
5604
+ /**
5605
+ * Prepare to write an element of `size` after `additional_bytes` have been
5606
+ * written, e.g. if you write a string, you need to align such the int length
5607
+ * field is aligned to 4 bytes, and the string data follows it directly. If all
5608
+ * you need to do is alignment, `additional_bytes` will be 0.
5609
+ *
5610
+ * @param size This is the of the new element to write
5611
+ * @param additional_bytes The padding size
5612
+ */
5251
5613
  prep(size, additional_bytes) {
5252
5614
  if (size > this.minalign) {
5253
5615
  this.minalign = size;
@@ -5283,26 +5645,50 @@ return true;`);
5283
5645
  writeFloat64(value) {
5284
5646
  this.bb.writeFloat64(this.space -= 8, value);
5285
5647
  }
5648
+ /**
5649
+ * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).
5650
+ * @param value The `int8` to add the buffer.
5651
+ */
5286
5652
  addInt8(value) {
5287
5653
  this.prep(1, 0);
5288
5654
  this.writeInt8(value);
5289
5655
  }
5656
+ /**
5657
+ * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).
5658
+ * @param value The `int16` to add the buffer.
5659
+ */
5290
5660
  addInt16(value) {
5291
5661
  this.prep(2, 0);
5292
5662
  this.writeInt16(value);
5293
5663
  }
5664
+ /**
5665
+ * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).
5666
+ * @param value The `int32` to add the buffer.
5667
+ */
5294
5668
  addInt32(value) {
5295
5669
  this.prep(4, 0);
5296
5670
  this.writeInt32(value);
5297
5671
  }
5672
+ /**
5673
+ * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).
5674
+ * @param value The `int64` to add the buffer.
5675
+ */
5298
5676
  addInt64(value) {
5299
5677
  this.prep(8, 0);
5300
5678
  this.writeInt64(value);
5301
5679
  }
5680
+ /**
5681
+ * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).
5682
+ * @param value The `float32` to add the buffer.
5683
+ */
5302
5684
  addFloat32(value) {
5303
5685
  this.prep(4, 0);
5304
5686
  this.writeFloat32(value);
5305
5687
  }
5688
+ /**
5689
+ * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).
5690
+ * @param value The `float64` to add the buffer.
5691
+ */
5306
5692
  addFloat64(value) {
5307
5693
  this.prep(8, 0);
5308
5694
  this.writeFloat64(value);
@@ -5349,29 +5735,59 @@ return true;`);
5349
5735
  this.slot(voffset);
5350
5736
  }
5351
5737
  }
5738
+ /**
5739
+ * Structs are stored inline, so nothing additional is being added. `d` is always 0.
5740
+ */
5352
5741
  addFieldStruct(voffset, value, defaultValue) {
5353
5742
  if (value != defaultValue) {
5354
5743
  this.nested(value);
5355
5744
  this.slot(voffset);
5356
5745
  }
5357
5746
  }
5747
+ /**
5748
+ * Structures are always stored inline, they need to be created right
5749
+ * where they're used. You'll get this assertion failure if you
5750
+ * created it elsewhere.
5751
+ */
5358
5752
  nested(obj) {
5359
5753
  if (obj != this.offset()) {
5360
5754
  throw new TypeError("FlatBuffers: struct must be serialized inline.");
5361
5755
  }
5362
5756
  }
5757
+ /**
5758
+ * Should not be creating any other object, string or vector
5759
+ * while an object is being constructed
5760
+ */
5363
5761
  notNested() {
5364
5762
  if (this.isNested) {
5365
5763
  throw new TypeError("FlatBuffers: object serialization must not be nested.");
5366
5764
  }
5367
5765
  }
5766
+ /**
5767
+ * Set the current vtable at `voffset` to the current location in the buffer.
5768
+ */
5368
5769
  slot(voffset) {
5369
5770
  if (this.vtable !== null)
5370
5771
  this.vtable[voffset] = this.offset();
5371
5772
  }
5773
+ /**
5774
+ * @returns Offset relative to the end of the buffer.
5775
+ */
5372
5776
  offset() {
5373
5777
  return this.bb.capacity() - this.space;
5374
5778
  }
5779
+ /**
5780
+ * Doubles the size of the backing ByteBuffer and copies the old data towards
5781
+ * the end of the new buffer (since we build the buffer backwards).
5782
+ *
5783
+ * @param bb The current buffer with the existing data
5784
+ * @returns A new byte buffer with the old data copied
5785
+ * to it. The data is located at the end of the buffer.
5786
+ *
5787
+ * uint8Array.set() formally takes {Array<number>|ArrayBufferView}, so to pass
5788
+ * it a uint8Array we need to suppress the type check:
5789
+ * @suppress {checkTypes}
5790
+ */
5375
5791
  static growByteBuffer(bb) {
5376
5792
  const old_buf_size = bb.capacity();
5377
5793
  if (old_buf_size & 3221225472) {
@@ -5383,10 +5799,20 @@ return true;`);
5383
5799
  nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);
5384
5800
  return nbb;
5385
5801
  }
5802
+ /**
5803
+ * Adds on offset, relative to where it will be written.
5804
+ *
5805
+ * @param offset The offset to add.
5806
+ */
5386
5807
  addOffset(offset) {
5387
5808
  this.prep(SIZEOF_INT, 0);
5388
5809
  this.writeInt32(this.offset() - offset + SIZEOF_INT);
5389
5810
  }
5811
+ /**
5812
+ * Start encoding a new object in the buffer. Users will not usually need to
5813
+ * call this directly. The FlatBuffers compiler will generate helper methods
5814
+ * that call this method internally.
5815
+ */
5390
5816
  startObject(numfields) {
5391
5817
  this.notNested();
5392
5818
  if (this.vtable == null) {
@@ -5399,6 +5825,11 @@ return true;`);
5399
5825
  this.isNested = true;
5400
5826
  this.object_start = this.offset();
5401
5827
  }
5828
+ /**
5829
+ * Finish off writing the object that is under construction.
5830
+ *
5831
+ * @returns The offset to the object inside `dataBuffer`
5832
+ */
5402
5833
  endObject() {
5403
5834
  if (this.vtable == null || !this.isNested) {
5404
5835
  throw new Error("FlatBuffers: endObject called without startObject");
@@ -5441,6 +5872,9 @@ return true;`);
5441
5872
  this.isNested = false;
5442
5873
  return vtableloc;
5443
5874
  }
5875
+ /**
5876
+ * Finalize a buffer, poiting to the given `root_table`.
5877
+ */
5444
5878
  finish(root_table, opt_file_identifier, opt_size_prefix) {
5445
5879
  const size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;
5446
5880
  if (opt_file_identifier) {
@@ -5460,9 +5894,16 @@ return true;`);
5460
5894
  }
5461
5895
  this.bb.setPosition(this.space);
5462
5896
  }
5897
+ /**
5898
+ * Finalize a size prefixed buffer, pointing to the given `root_table`.
5899
+ */
5463
5900
  finishSizePrefixed(root_table, opt_file_identifier) {
5464
5901
  this.finish(root_table, opt_file_identifier, true);
5465
5902
  }
5903
+ /**
5904
+ * This checks a required field has been set in a given table that has
5905
+ * just been constructed.
5906
+ */
5466
5907
  requiredField(table, field) {
5467
5908
  const table_start = this.bb.capacity() - table;
5468
5909
  const vtable_start = table_start - this.bb.readInt32(table_start);
@@ -5471,22 +5912,45 @@ return true;`);
5471
5912
  throw new TypeError("FlatBuffers: field " + field + " must be set");
5472
5913
  }
5473
5914
  }
5915
+ /**
5916
+ * Start a new array/vector of objects. Users usually will not call
5917
+ * this directly. The FlatBuffers compiler will create a start/end
5918
+ * method for vector types in generated code.
5919
+ *
5920
+ * @param elem_size The size of each element in the array
5921
+ * @param num_elems The number of elements in the array
5922
+ * @param alignment The alignment of the array
5923
+ */
5474
5924
  startVector(elem_size, num_elems, alignment) {
5475
5925
  this.notNested();
5476
5926
  this.vector_num_elems = num_elems;
5477
5927
  this.prep(SIZEOF_INT, elem_size * num_elems);
5478
5928
  this.prep(alignment, elem_size * num_elems);
5479
5929
  }
5930
+ /**
5931
+ * Finish off the creation of an array and all its elements. The array must be
5932
+ * created with `startVector`.
5933
+ *
5934
+ * @returns The offset at which the newly created array
5935
+ * starts.
5936
+ */
5480
5937
  endVector() {
5481
5938
  this.writeInt32(this.vector_num_elems);
5482
5939
  return this.offset();
5483
5940
  }
5941
+ /**
5942
+ * Encode the string `s` in the buffer using UTF-8. If the string passed has
5943
+ * already been seen, we return the offset of the already written string
5944
+ *
5945
+ * @param s The string to encode
5946
+ * @return The offset in the buffer where the encoded string starts
5947
+ */
5484
5948
  createSharedString(s) {
5485
5949
  if (!s) {
5486
5950
  return 0;
5487
5951
  }
5488
5952
  if (!this.string_maps) {
5489
- this.string_maps = new Map();
5953
+ this.string_maps = /* @__PURE__ */ new Map();
5490
5954
  }
5491
5955
  if (this.string_maps.has(s)) {
5492
5956
  return this.string_maps.get(s);
@@ -5495,6 +5959,13 @@ return true;`);
5495
5959
  this.string_maps.set(s, offset);
5496
5960
  return offset;
5497
5961
  }
5962
+ /**
5963
+ * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed
5964
+ * instead of a string, it is assumed to contain valid UTF-8 encoded data.
5965
+ *
5966
+ * @param s The string to encode
5967
+ * @return The offset in the buffer where the encoded string starts
5968
+ */
5498
5969
  createString(s) {
5499
5970
  if (s === null || s === void 0) {
5500
5971
  return 0;
@@ -5513,6 +5984,11 @@ return true;`);
5513
5984
  }
5514
5985
  return this.endVector();
5515
5986
  }
5987
+ /**
5988
+ * A helper function to pack an object
5989
+ *
5990
+ * @returns offset of obj
5991
+ */
5516
5992
  createObjectOffset(obj) {
5517
5993
  if (obj === null) {
5518
5994
  return 0;
@@ -5523,6 +5999,11 @@ return true;`);
5523
5999
  return obj.pack(this);
5524
6000
  }
5525
6001
  }
6002
+ /**
6003
+ * A helper function to pack a list of object
6004
+ *
6005
+ * @returns list of offsets of each non null object
6006
+ */
5526
6007
  createObjectOffsetList(list) {
5527
6008
  const ret = [];
5528
6009
  for (let i = 0; i < list.length; ++i) {
@@ -5677,14 +6158,32 @@ return true;`);
5677
6158
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
5678
6159
  return (obj || new DictionaryEncoding()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
5679
6160
  }
6161
+ /**
6162
+ * The known dictionary id in the application where this data is used. In
6163
+ * the file or streaming formats, the dictionary ids are found in the
6164
+ * DictionaryBatch messages
6165
+ */
5680
6166
  id() {
5681
6167
  const offset = this.bb.__offset(this.bb_pos, 4);
5682
6168
  return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
5683
6169
  }
6170
+ /**
6171
+ * The dictionary indices are constrained to be non-negative integers. If
6172
+ * this field is null, the indices must be signed int32. To maximize
6173
+ * cross-language compatibility and performance, implementations are
6174
+ * recommended to prefer signed integer types over unsigned integer types
6175
+ * and to avoid uint64 indices unless they are required by an application.
6176
+ */
5684
6177
  indexType(obj) {
5685
6178
  const offset = this.bb.__offset(this.bb_pos, 6);
5686
6179
  return offset ? (obj || new Int()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
5687
6180
  }
6181
+ /**
6182
+ * By default, dictionaries are not ordered, or the order does not have
6183
+ * semantic meaning. In some statistical, applications, dictionary-encoding
6184
+ * is used to represent ordered categorical data, and we provide a way to
6185
+ * preserve that metadata here
6186
+ */
5688
6187
  isOrdered() {
5689
6188
  const offset = this.bb.__offset(this.bb_pos, 8);
5690
6189
  return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
@@ -5840,14 +6339,24 @@ return true;`);
5840
6339
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
5841
6340
  return (obj || new Decimal2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
5842
6341
  }
6342
+ /**
6343
+ * Total number of decimal digits
6344
+ */
5843
6345
  precision() {
5844
6346
  const offset = this.bb.__offset(this.bb_pos, 4);
5845
6347
  return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
5846
6348
  }
6349
+ /**
6350
+ * Number of digits after the decimal point "."
6351
+ */
5847
6352
  scale() {
5848
6353
  const offset = this.bb.__offset(this.bb_pos, 6);
5849
6354
  return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
5850
6355
  }
6356
+ /**
6357
+ * Number of bits per value. The only accepted widths are 128 and 256.
6358
+ * We use bitWidth for consistency with Int::bitWidth.
6359
+ */
5851
6360
  bitWidth() {
5852
6361
  const offset = this.bb.__offset(this.bb_pos, 8);
5853
6362
  return offset ? this.bb.readInt32(this.bb_pos + offset) : 128;
@@ -5904,6 +6413,9 @@ return true;`);
5904
6413
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
5905
6414
  return (obj || new FixedSizeBinary2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
5906
6415
  }
6416
+ /**
6417
+ * Number of bytes per value
6418
+ */
5907
6419
  byteWidth() {
5908
6420
  const offset = this.bb.__offset(this.bb_pos, 4);
5909
6421
  return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
@@ -5943,6 +6455,9 @@ return true;`);
5943
6455
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
5944
6456
  return (obj || new FixedSizeList2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
5945
6457
  }
6458
+ /**
6459
+ * Number of list items per value
6460
+ */
5946
6461
  listSize() {
5947
6462
  const offset = this.bb.__offset(this.bb_pos, 4);
5948
6463
  return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
@@ -6107,6 +6622,9 @@ return true;`);
6107
6622
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
6108
6623
  return (obj || new Map2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
6109
6624
  }
6625
+ /**
6626
+ * Set to true if the keys within each value are sorted
6627
+ */
6110
6628
  keysSorted() {
6111
6629
  const offset = this.bb.__offset(this.bb_pos, 4);
6112
6630
  return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
@@ -6437,6 +6955,9 @@ return true;`);
6437
6955
  const offset = this.bb.__offset(this.bb_pos, 4);
6438
6956
  return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
6439
6957
  }
6958
+ /**
6959
+ * Whether or not this field can contain nulls. Should be true in general.
6960
+ */
6440
6961
  nullable() {
6441
6962
  const offset = this.bb.__offset(this.bb_pos, 6);
6442
6963
  return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
@@ -6445,14 +6966,24 @@ return true;`);
6445
6966
  const offset = this.bb.__offset(this.bb_pos, 8);
6446
6967
  return offset ? this.bb.readUint8(this.bb_pos + offset) : Type2.NONE;
6447
6968
  }
6969
+ /**
6970
+ * This is the type of the decoded value if the field is dictionary encoded.
6971
+ */
6448
6972
  type(obj) {
6449
6973
  const offset = this.bb.__offset(this.bb_pos, 10);
6450
6974
  return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
6451
6975
  }
6976
+ /**
6977
+ * Present only if the field is dictionary encoded.
6978
+ */
6452
6979
  dictionary(obj) {
6453
6980
  const offset = this.bb.__offset(this.bb_pos, 12);
6454
6981
  return offset ? (obj || new DictionaryEncoding()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
6455
6982
  }
6983
+ /**
6984
+ * children apply only to nested data types like Struct, List and Union. For
6985
+ * primitive types children will have length 0.
6986
+ */
6456
6987
  children(index, obj) {
6457
6988
  const offset = this.bb.__offset(this.bb_pos, 14);
6458
6989
  return offset ? (obj || new Field()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
@@ -6461,6 +6992,9 @@ return true;`);
6461
6992
  const offset = this.bb.__offset(this.bb_pos, 14);
6462
6993
  return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
6463
6994
  }
6995
+ /**
6996
+ * User-defined metadata
6997
+ */
6464
6998
  customMetadata(index, obj) {
6465
6999
  const offset = this.bb.__offset(this.bb_pos, 16);
6466
7000
  return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
@@ -6537,6 +7071,11 @@ return true;`);
6537
7071
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
6538
7072
  return (obj || new Schema()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
6539
7073
  }
7074
+ /**
7075
+ * endianness of the buffer
7076
+ * it is Little Endian by default
7077
+ * if endianness doesn't match the underlying system then the vectors need to be converted
7078
+ */
6540
7079
  endianness() {
6541
7080
  const offset = this.bb.__offset(this.bb_pos, 4);
6542
7081
  return offset ? this.bb.readInt16(this.bb_pos + offset) : Endianness.Little;
@@ -6557,6 +7096,9 @@ return true;`);
6557
7096
  const offset = this.bb.__offset(this.bb_pos, 8);
6558
7097
  return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
6559
7098
  }
7099
+ /**
7100
+ * Features used in the stream/file.
7101
+ */
6560
7102
  features(index) {
6561
7103
  const offset = this.bb.__offset(this.bb_pos, 10);
6562
7104
  return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
@@ -6672,6 +7214,9 @@ return true;`);
6672
7214
  const offset = this.bb.__offset(this.bb_pos, 10);
6673
7215
  return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
6674
7216
  }
7217
+ /**
7218
+ * User-defined metadata
7219
+ */
6675
7220
  customMetadata(index, obj) {
6676
7221
  const offset = this.bb.__offset(this.bb_pos, 12);
6677
7222
  return offset ? (obj || new KeyValue()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
@@ -6728,9 +7273,9 @@ return true;`);
6728
7273
 
6729
7274
  // ../../node_modules/apache-arrow/schema.mjs
6730
7275
  var Schema2 = class {
6731
- constructor(fields = [], metadata2, dictionaries) {
7276
+ constructor(fields = [], metadata, dictionaries) {
6732
7277
  this.fields = fields || [];
6733
- this.metadata = metadata2 || new Map();
7278
+ this.metadata = metadata || /* @__PURE__ */ new Map();
6734
7279
  if (!dictionaries) {
6735
7280
  dictionaries = generateDictionaryMap(fields);
6736
7281
  }
@@ -6745,11 +7290,23 @@ return true;`);
6745
7290
  toString() {
6746
7291
  return `Schema<{ ${this.fields.map((f, i) => `${i}: ${f}`).join(", ")} }>`;
6747
7292
  }
7293
+ /**
7294
+ * Construct a new Schema containing only specified fields.
7295
+ *
7296
+ * @param fieldNames Names of fields to keep.
7297
+ * @returns A new Schema of fields matching the specified names.
7298
+ */
6748
7299
  select(fieldNames) {
6749
7300
  const names = new Set(fieldNames);
6750
7301
  const fields = this.fields.filter((f) => names.has(f.name));
6751
7302
  return new Schema2(fields, this.metadata);
6752
7303
  }
7304
+ /**
7305
+ * Construct a new Schema containing only fields at the specified indices.
7306
+ *
7307
+ * @param fieldIndices Indices of fields to keep.
7308
+ * @returns A new Schema of fields at the specified indices.
7309
+ */
6753
7310
  selectAt(fieldIndices) {
6754
7311
  const fields = fieldIndices.map((i) => this.fields[i]).filter(Boolean);
6755
7312
  return new Schema2(fields, this.metadata);
@@ -6757,36 +7314,37 @@ return true;`);
6757
7314
  assign(...args) {
6758
7315
  const other = args[0] instanceof Schema2 ? args[0] : Array.isArray(args[0]) ? new Schema2(args[0]) : new Schema2(args);
6759
7316
  const curFields = [...this.fields];
6760
- const metadata2 = mergeMaps(mergeMaps(new Map(), this.metadata), other.metadata);
7317
+ const metadata = mergeMaps(mergeMaps(/* @__PURE__ */ new Map(), this.metadata), other.metadata);
6761
7318
  const newFields = other.fields.filter((f2) => {
6762
7319
  const i = curFields.findIndex((f) => f.name === f2.name);
6763
7320
  return ~i ? (curFields[i] = f2.clone({
6764
- metadata: mergeMaps(mergeMaps(new Map(), curFields[i].metadata), f2.metadata)
7321
+ metadata: mergeMaps(mergeMaps(/* @__PURE__ */ new Map(), curFields[i].metadata), f2.metadata)
6765
7322
  })) && false : true;
6766
7323
  });
6767
- const newDictionaries = generateDictionaryMap(newFields, new Map());
6768
- return new Schema2([...curFields, ...newFields], metadata2, new Map([...this.dictionaries, ...newDictionaries]));
7324
+ const newDictionaries = generateDictionaryMap(newFields, /* @__PURE__ */ new Map());
7325
+ return new Schema2([...curFields, ...newFields], metadata, new Map([...this.dictionaries, ...newDictionaries]));
6769
7326
  }
6770
7327
  };
6771
7328
  Schema2.prototype.fields = null;
6772
7329
  Schema2.prototype.metadata = null;
6773
7330
  Schema2.prototype.dictionaries = null;
6774
7331
  var Field2 = class {
7332
+ /** @nocollapse */
6775
7333
  static new(...args) {
6776
- let [name, type, nullable, metadata2] = args;
7334
+ let [name, type, nullable, metadata] = args;
6777
7335
  if (args[0] && typeof args[0] === "object") {
6778
7336
  ({ name } = args[0]);
6779
7337
  type === void 0 && (type = args[0].type);
6780
7338
  nullable === void 0 && (nullable = args[0].nullable);
6781
- metadata2 === void 0 && (metadata2 = args[0].metadata);
7339
+ metadata === void 0 && (metadata = args[0].metadata);
6782
7340
  }
6783
- return new Field2(`${name}`, type, nullable, metadata2);
7341
+ return new Field2(`${name}`, type, nullable, metadata);
6784
7342
  }
6785
- constructor(name, type, nullable = false, metadata2) {
7343
+ constructor(name, type, nullable = false, metadata) {
6786
7344
  this.name = name;
6787
7345
  this.type = type;
6788
7346
  this.nullable = nullable;
6789
- this.metadata = metadata2 || new Map();
7347
+ this.metadata = metadata || /* @__PURE__ */ new Map();
6790
7348
  }
6791
7349
  get typeId() {
6792
7350
  return this.type.typeId;
@@ -6798,9 +7356,9 @@ return true;`);
6798
7356
  return `${this.name}: ${this.type}`;
6799
7357
  }
6800
7358
  clone(...args) {
6801
- let [name, type, nullable, metadata2] = args;
6802
- !args[0] || typeof args[0] !== "object" ? [name = this.name, type = this.type, nullable = this.nullable, metadata2 = this.metadata] = args : { name = this.name, type = this.type, nullable = this.nullable, metadata: metadata2 = this.metadata } = args[0];
6803
- return Field2.new(name, type, nullable, metadata2);
7359
+ let [name, type, nullable, metadata] = args;
7360
+ !args[0] || typeof args[0] !== "object" ? [name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata] = args : { name = this.name, type = this.type, nullable = this.nullable, metadata = this.metadata } = args[0];
7361
+ return Field2.new(name, type, nullable, metadata);
6804
7362
  }
6805
7363
  };
6806
7364
  Field2.prototype.type = null;
@@ -6808,9 +7366,9 @@ return true;`);
6808
7366
  Field2.prototype.nullable = null;
6809
7367
  Field2.prototype.metadata = null;
6810
7368
  function mergeMaps(m1, m2) {
6811
- return new Map([...m1 || new Map(), ...m2 || new Map()]);
7369
+ return new Map([...m1 || /* @__PURE__ */ new Map(), ...m2 || /* @__PURE__ */ new Map()]);
6812
7370
  }
6813
- function generateDictionaryMap(fields, dictionaries = new Map()) {
7371
+ function generateDictionaryMap(fields, dictionaries = /* @__PURE__ */ new Map()) {
6814
7372
  for (let i = -1, n = fields.length; ++i < n; ) {
6815
7373
  const field = fields[i];
6816
7374
  const type = field.type;
@@ -6832,12 +7390,14 @@ return true;`);
6832
7390
  var Builder3 = Builder2;
6833
7391
  var ByteBuffer2 = ByteBuffer;
6834
7392
  var Footer_ = class {
7393
+ /** @nocollapse */
6835
7394
  static decode(buf) {
6836
7395
  buf = new ByteBuffer2(toUint8Array(buf));
6837
7396
  const footer = Footer.getRootAsFooter(buf);
6838
7397
  const schema = Schema2.decode(footer.schema());
6839
7398
  return new OffHeapFooter(schema, footer);
6840
7399
  }
7400
+ /** @nocollapse */
6841
7401
  static encode(footer) {
6842
7402
  const b = new Builder3();
6843
7403
  const schemaOffset = Schema2.encode(b, footer.schema);
@@ -6923,9 +7483,11 @@ return true;`);
6923
7483
  }
6924
7484
  };
6925
7485
  var FileBlock = class {
7486
+ /** @nocollapse */
6926
7487
  static decode(block) {
6927
7488
  return new FileBlock(block.metaDataLength(), block.bodyLength(), block.offset());
6928
7489
  }
7490
+ /** @nocollapse */
6929
7491
  static encode(b, fileBlock) {
6930
7492
  const { metaDataLength } = fileBlock;
6931
7493
  const offset = BigInt(fileBlock.offset);
@@ -7456,12 +8018,15 @@ return true;`);
7456
8018
  this._plus(other);
7457
8019
  return this;
7458
8020
  }
8021
+ /** @nocollapse */
7459
8022
  static from(val, out_buffer = new Uint32Array(2)) {
7460
8023
  return Uint642.fromString(typeof val === "string" ? val : val.toString(), out_buffer);
7461
8024
  }
8025
+ /** @nocollapse */
7462
8026
  static fromNumber(num, out_buffer = new Uint32Array(2)) {
7463
8027
  return Uint642.fromString(num.toString(), out_buffer);
7464
8028
  }
8029
+ /** @nocollapse */
7465
8030
  static fromString(str, out_buffer = new Uint32Array(2)) {
7466
8031
  const length = str.length;
7467
8032
  const out = new Uint642(out_buffer);
@@ -7475,6 +8040,7 @@ return true;`);
7475
8040
  }
7476
8041
  return out;
7477
8042
  }
8043
+ /** @nocollapse */
7478
8044
  static convertArray(values) {
7479
8045
  const data = new Uint32Array(values.length * 2);
7480
8046
  for (let i = -1, n = values.length; ++i < n; ) {
@@ -7482,10 +8048,12 @@ return true;`);
7482
8048
  }
7483
8049
  return data;
7484
8050
  }
8051
+ /** @nocollapse */
7485
8052
  static multiply(left, right) {
7486
8053
  const rtrn = new Uint642(new Uint32Array(left.buffer));
7487
8054
  return rtrn.times(right);
7488
8055
  }
8056
+ /** @nocollapse */
7489
8057
  static add(left, right) {
7490
8058
  const rtrn = new Uint642(new Uint32Array(left.buffer));
7491
8059
  return rtrn.plus(right);
@@ -7513,12 +8081,15 @@ return true;`);
7513
8081
  const other_high = other.buffer[1] << 0;
7514
8082
  return this_high < other_high || this_high === other_high && this.buffer[0] < other.buffer[0];
7515
8083
  }
8084
+ /** @nocollapse */
7516
8085
  static from(val, out_buffer = new Uint32Array(2)) {
7517
8086
  return Int642.fromString(typeof val === "string" ? val : val.toString(), out_buffer);
7518
8087
  }
8088
+ /** @nocollapse */
7519
8089
  static fromNumber(num, out_buffer = new Uint32Array(2)) {
7520
8090
  return Int642.fromString(num.toString(), out_buffer);
7521
8091
  }
8092
+ /** @nocollapse */
7522
8093
  static fromString(str, out_buffer = new Uint32Array(2)) {
7523
8094
  const negate = str.startsWith("-");
7524
8095
  const length = str.length;
@@ -7533,6 +8104,7 @@ return true;`);
7533
8104
  }
7534
8105
  return negate ? out.negate() : out;
7535
8106
  }
8107
+ /** @nocollapse */
7536
8108
  static convertArray(values) {
7537
8109
  const data = new Uint32Array(values.length * 2);
7538
8110
  for (let i = -1, n = values.length; ++i < n; ) {
@@ -7540,10 +8112,12 @@ return true;`);
7540
8112
  }
7541
8113
  return data;
7542
8114
  }
8115
+ /** @nocollapse */
7543
8116
  static multiply(left, right) {
7544
8117
  const rtrn = new Int642(new Uint32Array(left.buffer));
7545
8118
  return rtrn.times(right);
7546
8119
  }
8120
+ /** @nocollapse */
7547
8121
  static add(left, right) {
7548
8122
  const rtrn = new Int642(new Uint32Array(left.buffer));
7549
8123
  return rtrn.plus(right);
@@ -7623,20 +8197,25 @@ return true;`);
7623
8197
  hex() {
7624
8198
  return `${intAsHex(this.buffer[3])} ${intAsHex(this.buffer[2])} ${intAsHex(this.buffer[1])} ${intAsHex(this.buffer[0])}`;
7625
8199
  }
8200
+ /** @nocollapse */
7626
8201
  static multiply(left, right) {
7627
8202
  const rtrn = new Int128(new Uint32Array(left.buffer));
7628
8203
  return rtrn.times(right);
7629
8204
  }
8205
+ /** @nocollapse */
7630
8206
  static add(left, right) {
7631
8207
  const rtrn = new Int128(new Uint32Array(left.buffer));
7632
8208
  return rtrn.plus(right);
7633
8209
  }
8210
+ /** @nocollapse */
7634
8211
  static from(val, out_buffer = new Uint32Array(4)) {
7635
8212
  return Int128.fromString(typeof val === "string" ? val : val.toString(), out_buffer);
7636
8213
  }
8214
+ /** @nocollapse */
7637
8215
  static fromNumber(num, out_buffer = new Uint32Array(4)) {
7638
8216
  return Int128.fromString(num.toString(), out_buffer);
7639
8217
  }
8218
+ /** @nocollapse */
7640
8219
  static fromString(str, out_buffer = new Uint32Array(4)) {
7641
8220
  const negate = str.startsWith("-");
7642
8221
  const length = str.length;
@@ -7651,6 +8230,7 @@ return true;`);
7651
8230
  }
7652
8231
  return negate ? out.negate() : out;
7653
8232
  }
8233
+ /** @nocollapse */
7654
8234
  static convertArray(values) {
7655
8235
  const data = new Uint32Array(values.length * 4);
7656
8236
  for (let i = -1, n = values.length; ++i < n; ) {
@@ -7865,7 +8445,7 @@ return true;`);
7865
8445
  super({ type: new Dictionary(type.dictionary, type.indices, type.id, type.isOrdered) });
7866
8446
  this._nulls = null;
7867
8447
  this._dictionaryOffset = 0;
7868
- this._keysToIndices = Object.create(null);
8448
+ this._keysToIndices = /* @__PURE__ */ Object.create(null);
7869
8449
  this.indices = makeBuilder({ "type": this.type.indices, "nullValues": nulls });
7870
8450
  this.dictionary = makeBuilder({ "type": this.type.dictionary, "nullValues": null });
7871
8451
  if (typeof hashFn === "function") {
@@ -7923,7 +8503,7 @@ return true;`);
7923
8503
  this.indices.finish();
7924
8504
  this.dictionary.finish();
7925
8505
  this._dictionaryOffset = 0;
7926
- this._keysToIndices = Object.create(null);
8506
+ this._keysToIndices = /* @__PURE__ */ Object.create(null);
7927
8507
  return super.finish();
7928
8508
  }
7929
8509
  clear() {
@@ -8049,7 +8629,7 @@ return true;`);
8049
8629
  }
8050
8630
  setValue(index, value) {
8051
8631
  const row = value instanceof Map ? value : new Map(Object.entries(value));
8052
- const pending = this._pending || (this._pending = new Map());
8632
+ const pending = this._pending || (this._pending = /* @__PURE__ */ new Map());
8053
8633
  const current = pending.get(index);
8054
8634
  current && (this._pendingLength -= current.size);
8055
8635
  this._pendingLength += row.size;
@@ -8083,6 +8663,7 @@ return true;`);
8083
8663
 
8084
8664
  // ../../node_modules/apache-arrow/builder/null.mjs
8085
8665
  var NullBuilder = class extends Builder {
8666
+ // @ts-ignore
8086
8667
  setValue(index, value) {
8087
8668
  }
8088
8669
  setValid(index, valid) {
@@ -8104,6 +8685,7 @@ return true;`);
8104
8685
  return type.children.forEach((f, i) => children[i].set(index, value[f.name]));
8105
8686
  }
8106
8687
  }
8688
+ /** @inheritdoc */
8107
8689
  setValid(index, valid) {
8108
8690
  if (!super.setValid(index, valid)) {
8109
8691
  this.children.forEach((child) => child.setValid(index, valid));
@@ -8188,6 +8770,8 @@ return true;`);
8188
8770
  this.type = new Union_(mode, [...typeIds, childTypeId], fields);
8189
8771
  return childTypeId;
8190
8772
  }
8773
+ /** @ignore */
8774
+ // @ts-ignore
8191
8775
  _valueToChildTypeId(builder, value, offset) {
8192
8776
  throw new Error(`Cannot map UnionBuilder value to child typeId. Pass the \`childTypeId\` as the second argument to unionBuilder.append(), or supply a \`valueToChildTypeId\` function as part of the UnionBuilder constructor options.`);
8193
8777
  }
@@ -8199,6 +8783,7 @@ return true;`);
8199
8783
  super(options);
8200
8784
  this._offsets = new DataBufferBuilder(new Int32Array(0));
8201
8785
  }
8786
+ /** @ignore */
8202
8787
  setValue(index, value, childTypeId) {
8203
8788
  const id = this._typeIds.set(index, childTypeId).buffer[index];
8204
8789
  const child = this.getChildAt(this.type.typeIdToChildIndex[id]);
@@ -8223,6 +8808,7 @@ return true;`);
8223
8808
  setValue(index, value) {
8224
8809
  return super.setValue(index, encodeUtf8(value));
8225
8810
  }
8811
+ // @ts-ignore
8226
8812
  _flushPending(pending, pendingLength) {
8227
8813
  }
8228
8814
  };
@@ -8611,64 +9197,141 @@ return true;`);
8611
9197
  this.batches = batches;
8612
9198
  this._offsets = offsets !== null && offsets !== void 0 ? offsets : computeChunkOffsets(this.data);
8613
9199
  }
9200
+ /**
9201
+ * The contiguous {@link RecordBatch `RecordBatch`} chunks of the Table rows.
9202
+ */
8614
9203
  get data() {
8615
9204
  return this.batches.map(({ data }) => data);
8616
9205
  }
9206
+ /**
9207
+ * The number of columns in this Table.
9208
+ */
8617
9209
  get numCols() {
8618
9210
  return this.schema.fields.length;
8619
9211
  }
9212
+ /**
9213
+ * The number of rows in this Table.
9214
+ */
8620
9215
  get numRows() {
8621
9216
  return this.data.reduce((numRows, data) => numRows + data.length, 0);
8622
9217
  }
9218
+ /**
9219
+ * The number of null rows in this Table.
9220
+ */
8623
9221
  get nullCount() {
8624
9222
  if (this._nullCount === -1) {
8625
9223
  this._nullCount = computeChunkNullCounts(this.data);
8626
9224
  }
8627
9225
  return this._nullCount;
8628
9226
  }
9227
+ /**
9228
+ * Check whether an element is null.
9229
+ *
9230
+ * @param index The index at which to read the validity bitmap.
9231
+ */
9232
+ // @ts-ignore
8629
9233
  isValid(index) {
8630
9234
  return false;
8631
9235
  }
9236
+ /**
9237
+ * Get an element value by position.
9238
+ *
9239
+ * @param index The index of the element to read.
9240
+ */
9241
+ // @ts-ignore
8632
9242
  get(index) {
8633
9243
  return null;
8634
9244
  }
9245
+ /**
9246
+ * Set an element value by position.
9247
+ *
9248
+ * @param index The index of the element to write.
9249
+ * @param value The value to set.
9250
+ */
9251
+ // @ts-ignore
8635
9252
  set(index, value) {
8636
9253
  return;
8637
9254
  }
9255
+ /**
9256
+ * Retrieve the index of the first occurrence of a value in an Vector.
9257
+ *
9258
+ * @param element The value to locate in the Vector.
9259
+ * @param offset The index at which to begin the search. If offset is omitted, the search starts at index 0.
9260
+ */
9261
+ // @ts-ignore
8638
9262
  indexOf(element, offset) {
8639
9263
  return -1;
8640
9264
  }
9265
+ /**
9266
+ * Get the size in bytes of an element by index.
9267
+ * @param index The index at which to get the byteLength.
9268
+ */
9269
+ // @ts-ignore
8641
9270
  getByteLength(index) {
8642
9271
  return 0;
8643
9272
  }
9273
+ /**
9274
+ * Iterator for rows in this Table.
9275
+ */
8644
9276
  [Symbol.iterator]() {
8645
9277
  if (this.batches.length > 0) {
8646
9278
  return instance4.visit(new Vector(this.data));
8647
9279
  }
8648
9280
  return new Array(0)[Symbol.iterator]();
8649
9281
  }
9282
+ /**
9283
+ * Return a JavaScript Array of the Table rows.
9284
+ *
9285
+ * @returns An Array of Table rows.
9286
+ */
8650
9287
  toArray() {
8651
9288
  return [...this];
8652
9289
  }
9290
+ /**
9291
+ * Returns a string representation of the Table rows.
9292
+ *
9293
+ * @returns A string representation of the Table rows.
9294
+ */
8653
9295
  toString() {
8654
9296
  return `[
8655
9297
  ${this.toArray().join(",\n ")}
8656
9298
  ]`;
8657
9299
  }
9300
+ /**
9301
+ * Combines two or more Tables of the same schema.
9302
+ *
9303
+ * @param others Additional Tables to add to the end of this Tables.
9304
+ */
8658
9305
  concat(...others) {
8659
9306
  const schema = this.schema;
8660
9307
  const data = this.data.concat(others.flatMap(({ data: data2 }) => data2));
8661
9308
  return new Table(schema, data.map((data2) => new RecordBatch(schema, data2)));
8662
9309
  }
9310
+ /**
9311
+ * Return a zero-copy sub-section of this Table.
9312
+ *
9313
+ * @param begin The beginning of the specified portion of the Table.
9314
+ * @param end The end of the specified portion of the Table. This is exclusive of the element at the index 'end'.
9315
+ */
8663
9316
  slice(begin, end) {
8664
9317
  const schema = this.schema;
8665
9318
  [begin, end] = clampRange({ length: this.numRows }, begin, end);
8666
9319
  const data = sliceChunks(this.data, this._offsets, begin, end);
8667
9320
  return new Table(schema, data.map((chunk) => new RecordBatch(schema, chunk)));
8668
9321
  }
9322
+ /**
9323
+ * Returns a child Vector by name, or null if this Vector has no child with the given name.
9324
+ *
9325
+ * @param name The name of the child to retrieve.
9326
+ */
8669
9327
  getChild(name) {
8670
9328
  return this.getChildAt(this.schema.fields.findIndex((f) => f.name === name));
8671
9329
  }
9330
+ /**
9331
+ * Returns a child Vector by index, or null if this Vector has no child at the supplied index.
9332
+ *
9333
+ * @param index The index of the child to retrieve.
9334
+ */
8672
9335
  getChildAt(index) {
8673
9336
  if (index > -1 && index < this.schema.fields.length) {
8674
9337
  const data = this.data.map((data2) => data2.children[index]);
@@ -8681,6 +9344,12 @@ return true;`);
8681
9344
  }
8682
9345
  return null;
8683
9346
  }
9347
+ /**
9348
+ * Sets a child Vector by name.
9349
+ *
9350
+ * @param name The name of the child to overwrite.
9351
+ * @returns A new Table with the supplied child for the specified name.
9352
+ */
8684
9353
  setChild(name, child) {
8685
9354
  var _b2;
8686
9355
  return this.setChildAt((_b2 = this.schema.fields) === null || _b2 === void 0 ? void 0 : _b2.findIndex((f) => f.name === name), child);
@@ -8700,10 +9369,22 @@ return true;`);
8700
9369
  }
8701
9370
  return new Table(schema, batches);
8702
9371
  }
9372
+ /**
9373
+ * Construct a new Table containing only specified columns.
9374
+ *
9375
+ * @param columnNames Names of columns to keep.
9376
+ * @returns A new Table of columns matching the specified names.
9377
+ */
8703
9378
  select(columnNames) {
8704
- const nameToIndex = this.schema.fields.reduce((m, f, i) => m.set(f.name, i), new Map());
9379
+ const nameToIndex = this.schema.fields.reduce((m, f, i) => m.set(f.name, i), /* @__PURE__ */ new Map());
8705
9380
  return this.selectAt(columnNames.map((columnName) => nameToIndex.get(columnName)).filter((x) => x > -1));
8706
9381
  }
9382
+ /**
9383
+ * Construct a new Table containing only columns at the specified indices.
9384
+ *
9385
+ * @param columnIndices Indices of columns to keep.
9386
+ * @returns A new Table of columns at the specified indices.
9387
+ */
8707
9388
  selectAt(columnIndices) {
8708
9389
  const schema = this.schema.selectAt(columnIndices);
8709
9390
  const data = this.batches.map((batch) => batch.selectAt(columnIndices));
@@ -8788,53 +9469,113 @@ return true;`);
8788
9469
  get dictionaries() {
8789
9470
  return this._dictionaries || (this._dictionaries = collectDictionaries(this.schema.fields, this.data.children));
8790
9471
  }
9472
+ /**
9473
+ * The number of columns in this RecordBatch.
9474
+ */
8791
9475
  get numCols() {
8792
9476
  return this.schema.fields.length;
8793
9477
  }
9478
+ /**
9479
+ * The number of rows in this RecordBatch.
9480
+ */
8794
9481
  get numRows() {
8795
9482
  return this.data.length;
8796
9483
  }
9484
+ /**
9485
+ * The number of null rows in this RecordBatch.
9486
+ */
8797
9487
  get nullCount() {
8798
9488
  return this.data.nullCount;
8799
9489
  }
9490
+ /**
9491
+ * Check whether an element is null.
9492
+ * @param index The index at which to read the validity bitmap.
9493
+ */
8800
9494
  isValid(index) {
8801
9495
  return this.data.getValid(index);
8802
9496
  }
9497
+ /**
9498
+ * Get a row by position.
9499
+ * @param index The index of the element to read.
9500
+ */
8803
9501
  get(index) {
8804
9502
  return instance2.visit(this.data, index);
8805
9503
  }
9504
+ /**
9505
+ * Set a row by position.
9506
+ * @param index The index of the element to write.
9507
+ * @param value The value to set.
9508
+ */
8806
9509
  set(index, value) {
8807
9510
  return instance.visit(this.data, index, value);
8808
9511
  }
9512
+ /**
9513
+ * Retrieve the index of the first occurrence of a row in an RecordBatch.
9514
+ * @param element The row to locate in the RecordBatch.
9515
+ * @param offset The index at which to begin the search. If offset is omitted, the search starts at index 0.
9516
+ */
8809
9517
  indexOf(element, offset) {
8810
9518
  return instance3.visit(this.data, element, offset);
8811
9519
  }
9520
+ /**
9521
+ * Get the size (in bytes) of a row by index.
9522
+ * @param index The row index for which to compute the byteLength.
9523
+ */
8812
9524
  getByteLength(index) {
8813
9525
  return instance5.visit(this.data, index);
8814
9526
  }
9527
+ /**
9528
+ * Iterator for rows in this RecordBatch.
9529
+ */
8815
9530
  [Symbol.iterator]() {
8816
9531
  return instance4.visit(new Vector([this.data]));
8817
9532
  }
9533
+ /**
9534
+ * Return a JavaScript Array of the RecordBatch rows.
9535
+ * @returns An Array of RecordBatch rows.
9536
+ */
8818
9537
  toArray() {
8819
9538
  return [...this];
8820
9539
  }
9540
+ /**
9541
+ * Combines two or more RecordBatch of the same schema.
9542
+ * @param others Additional RecordBatch to add to the end of this RecordBatch.
9543
+ */
8821
9544
  concat(...others) {
8822
9545
  return new Table(this.schema, [this, ...others]);
8823
9546
  }
9547
+ /**
9548
+ * Return a zero-copy sub-section of this RecordBatch.
9549
+ * @param start The beginning of the specified portion of the RecordBatch.
9550
+ * @param end The end of the specified portion of the RecordBatch. This is exclusive of the element at the index 'end'.
9551
+ */
8824
9552
  slice(begin, end) {
8825
9553
  const [slice] = new Vector([this.data]).slice(begin, end).data;
8826
9554
  return new RecordBatch(this.schema, slice);
8827
9555
  }
9556
+ /**
9557
+ * Returns a child Vector by name, or null if this Vector has no child with the given name.
9558
+ * @param name The name of the child to retrieve.
9559
+ */
8828
9560
  getChild(name) {
8829
9561
  var _b2;
8830
9562
  return this.getChildAt((_b2 = this.schema.fields) === null || _b2 === void 0 ? void 0 : _b2.findIndex((f) => f.name === name));
8831
9563
  }
9564
+ /**
9565
+ * Returns a child Vector by index, or null if this Vector has no child at the supplied index.
9566
+ * @param index The index of the child to retrieve.
9567
+ */
8832
9568
  getChildAt(index) {
8833
9569
  if (index > -1 && index < this.schema.fields.length) {
8834
9570
  return new Vector([this.data.children[index]]);
8835
9571
  }
8836
9572
  return null;
8837
9573
  }
9574
+ /**
9575
+ * Sets a child Vector by name.
9576
+ * @param name The name of the child to overwrite.
9577
+ * @returns A new RecordBatch with the new child for the specified name.
9578
+ */
8838
9579
  setChild(name, child) {
8839
9580
  var _b2;
8840
9581
  return this.setChildAt((_b2 = this.schema.fields) === null || _b2 === void 0 ? void 0 : _b2.findIndex((f) => f.name === name), child);
@@ -8855,6 +9596,12 @@ return true;`);
8855
9596
  }
8856
9597
  return new RecordBatch(schema, data);
8857
9598
  }
9599
+ /**
9600
+ * Construct a new RecordBatch containing only specified columns.
9601
+ *
9602
+ * @param columnNames Names of columns to keep.
9603
+ * @returns A new RecordBatch of columns matching the specified names.
9604
+ */
8858
9605
  select(columnNames) {
8859
9606
  const schema = this.schema.select(columnNames);
8860
9607
  const type = new Struct(schema.fields);
@@ -8867,6 +9614,12 @@ return true;`);
8867
9614
  }
8868
9615
  return new RecordBatch(schema, makeData({ type, length: this.numRows, children }));
8869
9616
  }
9617
+ /**
9618
+ * Construct a new RecordBatch containing only columns at the specified indices.
9619
+ *
9620
+ * @param columnIndices Indices of columns to keep.
9621
+ * @returns A new RecordBatch of columns matching at the specified indices.
9622
+ */
8870
9623
  selectAt(columnIndices) {
8871
9624
  const schema = this.schema.selectAt(columnIndices);
8872
9625
  const children = columnIndices.map((i) => this.data.children[i]).filter(Boolean);
@@ -8902,7 +9655,7 @@ return true;`);
8902
9655
  makeData({ type: new Struct(fields), length: maxLength, children })
8903
9656
  ];
8904
9657
  }
8905
- function collectDictionaries(fields, children, dictionaries = new Map()) {
9658
+ function collectDictionaries(fields, children, dictionaries = /* @__PURE__ */ new Map()) {
8906
9659
  for (let i = -1, n = fields.length; ++i < n; ) {
8907
9660
  const field = fields[i];
8908
9661
  const type = field.type;
@@ -8961,10 +9714,17 @@ return true;`);
8961
9714
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
8962
9715
  return (obj || new BodyCompression()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
8963
9716
  }
9717
+ /**
9718
+ * Compressor library.
9719
+ * For LZ4_FRAME, each compressed buffer must consist of a single frame.
9720
+ */
8964
9721
  codec() {
8965
9722
  const offset = this.bb.__offset(this.bb_pos, 4);
8966
9723
  return offset ? this.bb.readInt8(this.bb_pos + offset) : CompressionType.LZ4_FRAME;
8967
9724
  }
9725
+ /**
9726
+ * Indicates the way the record batch body was compressed
9727
+ */
8968
9728
  method() {
8969
9729
  const offset = this.bb.__offset(this.bb_pos, 6);
8970
9730
  return offset ? this.bb.readInt8(this.bb_pos + offset) : BodyCompressionMethod.BUFFER;
@@ -9001,9 +9761,20 @@ return true;`);
9001
9761
  this.bb = bb;
9002
9762
  return this;
9003
9763
  }
9764
+ /**
9765
+ * The relative offset into the shared memory page where the bytes for this
9766
+ * buffer starts
9767
+ */
9004
9768
  offset() {
9005
9769
  return this.bb.readInt64(this.bb_pos);
9006
9770
  }
9771
+ /**
9772
+ * The absolute length (in bytes) of the memory buffer. The memory is found
9773
+ * from offset (inclusive) to offset + length (non-inclusive). When building
9774
+ * messages using the encapsulated IPC message, padding bytes may be written
9775
+ * after a buffer, but such padding bytes do not need to be accounted for in
9776
+ * the size here.
9777
+ */
9007
9778
  length() {
9008
9779
  return this.bb.readInt64(this.bb_pos + 8);
9009
9780
  }
@@ -9029,9 +9800,18 @@ return true;`);
9029
9800
  this.bb = bb;
9030
9801
  return this;
9031
9802
  }
9803
+ /**
9804
+ * The number of value slots in the Arrow array at this level of a nested
9805
+ * tree
9806
+ */
9032
9807
  length() {
9033
9808
  return this.bb.readInt64(this.bb_pos);
9034
9809
  }
9810
+ /**
9811
+ * The number of observed nulls. Fields with null_count == 0 may choose not
9812
+ * to write their physical validity bitmap out as a materialized buffer,
9813
+ * instead setting the length of the bitmap buffer to 0.
9814
+ */
9035
9815
  nullCount() {
9036
9816
  return this.bb.readInt64(this.bb_pos + 8);
9037
9817
  }
@@ -9064,10 +9844,17 @@ return true;`);
9064
9844
  bb.setPosition(bb.position() + SIZE_PREFIX_LENGTH);
9065
9845
  return (obj || new RecordBatch2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
9066
9846
  }
9847
+ /**
9848
+ * number of records / rows. The arrays in the batch should all have this
9849
+ * length
9850
+ */
9067
9851
  length() {
9068
9852
  const offset = this.bb.__offset(this.bb_pos, 4);
9069
9853
  return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
9070
9854
  }
9855
+ /**
9856
+ * Nodes correspond to the pre-ordered flattened logical schema
9857
+ */
9071
9858
  nodes(index, obj) {
9072
9859
  const offset = this.bb.__offset(this.bb_pos, 6);
9073
9860
  return offset ? (obj || new FieldNode()).__init(this.bb.__vector(this.bb_pos + offset) + index * 16, this.bb) : null;
@@ -9076,6 +9863,14 @@ return true;`);
9076
9863
  const offset = this.bb.__offset(this.bb_pos, 6);
9077
9864
  return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
9078
9865
  }
9866
+ /**
9867
+ * Buffers correspond to the pre-ordered flattened buffer tree
9868
+ *
9869
+ * The number of buffers appended to this list depends on the schema. For
9870
+ * example, most primitive arrays will have 2 buffers, 1 for the validity
9871
+ * bitmap and 1 for the values. For struct arrays, there will only be a
9872
+ * single buffer for the validity (nulls) bitmap
9873
+ */
9079
9874
  buffers(index, obj) {
9080
9875
  const offset = this.bb.__offset(this.bb_pos, 8);
9081
9876
  return offset ? (obj || new Buffer2()).__init(this.bb.__vector(this.bb_pos + offset) + index * 16, this.bb) : null;
@@ -9084,6 +9879,9 @@ return true;`);
9084
9879
  const offset = this.bb.__offset(this.bb_pos, 8);
9085
9880
  return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
9086
9881
  }
9882
+ /**
9883
+ * Optional compression of the message body
9884
+ */
9087
9885
  compression(obj) {
9088
9886
  const offset = this.bb.__offset(this.bb_pos, 10);
9089
9887
  return offset ? (obj || new BodyCompression()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
@@ -9141,6 +9939,11 @@ return true;`);
9141
9939
  const offset = this.bb.__offset(this.bb_pos, 6);
9142
9940
  return offset ? (obj || new RecordBatch2()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
9143
9941
  }
9942
+ /**
9943
+ * If isDelta is true the values in the dictionary are to be appended to a
9944
+ * dictionary with the indicated id. If isDelta is false this dictionary
9945
+ * should replace the existing dictionary.
9946
+ */
9144
9947
  isDelta() {
9145
9948
  const offset = this.bb.__offset(this.bb_pos, 8);
9146
9949
  return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
@@ -9374,7 +10177,7 @@ return true;`);
9374
10177
  var instance8 = new TypeAssembler();
9375
10178
 
9376
10179
  // ../../node_modules/apache-arrow/ipc/metadata/json.mjs
9377
- function schemaFromJSON(_schema, dictionaries = new Map()) {
10180
+ function schemaFromJSON(_schema, dictionaries = /* @__PURE__ */ new Map()) {
9378
10181
  return new Schema2(schemaFieldsFromJSON(_schema, dictionaries), customMetadataFromJSON(_schema["customMetadata"]), dictionaries);
9379
10182
  }
9380
10183
  function recordBatchFromJSON(b) {
@@ -9511,11 +10314,13 @@ return true;`);
9511
10314
  var Builder4 = Builder2;
9512
10315
  var ByteBuffer3 = ByteBuffer;
9513
10316
  var Message2 = class {
10317
+ /** @nocollapse */
9514
10318
  static fromJSON(msg, headerType) {
9515
10319
  const message = new Message2(0, MetadataVersion.V4, headerType);
9516
10320
  message._createHeader = messageHeaderFromJSON(msg, headerType);
9517
10321
  return message;
9518
10322
  }
10323
+ /** @nocollapse */
9519
10324
  static decode(buf) {
9520
10325
  buf = new ByteBuffer3(toUint8Array(buf));
9521
10326
  const _message = Message.getRootAsMessage(buf);
@@ -9526,6 +10331,7 @@ return true;`);
9526
10331
  message._createHeader = decodeMessageHeader(_message, headerType);
9527
10332
  return message;
9528
10333
  }
10334
+ /** @nocollapse */
9529
10335
  static encode(message) {
9530
10336
  const b = new Builder4();
9531
10337
  let headerOffset = -1;
@@ -9544,6 +10350,7 @@ return true;`);
9544
10350
  Message.finishMessageBuffer(b, Message.endMessage(b));
9545
10351
  return b.asUint8Array();
9546
10352
  }
10353
+ /** @nocollapse */
9547
10354
  static from(header, bodyLength = 0) {
9548
10355
  if (header instanceof Schema2) {
9549
10356
  return new Message2(0, MetadataVersion.V4, MessageHeader.Schema, header);
@@ -9683,7 +10490,7 @@ return true;`);
9683
10490
  FieldNode2["decode"] = decodeFieldNode;
9684
10491
  BufferRegion["encode"] = encodeBufferRegion;
9685
10492
  BufferRegion["decode"] = decodeBufferRegion;
9686
- function decodeSchema(_schema, dictionaries = new Map()) {
10493
+ function decodeSchema(_schema, dictionaries = /* @__PURE__ */ new Map()) {
9687
10494
  const fields = decodeSchemaFields(_schema, dictionaries);
9688
10495
  return new Schema2(fields, decodeCustomMetadata(_schema), dictionaries);
9689
10496
  }
@@ -9764,7 +10571,7 @@ return true;`);
9764
10571
  return field || null;
9765
10572
  }
9766
10573
  function decodeCustomMetadata(parent) {
9767
- const data = new Map();
10574
+ const data = /* @__PURE__ */ new Map();
9768
10575
  if (parent) {
9769
10576
  for (let entry, key, i = -1, n = Math.trunc(parent.customMetadataLength()); ++i < n; ) {
9770
10577
  if ((entry = parent.customMetadata(i)) && (key = entry.key()) != null) {
@@ -9938,7 +10745,12 @@ return true;`);
9938
10745
  }
9939
10746
  var platformIsLittleEndian = (() => {
9940
10747
  const buffer = new ArrayBuffer(2);
9941
- new DataView(buffer).setInt16(0, 256, true);
10748
+ new DataView(buffer).setInt16(
10749
+ 0,
10750
+ 256,
10751
+ true
10752
+ /* littleEndian */
10753
+ );
9942
10754
  return new Int16Array(buffer)[0] === 256;
9943
10755
  })();
9944
10756
 
@@ -9991,7 +10803,11 @@ return true;`);
9991
10803
  if (buf.byteLength < bodyLength) {
9992
10804
  throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));
9993
10805
  }
9994
- return buf.byteOffset % 8 === 0 && buf.byteOffset + buf.byteLength <= buf.buffer.byteLength ? buf : buf.slice();
10806
+ return (
10807
+ /* 1. */
10808
+ buf.byteOffset % 8 === 0 && /* 2. */
10809
+ buf.byteOffset + buf.byteLength <= buf.buffer.byteLength ? buf : buf.slice()
10810
+ );
9995
10811
  }
9996
10812
  readSchema(throwIfNull = false) {
9997
10813
  const type = MessageHeader.Schema;
@@ -10072,7 +10888,11 @@ return true;`);
10072
10888
  if (buf.byteLength < bodyLength) {
10073
10889
  throw new Error(invalidMessageBodyLength(bodyLength, buf.byteLength));
10074
10890
  }
10075
- return buf.byteOffset % 8 === 0 && buf.byteOffset + buf.byteLength <= buf.buffer.byteLength ? buf : buf.slice();
10891
+ return (
10892
+ /* 1. */
10893
+ buf.byteOffset % 8 === 0 && /* 2. */
10894
+ buf.byteOffset + buf.byteLength <= buf.buffer.byteLength ? buf : buf.slice()
10895
+ );
10076
10896
  });
10077
10897
  }
10078
10898
  readSchema(throwIfNull = false) {
@@ -10265,12 +11085,16 @@ return true;`);
10265
11085
  toNodeStream() {
10266
11086
  return adapters_default.toNodeStream(this.isSync() ? { [Symbol.iterator]: () => this } : { [Symbol.asyncIterator]: () => this }, { objectMode: true });
10267
11087
  }
11088
+ /** @nocollapse */
11089
+ // @ts-ignore
10268
11090
  static throughNode(options) {
10269
11091
  throw new Error(`"throughNode" not available in this environment`);
10270
11092
  }
11093
+ /** @nocollapse */
10271
11094
  static throughDOM(writableStrategy, readableStrategy) {
10272
11095
  throw new Error(`"throughDOM" not available in this environment`);
10273
11096
  }
11097
+ /** @nocollapse */
10274
11098
  static from(source) {
10275
11099
  if (source instanceof RecordBatchReader) {
10276
11100
  return source;
@@ -10287,6 +11111,7 @@ return true;`);
10287
11111
  }
10288
11112
  return fromByteStream(new ByteStream(source));
10289
11113
  }
11114
+ /** @nocollapse */
10290
11115
  static readAll(source) {
10291
11116
  if (source instanceof RecordBatchReader) {
10292
11117
  return source.isSync() ? readAllSync(source) : readAllAsync(source);
@@ -10369,7 +11194,7 @@ return true;`);
10369
11194
  get numRecordBatches() {
10370
11195
  return this._recordBatchIndex;
10371
11196
  }
10372
- constructor(dictionaries = new Map()) {
11197
+ constructor(dictionaries = /* @__PURE__ */ new Map()) {
10373
11198
  this.closed = false;
10374
11199
  this.autoDestroy = true;
10375
11200
  this._dictionaryIndex = 0;
@@ -10392,7 +11217,7 @@ return true;`);
10392
11217
  this._dictionaryIndex = 0;
10393
11218
  this._recordBatchIndex = 0;
10394
11219
  this.schema = schema;
10395
- this.dictionaries = new Map();
11220
+ this.dictionaries = /* @__PURE__ */ new Map();
10396
11221
  return this;
10397
11222
  }
10398
11223
  _loadRecordBatch(header, body) {
@@ -10823,6 +11648,7 @@ return true;`);
10823
11648
 
10824
11649
  // ../../node_modules/apache-arrow/visitor/vectorassembler.mjs
10825
11650
  var VectorAssembler = class extends Visitor {
11651
+ /** @nocollapse */
10826
11652
  static assemble(...args) {
10827
11653
  const unwrap = (nodes) => nodes.flatMap((node) => Array.isArray(node) ? unwrap(node) : node instanceof RecordBatch ? node.data.children : node.data);
10828
11654
  const assembler = new VectorAssembler();
@@ -10964,9 +11790,12 @@ return true;`);
10964
11790
 
10965
11791
  // ../../node_modules/apache-arrow/ipc/writer.mjs
10966
11792
  var RecordBatchWriter = class extends ReadableInterop {
11793
+ /** @nocollapse */
11794
+ // @ts-ignore
10967
11795
  static throughNode(options) {
10968
11796
  throw new Error(`"throughNode" not available in this environment`);
10969
11797
  }
11798
+ /** @nocollapse */
10970
11799
  static throughDOM(writableStrategy, readableStrategy) {
10971
11800
  throw new Error(`"throughDOM" not available in this environment`);
10972
11801
  }
@@ -10978,7 +11807,7 @@ return true;`);
10978
11807
  this._schema = null;
10979
11808
  this._dictionaryBlocks = [];
10980
11809
  this._recordBatchBlocks = [];
10981
- this._dictionaryDeltaOffsets = new Map();
11810
+ this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
10982
11811
  isObject(options) || (options = { autoDestroy: true, writeLegacyIpcFormat: false });
10983
11812
  this._autoDestroy = typeof options.autoDestroy === "boolean" ? options.autoDestroy : true;
10984
11813
  this._writeLegacyIpcFormat = typeof options.writeLegacyIpcFormat === "boolean" ? options.writeLegacyIpcFormat : false;
@@ -11036,7 +11865,7 @@ return true;`);
11036
11865
  this._started = false;
11037
11866
  this._dictionaryBlocks = [];
11038
11867
  this._recordBatchBlocks = [];
11039
- this._dictionaryDeltaOffsets = new Map();
11868
+ this._dictionaryDeltaOffsets = /* @__PURE__ */ new Map();
11040
11869
  if (!schema || !compareSchemas(schema, this._schema)) {
11041
11870
  if (schema == null) {
11042
11871
  this._position = 0;
@@ -11110,6 +11939,7 @@ return true;`);
11110
11939
  _writeSchema(schema) {
11111
11940
  return this._writeMessage(Message2.from(schema));
11112
11941
  }
11942
+ // @ts-ignore
11113
11943
  _writeFooter(schema) {
11114
11944
  return this._writeLegacyIpcFormat ? this._write(Int32Array.of(0)) : this._write(Int32Array.of(-1, 0));
11115
11945
  }
@@ -11160,6 +11990,7 @@ return true;`);
11160
11990
  }
11161
11991
  };
11162
11992
  var RecordBatchStreamWriter = class extends RecordBatchWriter {
11993
+ /** @nocollapse */
11163
11994
  static writeAll(input, options) {
11164
11995
  const writer = new RecordBatchStreamWriter(options);
11165
11996
  if (isPromise(input)) {
@@ -11171,6 +12002,7 @@ return true;`);
11171
12002
  }
11172
12003
  };
11173
12004
  var RecordBatchFileWriter = class extends RecordBatchWriter {
12005
+ /** @nocollapse */
11174
12006
  static writeAll(input) {
11175
12007
  const writer = new RecordBatchFileWriter();
11176
12008
  if (isPromise(input)) {
@@ -11184,6 +12016,7 @@ return true;`);
11184
12016
  super();
11185
12017
  this._autoDestroy = true;
11186
12018
  }
12019
+ // @ts-ignore
11187
12020
  _writeSchema(schema) {
11188
12021
  return this._writeMagic()._writePadding(2);
11189
12022
  }
@@ -11439,6 +12272,7 @@ return true;`);
11439
12272
  const writer = new this(writableStrategy);
11440
12273
  const reader = new AsyncByteStream(writer);
11441
12274
  const readable = new ReadableStream({
12275
+ // type: 'bytes',
11442
12276
  cancel() {
11443
12277
  return __awaiter(this, void 0, void 0, function* () {
11444
12278
  yield reader.cancel();
@@ -11500,29 +12334,6 @@ return true;`);
11500
12334
  RecordBatchFileWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
11501
12335
  RecordBatchStreamWriter["throughDOM"] = recordBatchWriterThroughDOMStream;
11502
12336
 
11503
- // src/arrow-loader.ts
11504
- var VERSION = true ? "4.0.0-beta.2" : "latest";
11505
- var ArrowLoader = {
11506
- name: "Apache Arrow",
11507
- id: "arrow",
11508
- module: "arrow",
11509
- version: VERSION,
11510
- category: "table",
11511
- extensions: ["arrow", "feather"],
11512
- mimeTypes: [
11513
- "application/vnd.apache.arrow.file",
11514
- "application/vnd.apache.arrow.stream",
11515
- "application/octet-stream"
11516
- ],
11517
- binary: true,
11518
- tests: ["ARROW"],
11519
- options: {
11520
- arrow: {
11521
- shape: "columnar-table"
11522
- }
11523
- }
11524
- };
11525
-
11526
12337
  // src/lib/convert-table.ts
11527
12338
  function convertApacheArrowToArrowTable(arrowTable) {
11528
12339
  return {
@@ -11593,10 +12404,13 @@ return true;`);
11593
12404
  if (batch) {
11594
12405
  this.arrowSchema = this.arrowSchema || getArrowSchema(batch.schema);
11595
12406
  const arrowVectors = getArrowVectors(this.arrowSchema, batch.data);
11596
- const recordBatch = new RecordBatch(this.arrowSchema, makeData({
11597
- type: new Struct(this.arrowSchema.fields),
11598
- children: arrowVectors.map(({ data }) => data[0])
11599
- }));
12407
+ const recordBatch = new RecordBatch(
12408
+ this.arrowSchema,
12409
+ makeData({
12410
+ type: new Struct(this.arrowSchema.fields),
12411
+ children: arrowVectors.map(({ data }) => data[0])
12412
+ })
12413
+ );
11600
12414
  return {
11601
12415
  shape: "arrow-table",
11602
12416
  batchType: "data",
@@ -11612,8 +12426,8 @@ return true;`);
11612
12426
  for (const key in schema) {
11613
12427
  const field = schema[key];
11614
12428
  if (field.type === Float32Array) {
11615
- const metadata2 = new Map();
11616
- const arrowField = new Field2(field.name, new Float32(), field.nullable, metadata2);
12429
+ const metadata = /* @__PURE__ */ new Map();
12430
+ const arrowField = new Field2(field.name, new Float32(), field.nullable, metadata);
11617
12431
  arrowFields.push(arrowField);
11618
12432
  }
11619
12433
  }